diff options
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index b7113d2b2..44ba84351 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -2990,6 +2990,29 @@ Expression* SExpressionWasmBuilder::makeCallRef(Element& s, bool isReturn) { target, operands, sigType.getSignature().results, isReturn); } +Expression* SExpressionWasmBuilder::makeContBind(Element& s) { + auto ret = allocator.alloc<ContBind>(); + + ret->contTypeBefore = parseHeapType(*s[1]); + if (!ret->contTypeBefore.isContinuation()) { + throw ParseException("expected continuation type", s[1]->line, s[1]->col); + } + ret->contTypeAfter = parseHeapType(*s[2]); + if (!ret->contTypeAfter.isContinuation()) { + throw ParseException("expected continuation type", s[2]->line, s[2]->col); + } + + Index i = 3; + while (i < s.size() - 1) { + ret->operands.push_back(parseExpression(s[i++])); + } + + ret->cont = parseExpression(s[i]); + + ret->finalize(); + return ret; +} + Expression* SExpressionWasmBuilder::makeContNew(Element& s) { auto ret = allocator.alloc<ContNew>(); |