Index: docs/language/dartLangSpec.tex |
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex |
index 3b7bdeb8c5c35cd8a6a8c2af36d1f76f84ef6e05..24753c21216362c656417f88d2145f28304800c9 100644 |
--- a/docs/language/dartLangSpec.tex |
+++ b/docs/language/dartLangSpec.tex |
@@ -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,15 +675,16 @@ 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} |
@@ -3608,13 +3611,12 @@ Function invocation involves evaluation of the list of actual arguments to the f |
\begin{grammar} |
{\bf arguments:} |
- `(' argumentList? `)' |
+ `(' (argumentList `,'?)? `)' |
. |
-{\bf argumentList:}namedArgument (`,' namedArgument)*; |
- % expressionList ',' spreadArgument; |
+{\bf argumentList:} |
+ namedArgument (`,' namedArgument)*; |
expressionList (`,' namedArgument)* |
eernst
2016/06/14 09:08:32
I think we should gather all the changes motivated
Lasse Reichstein Nielsen
2016/06/27 17:27:53
Let's do that. Reinserted for now.
|
-% spreadArgument |
. |
{\bf namedArgument:} |
@@ -3627,7 +3629,7 @@ Evaluation of an actual argument list of the form |
$(a_1, \ldots, a_m, q_1: a_{m+1}, \ldots, q_l: a_{m+l})$ |
-proceeds as follows: |
+(ignoring any trailing comma) proceeds as follows: |
eernst
2016/06/14 09:08:33
The given argument list serves as the basis for sp
|
\LMHash{} |
The arguments $a_1, \ldots, a_{m+l}$ are evaluated in the order they appear in the program, yielding objects $o_1, \ldots, o_{m+l}$. |
@@ -3643,7 +3645,7 @@ The arguments $a_1, \ldots, a_{m+l}$ are evaluated in the order they appear in t |
Let $f$ be a function with $h$ required parameters, let $p_1 \ldots p_n$ be the positional parameters of $f$ and let $p_{h+1}, \ldots, p_{h+k}$ be the optional parameters declared by $f$. |
\LMHash{} |
-An evaluated actual argument list $o_1 \ldots o_{m+l}$ derived from an actual argument list of the form $(a_1, \ldots, a_m, q_1: a_{m+1}, \ldots, q_l: a_{m+l})$ is bound to the formal parameters of $f$ as follows: |
+An evaluated actual argument list $o_1 \ldots o_{m+l}$ derived from an actual argument list of the form $(a_1, \ldots, a_m, q_1: a_{m+1}, \ldots, q_l: a_{m+l})$ (ignoring any trailing comma) is bound to the formal parameters of $f$ as follows: |
eernst
2016/06/14 09:08:33
Same issue as line 3632.
|
\commentary{ |
We have an argument list consisting of $m$ positional arguments and $l$ named arguments. We have a function with $h$ required parameters and $k$ optional parameters. The number of positional arguments must be at least as large as the number of required parameters, and no larger than the number of positional parameters. All named arguments must have a corresponding named parameter. You may not provide a given named argument more than once. If an optional parameter has no corresponding argument, it gets its default value. In checked mode, all arguments must belong to subtypes of the type of their corresponding formal. |