mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
Array size fix with missing commas
This commit is contained in:
parent
5a805e96d8
commit
0f9ae6ab8c
1 changed files with 13 additions and 11 deletions
|
@ -12104,8 +12104,9 @@ void BfExprEvaluator::Visit(BfObjectCreateExpression* objCreateExpr)
|
||||||
{
|
{
|
||||||
auto intType = mModule->ResolveTypeDef(mModule->mSystem->mTypeIntPtr);
|
auto intType = mModule->ResolveTypeDef(mModule->mSystem->mTypeIntPtr);
|
||||||
|
|
||||||
for (auto arg : arrayTypeRef->mParams)
|
for (int argIdx = 0; argIdx < (int)arrayTypeRef->mParams.size(); argIdx++)
|
||||||
{
|
{
|
||||||
|
auto arg = arrayTypeRef->mParams[argIdx];
|
||||||
if (auto tokenNode = BfNodeDynCastExact<BfTokenNode>(arg))
|
if (auto tokenNode = BfNodeDynCastExact<BfTokenNode>(arg))
|
||||||
{
|
{
|
||||||
if (tokenNode->GetToken() == BfToken_Comma)
|
if (tokenNode->GetToken() == BfToken_Comma)
|
||||||
|
@ -12113,18 +12114,11 @@ void BfExprEvaluator::Visit(BfObjectCreateExpression* objCreateExpr)
|
||||||
if (isRawArrayAlloc)
|
if (isRawArrayAlloc)
|
||||||
{
|
{
|
||||||
mModule->Fail("Sized arrays cannot be multidimensional.", tokenNode);
|
mModule->Fail("Sized arrays cannot be multidimensional.", tokenNode);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
dimensions++;
|
|
||||||
|
|
||||||
if (dimensions == 5)
|
|
||||||
{
|
|
||||||
mModule->Fail("Too many array dimensions, consider using a jagged array.", tokenNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto expr = BfNodeDynCast<BfExpression>(arg);
|
auto expr = BfNodeDynCast<BfExpression>(arg);
|
||||||
if ((isRawArrayAlloc) && (!dimLengthVals.IsEmpty()))
|
if ((isRawArrayAlloc) && (!dimLengthVals.IsEmpty()))
|
||||||
{
|
{
|
||||||
|
@ -12132,6 +12126,14 @@ void BfExprEvaluator::Visit(BfObjectCreateExpression* objCreateExpr)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argIdx != 0)
|
||||||
|
{
|
||||||
|
dimensions++;
|
||||||
|
if (dimensions == 5)
|
||||||
|
{
|
||||||
|
mModule->Fail("Too many array dimensions, consider using a jagged array.", arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dimLengthRefs.Add(expr);
|
dimLengthRefs.Add(expr);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue