1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-27 03:58:01 +02:00

Fixed Win32 eval

This commit is contained in:
Brian Fiete 2019-12-01 10:17:09 -08:00
parent 5b25039ff4
commit 2bb2a5926a
6 changed files with 48 additions and 40 deletions

View file

@ -6145,19 +6145,26 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
BfMethodMatcher methodMatcher(forEachStmt->mVariableName, this, "get__", argValues.mResolvedArgs, NULL);
methodMatcher.mMethodType = BfMethodType_PropertyGetter;
methodMatcher.CheckType(target.mType->ToTypeInstance(), target, false);
methodMatcher.mCheckedKind = boundsCheck ? BfCheckedKind_Checked : BfCheckedKind_Unchecked;
BfTypedValue arrayItem = exprEvaluator.CreateCall(&methodMatcher, target);
if ((varInst) && (arrayItem))
if (methodMatcher.mBestMethodDef == NULL)
{
if (isRefExpression)
arrayItem = BfTypedValue(arrayItem.mValue, CreateRefType(arrayItem.mType));
else if (!arrayItem.mType->IsComposite())
Fail("Failed to find indexer method in array", forEachStmt);
}
else
{
methodMatcher.mCheckedKind = boundsCheck ? BfCheckedKind_Checked : BfCheckedKind_Unchecked;
BfTypedValue arrayItem = exprEvaluator.CreateCall(&methodMatcher, target);
if ((varInst) && (arrayItem))
{
if (isRefExpression)
arrayItem = BfTypedValue(arrayItem.mValue, CreateRefType(arrayItem.mType));
else if (!arrayItem.mType->IsComposite())
arrayItem = LoadValue(arrayItem);
arrayItem = Cast(forEachStmt->mCollectionExpression, arrayItem, varType, BfCastFlags_Explicit);
arrayItem = LoadValue(arrayItem);
arrayItem = Cast(forEachStmt->mCollectionExpression, arrayItem, varType, BfCastFlags_Explicit);
arrayItem = LoadValue(arrayItem);
if (arrayItem)
mBfIRBuilder->CreateStore(arrayItem.mValue, varInst);
if (arrayItem)
mBfIRBuilder->CreateStore(arrayItem.mValue, varInst);
}
}
}
else