summaryrefslogtreecommitdiff
path: root/src/wasm-traversal.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-04-24 16:57:47 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-04-24 16:57:47 -0700
commite62602d6295f9e0c782b720e51ba14217844adbf (patch)
tree6d7118162e44660fe243a2c20174411f693ae051 /src/wasm-traversal.h
parentc2abbda652e2fc92e6bdd710952198ee3005653b (diff)
parentf9cc3ba2d568cc43ff33dbe21606c40e4ddff596 (diff)
downloadbinaryen-e62602d6295f9e0c782b720e51ba14217844adbf.tar.gz
binaryen-e62602d6295f9e0c782b720e51ba14217844adbf.tar.bz2
binaryen-e62602d6295f9e0c782b720e51ba14217844adbf.zip
Merge pull request #387 from WebAssembly/block-returns-nice
Optimize block and if returns
Diffstat (limited to 'src/wasm-traversal.h')
-rw-r--r--src/wasm-traversal.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h
index b8b625f09..a2e29ea77 100644
--- a/src/wasm-traversal.h
+++ b/src/wasm-traversal.h
@@ -156,7 +156,10 @@ struct Walker : public VisitorType {
// Useful methods for visitor implementions
- // Replace the current node
+ // Replace the current node. You can call this in your visit*() methods.
+ // Note that the visit*() for the result node is not called for you (i.e.,
+ // just one visit*() method is called by the traversal; if you replace a node,
+ // and you want to process the output, you must do that explicitly).
void replaceCurrent(Expression *expression) {
replace = expression;
}
@@ -467,10 +470,10 @@ struct LinearExecutionWalker : public PostWalker<SubType, VisitorType> {
LinearExecutionWalker() {}
// subclasses should implement this
- void noteNonLinear() { abort(); }
+ void noteNonLinear(Expression* curr) { abort(); }
static void doNoteNonLinear(SubType* self, Expression** currp) {
- self->noteNonLinear();
+ self->noteNonLinear(*currp);
}
static void scan(SubType* self, Expression** currp) {