From 9773495f1ab8a11194a21e1cf7b141c3da5cdfce Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 29 May 2020 14:26:48 -0400 Subject: NodeBase types constructed with astNodeType member set (#1363) * Maked Substituions derived from NodeBase * * Add astNodeTYpe field to NodeBase * Make Substitutions derived from NodeBase * Make all construction through ASTBuilder * Make getClassInfo non virtual (just uses the astNodeType) --- source/slang/slang-ast-dump.cpp | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 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 8b9f643dd..2157b7c19 100644 --- a/source/slang/slang-ast-dump.cpp +++ b/source/slang/slang-ast-dump.cpp @@ -545,8 +545,13 @@ struct Context m_writer->emit("\n"); } + void dump(ASTNodeType nodeType) + { + SLANG_UNUSED(nodeType) + // Don't bother to output anything - as will already have been dumped with the object name + } + void dumpObjectFull(NodeBase* node); - void dumpObjectFull(Substitutions* subs); Context(SourceWriter* writer, ASTDumpUtil::Style dumpStyle): m_writer(writer), @@ -585,7 +590,6 @@ static void dumpFields_##NAME(NAME* node, Context& context) \ SLANG_FIELDS_ASTNode_##NAME(SLANG_AST_DUMP_FIELD, _) \ } -SLANG_ALL_ASTNode_Substitutions(SLANG_AST_DUMP_FIELDS_IMPL, _) SLANG_ALL_ASTNode_NodeBase(SLANG_AST_DUMP_FIELDS_IMPL, _) }; @@ -599,7 +603,6 @@ struct DumpFieldFuncs DumpFieldFuncs() { memset(m_funcs, 0, sizeof(m_funcs)); - SLANG_ALL_ASTNode_Substitutions(SLANG_AST_GET_DUMP_FUNC, _) SLANG_ALL_ASTNode_NodeBase(SLANG_AST_GET_DUMP_FUNC, _) } @@ -679,20 +682,6 @@ void Context::dumpObjectFull(NodeBase* node) } } -void Context::dumpObjectFull(Substitutions* subs) -{ - if (!subs) - { - _dumpPtr(nullptr); - } - else - { - const ReflectClassInfo& typeInfo = subs->getClassInfo(); - Index index = getObjectIndex(typeInfo, subs); - dumpObjectFull(typeInfo, subs, index); - } -} - /* static */void ASTDumpUtil::dump(NodeBase* node, Style style, SourceWriter* writer) { Context context(writer, style); @@ -700,12 +689,4 @@ void Context::dumpObjectFull(Substitutions* subs) context.dumpRemaining(); } -/* static */void ASTDumpUtil::dump(Substitutions* subs, Style style, SourceWriter* writer) -{ - Context context(writer, style); - context.dumpObjectFull(subs); - context.dumpRemaining(); - -} - } // namespace Slang -- cgit v1.2.3