summaryrefslogtreecommitdiff
path: root/src/ir/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir/utils.h')
-rw-r--r--src/ir/utils.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ir/utils.h b/src/ir/utils.h
index b7c5b9cba..7362cbe1a 100644
--- a/src/ir/utils.h
+++ b/src/ir/utils.h
@@ -301,6 +301,20 @@ struct AutoDrop : public WalkerPass<ExpressionStackWalker<AutoDrop>> {
}
}
+ void visitTry(Try* curr) {
+ bool acted = false;
+ if (maybeDrop(curr->body)) {
+ acted = true;
+ }
+ if (maybeDrop(curr->catchBody)) {
+ acted = true;
+ }
+ if (acted) {
+ reFinalize();
+ assert(curr->type == Type::none);
+ }
+ }
+
void doWalkFunction(Function* curr) {
ReFinalize().walkFunctionInModule(curr, getModule());
walk(curr->body);