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

Fixed foreach ref iteration with sized arrays

This commit is contained in:
Brian Fiete 2021-01-20 13:18:03 -08:00
parent 3c8bb9bed9
commit b1432782a8

View file

@ -6572,6 +6572,8 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
{
target = MakeAddressable(target);
arrayItem = BfTypedValue(CreateIndexedValue(arrayType->mElementType, target.mValue, itrVal, true), arrayType->mElementType, true);
if (isRefExpression)
arrayItem = BfTypedValue(arrayItem.mValue, CreateRefType(arrayItem.mType));
}
arrayItem = Cast(forEachStmt->mCollectionExpression, arrayItem, varType, BfCastFlags_Explicit);
if ((arrayItem) && (!arrayItem.mValue.IsFake()))