| OLD | NEW |
| 1 \documentclass{article} | 1 \documentclass{article} |
| 2 \usepackage{epsfig} | 2 \usepackage{epsfig} |
| 3 \usepackage{color} | 3 \usepackage{color} |
| 4 \usepackage{dart} | 4 \usepackage{dart} |
| 5 \usepackage{bnf} | 5 \usepackage{bnf} |
| 6 \usepackage{hyperref} | 6 \usepackage{hyperref} |
| 7 \usepackage{lmodern} | 7 \usepackage{lmodern} |
| 8 \usepackage[T1]{fontenc} | 8 \usepackage[T1]{fontenc} |
| 9 \newcommand{\code}[1]{{\sf #1}} | 9 \newcommand{\code}[1]{{\sf #1}} |
| 10 \title{Dart Programming Language Specification \\ | 10 \title{Dart Programming Language Specification \\ |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 All functions have a signature and a body. The signature describes the formal pa
rameters of the function, and possibly its name and return type. A function bod
y is either: | 615 All functions have a signature and a body. The signature describes the formal pa
rameters of the function, and possibly its name and return type. A function bod
y is either: |
| 616 \begin{itemize} | 616 \begin{itemize} |
| 617 \item A block statement (\ref{blocks}) containing the statements (\ref{statement
s}) executed by the function, optionally marked with one of the modifiers: \ASYN
C, \ASYNC* or \SYNC*. | 617 \item A block statement (\ref{blocks}) containing the statements (\ref{statement
s}) executed by the function, optionally marked with one of the modifiers: \ASYN
C, \ASYNC* or \SYNC*. |
| 618 | 618 |
| 619 \commentary{ | 619 \commentary{ |
| 620 Because Dart is optionally typed, we cannot guarantee that a function that does
not return a value will not be used in the context of an expression. Therefore,
every function must return a value. A function body that ends without doing a th
row or return will cause the function to return \NULL{}, as will a \RETURN{} wit
hout an expression. For generator functions, the situation is more subtle. See f
urther discussion in section \ref{return}. | 620 Because Dart is optionally typed, we cannot guarantee that a function that does
not return a value will not be used in the context of an expression. Therefore,
every function must return a value. A function body that ends without doing a th
row or return will cause the function to return \NULL{}, as will a \RETURN{} wit
hout an expression. For generator functions, the situation is more subtle. See f
urther discussion in section \ref{return}. |
| 621 } | 621 } |
| 622 | 622 |
| 623 OR | 623 OR |
| 624 \item of the form \code{=> $e$} or the form \code{\ASYNC{} => $e$}, which both r
eturn the value of the expression $e$ as if by a \code{return $e$}. \commentary{
The other modifiers do not apply here, because they apply only to generators, di
scussed below, and generators do not allow to return a value, values are added t
o the generated stream or iterable using \YIELD{} instead.} | 624 \item of the form \code{=> $e$} or the form \code{\ASYNC{} => $e$}, which both r
eturn the value of the expression $e$ as if by a \code{return $e$}. \commentary{
The other modifiers do not apply here, because they apply only to generators, di
scussed below, and generators do not allow to return a value, values are added t
o the generated stream or iterable using \YIELD{} instead.} |
| 625 } | |
| 626 Let $R$ be the static type of $e$ | 625 Let $R$ be the static type of $e$ |
| 627 and let $T$ be the actual return type (\ref{actualTypeOfADeclaration}) | 626 and let $T$ be the actual return type (\ref{actualTypeOfADeclaration}) |
| 628 of the function that has this body. | 627 of the function that has this body. |
| 629 It is a static warning if $T$ is not \VOID{} and either | 628 It is a static warning if $T$ is not \VOID{} and either |
| 630 the function is synchronous and the static type of $R$ is not assignable to $T$, | 629 the function is synchronous and the static type of $R$ is not assignable to $T$, |
| 631 or the function is asynchronous and \code{Future<$flatten${$R$}>} | 630 or the function is asynchronous and \code{Future<$flatten${$R$}>} |
| 632 is not assignable to $T$. | 631 is not assignable to $T$. |
| 633 | 632 |
| 634 \end{itemize} | 633 \end{itemize} |
| 635 | 634 |
| (...skipping 7542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8178 | 8177 |
| 8179 The invariant that each normative paragraph is associated with a line | 8178 The invariant that each normative paragraph is associated with a line |
| 8180 containing the text \LMHash{} should be maintained. Extra occurrences | 8179 containing the text \LMHash{} should be maintained. Extra occurrences |
| 8181 of \LMHash{} can be added if needed, e.g., in order to make | 8180 of \LMHash{} can be added if needed, e.g., in order to make |
| 8182 individual \item{}s in itemized lists addressable. Each \LM.. command | 8181 individual \item{}s in itemized lists addressable. Each \LM.. command |
| 8183 must occur on a separate line. \LMHash{} must occur immediately | 8182 must occur on a separate line. \LMHash{} must occur immediately |
| 8184 before the associated paragraph, and \LMLabel must occur immediately | 8183 before the associated paragraph, and \LMLabel must occur immediately |
| 8185 after the associated \section{}, \subsection{} etc. | 8184 after the associated \section{}, \subsection{} etc. |
| 8186 | 8185 |
| 8187 ---------------------------------------------------------------------- | 8186 ---------------------------------------------------------------------- |
| OLD | NEW |