From c2d31347ea06c768045e7c503ef0188e0e5356de Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 28 May 2020 14:01:51 -0400 Subject: 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. --- source/slang/slang-check-conformance.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source/slang/slang-check-conformance.cpp') 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 SemanticsVisitor::createSimpleSubtypeWitness( TypeWitnessBreadcrumb* breadcrumb) { - RefPtr witness = new DeclaredSubtypeWitness(); + RefPtr witness = m_astBuilder->create(); 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 transitiveWitness = new TransitiveSubtypeWitness(); + RefPtr transitiveWitness = m_astBuilder->create(); 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(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(genericDeclRef) ) { - auto sub = GetSub(constraintDeclRef); - auto sup = GetSup(constraintDeclRef); + auto sub = GetSub(m_astBuilder, constraintDeclRef); + auto sup = GetSup(m_astBuilder, constraintDeclRef); auto subDeclRef = as(sub); if(!subDeclRef) @@ -313,9 +313,9 @@ namespace Slang // if(outWitness) { - RefPtr taggedUnionWitness = new TaggedUnionSubtypeWitness(); + RefPtr taggedUnionWitness = m_astBuilder->create(); 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 SemanticsVisitor::createTypeEqualityWitness( Type* type) { - RefPtr rs = new TypeEqualityWitness(); + RefPtr rs = m_astBuilder->create(); rs->sub = type; rs->sup = type; return rs; -- cgit v1.2.3