mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Fixed 'using' protection check, populate circular ref in LookupField
This commit is contained in:
parent
9642060e06
commit
8020f6b9d3
1 changed files with 22 additions and 16 deletions
|
@ -2822,8 +2822,7 @@ bool BfMethodMatcher::CheckType(BfTypeInstance* typeInstance, BfTypedValue targe
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mUsingLists != NULL) && (curTypeInst->mTypeDef->mHasUsingFields) &&
|
if ((mUsingLists != NULL) && (curTypeInst->mTypeDef->mHasUsingFields))
|
||||||
((curTypeInst->mTypeInfoEx == NULL) || (curTypeInst->mTypeInfoEx->mUsingFieldData == NULL)))
|
|
||||||
mModule->PopulateUsingFieldData(curTypeInst);
|
mModule->PopulateUsingFieldData(curTypeInst);
|
||||||
|
|
||||||
if (mUsingLists != NULL)
|
if (mUsingLists != NULL)
|
||||||
|
@ -2841,6 +2840,7 @@ bool BfMethodMatcher::CheckType(BfTypeInstance* typeInstance, BfTypedValue targe
|
||||||
for (int entryIdx = 0; entryIdx < entryList.mSize; entryIdx++)
|
for (int entryIdx = 0; entryIdx < entryList.mSize; entryIdx++)
|
||||||
{
|
{
|
||||||
auto& entry = entryList[entryIdx];
|
auto& entry = entryList[entryIdx];
|
||||||
|
BfProtectionCheckFlags protectionCheckFlags = BfProtectionCheckFlag_None;
|
||||||
if (!mModule->CheckProtection(protectionCheckFlags, entry.mTypeInstance, entry.GetDeclaringType(mModule)->mProject,
|
if (!mModule->CheckProtection(protectionCheckFlags, entry.mTypeInstance, entry.GetDeclaringType(mModule)->mProject,
|
||||||
(entryIdx < entryList.mSize - 1) ? entry.GetUsingProtection() : entry.GetProtection(), curTypeInst))
|
(entryIdx < entryList.mSize - 1) ? entry.GetUsingProtection() : entry.GetProtection(), curTypeInst))
|
||||||
{
|
{
|
||||||
|
@ -5531,23 +5531,29 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
||||||
bool isBaseLookup = false;
|
bool isBaseLookup = false;
|
||||||
while (curCheckType != NULL)
|
while (curCheckType != NULL)
|
||||||
{
|
{
|
||||||
bool isPopulatingType = false;
|
///
|
||||||
if (mModule->mContext->mCurTypeState != NULL)
|
|
||||||
{
|
{
|
||||||
if (curCheckType == mModule->mContext->mCurTypeState->mType)
|
bool isPopulatingType = false;
|
||||||
|
|
||||||
|
auto checkTypeState = mModule->mContext->mCurTypeState;
|
||||||
|
while (checkTypeState != NULL)
|
||||||
{
|
{
|
||||||
isPopulatingType = true;
|
if (curCheckType == checkTypeState->mType)
|
||||||
if (mModule->mContext->mCurTypeState->mResolveKind == BfTypeState::ResolveKind_Attributes)
|
|
||||||
{
|
{
|
||||||
// Don't allow lookups yet
|
isPopulatingType = true;
|
||||||
return BfTypedValue();
|
if (checkTypeState->mResolveKind == BfTypeState::ResolveKind_Attributes)
|
||||||
|
{
|
||||||
|
// Don't allow lookups yet
|
||||||
|
return BfTypedValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
checkTypeState = checkTypeState->mPrevState;
|
||||||
|
}
|
||||||
|
if ((!isPopulatingType) && (curCheckType->mDefineState < Beefy::BfTypeDefineState_Defined))
|
||||||
|
{
|
||||||
|
// We MAY have emitted fields so we need to do this
|
||||||
|
mModule->mContext->mUnreifiedModule->PopulateType(curCheckType, Beefy::BfPopulateType_Interfaces_All);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ((!isPopulatingType) && (curCheckType->mDefineState < Beefy::BfTypeDefineState_Defined))
|
|
||||||
{
|
|
||||||
// We MAY have emitted fields so we need to do this
|
|
||||||
mModule->mContext->mUnreifiedModule->PopulateType(curCheckType, Beefy::BfPopulateType_Interfaces_All);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
curCheckType->mTypeDef->PopulateMemberSets();
|
curCheckType->mTypeDef->PopulateMemberSets();
|
||||||
|
@ -5728,8 +5734,7 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
||||||
return LoadProperty(targetSrc, target, curCheckType, matchedProp, flags, checkedKind, isInlined);
|
return LoadProperty(targetSrc, target, curCheckType, matchedProp, flags, checkedKind, isInlined);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((curCheckType->mTypeDef->mHasUsingFields) &&
|
if (curCheckType->mTypeDef->mHasUsingFields)
|
||||||
((curCheckType->mTypeInfoEx == NULL) || (curCheckType->mTypeInfoEx->mUsingFieldData == NULL)))
|
|
||||||
mModule->PopulateUsingFieldData(curCheckType);
|
mModule->PopulateUsingFieldData(curCheckType);
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -5749,6 +5754,7 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
||||||
for (int entryIdx = 0; entryIdx < entryList.mSize; entryIdx++)
|
for (int entryIdx = 0; entryIdx < entryList.mSize; entryIdx++)
|
||||||
{
|
{
|
||||||
auto& entry = entryList[entryIdx];
|
auto& entry = entryList[entryIdx];
|
||||||
|
BfProtectionCheckFlags protectionCheckFlags = BfProtectionCheckFlag_None;
|
||||||
if (!mModule->CheckProtection(protectionCheckFlags, entry.mTypeInstance, entry.GetDeclaringType(mModule)->mProject,
|
if (!mModule->CheckProtection(protectionCheckFlags, entry.mTypeInstance, entry.GetDeclaringType(mModule)->mProject,
|
||||||
(entryIdx < entryList.mSize - 1) ? entry.GetUsingProtection() : entry.GetProtection(), curCheckType))
|
(entryIdx < entryList.mSize - 1) ? entry.GetUsingProtection() : entry.GetProtection(), curCheckType))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue