summaryrefslogtreecommitdiff
path: root/test/wasm2js/if_unreachable.wast
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2019-04-17 10:34:54 -0700
committerGitHub <noreply@github.com>2019-04-17 10:34:54 -0700
commitf75cf7fe9a70ec7041f758f061ac45deed18f4ab (patch)
tree6388084bdb173b613e57cc0661d58ac7de45d690 /test/wasm2js/if_unreachable.wast
parent4a1a935ff0e30c9e46f4b7469488a5b6ffee2714 (diff)
downloadbinaryen-f75cf7fe9a70ec7041f758f061ac45deed18f4ab.tar.gz
binaryen-f75cf7fe9a70ec7041f758f061ac45deed18f4ab.tar.bz2
binaryen-f75cf7fe9a70ec7041f758f061ac45deed18f4ab.zip
Fix if else JS printing when if body is a labelled block (#2017)
Before, we'd print if (..) label: { .. }; else .. But that is wrong, as it ends the if too early. After this, we print if (..) label: { .. } else .. The bug was we checked if the if body was a block, but not if it was a labelled block.
Diffstat (limited to 'test/wasm2js/if_unreachable.wast')
-rw-r--r--test/wasm2js/if_unreachable.wast21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/wasm2js/if_unreachable.wast b/test/wasm2js/if_unreachable.wast
new file mode 100644
index 000000000..11b41d16e
--- /dev/null
+++ b/test/wasm2js/if_unreachable.wast
@@ -0,0 +1,21 @@
+(module
+ (type $0 (func (param i32 i32 i32 i32 i32 i32)))
+ (import "env" "table" (table $timport$0 6 funcref))
+ (func $0 (; 0 ;) (type $0) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32)
+ (if
+ (i32.ne
+ (i32.const 0)
+ (i32.const 48)
+ )
+ (block $label$2
+ (br_if $label$2
+ (i32.const 0)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+)
+