From 69025ad82238a7402b18d9c566fac1574faef684 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 31 Aug 2020 13:02:55 -0400 Subject: AST Serialization in Modules (#1524) * First pass at filter for AST serial writing. * Serialization of AST for modules. * Removed some commented out source. Co-authored-by: Tim Foley --- source/slang/slang-ast-dump.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-ast-dump.cpp') diff --git a/source/slang/slang-ast-dump.cpp b/source/slang/slang-ast-dump.cpp index 806a9146b..a821729a6 100644 --- a/source/slang/slang-ast-dump.cpp +++ b/source/slang/slang-ast-dump.cpp @@ -218,6 +218,7 @@ struct ASTDumpContext { if (m_dumpFlags & ASTDumpUtil::Flag::HideSourceLoc) { + ScopeWrite(this).getBuf() << "SourceLoc(0)"; return; } @@ -268,7 +269,7 @@ struct ASTDumpContext { ScopeWrite(this).getBuf() << " { " << TokenTypeToString(token.type) << ", "; dump(token.loc); - m_writer->emit(" "); + m_writer->emit(", "); dump(token.getContent()); m_writer->emit(" }"); } @@ -443,11 +444,11 @@ struct ASTDumpContext { if (qualType.isLeftValue) { - m_writer->emit("left "); + m_writer->emit("lvalue "); } else { - m_writer->emit("right "); + m_writer->emit("rvalue "); } dump(qualType.type); } @@ -580,8 +581,10 @@ struct ASTDumpContext void dump(ASTNodeType nodeType) { - SLANG_UNUSED(nodeType) - // Don't bother to output anything - as will already have been dumped with the object name + // Get the class + auto info = ReflectClassInfo::getInfo(nodeType); + // Write the name + m_writer->emit(info->m_name); } void dumpObjectFull(NodeBase* node); -- cgit v1.2.3