mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +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)
|
||||
{
|
||||
PopulateType(targetTypeInstance, BfPopulateType_DataAndMethods);
|
||||
|
||||
auto getEnumeratorMethod = GetMethodByName(targetTypeInstance, "GetEnumerator", 0, true);
|
||||
if (!getEnumeratorMethod)
|
||||
{
|
||||
|
@ -6410,9 +6411,10 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
|
|||
};
|
||||
|
||||
auto enumeratorTypeInst = itr.mType->ToTypeInstance();
|
||||
|
||||
if (enumeratorTypeInst != NULL)
|
||||
while (enumeratorTypeInst != NULL)
|
||||
{
|
||||
PopulateType(enumeratorTypeInst, Beefy::BfPopulateType_Interfaces_All);
|
||||
|
||||
for (auto& interfaceRef : enumeratorTypeInst->mInterfaces)
|
||||
{
|
||||
BfTypeInstance* interface = interfaceRef.mInterfaceType;
|
||||
|
@ -6432,7 +6434,10 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
|
|||
varType = CreateRefType(varType);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
enumeratorTypeInst = enumeratorTypeInst->mBaseType;
|
||||
}
|
||||
|
||||
if ((genericItrInterface == NULL) && (genericParamInst != NULL))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue