summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-builder.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-06-25 16:29:39 -0700
committerYong He <yonghe@outlook.com>2020-06-25 16:29:39 -0700
commit09c64acde25dddbd70e2070df05c2e0362b750a8 (patch)
tree92c7805b43cf6af0bfa46588b566391e122967c3 /source/slang/slang-ast-builder.cpp
parent218a39b65c86654772c3d6adf2479e7cadc85d24 (diff)
parent892acc47143348d50062354492b048c4e474d1ec (diff)
Merge remote-tracking branch 'official/master' into dyndispatch2
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"));