mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
In 'for' loop, check base types for enumerator interfaces
This commit is contained in:
parent
1fe4a27abf
commit
84bc0ad1de
1 changed files with 7 additions and 2 deletions
|
@ -6343,6 +6343,7 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
|
||||||
if (targetTypeInstance != NULL)
|
if (targetTypeInstance != NULL)
|
||||||
{
|
{
|
||||||
PopulateType(targetTypeInstance, BfPopulateType_DataAndMethods);
|
PopulateType(targetTypeInstance, BfPopulateType_DataAndMethods);
|
||||||
|
|
||||||
auto getEnumeratorMethod = GetMethodByName(targetTypeInstance, "GetEnumerator", 0, true);
|
auto getEnumeratorMethod = GetMethodByName(targetTypeInstance, "GetEnumerator", 0, true);
|
||||||
if (!getEnumeratorMethod)
|
if (!getEnumeratorMethod)
|
||||||
{
|
{
|
||||||
|
@ -6410,9 +6411,10 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
|
||||||
};
|
};
|
||||||
|
|
||||||
auto enumeratorTypeInst = itr.mType->ToTypeInstance();
|
auto enumeratorTypeInst = itr.mType->ToTypeInstance();
|
||||||
|
while (enumeratorTypeInst != NULL)
|
||||||
if (enumeratorTypeInst != NULL)
|
|
||||||
{
|
{
|
||||||
|
PopulateType(enumeratorTypeInst, Beefy::BfPopulateType_Interfaces_All);
|
||||||
|
|
||||||
for (auto& interfaceRef : enumeratorTypeInst->mInterfaces)
|
for (auto& interfaceRef : enumeratorTypeInst->mInterfaces)
|
||||||
{
|
{
|
||||||
BfTypeInstance* interface = interfaceRef.mInterfaceType;
|
BfTypeInstance* interface = interfaceRef.mInterfaceType;
|
||||||
|
@ -6432,7 +6434,10 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
|
||||||
varType = CreateRefType(varType);
|
varType = CreateRefType(varType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enumeratorTypeInst = enumeratorTypeInst->mBaseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((genericItrInterface == NULL) && (genericParamInst != NULL))
|
if ((genericItrInterface == NULL) && (genericParamInst != NULL))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue