diff options
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 09cc044bf..d7b3824a9 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -786,6 +786,7 @@ Expression* SExpressionWasmBuilder::makeSetGlobal(Element& s) { Expression* SExpressionWasmBuilder::makeBlock(Element& s) { + if (!currFunction) throw ParseException("block is unallowed outside of functions"); // special-case Block, because Block nesting (in their first element) can be incredibly deep auto curr = allocator.alloc<Block>(); auto* sp = &s; |