diff options
author | Abbas Mashayekh <martianboy2005@gmail.com> | 2021-04-02 21:34:03 +0430 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-02 10:04:03 -0700 |
commit | c59df4cda843ef11ad261f5c889dddc9a9d59d3b (patch) | |
tree | 123b923408082a8578bc9bad6cafe2b5aaeeedda /src/passes/Print.cpp | |
parent | c75be5fc138f4f523a548758fa785cac310563fd (diff) | |
download | binaryen-c59df4cda843ef11ad261f5c889dddc9a9d59d3b.tar.gz binaryen-c59df4cda843ef11ad261f5c889dddc9a9d59d3b.tar.bz2 binaryen-c59df4cda843ef11ad261f5c889dddc9a9d59d3b.zip |
Reorder global definitions in Print pass (#3770)
This is needed to make sure globals are printed before element segments,
where `global.get` can appear both as offset and an expression.
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index b4b4ef70f..e3ea04b53 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2892,6 +2892,8 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { *curr, [&](Function* func) { visitFunction(func); }); ModuleUtils::iterImportedEvents(*curr, [&](Event* event) { visitEvent(event); }); + ModuleUtils::iterDefinedGlobals( + *curr, [&](Global* global) { visitGlobal(global); }); ModuleUtils::iterDefinedMemories( *curr, [&](Memory* memory) { visitMemory(memory); }); ModuleUtils::iterDefinedTables(*curr, @@ -2909,8 +2911,6 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { } o << ')' << maybeNewLine; } - ModuleUtils::iterDefinedGlobals( - *curr, [&](Global* global) { visitGlobal(global); }); ModuleUtils::iterDefinedEvents(*curr, [&](Event* event) { visitEvent(event); }); for (auto& child : curr->exports) { |