mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-05 07:45:59 +02:00
Fixed Friend check for properties
This commit is contained in:
parent
14ac27c977
commit
d1c373420b
2 changed files with 8 additions and 8 deletions
|
@ -13985,11 +13985,12 @@ BfModuleMethodInstance BfExprEvaluator::GetPropertyMethodInstance(BfMethodDef* m
|
||||||
return mModule->GetMethodInstance(propTypeInst, methodDef, BfTypeVector(), mPropGetMethodFlags);
|
return mModule->GetMethodInstance(propTypeInst, methodDef, BfTypeVector(), mPropGetMethodFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfExprEvaluator::CheckPropFail(BfMethodDef* propMethodDef, BfMethodInstance* methodInstance)
|
void BfExprEvaluator::CheckPropFail(BfMethodDef* propMethodDef, BfMethodInstance* methodInstance, bool checkProt)
|
||||||
{
|
{
|
||||||
auto propTypeInst = mPropTarget.mType->ToTypeInstance();
|
auto propTypeInst = mPropTarget.mType->ToTypeInstance();
|
||||||
// If mExplicitInterface is null then we are implicitly calling through an interface
|
// If mExplicitInterface is null then we are implicitly calling through an interface
|
||||||
if ((propTypeInst != NULL) && (methodInstance->GetExplicitInterface() == NULL) && (!mModule->CheckAccessMemberProtection(propMethodDef->mProtection, propTypeInst)))
|
if ((checkProt) && (propTypeInst != NULL) && (methodInstance->GetExplicitInterface() == NULL) &&
|
||||||
|
(!mModule->CheckAccessMemberProtection(propMethodDef->mProtection, propTypeInst)))
|
||||||
mModule->Fail(StrFormat("'%s' is inaccessible due to its protection level", mModule->MethodToString(methodInstance).c_str()), mPropSrc);
|
mModule->Fail(StrFormat("'%s' is inaccessible due to its protection level", mModule->MethodToString(methodInstance).c_str()), mPropSrc);
|
||||||
else if (mPropCheckedKind != methodInstance->mMethodDef->mCheckedKind)
|
else if (mPropCheckedKind != methodInstance->mMethodDef->mCheckedKind)
|
||||||
{
|
{
|
||||||
|
@ -14070,8 +14071,7 @@ BfTypedValue BfExprEvaluator::GetResult(bool clearResult, bool resolveGenericTyp
|
||||||
if (mPropSrc != NULL)
|
if (mPropSrc != NULL)
|
||||||
mModule->UpdateExprSrcPos(mPropSrc);
|
mModule->UpdateExprSrcPos(mPropSrc);
|
||||||
|
|
||||||
if ((mPropGetMethodFlags & BfGetMethodInstanceFlag_Friend) == 0)
|
CheckPropFail(matchedMethod, methodInstance.mMethodInstance, (mPropGetMethodFlags & BfGetMethodInstanceFlag_Friend) == 0);
|
||||||
CheckPropFail(matchedMethod, methodInstance.mMethodInstance);
|
|
||||||
PerformCallChecks(methodInstance.mMethodInstance, mPropSrc);
|
PerformCallChecks(methodInstance.mMethodInstance, mPropSrc);
|
||||||
|
|
||||||
if (methodInstance.mMethodInstance->IsSkipCall())
|
if (methodInstance.mMethodInstance->IsSkipCall())
|
||||||
|
@ -14910,7 +14910,7 @@ void BfExprEvaluator::PerformAssignment(BfAssignmentExpression* assignExpr, bool
|
||||||
if (methodInstance.mMethodInstance == NULL)
|
if (methodInstance.mMethodInstance == NULL)
|
||||||
return;
|
return;
|
||||||
BF_ASSERT(methodInstance.mMethodInstance->mMethodDef == setMethod);
|
BF_ASSERT(methodInstance.mMethodInstance->mMethodDef == setMethod);
|
||||||
CheckPropFail(setMethod, methodInstance.mMethodInstance);
|
CheckPropFail(setMethod, methodInstance.mMethodInstance, (mPropGetMethodFlags & BfGetMethodInstanceFlag_Friend) == 0);
|
||||||
|
|
||||||
BfTypedValue convVal;
|
BfTypedValue convVal;
|
||||||
if (binaryOp != BfBinaryOp_None)
|
if (binaryOp != BfBinaryOp_None)
|
||||||
|
|
|
@ -329,7 +329,7 @@ public:
|
||||||
BfTypedValue ResolveArgValue(BfResolvedArg& resolvedArg, BfType* wantType, BfTypedValue* receivingValue = NULL, BfParamKind paramKind = BfParamKind_Normal);
|
BfTypedValue ResolveArgValue(BfResolvedArg& resolvedArg, BfType* wantType, BfTypedValue* receivingValue = NULL, BfParamKind paramKind = BfParamKind_Normal);
|
||||||
BfMethodDef* GetPropertyMethodDef(BfPropertyDef* propDef, BfMethodType methodType, BfCheckedKind checkedKind);
|
BfMethodDef* GetPropertyMethodDef(BfPropertyDef* propDef, BfMethodType methodType, BfCheckedKind checkedKind);
|
||||||
BfModuleMethodInstance GetPropertyMethodInstance(BfMethodDef* methodDef);
|
BfModuleMethodInstance GetPropertyMethodInstance(BfMethodDef* methodDef);
|
||||||
void CheckPropFail(BfMethodDef* propMethodDef, BfMethodInstance* methodInstance);
|
void CheckPropFail(BfMethodDef* propMethodDef, BfMethodInstance* methodInstance, bool checkProt);
|
||||||
bool HasResult();
|
bool HasResult();
|
||||||
BfTypedValue GetResult(bool clearResult = false, bool resolveGenericType = false);
|
BfTypedValue GetResult(bool clearResult = false, bool resolveGenericType = false);
|
||||||
void CheckResultForReading(BfTypedValue& typedValue);
|
void CheckResultForReading(BfTypedValue& typedValue);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue