summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-02-21 10:29:59 -0800
committerGitHub <noreply@github.com>2017-02-21 10:29:59 -0800
commita32c0eff473d39b816679a5f7c65b522886726b0 (patch)
treebb45de27ff61d2b793e5168f17af8ab0f5d820a1 /src
parentd946d68963d4731020d7dc0e41f331e0ab89591c (diff)
downloadbinaryen-a32c0eff473d39b816679a5f7c65b522886726b0.tar.gz
binaryen-a32c0eff473d39b816679a5f7c65b522886726b0.tar.bz2
binaryen-a32c0eff473d39b816679a5f7c65b522886726b0.zip
allow traversing the inits of globals (#917)
Diffstat (limited to 'src')
-rw-r--r--src/wasm-traversal.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h
index 47f6984dd..4eb5eb0ad 100644
--- a/src/wasm-traversal.h
+++ b/src/wasm-traversal.h
@@ -172,6 +172,11 @@ struct Walker : public VisitorType {
// Walk starting
+ void walkGlobal(Global* global) {
+ walk(global->init);
+ static_cast<SubType*>(this)->visitGlobal(global);
+ }
+
void walkFunction(Function* func) {
setFunction(func);
static_cast<SubType*>(this)->doWalkFunction(func);
@@ -219,7 +224,7 @@ struct Walker : public VisitorType {
self->visitExport(curr.get());
}
for (auto& curr : module->globals) {
- self->visitGlobal(curr.get());
+ self->walkGlobal(curr.get());
}
for (auto& curr : module->functions) {
self->walkFunction(curr.get());