1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Allow typeof(Self) in static section

This commit is contained in:
Brian Fiete 2021-11-27 08:01:08 -08:00
parent 88711eae69
commit 0d837d23cb
3 changed files with 4 additions and 3 deletions

View file

@ -10264,7 +10264,7 @@ void BfExprEvaluator::Visit(BfTypeOfExpression* typeOfExpr)
}
else
{
type = ResolveTypeRef(typeOfExpr->mTypeRef, BfPopulateType_Identity);
type = ResolveTypeRef(typeOfExpr->mTypeRef, BfPopulateType_Identity, BfResolveTypeRefFlag_AllowGlobalsSelf);
}
if (type == NULL)

View file

@ -9375,7 +9375,7 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
if (selfType != NULL)
{
auto selfTypeInst = selfType->ToTypeInstance();
if ((selfTypeInst != NULL) && (selfTypeInst->mTypeDef->IsGlobalsContainer()))
if ((selfTypeInst != NULL) && (selfTypeInst->mTypeDef->IsGlobalsContainer()) && ((resolveFlags & BfResolveTypeRefFlag_AllowGlobalsSelf) == 0))
selfType = NULL;
}

View file

@ -35,7 +35,8 @@ enum BfResolveTypeRefFlags
BfResolveTypeRefFlag_DisallowComptime = 0x1000,
BfResolveTypeRefFlag_AllowDotDotDot = 0x2000,
BfResolveTypeRefFlag_AllowGlobalContainer = 0x4000,
BfResolveTypeRefFlag_AllowInferredSizedArray = 0x8000
BfResolveTypeRefFlag_AllowInferredSizedArray = 0x8000,
BfResolveTypeRefFlag_AllowGlobalsSelf = 0x10000,
};
enum BfTypeNameFlags : uint16