diff options
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r-- | src/wasm-s-parser.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index e92f56eea..677052984 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -849,6 +849,15 @@ private: return ret; } + Expression* makeMaybeBlock(Element &s, size_t i) { + if (s.size() == i+1) return parseExpression(s[i]); + auto ret = allocator.alloc<Block>(); + for (; i < s.size(); i++) { + ret->list.push_back(parseExpression(s[i])); + } + return ret; + } + Expression* makeLoop(Element& s) { auto ret = allocator.alloc<Loop>(); size_t i = 1; @@ -860,7 +869,7 @@ private: ret->in = s[i]->str(); i++; } - ret->body = parseExpression(s[i]); + ret->body = makeMaybeBlock(s, i); return ret; } |