mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Self
is type alias definition now refers to outer type
This commit is contained in:
parent
ea5e5fd82a
commit
ea8b80497d
1 changed files with 39 additions and 25 deletions
|
@ -9153,6 +9153,10 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
|
|||
if (findName == "Self")
|
||||
{
|
||||
BfType* selfType = mCurTypeInstance;
|
||||
if (selfType->IsTypeAlias())
|
||||
selfType = GetOuterType(selfType);
|
||||
if (selfType != NULL)
|
||||
{
|
||||
if (selfType->IsInterface()) // For interfaces, 'Self' refers to the identity of the implementing type, so we use a placeholder
|
||||
return GetPrimitiveType(BfTypeCode_Self);
|
||||
else
|
||||
|
@ -9165,6 +9169,7 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
|
|||
if ((selfType->IsSpecializedType()) || (selfType->IsUnspecializedTypeVariation()))
|
||||
selfType = ResolveTypeDef(selfType->ToTypeInstance()->mTypeDef, populateType);
|
||||
}
|
||||
}
|
||||
if (selfType != NULL)
|
||||
{
|
||||
auto selfTypeInst = selfType->ToTypeInstance();
|
||||
|
@ -9181,8 +9186,11 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
|
|||
else if (findName == "SelfBase")
|
||||
{
|
||||
BfType* selfType = mCurTypeInstance;
|
||||
if (selfType->IsTypeAlias())
|
||||
selfType = GetOuterType(selfType);
|
||||
if (selfType != NULL)
|
||||
{
|
||||
resolveFlags = (BfResolveTypeRefFlags)(resolveFlags | BfResolveTypeRefFlag_FromIndirectSource);
|
||||
|
||||
if (selfType->IsBoxed())
|
||||
selfType = selfType->GetUnderlyingType();
|
||||
if ((resolveFlags & BfResolveTypeRefFlag_NoResolveGenericParam) != 0)
|
||||
|
@ -9190,6 +9198,7 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
|
|||
if ((selfType->IsSpecializedType()) || (selfType->IsUnspecializedTypeVariation()))
|
||||
selfType = ResolveTypeDef(selfType->ToTypeInstance()->mTypeDef, populateType);
|
||||
}
|
||||
}
|
||||
BfType* baseType = NULL;
|
||||
if (selfType != NULL)
|
||||
{
|
||||
|
@ -9213,6 +9222,10 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
|
|||
else if (findName == "SelfOuter")
|
||||
{
|
||||
BfType* selfType = mCurTypeInstance;
|
||||
if (selfType->IsTypeAlias())
|
||||
selfType = GetOuterType(selfType);
|
||||
if (selfType != NULL)
|
||||
{
|
||||
resolveFlags = (BfResolveTypeRefFlags)(resolveFlags | BfResolveTypeRefFlag_FromIndirectSource);
|
||||
if (selfType->IsBoxed())
|
||||
selfType = selfType->GetUnderlyingType();
|
||||
|
@ -9221,7 +9234,8 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
|
|||
if ((selfType->IsSpecializedType()) || (selfType->IsUnspecializedTypeVariation()))
|
||||
selfType = ResolveTypeDef(selfType->ToTypeInstance()->mTypeDef, populateType);
|
||||
}
|
||||
selfType = GetOuterType(mCurTypeInstance);
|
||||
selfType = GetOuterType(selfType->ToTypeInstance());
|
||||
}
|
||||
if (selfType == NULL)
|
||||
Fail("'SelfOuter' type is not usable here", typeRef);
|
||||
return ResolveTypeResult(typeRef, selfType, populateType, resolveFlags);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue