@@ -1381,10 +1381,8 @@ \section{Variables}
1381
1381
A \IndexCustom{mutable variable}{variable!mutable}
1382
1382
is a variable which is not final.
1383
1383
1384
- %% Note that the following relies on the assumption that inference has
1385
- %% already taken place, including member signature inference. For instance,
1386
- %% if `var x;` is an instance variable declaration that overrides `T get x;`
1387
- %% then we treat `var x;` as if it had been `T x;`.
1384
+ \subsection{Implicitly Induced Getters and Setters}
1385
+ \LMLabel{implicitlyInducedGettersAndSetters}
1388
1386
1389
1387
\LMHash{}%
1390
1388
The following rules on implicitly induced getters and setters
@@ -1685,7 +1683,7 @@ \subsection{Evaluation of Implicit Variable Getters}
1685
1683
will evaluate to the object stored in \id.
1686
1684
Otherwise
1687
1685
(\commentary{when no value has been stored in this variable}),
1688
- the getter invocation will throw .
1686
+ the getter invocation incurs a dynamic error .
1689
1687
\EndCase
1690
1688
1691
1689
\LMHash{}%
@@ -1742,7 +1740,17 @@ \subsection{Evaluation of Implicit Variable Getters}
1742
1740
and the most recent invocation of the getter \code{i}
1743
1741
returns 10.
1744
1742
This makes \code{i + 1} evaluate to 11,
1745
- which is stored in the variable.%
1743
+ which is stored in the variable.
1744
+ Finally, the invocation of the getter \code{i} in \code{main}
1745
+ completes returning 11.%
1746
+ }
1747
+
1748
+ \commentary{%
1749
+ Note that this is a change from the semantics older versions of Dart:
1750
+ Throwing an exception during initializer evaluation no longer sets the
1751
+ variable to \code{null},
1752
+ and reading the variable during initializer evaluation
1753
+ no longer causes a dynamic error.%
1746
1754
}
1747
1755
\item \emph{Constant variable.}
1748
1756
If $d$ is of one of the forms
@@ -1784,7 +1792,9 @@ \subsection{Evaluation of Implicit Variable Getters}
1784
1792
in a situation where no object has been stored in the variable \id{}
1785
1793
will incur a dynamic error.
1786
1794
\end{itemize}
1787
- \EndCase
1795
+
1796
+ % Reduce whitespace after itemized list: This is just an end symbol.
1797
+ \vspace{-\baselineskip}\EndCase
1788
1798
1789
1799
1790
1800
\section{Functions}
@@ -24454,41 +24464,9 @@ \subsubsection{Late fields and variables}
24454
24464
24455
24465
!!!TODO!!!
24456
24466
24457
- A variable which is marked as \LATE{} ...
24458
-
24459
- A read of a field or variable which is marked as \LATE{} which has not yet been
24460
- written to causes the initializer expression of the variable to be evaluated to
24461
- a value, assigned to the variable or field, and returned as the value of the
24462
- read.
24463
-
24464
- \begin{itemize}
24465
- \item If there is no initializer expression, the read causes a runtime error to be
24466
- thrown.
24467
- \item Evaluating the initializer expression may validly cause a write to the field
24468
- or variable, assuming that the field or variable is not final. In this
24469
- case, the variable assumes the written value. The final value of the
24470
- initializer expression overwrites any intermediate written values.
24471
- \item Evaluating the initializer expression may cause an exception to be thrown.
24472
- If the variable was written to before the exception was thrown, the value of
24473
- the variable on subsequent reads is the last written value. If the variable
24474
- was not written before the exception was thrown, then the next read attempts
24475
- to evaluate the initializer expression again.
24476
- \item If a variable or field is read from during the process of evaluating its own
24477
- initializer expression, and no write to the variable has occurred, the read
24478
- is treated as a first read and the initializer expression is evaluated
24479
- again.
24480
- \end{itemize}
24481
-
24482
- Let $D$ be a \LATE{} and \FINAL{} non-local variable declaration named \code{v}
24483
- without an initializing expression.
24484
- It is a run-time error, to invoke the setter \code{v=} which is
24485
- implicitly induced by $D$ if a value has previously been assigned to \code{v}
24486
- (which could be due to an initializing formal or a constructor initializer
24487
- list, or due to an invocation of the setter).
24488
-
24489
- Let $D$ be a \LATE{} and \FINAL{} local variable declaration named \code{v}. It is a
24490
- run-time error, to assign a value to \code{v} if a value has previously
24491
- been assigned to \code{v}.
24467
+ Let $D$ be a \LATE{} and \FINAL{} local variable declaration named \code{v}.
24468
+ It is a run-time error, to assign a value to \code{v}
24469
+ if a value has previously been assigned to \code{v}.
24492
24470
24493
24471
Note that this includes the implicit initializing writes induced by
24494
24472
evaluating the initializer during a read. Hence, the following program
@@ -24502,16 +24480,6 @@ \subsubsection{Late fields and variables}
24502
24480
\}
24503
24481
\end{dartCode}
24504
24482
24505
- A toplevel or class variable with an initializer is evaluated as if it
24506
- was marked \LATE. Note that this is a change from pre-NNBD semantics in that:
24507
-
24508
- \begin{itemize}
24509
- \item Throwing an exception during initializer evaluation no longer sets the
24510
- variable to \code{null}
24511
- \item Reading the variable during initializer evaluation is no longer checked for,
24512
- and does not cause an error.
24513
- \end{itemize}
24514
-
24515
24483
\subsubsection{Boolean conditional evaluation}
24516
24484
24517
24485
The requirement that the condition in a boolean conditional control expression
0 commit comments