diff options
| author | Yong He <yonghe@outlook.com> | 2018-01-12 14:15:56 -0800 |
|---|---|---|
| committer | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-01-12 14:15:56 -0800 |
| commit | df6eeb93c1718334779ae328db277cdf7a9d7b04 (patch) | |
| tree | f4d53d3106cdc717727701e46411a1ebe23105fb /source/slang/parameter-binding.cpp | |
| parent | 8daafcc2e4bf7b2dfb66d7a3b7ac60c86b2d926c (diff) | |
Refactor substitution representation in DeclRefBase (#363)
This commit changes the type of `DeclRefBase::substitutions` from `RefPtr<Substitutions>` to `SubstitutionSet`, which is a new type defined as following:
```
struct SubstitutionSet
{
RefPtr<GenericSubstitution> genericSubstitutions;
RefPtr<ThisTypeSubstitution> thisTypeSubstitution;
RefPtr<GlobalGenericParamSubstitution> 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.
Diffstat (limited to 'source/slang/parameter-binding.cpp')
| -rw-r--r-- | source/slang/parameter-binding.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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<TypeLayout> 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<ProgramLayout> specializeProgramLayout( TargetRequest * targetReq, ProgramLayout* programLayout, - Substitutions * typeSubst) + SubstitutionSet typeSubst) { RefPtr<ProgramLayout> newProgramLayout; newProgramLayout = new ProgramLayout(); |
