From 259f50d6129116823762bbe43e958b838c37253b Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Tue, 26 Apr 2022 07:36:33 -0700 Subject: [PATCH] Fixed autoprop backing field access --- IDEHelper/Compiler/BfExprEvaluator.cpp | 10 ++++++++-- IDEHelper/Compiler/BfModule.cpp | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 85ad6603..66503131 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -5291,9 +5291,15 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar auto field = nextField; nextField = nextField->mNextWithSameName; - + auto checkProtection = field->mProtection; + if (checkProtection == BfProtection_Hidden) + { + // Allow acessing hidden fields + checkProtection = BfProtection_Private; + } + if (((flags & BfLookupFieldFlag_IgnoreProtection) == 0) && (!isFailurePass) && - (!mModule->CheckProtection(protectionCheckFlags, curCheckType, field->mDeclaringType->mProject, field->mProtection, startCheckType))) + (!mModule->CheckProtection(protectionCheckFlags, curCheckType, field->mDeclaringType->mProject, checkProtection, startCheckType))) { continue; } diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 5e339d20..1c8ed8bf 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -2752,7 +2752,9 @@ void BfModule::GetAccessAllowed(BfTypeInstance* checkType, bool &allowProtected, } bool BfModule::CheckProtection(BfProtectionCheckFlags& flags, BfTypeInstance* memberOwner, BfProject* memberProject, BfProtection memberProtection, BfTypeInstance* lookupStartType) -{ +{ + if (memberProtection == BfProtection_Hidden) + return false; if (memberProtection == BfProtection_Public) return true;