summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ast_utils.h1
-rw-r--r--test/reg_switch.wast13
-rw-r--r--test/reg_switch.wast.fromBinary17
3 files changed, 31 insertions, 0 deletions
diff --git a/src/ast_utils.h b/src/ast_utils.h
index ebb6861da..e09104cc6 100644
--- a/src/ast_utils.h
+++ b/src/ast_utils.h
@@ -36,6 +36,7 @@ struct BreakSeeker : public PostWalker<BreakSeeker, Visitor<BreakSeeker>> {
for (auto name : curr->targets) {
if (name == target) found++;
}
+ if (curr->default_ == target) found++;
}
static bool has(Expression* tree, Name target) {
diff --git a/test/reg_switch.wast b/test/reg_switch.wast
new file mode 100644
index 000000000..b53d45f54
--- /dev/null
+++ b/test/reg_switch.wast
@@ -0,0 +1,13 @@
+(module
+ (memory 0)
+ (func $0
+ (if
+ (nop)
+ (block $A
+ (br_table $A
+ (nop)
+ )
+ )
+ )
+ )
+)
diff --git a/test/reg_switch.wast.fromBinary b/test/reg_switch.wast.fromBinary
new file mode 100644
index 000000000..89a2fe061
--- /dev/null
+++ b/test/reg_switch.wast.fromBinary
@@ -0,0 +1,17 @@
+(module
+ (memory 0)
+ (type $0 (func))
+ (func $0 (type $0)
+ (if
+ (nop)
+ (block $label$0
+ (block $label$1
+ (br_table $label$1
+ (nop)
+ )
+ )
+ )
+ )
+ )
+)
+