@@ -1404,10 +1404,8 @@ \section{Variables}
1404
1404
A \IndexCustom{mutable variable}{variable!mutable}
1405
1405
is a variable which is not final.
1406
1406
1407
- %% Note that the following relies on the assumption that inference has
1408
- %% already taken place, including member signature inference. For instance,
1409
- %% if `var x;` is an instance variable declaration that overrides `T get x;`
1410
- %% then we treat `var x;` as if it had been `T x;`.
1407
+ \subsection{Implicitly Induced Getters and Setters}
1408
+ \LMLabel{implicitlyInducedGettersAndSetters}
1411
1409
1412
1410
\LMHash{}%
1413
1411
The following rules on implicitly induced getters and setters
@@ -1708,7 +1706,7 @@ \subsection{Evaluation of Implicit Variable Getters}
1708
1706
will evaluate to the object stored in \id.
1709
1707
Otherwise
1710
1708
(\commentary{when no value has been stored in this variable}),
1711
- the getter invocation will throw .
1709
+ the getter invocation incurs a dynamic error .
1712
1710
\EndCase
1713
1711
1714
1712
\LMHash{}%
@@ -1765,7 +1763,17 @@ \subsection{Evaluation of Implicit Variable Getters}
1765
1763
and the most recent invocation of the getter \code{i}
1766
1764
returns 10.
1767
1765
This makes \code{i + 1} evaluate to 11,
1768
- which is stored in the variable.%
1766
+ which is stored in the variable.
1767
+ Finally, the invocation of the getter \code{i} in \code{main}
1768
+ completes returning 11.%
1769
+ }
1770
+
1771
+ \commentary{%
1772
+ Note that this is a change from the semantics older versions of Dart:
1773
+ Throwing an exception during initializer evaluation no longer sets the
1774
+ variable to \code{null},
1775
+ and reading the variable during initializer evaluation
1776
+ no longer causes a dynamic error.%
1769
1777
}
1770
1778
\item \emph{Constant variable.}
1771
1779
If $d$ is of one of the forms
@@ -1807,7 +1815,9 @@ \subsection{Evaluation of Implicit Variable Getters}
1807
1815
in a situation where no object has been stored in the variable \id{}
1808
1816
will incur a dynamic error.
1809
1817
\end{itemize}
1810
- \EndCase
1818
+
1819
+ % Reduce whitespace after itemized list: This is just an end symbol.
1820
+ \vspace{-\baselineskip}\EndCase
1811
1821
1812
1822
1813
1823
\section{Functions}
@@ -24722,41 +24732,9 @@ \subsubsection{Late fields and variables}
24722
24732
24723
24733
!!!TODO!!!
24724
24734
24725
- A variable which is marked as \LATE{} ...
24726
-
24727
- A read of a field or variable which is marked as \LATE{} which has not yet been
24728
- written to causes the initializer expression of the variable to be evaluated to
24729
- a value, assigned to the variable or field, and returned as the value of the
24730
- read.
24731
-
24732
- \begin{itemize}
24733
- \item If there is no initializer expression, the read causes a runtime error to be
24734
- thrown.
24735
- \item Evaluating the initializer expression may validly cause a write to the field
24736
- or variable, assuming that the field or variable is not final. In this
24737
- case, the variable assumes the written value. The final value of the
24738
- initializer expression overwrites any intermediate written values.
24739
- \item Evaluating the initializer expression may cause an exception to be thrown.
24740
- If the variable was written to before the exception was thrown, the value of
24741
- the variable on subsequent reads is the last written value. If the variable
24742
- was not written before the exception was thrown, then the next read attempts
24743
- to evaluate the initializer expression again.
24744
- \item If a variable or field is read from during the process of evaluating its own
24745
- initializer expression, and no write to the variable has occurred, the read
24746
- is treated as a first read and the initializer expression is evaluated
24747
- again.
24748
- \end{itemize}
24749
-
24750
- Let $D$ be a \LATE{} and \FINAL{} non-local variable declaration named \code{v}
24751
- without an initializing expression.
24752
- It is a run-time error, to invoke the setter \code{v=} which is
24753
- implicitly induced by $D$ if a value has previously been assigned to \code{v}
24754
- (which could be due to an initializing formal or a constructor initializer
24755
- list, or due to an invocation of the setter).
24756
-
24757
- Let $D$ be a \LATE{} and \FINAL{} local variable declaration named \code{v}. It is a
24758
- run-time error, to assign a value to \code{v} if a value has previously
24759
- been assigned to \code{v}.
24735
+ Let $D$ be a \LATE{} and \FINAL{} local variable declaration named \code{v}.
24736
+ It is a run-time error, to assign a value to \code{v}
24737
+ if a value has previously been assigned to \code{v}.
24760
24738
24761
24739
Note that this includes the implicit initializing writes induced by
24762
24740
evaluating the initializer during a read. Hence, the following program
@@ -24770,16 +24748,6 @@ \subsubsection{Late fields and variables}
24770
24748
\}
24771
24749
\end{dartCode}
24772
24750
24773
- A toplevel or class variable with an initializer is evaluated as if it
24774
- was marked \LATE. Note that this is a change from pre-NNBD semantics in that:
24775
-
24776
- \begin{itemize}
24777
- \item Throwing an exception during initializer evaluation no longer sets the
24778
- variable to \code{null}
24779
- \item Reading the variable during initializer evaluation is no longer checked for,
24780
- and does not cause an error.
24781
- \end{itemize}
24782
-
24783
24751
\subsubsection{Boolean conditional evaluation}
24784
24752
24785
24753
The requirement that the condition in a boolean conditional control expression
0 commit comments