1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

More protection for foreach failure

This commit is contained in:
Brian Fiete 2025-05-20 06:58:27 +02:00
parent 192c9d8f33
commit ad3c7ce767

View file

@ -7192,6 +7192,11 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
mBfIRBuilder->CreateBr(endBB); mBfIRBuilder->CreateBr(endBB);
} }
else if (!getNextMethodInst)
{
AssertErrorState();
mBfIRBuilder->CreateBr(endBB);
}
else else
{ {
BfExprEvaluator exprEvaluator(this); BfExprEvaluator exprEvaluator(this);
@ -7315,7 +7320,11 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
} }
else else
{ {
if (needsValCopy) if (nextEmbeddedType->IsVar())
{
AssertErrorState();
}
else if (needsValCopy)
{ {
auto nextVal = BfTypedValue(mBfIRBuilder->CreateBitCast(nextResult.mValue, mBfIRBuilder->MapType(CreatePointerType(nextEmbeddedType))), nextEmbeddedType, true); auto nextVal = BfTypedValue(mBfIRBuilder->CreateBitCast(nextResult.mValue, mBfIRBuilder->MapType(CreatePointerType(nextEmbeddedType))), nextEmbeddedType, true);
if (isRefExpression) if (isRefExpression)