mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed valueless foreach
This commit is contained in:
parent
891aef16be
commit
c1f4466dd1
1 changed files with 5 additions and 2 deletions
|
@ -6759,7 +6759,7 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
|
|||
else
|
||||
{
|
||||
// Normal case
|
||||
if ((nextResult) && (varType->IsComposite()) && (!isRefExpression))
|
||||
if ((nextResult) && (varType->IsComposite()) && (!varType->IsValuelessType()) && (!isRefExpression))
|
||||
{
|
||||
needsValCopy = false;
|
||||
varType = CreateRefType(varType);
|
||||
|
@ -6770,7 +6770,10 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
|
|||
localDef->mNameNode = nameNode;
|
||||
localDef->mName = variableName;
|
||||
localDef->mResolvedType = varType;
|
||||
varInst = CreateAlloca(varType);
|
||||
if (!varType->IsValuelessType())
|
||||
varInst = CreateAlloca(varType);
|
||||
else
|
||||
varInst = mBfIRBuilder->GetFakeVal();
|
||||
localDef->mAddr = varInst;
|
||||
localDef->mAssignedKind = BfLocalVarAssignKind_Unconditional;
|
||||
localDef->mReadFromId = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue