|
103 | 103 | % - Add requirement that the iterator of a for-in statement must have
|
104 | 104 | % type `Iterator`.
|
105 | 105 | % - Clarify which constructors are covered by the section 'Constant
|
106 |
| -% Constructors' and removed confusing redundancy in definiton of |
| 106 | +% Constructors' and removed confusing redundancy in definition of |
107 | 107 | % potentially constant expressions.
|
108 | 108 | % - Integrate the feature specification of collection literal elements
|
109 | 109 | % (aka UI-as-code).
|
@@ -6719,7 +6719,7 @@ \subsection{Constants}
|
6719 | 6719 | % be computed statically without running user code.
|
6720 | 6720 |
|
6721 | 6721 | % A validly typed potentially constant expression can still fail when evaluated.
|
6722 |
| -% If that happens in a const invociation, it's a compile-time error. |
| 6722 | +% If that happens in a const invocation, it's a compile-time error. |
6723 | 6723 |
|
6724 | 6724 | \LMHash{}%
|
6725 | 6725 | It is a compile-time error if an expression is required to be
|
@@ -10352,7 +10352,7 @@ \subsection{Function Invocation}
|
10352 | 10352 | }
|
10353 | 10353 |
|
10354 | 10354 | %\LMHash{}%
|
10355 |
| -%When a stream is canceled, the implementation must wait for the cancelation future returned by \code{cancell()} to complete before proceeding. |
| 10355 | +%When a stream is canceled, the implementation must wait for the cancellation future returned by \code{cancell()} to complete before proceeding. |
10356 | 10356 |
|
10357 | 10357 |
|
10358 | 10358 | \subsubsection{Actual Argument Lists}
|
@@ -16017,7 +16017,8 @@ \subsection{Yield-Each}
|
16017 | 16017 | if the class of $o$ is not a subtype of \code{Iterable<$T_f$>}.
|
16018 | 16018 | Otherwise
|
16019 | 16019 | \item
|
16020 |
| - The method \code{iterator} is invoked upon $o$ returning an object $i$. |
| 16020 | + The getter \code{iterator} is invoked upon $o$ returning an object $i$. |
| 16021 | + Otherwise |
16021 | 16022 | \item
|
16022 | 16023 | \label{moveNext} The \code{moveNext} method of $i$ is invoked on it
|
16023 | 16024 | with no arguments.
|
@@ -16051,35 +16052,76 @@ \subsection{Yield-Each}
|
16051 | 16052 | It is a dynamic type error if the class of $o$
|
16052 | 16053 | is not a subtype of \code{Stream<$T_f$>}.
|
16053 | 16054 | Otherwise
|
| 16055 | +\item |
| 16056 | + If the stream associated with $m$ has been cancelled, |
| 16057 | + then execution of $s$ completes by returning without a value. |
| 16058 | + \commentary{In this case, the \code{\YIELD*} operation does |
| 16059 | + not begin to listen to the stream $o$.} |
| 16060 | +Otherwise |
| 16061 | +\item |
| 16062 | + The $o$ stream is listened to by invoking \code{$v_o$.listen} |
| 16063 | + with system provided arguments, |
| 16064 | + where $v_o$ is a fresh variable referencing the stream $o$. |
| 16065 | + Let $u$ be the stream subscription returned by the call to |
| 16066 | + \code{$p$.listen} and let $v$ be a fresh variable bound to $u$. |
| 16067 | +\item |
| 16068 | + If the stream associated with $m$ is paused, then $u$ is immediately |
| 16069 | + paused as if by invoking \code{$v$.pause} with no arguments. |
| 16070 | +\item{} |
| 16071 | + If the stream associated with $m$ has been cancelled, then |
| 16072 | + $u$ is cancelled by executing \code{await $v$.cancel();}. |
| 16073 | + If this execution does not throw, the execution of $s$ |
| 16074 | + completes by returning without a value. |
| 16075 | + % This can only happen if a call to "listen" or "pause" above has |
| 16076 | + % side effects which cancels the stream of $m$. |
16054 | 16077 | \item
|
16055 | 16078 | The nearest enclosing asynchronous for loop (\ref{asynchronousFor-in}),
|
16056 | 16079 | if any, is paused.
|
16057 | 16080 | \item
|
16058 |
| - The $o$ stream is listened to, creating a subscription $s$, |
16059 |
| - and for each event $x$, or error $e$ with stack trace $t$, of $s$: |
| 16081 | + Execution of $m$ is suspended. |
| 16082 | + While $m$ is suspended, the following reactions happen if $u$ delivers |
| 16083 | + an event or if the stream associated with $m$ is paused, resumed or cancelled. |
| 16084 | + \commentary{It is unspecified what happens if $u$ delivers events |
| 16085 | + before $m$ is suspended or after $m$ is resumed, or if $u$ delivers events |
| 16086 | + after a call to \code{$v$.cancel} or a call to \code{$v$.pause} which has |
| 16087 | + not been followed by a call to \code{$v$.resume}, or after having delivered |
| 16088 | + a done event.} |
| 16089 | + % Such events should be ignored. |
16060 | 16090 | \begin{itemize}
|
16061 | 16091 | \item
|
16062 |
| - If the stream $u$ associated with $m$ has been paused, |
16063 |
| - then execution of $m$ is suspended until $u$ is resumed or canceled. |
| 16092 | + If the stream associated with $m$ becomes paused, |
| 16093 | + then $u$ is paused by executing \code{$v$.pause();}. |
| 16094 | + It is unspecified what happens if this execution throws. |
| 16095 | + % The error can be passed to \code{Zone.current.handleUncaughtError}. |
16064 | 16096 | \item
|
16065 |
| - If the stream $u$ associated with $m$ has been canceled, |
16066 |
| - then $s$ is canceled by evaluating \code{\AWAIT{} v.cancel()} |
16067 |
| - where $v$ is a fresh variable referencing the stream subscription $s$. |
16068 |
| - Then, if the cancel completed normally, |
16069 |
| - the stream execution of $s$ returns without an object |
16070 |
| - (\ref{statementCompletion}). |
| 16097 | + If the stream associated with $m$ is resumed after being paused, |
| 16098 | + then $u$ is resumed as by executing \code{$v$.resume();}. |
| 16099 | + It is unspecified what happens if this execution throws. |
| 16100 | + % The error can be passed to \code{Zone.current.handleUncaughtError}. |
| 16101 | + \item |
| 16102 | + If the stream associated with $m$ is cancelled, |
| 16103 | + then $u$ is also cancelled as by executing \code{await $v$.cancel();}. |
| 16104 | + |
| 16105 | + At some future time, execution of $m$ resumes. If the execution above |
| 16106 | + completed by throwing an error \metavar{er} and stack trace \metavar{st}, |
| 16107 | + then execution of $s$ completes by throwing \metavar{er} |
| 16108 | + and stack trace \metavar{st}. |
| 16109 | + Otherwise, execution of $s$ completes by returning without a value. |
16071 | 16110 | \item
|
16072 |
| - Otherwise, $x$, or $e$ with $t$, are added to |
16073 |
| - the stream associated with $m$ in the order they appear in $o$. |
16074 |
| - \commentary{% |
16075 |
| - Note that a dynamic error occurs if $x$ is added |
16076 |
| - and the dynamic type of $x$ is not a subtype of |
16077 |
| - the element type of said stream.% |
16078 |
| - } |
16079 |
| - The function $m$ may suspend. |
| 16111 | + If $u$ emits a data event with value $x$, |
| 16112 | + then if the runtime type of $x$ is not a subtype of $T_v$, |
| 16113 | + then the stream associated with $m$ emits a dynamic type error. |
| 16114 | + Otherwise the stream associated with $m$ immediately emits |
| 16115 | + a data event with value $x$. |
| 16116 | + \item |
| 16117 | + If $u$ emits an error event with error \metavar{er} |
| 16118 | + and stack trace \metavar{st}, |
| 16119 | + then the stream associated with $m$ immediately emits an error event |
| 16120 | + with error \metavar{er} and stack trace \metavar{st}. |
| 16121 | + \item |
| 16122 | + If $u$ closes \commentary{(by emitting a done event)}, |
| 16123 | + then execution of $m$ resumes and execution of $s$ completes normally. |
16080 | 16124 | \end{itemize}
|
16081 |
| -\item |
16082 |
| - If the stream $o$ is done, execution of $s$ completes normally. |
16083 | 16125 | \end{itemize}
|
16084 | 16126 |
|
16085 | 16127 |
|
|
0 commit comments