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

Protected protection improvements

This commit is contained in:
Brian Fiete 2020-12-06 07:32:01 -08:00
parent 670de8d4dc
commit 8852e7e194
7 changed files with 94 additions and 36 deletions

View file

@ -2584,19 +2584,37 @@ bool BfModule::CheckProtection(BfProtectionCheckFlags& flags, BfTypeInstance* me
curCheckType = mixinOwner;
}
auto lookupCheckType = lookupStartType;
while (lookupCheckType->mInheritDepth >= curCheckType->mInheritDepth)
if ((flags & BfProtectionCheckFlag_InstanceLookup) != 0)
{
if (lookupCheckType == curCheckType)
auto lookupCheckType = lookupStartType;
while (lookupCheckType->mInheritDepth >= curCheckType->mInheritDepth)
{
allowProtected = true;
break;
if (lookupCheckType == curCheckType)
{
allowProtected = true;
break;
}
if (lookupCheckType == memberOwner)
break;
lookupCheckType = lookupCheckType->mBaseType;
if (lookupCheckType == NULL)
break;
}
}
else
{
auto lookupCheckType = curCheckType;
while (lookupCheckType->mInheritDepth >= memberOwner->mInheritDepth)
{
if (lookupCheckType == memberOwner)
{
allowProtected = true;
break;
}
lookupCheckType = lookupCheckType->mBaseType;
if (lookupCheckType == NULL)
break;
}
if (lookupCheckType == memberOwner)
break;
lookupCheckType = lookupCheckType->mBaseType;
if (lookupCheckType == NULL)
break;
}
if (!allowProtected)