summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-conformance.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-05-28 14:01:51 -0400
committerGitHub <noreply@github.com>2020-05-28 14:01:51 -0400
commitc2d31347ea06c768045e7c503ef0188e0e5356de (patch)
tree1a4ee67aafca0a709ae691104023431bb6829825 /source/slang/slang-check-conformance.cpp
parente5d0f3360f44a4cdd2390e7817db17bb3cc0dd04 (diff)
WIP: ASTBuilder (#1358)
* Compiles. * Small tidy up around session/ASTBuilder. * Tests are now passing. * Fix Visual Studio project. * Fix using new X to use builder when protectedness of Ctor is not enough. Substitute->substitute * Add some missing ast nodes created outside of ASTBuilder. * Compile time check that ASTBuilder is making an AST type. * Moced findClasInfo and findSyntaxClass (essentially the same thing) to SharedASTBuilder from Session.
Diffstat (limited to 'source/slang/slang-check-conformance.cpp')
-rw-r--r--source/slang/slang-check-conformance.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/slang/slang-check-conformance.cpp b/source/slang/slang-check-conformance.cpp
index 639716ee5..4a149c10f 100644
--- a/source/slang/slang-check-conformance.cpp
+++ b/source/slang/slang-check-conformance.cpp
@@ -10,7 +10,7 @@ namespace Slang
RefPtr<DeclaredSubtypeWitness> SemanticsVisitor::createSimpleSubtypeWitness(
TypeWitnessBreadcrumb* breadcrumb)
{
- RefPtr<DeclaredSubtypeWitness> witness = new DeclaredSubtypeWitness();
+ RefPtr<DeclaredSubtypeWitness> witness = m_astBuilder->create<DeclaredSubtypeWitness>();
witness->sub = breadcrumb->sub;
witness->sup = breadcrumb->sup;
witness->declRef = breadcrumb->declRef;
@@ -79,7 +79,7 @@ namespace Slang
// where `[...]` represents the "hole" we leave
// open to fill in next.
//
- RefPtr<TransitiveSubtypeWitness> transitiveWitness = new TransitiveSubtypeWitness();
+ RefPtr<TransitiveSubtypeWitness> transitiveWitness = m_astBuilder->create<TransitiveSubtypeWitness>();
transitiveWitness->sub = bb->sub;
transitiveWitness->sup = bb->sup;
transitiveWitness->midToSup = bb->declRef;
@@ -190,7 +190,7 @@ namespace Slang
// loops better). This would also help avoid checking multiply-inherited
// conformances multiple times.
- auto inheritedType = getBaseType(inheritanceDeclRef);
+ auto inheritedType = getBaseType(m_astBuilder, inheritanceDeclRef);
// We need to ensure that the witness that gets created
// is a composite one, reflecting lookup through
@@ -211,7 +211,7 @@ namespace Slang
for (auto genConstraintDeclRef : getMembersOfType<GenericTypeConstraintDecl>(aggTypeDeclRef))
{
ensureDecl(genConstraintDeclRef, DeclCheckState::CanUseBaseOfInheritanceDecl);
- auto inheritedType = GetSup(genConstraintDeclRef);
+ auto inheritedType = GetSup(m_astBuilder, genConstraintDeclRef);
TypeWitnessBreadcrumb breadcrumb;
breadcrumb.prev = inBreadcrumbs;
breadcrumb.sub = type;
@@ -233,8 +233,8 @@ namespace Slang
for( auto constraintDeclRef : getMembersOfType<GenericTypeConstraintDecl>(genericDeclRef) )
{
- auto sub = GetSub(constraintDeclRef);
- auto sup = GetSup(constraintDeclRef);
+ auto sub = GetSub(m_astBuilder, constraintDeclRef);
+ auto sup = GetSup(m_astBuilder, constraintDeclRef);
auto subDeclRef = as<DeclRefType>(sub);
if(!subDeclRef)
@@ -313,9 +313,9 @@ namespace Slang
//
if(outWitness)
{
- RefPtr<TaggedUnionSubtypeWitness> taggedUnionWitness = new TaggedUnionSubtypeWitness();
+ RefPtr<TaggedUnionSubtypeWitness> taggedUnionWitness = m_astBuilder->create<TaggedUnionSubtypeWitness>();
taggedUnionWitness->sub = taggedUnionType;
- taggedUnionWitness->sup = DeclRefType::Create(getSession(), interfaceDeclRef);
+ taggedUnionWitness->sup = DeclRefType::create(m_astBuilder, interfaceDeclRef);
taggedUnionWitness->caseWitnesses.swapWith(caseWitnesses);
*outWitness = taggedUnionWitness;
@@ -346,7 +346,7 @@ namespace Slang
RefPtr<Val> SemanticsVisitor::createTypeEqualityWitness(
Type* type)
{
- RefPtr<TypeEqualityWitness> rs = new TypeEqualityWitness();
+ RefPtr<TypeEqualityWitness> rs = m_astBuilder->create<TypeEqualityWitness>();
rs->sub = type;
rs->sup = type;
return rs;