From ab3a1f65fb9d2e4ec7e2640daca0b3953a030da6 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 7 Aug 2019 19:40:26 -0700 Subject: Copying fixes (#2289) We didn't have an OverriddenVisitor in the copying code, and sadly unimplemented visitors just return null. That explains the crash in #2288 The missing visitors were push and pop. --- src/ir/ExpressionManipulator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ir/ExpressionManipulator.cpp b/src/ir/ExpressionManipulator.cpp index 783342780..29f08de2e 100644 --- a/src/ir/ExpressionManipulator.cpp +++ b/src/ir/ExpressionManipulator.cpp @@ -24,7 +24,7 @@ namespace ExpressionManipulator { Expression* flexibleCopy(Expression* original, Module& wasm, CustomCopier custom) { - struct Copier : public Visitor { + struct Copier : public OverriddenVisitor { Module& wasm; CustomCopier custom; @@ -41,7 +41,7 @@ flexibleCopy(Expression* original, Module& wasm, CustomCopier custom) { if (ret) { return ret; } - return Visitor::visit(curr); + return OverriddenVisitor::visit(curr); } Expression* visitBlock(Block* curr) { @@ -223,6 +223,8 @@ flexibleCopy(Expression* original, Module& wasm, CustomCopier custom) { Expression* visitUnreachable(Unreachable* curr) { return builder.makeUnreachable(); } + Expression* visitPush(Push* curr) { return builder.makePush(curr->value); } + Expression* visitPop(Pop* curr) { return builder.makePop(curr->type); } }; Copier copier(wasm, custom); -- cgit v1.2.3