summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm-binary.h1
-rw-r--r--src/wasm-s-parser.h8
2 files changed, 9 insertions, 0 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index a76bf7fa5..e77f3992e 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -469,6 +469,7 @@ class WasmBinaryWriter : public Visitor<WasmBinaryWriter, void> {
if (func->type.isNull()) {
func->type = ensureFunctionType(getSig(func.get()), wasm)->name;
}
+ // TODO: depending on upstream flux https://github.com/WebAssembly/spec/pull/301 might want this: assert(!func->type.isNull());
}
}
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index a48ee1a5f..c6b3809f1 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -498,6 +498,14 @@ private:
body = allocator.alloc<Nop>();
}
if (currFunction->result != result) throw ParseException("bad func declaration", s.line, s.col);
+ /* TODO: spec in flux, https://github.com/WebAssembly/spec/pull/301
+ if (type.isNull()) {
+ // if no function type provided, generate a private one for this function
+ auto* functionType = sigToFunctionType(getSig(currFunction.get()));
+ wasm.addFunctionType(functionType);
+ type = functionType->name;
+ }
+ */
currFunction->body = body;
currFunction->type = type;
wasm.addFunction(currFunction.release());