diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-02 17:30:37 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-02 17:30:37 -0800 |
commit | 1c25d8bd86c466306cc8e0bebed4fe7ae066e64e (patch) | |
tree | d351fc7715596f7ec3adac5cff3f36b82bf4649e | |
parent | 79c1a48d3b50c6298f4b89c3237df426aebd3f75 (diff) | |
download | binaryen-1c25d8bd86c466306cc8e0bebed4fe7ae066e64e.tar.gz binaryen-1c25d8bd86c466306cc8e0bebed4fe7ae066e64e.tar.bz2 binaryen-1c25d8bd86c466306cc8e0bebed4fe7ae066e64e.zip |
fix while (condition) loops
-rw-r--r-- | src/asm2wasm.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h index 04d4db21c..65d837496 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -881,10 +881,11 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { ret->body = process(ast[2]); } else { Break *breakOut = allocator.alloc<Break>(); - breakOut->name = in; + breakOut->name = out; If *condition = allocator.alloc<If>(); condition->condition = process(ast[1]); - condition->ifTrue = breakOut; + condition->ifTrue = allocator.alloc<Nop>(); + condition->ifFalse = breakOut; auto body = allocator.alloc<Block>(); body->list.push_back(condition); body->list.push_back(process(ast[2])); |