From 892acc47143348d50062354492b048c4e474d1ec Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 25 Jun 2020 16:41:14 -0400 Subject: AST Serialize Reading (#1409) * Try to fix problem with C++ extractor concating tokens producing an erroneous result. * Improve naming/comments around C++ extractor fix. * Another small improvement around space concating when outputing token list. * Handle some more special cases for consecutive tokens for C++ extractor concat of tokens. * WIP AST serialization. * Comment out so compile works. * More work on AST serialization. * WIP AST serialize. * WIP AST Serialization - handling more types. * WIP: Compiles but not all types are converted, as not all List element types are handled. * Compiles with array types. * Finish off AST serialization of remaining types. * Remove ComputedLayoutModifier and TupleVarModifier. * Add fields to ASTSerialClass type. * Construct AST type layout. * AST Serialization working for writing to ASTSerialWriter. * Removed call to ASTSerialization::selfTest in session creation. * Fixes for gcc. * Diagnostics handling - better handling of dashify. * Improve comment around DiagnosticLookup. * Updated VS project. * Write out as a Stream, taking into account alignment. * First pass at serializing in AST. * Added support for deserializing arrays. * Small bug fixes. * Fix problem calculating layout. Split out loading on entries. * Fix typo in AST conversion. --- source/slang/slang-ast-builder.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/slang/slang-ast-builder.cpp') diff --git a/source/slang/slang-ast-builder.cpp b/source/slang/slang-ast-builder.cpp index 3ff6130bd..ec4fd20f1 100644 --- a/source/slang/slang-ast-builder.cpp +++ b/source/slang/slang-ast-builder.cpp @@ -167,6 +167,20 @@ ASTBuilder::~ASTBuilder() } } +NodeBase* ASTBuilder::createByNodeType(ASTNodeType nodeType) +{ + const ReflectClassInfo* info = ReflectClassInfo::getInfo(nodeType); + + auto createFunc = info->m_createFunc; + SLANG_ASSERT(createFunc); + if (!createFunc) + { + return nullptr; + } + + return (NodeBase*)createFunc(this); +} + PtrType* ASTBuilder::getPtrType(Type* valueType) { return dynamicCast(getPtrType(valueType, "PtrType")); -- cgit v1.2.3