From ee0564088c7f89814bf951cc5936aa096538e38f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 16 Aug 2019 10:16:28 -0700 Subject: wasm2js: Fix switch lowering, don't fall through after the hoisted parts (#2301) The switch lowering will "hoist" blocks of code into the JS switch when it can. If it can hoist some but not others, it must not fall through into those others (while it can fall through the hoisted ones - they began as nested blocks with falling-through between them). To fix this, after the hoisted ones issue a break out of the switch (which now contains all the hoisted code, so breaking out of it gets to the code right after the hoisted ones). fixes #2300 --- test/wasm2js/switch.2asm.js | 1 + 1 file changed, 1 insertion(+) (limited to 'test/wasm2js/switch.2asm.js') diff --git a/test/wasm2js/switch.2asm.js b/test/wasm2js/switch.2asm.js index b7583298e..3c2572315 100644 --- a/test/wasm2js/switch.2asm.js +++ b/test/wasm2js/switch.2asm.js @@ -46,6 +46,7 @@ function asmFunc(global, env, buffer) { j = 101; default: j = 102; + break; case 7: break $7; }; -- cgit v1.2.3