Skip to content

Commit

Permalink
Copying fixes (#2289)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kripken authored Aug 8, 2019
1 parent bf4737b commit ab3a1f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ir/ExpressionManipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ab3a1f6

Please sign in to comment.