1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Const actualization fixes

This commit is contained in:
Brian Fiete 2021-11-23 15:01:10 -08:00
parent 870c9914be
commit a7da8a75d6
3 changed files with 22 additions and 2 deletions

View file

@ -234,7 +234,10 @@ BfTypedValue BfConstResolver::Resolve(BfExpression* expr, BfType* wantType, BfCo
mModule->FixIntUnknown(mResult); mModule->FixIntUnknown(mResult);
if ((flags & BfConstResolveFlag_NoActualizeValues) == 0) if ((flags & BfConstResolveFlag_NoActualizeValues) == 0)
{
prevIgnoreWrites.Restore();
mModule->FixValueActualization(mResult, !prevIgnoreWrites.mPrevVal || ((flags & BfConstResolveFlag_ActualizeValues) != 0)); mModule->FixValueActualization(mResult, !prevIgnoreWrites.mPrevVal || ((flags & BfConstResolveFlag_ActualizeValues) != 0));
}
return mResult; return mResult;
} }

View file

@ -8499,14 +8499,15 @@ BfType* BfModule::ResolveTypeResult(BfTypeReference* typeRef, BfType* resolvedTy
populateModule->PopulateType(resolvedTypeRef, populateType); populateModule->PopulateType(resolvedTypeRef, populateType);
if ((typeInstance != NULL) && (typeInstance->mTypeDef != NULL) && (typeInstance->mTypeDef->mProtection == BfProtection_Internal) && (typeInstance->mTypeDef->mOuterType == NULL)) if ((typeInstance != NULL) && (typeInstance->mTypeDef != NULL) && (typeInstance->mTypeDef->mProtection == BfProtection_Internal) &&
(typeInstance->mTypeDef->mOuterType == NULL) && (!typeRef->IsTemporary()))
{ {
if (!CheckProtection(typeInstance->mTypeDef->mProtection, typeInstance->mTypeDef, false, false)) if (!CheckProtection(typeInstance->mTypeDef->mProtection, typeInstance->mTypeDef, false, false))
Fail(StrFormat("'%s' is inaccessible due to its protection level", TypeToString(typeInstance).c_str()), typeRef); // CS0122 Fail(StrFormat("'%s' is inaccessible due to its protection level", TypeToString(typeInstance).c_str()), typeRef); // CS0122
} }
if ((populateType > BfPopulateType_Identity) && (!ResolveTypeResult_Validate(typeRef, resolvedTypeRef))) if ((populateType > BfPopulateType_Identity) && (!ResolveTypeResult_Validate(typeRef, resolvedTypeRef)))
return NULL; return NULL;
if (populateType != BfPopulateType_IdentityNoRemapAlias) if (populateType != BfPopulateType_IdentityNoRemapAlias)
{ {

View file

@ -0,0 +1,16 @@
#pragma warning disable 168
using System;
namespace Tests
{
class Reflection2
{
[Test]
public static void TestBasics()
{
const Type t = typeof(StringView);
int fieldCount = t.FieldCount;
}
}
}