summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-builder.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-06-05 13:01:06 -0700
committerGitHub <noreply@github.com>2020-06-05 13:01:06 -0700
commit92fc3aaa835315ff08750c7b5a7498b7228e2c33 (patch)
tree162b2b4b9411ede11d6a53015713ab431283f6c6 /source/slang/slang-ast-builder.cpp
parent389be08822ba554327b5948266f54acf8a312fe7 (diff)
parente3e1cf2045f14837cfecb14e252c0e1083787b93 (diff)
Merge branch 'master' into findtypebynamefix
Diffstat (limited to 'source/slang/slang-ast-builder.cpp')
-rw-r--r--source/slang/slang-ast-builder.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/slang/slang-ast-builder.cpp b/source/slang/slang-ast-builder.cpp
index 316390353..67ce80120 100644
--- a/source/slang/slang-ast-builder.cpp
+++ b/source/slang/slang-ast-builder.cpp
@@ -21,18 +21,20 @@ void SharedASTBuilder::init(Session* session)
m_session = session;
// We just want as a place to store allocations of shared types
- RefPtr<ASTBuilder> astBuilder(new ASTBuilder);
-
- astBuilder->m_sharedASTBuilder = this;
+ {
+ RefPtr<ASTBuilder> astBuilder(new ASTBuilder);
+ astBuilder->m_sharedASTBuilder = this;
+ m_astBuilder = astBuilder.detach();
+ }
+ // Clear the built in types
memset(m_builtinTypes, 0, sizeof(m_builtinTypes));
+ // Create common shared types
m_errorType = m_astBuilder->create<ErrorType>();
m_initializerListType = m_astBuilder->create<InitializerListType>();
m_overloadedType = m_astBuilder->create<OverloadGroupType>();
- m_astBuilder = astBuilder.detach();
-
// We can just iterate over the class pointers.
// NOTE! That this adds the names of the abstract classes too(!)
for (Index i = 0; i < Index(ASTNodeType::CountOf); ++i)