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/type-defs.h | |
| 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/type-defs.h')
| -rw-r--r-- | source/slang/type-defs.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/slang/type-defs.h b/source/slang/type-defs.h index 4efbc7ec1..c4ec09f1d 100644 --- a/source/slang/type-defs.h +++ b/source/slang/type-defs.h @@ -61,7 +61,7 @@ SYNTAX_CLASS(DeclRefType, Type) RAW( virtual String ToString() override; - virtual RefPtr<Val> SubstituteImpl(Substitutions* subst, int* ioDiff) override; + virtual RefPtr<Val> SubstituteImpl(SubstitutionSet subst, int* ioDiff) override; static DeclRefType* Create( Session* session, @@ -310,7 +310,7 @@ RAW( protected: virtual bool EqualsImpl(Type * type) override; virtual Type* CreateCanonicalType() override; - virtual RefPtr<Val> SubstituteImpl(Substitutions* subst, int* ioDiff) override; + virtual RefPtr<Val> SubstituteImpl(SubstitutionSet subst, int* ioDiff) override; virtual int GetHashCode() override; ) END_SYNTAX_CLASS() @@ -464,7 +464,7 @@ RAW( virtual String ToString() override; protected: - virtual RefPtr<Val> SubstituteImpl(Substitutions* subst, int* ioDiff) override; + virtual RefPtr<Val> SubstituteImpl(SubstitutionSet subst, int* ioDiff) override; virtual bool EqualsImpl(Type * type) override; virtual Type* CreateCanonicalType() override; virtual int GetHashCode() override; |
