Skip to content

Commit df42dfe

Browse files
committed
Add a paragraph explaining that the given section is about both optional and named parameters, not just parameters that are both
1 parent 9bebf93 commit df42dfe

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

specification/dartLangSpec.tex

+12-5
Original file line numberDiff line numberDiff line change
@@ -2225,7 +2225,8 @@ \subsection{Formal Parameters}
22252225
\Index{formal parameter list},
22262226
which consists of a list of required positional parameters
22272227
(\ref{requiredFormals}),
2228-
followed by any optional and/or named parameters (\ref{optionalFormals}).
2228+
followed by any optional and/or named parameters
2229+
(\ref{optionalFormalsAndNamedFormals}).
22292230
The latter may be specified
22302231
either as a list of optional positional parameters,
22312232
or as a set of named parameters,
@@ -2429,8 +2430,14 @@ \subsubsection{Required Formals}
24292430
an instance method, instance setter, or instance operator.
24302431

24312432

2432-
\subsubsection{Optional and Named Formals}
2433-
\LMLabel{optionalFormals}
2433+
\subsubsection{Optional Formals and Named Formals}
2434+
\LMLabel{optionalFormalsAndNamedFormals}
2435+
2436+
\LMHash{}%
2437+
This section is concerned with optional parameters,
2438+
positional or named,
2439+
and with required named parameters.
2440+
They are handled together because they share grammar rules.
24342441

24352442
\LMHash{}%
24362443
Optional formal parameters may be specified and provided with default values.
@@ -2442,7 +2449,7 @@ \subsubsection{Optional and Named Formals}
24422449

24432450
<defaultNamedParameter> ::= \gnewline{}
24442451
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2445-
\gnewline{} (`:' <expression>)?
2452+
\gnewline{} (`=' <expression>)?
24462453
\end{grammar}
24472454

24482455
\LMHash{}%
@@ -2460,7 +2467,7 @@ \subsubsection{Optional and Named Formals}
24602467
\Error{compile-time error} if a required named parameter has a default value.
24612468

24622469
\LMHash{}%
2463-
Assume that $p$ is an optional named parameter with default value $d$.
2470+
Assume that $p$ is an optional parameter with default value $d$.
24642471
It is a \Error{compile-time error}
24652472
if the static type of $d$ is not assignable to the declared type of $p$.
24662473

0 commit comments

Comments
 (0)