From 8900ceb7e1adf6b91374c236a30ad7f20b980106 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Wed, 5 Sep 2018 15:38:46 -0500 Subject: [wasm2js] Fix nested selects (#1671) In wasmjs, the nested selects are trying to use the same temporary locals. The patch reserves temporaries "at right time" to avoid overriding the values. --- src/wasm2js.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/wasm2js.h b/src/wasm2js.h index 40f8e3057..a88f0fbdc 100644 --- a/src/wasm2js.h +++ b/src/wasm2js.h @@ -1966,12 +1966,12 @@ Ref Wasm2JSBuilder::processFunctionBody(Module* m, Function* func, IString resul return ret; } // normal select - Ref ifTrue = visit(curr->ifTrue, EXPRESSION_RESULT); - Ref ifFalse = visit(curr->ifFalse, EXPRESSION_RESULT); - Ref condition = visit(curr->condition, EXPRESSION_RESULT); ScopedTemp tempIfTrue(curr->type, parent, func), tempIfFalse(curr->type, parent, func), tempCondition(i32, parent, func); + Ref ifTrue = visit(curr->ifTrue, EXPRESSION_RESULT); + Ref ifFalse = visit(curr->ifFalse, EXPRESSION_RESULT); + Ref condition = visit(curr->condition, EXPRESSION_RESULT); return ValueBuilder::makeSeq( ValueBuilder::makeBinary(tempIfTrue.getAstName(), SET, ifTrue), -- cgit v1.2.3