Skip to content

Commit 28764b2

Browse files
committed
Corrected last part of section Variables
1 parent 2067652 commit 28764b2

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

specification/dartLangSpec.tex

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,8 @@ \section{Variables}
13381338

13391339
\LMHash{}%
13401340
A \Error{compile-time error} occurs if a static variable has a
1341-
non-nullable type and no initializing expression,
1341+
no initializing expression and a type which is not nullable
1342+
(\ref{typeNullability}),
13421343
unless the variable declaration has
13431344
the modifier \LATE{} or \EXTERNAL.
13441345

@@ -1650,7 +1651,7 @@ \subsection{Evaluation of Implicit Variable Getters}
16501651
\Case{Static variable}
16511652
If $d$ declares a static variable
16521653
(\commentary{that is, a library variable or a class variable}),
1653-
the implicit getter method of \id{} executes as follows:
1654+
the implicitly induced getter of \id{} executes as follows:
16541655

16551656
\begin{itemize}
16561657
\item \emph{Non-constant variable with an initializer.}
@@ -1659,14 +1660,14 @@ \subsection{Evaluation of Implicit Variable Getters}
16591660
\code{\STATIC?\,\,\LATE?\,\,\FINAL\,\,\id{} = $e$;}, or
16601661
\code{\STATIC?\,\,\LATE?\,\,\FINAL?\,\,$T$\,\,\id{} = $e$;}.
16611662

1662-
The first invocation of the implicit getter of \id{}
1663+
The first invocation of the implicitly induced getter of \id{}
16631664
will evaluate $e$ to an object $o$, store $o$ in \id{},
16641665
and evaluate to $o$;
16651666
if the evaluation of $e$ throws,
16661667
the invocation of the getter throws the same object and stack trace,
1667-
and the next invocation of the implicit getter of \id{}
1668+
and the next invocation of the getter of \id{}
16681669
is considered to be the first invocation.
1669-
A non-first invocation of the implicit getter of \id{} evaluates to
1670+
A non-first invocation of the getter of \id{} evaluates to
16701671
the object stored in \id.
16711672

16721673
If \id{} has an implicitly induced setter,
@@ -1683,15 +1684,41 @@ \subsection{Evaluation of Implicit Variable Getters}
16831684
If $d$ is of one of the forms
16841685
\code{\STATIC?\,\,\LATE?\,\,\CONST{} $v$ = $e$;} or
16851686
\code{\STATIC?\,\,\LATE?\,\,\CONST{} $T$ $v$ = $e$;}.
1686-
the result of the getter is the value of the constant expression $e$.
1687+
the result of the executing the implicitly induced getter is
1688+
the value of the constant expression $e$.
16871689
\commentary{%
16881690
Note that a constant expression cannot depend on itself,
16891691
so no cyclic references can occur.%
16901692
}
16911693
\item \emph{Variable without an initializer.}
1694+
Consider the case where $d$ has one of the forms
1695+
\code{\STATIC?\,\,\VAR\,\,\id;} or
1696+
\code{\STATIC?\,\,$T$\,\,\id;}.
1697+
The result of executing the implicitly induced getter of \id{} is
1698+
the object stored in \id.
1699+
1700+
\commentary{%
1701+
This may be the initial value, that is, the null object
1702+
(the typed variant is an error unless $T$ is nullable).
1703+
Note that forms like \code{\FINAL\,\,\id;} and
1704+
\code{\FINAL\,\,$T$\,\,\id;} are irrelevant here:
1705+
They are syntax errors at the top level,
1706+
and instance variables were specified earlier in this section.
1707+
The forms \code{\STATIC\,\,\FINAL\,\,\id;} and
1708+
\code{\STATIC\,\,\FINAL\,\,$T$\,\,\id;}
1709+
are syntax errors as well.%
1710+
}
16921711

1693-
The result of executing the getter method is the object stored in $v$.
1694-
\commentary{This may be the initial value, that is, the null object.}
1712+
Consider the situation where $d$ has one of the forms
1713+
\code{\STATIC?\,\,\LATE\,\,\VAR\,\,\id;},
1714+
\code{\STATIC?\,\,\LATE\,\,\FINAL\,\,\id;}, or
1715+
\code{\STATIC?\,\,\LATE\,\,\FINAL?\,\,$T$\,\,\id;}.
1716+
The result of the execution of the implicitly induced getter of \id{}
1717+
is the object stored in \id{} if the corresponding implicitly induced setter
1718+
has been executed.
1719+
\commentary{Note that this setter cannot throw during the first execution.}
1720+
Otherwise, if said setter has not been executed,
1721+
the execution of the getter throws.
16951722
\end{itemize}
16961723

16971724

@@ -23527,6 +23554,8 @@ \subsubsection{Local variables and inference}
2352723554

2352823555
\subsubsection{Expression typing}
2352923556

23557+
!!!TODO!!!
23558+
2353023559
It is permitted to invoke or tear-off a method, setter, getter, or operator that
2353123560
is defined on \code{Object} on potentially nullable type. The type used for static
2353223561
analysis of such an invocation or tear-off shall be the type declared on the

0 commit comments

Comments
 (0)