@@ -1396,10 +1396,8 @@ \section{Variables}
1396
1396
A \IndexCustom{mutable variable}{variable!mutable}
1397
1397
is a variable which is not final.
1398
1398
1399
- %% Note that the following relies on the assumption that inference has
1400
- %% already taken place, including member signature inference. For instance,
1401
- %% if `var x;` is an instance variable declaration that overrides `T get x;`
1402
- %% then we treat `var x;` as if it had been `T x;`.
1399
+ \subsection{Implicitly Induced Getters and Setters}
1400
+ \LMLabel{implicitlyInducedGettersAndSetters}
1403
1401
1404
1402
\LMHash{}%
1405
1403
The following rules on implicitly induced getters and setters
@@ -1700,7 +1698,7 @@ \subsection{Evaluation of Implicit Variable Getters}
1700
1698
will evaluate to the object stored in \id.
1701
1699
Otherwise
1702
1700
(\commentary{when no value has been stored in this variable}),
1703
- the getter invocation will throw .
1701
+ the getter invocation incurs a dynamic error .
1704
1702
\EndCase
1705
1703
1706
1704
\LMHash{}%
@@ -1757,7 +1755,17 @@ \subsection{Evaluation of Implicit Variable Getters}
1757
1755
and the most recent invocation of the getter \code{i}
1758
1756
returns 10.
1759
1757
This makes \code{i + 1} evaluate to 11,
1760
- which is stored in the variable.%
1758
+ which is stored in the variable.
1759
+ Finally, the invocation of the getter \code{i} in \code{main}
1760
+ completes returning 11.%
1761
+ }
1762
+
1763
+ \commentary{%
1764
+ Note that this is a change from the semantics older versions of Dart:
1765
+ Throwing an exception during initializer evaluation no longer sets the
1766
+ variable to \code{null},
1767
+ and reading the variable during initializer evaluation
1768
+ no longer causes a dynamic error.%
1761
1769
}
1762
1770
\item \emph{Constant variable.}
1763
1771
If $d$ is of one of the forms
@@ -1799,7 +1807,9 @@ \subsection{Evaluation of Implicit Variable Getters}
1799
1807
in a situation where no object has been stored in the variable \id{}
1800
1808
will incur a dynamic error.
1801
1809
\end{itemize}
1802
- \EndCase
1810
+
1811
+ % Reduce whitespace after itemized list: This is just an end symbol.
1812
+ \vspace{-\baselineskip}\EndCase
1803
1813
1804
1814
1805
1815
\section{Functions}
@@ -24583,41 +24593,9 @@ \subsubsection{Late fields and variables}
24583
24593
24584
24594
!!!TODO!!!
24585
24595
24586
- A variable which is marked as \LATE{} ...
24587
-
24588
- A read of a field or variable which is marked as \LATE{} which has not yet been
24589
- written to causes the initializer expression of the variable to be evaluated to
24590
- a value, assigned to the variable or field, and returned as the value of the
24591
- read.
24592
-
24593
- \begin{itemize}
24594
- \item If there is no initializer expression, the read causes a runtime error to be
24595
- thrown.
24596
- \item Evaluating the initializer expression may validly cause a write to the field
24597
- or variable, assuming that the field or variable is not final. In this
24598
- case, the variable assumes the written value. The final value of the
24599
- initializer expression overwrites any intermediate written values.
24600
- \item Evaluating the initializer expression may cause an exception to be thrown.
24601
- If the variable was written to before the exception was thrown, the value of
24602
- the variable on subsequent reads is the last written value. If the variable
24603
- was not written before the exception was thrown, then the next read attempts
24604
- to evaluate the initializer expression again.
24605
- \item If a variable or field is read from during the process of evaluating its own
24606
- initializer expression, and no write to the variable has occurred, the read
24607
- is treated as a first read and the initializer expression is evaluated
24608
- again.
24609
- \end{itemize}
24610
-
24611
- Let $D$ be a \LATE{} and \FINAL{} non-local variable declaration named \code{v}
24612
- without an initializing expression.
24613
- It is a run-time error, to invoke the setter \code{v=} which is
24614
- implicitly induced by $D$ if a value has previously been assigned to \code{v}
24615
- (which could be due to an initializing formal or a constructor initializer
24616
- list, or due to an invocation of the setter).
24617
-
24618
- Let $D$ be a \LATE{} and \FINAL{} local variable declaration named \code{v}. It is a
24619
- run-time error, to assign a value to \code{v} if a value has previously
24620
- been assigned to \code{v}.
24596
+ Let $D$ be a \LATE{} and \FINAL{} local variable declaration named \code{v}.
24597
+ It is a run-time error, to assign a value to \code{v}
24598
+ if a value has previously been assigned to \code{v}.
24621
24599
24622
24600
Note that this includes the implicit initializing writes induced by
24623
24601
evaluating the initializer during a read. Hence, the following program
@@ -24631,16 +24609,6 @@ \subsubsection{Late fields and variables}
24631
24609
\}
24632
24610
\end{dartCode}
24633
24611
24634
- A toplevel or class variable with an initializer is evaluated as if it
24635
- was marked \LATE. Note that this is a change from pre-NNBD semantics in that:
24636
-
24637
- \begin{itemize}
24638
- \item Throwing an exception during initializer evaluation no longer sets the
24639
- variable to \code{null}
24640
- \item Reading the variable during initializer evaluation is no longer checked for,
24641
- and does not cause an error.
24642
- \end{itemize}
24643
-
24644
24612
\subsubsection{Boolean conditional evaluation}
24645
24613
24646
24614
The requirement that the condition in a boolean conditional control expression
0 commit comments