1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Allow private member access in initializer block when subclassing

This commit is contained in:
Brian Fiete 2025-01-06 07:10:18 -08:00
parent 40a9dbf25c
commit 971cecdd99
3 changed files with 35 additions and 36 deletions

View file

@ -2884,6 +2884,9 @@ void BfModule::GetAccessAllowed(BfTypeInstance* checkType, bool &allowProtected,
bool BfModule::CheckProtection(BfProtectionCheckFlags& flags, BfTypeInstance* memberOwner, BfProject* memberProject, BfProtection memberProtection, BfTypeInstance* lookupStartType)
{
if ((memberOwner != NULL) && (mCurMethodState != NULL) && (mCurMethodState->mPrivateTypeInstance == memberOwner))
return true;
if (memberProtection == BfProtection_Hidden)
return false;
if (memberProtection == BfProtection_Public)
@ -22233,6 +22236,7 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup,
mCurMethodState->mHeadScope.mAstBlock = bodyBlock;
mCurMethodState->mHeadScope.mCloseNode = bodyBlock->mCloseBrace;
VisitCodeBlock(bodyBlock);
BF_ASSERT(mCurMethodState->mCurScope == &mCurMethodState->mHeadScope);
}
else if (auto expressionBody = BfNodeDynCast<BfExpression>(methodDef->mBody))
{