summaryrefslogtreecommitdiff
path: root/src/passes/RemoveUnusedModuleElements.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/RemoveUnusedModuleElements.cpp')
-rw-r--r--src/passes/RemoveUnusedModuleElements.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/passes/RemoveUnusedModuleElements.cpp b/src/passes/RemoveUnusedModuleElements.cpp
index f5000e3a4..21cbc5e5b 100644
--- a/src/passes/RemoveUnusedModuleElements.cpp
+++ b/src/passes/RemoveUnusedModuleElements.cpp
@@ -116,6 +116,12 @@ struct ReachabilityAnalyzer : public PostWalker<ReachabilityAnalyzer> {
usesMemory = true;
}
}
+ void visitRefFunc(RefFunc* curr) {
+ if (reachable.count(
+ ModuleElement(ModuleElementKind::Function, curr->func)) == 0) {
+ queue.emplace_back(ModuleElementKind::Function, curr->func);
+ }
+ }
void visitThrow(Throw* curr) {
if (reachable.count(ModuleElement(ModuleElementKind::Event, curr->event)) ==
0) {