1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-11 04:52:21 +02:00

Respect Prop IsTypeMemberIncluded in specialized sections

This commit is contained in:
Brian Fiete 2024-03-22 07:47:21 -04:00
parent 45035c69e9
commit 085a3fe091

View file

@ -5758,10 +5758,12 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
if ((!target.IsStatic()) || (prop->mIsStatic) || ((mBfEvalExprFlags & BfEvalExprFlags_NameOf) != 0)) if ((!target.IsStatic()) || (prop->mIsStatic) || ((mBfEvalExprFlags & BfEvalExprFlags_NameOf) != 0))
{ {
if (!curCheckType->IsTypeMemberIncluded(prop->mDeclaringType, activeTypeDef, mModule))
continue;
if (!mModule->IsInSpecializedSection()) if (!mModule->IsInSpecializedSection())
{ {
if ((!curCheckType->IsTypeMemberIncluded(prop->mDeclaringType, activeTypeDef, mModule)) || if (!curCheckType->IsTypeMemberAccessible(prop->mDeclaringType, mModule->GetVisibleProjectSet()))
(!curCheckType->IsTypeMemberAccessible(prop->mDeclaringType, mModule->GetVisibleProjectSet())))
continue; continue;
} }
@ -11879,12 +11881,17 @@ bool BfExprEvaluator::LookupTypeProp(BfTypeOfExpression* typeOfExpr, BfIdentifie
_Int32Result((typeInstance != NULL) ? typeInstance->GetInstStride() : type->GetStride()); _Int32Result((typeInstance != NULL) ? typeInstance->GetInstStride() : type->GetStride());
else if (memberName == "UnderlyingType") else if (memberName == "UnderlyingType")
{ {
bool handled = false;
auto typeType = mModule->ResolveTypeDef(mModule->mCompiler->mTypeTypeDef); auto typeType = mModule->ResolveTypeDef(mModule->mCompiler->mTypeTypeDef);
if (type->IsGenericParam()) if (type->IsGenericParam())
{ {
auto genericParamInstance = mModule->GetGenericParamInstance((BfGenericParamType*)type); auto genericParamInstance = mModule->GetGenericParamInstance((BfGenericParamType*)type);
if (genericParamInstance->IsEnum()) if (genericParamInstance->IsEnum())
{
handled = true;
mResult = BfTypedValue(mModule->mBfIRBuilder->GetUndefConstValue(mModule->mBfIRBuilder->MapType(typeType)), typeType); mResult = BfTypedValue(mModule->mBfIRBuilder->GetUndefConstValue(mModule->mBfIRBuilder->MapType(typeType)), typeType);
}
} }
else if (type->IsEnum()) else if (type->IsEnum())
{ {
@ -11893,10 +11900,14 @@ bool BfExprEvaluator::LookupTypeProp(BfTypeOfExpression* typeOfExpr, BfIdentifie
auto underlyingType = type->GetUnderlyingType(); auto underlyingType = type->GetUnderlyingType();
if (underlyingType != NULL) if (underlyingType != NULL)
{ {
handled = true;
mModule->AddDependency(underlyingType, mModule->mCurTypeInstance, BfDependencyMap::DependencyFlag_ExprTypeReference); mModule->AddDependency(underlyingType, mModule->mCurTypeInstance, BfDependencyMap::DependencyFlag_ExprTypeReference);
mResult = BfTypedValue(mModule->CreateTypeDataRef(underlyingType), typeType); mResult = BfTypedValue(mModule->CreateTypeDataRef(underlyingType), typeType);
} }
} }
if (!handled)
mResult = BfTypedValue(mModule->CreateTypeDataRef(mModule->GetPrimitiveType(BfTypeCode_None)), typeType);
} }
else if (memberName == "BitSize") else if (memberName == "BitSize")
{ {