diff options
-rw-r--r-- | src/passes/Print.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 1f14819cf..0c71afc7b 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -1837,11 +1837,16 @@ struct PrintSExpression : public OverriddenVisitor<PrintSExpression> { o << maybeNewLine; } void visitEvent(Event* curr) { - doIndent(o, indent); if (curr->imported()) { - o << '('; - emitImportHeader(curr); + visitImportedEvent(curr); + } else { + visitDefinedEvent(curr); } + } + void visitImportedEvent(Event* curr) { + doIndent(o, indent); + o << '('; + emitImportHeader(curr); o << "(event "; printName(curr->name, o); o << maybeSpace << "(attr " << curr->attribute << ')' << maybeSpace << '('; @@ -1849,12 +1854,21 @@ struct PrintSExpression : public OverriddenVisitor<PrintSExpression> { for (auto& param : curr->params) { o << ' ' << printType(param); } - o << "))"; - if (curr->imported()) { - o << ')'; - } + o << ")))"; o << maybeNewLine; } + void visitDefinedEvent(Event* curr) { + doIndent(o, indent); + o << '('; + printMedium(o, "event "); + printName(curr->name, o); + o << maybeSpace << "(attr " << curr->attribute << ')' << maybeSpace << '('; + printMinor(o, "param"); + for (auto& param : curr->params) { + o << ' ' << printType(param); + } + o << "))" << maybeNewLine; + } void printTableHeader(Table* curr) { o << '('; printMedium(o, "table") << ' '; |