mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed access error for protected properties
This commit is contained in:
parent
1de552e940
commit
1db7f78b28
1 changed files with 14 additions and 7 deletions
|
@ -2736,7 +2736,10 @@ bool BfModule::CheckAccessMemberProtection(BfProtection protection, BfType* memb
|
||||||
bool allowPrivate = (memberType == mCurTypeInstance) || (IsInnerType(mCurTypeInstance, memberType));
|
bool allowPrivate = (memberType == mCurTypeInstance) || (IsInnerType(mCurTypeInstance, memberType));
|
||||||
if (!allowPrivate)
|
if (!allowPrivate)
|
||||||
allowPrivate |= memberType->IsInterface();
|
allowPrivate |= memberType->IsInterface();
|
||||||
bool allowProtected = allowPrivate;// allowPrivate || TypeIsSubTypeOf(mCurTypeInstance, memberType->ToTypeInstance());
|
bool allowProtected = allowPrivate;
|
||||||
|
//TODO: We had this commented out, but this makes accessing protected properties fail
|
||||||
|
if (mCurTypeInstance != NULL)
|
||||||
|
allowProtected |= TypeIsSubTypeOf(mCurTypeInstance, memberType->ToTypeInstance());
|
||||||
if (!CheckProtection(protection, allowProtected, allowPrivate))
|
if (!CheckProtection(protection, allowProtected, allowPrivate))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -3314,7 +3317,7 @@ void BfModule::ResolveConstField(BfTypeInstance* typeInstance, BfFieldInstance*
|
||||||
fieldType = fieldInstance->GetResolvedType();
|
fieldType = fieldInstance->GetResolvedType();
|
||||||
if ((fieldType == NULL) || (fieldType->IsVar()))
|
if ((fieldType == NULL) || (fieldType->IsVar()))
|
||||||
{
|
{
|
||||||
AssertErrorState();
|
AssertZeberrorState();
|
||||||
// Default const type is 'int'
|
// Default const type is 'int'
|
||||||
BfTypedValue initValue = GetDefaultTypedValue(GetPrimitiveType(BfTypeCode_IntPtr));
|
BfTypedValue initValue = GetDefaultTypedValue(GetPrimitiveType(BfTypeCode_IntPtr));
|
||||||
if (fieldInstance != NULL)
|
if (fieldInstance != NULL)
|
||||||
|
@ -3360,7 +3363,7 @@ BfType* BfModule::ResolveVarFieldType(BfTypeInstance* typeInstance, BfFieldInsta
|
||||||
|
|
||||||
if ((!field->mIsStatic) && (typeDef->mIsStatic))
|
if ((!field->mIsStatic) && (typeDef->mIsStatic))
|
||||||
{
|
{
|
||||||
AssertErrorState();
|
AssertZeberrorState();
|
||||||
return GetPrimitiveType(BfTypeCode_Var);
|
return GetPrimitiveType(BfTypeCode_Var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12944,10 +12947,14 @@ void BfModule::EmitReturn(BfIRValue val)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EmitDeferredScopeCalls(false, NULL);
|
EmitDeferredScopeCalls(false, NULL);
|
||||||
if (mCurMethodInstance->mReturnType->IsValuelessType())
|
|
||||||
mBfIRBuilder->CreateRetVoid();
|
if (val)
|
||||||
else
|
{
|
||||||
mBfIRBuilder->CreateRet(val);
|
if (mCurMethodInstance->mReturnType->IsValuelessType())
|
||||||
|
mBfIRBuilder->CreateRetVoid();
|
||||||
|
else
|
||||||
|
mBfIRBuilder->CreateRet(val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mCurMethodState->SetHadReturn(true);
|
mCurMethodState->SetHadReturn(true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue