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/legalize-types.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/slang/legalize-types.cpp') diff --git a/source/slang/legalize-types.cpp b/source/slang/legalize-types.cpp index 1264201a2..211685aa2 100644 --- a/source/slang/legalize-types.cpp +++ b/source/slang/legalize-types.cpp @@ -450,8 +450,7 @@ static RefPtr createBuiltinGenericType( // TODO: we should have library code to make // manipulations like this way easier. - RefPtr oldGenericSubst = getGenericSubstitution( - typeDeclRef.substitutions); + RefPtr oldGenericSubst = typeDeclRef.substitutions.genericSubstitutions; SLANG_ASSERT(oldGenericSubst); RefPtr newGenericSubst = new GenericSubstitution(); -- cgit v1.2.3