Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: docs/language/dartLangSpec.tex

Issue 1183493005: Added type rules for e++ and friends (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/language/dartLangSpec.tex
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex
index 6627971b77eeca7801e79285ec41fc721d645c7e..dea314b4ddab95ee05acb006f8beba55c6bcb373 100644
--- a/docs/language/dartLangSpec.tex
+++ b/docs/language/dartLangSpec.tex
@@ -3870,6 +3870,8 @@ Let $T$ be the static type of $o$. It is a static type warning if $T$ does not
\item
$T$ or a superinterface of $T$ is annotated with an annotation denoting a constant identical to the constant \code{@proxy} defined in \code{dart:core}. Or
\item $T$ is \code{Type}, $e$ is a constant type literal and the class corresponding to $e$ has a static getter named $m$.
+\item $T$ is \code{Function} and $m$ is \CALL. \rationale {The type \code{Function} is treated as if it has a \code{call} method for any possible signature of \CALL. The expectation is that any concrete subclass of \code{Function} will implement \CALL. Note that a warning will be issue if this is not the case. Furthermore, any use of \CALL on a subclass of \code{Function} that fails to implement \CALL{} will also provoke a a warning, as this exemption is limited to type \code{Function}, and does not apply to its subtypes.
+}
\end{itemize}
\LMHash{}
@@ -4158,12 +4160,14 @@ Let $T$ be the static type of $e$. It is a static type warning if $T$ does not h
\begin{itemize}
\item $T$ or a superinterface of $T$ is annotated with an annotation denoting a constant identical to the constant \code{@proxy} defined in \cd{dart:core}. Or
\item $T$ is \cd{Type}, $e$ is a constant type literal and the class corresponding to $e$ declares an accessible static method or getter named $m$.
+\item $T$ is \code{Function} and $m$ is \CALL.
\end{itemize}
The static type of $i$ is:
\begin{itemize}
\item The static type of function $T.m$, if $T$ has an accessible instance member named $m$.
\item The static type of function $T.m$, if $T$ is \cd{Type}, $e$ is a constant type literal and the class corresponding to $e$ declares an accessible static member or constructor named $m$.
+\item \code{Function} if $T$ is \code{Function} and $m$ is \CALL.
\item The type \DYNAMIC{} otherwise.
\end{itemize}
@@ -5010,56 +5014,93 @@ Postfix expressions invoke the postfix operators on objects.
A {\em postfix expression} is either a primary expression, a function, method or getter invocation, or an invocation of a postfix operator on an expression $e$.
\LMHash{}
-A postfix expression of the form \code{$v$++}, where $v$ is an identifier, is equivalent to \code{()\{\VAR{} r = $v$; $v$ = r + 1; \RETURN{} r\}()}.
+Execution of a postfix expression of the form \code{$v$++}, where $v$ is an identifier, is equivalent to executing \code{()\{\VAR{} r = $v$; $v$ = r + 1; \RETURN{} r\}()}.
+
+\LMHash{}
+The static type of such an expression is the static type of $v$.
+
\rationale{The above ensures that if $v$ is a field, the getter gets called exactly once. Likewise in the cases below.
}
\LMHash{}
-A postfix expression of the form \code{$C.v$ ++} is equivalent to
+Execution of a postfix expression of the form \code{$C.v$ ++} is equivalent to executing
\code{()\{\VAR{} r = $C.v$; $C.v$ = r + 1; \RETURN{} r\}()}.
\LMHash{}
-A postfix expression of the form \code{$e_1.v$++} is equivalent to
+The static type of such an expression is the static type of $C.v$.
+
+
+\LMHash{}
+Execution of a postfix expression of the form \code{$e_1.v$++} is equivalent to executing
\code{(x)\{\VAR{} r = x.v; x.v = r + 1; \RETURN{} r\}($e_1$)}.
\LMHash{}
-A postfix expression of the form \code{$e_1[e_2]$++}, is equivalent to
+The static type of such an expression is the static type of $e_1.v$.
+
+
+\LMHash{}
+Execution of a postfix expression of the form \code{$e_1[e_2]$++}, is equivalent to executing
\code{(a, i)\{\VAR{} r = a[i]; a[i] = r + 1; \RETURN{} r\}($e_1$, $e_2$)}.
\LMHash{}
-A postfix expression of the form \code{$v$-{}-}, where $v$ is an identifier, is equivalent to
+The static type of such an expression is the static type of $e_1[e_2]$.
+
+
+\LMHash{}
+Execution of a postfix expression of the form \code{$v$-{}-}, where $v$ is an identifier, is equivalent to executing
\code{()\{\VAR{} r = $v$; $v$ = r - 1; \RETURN{} r\}()}.
\LMHash{}
-A postfix expression of the form \code{$C.v$-{}-} is equivalent to
+The static type of such an expression is the static type of $v$.
+
+
+\LMHash{}
+Execution of a postfix expression of the form \code{$C.v$-{}-} is equivalent to executing
\code{()\{\VAR{} r = $C.v$; $C.v$ = r - 1; \RETURN{} r\}()}.
\LMHash{}
-A postfix expression of the form \code{$e_1.v$-{}-} is equivalent to
+The static type of such an expression is the static type of $C.v$.
+
+
+\LMHash{}
+Execution of a postfix expression of the form \code{$e_1.v$-{}-} is equivalent to executing
\code{(x)\{\VAR{} r = x.v; x.v = r - 1; \RETURN{} r\}($e_1$)}.
\LMHash{}
-A postfix expression of the form \code{$e_1[e_2]$-{}-}, is equivalent to
+The static type of such an expression is the static type of $e_1.v$.
+
+
+\LMHash{}
+Execution of a postfix expression of the form \code{$e_1[e_2]$-{}-}, is equivalent to executing
\code{(a, i)\{\VAR{} r = a[i]; a[i] = r - 1; \RETURN{} r\}($e_1$, $e_2$)}.
\LMHash{}
-A postfix expression of the form \code{$e_1?.v$++} is equivalent to
+The static type of such an expression is the static type of $e_1[e_2]$.
+
+\LMHash{}
+Execution of a postfix expression of the form \code{$e_1?.v$++} is equivalent to executing
\code{((x) =$>$ x == \NULL? \NULL : x.v++)($e_1$)}.
\LMHash{}
-A postfix expression of the form \code{$e_1?.v$-{}-} is equivalent to
+The static type of such an expression is the static type of $e_1.v$.
+
+\LMHash{}
+Execution of a postfix expression of the form \code{$e_1?.v$-{}-} is equivalent to executing
\code{((x) =$>$ x == \NULL? \NULL : x.v-{}-)($e_1$)}.
+\LMHash{}
+The static type of such an expression is the static type of $e_1.v$.
+
\subsection{ Assignable Expressions}
\LMLabel{assignableExpressions}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698