@@ -1923,7 +1923,17 @@ \subsection{Evaluation of Implicit Variable Getters}
1923
1923
and the most recent invocation of the getter \code{i}
1924
1924
returns 10.
1925
1925
This makes \code{i + 1} evaluate to 11,
1926
- which is stored in the variable.%
1926
+ which is stored in the variable.
1927
+ Finally, the invocation of the getter \code{i} in \code{main}
1928
+ completes returning 11.%
1929
+ }
1930
+
1931
+ \commentary{%
1932
+ Note that this is a change from the semantics older versions of Dart:
1933
+ Throwing an exception during initializer evaluation no longer sets the
1934
+ variable to \code{null},
1935
+ and reading the variable during initializer evaluation
1936
+ no longer causes a dynamic error.%
1927
1937
}
1928
1938
\item \emph{Constant variable.}
1929
1939
If $d$ declares a constant variable with the initializing expression $e$,
@@ -1951,7 +1961,9 @@ \subsection{Evaluation of Implicit Variable Getters}
1951
1961
the implicitly induced getter is a late-uninitialized getter.
1952
1962
This determines the semantics of an invocation.
1953
1963
\end{itemize}
1954
- \EndCase
1964
+
1965
+ % Reduce whitespace after itemized list: This is just an end symbol.
1966
+ \vspace{-\baselineskip}\EndCase
1955
1967
1956
1968
% Reduce whitespace after itemized list: This is just an end symbol.
1957
1969
\vspace{-\baselineskip}\EndCase
@@ -24932,41 +24944,9 @@ \subsubsection{Late fields and variables}
24932
24944
24933
24945
!!!TODO!!!
24934
24946
24935
- A variable which is marked as \LATE{} ...
24936
-
24937
- A read of a field or variable which is marked as \LATE{} which has not yet been
24938
- written to causes the initializer expression of the variable to be evaluated to
24939
- a value, assigned to the variable or field, and returned as the value of the
24940
- read.
24941
-
24942
- \begin{itemize}
24943
- \item If there is no initializer expression, the read causes a runtime error to be
24944
- thrown.
24945
- \item Evaluating the initializer expression may validly cause a write to the field
24946
- or variable, assuming that the field or variable is not final. In this
24947
- case, the variable assumes the written value. The final value of the
24948
- initializer expression overwrites any intermediate written values.
24949
- \item Evaluating the initializer expression may cause an exception to be thrown.
24950
- If the variable was written to before the exception was thrown, the value of
24951
- the variable on subsequent reads is the last written value. If the variable
24952
- was not written before the exception was thrown, then the next read attempts
24953
- to evaluate the initializer expression again.
24954
- \item If a variable or field is read from during the process of evaluating its own
24955
- initializer expression, and no write to the variable has occurred, the read
24956
- is treated as a first read and the initializer expression is evaluated
24957
- again.
24958
- \end{itemize}
24959
-
24960
- Let $D$ be a \LATE{} and \FINAL{} non-local variable declaration named \code{v}
24961
- without an initializing expression.
24962
- It is a run-time error, to invoke the setter \code{v=} which is
24963
- implicitly induced by $D$ if a value has previously been assigned to \code{v}
24964
- (which could be due to an initializing formal or a constructor initializer
24965
- list, or due to an invocation of the setter).
24966
-
24967
- Let $D$ be a \LATE{} and \FINAL{} local variable declaration named \code{v}. It is a
24968
- run-time error, to assign a value to \code{v} if a value has previously
24969
- been assigned to \code{v}.
24947
+ Let $D$ be a \LATE{} and \FINAL{} local variable declaration named \code{v}.
24948
+ It is a run-time error, to assign a value to \code{v}
24949
+ if a value has previously been assigned to \code{v}.
24970
24950
24971
24951
Note that this includes the implicit initializing writes induced by
24972
24952
evaluating the initializer during a read. Hence, the following program
@@ -24980,16 +24960,6 @@ \subsubsection{Late fields and variables}
24980
24960
\}
24981
24961
\end{dartCode}
24982
24962
24983
- A toplevel or class variable with an initializer is evaluated as if it
24984
- was marked \LATE. Note that this is a change from pre-NNBD semantics in that:
24985
-
24986
- \begin{itemize}
24987
- \item Throwing an exception during initializer evaluation no longer sets the
24988
- variable to \code{null}
24989
- \item Reading the variable during initializer evaluation is no longer checked for,
24990
- and does not cause an error.
24991
- \end{itemize}
24992
-
24993
24963
\subsubsection{Boolean conditional evaluation}
24994
24964
24995
24965
The requirement that the condition in a boolean conditional control expression
0 commit comments