1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

In 'for' loop, check base types for enumerator interfaces

This commit is contained in:
Brian Fiete 2022-06-27 15:39:50 -07:00
parent 1fe4a27abf
commit 84bc0ad1de

View file

@ -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))