mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 15:46:05 +02:00
var
fixes
This commit is contained in:
parent
6708399691
commit
e5eb8b38eb
1 changed files with 11 additions and 6 deletions
|
@ -1909,7 +1909,7 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
|
||||||
if (!initValue)
|
if (!initValue)
|
||||||
initValue = GetDefaultTypedValue(localDef->mResolvedType);
|
initValue = GetDefaultTypedValue(localDef->mResolvedType);
|
||||||
|
|
||||||
if (!localDef->mResolvedType->IsValuelessType())
|
if ((!localDef->mResolvedType->IsValuelessType()) && (!localDef->mResolvedType->IsVar()))
|
||||||
localDef->mAddr = mBfIRBuilder->CreateGlobalVariable(mBfIRBuilder->MapType(localDef->mResolvedType, BfIRPopulateType_Full), false, BfIRLinkageType_Internal, initValue.mValue, name);;
|
localDef->mAddr = mBfIRBuilder->CreateGlobalVariable(mBfIRBuilder->MapType(localDef->mResolvedType, BfIRPopulateType_Full), false, BfIRLinkageType_Internal, initValue.mValue, name);;
|
||||||
initHandled = true;
|
initHandled = true;
|
||||||
}
|
}
|
||||||
|
@ -6493,11 +6493,16 @@ void BfModule::DoForLess(BfForEachStatement* forEachStmt)
|
||||||
// Soldier on
|
// Soldier on
|
||||||
target = GetDefaultTypedValue(varType);
|
target = GetDefaultTypedValue(varType);
|
||||||
}
|
}
|
||||||
if (forEachStmt->mInToken->mToken == BfToken_LessEquals)
|
|
||||||
conditionValue = mBfIRBuilder->CreateCmpLTE(localVal, target.mValue, varType->IsSigned());
|
if (!target.mValue.IsFake())
|
||||||
else
|
{
|
||||||
conditionValue = mBfIRBuilder->CreateCmpLT(localVal, target.mValue, varType->IsSigned());
|
if (forEachStmt->mInToken->mToken == BfToken_LessEquals)
|
||||||
mBfIRBuilder->CreateCondBr(conditionValue, bodyBB, endBB);
|
conditionValue = mBfIRBuilder->CreateCmpLTE(localVal, target.mValue, varType->IsSigned());
|
||||||
|
else
|
||||||
|
conditionValue = mBfIRBuilder->CreateCmpLT(localVal, target.mValue, varType->IsSigned());
|
||||||
|
mBfIRBuilder->CreateCondBr(conditionValue, bodyBB, endBB);
|
||||||
|
}
|
||||||
|
|
||||||
ValueScopeEnd(valueScopeStart);
|
ValueScopeEnd(valueScopeStart);
|
||||||
|
|
||||||
mBfIRBuilder->AddBlock(bodyBB);
|
mBfIRBuilder->AddBlock(bodyBB);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue