From df6eeb93c1718334779ae328db277cdf7a9d7b04 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 12 Jan 2018 14:15:56 -0800 Subject: Refactor substitution representation in DeclRefBase (#363) This commit changes the type of `DeclRefBase::substitutions` from `RefPtr` to `SubstitutionSet`, which is a new type defined as following: ``` struct SubstitutionSet { RefPtr genericSubstitutions; RefPtr thisTypeSubstitution; RefPtr globalGenParamSubstitutions; } ``` This change get rid of most helper functions to retreive the substitution of a certain type, as well as surgery operations to insert a `ThisTypeSubstitution` or `GlobalGenericTypeSubstittuion` at top or bottom of the substitution chain. It also simplies type comparison when certain type of substitution should not be considered as part of type definition. --- source/slang/parameter-binding.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/slang/parameter-binding.cpp') diff --git a/source/slang/parameter-binding.cpp b/source/slang/parameter-binding.cpp index fcd3fa525..e5ea1d531 100644 --- a/source/slang/parameter-binding.cpp +++ b/source/slang/parameter-binding.cpp @@ -1529,7 +1529,7 @@ static RefPtr processEntryPointParameter( static void collectEntryPointParameters( ParameterBindingContext* context, EntryPointRequest* entryPoint, - Substitutions* typeSubst) + SubstitutionSet typeSubst) { FuncDecl* entryPointFuncDecl = entryPoint->decl; if (!entryPointFuncDecl) @@ -1722,7 +1722,7 @@ static void collectParameters( for( auto& entryPoint : translationUnit->entryPoints ) { context->stage = entryPoint->profile.GetStage(); - collectEntryPointParameters(context, entryPoint.Ptr(), nullptr); + collectEntryPointParameters(context, entryPoint.Ptr(), SubstitutionSet()); } context->entryPointLayout = nullptr; } @@ -2059,7 +2059,7 @@ StructTypeLayout* getGlobalStructLayout( RefPtr specializeProgramLayout( TargetRequest * targetReq, ProgramLayout* programLayout, - Substitutions * typeSubst) + SubstitutionSet typeSubst) { RefPtr newProgramLayout; newProgramLayout = new ProgramLayout(); -- cgit v1.2.3