diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-05 22:08:50 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-05 22:08:50 -0800 |
commit | 1585a63c8846eef56b95f076be2ffe2f7e2f15da (patch) | |
tree | 116745d51d66aaaa06e3498a298878dee41fcfb7 | |
parent | 5c3a102d7476b2200787aa66a84175bb47862c36 (diff) | |
download | binaryen-1585a63c8846eef56b95f076be2ffe2f7e2f15da.tar.gz binaryen-1585a63c8846eef56b95f076be2ffe2f7e2f15da.tar.bz2 binaryen-1585a63c8846eef56b95f076be2ffe2f7e2f15da.zip |
fix do-while label
-rw-r--r-- | src/wasm2asm.h | 5 | ||||
-rw-r--r-- | test/unit.2asm.js | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h index 2ca6406b5..a19416e04 100644 --- a/src/wasm2asm.h +++ b/src/wasm2asm.h @@ -513,10 +513,11 @@ Ref Wasm2AsmBuilder::processFunctionBody(Expression* curr, IString result) { Name asmLabel = curr->out.is() ? curr->out : curr->in; // label using the outside, normal for breaks. if no outside, then inside if (curr->in.is()) continueLabels[curr->in] = asmLabel; Ref body = visit(curr->body, result); + Ref ret = ValueBuilder::makeDo(body, ValueBuilder::makeInt(0)); if (asmLabel.is()) { - body = ValueBuilder::makeLabel(fromName(asmLabel), body); + ret = ValueBuilder::makeLabel(fromName(asmLabel), ret); } - return ValueBuilder::makeDo(body, ValueBuilder::makeInt(0)); + return ret; } Ref visitLabel(Label *curr) override { return ValueBuilder::makeLabel(fromName(curr->name), visit(curr->body, result)); diff --git a/test/unit.2asm.js b/test/unit.2asm.js index b835cca53..6d4df7fff 100644 --- a/test/unit.2asm.js +++ b/test/unit.2asm.js @@ -112,13 +112,13 @@ function asmFunc() { case 8: break label$break$Lout; case 3: - do while_out$10 : { + while_out$10 : do { break while_out$10; continue while_out$10; } while (0); break label$break$Lout; case 0: - do while_out$13 : { + while_out$13 : do { break label$break$Lout; continue while_out$13; } while (0); |