1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Allow default param before params param

This commit is contained in:
Brian Fiete 2020-11-07 06:37:41 -08:00
parent bd6e21073e
commit a9d9776bcb
2 changed files with 2 additions and 2 deletions

View file

@ -667,7 +667,7 @@ BfMethodDef* BfDefBuilder::CreateMethodDef(BfMethodDeclaration* methodDeclaratio
if (paramDef->mParamDeclaration->mInitializer != NULL)
hasDefault = true;
else if (hasDefault)
else if ((hasDefault) && (paramDef->mParamKind != BfParamKind_Params))
{
if (!didDefaultsError)
Fail("Optional parameters must appear after all required parameters", methodDef->mParams[paramIdx - 1]->mParamDeclaration);

View file

@ -5830,7 +5830,7 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
if (!isDirectPass)
{
int numElements = (int)argValues.size() - argIdx;
int numElements = BF_MAX((int)argValues.size() - argIdx, 0);
if (methodDef->mMethodType == BfMethodType_Extension)
numElements++;