summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/passes/ExtractFunction.cpp1
-rw-r--r--test/lit/passes/extract-function.wast2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/passes/ExtractFunction.cpp b/src/passes/ExtractFunction.cpp
index a219000c8..0c0c1477e 100644
--- a/src/passes/ExtractFunction.cpp
+++ b/src/passes/ExtractFunction.cpp
@@ -46,6 +46,7 @@ static void extract(PassRunner* runner, Module* module, Name name) {
// Leave just one export, for the thing we want.
module->exports.clear();
+ module->updateMaps();
module->addExport(Builder::makeExport(name, name, ExternalKind::Function));
// Remove unneeded things.
diff --git a/test/lit/passes/extract-function.wast b/test/lit/passes/extract-function.wast
index 606fd326c..f53dda982 100644
--- a/test/lit/passes/extract-function.wast
+++ b/test/lit/passes/extract-function.wast
@@ -68,7 +68,9 @@
;; CHECK: (elem $0 (i32.const 0) $other)
(elem $0 (table $t) (i32.const 0) func $other)
+ ;; Test that an existing export does not cause us to crash.
;; CHECK: (export "foo" (func $foo))
+ (export "foo" (func $foo))
;; CHECK: (func $foo
;; CHECK-NEXT: (call_indirect (type $none)