summaryrefslogtreecommitdiff
path: root/src/passes/TranslateEH.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/TranslateEH.cpp')
-rw-r--r--src/passes/TranslateEH.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/passes/TranslateEH.cpp b/src/passes/TranslateEH.cpp
index f8e059624..42cea6199 100644
--- a/src/passes/TranslateEH.cpp
+++ b/src/passes/TranslateEH.cpp
@@ -359,11 +359,13 @@ struct TranslateToNewEH : public WalkerPass<PostWalker<TranslateToNewEH>> {
std::optional<Index> local = localAssigner->getExnrefLocal(curr->name);
if (local) {
for (auto* throwRef : FindAll<ThrowRef>(catchBody).list) {
- // All throw_refs generated in this pass has a local.get as its child.
- // See visitRethrow().
- auto* localGet = throwRef->exnref->cast<LocalGet>();
- if (localGet->index == *local) {
- return true;
+ // All rethrows within this catch body have already been converted to
+ // throw_refs, which contains a local.get as its child.(See
+ // visitRethrow() for details).
+ if (auto* localGet = throwRef->exnref->dynCast<LocalGet>()) {
+ if (localGet->index == *local) {
+ return true;
+ }
}
}
}