summaryrefslogtreecommitdiff
path: root/src/wasm-traversal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-traversal.h')
-rw-r--r--src/wasm-traversal.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h
index 1f307c318..388584fd6 100644
--- a/src/wasm-traversal.h
+++ b/src/wasm-traversal.h
@@ -259,6 +259,25 @@ struct Walker : public VisitorType {
self->walkMemory(&module->memory);
}
+ // Walks module-level code, that is, code that is not in functions.
+ void walkModuleCode(Module* module) {
+ // Dispatch statically through the SubType.
+ SubType* self = static_cast<SubType*>(this);
+ for (auto& curr : module->globals) {
+ if (!curr->imported()) {
+ self->walk(curr->init);
+ }
+ }
+ for (auto& curr : module->elementSegments) {
+ if (curr->offset) {
+ self->walk(curr->offset);
+ }
+ for (auto* item : curr->data) {
+ self->walk(item);
+ }
+ }
+ }
+
// Walk implementation. We don't use recursion as ASTs may be highly
// nested.