diff options
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index fb85023f0..9dbf3cc1f 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -1660,6 +1660,9 @@ struct PrintSExpression : public Visitor<PrintSExpression> { case ExternalKind::Global: o << "global"; break; + case ExternalKind::Event: + o << "event"; + break; case ExternalKind::Invalid: WASM_UNREACHABLE(); } @@ -1805,6 +1808,25 @@ struct PrintSExpression : public Visitor<PrintSExpression> { } o << maybeNewLine; } + void visitEvent(Event* curr) { + doIndent(o, indent); + if (curr->imported()) { + o << '('; + emitImportHeader(curr); + } + o << "(event "; + printName(curr->name, o); + o << maybeSpace << "(attr " << curr->attribute << ')' << maybeSpace << '('; + printMinor(o, "param"); + for (auto& param : curr->params) { + o << ' ' << printType(param); + } + o << "))"; + if (curr->imported()) { + o << ')'; + } + o << maybeNewLine; + } void printTableHeader(Table* curr) { o << '('; printMedium(o, "table") << ' '; @@ -1948,12 +1970,16 @@ struct PrintSExpression : public Visitor<PrintSExpression> { *curr, [&](Global* global) { visitGlobal(global); }); ModuleUtils::iterImportedFunctions( *curr, [&](Function* func) { visitFunction(func); }); + ModuleUtils::iterImportedEvents(*curr, + [&](Event* event) { visitEvent(event); }); ModuleUtils::iterDefinedMemories( *curr, [&](Memory* memory) { visitMemory(memory); }); ModuleUtils::iterDefinedTables(*curr, [&](Table* table) { visitTable(table); }); ModuleUtils::iterDefinedGlobals( *curr, [&](Global* global) { visitGlobal(global); }); + ModuleUtils::iterDefinedEvents(*curr, + [&](Event* event) { visitEvent(event); }); for (auto& child : curr->exports) { doIndent(o, indent); visitExport(child.get()); |