From c25d24447aeede9df0e76aac5176cf525522343b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 30 Dec 2016 10:13:04 -0800 Subject: emit globals before table and memory, because they may use a global for their element/segment offsets --- src/passes/Print.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index c6fca0256..3c847809f 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -698,15 +698,15 @@ struct PrintSExpression : public Visitor { visitImport(child.get()); o << maybeNewLine; } - if (curr->table.exists) { - visitTable(&curr->table); // Prints its own newlines - } - visitMemory(&curr->memory); for (auto& child : curr->globals) { doIndent(o, indent); visitGlobal(child.get()); o << maybeNewLine; } + if (curr->table.exists) { + visitTable(&curr->table); // Prints its own newlines + } + visitMemory(&curr->memory); for (auto& child : curr->exports) { doIndent(o, indent); visitExport(child.get()); -- cgit v1.2.3