715d59779e
The current specification seems to allow (or even mandate) that a
redirecting constructor (factory or generative) must be considered as a
syntactic shorthand for an invocation of the redirection target, with
no checks applied statically or dynamically according to the
declarations in the redirected constructor. So the following would be
OK:
class A {
A(num n) { print(n); }
A.foo(int i): this(i);
}
main() => new A.foo(3.0);
This CL changes dartLangSpec.tex to mandate all the checks (static
and dynamic) for the declaration of the redirecting constructor as
well as each one of the redirection targets.
Note that the analyzer already rejects the above program, which
lessens the disruption and the implementation burden, but compilers
would presumably need to have the dynamic checks implemented.
Underlying issues: https://github.com/dart-lang/sdk/issues/31590,
https://github.com/dart-lang/sdk/issues/32049,
https://github.com/dart-lang/sdk/issues/32511.
Change-Id: Icc15da6b817e4e678cdfc8829a1e06458756eb4b
Reviewed-on: https://dart-review.googlesource.com/28140
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
134 lines
3.8 KiB
TeX
134 lines
3.8 KiB
TeX
\def\keyword#1{\textbf{#1}}
|
|
\def\builtinId#1{\textbf{#1}}
|
|
\def\code#1{\textsf{#1}}
|
|
\def\comment#1{\textit{#1}}
|
|
\def\capt#1{\rmfamily \caption{#1}}
|
|
\def\lt{\ensuremath{<}}
|
|
\def\gt{\ensuremath{>}}
|
|
\def\<{\ensuremath{\langle}}
|
|
\def\>{\ensuremath{\rangle}}
|
|
\def\metavar#1{\ensuremath{\mathit{#1}}}
|
|
|
|
\def\ABSTRACT{\builtinId{abstract}}
|
|
\def\AS{\builtinId{as}}
|
|
\def\COVARIANT{\builtinId{covariant}}
|
|
\def\DEFERRED{\builtinId{deferred}}
|
|
\def\DYNAMIC{\builtinId{dynamic}}
|
|
\def\EXPORT{\builtinId{export}}
|
|
\def\EXTERNAL{\builtinId{external}}
|
|
\def\FACTORY{\builtinId{factory}}
|
|
\def\FUNCTION{\builtinId{Function}}
|
|
\def\GET{\builtinId{get}}
|
|
\def\IMPLEMENTS{\builtinId{implements}}
|
|
\def\IMPORT{\builtinId{import}}
|
|
\def\INTERFACE{\builtinId{interface}}
|
|
\def\LIBRARY{\builtinId{library}}
|
|
\def\MIXIN{\builtinId{mixin}}
|
|
\def\OPERATOR{\builtinId{operator}}
|
|
\def\PART{\builtinId{part}}
|
|
\def\SET{\builtinId{set}}
|
|
\def\STATIC{\builtinId{static}}
|
|
\def\TYPEDEF{\builtinId{typedef}}
|
|
|
|
\def\ASSERT{\keyword{assert}}
|
|
\def\ASYNC{\keyword{async}}
|
|
\def\AWAIT{\keyword{await}}
|
|
\def\BREAK{\keyword{break}}
|
|
\def\CALL{\keyword{call}}
|
|
\def\CASE{\keyword{case}}
|
|
\def\CATCH{\keyword{catch}}
|
|
\def\CLASS{\keyword{class}}
|
|
\def\CONST{\keyword{const}}
|
|
\def\CONTINUE{\keyword{continue}}
|
|
\def\DEFAULT{\keyword{default}}
|
|
\def\DO{\keyword{do}}
|
|
\def\ELSE{\keyword{else}}
|
|
\def\ENUM{\keyword{enum}}
|
|
\def\EXTENDS{\keyword{extends}}
|
|
\def\FALSE{\keyword{false}}
|
|
\def\FINAL{\keyword{final}}
|
|
\def\FINALLY{\keyword{finally}}
|
|
\def\FOR{\keyword{for}}
|
|
\def\HIDE{\keyword{hide}}
|
|
\def\IF{\keyword{if}}
|
|
\def\IN{\keyword{in}}
|
|
\def\IS{\keyword{is}}
|
|
\def\NEW{\keyword{new}}
|
|
\def\NULL{\keyword{null}}
|
|
\def\OF{\keyword{of}}
|
|
\def\ON{\keyword{on}}
|
|
\def\RETHROW{\keyword{rethrow}}
|
|
\def\RETURN{\keyword{return}}
|
|
\def\SHOW{\keyword{show}}
|
|
\def\SUPER{\keyword{super}}
|
|
\def\SWITCH{\keyword{switch}}
|
|
\def\SYNC{\keyword{sync}}
|
|
\def\THIS{\keyword{this}}
|
|
\def\THROW{\keyword{throw}}
|
|
\def\TRUE{\keyword{true}}
|
|
\def\TRY{\keyword{try}}
|
|
\def\VAR{\keyword{var}}
|
|
\def\VOID{\keyword{void}}
|
|
\def\WHILE{\keyword{while}}
|
|
\def\WITH{\keyword{with}}
|
|
\def\YIELD{\keyword{yield}}
|
|
|
|
% A quoted comma as used in the grammar: needs spacing fix.
|
|
\newcommand{\gcomma}{\mbox{`,\hspace{-0.1em}'}}
|
|
|
|
% Used as line break in the right hand side of a grammar
|
|
% alternative, that is, when starting a "continuation line".
|
|
\newcommand{\gnewline}{\\\mbox{}\qquad{}}
|
|
|
|
% Metavariables for argument lists.
|
|
\newcommand{\argumentList}[1]{\metavar{{#1}s}}
|
|
\newcommand{\parameterList}[1]{\metavar{{#1}s}}
|
|
|
|
\newenvironment{Q}[1]{{\bf #1}}{}
|
|
\newenvironment{rationale}[1]{{\it #1}}{}
|
|
\newenvironment{commentary}[1]{{\sf #1}}{}
|
|
|
|
\newenvironment{dartCode}[1][!ht] {
|
|
% \begin{verbatim}[#1]
|
|
\def\@programcr{\@addfield\strut}
|
|
\let\\=\@programcr
|
|
\relax\@vobeyspaces\obeylines
|
|
|
|
\sffamily
|
|
}{
|
|
%\end{verbatim}
|
|
}
|
|
|
|
% A commonly used name for an identifier
|
|
\newcommand{\id}{\metavar{id}}
|
|
|
|
% ----------------------------------------------------------------------
|
|
% Support for hash valued Location Markers
|
|
|
|
% very small font, to enable 40 char hash values in the margin
|
|
\makeatletter
|
|
\ifcase \@ptsize \relax% 10pt
|
|
\newcommand{\miniscule}{\@setfontsize\miniscule{2}{3}}% \tiny: 5/6
|
|
\or% 11pt
|
|
\newcommand{\miniscule}{\@setfontsize\miniscule{3}{4}}% \tiny: 6/7
|
|
\or% 12pt
|
|
\newcommand{\miniscule}{\@setfontsize\miniscule{3}{4}}% \tiny: 6/7
|
|
\fi
|
|
\makeatother
|
|
|
|
% white: location markers should not create visual noise
|
|
\definecolor{LMdim}{gray}{1.0}
|
|
|
|
% insert location marker showing hash value of following paragraph
|
|
\newcommand{\LMHash}[1]{%
|
|
\hspace{0pt}\marginpar{\raisebox{0.5ex}{\miniscule{\color{LMdim}#1}}}}
|
|
|
|
% support convenient renewcommand
|
|
\let\OriginalLMHash\LMHash
|
|
|
|
% define a label, and show the associated logical location marker
|
|
\newcommand{\LMLabel}[1]{%
|
|
\vspace{-\baselineskip}\hspace{0pt}\OriginalLMHash{\raisebox{10ex}{#1}}%
|
|
\label{#1}}
|
|
% ----------------------------------------------------------------------
|