diff options
| author | Yong He <yonghe@outlook.com> | 2018-01-16 14:52:06 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-16 14:52:06 -0800 |
| commit | 68f529af8d0eb8ec45a2d73e82c4ee372015ce01 (patch) | |
| tree | 9895842d33893b9a233f58964cfa55b3974d6134 /source/slang/syntax.cpp | |
| parent | 59691aeeb013c5bb7cdaa31a6fc572eebd8be610 (diff) | |
| parent | a74a5494b34e2b41a294042ab8b3e7bce115dcba (diff) | |
Merge pull request #370 from csyonghe/master
bug fixes to get falcor example shader code to compile.
Diffstat (limited to 'source/slang/syntax.cpp')
| -rw-r--r-- | source/slang/syntax.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp index 2ed10e138..552f1dc56 100644 --- a/source/slang/syntax.cpp +++ b/source/slang/syntax.cpp @@ -1673,6 +1673,32 @@ void Type::accept(IValVisitor* visitor, void* extra) // TODO: should really have a `type.cpp` and a `witness.cpp` + bool TypeEqualityWitness::EqualsVal(Val* val) + { + auto otherWitness = dynamic_cast<TypeEqualityWitness*>(val); + if (!otherWitness) + return false; + return sub->Equals(otherWitness->sub); + } + + RefPtr<Val> TypeEqualityWitness::SubstituteImpl(SubstitutionSet subst, int * ioDiff) + { + RefPtr<TypeEqualityWitness> rs = new TypeEqualityWitness(); + rs->sub = sub->SubstituteImpl(subst, ioDiff).As<Type>(); + rs->sup = sup->SubstituteImpl(subst, ioDiff).As<Type>(); + return rs; + } + + String TypeEqualityWitness::ToString() + { + return "TypeEqualityWitness(" + sub->ToString() + ")"; + } + + int TypeEqualityWitness::GetHashCode() + { + return sub->GetHashCode(); + } + bool DeclaredSubtypeWitness::EqualsVal(Val* val) { auto otherWitness = dynamic_cast<DeclaredSubtypeWitness*>(val); @@ -1760,10 +1786,7 @@ void Type::accept(IValVisitor* visitor, void* extra) int DeclaredSubtypeWitness::GetHashCode() { - auto hash = sub->GetHashCode(); - hash = combineHash(hash, sup->GetHashCode()); - hash = combineHash(hash, declRef.GetHashCode()); - return hash; + return declRef.GetHashCode(); } // TransitiveSubtypeWitness |
