summaryrefslogtreecommitdiff
path: root/test/wasm2js/switch.2asm.js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-08-16 10:16:28 -0700
committerGitHub <noreply@github.com>2019-08-16 10:16:28 -0700
commitee0564088c7f89814bf951cc5936aa096538e38f (patch)
treed327c8f69b71f785faa0ac55c93662cd55280df9 /test/wasm2js/switch.2asm.js
parent1b8c19a021c09aa4024fe79753ab922cd5762ec0 (diff)
downloadbinaryen-ee0564088c7f89814bf951cc5936aa096538e38f.tar.gz
binaryen-ee0564088c7f89814bf951cc5936aa096538e38f.tar.bz2
binaryen-ee0564088c7f89814bf951cc5936aa096538e38f.zip
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
Diffstat (limited to 'test/wasm2js/switch.2asm.js')
-rw-r--r--test/wasm2js/switch.2asm.js1
1 files changed, 1 insertions, 0 deletions
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;
};