1
0
Fork 0
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:
Brian Fiete 2019-09-18 17:10:06 -07:00
parent 49a19647d3
commit fbd4e14fb6

View file

@ -10326,7 +10326,20 @@ void BfExprEvaluator::Visit(BfObjectCreateExpression* objCreateExpr)
}
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)
{
dimLength = mModule->GetDefaultTypedValue(intType);