mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Added error when attempting to add default value to params parameter
This commit is contained in:
parent
7e843bb402
commit
e59cb10ed4
1 changed files with 8 additions and 0 deletions
|
@ -20177,6 +20177,14 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
|
||||||
if ((paramDef != NULL) && (paramDef->mParamDeclaration != NULL) && (paramDef->mParamDeclaration->mInitializer != NULL) &&
|
if ((paramDef != NULL) && (paramDef->mParamDeclaration != NULL) && (paramDef->mParamDeclaration->mInitializer != NULL) &&
|
||||||
(!paramDef->mParamDeclaration->mInitializer->IsA<BfBlock>()))
|
(!paramDef->mParamDeclaration->mInitializer->IsA<BfBlock>()))
|
||||||
{
|
{
|
||||||
|
if (paramDef->mParamKind == BfParamKind_Params)
|
||||||
|
{
|
||||||
|
BfAstNode* refNode = paramDef->mParamDeclaration->mEqualsNode;
|
||||||
|
if (refNode != NULL)
|
||||||
|
refNode = paramDef->mParamDeclaration->mModToken;
|
||||||
|
Fail("Cannot specify a default value for a 'params' parameter", refNode);
|
||||||
|
}
|
||||||
|
|
||||||
BfMethodState methodState;
|
BfMethodState methodState;
|
||||||
SetAndRestoreValue<BfMethodState*> prevMethodState(mCurMethodState, &methodState);
|
SetAndRestoreValue<BfMethodState*> prevMethodState(mCurMethodState, &methodState);
|
||||||
methodState.mTempKind = BfMethodState::TempKind_Static;
|
methodState.mTempKind = BfMethodState::TempKind_Static;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue