summaryrefslogtreecommitdiff
path: root/src/ir/ExpressionManipulator.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-08-07 19:40:26 -0700
committerGitHub <noreply@github.com>2019-08-07 19:40:26 -0700
commitab3a1f65fb9d2e4ec7e2640daca0b3953a030da6 (patch)
tree53183a4bb5a5fa669f6a3b664dd34a29a3dd3059 /src/ir/ExpressionManipulator.cpp
parentbf4737bbed3482ce1d82c8d28ebec080318f0b39 (diff)
downloadbinaryen-ab3a1f65fb9d2e4ec7e2640daca0b3953a030da6.tar.gz
binaryen-ab3a1f65fb9d2e4ec7e2640daca0b3953a030da6.tar.bz2
binaryen-ab3a1f65fb9d2e4ec7e2640daca0b3953a030da6.zip
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.
Diffstat (limited to 'src/ir/ExpressionManipulator.cpp')
-rw-r--r--src/ir/ExpressionManipulator.cpp6
1 files changed, 4 insertions, 2 deletions
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<Copier, Expression*> {
+ struct Copier : public OverriddenVisitor<Copier, Expression*> {
Module& wasm;
CustomCopier custom;
@@ -41,7 +41,7 @@ flexibleCopy(Expression* original, Module& wasm, CustomCopier custom) {
if (ret) {
return ret;
}
- return Visitor<Copier, Expression*>::visit(curr);
+ return OverriddenVisitor<Copier, Expression*>::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);