mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Allowing allocation of arrays by uint size instead of just int
This commit is contained in:
parent
49a19647d3
commit
fbd4e14fb6
1 changed files with 14 additions and 1 deletions
|
@ -10326,7 +10326,20 @@ void BfExprEvaluator::Visit(BfObjectCreateExpression* objCreateExpr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg != NULL)
|
if (arg != NULL)
|
||||||
dimLength = mModule->CreateValueFromExpression(expr, intType);
|
{
|
||||||
|
dimLength = mModule->CreateValueFromExpression(expr, intType, BfEvalExprFlags_NoCast);
|
||||||
|
|
||||||
|
BfCastFlags castFlags = BfCastFlags_None;
|
||||||
|
if (dimLength.mType->IsInteger())
|
||||||
|
{
|
||||||
|
// Allow uint for size - just force to int
|
||||||
|
if (!((BfPrimitiveType*)dimLength.mType)->IsSigned())
|
||||||
|
castFlags = BfCastFlags_Explicit;
|
||||||
|
}
|
||||||
|
if (dimLength)
|
||||||
|
dimLength = mModule->Cast(expr, dimLength, intType, castFlags);
|
||||||
|
}
|
||||||
|
|
||||||
if (!dimLength)
|
if (!dimLength)
|
||||||
{
|
{
|
||||||
dimLength = mModule->GetDefaultTypedValue(intType);
|
dimLength = mModule->GetDefaultTypedValue(intType);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue