mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Add trailing commas to argument and parameter lists.
R=eernst@google.com Review URL: https://codereview.chromium.org/2060163002.
This commit is contained in:
parent
bb96f28921
commit
4f9645c406
|
@ -655,9 +655,11 @@ The body of a function introduces a new scope known as the function's {\em body
|
|||
It is a compile-time error if a formal parameter is declared as a constant variable (\ref{variables}).
|
||||
|
||||
\begin{grammar}
|
||||
{\bf formalParameterList:}`(' `)';
|
||||
`(' normalFormalParameters ( `,' optionalFormalParameters)? `)';
|
||||
`(' optionalFormalParameters `)'
|
||||
{\bf formalParameterList:}
|
||||
`(' `)';
|
||||
`(' normalFormalParameters `,'? `)';
|
||||
`(' normalFormalParameters `,' optionalFormalParameters `)';
|
||||
`(' optionalFormalParameters `)'
|
||||
.
|
||||
%\end{grammar}
|
||||
%}
|
||||
|
@ -673,18 +675,21 @@ It is a compile-time error if a formal parameter is declared as a constant varia
|
|||
normalFormalParameter (`,' normalFormalParameter)*
|
||||
.
|
||||
|
||||
{\bf optionalFormalParameters:}optionalPositionalFormalParameters;
|
||||
{\bf optionalFormalParameters:}
|
||||
optionalPositionalFormalParameters;
|
||||
namedFormalParameters
|
||||
.
|
||||
|
||||
{\bf optionalPositionalFormalParameters:}
|
||||
`[' defaultFormalParameter (`,' defaultFormalParameter)* `]'
|
||||
`[' defaultFormalParameter (`,' defaultFormalParameter)* `,'? `]'
|
||||
.
|
||||
{\bf namedFormalParameters:}
|
||||
`\{' defaultNamedParameter (`,' defaultNamedParameter)* `\}'
|
||||
`\{' defaultNamedParameter (`,' defaultNamedParameter)* `,'? `\}'
|
||||
.
|
||||
\end{grammar}
|
||||
|
||||
Formal parameter lists allow an optional trailing comma after the last parameter ($`,'?$). A parameter list with such a trailing comma is equivalent in all ways to the same parameter list without the trailing comma. All parameter lists in this specification are shown without a trailing comma, but the rules and semantics apply equally to the corresponding parameter list with a trailing comma.
|
||||
|
||||
%Formal parameters are always \FINAL{}.
|
||||
%\Q{We're awaiting some data on whether enforcing this would cause widespread pain.}
|
||||
%A formal parameter is always considered to be initialized. \rationale{This is because it will always be initialized by the call - even if it is optional.}
|
||||
|
@ -3608,10 +3613,11 @@ Function invocation involves evaluation of the list of actual arguments to the f
|
|||
|
||||
\begin{grammar}
|
||||
{\bf arguments:}
|
||||
`(' argumentList? `)'
|
||||
`(' (argumentList `,'?)? `)'
|
||||
.
|
||||
|
||||
{\bf argumentList:}namedArgument (`,' namedArgument)*;
|
||||
{\bf argumentList:}
|
||||
namedArgument (`,' namedArgument)*;
|
||||
% expressionList ',' spreadArgument;
|
||||
expressionList (`,' namedArgument)*
|
||||
% spreadArgument
|
||||
|
@ -3622,6 +3628,8 @@ Function invocation involves evaluation of the list of actual arguments to the f
|
|||
.
|
||||
\end{grammar}
|
||||
|
||||
Argument lists allow an optional trailing comma after the last argument ($`,'?$). An argument list with such a trailing comma is equivalent in all ways to the same parameter list without the trailing comma. All argument lists in this specification are shown without a trailing comma, but the rules and semantics apply equally to the corresponding argument list with a trailing comma.
|
||||
|
||||
\LMHash{}
|
||||
Evaluation of an actual argument list of the form
|
||||
|
||||
|
|
Loading…
Reference in a new issue