summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r--src/wasm-s-parser.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 49fd52ef0..28975c7e3 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -1171,24 +1171,28 @@ private:
Expression* makeLoop(Element& s) {
auto ret = allocator.alloc<Loop>();
size_t i = 1;
+ Name out;
if (s.size() > i + 1 && s[i]->isStr() && s[i + 1]->isStr()) { // out can only be named if both are
- ret->out = s[i]->str();
+ out = s[i]->str();
i++;
- } else {
- ret->out = getPrefixedName("loop-out");
}
if (s.size() > i && s[i]->isStr()) {
- ret->in = s[i]->str();
+ ret->name = s[i]->str();
i++;
} else {
- ret->in = getPrefixedName("loop-in");
+ ret->name = getPrefixedName("loop-in");
}
- labelStack.push_back(ret->out);
- labelStack.push_back(ret->in);
+ labelStack.push_back(ret->name);
ret->body = makeMaybeBlock(s, i);
labelStack.pop_back();
- labelStack.pop_back();
ret->finalize();
+ if (out.is()) {
+ auto* block = allocator.alloc<Block>();
+ block->name = out;
+ block->list.push_back(ret);
+ block->finalize();
+ return block;
+ }
return ret;
}