summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-builder.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-06-25 16:41:14 -0400
committerGitHub <noreply@github.com>2020-06-25 16:41:14 -0400
commit892acc47143348d50062354492b048c4e474d1ec (patch)
tree06770d26509f77641a78eec490eb93012aa6fa9c /source/slang/slang-ast-builder.cpp
parent3fe4f5398d524333e955ecb91be5646e86f3b2da (diff)
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.
Diffstat (limited to 'source/slang/slang-ast-builder.cpp')
-rw-r--r--source/slang/slang-ast-builder.cpp14
1 files changed, 14 insertions, 0 deletions
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<PtrType>(getPtrType(valueType, "PtrType"));