From 643aaa13d2c6e0c4994437aa9fba6716787608ce Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 7 Jul 2023 14:26:37 -0700 Subject: Make DeclRefBase a Val, and DeclRef a helper class. (#2967) * Make DeclRefBase a Val, and DeclRef a helper class. * Fixes. * Workaround gcc parser issue. * Revert NodeOperand change. * Fix. * Fix clang incomplete class complains. * Fix code review. * Small cleanups and improvements. --------- Co-authored-by: Yong He --- source/slang/slang-lookup.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/slang/slang-lookup.cpp') diff --git a/source/slang/slang-lookup.cpp b/source/slang/slang-lookup.cpp index 46977b71d..b16671efb 100644 --- a/source/slang/slang-lookup.cpp +++ b/source/slang/slang-lookup.cpp @@ -176,7 +176,7 @@ static void _lookUpDirectAndTransparentMembers( AddToLookupResult( result, CreateLookupResultItem( - astBuilder->getSpecializedDeclRef(member, containerDeclRef.substitutions), inBreadcrumbs)); + astBuilder->getSpecializedDeclRef(member, containerDeclRef.getSubst()), inBreadcrumbs)); } } else @@ -201,7 +201,7 @@ static void _lookUpDirectAndTransparentMembers( continue; // The declaration passed the test, so add it! - AddToLookupResult(result, CreateLookupResultItem(astBuilder->getSpecializedDeclRef(m, containerDeclRef.substitutions), inBreadcrumbs)); + AddToLookupResult(result, CreateLookupResultItem(astBuilder->getSpecializedDeclRef(m, containerDeclRef.getSubst()), inBreadcrumbs)); } } @@ -211,7 +211,7 @@ static void _lookUpDirectAndTransparentMembers( { // The reference to the transparent member should use whatever // substitutions we used in referring to its outer container - DeclRef transparentMemberDeclRef = astBuilder->getSpecializedDeclRef(transparentInfo.decl, containerDeclRef.substitutions); + DeclRef transparentMemberDeclRef = astBuilder->getSpecializedDeclRef(transparentInfo.decl, containerDeclRef.getSubst()); // We need to leave a breadcrumb so that we know that the result // of lookup involves a member lookup step here @@ -320,7 +320,7 @@ static Type* _maybeSpecializeSuperType( ThisTypeSubstitution* thisTypeSubst = astBuilder->create(); thisTypeSubst->interfaceDecl = superInterfaceDeclRef.getDecl(); thisTypeSubst->witness = subIsSuperWitness; - thisTypeSubst->outer = superInterfaceDeclRef.substitutions.substitutions; + thisTypeSubst->outer = superInterfaceDeclRef.getSubst(); auto specializedInterfaceDeclRef = astBuilder->getSpecializedDeclRef(superInterfaceDeclRef.getDecl(), thisTypeSubst); @@ -403,7 +403,7 @@ static void _lookUpMembersInSuperType( { if( request.semantics ) { - ensureDecl(request.semantics, intermediateIsSuperConstraint, DeclCheckState::CanUseBaseOfInheritanceDecl); + ensureDecl(request.semantics, intermediateIsSuperConstraint.getDecl(), DeclCheckState::CanUseBaseOfInheritanceDecl); } // The super-type in the constraint (e.g., `Foo` in `T : Foo`) @@ -450,11 +450,11 @@ static void _lookUpMembersInSuperTypeDeclImpl( auto genericDeclRef = genericTypeParamDeclRef.getParent(astBuilder).as(); assert(genericDeclRef); - for(auto constraintDeclRef : getMembersOfType(astBuilder, genericDeclRef)) + for(auto constraintDeclRef : getMembersOfType(astBuilder, DeclRef(genericDeclRef))) { if( semantics ) { - ensureDecl(semantics, constraintDeclRef, DeclCheckState::CanUseBaseOfInheritanceDecl); + ensureDecl(semantics, constraintDeclRef.getDecl(), DeclCheckState::CanUseBaseOfInheritanceDecl); } // Does this constraint pertain to the type we are working on? -- cgit v1.2.3