summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/passes/Print.cpp2
-rw-r--r--src/wasm-builder.h6
-rw-r--r--src/wasm-traversal.h14
3 files changed, 16 insertions, 6 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 5ea62c9f2..5e290ebca 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -2018,7 +2018,7 @@ struct PrintExpressionContents
printMedium(o, "rethrow ");
printName(curr->target, o);
}
- void visitThrowRef(ThrowRef* curr) { printMedium(o, "throw_ref "); }
+ void visitThrowRef(ThrowRef* curr) { printMedium(o, "throw_ref"); }
void visitNop(Nop* curr) { printMinor(o, "nop"); }
void visitUnreachable(Unreachable* curr) { printMinor(o, "unreachable"); }
void visitPop(Pop* curr) {
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index dd5b498be..a873a7309 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -836,6 +836,12 @@ public:
ret->finalize();
return ret;
}
+ ThrowRef* makeThrowRef(Expression* exnref) {
+ auto* ret = wasm.allocator.alloc<ThrowRef>();
+ ret->exnref = exnref;
+ ret->finalize();
+ return ret;
+ }
Unreachable* makeUnreachable() { return wasm.allocator.alloc<Unreachable>(); }
Pop* makePop(Type type) {
auto* ret = wasm.allocator.alloc<Pop>();
diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h
index 1a458bdf7..f5f25dd1f 100644
--- a/src/wasm-traversal.h
+++ b/src/wasm-traversal.h
@@ -403,7 +403,8 @@ using ExpressionStack = SmallVector<Expression*, 10>;
template<typename SubType, typename VisitorType = Visitor<SubType>>
struct ControlFlowWalker : public PostWalker<SubType, VisitorType> {
- ExpressionStack controlFlowStack; // contains blocks, loops, and ifs
+ // contains blocks, loops, ifs, trys, and try_tables
+ ExpressionStack controlFlowStack;
// Uses the control flow stack to find the target of a break to a name
Expression* findBreakTarget(Name name) {
@@ -420,8 +421,9 @@ struct ControlFlowWalker : public PostWalker<SubType, VisitorType> {
return curr;
}
} else {
- // an if or try, ignorable
- assert(curr->template is<If>() || curr->template is<Try>());
+ // an if, try, or try_table, ignorable
+ assert(curr->template is<If>() || curr->template is<Try>() ||
+ curr->template is<TryTable>());
}
if (i == 0) {
return nullptr;
@@ -447,7 +449,8 @@ struct ControlFlowWalker : public PostWalker<SubType, VisitorType> {
case Expression::Id::BlockId:
case Expression::Id::IfId:
case Expression::Id::LoopId:
- case Expression::Id::TryId: {
+ case Expression::Id::TryId:
+ case Expression::Id::TryTableId: {
self->pushTask(SubType::doPostVisitControlFlow, currp);
break;
}
@@ -461,7 +464,8 @@ struct ControlFlowWalker : public PostWalker<SubType, VisitorType> {
case Expression::Id::BlockId:
case Expression::Id::IfId:
case Expression::Id::LoopId:
- case Expression::Id::TryId: {
+ case Expression::Id::TryId:
+ case Expression::Id::TryTableId: {
self->pushTask(SubType::doPreVisitControlFlow, currp);
break;
}