mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
More sophisticated Self equality check (ie: 'Result<Self>')
This commit is contained in:
parent
c6ca4c8bb4
commit
913d60ef5b
1 changed files with 11 additions and 5 deletions
|
@ -4940,12 +4940,18 @@ String BfTypeUtils::TypeToString(BfAstNode* typeRefNode)
|
|||
return typeRef->ToString();
|
||||
}
|
||||
|
||||
bool BfTypeUtils::TypeEquals(BfType* typeA, BfType* typeB, BfType* selfType)
|
||||
bool BfTypeUtils::TypeEquals(BfType* typeA, BfType* typeB, BfTypeInstance* selfType)
|
||||
{
|
||||
if (typeA->IsSelf())
|
||||
typeA = selfType;
|
||||
if (typeB->IsSelf())
|
||||
typeB = selfType;
|
||||
if (typeA->IsUnspecializedTypeVariation())
|
||||
{
|
||||
SetAndRestoreValue<BfTypeInstance*> prevCurTypeInst(selfType->mModule->mCurTypeInstance, selfType);
|
||||
return selfType->mModule->ResolveGenericType(typeA, NULL, NULL);
|
||||
}
|
||||
if (typeB->IsUnspecializedTypeVariation())
|
||||
{
|
||||
SetAndRestoreValue<BfTypeInstance*> prevCurTypeInst(selfType->mModule->mCurTypeInstance, selfType);
|
||||
return selfType->mModule->ResolveGenericType(typeB, NULL, NULL);
|
||||
}
|
||||
return typeA == typeB;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue