summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/passes/Print.cpp3
-rw-r--r--test/exception-handling.wast13
-rw-r--r--test/exception-handling.wast.from-wast13
-rw-r--r--test/exception-handling.wast.fromBinary13
-rw-r--r--test/exception-handling.wast.fromBinary.noDebugInfo13
5 files changed, 53 insertions, 2 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 7260d7161..2aacb513b 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -2390,7 +2390,6 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
}
}
- int startControlFlowDepth = controlFlowDepth;
controlFlowDepth += stack.size();
auto* top = stack.back();
while (stack.size() > 0) {
@@ -2413,6 +2412,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
}
printFullLine(list[i]);
}
+ controlFlowDepth--;
}
decIndent();
if (full) {
@@ -2421,7 +2421,6 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
o << ' ' << curr->name;
}
}
- controlFlowDepth = startControlFlowDepth;
}
void visitIf(If* curr) {
controlFlowDepth++;
diff --git a/test/exception-handling.wast b/test/exception-handling.wast
index 1db356684..642856f03 100644
--- a/test/exception-handling.wast
+++ b/test/exception-handling.wast
@@ -352,4 +352,17 @@
)
)
)
+
+ ;; When 'delegate' is next to a nested block, make sure its delegate argument
+ ;; is parsed correctly.
+ (func $nested-block-and-try
+ (block $l0
+ (block $l1)
+ (try
+ (do)
+ (delegate 1) ;; to caller
+ )
+ )
+ (nop)
+ )
)
diff --git a/test/exception-handling.wast.from-wast b/test/exception-handling.wast.from-wast
index c53f602d9..2427a1ee1 100644
--- a/test/exception-handling.wast.from-wast
+++ b/test/exception-handling.wast.from-wast
@@ -393,4 +393,17 @@
)
)
)
+ (func $nested-block-and-try
+ (block $l0
+ (block $l1
+ )
+ (try $try
+ (do
+ (nop)
+ )
+ (delegate 1)
+ )
+ )
+ (nop)
+ )
)
diff --git a/test/exception-handling.wast.fromBinary b/test/exception-handling.wast.fromBinary
index 29231a943..f88e54507 100644
--- a/test/exception-handling.wast.fromBinary
+++ b/test/exception-handling.wast.fromBinary
@@ -424,5 +424,18 @@
)
)
)
+ (func $nested-block-and-try
+ (block $label$1
+ (block $label$2
+ )
+ (try $label$5
+ (do
+ (nop)
+ )
+ (delegate 1)
+ )
+ )
+ (nop)
+ )
)
diff --git a/test/exception-handling.wast.fromBinary.noDebugInfo b/test/exception-handling.wast.fromBinary.noDebugInfo
index 16ab587b2..c65a216c3 100644
--- a/test/exception-handling.wast.fromBinary.noDebugInfo
+++ b/test/exception-handling.wast.fromBinary.noDebugInfo
@@ -424,5 +424,18 @@
)
)
)
+ (func $7
+ (block $label$1
+ (block $label$2
+ )
+ (try $label$5
+ (do
+ (nop)
+ )
+ (delegate 1)
+ )
+ )
+ (nop)
+ )
)