summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-constraint.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-constraint.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-constraint.cpp')
-rw-r--r--source/slang/slang-check-constraint.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/slang/slang-check-constraint.cpp b/source/slang/slang-check-constraint.cpp
index a5a5620ae..315f9c5b1 100644
--- a/source/slang/slang-check-constraint.cpp
+++ b/source/slang/slang-check-constraint.cpp
@@ -114,7 +114,7 @@ namespace Slang
continue;
// Look up the type in our session.
- auto candidateType = type->getSession()->getBuiltinType(BaseType(baseTypeFlavorIndex));
+ auto candidateType = type->getASTBuilder()->getBuiltinType(BaseType(baseTypeFlavorIndex));
if(!candidateType)
continue;
@@ -286,7 +286,7 @@ namespace Slang
// that `X<T>.IndexType == T`.
for( auto constraintDeclRef : getMembersOfType<GenericTypeConstraintDecl>(genericDeclRef) )
{
- if(!TryUnifyTypes(*system, GetSub(constraintDeclRef), GetSup(constraintDeclRef)))
+ if(!TryUnifyTypes(*system, GetSub(m_astBuilder, constraintDeclRef), GetSup(m_astBuilder, constraintDeclRef)))
return SubstitutionSet();
}
SubstitutionSet resultSubst = genericDeclRef.substitutions;
@@ -391,7 +391,7 @@ namespace Slang
// search for a conformance `Robin : ISidekick`, which involved
// apply the substitutions we already know...
- RefPtr<GenericSubstitution> solvedSubst = new GenericSubstitution();
+ RefPtr<GenericSubstitution> solvedSubst = m_astBuilder->create<GenericSubstitution>();
solvedSubst->genericDecl = genericDeclRef.getDecl();
solvedSubst->outer = genericDeclRef.substitutions.substitutions;
solvedSubst->args = args;
@@ -404,8 +404,8 @@ namespace Slang
solvedSubst);
// Extract the (substituted) sub- and super-type from the constraint.
- auto sub = GetSub(constraintDeclRef);
- auto sup = GetSup(constraintDeclRef);
+ auto sub = GetSub(m_astBuilder, constraintDeclRef);
+ auto sup = GetSup(m_astBuilder, constraintDeclRef);
// Search for a witness that shows the constraint is satisfied.
auto subTypeWitness = tryGetSubtypeWitness(sub, sup);