Version 2.0.0-dev.69.0
Merge commit 'b571e9391ca7959e1d0dbbad8ab93a6ae01ede8e' into dev
diff --git a/.github/move.yml b/.github/move.yml
new file mode 100644
index 0000000..bf0cceb
--- /dev/null
+++ b/.github/move.yml
@@ -0,0 +1,21 @@
+# Configuration for move-issues - https://github.com/dessant/move-issues
+
+# Delete the command comment when it contains no other content
+deleteCommand: true
+
+# Close the source issue after moving
+closeSourceIssue: true
+
+# Lock the source issue after moving
+lockSourceIssue: false
+
+# Mention issue and comment authors
+mentionAuthors: true
+
+# Preserve mentions in the issue content
+keepContentMentions: true
+
+# Set custom aliases for targets
+aliases:
+ flutter: flutter/flutter
+ flutter-intellij: flutter/flutter-intellij
diff --git a/BUILD.gn b/BUILD.gn
index b00fb39..5dbba45 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -63,6 +63,10 @@
}
group("runtime_kernel") {
+ if (targetting_fuchsia) {
+ # Fuchsia has run_vm_tests marked testonly.
+ testonly = true
+ }
deps = [
":runtime",
]
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1160e93..832c29d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,26 +1,17 @@
-## 2.0.0-dev.XX.0
-(Add new changes here, and they will be copied to the
- change section for the next dev version)
-
-### Language
-
-#### Strong Mode
-
-### Dart VM
-
-### Tool Changes
-
-#### dartfmt
-
-#### Pub
-
-#### Dart2js
-
-#### Analyzer
-
-#### Other Tools
+## 2.0.0-dev.69.0
### Core library changes
+* `dart:collection`, `dart:core`:
+ * Re-enable `Iterable.whereType`. The method was disabled because code
+ was still being compiled in Dart 1 mode, and the function was
+ error-prone when used in that code.
+* `dart:async`
+ * Changed an internal lazily-allocated reusable "null future" to always belong
+ to the root zone. This avoids race conditions where the first access to the
+ future determined which zone it would belong to. The zone is only used
+ for *scheduling* the callback of listeners, the listeners themselves will
+ run in the correct zone in any case.
+ Issue [#32556](http://dartbug.com/32556).
## 2.0.0-dev.68.0
diff --git a/DEPS b/DEPS
index 544f975..21df396 100644
--- a/DEPS
+++ b/DEPS
@@ -53,13 +53,13 @@
# Revisions of /third_party/* dependencies.
"args_tag": "1.4.1",
"async_tag": "2.0.7",
- "bazel_worker_tag": "v0.1.9",
+ "bazel_worker_tag": "0.1.11",
"boolean_selector_tag" : "1.0.3",
"boringssl_gen_rev": "fc47eaa1a245d858bae462cd64d4155605b850ea",
"boringssl_rev" : "189270cd190267f5bd60cfe8f8ce7a61d07ba6f4",
"charcode_tag": "v1.1.1",
"chrome_rev" : "19997",
- "cli_util_tag" : "0.1.2+1",
+ "cli_util_rev" : "fb5ee65ab72f6b4dd99a53efd992979ebdaf10df",
"collection_tag": "1.14.10",
"convert_tag": "2.0.1",
"crypto_tag" : "2.0.5",
@@ -78,70 +78,71 @@
# minutes later.
#
# For more details, see https://github.com/dart-lang/sdk/issues/30164
- "dart_style_tag": "1.1.2", # Please see the note above before updating.
+ "dart_style_tag": "1.1.3", # Please see the note above before updating.
"dartdoc_tag" : "v0.20.1",
"fixnum_tag": "0.10.5",
"func_rev": "25eec48146a58967d75330075ab376b3838b18a8",
"glob_tag": "1.1.5",
"html_tag" : "0.13.3",
- "http_io_tag": "265e90afbffacb7b2988385d4a6aa2f14e970d44",
- "http_multi_server_tag" : "2.0.4",
+ "http_io_rev": "265e90afbffacb7b2988385d4a6aa2f14e970d44",
+ "http_multi_server_tag" : "2.0.5",
"http_parser_tag" : "3.1.1",
"http_retry_tag": "0.1.1",
"http_tag" : "0.11.3+17",
"http_throttle_tag" : "1.0.2",
"idl_parser_rev": "5fb1ebf49d235b5a70c9f49047e83b0654031eb7",
- "intl_tag": "0.15.2",
+ "intl_tag": "0.15.6",
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
- "json_rpc_2_tag": "2.0.6",
+ "json_rpc_2_tag": "2.0.8",
"linter_tag": "0.1.56",
"logging_tag": "0.11.3+1",
- "markdown_tag": "2.0.0",
+ "markdown_tag": "2.0.1",
"matcher_tag": "0.12.3",
- "mime_tag": "0.9.6",
+ "mime_tag": "0.9.6+1",
"mockito_tag": "d39ac507483b9891165e422ec98d9fb480037c8b",
"mustache4dart_tag" : "v2.1.2",
- "oauth2_tag": "1.1.0",
+ "oauth2_tag": "1.2.1",
"observatory_pub_packages_rev": "caf0aecfb15077fc7a34d48e9df13606c793fddf",
"package_config_tag": "1.0.3",
- "package_resolver_tag": "1.0.2+1",
+ "package_resolver_tag": "1.0.3",
"path_tag": "1.5.1",
"plugin_tag": "0.2.0+2",
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
"pool_tag": "1.3.4",
- "protobuf_tag": "0.7.1",
+ "protobuf_tag": "0.9.0",
"pub_rev": "58fe996eab8d54f28f5109c407ff0ab62fbd835d",
"pub_semver_tag": "1.4.1",
"quiver_tag": "0.29.0",
- "resource_rev":"af5a5bf65511943398146cf146e466e5f0b95cb9",
+ "resource_rev": "b786afa7567fc6b95c185edb01cc4e9d3dadbe30",
"root_certificates_rev": "16ef64be64c7dfdff2b9f4b910726e635ccc519e",
- "shelf_static_rev": "v0.2.7",
+ "shelf_static_rev": "v0.2.8",
"shelf_packages_handler_tag": "1.0.3",
- "shelf_tag": "0.7.2",
- "shelf_web_socket_tag": "0.2.2",
+ "shelf_tag": "0.7.3+2",
+ "shelf_web_socket_tag": "0.2.2+2",
"source_map_stack_trace_tag": "1.1.4",
"source_maps-0.9.4_rev": "38524",
- "source_maps_tag": "0.10.4",
+ "source_maps_tag": "0.10.6",
"source_span_tag": "1.4.0",
"stack_trace_tag": "1.9.2",
"stream_channel_tag": "1.6.4",
"string_scanner_tag": "1.0.2",
"sunflower_rev": "879b704933413414679396b129f5dfa96f7a0b1e",
- "test_descriptor_tag": "1.0.3",
- "test_process_tag": "1.0.1",
+ "test_descriptor_tag": "1.1.1",
+ "test_process_tag": "1.0.3",
"term_glyph_tag": "1.0.0",
"test_reflective_loader_tag": "0.1.4",
"test_tag": "1.0.0",
"tuple_tag": "v1.0.1",
"typed_data_tag": "1.1.3",
+ "unittest_rev": "2b8375bc98bb9dc81c539c91aaea6adce12e1072",
"usage_tag": "3.4.0",
"utf_tag": "0.9.0+4",
- "watcher_tag": "0.9.7+8",
+ "watcher_rev": "908d74c6ed0889fa9bd7939c72bcc287e4f581fd",
"web_components_rev": "8f57dac273412a7172c8ade6f361b407e2e4ed02",
- "web_socket_channel_tag": "1.0.7",
+ "web_socket_channel_tag": "1.0.8",
"WebCore_rev": "fb11e887f77919450e497344da570d780e078bc8",
- "yaml_tag": "2.1.13",
+ "yaml_tag": "2.1.14",
"zlib_rev": "c3d0a6190f2f8c924a05ab6cc97b8f975bddd33f",
}
@@ -157,7 +158,7 @@
"packages": [
{
"package": "dart/dart-sdk/${{platform}}",
- "version": "version:2.0.0-dev.65.0",
+ "version": "version:2.0.0-dev.68.0",
},
],
"dep_type": "cipd",
@@ -215,7 +216,7 @@
Var("dart_root") + "/third_party/pkg/charcode":
Var("dart_git") + "charcode.git" + "@" + Var("charcode_tag"),
Var("dart_root") + "/third_party/pkg/cli_util":
- Var("dart_git") + "cli_util.git" + "@" + Var("cli_util_tag"),
+ Var("dart_git") + "cli_util.git" + "@" + Var("cli_util_rev"),
Var("dart_root") + "/third_party/pkg/collection":
Var("dart_git") + "collection.git" + "@" + Var("collection_tag"),
Var("dart_root") + "/third_party/pkg/convert":
@@ -241,7 +242,7 @@
Var("dart_root") + "/third_party/pkg/http":
Var("dart_git") + "http.git" + "@" + Var("http_tag"),
Var("dart_root") + "/third_party/pkg_tested/http_io":
- Var("dart_git") + "http_io.git" + "@" + Var("http_io_tag"),
+ Var("dart_git") + "http_io.git" + "@" + Var("http_io_rev"),
Var("dart_root") + "/third_party/pkg/http_multi_server":
Var("dart_git") + "http_multi_server.git" +
"@" + Var("http_multi_server_tag"),
@@ -346,12 +347,18 @@
Var("dart_git") + "tuple.git" + "@" + Var("tuple_tag"),
Var("dart_root") + "/third_party/pkg/typed_data":
Var("dart_git") + "typed_data.git" + "@" + Var("typed_data_tag"),
+ # Unittest is an early version, 0.11.x, of the package "test"
+ # Do not use it in any new tests. Fetched from chromium_git to avoid
+ # race condition in cache with pkg/test.
+ Var("dart_root") + "/third_party/pkg/unittest":
+ Var("chromium_git") + "/external/github.com/dart-lang/test.git" +
+ "@" + Var("unittest_rev"),
Var("dart_root") + "/third_party/pkg/usage":
Var("dart_git") + "usage.git" + "@" + Var("usage_tag"),
Var("dart_root") + "/third_party/pkg/utf":
Var("dart_git") + "utf.git" + "@" + Var("utf_tag"),
Var("dart_root") + "/third_party/pkg/watcher":
- Var("dart_git") + "watcher.git" + "@" + Var("watcher_tag"),
+ Var("dart_git") + "watcher.git" + "@" + Var("watcher_rev"),
Var("dart_root") + "/third_party/pkg/web_components":
Var("dart_git") + "web-components.git" +
"@" + Var("web_components_rev"),
@@ -415,22 +422,6 @@
],
},
{
- "name": "unittest",
- # Unittest is an early version, 0.11.6, of the package "test"
- # Do not use it in any new tests.
- "pattern": ".",
- "action": [
- "download_from_google_storage",
- "--no_auth",
- "--no_resume",
- "--bucket",
- "dart-dependencies",
- "--extract",
- "-s",
- Var('dart_root') + "/third_party/pkg/unittest.tar.gz.sha1",
- ],
- },
- {
"name": "7zip",
"pattern": ".",
"action": [
diff --git a/sdk/copy_tree.gni b/build/dart/copy_tree.gni
similarity index 98%
rename from sdk/copy_tree.gni
rename to build/dart/copy_tree.gni
index a368a29..580d711 100644
--- a/sdk/copy_tree.gni
+++ b/build/dart/copy_tree.gni
@@ -2,7 +2,7 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
-_dart_root = rebase_path("..")
+_dart_root = rebase_path("../..")
# copy_tree() copies a directory tree rooted at `source` to `dest`, which should
# be somewhere under $root_out_dir.
diff --git a/docs/language/dart.sty b/docs/language/dart.sty
index 6c8a3e5..3146317 100644
--- a/docs/language/dart.sty
+++ b/docs/language/dart.sty
@@ -80,6 +80,10 @@
% 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}}{}
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex
index 79178c0..80b7482 100644
--- a/docs/language/dartLangSpec.tex
+++ b/docs/language/dartLangSpec.tex
@@ -67,6 +67,8 @@
% - Clarify that it is an error to use FutureOr<T> as a superinterface etc.
% - Eliminate the notion of static warnings, all program faults are now errors.
% - It is no longer an error for a getter to have return type `void`.
+% - Specify that each redirection of a constructor is checked, statically and
+% dynamically.
%
% 1.15
% - Change how language specification describes control flow.
@@ -1028,7 +1030,7 @@
.
\end{grammar}
-Formal parameter lists allow an optional trailing comma after the last parameter ($`,\!'?$).
+Formal parameter lists allow an optional trailing comma after the last parameter (\gcomma{}?).
A parameter list with such a trailing comma is equivalent in all ways to the same parameter list without the trailing comma.
All parameter lists in this specification are shown without a trailing comma, but the rules and semantics apply equally to the corresponding parameter list with a trailing comma.
@@ -1720,18 +1722,80 @@
If a generative constructor $c$ is not a redirecting constructor and no body is provided, then $c$ implicitly has an empty body \code{\{\}}.
-\paragraph{Redirecting Constructors}
-\LMLabel{redirectingConstructors}
+\paragraph{Redirecting Generative Constructors}
+\LMLabel{redirectingGenerativeConstructors}
\LMHash{}
A generative constructor may be {\em redirecting}, in which case its only action is to invoke another generative constructor.
-A redirecting constructor has no body; instead, it has a redirect clause that specifies which constructor the invocation is redirected to, and with what arguments.
+A redirecting constructor has no body;
+instead, it has a redirect clause that specifies which constructor the invocation is redirected to, and with which arguments.
\begin{grammar}
{\bf redirection:}`{\escapegrammar :}' \THIS{} (`{\escapegrammar .}' identifier)? arguments
.
\end{grammar}
+\def\ConstMetavar{\mbox{\CONST{}?}}
+
+\LMHash{}
+Assume that
+\code{$C$<$X_1\ \EXTENDS\ B_1 \ldots,\ X_m\ \EXTENDS\ B_m$>}
+is the name and formal type parameters of the enclosing class,
+$\ConstMetavar$ stands for either \CONST{} or nothing,
+$N$ is $C$ or $C.\id_0$ for some identifier $\id_0$,
+and \id{} is an identifier.
+Consider a declaration of a redirecting generative constructor $k$ of one of the forms
+
+\code{$\ConstMetavar$ $N$($T_1\ x_1 \ldots,\ T_n\ x_n,\ $[$T_{n+1}\ x_{n+1} = d_1 \ldots,\ T_{n+k}\ x_{n+k} = d_k$]): $R$;}
+
+\code{$\ConstMetavar$ $N$($T_1\ x_1 \ldots,\ T_n\ x_n,\ $\{$T_{n+1}\ x_{n+1} = d_1 \ldots,\ T_{n+k}\ x_{n+k} = d_k$\}): $R$;}
+
+\noindent
+where $R$ is of one of the forms
+
+\code{$\THIS{}$($e_1 \ldots,\ e_p,\ x_1$: $e_{p+1}, \ldots,\ x_q$: $e_{p+q}$)}
+
+\code{$\THIS{}.\id$($e_1 \ldots,\ e_p,\ x_1$: $e_{p+1}, \ldots,\ x_q$: $e_{p+q}$)}
+
+\LMHash{}
+The {\em redirectee constructor} for this declaration is then the constructor denoted by
+\code{$C$<$X_1 \ldots,\ X_m$>} respectively \code{$C$<$X_1 \ldots,\ X_m$>.\id}.
+It is a compile-time error if the static argument list type (\ref{actualArgumentLists}) of
+\code{($e_1 \ldots,\ e_p,\ x_1$: $e_{p+1}, \ldots,\ x_q$: $e_{p+q}$)}
+is not an assignable match for the formal parameter list of the redirectee.
+
+\commentary{
+Note that the case where no named parameters are passed is covered by letting $q$ be zero,
+and the case where $C$ is a non-generic class is covered by letting $m$ be zero,
+in which case the formal type parameter list and actual type argument lists are omitted (\ref{generics}).
+}
+
+\rationale{
+We require an assignable match rather than the stricter subtype match
+because a generative redirecting constructor $k$ invokes its redirectee $k'$
+in a manner which resembles function invocation in general.
+For instance, $k$ could accept an argument \code{x}
+and pass on an expression $e_j$ using \code{x} such as \code{x.f(42)} to $k'$,
+and it would be surprising
+if $e_j$ were subject to more strict constraints than the ones applied to
+actual arguments to function invocations in general.
+}
+
+\LMHash{}
+When $\ConstMetavar$ is \CONST{},
+it is a compile-time error if the redirectee is not a constant constructor.
+Moreover, when $\ConstMetavar$ is \CONST{}, each
+$e_i,\ i \in 1 .. p+q$,
+must be a potentially constant expression (\ref{constantConstructors}).
+
+\LMHash{}
+It is a dynamic error if an actual argument passed in an invocation of a redirecting generative constructor $k$
+is not a subtype of the actual type
+\ref{actualTypeOfADeclaration}) of the corresponding formal parameter in the declaration of $k$.
+It is a dynamic error if an actual argument passed to the redirectee $k'$ of a redirecting generative constructor
+is not a subtype of the actual type
+(\ref{actualTypeOfADeclaration}) of the corresponding formal parameter in the declaration of the redirectee.
+
\paragraph{Initializer Lists}
\LMLabel{initializerLists}
@@ -1953,13 +2017,56 @@
.
\end{grammar}
+Assume that
+\code{$C$<$X_1\ \EXTENDS\ B_1 \ldots,\ X_m\ \EXTENDS\ B_m$>}
+is the name and formal type parameters of the enclosing class,
+$\ConstMetavar$ is \CONST{} or empty,
+$N$ is $C$ or $C.\id_0$ for some identifier $\id_0$,
+$T$ is a type name, and \id{} is an identifier,
+then consider a declaration of a redirecting factory constructor $k$ of one of the forms
+
+\begin{dartCode}
+$\ConstMetavar$ \FACTORY{}
+ $N$($T_1\ x_1 \ldots,\ T_n\ x_n,\ $[$T_{n+1}\ x_{n+1} = d_1 \ldots,\ T_{n+k}\ x_{n+k} = d_k$]) = $R$;
+
+$\ConstMetavar$ \FACTORY{}
+ $N$($T_1\ x_1 \ldots,\ T_n\ x_n,\ $\{$T_{n+1}\ x_{n+1} = d_1 \ldots,\ T_{n+k}\ x_{n+k} = d_k$\}) = $R$;
+\end{dartCode}
+
+\noindent
+where $R$ is of one of the forms
+\code{$T$<$S_1 \ldots,\ S_p$>} or
+\code{$T$<$S_1 \ldots,\ S_p$>.\id}.
+The {\em redirectee constructor} for this declaration is then the constructor denoted by $R$.
+
\LMHash{}
-Calling a redirecting factory constructor $k$ causes the constructor $k'$ denoted by $type$ (respectively, $type.identifier$) to be called with the actual arguments passed to $k$, and returns the result of $k'$ as the result of $k$.
-The resulting constructor call is governed by the same rules as an instance creation expression using \NEW{} (\ref{instanceCreation}).
+Let $\argumentList{T}$ be the static argument list type (\ref{actualArgumentLists})
+\code{($T_1 \ldots,\ T_{n+k}$)}
+when $k$ takes no named arguments, and
+\code{($T_1 \ldots,\ T_n,\ T_{n+1}\ x_{n+1},\ \ldots,\ T_{n+k}\ x_{n+k}$)}
+when $k$ takes some named arguments.
+It is a compile-time error if $\argumentList{T}$
+is not a subtype match for the formal parameter list of the redirectee.
+
+\rationale{
+We require a subtype match
+(rather than the more forgiving assignable match which is used with a generative redirecting constructor),
+because a factory redirecting constructor $k$ always invokes its redirectee $k'$
+with exactly the same actual arguments that $k$ received.
+This means that a downcast on an actual argument
+``between'' $k$ and $k'$
+would either be unused because the actual argument has the type required by $k'$,
+or it would amount to a dynamic error which is simply delayed a single step.
+}
+
+\LMHash{}
+Moreover, when $\ConstMetavar$ is \CONST{}
+the redirectee must be a constant constructor.
\commentary{
-It follows that if \metavar{type} or \code{\metavar{type}.\id} are not defined, or do not refer to a class or constructor, a dynamic error occurs, as with any other undefined constructor call.
-The same holds if $k$ is called with fewer required parameters or more positional parameters than $k'$ expects, or if $k$ is called with a named parameter that is not declared by $k'$.
+Note that the non-generic case is covered by letting $m$ or $p$ or both be zero,
+in which case the formal type parameter list of the class $C$
+and/or the actual type argument list of the redirectee constructor is omitted (\ref{generics}).
}
\LMHash{}
@@ -1970,14 +2077,7 @@
}
\LMHash{}
-It is a run-time error if a redirecting factory constructor redirects to itself, either directly or indirectly via a sequence of redirections. %does not redirect to a non-redirecting factory constructor or to a generative constructor in a finite number of steps.
-
-% Make this a run-time error so deferred loading works
-
-\rationale{
-If a redirecting factory $F_1$ redirects to another redirecting factory $F_2$ and $F_2$ then redirects to $F_1$, then both $F_1$ and $F_2$ are ill-defined.
-Such cycles are therefore illegal.
-}
+It is a compile-time error if a redirecting factory constructor redirects to itself, either directly or indirectly via a sequence of redirections.
\LMHash{}
It is a compile-time error if $type$ does not denote a class accessible in the current scope;
@@ -1992,7 +2092,7 @@
However, redirecting factories have several advantages:
\begin{itemize}
\item An abstract class may provide a constant constructor that utilizes the constant constructor of another class.
-\item A redirecting factory constructors avoids the need for forwarders to repeat the default values for formal parameters in their signatures.
+\item A redirecting factory constructor avoids the need for forwarders to repeat the default values for formal parameters in their signatures.
%\item A generic factory class that aggregates factory constructors for types it does not implement can still have its type arguments passed correctly.
\end{itemize}
@@ -2034,6 +2134,25 @@
\LMHash{}
It is a compile-time error if any of the type arguments to $k'$ are not subtypes of the bounds of the corresponding formal type parameters of $type$.
+\LMHash{}
+For the dynamic semantics,
+assume that $k$ is a redirecting factory constructor
+and $k'$ is the redirectee of $k$.
+
+\LMHash{}
+When the redirectee $k'$ is a factory constructor,
+execution of $k$ amounts to execution of $k'$ with the actual arguments passed to $k$.
+The result of the execution of $k'$ is the result of $k$.
+
+\LMHash{}
+When the redirectee $k'$ is a generative constructor,
+let $o$ be a fresh instance (\ref{generativeConstructors})
+of the class that contains $k'$.
+Execution of $k$ then amounts to execution of $k'$ to initialize $o$,
+governed by the same rules as an instance creation expression (\ref{instanceCreation}).
+If $k$ completed normally then the execution of $k'$ completes normally returning $o$,
+otherwise $k'$ completes by throwing the exception and stack trace thrown by $k$.
+
\subsubsection{Constant Constructors}
\LMLabel{constantConstructors}
@@ -2350,7 +2469,7 @@
When we speak of members here, we mean accessible instance or static variables, getters, setters, and methods (\ref{classes}).
\item You cannot have two members with the same name in the same class - be they declared or inherited (\ref{scoping}, \ref{classes}).
\item Static members are never inherited.
-\item It is an error if you have an static member named $m$ in your class and an instance member of the same name (\ref{instanceMethods}, \ref{getters}, \ref{setters}).
+\item It is an error if you have an static member named $m$ in your class and an instance member of the same name (\ref{classMemborConflicts}).
\item It is an error if you have a static setter $v=$, and an instance member $v$ (\ref{setters}).
\item It is an error if you have a static getter $v$ and an instance setter $v=$ (\ref{getters}).
\item If you define an instance member named $m$, and your superclass has an instance member of the same name, they override each other.
@@ -2767,7 +2886,7 @@
\LMHash{}
The declaration of an enum of the form
-\code{$m$ \ENUM{} E \{$m_0\,\,id_0, \ldots,\ m_{n-1}\,\,id_{n-1}$\}}
+\code{$m$ \ENUM{} E \{$m_0\,\,\id_0, \ldots,\ m_{n-1}\,\,\id_{n-1}$\}}
has the same effect as a class declaration
\begin{dartCode}
@@ -2777,8 +2896,8 @@
$m_0$ \STATIC{} \CONST{} E id$_0$ = \CONST{} E(0);
$\ldots$
$m_{n-1}$ \STATIC{} \CONST{} E id$_{n-1}$ = const E(n - 1);
- \STATIC{} \CONST{} List<E> values = const <E>[id$_0, \ldots, $ id$_{n-1}$];
- String toString() => \{ 0: `E.id$_0$', $\ldots$, n-1: `E.id$_{n-1}$'\}[index]
+ \STATIC{} \CONST{} List<E> values = const <E>[\id$_0, \ldots, $ \id$_{n-1}$];
+ String toString() => \{ 0: `E.\id$_0$', $\ldots$, n-1: `E.\id$_{n-1}$'\}[index]
\}
\end{dartCode}
@@ -3977,7 +4096,7 @@
\end{itemize}
\LMHash{}
-The form \code{\$id} is equivalent to the form \code{\$\{id\}}.
+The form \code{\$\id} is equivalent to the form \code{\$\{\id\}}.
An interpolated string, $s$, with content `\code{$s_0$\$\{$e_1$\}$s_1\ldots{}s_{n-1}\$\{e_n\}s_{n}$}' (where any of $s_0, \ldots, s_n$ can be empty)
is evaluated by evaluating each expression $e_i$ ($1 \le i \le n$) in to a string $r_i$ in the order they occur in the source text, as follows:
\begin{itemize}
@@ -4002,20 +4121,20 @@
\end{grammar}
\LMHash{}
-A symbol literal \code{\#$id$} where $id$ is an identifier
+A symbol literal \code{\#\id} where \id{} is an identifier
that does not begin with an underscore ('\code{\_}'),
-evaluates to an instance of \code{Symbol} representing the identifier $id$.
-All occurences of \code{\#$id$} evaluate to the same instance
+evaluates to an instance of \code{Symbol} representing the identifier \id.
+All occurences of \code{\#\id} evaluate to the same instance
\commentary{(symbol instances are canonicalized)},
and no other symbol literals evaluate to that \code{Symbol} instance
or to a \code{Symbol} instance that is equal
(according to the \code{==} operator \ref{equality}) to that instance.
\LMHash{}
-A symbol literal \code{\#$id$.$id_2$\ldots$id_n$}
-where $id$ \ldots $id_n$ are identifiers,
+A symbol literal \code{\#$\id.\id_2\ldots\id_n$}
+where $\id{} \ldots \id_n$ are identifiers,
evaluates to an instance of \code{Symbol} representing that particular sequence of identifiers.
-All occurences of \code{\#$id$.$id_2$\ldots$id_n$} with the same sequence of identifiers
+All occurences of \code{\#$\id.\id_2\ldots\id_n$} with the same sequence of identifiers
evaluate to the same instance,
and no other symbol literals evaluate to that \code{Symbol} instance
or to a \code{Symbol} instance that is \code{==} to that instance.
@@ -4030,9 +4149,9 @@
or to a \code{Symbol} instance that is \code{==} to that instance.
\LMHash{}
-A symbol literal \code{\#\_$id$}, evaluates to an instance of \code{Symbol}
+A symbol literal \code{\#\_\id}, evaluates to an instance of \code{Symbol}
representing the private identifier \code{\_\id} of the containing library.
-All occurences of \code{\#\_$id$} {\em in the same library} evaluate to the same instance,
+All occurences of \code{\#\_\id} {\em in the same library} evaluate to the same instance,
and no other symbol literals evaluate to that \code{Symbol} instance
or to a \code{Symbol} instance that is \code{==} to that instance.
@@ -4854,7 +4973,7 @@
when a function expression (\ref{functionExpressions}) is invoked (\ref{functionExpressionInvocation}),
when a method (\ref{methodInvocation}), getter (\ref{topLevelGetterInvocation}, \ref{propertyExtraction}) or setter (\ref{assignment}) is invoked,
or when a constructor is invoked
-(either via instance creation (\ref{instanceCreation}), constructor redirection (\ref{redirectingConstructors}) or super initialization).
+(either via instance creation (\ref{instanceCreation}), constructor redirection (\ref{redirectingGenerativeConstructors}), or super initialization).
The various kinds of function invocation differ as to how the function to be invoked, $f$, is determined, as well as whether \THIS{} (\ref{this}) is bound.
Once $f$ has been determined,
formal type parameters of $f$ are bound to the corresponding actual type arguments,
@@ -4989,11 +5108,11 @@
%When a stream is canceled, the implementation must wait for the cancelation future returned by \code{cancell()} to complete before proceeding.
-\subsubsection{Actual Argument List Evaluation}
-\LMLabel{actualArguments}
+\subsubsection{Actual Argument Lists}
+\LMLabel{actualArgumentLists}
\LMHash{}
-Function invocation involves evaluation of the list of actual arguments to the function and binding of the results to the function's formal parameters.
+Actual argument lists have the following syntax:
\begin{grammar}
{\bf arguments:}`(' (argumentList \gcomma{}?)? `)'
@@ -5008,9 +5127,78 @@
\end{grammar}
\LMHash{}
-Argument lists allow an optional trailing comma after the last argument ($`,\!'?$).
-An argument list with such a trailing comma is equivalent in all ways to the same argument list without the trailing comma.
-All argument lists in this specification are shown without a trailing comma, but the rules and semantics apply equally to the corresponding argument list with a trailing comma.
+Argument lists allow an optional trailing comma after the last argument (\gcomma{}?).
+An argument list with such a trailing comma is equivalent in all ways to the same parameter list without the trailing comma.
+All argument lists in this specification are shown without a trailing comma,
+but the rules and semantics apply equally to the corresponding argument list with a trailing comma.
+
+\LMHash{}
+Let $L$ be an argument list of the form
+\code{($e_1 \ldots,\ e_m,\ y_{m+1}$: $e_{m+1} \ldots,\ y_{m+p}$: $e_{m+p}$)}
+and assume that the static type of $e_i$ is $S_i$, $i \in 1 .. m+p$.
+The {\em static argument list type} of $L$ is then
+\code{($S_1 \ldots,\ S_m,\ S_{m+1}\ y_{m+1} \ldots,\ S_{m+p}\ y_{m+p}$)}.
+
+\LMHash{}
+Let $\argumentList{S}$ be the static argument list type
+
+\code{($S_1 \ldots,\ S_m,\ S_{m+1}\ y_{m+1} \ldots,\ S_{m+p}\ y_{m+p}$)}
+
+\noindent
+and let $\parameterList{P}$ be the formal parameter list
+
+\code{($T_1\ x_1 \ldots,\ T_n\ x_n,\ $[$T_{n+1}\ x_{n+1} = d_1, \ldots,\ T_{n+k}\ x_{n+k} = d_k$])}
+
+\noindent
+where each parameter may be marked \COVARIANT{} (\commentary{not shown, but allowed}).
+
+\LMHash{}
+We say that $\argumentList{S}$ {\em is a subtype match} for $\parameterList{P}$
+if{}f $p = 0$, $n \leq m \leq n+k$, and $S_i$ is a subtype of $T_i$ for all $i \in 1 .. m$.
+We say that $\argumentList{S}$ {\em is an assignable match} for $\parameterList{P}$
+if{}f $p = 0$, $n \leq m \leq n+k$, and $S_i$ is assignable to $T_i$ for all $i \in 1 .. m$.
+
+\LMHash{}
+Let $\argumentList{S}$ be the static argument list type
+
+\code{($S_1 \ldots,\ S_m,\ S_{m+1}\ y_{m+1} \ldots,\ S_{m+p}\ y_{m+p}$)}
+
+\noindent
+and let $\parameterList{P}$ be the formal parameter list
+
+\code{($T_1\ x_1 \ldots,\ T_n\ x_n,\ $\{$T_{n+1}\ x_{n+1} = d_1, \ldots,\ T_{n+k}\ x_{n+k} = d_k$\})}
+
+\noindent
+where each parameter may be marked \COVARIANT{} (\commentary{not shown, but allowed}).
+
+\LMHash{}
+We say that $\argumentList{S}$ {\em is a subtype match} for $\parameterList{P}$
+if{}f $m = n$,
+$\{y_{m+1}\ldots,\ y_{m+p}\} \subseteq \{x_{n+1}\ldots,\ x_{n+k}\}$,
+$S_i$ is a subtype of $T_i$ for all $i \in 1 .. m$,
+and $S_i$ is a subtype of $T_j$ whenever $y_i = x_j$ and
+$j \in n + 1 .. n + k$, for all
+$i \in m + 1 .. m + p$.
+We say that $\argumentList{S}$ {\em is an assignable match} for $\parameterList{P}$
+if{}f $m = n$,
+$\{y_{m+1}\ldots,\ y_{m+p}\} \subseteq \{x_{n+1}\ldots,\ x_{n+k}\}$,
+$S_i$ is assignable to $T_i$ for all $i \in 1 .. m$,
+and $S_i$ is assignable to $T_j$ whenever $y_i = x_j$ and
+$j \in n + 1 .. n + k$, for all
+$i \in m + 1 .. m + p$.
+
+\commentary{
+In short, an actual argument list is a match for a formal parameter list
+whenever the former can safely be passed to the latter.
+}
+
+
+\subsubsection{Actual Argument List Evaluation}
+\LMLabel{actualArguments}
+
+\LMHash{}
+Function invocation involves evaluation of the list of actual arguments to the function,
+and binding of the results to the function's formal parameters.
\LMHash{}
When parsing an argument list, an ambiguity may arise because the same source code could be one generic function invocation, and it could be two or more relational expressions and/or shift expressions.
@@ -8179,8 +8367,8 @@
It is a compile-time error if all of the following conditions hold:
\begin{itemize}
\item The switch statement does not have a default clause.
-\item The static type of $e$ is an enumerated typed with elements $id_1, \ldots, id_n$.
-\item The sets $\{e_1, \ldots, e_k\} $ and $\{id_1, \ldots, id_n\}$ are not the same.
+\item The static type of $e$ is an enumerated type with elements $\id_1, \ldots, \id_n$.
+\item The sets $\{e_1, \ldots, e_k\} $ and $\{\id_1, \ldots, \id_n\}$ are not the same.
\end{itemize}
\commentary{
@@ -9007,9 +9195,9 @@
\begin{itemize}
\item If $C_i$ is of the form
-\code{\SHOW{} $id_1, \ldots,\ id_k$}
+\code{\SHOW{} $\id_1, \ldots,\ \id_k$}
-then let $NS_i = \SHOW{}([id_1, \ldots,\ id_k], NS_{i-1}$)
+then let $NS_i = \SHOW{}([\id_1, \ldots,\ \id_k], NS_{i-1}$)
where $show(l,n)$ takes a list of identifiers $l$ and a namespace $n$, and produces a namespace that maps each name in $l$ to the same element that $n$ does.
Furthermore, for each name $x$ in $l$, if $n$ defines the name $x=$ then the new namespace maps $x=$ to the same element that $n$ does.
@@ -9017,9 +9205,9 @@
\item If $C_i$ is of the form
-\code{\HIDE{} $id_1, \ldots,\ id_k$}
+\code{\HIDE{} $\id_1, \ldots,\ \id_k$}
-then let $NS_i = \HIDE{}([id_1, \ldots,\ id_k], NS_{i-1}$)
+then let $NS_i = \HIDE{}([\id_1, \ldots,\ \id_k], NS_{i-1}$)
where $hide(l, n)$ takes a list of identifiers $l$ and a namespace $n$, and produces a namespace that is identical to $n$ except that for each name $k$ in $l$, $k$ and $k=$ are undefined.
\end{itemize}
@@ -9178,12 +9366,12 @@
Let $NS_0$ be the exported namespace of $B$.
Then, for each combinator clause $C_i, i \in 1 .. n$ in $E$:
\begin{itemize}
-\item If $C_i$ is of the form \code{\SHOW{} $id_1, \ldots,\ id_k$} then let
+\item If $C_i$ is of the form \code{\SHOW{} $\id_1, \ldots,\ \id_k$} then let
-$NS_i = \SHOW{}([id_1, \ldots,\ id_k], NS_{i-1}$).
-\item If $C_i$ is of the form \code{\HIDE{} $id_1, \ldots,\ id_k$}
+$NS_i = \SHOW{}([\id_1, \ldots,\ \id_k], NS_{i-1}$).
+\item If $C_i$ is of the form \code{\HIDE{} $\id_1, \ldots,\ \id_k$}
-then let $NS_i = \HIDE{}([id_1, \ldots,\ id_k], NS_{i-1}$).
+then let $NS_i = \HIDE{}([\id_1, \ldots,\ \id_k], NS_{i-1}$).
\end{itemize}
\LMHash{}
diff --git a/docs/language/informal/generic-function-instantiation.md b/docs/language/informal/generic-function-instantiation.md
new file mode 100644
index 0000000..d9ee68b
--- /dev/null
+++ b/docs/language/informal/generic-function-instantiation.md
@@ -0,0 +1,387 @@
+# Generic Function Instantiation
+
+Author: eernst@.
+
+Version: 0.3 (2018-04-05)
+
+Status: Under discussion.
+
+**This document** is a Dart 2 feature specification of _generic function
+instantiation_, which is the feature that implicitly coerces a reference to
+a generic function into a non-generic function obtained from said generic
+function by passing inferred type arguments.
+
+Intuitively, this is the feature that provides inference for function
+values, corresponding to the more well-known inference that we may get for
+each invocation of a generic function:
+
+```dart
+List<T> f<T>(T t) => [t];
+
+void g(Iterable<int> f(int i)) => print(f(42));
+
+main() {
+ // Invocation inference.
+ print(f(42)); // Inferred as `f<int>(42)`.
+
+ // Function value inference.
+ g(f); // Inferred approximately as `g((int n) => f<int>(n))`.
+}
+```
+
+This document draws on many of the comments on the SDK issue
+[#31665](https://github.com/dart-lang/sdk/issues/31665).
+
+
+## Motivation
+
+The
+[language specification](https://github.com/dart-lang/sdk/blob/master/docs/language/dartLangSpec.tex)
+uses the phrase _function object_ to denote the first-class semantic
+entity which corresponds to a function declaration. In the following
+example, each of the expressions `fg`, `A.fs`, `new A().fi`, and `fl` in
+`main` evaluate to a function object, and so does the function literal at
+the end of the list:
+
+```dart
+int fg(int i) => i;
+
+class A {
+ static int fs(int i) => i;
+ int fi(int i) => i;
+}
+
+main() {
+ int fl(int i) => i;
+ var functions =
+ [fg, A.fs, new A().fi, fl, (int i) => i];
+}
+```
+
+Once a function object has been obtained, it can be passed around by
+assigning it to a variable, passing it as an actual argument, etc. Hence,
+it is the notion of a function object that makes functions first-class
+entities. The computational step that produces a function object from a
+denotation of a function declaration is known as _closurization_.
+
+The situation where closurization occurs is exactly the situation where the
+generic function instantiation feature specified in this document may kick
+in.
+
+First note that generic function declarations provide support for working
+with generic functions as first class values, i.e., generic functions
+support regular closurization, just like non-generic functions.
+
+The essence of generic function instantiation is to allow for "curried"
+invocations, in the sense that a generic function can receive its actual
+type arguments separately during closurization (it must then receive _all_
+its type arguments, not just some of them), and that yields a non-generic
+function whose type is obtained by substituting type variables in the
+generic type for the actual type arguments:
+
+```dart
+X fg<X extends num>(X x) => x;
+
+class A {
+ static X fs<X extends num>(X x) => x;
+ X fi<X extends num>(X x) => x;
+}
+
+main() {
+ X fl<X extends num>(X x) => x;
+ var genericFunctions =
+ <Function>[fg, A.fs, new A().fi, fl, <X>(X x) => x];
+ var instantiatedFunctions =
+ <int Function(int)>[fg, A.fs, new A().fi, fl];
+}
+```
+
+The functions stored in `instantiatedFunctions` are all of type
+`int Function(int)`, and they are obtained by passing the actual
+type argument `int` to the denoted generic function, thus obtaining
+a non-generic function of the specified type. Hence, the reason why
+`instantiatedFunctions` can be created as shown is that it relies on
+generic function instantiation, for each element in the list.
+
+Note that generic function instantiation is not supported with all kinds of
+generic functions; this is discussed in the discussion section.
+
+It may seem natural to allow explicit instantiations, e.g., `fg<int>` and
+`new A().fi<int>` (where type arguments are passed explicitly, but there is
+no value argument list). This kind of construct would yield non-generic
+functions, just like the cases shown above where the type arguments are
+inferred. This is a language extension which is not included in this
+document. It may or may not be added to the language separately.
+
+
+## Syntax
+
+This feature does not affect the grammar.
+
+*If this feature is generalized to include explicit generic
+function instantiation, the grammar would need to be extended
+to allow a construct like `f<int>` as an expression.*
+
+
+## Static Analysis and Program Transformation
+
+We say that a reference of the form `identifier`,
+`identifier '.' identifier`, or
+`identifier '.' identifier '.' identifier`
+is a _statically resolved reference to a function_ if it denotes a
+declaration of a library function or a static function.
+
+*Such a reference is first-order in the sense that it is bound directly to
+the function declaration and there need not be a heap object which
+represents said function declaration in order to support invocations of the
+function. In that sense we may consider statically resolved references
+"extra simple", compared to general references to functions. In particular,
+a statically resolved reference to a function will have a static type which
+is obtained directly from its declaration, it will never be a supertype
+thereof such as `Function` or `dynamic`.*
+
+When an expression _e_ whose static type is a generic function type _G_ is
+used in a context where the expected type is a non-generic function type
+_F_, it is a compile-time error except in the three situations specified
+below.
+
+*The point is that generic function instantiation will only take place in
+situations where we would have a compile-time error without that feature,
+and in those situations the compile-time error will still exist unless the
+situation matches one of those three exceptions.*
+
+**1st exception**: If _e_ is a statically resolved reference to a function,
+and type inference yields an actual type argument list
+_T<sub>1</sub> .. T<sub>k</sub>_ such that
+_G<T<sub>1</sub> .. T<sub>k</sub>>_ is assignable to _F_, then the program
+is modified such that _e_ is replaced by a reference to a non-generic
+function whose signature is obtained by substituting
+_T<sub>1</sub> .. T<sub>k</sub>_ for the formal type parameters in the
+function signature of the function denoted by _e_, and whose semantics for
+each invocation is the same as invoking _e_ with
+_T<sub>1</sub> .. T<sub>k</sub>_ as the actual type argument list.
+
+*Here is an example:*
+
+```dart
+List<T> foo<T>(T t) => [t];
+List<int> fooOfInt(int i) => [i];
+
+String bar(List<int> f(int)) => "${f(42)}";
+
+main() {
+ print(bar(foo));
+}
+```
+
+*In this example, `foo` as an actual argument to `bar` will be modified as
+if the call had been `bar(fooOfInt)`, except for equality—which is
+specified next.*
+
+Consider two distinct evaluations of a statically resolved reference to the
+same generic function, which are subject to the above-mentioned
+transformation with the same actual type argument list, and let `f1` and
+`f2` denote the two functions obtained after the transformation. It is then
+guaranteed that `f1 == f2` evaluates to true, but `identical(f1, f2)` can
+be false or true, depending on the implementation.
+
+**2nd exception**: Generic function instantiation is supported for instance
+methods as well as statically resolved functions: If
+
+- _e_ is a property extraction which denotes a closurization,
+- the static type of _e_ is a generic function type _G_,
+- _e_ occurs in a context where the expected type is a non-generic
+ function type _F_, and
+- type inference yields an actual type argument list
+ _T<sub>1</sub> .. T<sub>k</sub>_ such that
+ _G<T<sub>1</sub> .. T<sub>k</sub>>_ is assignable to _F_
+
+then the program is modified such that _e_ is replaced by a reference to a
+non-generic function whose signature is obtained by substituting
+_T<sub>1</sub> .. T<sub>k</sub>_ for
+the formal type parameters in the signature of the method denoted by
+_e_, and whose semantics for each invocation is the same as
+invoking that method on that receiver with
+_T<sub>1</sub> .. T<sub>k</sub>_ as the actual type argument list.
+
+*Note that the statically known declaration of the method which is
+closurized may not be the same one as the declaration of the method which
+is actually closurized at run time, but it is guaranteed that the actual
+signature will have a formal type parameter list with the same length,
+where each formal type parameter will have the same bound as the statically
+known one, and the value parameters will have types which are in a correct
+override relationship to the statically known ones. In other words, the
+function obtained by generic function instantiation on an instance method
+may accept a different number of parameters, with type annotations that are
+different than the statically known ones, but the corresponding function
+type will be a subtype of the statically known one, i.e., it can be called
+safely. (It is possible that the method which is actually closurized has
+one or more formal parameters which are covariant, and this may cause an
+otherwise statically safe invocation to fail at run-time, but this is
+exactly the same situation as we would have had with a direct invocation of
+the method.)*
+
+Consider two distinct evaluations of a property extraction for the same method
+of receivers `o1` and `o2`, which are subject to the above-mentioned
+transformation with the same actual type argument list, and let `f1` and
+`f2` denote the two functions obtained after the transformation. It is then
+guaranteed that `f1 == f2` evaluates to the same value as `identical(o1, o2)`,
+but `identical(f1, f2)` can be false or true, depending on the implementation.
+
+*Here is an example:*
+
+```dart
+class A {
+ List<T> foo<T>(T t) => [t];
+}
+
+String bar(List<int> f(int)) => "${f(42)}";
+
+main() {
+ print(bar(new A().foo));
+}
+```
+
+*In this example, `new A().foo` as an actual argument to `bar` will be
+modified as if the call had been `bar((int i) => o.foo<int>(i))` where `o`
+is a fresh variable bound to the result of evaluating `new A()`, except for
+equality.*
+
+**3rd exception**: Generic function instantiation is supported also for
+local functions: If
+
+- _e_ is an `identifier` denoting a local function,
+- the static type of _e_ is a generic function type _G_,
+- _e_ occurs in a context where the expected type is a non-generic
+ function type _F_, and
+- type inference yields an actual type argument list
+ _T<sub>1</sub> .. T<sub>k</sub>_ such that
+ _G<T<sub>1</sub> .. T<sub>k</sub>>_ is assignable to _F_
+
+then the program is modified such that _e_ is replaced by a reference to a
+non-generic function whose signature is obtained by substituting
+_T<sub>1</sub> .. T<sub>k</sub>_ for
+the formal type parameters in the signature of the function denoted by _e_,
+and whose semantics for each invocation is the same as invoking that
+function on that receiver with _T<sub>1</sub> .. T<sub>k</sub>_ as the
+actual type argument list.
+
+*No special guarantees are provided regarding the equality and identity
+properties of the non-generic functions obtained from a local function.*
+
+If _e_ is an expression which is subject to generic function instantiation
+as specified above, and the function denoted by _e_ is a top-level function
+or a static method that is not qualified by a deferred prefix, and the
+inferred type arguments are all compile-time constant type expressions
+(*cf. [this CL](https://dart-review.googlesource.com/c/sdk/+/36220)*), then
+_e_ is a constant expression. Other than that, an expression subject to
+generic function instantiation is not constant.
+
+
+## Dynamic Semantics
+
+The dynamic semantics of this feature follows directly from the fact that
+the section on static analysis specifies which expressions are subject to
+generic function instantiation, and how to obtain the non-generic function
+which is the value of such an expression.
+
+There is one exception: It is possible for inference to provide a type
+argument which is not statically guaranteed to satisfy the declared upper
+bound. In that case, a dynamic error occurs when the generic function
+instantiation takes place.
+
+*Here is an example to illustrate how this may occur:*
+
+```dart
+class C<X> {
+ X x;
+ void foo<Y extends X>(Y y) => x = y;
+}
+
+C<num> complexComputation() => new C<int>();
+
+main() {
+ C<num> c = complexComputation();
+ void Function(num) f = c.foo; // Inferred type argument: `num`.
+}
+```
+
+*In this situation, the inferred type argument `num` is not guaranteed to
+satisfy the declared upper bound of `Y`, because the actual type argument
+of `c`, let us call it `T`, is only known to be some subtype of `num`.
+There is no way to denote the type `T` or any other type (except `Null`)
+which is guaranteed to be a subtype of `T`. Hence, the chosen type argument
+may turn out to violate the bound at run time, and that violation must be
+detected when the tear-off takes place, rather than letting the tear-off
+succeed and incurring a dynamic error at each invocation of the resulting
+function object.*
+
+
+## Discussion
+
+There is no support for generic function instantiation with function
+literals. That is hardly a serious omission, however, because a function
+literal is only referred from one single location (the place where it
+occurs), and hence there is never a need to use such a function both as a
+generic and as a non-generic function, so it is extremely likely to be
+simpler and more convenient to write the function literal as a non-generic
+function in the first place, if that is how it will be used.
+
+```dart
+class A<X> {
+ X x;
+
+ A(this.x);
+
+ void f(List<X> Function(X) g) => print(g(x));
+
+ void bar() {
+ // Error: Needs generic function instantiation,
+ // which would implicitly pass `<X>`.
+ f(<Y>(Y y) => [y]);
+
+ // Work-around: Just use a non-generic function---it can get
+ // the required different types for different values of `X` by
+ // using `X` directly.
+ f((X x) => [x]);
+ }
+}
+
+main() {
+ new A<int>(42).bar();
+}
+```
+
+Finally, there is no support for generic function instantiation with first
+class functions (e.g., the value of a variable or an actual argument). This
+choice was made in order to avoid the complexity and performance
+implications of having such a feature. Note that, apart from the `==`
+property, it is always possible to write a function literal in order to
+pass actual type arguments explicitly, thus getting the same effect:
+
+```dart
+List<T> foo<T>(T t) => [t];
+
+void g(List<int> Function(int) h) => print(h(42)[0].isEven);
+
+void bar(List<T> Function<T>(T) f) {
+ g(f); // Error: Generic function instantiation not supported here.
+ // Work-around.
+ g((int i) => f(i));
+}
+
+main() {
+ bar(foo); // No generic function instantiation needed here.
+}
+```
+
+
+## Revisions
+
+- 0.3 (2018-04-05) Clarified constancy of expressions subject to generic
+ function instantiation.
+
+- 0.2 (2018-03-21) Adjusted to include support for generic function
+ instantiation also for local functions.
+
+- 0.1 (2018-03-19) Initial version.
diff --git a/pkg/analysis_server/benchmark/benchmarks.dart b/pkg/analysis_server/benchmark/benchmarks.dart
index d1c7d6d..3bcfb11 100644
--- a/pkg/analysis_server/benchmark/benchmarks.dart
+++ b/pkg/analysis_server/benchmark/benchmarks.dart
@@ -216,8 +216,10 @@
CompoundBenchMarkResult o = other as CompoundBenchMarkResult;
CompoundBenchMarkResult combined = new CompoundBenchMarkResult(name);
- List<String> keys =
- (new Set()..addAll(results.keys)..addAll(o.results.keys)).toList();
+ List<String> keys = (new Set<String>()
+ ..addAll(results.keys)
+ ..addAll(o.results.keys))
+ .toList();
for (String key in keys) {
combined.add(key, _combine(results[key], o.results[key]));
diff --git a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
index 13e4b5f..65d00d4 100644
--- a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
+++ b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
@@ -987,7 +987,8 @@
/**
* Handle the fact that an unhandled error has occurred in the plugin.
*/
- void handleOnError(List<String> errorPair) {
+ void handleOnError(dynamic error) {
+ List<String> errorPair = (error as List).cast<String>();
StackTrace stackTrace = new StackTrace.fromString(errorPair[1]);
info.exception =
new CaughtException(new PluginException(errorPair[0]), stackTrace);
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
index a2ceffb..8079bf0 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
@@ -232,9 +232,23 @@
if (entity is ConstructorInitializer) {
_addSuggestion(Keyword.ASSERT);
}
- if (node.initializers.last == entity) {
- _addSuggestion(Keyword.SUPER);
- _addSuggestion(Keyword.THIS);
+ var last = node.initializers.last;
+ if (last == entity) {
+ Token previous = node.findPrevious(last.beginToken);
+ if (previous != null && previous.end <= request.offset) {
+ _addSuggestion(Keyword.SUPER);
+ _addSuggestion(Keyword.THIS);
+ }
+ }
+ } else {
+ Token separator = node.separator;
+ if (separator != null) {
+ var offset = request.offset;
+ if (separator.end <= offset && offset <= separator.next.offset) {
+ _addSuggestion(Keyword.ASSERT);
+ _addSuggestion(Keyword.SUPER);
+ _addSuggestion(Keyword.THIS);
+ }
}
}
}
@@ -363,9 +377,18 @@
@override
visitIfStatement(IfStatement node) {
if (_isPreviousTokenSynthetic(entity, TokenType.CLOSE_PAREN)) {
+ // analyzer parser
// Actual: if (x i^)
// Parsed: if (x) i^
_addSuggestion(Keyword.IS, DART_RELEVANCE_HIGH);
+ } else if (entity == node.rightParenthesis) {
+ if (node.condition.endToken.next == droppedToken) {
+ // fasta parser
+ // Actual: if (x i^)
+ // Parsed: if (x)
+ // where "i" is in the token stream but not part of the AST
+ _addSuggestion(Keyword.IS, DART_RELEVANCE_HIGH);
+ }
} else if (entity == node.thenStatement || entity == node.elseStatement) {
_addStatementKeywords(node);
} else if (entity == node.condition) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
index d435a04..f7289e4 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
@@ -151,24 +151,33 @@
if (node is ClassDeclaration) {
Object entity = target.entity;
if (entity is FieldDeclaration) {
- NodeList<VariableDeclaration> variables = entity.fields.variables;
- if (variables.length == 1) {
- SimpleIdentifier targetId = variables[0].name;
- if (targetId.name.isEmpty) {
- return targetId;
- }
- }
+ return _getTargetIdFromVarList(entity.fields);
}
} else if (node is FieldDeclaration) {
Object entity = target.entity;
if (entity is VariableDeclarationList) {
- NodeList<VariableDeclaration> variables = entity.variables;
- if (variables.length == 1) {
- SimpleIdentifier targetId = variables[0].name;
- if (targetId.name.isEmpty) {
- return targetId;
- }
- }
+ return _getTargetIdFromVarList(entity);
+ }
+ }
+ return null;
+ }
+
+ SimpleIdentifier _getTargetIdFromVarList(VariableDeclarationList fields) {
+ NodeList<VariableDeclaration> variables = fields.variables;
+ if (variables.length == 1) {
+ VariableDeclaration variable = variables[0];
+ SimpleIdentifier targetId = variable.name;
+ if (targetId.name.isEmpty) {
+ // analyzer parser
+ // Actual: class C { foo^ }
+ // Parsed: class C { foo^ _s_ }
+ // where _s_ is a synthetic id inserted by the analyzer parser
+ return targetId;
+ } else if (fields.keyword == null &&
+ fields.type == null &&
+ variable.initializer == null) {
+ // fasta parser does not insert a synthetic identifier
+ return targetId;
}
}
return null;
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 7a97f72..c5c99cb 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -1206,8 +1206,8 @@
String filePath;
if (prefixElement == null) {
targetUnit = unitElement;
- CompilationUnitMember enclosingMember =
- node.getAncestor((node) => node.parent is CompilationUnit);
+ CompilationUnitMember enclosingMember = node.getAncestor((node) =>
+ node is CompilationUnitMember && node.parent is CompilationUnit);
if (enclosingMember == null) {
return;
}
@@ -1909,8 +1909,7 @@
ClassDeclaration targetClass = node.parent as ClassDeclaration;
ClassElement targetClassElement = targetClass.element;
utils.targetClassElement = targetClassElement;
- List<ExecutableElement> elements = ErrorVerifier
- .computeMissingOverrides(
+ List<ExecutableElement> elements = ErrorVerifier.computeMissingOverrides(
driver.analysisOptions.strongMode,
typeProvider,
typeSystem,
diff --git a/pkg/analysis_server/lib/src/services/refactoring/move_file.dart b/pkg/analysis_server/lib/src/services/refactoring/move_file.dart
index 58adda3..7b871e0 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/move_file.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/move_file.dart
@@ -11,6 +11,7 @@
import 'package:analysis_server/src/services/refactoring/refactoring_internal.dart';
import 'package:analysis_server/src/services/search/search_engine.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
@@ -25,6 +26,7 @@
final pathos.Context pathContext;
final RefactoringWorkspace workspace;
final Source source;
+ AnalysisDriver driver;
String oldFile;
String newFile;
@@ -42,39 +44,33 @@
String get refactoringName => 'Move File';
@override
- Future<RefactoringStatus> checkFinalConditions() {
- RefactoringStatus result = new RefactoringStatus();
- return new Future.value(result);
+ Future<RefactoringStatus> checkFinalConditions() async {
+ final drivers = workspace.driversContaining(newFile);
+ if (drivers.length != 1) {
+ return new RefactoringStatus.fatal(
+ 'Unable to find a single driver for $newFile.');
+ }
+ driver = drivers.first;
+ return new RefactoringStatus();
}
@override
- Future<RefactoringStatus> checkInitialConditions() {
- RefactoringStatus result = new RefactoringStatus();
- return new Future.value(result);
+ Future<RefactoringStatus> checkInitialConditions() async {
+ return new RefactoringStatus();
}
@override
Future<SourceChange> createChange() async {
- var changeBuilder =
- new DartChangeBuilder(workspace.drivers.first.currentSession);
-
- final drivers =
- workspace.drivers.where((d) => d.contextRoot.containsFile(newFile));
- if (drivers.length != 1) {
- // TODO(dantup): What to do in this case? Should we throw?
- return changeBuilder.sourceChange;
- }
-
- final driver = drivers.first; // The above guarantees there's exactly one.
- final result = await driver.getResult(oldFile);
- final element = result?.unit?.element;
+ var changeBuilder = new DartChangeBuilder(driver.currentSession);
+ final result = await driver.getUnitElement(oldFile);
+ final element = result?.element;
if (element == null) {
return changeBuilder.sourceChange;
}
final library = element.library;
// If this element is a library, update outgoing references inside the file.
- if (library != null && element == library.definingCompilationUnit) {
+ if (element == library.definingCompilationUnit) {
await changeBuilder.addFileEdit(library.source.fullName, (builder) {
final oldDir = pathContext.dirname(oldFile);
final newDir = pathContext.dirname(newFile);
@@ -86,7 +82,7 @@
// Update incoming references to this file
List<SearchMatch> matches =
- await workspace.searchEngine.searchReferences(result.unit.element);
+ await workspace.searchEngine.searchReferences(element);
List<SourceReference> references = getSourceReferences(matches);
for (SourceReference reference in references) {
await changeBuilder.addFileEdit(reference.file, (builder) {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
index 6b5c4904..5c14cf7 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
@@ -427,6 +427,15 @@
return driver.contextRoot.containsFile(path);
});
}
+
+ /**
+ * Returns the drivers that have [path] in a context root.
+ */
+ Iterable<AnalysisDriver> driversContaining(String path) {
+ return drivers.where((driver) {
+ return driver.contextRoot.containsFile(path);
+ });
+ }
}
/**
diff --git a/pkg/analysis_server/lib/src/status/diagnostics.dart b/pkg/analysis_server/lib/src/status/diagnostics.dart
index a21b681..d5e2bbd 100644
--- a/pkg/analysis_server/lib/src/status/diagnostics.dart
+++ b/pkg/analysis_server/lib/src/status/diagnostics.dart
@@ -384,6 +384,11 @@
String describe(AnalysisOptionsImpl options) {
StringBuffer b = new StringBuffer();
+ b.write(writeOption('Strong mode', options.strongMode));
+ b.write(writeOption('Implicit dynamic', options.implicitDynamic));
+ b.write(writeOption('Implicit casts', options.implicitCasts));
+ b.write(writeOption('Declaration casts', options.declarationCasts));
+
b.write(
writeOption('Analyze function bodies', options.analyzeFunctionBodies));
b.write(writeOption('Enable super mixins', options.enableSuperMixins));
@@ -394,7 +399,6 @@
writeOption('Generate errors in SDK files', options.generateSdkErrors));
b.write(writeOption('Generate hints', options.hint));
b.write(writeOption('Preserve comments', options.preserveComments));
- b.write(writeOption('Strong mode', options.strongMode));
b.write(writeOption('Strong mode hints', options.strongModeHints));
return b.toString();
@@ -1312,6 +1316,8 @@
h3('Status');
buf.writeln(writeOption('Preview-dart-2',
diagnosticsSite.socketServer.analysisServerOptions.previewDart2));
+ buf.writeln(writeOption('Use fasta parser',
+ diagnosticsSite.socketServer.analysisServerOptions.useFastaParser));
buf.writeln(writeOption('Use common front end',
diagnosticsSite.socketServer.analysisServerOptions.useCFE));
buf.writeln(writeOption('Instrumentation enabled',
diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml
index 43c8630..5d4eae1 100644
--- a/pkg/analysis_server/pubspec.yaml
+++ b/pkg/analysis_server/pubspec.yaml
@@ -1,10 +1,6 @@
name: analysis_server
-version: 0.1.1-dev
-author: Dart Team <misc@dartlang.org>
+publish_to: none
description: A server that performs analysis of Dart code over character streams using JSON-RPC encoded information.
-homepage: http://www.dartlang.org
-environment:
- sdk: '>=1.12.0 <2.0.0'
dependencies:
analyzer: ^0.30.0
args: '>=0.13.0 <2.0.0'
diff --git a/pkg/analysis_server/test/integration/analysis/package_root_test.dart b/pkg/analysis_server/test/integration/analysis/package_root_test.dart
index f764bfc..3a84651 100644
--- a/pkg/analysis_server/test/integration/analysis/package_root_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/package_root_test.dart
@@ -21,6 +21,7 @@
@reflectiveTest
class SetAnalysisRootsTest extends AbstractAnalysisServerIntegrationTest {
+ @TestTimeout(const Timeout.factor(2))
test_package_root() async {
String projPath = sourcePath('project');
String mainPath = path.join(projPath, 'main.dart');
diff --git a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
index d4757ed..2448c48 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
@@ -906,7 +906,7 @@
@override
void listen(void onResponse(Response response),
void onNotification(Notification notification),
- {Function onError, void onDone()}) {
+ {void onError(dynamic error), void onDone()}) {
fail('Unexpected invocation of listen');
}
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index ac71287..56213b8 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -520,6 +520,11 @@
E accept<E>(AstVisitor<E> visitor);
/**
+ * Return the token before [target] or `null` if it cannot be found.
+ */
+ Token findPrevious(Token target);
+
+ /**
* Return the most immediate ancestor of this node for which the [predicate]
* returns `true`, or `null` if there is no such ancestor. Note that this node
* will never be returned.
@@ -533,11 +538,6 @@
E getProperty<E>(String name);
/**
- * Return the token before [target] or `null` if it cannot be found.
- */
- Token findPrevious(Token target);
-
- /**
* Set the value of the property with the given [name] to the given [value].
* If the value is `null`, the property will effectively be removed.
*/
@@ -4469,9 +4469,9 @@
* information, or `null` if the AST structure has not been resolved, or if
* the invoke could not be resolved.
*
- * This will usually be a [FunctionType], but it can also be an
- * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
- * interface type that implements `Function`.
+ * This will usually be a [FunctionType], but it can also be `dynamic` or
+ * `Function`. In the case of interface types that have a `call` method, we
+ * store the type of that `call` method here as parameterized.
*/
DartType get staticInvokeType;
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 68083db..c93b47de 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -82,6 +82,9 @@
CompileTimeErrorCode.CONFLICTING_GENERIC_INTERFACES,
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS,
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER,
+ CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR,
+ CompileTimeErrorCode.CONFLICTS_WITH_INHERITED_MEMBER,
+ CompileTimeErrorCode.CONFLICTS_WITH_MEMBER,
CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION,
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD,
@@ -108,6 +111,7 @@
CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR,
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT,
+ CompileTimeErrorCode.DECLARED_MEMBER_CONFLICTS_WITH_INHERITED,
CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER,
CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS,
CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR,
@@ -172,6 +176,7 @@
CompileTimeErrorCode.INVALID_USE_OF_COVARIANT,
CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE,
CompileTimeErrorCode.LABEL_UNDEFINED,
+ CompileTimeErrorCode.LOAD_LIBRARY_TAKES_NO_ARGUMENTS,
CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME,
CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME,
CompileTimeErrorCode.MISSING_CONST_IN_LIST_LITERAL,
@@ -207,7 +212,9 @@
CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT,
CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
CompileTimeErrorCode.NON_SYNC_ABSTRACT_METHOD,
- CompileTimeErrorCode.NON_SYNC_FACTORY_METHOD,
+ CompileTimeErrorCode.NON_SYNC_CONSTRUCTOR,
+ CompileTimeErrorCode.NON_SYNC_FACTORY,
+ CompileTimeErrorCode.NOT_CONSTANT_EXPRESSION,
CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS,
CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS,
CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT,
@@ -237,8 +244,10 @@
CompileTimeErrorCode.RETURN_IN_GENERATOR,
CompileTimeErrorCode.SHARED_DEFERRED_PREFIX,
CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT,
+ CompileTimeErrorCode.SUPER_AS_EXPRESSION,
CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT,
CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR,
+ CompileTimeErrorCode.THIS_ACCESS_FROM_INITIALIZER,
CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
CompileTimeErrorCode.TYPE_PARAMETER_ON_CONSTRUCTOR,
diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart
index 535e3a6..716008f 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -169,7 +169,8 @@
negatable: true);
parser.addFlag(declarationCastsFlag,
negatable: true,
- help: 'Disable declaration casts in strong mode (https://goo.gl/cTLz40).',
+ help: 'Disable declaration casts in strong mode (https://goo.gl/cTLz40)\n'
+ 'This option is deprecated and will be removed in a future release.',
hide: ddc && hide);
parser.addFlag(implicitCastsFlag,
negatable: true,
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_builder.dart b/pkg/analyzer/lib/src/dart/analysis/context_builder.dart
index bf4d9ba..3ede35d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/context_builder.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/context_builder.dart
@@ -83,6 +83,12 @@
contextRoot.root.path, contextRoot.excludedPaths.toList(),
pathContext: resourceProvider.pathContext);
AnalysisDriver driver = builder.buildDriver(oldContextRoot);
+
+ // AnalysisDriver reports results into streams.
+ // We need to drain these streams to avoid memory leak.
+ driver.results.drain();
+ driver.exceptions.drain();
+
DriverBasedAnalysisContext context =
new DriverBasedAnalysisContext(resourceProvider, contextRoot, driver);
return context;
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index 530e205..39ce165 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -766,15 +766,16 @@
FileSystemStateTestView _testView;
FileSystemState(
- this._logger,
- this._byteStore,
- this._contentOverlay,
- this._resourceProvider,
- this._sourceFactory,
- this._analysisOptions,
- this._salt,
- {this.externalSummaries,
- this.parseExceptionHandler}) {
+ this._logger,
+ this._byteStore,
+ this._contentOverlay,
+ this._resourceProvider,
+ this._sourceFactory,
+ this._analysisOptions,
+ this._salt, {
+ this.externalSummaries,
+ this.parseExceptionHandler,
+ }) {
_fileContentCache =
_FileContentCache.getInstance(_resourceProvider, _contentOverlay);
_testView = new FileSystemStateTestView(this);
@@ -815,9 +816,9 @@
return file;
}
// Create a new file.
- Uri fileUri = _resourceProvider.pathContext.toUri(path);
FileSource uriSource = new FileSource(resource, uri);
- file = new FileState._(this, path, uri, fileUri, uriSource);
+ file = new FileState._(
+ this, path, uri, _absolutePathToFileUri(path), uriSource);
_uriToFile[uri] = file;
_addFileWithPath(path, file);
_pathToCanonicalFile[path] = file;
@@ -856,9 +857,9 @@
String path = uriSource.fullName;
File resource = _resourceProvider.getFile(path);
- Uri fileUri = _resourceProvider.pathContext.toUri(path);
FileSource source = new FileSource(resource, uri);
- file = new FileState._(this, path, uri, fileUri, source);
+ file = new FileState._(
+ this, path, uri, _absolutePathToFileUri(path), source);
_uriToFile[uri] = file;
_addFileWithPath(path, file);
file.refresh(allowCached: true);
@@ -933,6 +934,18 @@
}
files.add(file);
}
+
+ /**
+ * A specialized version of package:path context.toUri(). This assumes the
+ * path is absolute as does a performant conversion to a file: uri.
+ */
+ Uri _absolutePathToFileUri(String path) {
+ if (path.contains(r'\')) {
+ return new Uri(scheme: 'file', path: path.replaceAll(r'\', '/'));
+ } else {
+ return new Uri(scheme: 'file', path: path);
+ }
+ }
}
@visibleForTesting
diff --git a/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart b/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart
index cdf82ad..179242f 100644
--- a/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart
@@ -42,6 +42,9 @@
/// Resolution information in a single function body.
class CollectedResolution {
final Map<int, ResolutionData<DartType, int, Node, int>> kernelData = {};
+
+ final Map<TypeParameter, int> typeVariableDeclarations =
+ new Map<TypeParameter, int>.identity();
}
/// The compilation result for a single file.
@@ -74,7 +77,7 @@
'A compile() invocation is still executing.';
/// Options used by the kernel compiler.
- final ProcessedOptions _options;
+ final CompilerOptions _compilerOptions;
/// The logger to report compilation progress.
final PerformanceLog _logger;
@@ -92,10 +95,17 @@
/// Each value is the compilation result of the key library.
final Map<Uri, LibraryCompilationResult> _results = {};
+ /// Index of metadata in [_component].
+ final AnalyzerMetadataIndex _metadataIndex = new AnalyzerMetadataIndex();
+
/// The [Component] with currently valid libraries. When a file is invalidated,
/// we remove the file, its library, and everything affected from [_component].
Component _component = new Component();
+ /// The [DillTarget] that is filled with [_component] libraries before
+ /// compilation of a new library.
+ DillTarget _dillTarget;
+
/// Each key is the file system URI of a library.
/// Each value is the libraries that directly depend on the key library.
final Map<Uri, Set<Uri>> _directLibraryDependencies = {};
@@ -161,7 +171,7 @@
var uriTranslator = new UriTranslatorImpl(
new TargetLibrariesSpecification('none', dartLibraries), packages);
var errorListener = new _ErrorListener();
- var options = new CompilerOptions()
+ var compilerOptions = new CompilerOptions()
..target = new _AnalyzerTarget(
new TargetFlags(strongMode: analysisOptions.strongMode))
..reportMessages = false
@@ -169,15 +179,15 @@
..fileSystem = new _FileSystemAdaptor(fsState, pathContext)
..byteStore = byteStore
..onError = errorListener.onError;
- var processedOptions = new ProcessedOptions(options);
return new FrontEndCompiler._(
- processedOptions, uriTranslator, errorListener);
+ compilerOptions, uriTranslator, errorListener);
}
- FrontEndCompiler._(this._options, this.uriTranslator, this._errorListener)
- : _logger = _options.logger,
- _fileSystem = _options.fileSystem;
+ FrontEndCompiler._(
+ this._compilerOptions, this.uriTranslator, this._errorListener)
+ : _logger = _compilerOptions.logger,
+ _fileSystem = _compilerOptions.fileSystem;
/// Compile the library with the given absolute [uri], and everything it
/// depends on. Return the result of the requested library compilation.
@@ -200,23 +210,26 @@
}
}
- return _runWithFrontEndContext('Compile', () async {
- // TODO(brianwilkerson) Determine whether this await is necessary.
- await null;
+ return _runWithFrontEndContext('Compile', uri, (processedOptions) async {
try {
- var dillTarget =
- new DillTarget(_options.ticker, uriTranslator, _options.target);
+ // Initialize the dill target once.
+ if (_dillTarget == null) {
+ _dillTarget = new DillTarget(
+ processedOptions.ticker,
+ uriTranslator,
+ processedOptions.target,
+ );
+ }
- // Append all libraries what we still have in the current component.
+ // Append new libraries from the current component.
await _logger.runAsync('Load dill libraries', () async {
- // TODO(brianwilkerson) Determine whether this await is necessary.
- await null;
- dillTarget.loader.appendLibraries(_component);
- await dillTarget.buildOutlines();
+ _dillTarget.loader.appendLibraries(_component,
+ filter: (uri) => !_dillTarget.loader.builders.containsKey(uri));
+ await _dillTarget.buildOutlines();
});
// Create the target to compile the library.
- var kernelTarget = new _AnalyzerKernelTarget(_fileSystem, dillTarget,
+ var kernelTarget = new _AnalyzerKernelTarget(_fileSystem, _dillTarget,
uriTranslator, new AnalyzerMetadataCollector());
kernelTarget.read(uri);
@@ -225,7 +238,7 @@
await kernelTarget.buildOutlines(nameRoot: _component.root);
Component newComponent = await kernelTarget.buildComponent();
if (newComponent != null) {
- AnalyzerMetadataRepository.merge(newComponent, _component);
+ _metadataIndex.replaceComponent(newComponent);
return newComponent;
} else {
return _component;
@@ -237,9 +250,9 @@
_logger.run('Compute dependencies', _computeDependencies);
- // TODO(scheglov) Can we keep the same instance?
+ // Reuse CoreTypes and ClassHierarchy.
var types = new TypeEnvironment(
- new CoreTypes(_component), new ClassHierarchy(_component));
+ kernelTarget.loader.coreTypes, kernelTarget.loader.hierarchy);
// Add results for new libraries.
for (var library in _component.libraries) {
@@ -287,9 +300,13 @@
if (library == null) return;
// Invalidate the library.
+ _metadataIndex.invalidate(library);
_component.libraries.remove(library);
_component.root.removeChild('${library.importUri}');
_component.uriToSource.remove(libraryUri);
+ _dillTarget.loader.builders.remove(library.importUri);
+ _dillTarget.loader.libraries.remove(library);
+ _dillTarget.loader.uriToSource.remove(libraryUri);
_results.remove(library.importUri);
// Recursively invalidate dependencies.
@@ -333,12 +350,12 @@
_component.libraries.forEach(processLibrary);
}
- Future<T> _runWithFrontEndContext<T>(String msg, Future<T> f()) async {
- // TODO(brianwilkerson) Determine whether this await is necessary.
- await null;
- return await CompilerContext.runWithOptions(_options, (context) {
+ Future<T> _runWithFrontEndContext<T>(
+ String msg, Uri input, Future<T> Function(ProcessedOptions) f) async {
+ var processedOptions = new ProcessedOptions(_compilerOptions, [input]);
+ return await CompilerContext.runWithOptions(processedOptions, (context) {
context.disableColors();
- return _logger.runAsync(msg, f);
+ return _logger.runAsync(msg, () => f(processedOptions));
});
}
}
@@ -391,7 +408,8 @@
}
var resolution = new CollectedResolution();
fileResolutions.add(resolution);
- storer = new ResolutionStorer(resolution.kernelData);
+ storer = new ResolutionStorer(
+ resolution.kernelData, resolution.typeVariableDeclarations);
return super.createListener(
builder, memberScope, isInstanceMember, formalParameterScope, storer);
}
@@ -410,6 +428,11 @@
_AnalyzerSourceLoader<Library> createLoader() {
return new _AnalyzerSourceLoader<Library>(fileSystem, this, resolutions);
}
+
+ @override
+ Declaration getDuplicatedFieldInitializerError(loader) {
+ return loader.coreLibrary.getConstructor('Exception');
+ }
}
/// The [SourceLoader] that record resolution information.
diff --git a/pkg/analyzer/lib/src/dart/analysis/kernel_metadata.dart b/pkg/analyzer/lib/src/dart/analysis/kernel_metadata.dart
index 7312359..a5bc6ef 100644
--- a/pkg/analyzer/lib/src/dart/analysis/kernel_metadata.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/kernel_metadata.dart
@@ -66,6 +66,58 @@
}
}
+/// Index of metadata.
+class AnalyzerMetadataIndex {
+ final Map<kernel.Library, List<kernel.TreeNode>> libraryNodes = {};
+ AnalyzerMetadataRepository repository;
+
+ /// The [library] was invalidated, flush its metadata.
+ void invalidate(kernel.Library library) {
+ var nodes = libraryNodes.remove(library);
+ nodes?.forEach(repository.mapping.remove);
+ }
+
+ /// A [newComponent] has been compiled, with new, and only new, metadata.
+ /// Merge the existing [repository] into the new one, and replace it.
+ void replaceComponent(kernel.Component newComponent) {
+ AnalyzerMetadataRepository newRepository =
+ newComponent.metadata[AnalyzerMetadataRepository.TAG];
+ if (newRepository != null) {
+ _indexNewMetadata(newRepository);
+ if (repository != null) {
+ newRepository.mapping.addAll(repository.mapping);
+ }
+ repository = newRepository;
+ } else {
+ newComponent.metadata[AnalyzerMetadataRepository.TAG] = repository;
+ }
+ }
+
+ void _indexNewMetadata(AnalyzerMetadataRepository newRepository) {
+ for (var node in newRepository.mapping.keys) {
+ var library = _enclosingLibrary(node);
+ assert(library != null);
+
+ var nodes = libraryNodes[library];
+ if (nodes == null) {
+ nodes = <kernel.TreeNode>[];
+ libraryNodes[library] = nodes;
+ }
+
+ nodes.add(node);
+ }
+ }
+
+ static kernel.Library _enclosingLibrary(kernel.TreeNode node) {
+ for (; node != null; node = node.parent) {
+ if (node is kernel.Library) {
+ return node;
+ }
+ }
+ return null;
+ }
+}
+
/// Analyzer specific implementation of [kernel.MetadataRepository].
class AnalyzerMetadataRepository
implements kernel.MetadataRepository<AnalyzerMetadata> {
@@ -127,17 +179,4 @@
sink.writeByte(0);
}
}
-
- /// Merge metadata from the [source] into the [destination].
- static void merge(kernel.Component destination, kernel.Component source) {
- kernel.MetadataRepository destinationRepo = destination.metadata[TAG];
- kernel.MetadataRepository sourceRepo = source.metadata[TAG];
- if (sourceRepo != null) {
- if (destinationRepo != null) {
- destinationRepo.mapping.addAll(sourceRepo.mapping);
- } else {
- destination.metadata[TAG] = sourceRepo;
- }
- }
- }
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index d463793..5f21305c 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -774,7 +774,7 @@
var redirectedConstructor = context.redirectedConstructor;
redirectName.staticElement = redirectedConstructor;
// TODO(scheglov) Support for import prefix?
- ResolutionApplier.applyConstructorElement(
+ DeclarationResolver.applyConstructorElement(
_libraryElement,
null,
redirectedConstructor,
@@ -1089,11 +1089,16 @@
invokeType: translateType(data.invokeType),
isExplicitCall: data.isExplicitCall,
isImplicitCall: data.isImplicitCall,
+ isPrefixReference: data.isPrefixReference,
+ isTypeReference: data.isTypeReference,
isWriteReference: data.isWriteReference,
literalType: translateType(data.literalType),
+ loadLibrary: _translateReference(data.loadLibrary),
prefixInfo: _translatePrefixInfo(data.prefixInfo),
reference: _translateReference(data.reference,
- isWriteReference: data.isWriteReference),
+ isWriteReference: data.isWriteReference,
+ isTypeReference: data.isTypeReference,
+ inferredType: data.inferredType),
writeContext: translateType(data.writeContext));
}
@@ -1139,7 +1144,19 @@
}
return new TypeArgumentsDartType(types);
} else {
- return resynthesizer.getType(context, kernelType);
+ return resynthesizer.getType(context, kernelType,
+ getLocalTypeParameter: _getLocalTypeParameter);
+ }
+ }
+
+ TypeParameterElement _getLocalTypeParameter(
+ kernel.TypeParameter typeParameter) {
+ var declarationOffset = resolution.typeVariableDeclarations[typeParameter];
+ if (declarationOffset != null) {
+ TypeParameter typeParameter = localDeclarations[declarationOffset];
+ return typeParameter.element;
+ } else {
+ return null;
}
}
@@ -1155,6 +1172,8 @@
element = declaration.staticElement;
} else if (declaration is FunctionDeclaration) {
element = declaration.element;
+ } else if (declaration is TypeParameter) {
+ element = declaration.element;
} else {
throw new UnimplementedError('${declaration.runtimeType}');
}
@@ -1168,8 +1187,15 @@
}
Element _translateReference(kernel.Node referencedNode,
- {bool isWriteReference = false}) {
- if (referencedNode == null) return null;
+ {bool isWriteReference = false,
+ bool isTypeReference = false,
+ kernel.DartType inferredType}) {
+ if (referencedNode == null) {
+ if (isTypeReference && inferredType is kernel.DynamicType) {
+ return typeProvider.dynamicType.element;
+ }
+ return null;
+ }
Element element;
if (referencedNode is kernel.NamedNode) {
element = resynthesizer
@@ -1183,11 +1209,15 @@
.getElementFromCanonicalName(referencedNode.classNode.canonicalName);
assert(element != null);
} else if (referencedNode is kernel.TypeParameterType) {
- element =
- resynthesizer.getTypeParameter(context, referencedNode.parameter);
+ element = resynthesizer.getTypeParameter(
+ context, referencedNode.parameter,
+ getLocalTypeParameter: _getLocalTypeParameter);
assert(element != null);
} else if (referencedNode is kernel.DynamicType) {
element = DynamicElementImpl.instance;
+ } else if (referencedNode is kernel.TypeParameter) {
+ element = resynthesizer.getTypeParameter(context, referencedNode,
+ getLocalTypeParameter: _getLocalTypeParameter);
} else if (referencedNode is kernel.InvalidType) {
element = DynamicElementImpl.instance;
} else {
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index f643697..ae52a0e 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -6721,60 +6721,15 @@
* by a unary negation operator.
*/
static bool isValidLiteral(String lexeme, bool isNegative) {
- if (lexeme.startsWith('0x') || lexeme.startsWith('0X')) {
- return _isValidHexadecimalLiteral(lexeme, isNegative);
- }
- return _isValidDecimalLiteral(lexeme, isNegative);
- }
-
- /**
- * Return `true` if the given [lexeme] is a valid lexeme for a decimal integer
- * literal. The flag [isNegative] should be `true` if the lexeme is preceded
- * by a minus operator.
- */
- static bool _isValidDecimalLiteral(String lexeme, bool isNegative) {
- int length = lexeme.length;
- int index = 0;
- while (length > 0 && lexeme.substring(index, index + 1) == '0') {
- length--;
- index++;
- }
- if (length < 19) {
- return true;
- } else if (length > 19) {
- return false;
- }
- if (int.parse(lexeme.substring(index, index + 1)) < 9) {
- return true;
- }
- int bound = 223372036854775808;
- if (isNegative) {
- return int.parse(lexeme.substring(index + 1)) <= bound;
- } else {
- return int.parse(lexeme.substring(index + 1)) < bound;
- }
- }
-
- /**
- * Return `true` if the given [lexeme] is a valid lexeme for a hexadecimal
- * integer literal. The lexeme is expected to start with either `0x` or `0X`.
- */
- static bool _isValidHexadecimalLiteral(String lexeme, bool isNegative) {
- int length = lexeme.length - 2;
- int index = 2;
- while (length > 0 && lexeme.substring(index, index + 1) == '0') {
- length--;
- index++;
- }
- if (length < 16) {
- return true;
- } else if (length > 16) {
- return false;
- }
- if (!isNegative) {
- return true;
- }
- return int.parse(lexeme.substring(index, index + 1), radix: 16) <= 7;
+ // TODO(jmesserly): this depends on the platform int implementation, and
+ // may not be accurate if run on dart4web.
+ //
+ // (Prior to https://dart-review.googlesource.com/c/sdk/+/63023 there was
+ // a partial implementation here which may be a good starting point.
+ // _isValidDecimalLiteral relied on int.parse so that would need some fixes.
+ // _isValidHexadecimalLiteral worked except for negative int64 max.)
+ if (isNegative) lexeme = '-$lexeme';
+ return int.tryParse(lexeme) != null;
}
}
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index e4a1f8f..767e12d 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -900,7 +900,7 @@
if (_kernel != null) {
_methods ??= _kernel.procedures
.where((k) =>
- !k.isForwardingStub &&
+ !k.isSyntheticForwarder &&
(k.kind == kernel.ProcedureKind.Method ||
k.kind == kernel.ProcedureKind.Operator))
.map((k) => new MethodElementImpl.forKernel(this, k))
@@ -1716,6 +1716,7 @@
if (_kernelContext != null) {
_functions ??= _kernelContext.kernelUnit.procedures
.where((k) => k.kind == kernel.ProcedureKind.Method)
+ .where((k) => !k.name.name.startsWith('__loadLibrary_'))
.map((k) => new FunctionElementImpl.forKernel(this, k))
.toList(growable: false);
}
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index 8514e4f..bc6ebcc 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -1274,7 +1274,7 @@
}
@override
- ClassElement get element => super.element as ClassElement;
+ ClassElement get element => super.element;
@override
int get hashCode {
diff --git a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
index cb19d0f..024ff7b 100644
--- a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
@@ -240,8 +240,7 @@
InterfaceType definingType) {
// if the baseFunctionType is null, or does not have any parameters,
// return it.
- if (baseFunctionType == null ||
- baseFunctionType.typeArguments.length == 0) {
+ if (baseFunctionType == null || baseFunctionType.typeArguments.isEmpty) {
return baseFunctionType;
}
// First, generate the path from the defining type to the overridden member
@@ -691,7 +690,7 @@
}
}
}
- if (lookupMaps.length == 0) {
+ if (lookupMaps.isEmpty) {
return null;
}
return lookupMaps;
diff --git a/pkg/analyzer/lib/src/dart/scanner/scanner.dart b/pkg/analyzer/lib/src/dart/scanner/scanner.dart
index fcd9346..1dc4e0a 100644
--- a/pkg/analyzer/lib/src/dart/scanner/scanner.dart
+++ b/pkg/analyzer/lib/src/dart/scanner/scanner.dart
@@ -47,10 +47,8 @@
*/
factory Scanner(Source source, CharacterReader reader,
AnalysisErrorListener errorListener) =>
- fe.Scanner.useFasta
- ? new Scanner.fasta(source, errorListener,
- contents: reader.getContents(), offset: reader.offset)
- : new Scanner._(source, reader, errorListener);
+ new Scanner.fasta(source, errorListener,
+ contents: reader.getContents(), offset: reader.offset);
factory Scanner.fasta(Source source, AnalysisErrorListener errorListener,
{String contents, int offset: -1}) {
@@ -58,7 +56,8 @@
source, contents ?? source.contents.data, offset, errorListener);
}
- Scanner._(this.source, CharacterReader reader, this._errorListener)
+ // Deprecated
+ Scanner.old(this.source, CharacterReader reader, this._errorListener)
: super.create(reader);
@override
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 49a4b15..8f9692a 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -449,6 +449,15 @@
"this class.",
correction: "Try renaming either the type variable or the member.");
+ static const CompileTimeErrorCode CONFLICTS_WITH_CONSTRUCTOR =
+ const CompileTimeErrorCode.fromFasta('CONFLICTS_WITH_CONSTRUCTOR');
+
+ static const CompileTimeErrorCode CONFLICTS_WITH_INHERITED_MEMBER =
+ const CompileTimeErrorCode.fromFasta('CONFLICTS_WITH_INHERITED_MEMBER');
+
+ static const CompileTimeErrorCode CONFLICTS_WITH_MEMBER =
+ const CompileTimeErrorCode.fromFasta('CONFLICTS_WITH_MEMBER');
+
/**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
@@ -771,6 +780,10 @@
"The class '{0}' doesn't have a default constant constructor.",
correction: "Try calling a different contructor.");
+ static const CompileTimeErrorCode DECLARED_MEMBER_CONFLICTS_WITH_INHERITED =
+ const CompileTimeErrorCode.fromFasta(
+ 'DECLARED_MEMBER_CONFLICTS_WITH_INHERITED');
+
/**
* 15.3.1 Typedef: It is a compile-time error if any default values are
* specified in the signature of a function type alias.
@@ -1588,6 +1601,9 @@
correction: "Try defining the label, or "
"correcting the name to match an existing label.");
+ static const CompileTimeErrorCode LOAD_LIBRARY_TAKES_NO_ARGUMENTS =
+ const CompileTimeErrorCode.fromFasta('LOAD_LIBRARY_TAKES_NO_ARGUMENTS');
+
/**
* 7 Classes: It is a compile time error if a class <i>C</i> declares a member
* with the same name as <i>C</i>.
@@ -2038,8 +2054,11 @@
static const CompileTimeErrorCode NON_SYNC_ABSTRACT_METHOD =
const CompileTimeErrorCode.fromFasta('NON_SYNC_ABSTRACT_METHOD');
- static const CompileTimeErrorCode NON_SYNC_FACTORY_METHOD =
- const CompileTimeErrorCode.fromFasta('NON_SYNC_FACTORY_METHOD');
+ static const CompileTimeErrorCode NON_SYNC_CONSTRUCTOR =
+ const CompileTimeErrorCode.fromFasta('NON_SYNC_CONSTRUCTOR');
+
+ static const CompileTimeErrorCode NON_SYNC_FACTORY =
+ const CompileTimeErrorCode.fromFasta('NON_SYNC_FACTORY');
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i>
@@ -2071,6 +2090,9 @@
"Try calling a different constructor in the superclass, or "
"making the called constructor not be a factory constructor.");
+ static const CompileTimeErrorCode NOT_CONSTANT_EXPRESSION =
+ const CompileTimeErrorCode.fromFasta('NOT_CONSTANT_EXPRESSION');
+
/**
* 7.9 Superclasses: It is a compile-time error to specify an extends clause
* for class Object.
@@ -2360,6 +2382,9 @@
"directives.",
correction: "Try renaming one of the prefixes.");
+ static const CompileTimeErrorCode SUPER_AS_EXPRESSION =
+ const CompileTimeErrorCode.fromFasta('SUPER_AS_EXPRESSION');
+
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
* <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>:
@@ -2436,6 +2461,9 @@
correction: "Try removing the type parameters '<{0}>', or using"
" 'dynamic' as the type argument here instead of a function.");
+ static const CompileTimeErrorCode THIS_ACCESS_FROM_INITIALIZER =
+ const CompileTimeErrorCode.fromFasta('THIS_ACCESS_FROM_INITIALIZER');
+
/**
* 15.3.1 Typedef: Any self reference, either directly, or recursively via
* another typedef, is a compile time error.
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 6545302..d326fcd 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -1220,7 +1220,7 @@
}
@override
- void endFunctionTypedFormalParameter() {
+ void endFunctionTypedFormalParameter(Token nameToken) {
debugEvent("FunctionTypedFormalParameter");
FormalParameterList formalParameters = pop();
@@ -2172,7 +2172,9 @@
List<Annotation> metadata = pop();
Comment comment = _findComment(metadata, name.beginToken);
- push(ast.typeParameter(comment, metadata, name, null, null));
+ var typeParameter = ast.typeParameter(comment, metadata, name, null, null);
+ localDeclarations[name.offset] = typeParameter;
+ push(typeParameter);
}
@override
diff --git a/pkg/analyzer/lib/src/fasta/resolution_applier.dart b/pkg/analyzer/lib/src/fasta/resolution_applier.dart
index 6bd72ac..a3903958 100644
--- a/pkg/analyzer/lib/src/fasta/resolution_applier.dart
+++ b/pkg/analyzer/lib/src/fasta/resolution_applier.dart
@@ -11,7 +11,6 @@
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/fasta/resolution_storer.dart';
-import 'package:analyzer/src/generated/declaration_resolver.dart';
import 'package:front_end/src/base/syntactic_entity.dart';
import 'package:front_end/src/scanner/token.dart';
import 'package:kernel/kernel.dart' as kernel;
@@ -105,9 +104,8 @@
@override
void visitAsExpression(AsExpression node) {
node.expression.accept(this);
+ node.type.accept(this);
var data = _get(node.asOperator);
- applyToTypeAnnotation(
- _enclosingLibraryElement, data.literalType, node.type);
node.staticType = data.inferredType;
}
@@ -164,12 +162,7 @@
@override
void visitCatchClause(CatchClause node) {
- DartType guardType = _get(node.onKeyword ?? node.catchKeyword).literalType;
- if (node.exceptionType != null) {
- applyToTypeAnnotation(
- _enclosingLibraryElement, guardType, node.exceptionType);
- }
-
+ node.exceptionType?.accept(this);
SimpleIdentifier exception = node.exceptionParameter;
if (exception != null) {
LocalVariableElementImpl element = exception.staticElement;
@@ -229,16 +222,12 @@
void visitForEachStatement(ForEachStatement node) {
DeclaredIdentifier loopVariable = node.loopVariable;
if (loopVariable != null) {
+ loopVariable.type?.accept(this);
SimpleIdentifier identifier = loopVariable.identifier;
DartType type = _get(identifier).inferredType;
identifier.staticType = type;
- if (loopVariable.type != null) {
- applyToTypeAnnotation(
- _enclosingLibraryElement, type, loopVariable.type);
- }
-
VariableElementImpl element = identifier.staticElement;
if (element != null) {
_typeContext.encloseVariable(element);
@@ -256,14 +245,39 @@
void visitFormalParameterList(FormalParameterList parameterList) {
for (var parameter in parameterList.parameters) {
parameter.metadata?.accept(this);
+ NormalFormalParameter normalParameter;
if (parameter is DefaultFormalParameter) {
parameter.defaultValue?.accept(this);
+ normalParameter = parameter.parameter;
+ } else if (parameter is NormalFormalParameter) {
+ normalParameter = parameter;
+ } else {
+ // All parameters should either be DefaultFormalParameter or
+ // NormalFormalParameter.
+ throw new UnimplementedError('${parameter.runtimeType}');
+ }
+ if (normalParameter is SimpleFormalParameter) {
+ normalParameter.type?.accept(this);
+ } else if (normalParameter is FieldFormalParameter) {
+ normalParameter.type?.accept(this);
+ } else if (normalParameter is FunctionTypedFormalParameter) {
+ normalParameter.returnType?.accept(this);
+ normalParameter.typeParameters?.accept(this);
+ normalParameter.parameters?.accept(this);
+ var data = _get(normalParameter.identifier);
+ normalParameter.identifier.staticType = data.inferredType;
+ } else {
+ // Now that DefaultFormalParameter has been handled, all parameters
+ // should be SimpleFormalParameter, FieldFormalParameter, or
+ // FunctionTypedFormalParameter.
+ throw new UnimplementedError('${normalParameter.runtimeType}');
}
}
}
@override
void visitFunctionDeclaration(FunctionDeclaration node) {
+ node.returnType?.accept(this);
FunctionExpression functionExpression = node.functionExpression;
FormalParameterList parameterList = functionExpression.parameters;
@@ -292,11 +306,6 @@
typeParameter.name.staticType = _typeContext.typeType;
}
}
-
- applyToTypeAnnotation(
- _enclosingLibraryElement, element.returnType, node.returnType);
- applyParameters(
- _enclosingLibraryElement, element.parameters, parameterList);
}
_typeContext.exitLocalFunction(element);
@@ -319,8 +328,6 @@
if (element != null) {
node.element = element;
node.staticType = element.type;
- applyParameters(
- _enclosingLibraryElement, element.parameters, parameterList);
}
_typeContext.exitLocalFunction(element);
@@ -329,19 +336,12 @@
@override
void visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
node.function.accept(this);
+ node.typeArguments?.accept(this);
var data = _get(node.argumentList);
DartType invokeType = data.invokeType;
node.staticInvokeType = invokeType;
- List<DartType> typeArguments = data.argumentTypes;
- if (node.typeArguments != null && typeArguments != null) {
- _applyTypeArgumentsToList(
- _enclosingLibraryElement,
- new TypeArgumentsDartType(typeArguments),
- node.typeArguments.arguments);
- }
-
DartType resultType = data.inferredType;
node.staticType = resultType;
@@ -349,6 +349,13 @@
}
@override
+ void visitGenericFunctionType(GenericFunctionType node) {
+ super.visitGenericFunctionType(node);
+ var data = _get(node.functionKeyword);
+ (node as GenericFunctionTypeImpl).type = data.inferredType;
+ }
+
+ @override
void visitIndexExpression(IndexExpression node) {
node.target?.accept(this);
@@ -374,13 +381,14 @@
SimpleIdentifier classIdentifier;
SimpleIdentifier constructorIdentifier;
+ constructorName.type.typeArguments?.accept(this);
var data = _get(typeIdentifier);
TypeName newTypeName;
if (typeIdentifier is SimpleIdentifier) {
classIdentifier = typeIdentifier;
constructorIdentifier = constructorName.name;
} else if (typeIdentifier is PrefixedIdentifier) {
- if (data.prefixInfo != null) {
+ if (data.isPrefixReference) {
typeIdentifier.prefix.staticElement = data.prefixInfo;
classIdentifier = typeIdentifier.identifier;
@@ -405,12 +413,6 @@
ConstructorElement constructor = data.reference;
DartType type = data.inferredType;
- TypeArgumentList typeArguments = constructorName.type.typeArguments;
- if (typeArguments != null) {
- _applyTypeArgumentsToList(
- _enclosingLibraryElement, type, typeArguments.arguments);
- }
-
node.staticElement = constructor;
node.staticType = type;
@@ -429,9 +431,8 @@
@override
void visitIsExpression(IsExpression node) {
node.expression.accept(this);
+ node.type.accept(this);
var data = _get(node.isOperator);
- applyToTypeAnnotation(
- _enclosingLibraryElement, data.literalType, node.type);
node.staticType = data.inferredType;
}
@@ -446,35 +447,33 @@
@override
void visitListLiteral(ListLiteral node) {
+ node.typeArguments?.accept(this);
node.elements.accept(this);
DartType type = _get(node.constKeyword ?? node.leftBracket).inferredType;
node.staticType = type;
- if (node.typeArguments != null) {
- _applyTypeArgumentsToList(
- _enclosingLibraryElement, type, node.typeArguments.arguments);
- }
}
@override
void visitMapLiteral(MapLiteral node) {
+ node.typeArguments?.accept(this);
node.entries.accept(this);
DartType type = _get(node.constKeyword ?? node.leftBracket).inferredType;
node.staticType = type;
- if (node.typeArguments != null) {
- _applyTypeArgumentsToList(
- _enclosingLibraryElement, type, node.typeArguments.arguments);
- }
}
@override
void visitMethodInvocation(MethodInvocation node) {
node.target?.accept(this);
+ node.typeArguments?.accept(this);
ArgumentList argumentList = node.argumentList;
var data = _get(argumentList);
Element invokeElement;
- if (data.isImplicitCall) {
+ if (data.loadLibrary != null) {
+ LibraryElement libraryElement = data.loadLibrary;
+ invokeElement = libraryElement.loadLibraryFunction;
+ } else if (data.isImplicitCall) {
if (node.methodName != null) {
node.methodName.accept(this);
invokeElement = node.methodName.staticElement;
@@ -483,7 +482,6 @@
invokeElement = data.reference;
}
DartType invokeType = data.invokeType;
- List<DartType> typeArguments = data.argumentTypes;
DartType resultType = data.inferredType;
if (invokeElement is PropertyInducingElement) {
@@ -503,13 +501,6 @@
node.methodName.staticType = invokeType;
}
- if (node.typeArguments != null && typeArguments != null) {
- _applyTypeArgumentsToList(
- _enclosingLibraryElement,
- new TypeArgumentsDartType(typeArguments),
- node.typeArguments.arguments);
- }
-
_applyResolutionToArguments(argumentList);
{
@@ -604,6 +595,9 @@
node.staticElement = data.prefixInfo;
} else if (data.declaration != null) {
node.staticElement = data.declaration;
+ } else if (data.loadLibrary != null) {
+ LibraryElement library = data.loadLibrary;
+ node.staticElement = library.loadLibraryFunction;
} else if (data.reference != null) {
node.staticElement = data.reference;
} else {
@@ -653,6 +647,12 @@
}
@override
+ void visitTypeName(TypeName node) {
+ super.visitTypeName(node);
+ node.type = node.name.staticType;
+ }
+
+ @override
void visitVariableDeclaration(VariableDeclaration node) {
AstNode parent = node.parent;
if (parent is VariableDeclarationList &&
@@ -678,15 +678,9 @@
if (node.parent is TopLevelVariableDeclaration) {
node.variables.accept(this);
} else {
+ node.type?.accept(this);
node.metadata.accept(this);
node.variables.accept(this);
- if (node.type != null) {
- DartType type = node.variables[0].name.staticType;
- // TODO(brianwilkerson) Understand why the type is sometimes `null`.
- if (type != null) {
- applyToTypeAnnotation(_enclosingLibraryElement, type, node.type);
- }
- }
}
}
@@ -695,6 +689,7 @@
for (var argument in argumentList.arguments) {
if (argument is NamedExpression) {
argument.expression.accept(this);
+ argument.staticType = argument.expression.staticType;
} else {
argument.accept(this);
}
@@ -784,192 +779,6 @@
}
}
}
-
- /// Apply the [type] that is created by the [constructorName] and the
- /// [constructorElement] it references.
- static void applyConstructorElement(
- LibraryElement enclosingLibraryElement,
- PrefixElement prefixElement,
- ConstructorElement constructorElement,
- DartType type,
- ConstructorName constructorName) {
- constructorName.staticElement = constructorElement;
-
- ClassElement classElement = constructorElement?.enclosingElement;
-
- Identifier typeIdentifier = constructorName.type.name;
- if (prefixElement != null) {
- PrefixedIdentifier prefixedTypeIdentifier = typeIdentifier;
- prefixedTypeIdentifier.staticType = type;
-
- prefixedTypeIdentifier.prefix.staticElement = prefixElement;
-
- SimpleIdentifier classNode = prefixedTypeIdentifier.identifier;
- classNode.staticElement = classElement;
- classNode.staticType = type;
- } else {
- if (typeIdentifier is SimpleIdentifier) {
- typeIdentifier.staticElement = classElement;
- typeIdentifier.staticType = type;
- } else if (typeIdentifier is PrefixedIdentifier) {
- constructorName.type = astFactory.typeName(typeIdentifier.prefix, null);
- constructorName.period = typeIdentifier.period;
- constructorName.name = typeIdentifier.identifier;
- }
- }
-
- constructorName.name?.staticElement = constructorElement;
-
- applyToTypeAnnotation(enclosingLibraryElement, type, constructorName.type);
- }
-
- /// Apply the types of the [parameterElements] to the [parameterList] that
- /// have an explicit type annotation.
- static void applyParameters(
- LibraryElement enclosingLibraryElement,
- List<ParameterElement> parameterElements,
- FormalParameterList parameterList) {
- List<FormalParameter> parameters = parameterList.parameters;
-
- int length = parameterElements.length;
- if (parameters.length != length) {
- throw new StateError('Parameter counts do not match');
- }
- for (int i = 0; i < length; i++) {
- ParameterElementImpl element = parameterElements[i];
- FormalParameter parameter = parameters[i];
-
- DeclarationResolver.resolveMetadata(
- parameter, parameter.metadata, element);
-
- NormalFormalParameter normalParameter;
- if (parameter is NormalFormalParameter) {
- normalParameter = parameter;
- } else if (parameter is DefaultFormalParameter) {
- normalParameter = parameter.parameter;
- }
- assert(normalParameter != null);
-
- if (normalParameter is SimpleFormalParameterImpl) {
- normalParameter.element = element;
- }
-
- if (normalParameter.identifier != null) {
- element.nameOffset = normalParameter.identifier.offset;
- normalParameter.identifier.staticElement = element;
- normalParameter.identifier.staticType = element.type;
- }
-
- // Apply the type or the return type, if a function typed parameter.
- TypeAnnotation functionReturnType;
- FormalParameterList functionParameterList;
- if (normalParameter is SimpleFormalParameter) {
- applyToTypeAnnotation(
- enclosingLibraryElement, element.type, normalParameter.type);
- } else if (normalParameter is FunctionTypedFormalParameter) {
- functionReturnType = normalParameter.returnType;
- functionParameterList = normalParameter.parameters;
- } else if (normalParameter is FieldFormalParameter) {
- if (normalParameter.parameters == null) {
- applyToTypeAnnotation(
- enclosingLibraryElement, element.type, normalParameter.type);
- } else {
- functionReturnType = normalParameter.type;
- functionParameterList = normalParameter.parameters;
- }
- }
-
- if (functionParameterList != null) {
- FunctionType elementType = element.type;
- if (functionReturnType != null) {
- applyToTypeAnnotation(enclosingLibraryElement, elementType.returnType,
- functionReturnType);
- }
- applyParameters(enclosingLibraryElement, elementType.parameters,
- functionParameterList);
- }
- }
- }
-
- /// Apply the [type] to the [typeAnnotation] by setting the type of the
- /// [typeAnnotation] to the [type] and recursively applying each of the type
- /// arguments of the [type] to the corresponding type arguments of the
- /// [typeAnnotation].
- static void applyToTypeAnnotation(LibraryElement enclosingLibraryElement,
- DartType type, TypeAnnotation typeAnnotation) {
- if (typeAnnotation is GenericFunctionTypeImpl) {
- if (type is! FunctionType) {
- throw new StateError('Non-function type ($type) '
- 'for generic function annotation ($typeAnnotation)');
- }
- FunctionType functionType = type;
- typeAnnotation.type = type;
- applyToTypeAnnotation(enclosingLibraryElement, functionType.returnType,
- typeAnnotation.returnType);
- applyParameters(enclosingLibraryElement, functionType.parameters,
- typeAnnotation.parameters);
- } else if (typeAnnotation is TypeNameImpl) {
- typeAnnotation.type = type;
-
- Identifier typeIdentifier = typeAnnotation.name;
- SimpleIdentifier typeName;
- if (typeIdentifier is PrefixedIdentifier) {
- if (enclosingLibraryElement != null) {
- String prefixName = typeIdentifier.prefix.name;
- for (var import in enclosingLibraryElement.imports) {
- if (import.prefix?.name == prefixName) {
- typeIdentifier.prefix.staticElement = import.prefix;
- break;
- }
- }
- }
- typeName = typeIdentifier.identifier;
- } else {
- typeName = typeIdentifier;
- }
-
- Element typeElement = type.element;
- if (typeElement is GenericFunctionTypeElement &&
- typeElement.enclosingElement is GenericTypeAliasElement) {
- typeElement = typeElement.enclosingElement;
- }
-
- typeName.staticElement = typeElement;
- typeName.staticType = type;
- }
- if (typeAnnotation is NamedType) {
- TypeArgumentList typeArguments = typeAnnotation.typeArguments;
- if (typeArguments != null) {
- _applyTypeArgumentsToList(
- enclosingLibraryElement, type, typeArguments.arguments);
- }
- }
- }
-
- /// Recursively apply each of the type arguments of the [type] to the
- /// corresponding type arguments of the [typeArguments].
- static void _applyTypeArgumentsToList(LibraryElement enclosingLibraryElement,
- DartType type, List<TypeAnnotation> typeArguments) {
- if (type != null && type.isUndefined) {
- for (TypeAnnotation argument in typeArguments) {
- applyToTypeAnnotation(enclosingLibraryElement, type, argument);
- }
- } else if (type is ParameterizedType) {
- List<DartType> argumentTypes = type.typeArguments;
- int argumentCount = argumentTypes.length;
- if (argumentCount != typeArguments.length) {
- throw new StateError('Found $argumentCount argument types '
- 'for ${typeArguments.length} type arguments');
- }
- for (int i = 0; i < argumentCount; i++) {
- applyToTypeAnnotation(
- enclosingLibraryElement, argumentTypes[i], typeArguments[i]);
- }
- } else {
- throw new StateError('Attempting to apply a non-parameterized type '
- '(${type.runtimeType}) to type arguments');
- }
- }
}
/// A container with [typeArguments].
diff --git a/pkg/analyzer/lib/src/fasta/resolution_storer.dart b/pkg/analyzer/lib/src/fasta/resolution_storer.dart
index 01d758e..9924ebb 100644
--- a/pkg/analyzer/lib/src/fasta/resolution_storer.dart
+++ b/pkg/analyzer/lib/src/fasta/resolution_storer.dart
@@ -5,6 +5,7 @@
import 'package:analyzer/src/fasta/resolution_applier.dart';
import 'package:front_end/src/fasta/kernel/factory.dart';
import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart';
+import 'package:front_end/src/fasta/kernel/kernel_type_variable_builder.dart';
import 'package:front_end/src/fasta/type_inference/type_inference_listener.dart';
import 'package:front_end/src/scanner/token.dart';
import 'package:kernel/ast.dart';
@@ -18,8 +19,11 @@
final Type invokeType;
final bool isExplicitCall;
final bool isImplicitCall;
+ final bool isPrefixReference;
+ final bool isTypeReference;
final bool isWriteReference;
final Type literalType;
+ final Reference loadLibrary;
final PrefixInfo prefixInfo;
final Reference reference;
final Type writeContext;
@@ -32,8 +36,11 @@
this.invokeType,
this.isExplicitCall = false,
this.isImplicitCall = false,
+ this.isPrefixReference = false,
+ this.isTypeReference = false,
this.isWriteReference = false,
this.literalType,
+ this.loadLibrary,
this.prefixInfo,
this.reference,
this.writeContext});
@@ -41,83 +48,27 @@
/// Type inference listener that records inferred types for later use by
/// [ResolutionApplier].
-class ResolutionStorer extends _ResolutionStorer<int, Node, int>
+class ResolutionStorer
implements
TypeInferenceListener<int, Node, int>,
Factory<void, void, void, void> {
- ResolutionStorer(Map<int, ResolutionData<DartType, int, Node, int>> data)
- : super(data);
+ final Map<int, ResolutionData<DartType, int, Node, int>> _data;
- @override
- void _validateLocation(int location) {
- if (location < 0) {
- throw new StateError('Invalid location: $location');
- }
- }
-}
+ final Map<TypeParameter, int> _typeVariableDeclarations;
-/// Implementation of [ResolutionStorer], with types parameterized to avoid
-/// accidentally peeking into kernel internals.
-///
-/// TODO(paulberry): when the time is right, fuse this with [ResolutionStorer].
-class _ResolutionStorer<Location, Reference, PrefixInfo> {
- final Map<Location, ResolutionData<DartType, int, Reference, PrefixInfo>>
- _data;
+ ResolutionStorer(Map<int, ResolutionData<DartType, int, Node, int>> data,
+ Map<TypeParameter, int> typeVariableDeclarations)
+ : _data = data,
+ _typeVariableDeclarations = typeVariableDeclarations;
- _ResolutionStorer(this._data);
-
- void _store(Location location,
- {List<DartType> argumentTypes,
- Reference combiner,
- int declaration,
- DartType inferredType,
- DartType invokeType,
- bool isExplicitCall = false,
- bool isImplicitCall = false,
- bool isWriteReference = false,
- DartType literalType,
- PrefixInfo prefixInfo,
- Reference reference,
- bool replace = false,
- DartType writeContext}) {
- _validateLocation(location);
- if (!replace && _data.containsKey(location)) {
- throw new StateError('Data already stored for offset $location');
- }
- _data[location] = new ResolutionData(
- argumentTypes: argumentTypes,
- combiner: combiner,
- declaration: declaration,
- inferredType: inferredType,
- invokeType: invokeType,
- isExplicitCall: isExplicitCall,
- isImplicitCall: isImplicitCall,
- isWriteReference: isWriteReference,
- literalType: literalType,
- prefixInfo: prefixInfo,
- reference: reference,
- writeContext: writeContext);
- }
-
- void _unstore(Location location) {
- _data.remove(location) == null;
- }
-
- void _validateLocation(Location location) {}
-
- void asExpression(
- ExpressionJudgment judgment,
- Location location,
- void expression,
- Token asOperator,
- void literalType,
- DartType inferredType) {
+ void asExpression(ExpressionJudgment judgment, int location, void expression,
+ Token asOperator, void literalType, DartType inferredType) {
_store(location, literalType: inferredType, inferredType: inferredType);
}
void assertInitializer(
InitializerJudgment judgment,
- Location location,
+ int location,
Token assertKeyword,
Token leftParenthesis,
void condition,
@@ -127,7 +78,7 @@
void assertStatement(
StatementJudgment judgment,
- Location location,
+ int location,
Token assertKeyword,
Token leftParenthesis,
void condition,
@@ -136,27 +87,48 @@
Token rightParenthesis,
Token semicolon) {}
- void awaitExpression(ExpressionJudgment judgment, Location location,
+ void awaitExpression(ExpressionJudgment judgment, int location,
Token awaitKeyword, void expression, DartType inferredType) =>
genericExpression("awaitExpression", location, inferredType);
- void block(StatementJudgment judgment, Location location, Token leftBracket,
+ Object binderForFunctionDeclaration(
+ StatementJudgment judgment, int fileOffset, String name) {
+ return new VariableDeclarationBinder(fileOffset);
+ }
+
+ void binderForStatementLabel(
+ StatementJudgment judgment, int fileOffset, String name) {}
+
+ void binderForSwitchLabel(
+ SwitchCaseJudgment judgment, int fileOffset, String name) {}
+
+ TypeVariableBinder binderForTypeVariable(
+ KernelTypeVariableBuilder builder, int fileOffset, String name) {
+ return new TypeVariableBinder(fileOffset);
+ }
+
+ Object binderForVariableDeclaration(
+ StatementJudgment judgment, int fileOffset, String name) {
+ return new VariableDeclarationBinder(fileOffset);
+ }
+
+ void block(StatementJudgment judgment, int location, Token leftBracket,
List<void> statements, Token rightBracket) {}
- void boolLiteral(ExpressionJudgment judgment, Location location,
- Token literal, bool value, DartType inferredType) =>
+ void boolLiteral(ExpressionJudgment judgment, int location, Token literal,
+ bool value, DartType inferredType) =>
genericExpression("boolLiteral", location, inferredType);
void breakStatement(
StatementJudgment judgment,
- Location location,
+ int location,
Token breakKeyword,
void label,
Token semicolon,
covariant Object labelBinder) {}
void cascadeExpression(
- ExpressionJudgment judgment, Location location, DartType inferredType) {
+ ExpressionJudgment judgment, int location, DartType inferredType) {
// Overridden so that the type of the expression will not be recorded. We
// don't need to record the type because the type is always the same as the
// type of the target, and we don't have the appropriate offset so we can't
@@ -165,7 +137,7 @@
void catchStatement(
Catch judgment,
- Location location,
+ int location,
Token onKeyword,
void type,
Token catchKeyword,
@@ -183,19 +155,17 @@
_store(location, literalType: guardType);
if (exceptionBinder != null) {
- _store(exceptionBinder.fileOffset as Location,
- literalType: exceptionType);
+ _store(exceptionBinder.fileOffset, literalType: exceptionType);
}
if (stackTraceBinder != null) {
- _store(stackTraceBinder.fileOffset as Location,
- literalType: stackTraceType);
+ _store(stackTraceBinder.fileOffset, literalType: stackTraceType);
}
}
void conditionalExpression(
ExpressionJudgment judgment,
- Location location,
+ int location,
void condition,
Token question,
void thenExpression,
@@ -204,8 +174,8 @@
DartType inferredType) =>
genericExpression("conditionalExpression", location, inferredType);
- void constructorInvocation(ExpressionJudgment judgment, Location location,
- Reference expressionTarget, DartType inferredType) {
+ void constructorInvocation(ExpressionJudgment judgment, int location,
+ Node expressionTarget, DartType inferredType) {
// A class reference may have already been stored at this location by
// storeClassReference. We want to replace it with a constructor
// reference.
@@ -215,7 +185,7 @@
void continueStatement(
StatementJudgment judgment,
- Location location,
+ int location,
Token continueKeyword,
void label,
Token semicolon,
@@ -223,20 +193,20 @@
void continueSwitchStatement(
StatementJudgment judgment,
- Location location,
+ int location,
Token continueKeyword,
void label,
Token semicolon,
covariant Object labelBinder) {}
void deferredCheck(
- ExpressionJudgment judgment, Location location, DartType inferredType) {
+ ExpressionJudgment judgment, int location, DartType inferredType) {
// This judgment has no semantic value for Analyzer.
}
void doStatement(
StatementJudgment judgment,
- Location location,
+ int location,
Token doKeyword,
void body,
Token whileKeyword,
@@ -245,30 +215,30 @@
Token rightParenthesis,
Token semicolon) {}
- void doubleLiteral(ExpressionJudgment judgment, Location location,
- Token literal, double value, DartType inferredType) =>
+ void doubleLiteral(ExpressionJudgment judgment, int location, Token literal,
+ double value, DartType inferredType) =>
genericExpression("doubleLiteral", location, inferredType);
void emptyStatement(Token semicolon) {}
- void expressionStatement(StatementJudgment judgment, Location location,
+ void expressionStatement(StatementJudgment judgment, int location,
void expression, Token semicolon) {}
void fieldInitializer(
InitializerJudgment judgment,
- Location location,
+ int location,
Token thisKeyword,
Token period,
Token fieldName,
Token equals,
void expression,
- Reference initializerField) {
+ Node initializerField) {
_store(location, reference: initializerField);
}
void forInStatement(
StatementJudgment judgment,
- Location location,
+ int location,
Token awaitKeyword,
Token forKeyword,
Token leftParenthesis,
@@ -280,13 +250,12 @@
void body,
covariant VariableDeclarationBinder loopVariableBinder,
DartType loopVariableType,
- Location writeLocation,
+ int writeLocation,
DartType writeType,
covariant VariableDeclarationBinder writeVariableBinder,
- Reference writeTarget) {
+ Node writeTarget) {
if (loopVariableBinder != null) {
- _store(loopVariableBinder.fileOffset as Location,
- inferredType: loopVariableType);
+ _store(loopVariableBinder.fileOffset, inferredType: loopVariableType);
} else {
if (writeVariableBinder != null) {
_store(writeLocation,
@@ -303,7 +272,7 @@
void forStatement(
StatementJudgment judgment,
- Location location,
+ int location,
Token forKeyword,
Token leftParenthesis,
void variableDeclarationList,
@@ -317,30 +286,35 @@
void functionDeclaration(
covariant VariableDeclarationBinder binder, FunctionType inferredType) {
- _store(binder.fileOffset as Location, inferredType: inferredType);
+ _store(binder.fileOffset, inferredType: inferredType);
}
- Object binderForFunctionDeclaration(
- StatementJudgment judgment, int fileOffset, String name) {
- return new VariableDeclarationBinder(fileOffset);
- }
-
- void functionExpression(ExpressionJudgment judgment, Location location,
- DartType inferredType) =>
+ void functionExpression(
+ ExpressionJudgment judgment, int location, DartType inferredType) =>
genericExpression("functionExpression", location, inferredType);
+ @override
+ void functionType(int location, DartType type) {
+ _store(location, inferredType: type);
+ }
+
+ @override
+ void functionTypedFormalParameter(int location, DartType type) {
+ _store(location, inferredType: type);
+ }
+
void genericExpression(
- String expressionType, Location location, DartType inferredType) {
+ String expressionType, int location, DartType inferredType) {
_store(location, inferredType: inferredType);
}
- void ifNull(ExpressionJudgment judgment, Location location, void leftOperand,
+ void ifNull(ExpressionJudgment judgment, int location, void leftOperand,
Token operator, void rightOperand, DartType inferredType) =>
genericExpression('ifNull', location, inferredType);
void ifStatement(
StatementJudgment judgment,
- Location location,
+ int location,
Token ifKeyword,
Token leftParenthesis,
void condition,
@@ -349,22 +323,46 @@
Token elseKeyword,
void elseStatement) {}
- void intLiteral(ExpressionJudgment judgment, Location location, Token literal,
+ void indexAssign(ExpressionJudgment judgment, int location, Node writeMember,
+ Node combiner, DartType inferredType) {
+ _store(location,
+ reference: writeMember, inferredType: inferredType, combiner: combiner);
+ }
+
+ void intLiteral(ExpressionJudgment judgment, int location, Token literal,
num value, DartType inferredType) =>
genericExpression("intLiteral", location, inferredType);
- void invalidInitializer(InitializerJudgment judgment, Location location) {}
+ void invalidInitializer(InitializerJudgment judgment, int location) {}
+
+ void isExpression(
+ ExpressionJudgment judgment,
+ int location,
+ void expression,
+ Token isOperator,
+ void literalType,
+ DartType testedType,
+ DartType inferredType) {
+ _store(location, literalType: testedType, inferredType: inferredType);
+ }
+
+ void isNotExpression(
+ ExpressionJudgment judgment,
+ int location,
+ void expression,
+ Token isOperator,
+ Token notOperator,
+ void literalType,
+ DartType type,
+ DartType inferredType) {
+ _store(location, literalType: type, inferredType: inferredType);
+ }
void labeledStatement(List<Object> labels, void statement) {}
- void statementLabel(covariant void binder, Token label, Token colon) {}
-
- void binderForStatementLabel(
- StatementJudgment judgment, int fileOffset, String name) {}
-
void listLiteral(
ExpressionJudgment judgment,
- Location location,
+ int location,
Token constKeyword,
Object typeArguments,
Token leftBracket,
@@ -373,9 +371,24 @@
DartType inferredType) =>
genericExpression("listLiteral", location, inferredType);
+ @override
+ void loadLibrary(LoadLibraryJudgment judgment, int location, Node library,
+ FunctionType calleeType, DartType inferredType) {
+ _store(location,
+ loadLibrary: library,
+ invokeType: calleeType,
+ inferredType: inferredType);
+ }
+
+ @override
+ void loadLibraryTearOff(LoadLibraryTearOffJudgment judgment, int location,
+ Node library, DartType inferredType) {
+ _store(location, loadLibrary: library, inferredType: inferredType);
+ }
+
void logicalExpression(
ExpressionJudgment judgment,
- Location location,
+ int location,
void leftOperand,
Token operator,
void rightOperand,
@@ -384,7 +397,7 @@
void mapLiteral(
ExpressionJudgment judgment,
- Location location,
+ int location,
Token constKeyword,
Object typeArguments,
Token leftBracket,
@@ -398,56 +411,12 @@
// TODO(brianwilkerson) Implement this.
}
- void namedFunctionExpression(ExpressionJudgment judgment,
- covariant VariableDeclarationBinder binder, DartType inferredType) =>
- genericExpression("namedFunctionExpression",
- binder.fileOffset as Location, inferredType);
-
- void not(ExpressionJudgment judgment, Location location, Token operator,
- void operand, DartType inferredType) =>
- genericExpression("not", location, inferredType);
-
- void nullLiteral(ExpressionJudgment judgment, Location location,
- Token literal, bool isSynthetic, DartType inferredType) {
- if (isSynthetic) return null;
- genericExpression("nullLiteral", location, inferredType);
- }
-
- void indexAssign(ExpressionJudgment judgment, Location location,
- Reference writeMember, Reference combiner, DartType inferredType) {
- _store(location,
- reference: writeMember, inferredType: inferredType, combiner: combiner);
- }
-
- void isExpression(
- ExpressionJudgment judgment,
- Location location,
- void expression,
- Token isOperator,
- void literalType,
- DartType testedType,
- DartType inferredType) {
- _store(location, literalType: testedType, inferredType: inferredType);
- }
-
- void isNotExpression(
- ExpressionJudgment judgment,
- Location location,
- void expression,
- Token isOperator,
- Token notOperator,
- void literalType,
- DartType type,
- DartType inferredType) {
- _store(location, literalType: type, inferredType: inferredType);
- }
-
void methodInvocation(
ExpressionJudgment judgment,
- Location resultOffset,
+ int resultOffset,
List<DartType> argumentsTypes,
bool isImplicitCall,
- Reference interfaceMember,
+ Node interfaceMember,
FunctionType calleeType,
Substitution substitution,
DartType inferredType) {
@@ -465,7 +434,7 @@
void methodInvocationCall(
ExpressionJudgment judgment,
- Location resultOffset,
+ int resultOffset,
List<DartType> argumentsTypes,
bool isImplicitCall,
FunctionType calleeType,
@@ -482,12 +451,27 @@
isImplicitCall: isImplicitCall);
}
+ void namedFunctionExpression(ExpressionJudgment judgment,
+ covariant VariableDeclarationBinder binder, DartType inferredType) =>
+ genericExpression(
+ "namedFunctionExpression", binder.fileOffset, inferredType);
+
+ void not(ExpressionJudgment judgment, int location, Token operator,
+ void operand, DartType inferredType) =>
+ genericExpression("not", location, inferredType);
+
+ void nullLiteral(ExpressionJudgment judgment, int location, Token literal,
+ bool isSynthetic, DartType inferredType) {
+ if (isSynthetic) return null;
+ genericExpression("nullLiteral", location, inferredType);
+ }
+
void propertyAssign(
ExpressionJudgment judgment,
- Location location,
- Reference writeMember,
+ int location,
+ Node writeMember,
DartType writeContext,
- Reference combiner,
+ Node combiner,
DartType inferredType) {
_store(location,
isWriteReference: true,
@@ -497,45 +481,42 @@
inferredType: inferredType);
}
- void propertySet(ExpressionJudgment judgment, Location location,
- DartType inferredType) =>
- genericExpression("propertySet", location, inferredType);
-
- void propertyGet(ExpressionJudgment judgment, Location location,
- Reference member, DartType inferredType) {
+ void propertyGet(ExpressionJudgment judgment, int location, Node member,
+ DartType inferredType) {
_store(location, reference: member, inferredType: inferredType);
}
void propertyGetCall(
- ExpressionJudgment judgment, Location location, DartType inferredType) {
+ ExpressionJudgment judgment, int location, DartType inferredType) {
_store(location, isExplicitCall: true);
}
+ void propertySet(
+ ExpressionJudgment judgment, int location, DartType inferredType) =>
+ genericExpression("propertySet", location, inferredType);
+
void redirectingInitializer(
InitializerJudgment judgment,
- Location location,
+ int location,
Token thisKeyword,
Token period,
Token constructorName,
covariant Object argumentList,
- Reference initializerTarget) {
+ Node initializerTarget) {
_store(location, reference: initializerTarget);
}
- void rethrow_(ExpressionJudgment judgment, Location location,
- Token rethrowKeyword, DartType inferredType) =>
+ void rethrow_(ExpressionJudgment judgment, int location, Token rethrowKeyword,
+ DartType inferredType) =>
genericExpression('rethrow', location, inferredType);
- void returnStatement(StatementJudgment judgment, Location location,
+ void returnStatement(StatementJudgment judgment, int location,
Token returnKeyword, void expression, Token semicolon) {}
- void staticAssign(
- ExpressionJudgment judgment,
- Location location,
- Reference writeMember,
- DartType writeContext,
- Reference combiner,
- DartType inferredType) {
+ void statementLabel(covariant void binder, Token label, Token colon) {}
+
+ void staticAssign(ExpressionJudgment judgment, int location, Node writeMember,
+ DartType writeContext, Node combiner, DartType inferredType) {
_store(location,
reference: writeMember,
isWriteReference: true,
@@ -544,15 +525,15 @@
inferredType: inferredType);
}
- void staticGet(ExpressionJudgment judgment, Location location,
- Reference expressionTarget, DartType inferredType) {
+ void staticGet(ExpressionJudgment judgment, int location,
+ Node expressionTarget, DartType inferredType) {
_store(location, reference: expressionTarget, inferredType: inferredType);
}
void staticInvocation(
ExpressionJudgment judgment,
- Location location,
- Reference expressionTarget,
+ int location,
+ Node expressionTarget,
List<DartType> expressionArgumentsTypes,
FunctionType calleeType,
Substitution substitution,
@@ -567,19 +548,28 @@
inferredType: inferredType);
}
+ void storeClassReference(int location, Node reference, DartType rawType) {
+ // TODO(paulberry): would it be better to use literalType?
+ _store(location, reference: reference, inferredType: rawType);
+ }
+
+ void storePrefixInfo(int location, int prefixInfo) {
+ _store(location, isPrefixReference: true, prefixInfo: prefixInfo);
+ }
+
void stringConcatenation(
- ExpressionJudgment judgment, Location location, DartType inferredType) {
+ ExpressionJudgment judgment, int location, DartType inferredType) {
// We don't need the type - we already know that it is String.
// Moreover, the file offset for StringConcatenation is `-1`.
}
- void stringLiteral(ExpressionJudgment judgment, Location location,
- Token literal, String value, DartType inferredType) =>
+ void stringLiteral(ExpressionJudgment judgment, int location, Token literal,
+ String value, DartType inferredType) =>
genericExpression("StringLiteral", location, inferredType);
void superInitializer(
InitializerJudgment judgment,
- Location location,
+ int location,
Token superKeyword,
Token period,
Token constructorName,
@@ -590,12 +580,9 @@
void switchLabel(covariant void binder, Token label, Token colon) {}
- void binderForSwitchLabel(
- SwitchCaseJudgment judgment, int fileOffset, String name) {}
-
void switchStatement(
StatementJudgment judgment,
- Location location,
+ int location,
Token switchKeyword,
Token leftParenthesis,
void expression,
@@ -604,44 +591,54 @@
void members,
Token rightBracket) {}
- void symbolLiteral(
- ExpressionJudgment judgment,
- Location location,
- Token poundSign,
- List<Token> components,
- String value,
- DartType inferredType) =>
+ void symbolLiteral(ExpressionJudgment judgment, int location, Token poundSign,
+ List<Token> components, String value, DartType inferredType) =>
genericExpression("symbolLiteral", location, inferredType);
- void thisExpression(ExpressionJudgment judgment, Location location,
+ void thisExpression(ExpressionJudgment judgment, int location,
Token thisKeyword, DartType inferredType) {}
- void throw_(ExpressionJudgment judgment, Location location,
- Token throwKeyword, void expression, DartType inferredType) =>
+ void throw_(ExpressionJudgment judgment, int location, Token throwKeyword,
+ void expression, DartType inferredType) =>
genericExpression('throw', location, inferredType);
- void tryCatch(StatementJudgment judgment, Location location) {}
+ void tryCatch(StatementJudgment judgment, int location) {}
- void tryFinally(
- StatementJudgment judgment,
- Location location,
- Token tryKeyword,
- void body,
- void catchClauses,
- Token finallyKeyword,
- void finallyBlock) {}
+ void tryFinally(StatementJudgment judgment, int location, Token tryKeyword,
+ void body, void catchClauses, Token finallyKeyword, void finallyBlock) {}
- void typeLiteral(ExpressionJudgment judgment, Location location,
- Reference expressionType, DartType inferredType) {
+ void typeLiteral(ExpressionJudgment judgment, int location,
+ Node expressionType, DartType inferredType) {
_store(location, reference: expressionType, inferredType: inferredType);
}
+ void typeReference(
+ int location,
+ Token leftBracket,
+ List<void> typeArguments,
+ Token rightBracket,
+ Node reference,
+ covariant TypeVariableBinder binder,
+ DartType type) {
+ _store(location,
+ reference: reference,
+ declaration: binder?.fileOffset,
+ inferredType: type,
+ isTypeReference: true);
+ }
+
+ void typeVariableDeclaration(int location,
+ covariant TypeVariableBinder binder, TypeParameter typeParameter) {
+ _storeTypeVariableDeclaration(binder.fileOffset, typeParameter);
+ _store(location, declaration: binder.fileOffset);
+ }
+
void variableAssign(
ExpressionJudgment judgment,
- Location location,
+ int location,
DartType writeContext,
covariant VariableDeclarationBinder writeVariableBinder,
- Reference combiner,
+ Node combiner,
DartType inferredType) {
_store(location,
declaration: writeVariableBinder?.fileOffset,
@@ -653,18 +650,13 @@
void variableDeclaration(covariant VariableDeclarationBinder binder,
DartType statementType, DartType inferredType) {
- _store(binder.fileOffset as Location,
+ _store(binder.fileOffset,
literalType: statementType, inferredType: inferredType);
}
- Object binderForVariableDeclaration(
- StatementJudgment judgment, int fileOffset, String name) {
- return new VariableDeclarationBinder(fileOffset);
- }
-
void variableGet(
ExpressionJudgment judgment,
- Location location,
+ int location,
bool isInCascade,
covariant VariableDeclarationBinder variableBinder,
DartType inferredType) {
@@ -675,34 +667,79 @@
declaration: variableBinder?.fileOffset, inferredType: inferredType);
}
+ void voidType(int location, Token token, DartType type) {
+ _store(location, inferredType: type);
+ }
+
void whileStatement(
StatementJudgment judgment,
- Location location,
+ int location,
Token whileKeyword,
Token leftParenthesis,
void condition,
Token rightParenthesis,
void body) {}
- void yieldStatement(StatementJudgment judgment, Location location,
+ void yieldStatement(StatementJudgment judgment, int location,
Token yieldKeyword, Token star, void expression, Token semicolon) {}
- void storePrefixInfo(Location location, PrefixInfo prefixInfo) {
- _store(location, prefixInfo: prefixInfo);
+ void _store(int location,
+ {List<DartType> argumentTypes,
+ Node combiner,
+ int declaration,
+ DartType inferredType,
+ DartType invokeType,
+ bool isExplicitCall = false,
+ bool isImplicitCall = false,
+ bool isPrefixReference = false,
+ bool isTypeReference = false,
+ bool isWriteReference = false,
+ DartType literalType,
+ Node loadLibrary,
+ int prefixInfo,
+ Node reference,
+ bool replace = false,
+ DartType writeContext}) {
+ _validateLocation(location);
+ if (!replace && _data.containsKey(location)) {
+ throw new StateError('Data already stored for offset $location');
+ }
+ _data[location] = new ResolutionData(
+ argumentTypes: argumentTypes,
+ combiner: combiner,
+ declaration: declaration,
+ inferredType: inferredType,
+ invokeType: invokeType,
+ isExplicitCall: isExplicitCall,
+ isImplicitCall: isImplicitCall,
+ isPrefixReference: isPrefixReference,
+ isTypeReference: isTypeReference,
+ isWriteReference: isWriteReference,
+ literalType: literalType,
+ loadLibrary: loadLibrary,
+ prefixInfo: prefixInfo,
+ reference: reference,
+ writeContext: writeContext);
}
- void storeClassReference(
- Location location, Reference reference, DartType rawType) {
- // TODO(paulberry): would it be better to use literalType?
- _store(location, reference: reference, inferredType: rawType);
+ void _storeTypeVariableDeclaration(
+ int fileOffset, TypeParameter typeParameter) {
+ if (_typeVariableDeclarations.containsKey(fileOffset)) {
+ throw new StateError(
+ 'Type declaration already stored for offset $fileOffset');
+ }
+ _typeVariableDeclarations[typeParameter] = fileOffset;
}
-}
-/// TODO(paulberry): eventually just use the element directly.
-class VariableDeclarationBinder {
- final int fileOffset;
+ void _unstore(int location) {
+ _data.remove(location) == null;
+ }
- VariableDeclarationBinder(this.fileOffset);
+ void _validateLocation(int location) {
+ if (location < 0) {
+ throw new StateError('Invalid location: $location');
+ }
+ }
}
/// A [DartType] wrapper around invocation type arguments.
@@ -718,3 +755,17 @@
return '<${types.join(', ')}>';
}
}
+
+/// TODO(paulberry): eventually just use the element directly.
+class TypeVariableBinder {
+ final int fileOffset;
+
+ TypeVariableBinder(this.fileOffset);
+}
+
+/// TODO(paulberry): eventually just use the element directly.
+class VariableDeclarationBinder {
+ final int fileOffset;
+
+ VariableDeclarationBinder(this.fileOffset);
+}
diff --git a/pkg/analyzer/lib/src/generated/declaration_resolver.dart b/pkg/analyzer/lib/src/generated/declaration_resolver.dart
index f25218f..5afac37 100644
--- a/pkg/analyzer/lib/src/generated/declaration_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/declaration_resolver.dart
@@ -5,6 +5,7 @@
library analyzer.src.generated.declaration_resolver;
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -14,7 +15,6 @@
import 'package:analyzer/src/dart/element/builder.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/type.dart';
-import 'package:analyzer/src/fasta/resolution_applier.dart';
import 'package:analyzer/src/generated/resolver.dart';
/**
@@ -294,8 +294,7 @@
@override
Object visitFormalParameterList(FormalParameterList node) {
if (_applyKernelTypes) {
- ResolutionApplier.applyParameters(
- _enclosingLibrary, _walker._parameters, node);
+ applyParameters(_enclosingLibrary, _walker._parameters, node);
_walker.consumeParameters();
return null;
} else {
@@ -633,8 +632,7 @@
/// Apply [type] to the [typeAnnotation].
void _applyType(DartType type, TypeAnnotation typeAnnotation) {
- ResolutionApplier.applyToTypeAnnotation(
- _enclosingLibrary, type, typeAnnotation);
+ applyToTypeAnnotation(_enclosingLibrary, type, typeAnnotation);
}
/**
@@ -734,6 +732,168 @@
_walker = outerWalker;
}
+ /// Apply the [type] that is created by the [constructorName] and the
+ /// [constructorElement] it references.
+ static void applyConstructorElement(
+ LibraryElement enclosingLibraryElement,
+ PrefixElement prefixElement,
+ ConstructorElement constructorElement,
+ DartType type,
+ ConstructorName constructorName) {
+ constructorName.staticElement = constructorElement;
+
+ ClassElement classElement = constructorElement?.enclosingElement;
+
+ Identifier typeIdentifier = constructorName.type.name;
+ if (prefixElement != null) {
+ PrefixedIdentifier prefixedTypeIdentifier = typeIdentifier;
+ prefixedTypeIdentifier.staticType = type;
+
+ prefixedTypeIdentifier.prefix.staticElement = prefixElement;
+
+ SimpleIdentifier classNode = prefixedTypeIdentifier.identifier;
+ classNode.staticElement = classElement;
+ classNode.staticType = type;
+ } else {
+ if (typeIdentifier is SimpleIdentifier) {
+ typeIdentifier.staticElement = classElement;
+ typeIdentifier.staticType = type;
+ } else if (typeIdentifier is PrefixedIdentifier) {
+ constructorName.type = astFactory.typeName(typeIdentifier.prefix, null);
+ constructorName.period = typeIdentifier.period;
+ constructorName.name = typeIdentifier.identifier;
+ }
+ }
+
+ constructorName.name?.staticElement = constructorElement;
+
+ DeclarationResolver.applyToTypeAnnotation(
+ enclosingLibraryElement, type, constructorName.type);
+ }
+
+ /// Apply the types of the [parameterElements] to the [parameterList] that
+ /// have an explicit type annotation.
+ static void applyParameters(
+ LibraryElement enclosingLibraryElement,
+ List<ParameterElement> parameterElements,
+ FormalParameterList parameterList) {
+ List<FormalParameter> parameters = parameterList.parameters;
+
+ int length = parameterElements.length;
+ if (parameters.length != length) {
+ throw new StateError('Parameter counts do not match');
+ }
+ for (int i = 0; i < length; i++) {
+ ParameterElementImpl element = parameterElements[i];
+ FormalParameter parameter = parameters[i];
+
+ DeclarationResolver.resolveMetadata(
+ parameter, parameter.metadata, element);
+
+ NormalFormalParameter normalParameter;
+ if (parameter is NormalFormalParameter) {
+ normalParameter = parameter;
+ } else if (parameter is DefaultFormalParameter) {
+ normalParameter = parameter.parameter;
+ }
+ assert(normalParameter != null);
+
+ if (normalParameter is SimpleFormalParameterImpl) {
+ normalParameter.element = element;
+ }
+
+ if (normalParameter.identifier != null) {
+ element.nameOffset = normalParameter.identifier.offset;
+ normalParameter.identifier.staticElement = element;
+ normalParameter.identifier.staticType = element.type;
+ }
+
+ // Apply the type or the return type, if a function typed parameter.
+ TypeAnnotation functionReturnType;
+ FormalParameterList functionParameterList;
+ if (normalParameter is SimpleFormalParameter) {
+ applyToTypeAnnotation(
+ enclosingLibraryElement, element.type, normalParameter.type);
+ } else if (normalParameter is FunctionTypedFormalParameter) {
+ functionReturnType = normalParameter.returnType;
+ functionParameterList = normalParameter.parameters;
+ } else if (normalParameter is FieldFormalParameter) {
+ if (normalParameter.parameters == null) {
+ applyToTypeAnnotation(
+ enclosingLibraryElement, element.type, normalParameter.type);
+ } else {
+ functionReturnType = normalParameter.type;
+ functionParameterList = normalParameter.parameters;
+ }
+ }
+
+ if (functionParameterList != null) {
+ FunctionType elementType = element.type;
+ if (functionReturnType != null) {
+ applyToTypeAnnotation(enclosingLibraryElement, elementType.returnType,
+ functionReturnType);
+ }
+ applyParameters(enclosingLibraryElement, elementType.parameters,
+ functionParameterList);
+ }
+ }
+ }
+
+ /// Apply the [type] to the [typeAnnotation] by setting the type of the
+ /// [typeAnnotation] to the [type] and recursively applying each of the type
+ /// arguments of the [type] to the corresponding type arguments of the
+ /// [typeAnnotation].
+ static void applyToTypeAnnotation(LibraryElement enclosingLibraryElement,
+ DartType type, TypeAnnotation typeAnnotation) {
+ if (typeAnnotation is GenericFunctionTypeImpl) {
+ if (type is! FunctionType) {
+ throw new StateError('Non-function type ($type) '
+ 'for generic function annotation ($typeAnnotation)');
+ }
+ FunctionType functionType = type;
+ typeAnnotation.type = type;
+ applyToTypeAnnotation(enclosingLibraryElement, functionType.returnType,
+ typeAnnotation.returnType);
+ applyParameters(enclosingLibraryElement, functionType.parameters,
+ typeAnnotation.parameters);
+ } else if (typeAnnotation is TypeNameImpl) {
+ typeAnnotation.type = type;
+
+ Identifier typeIdentifier = typeAnnotation.name;
+ SimpleIdentifier typeName;
+ if (typeIdentifier is PrefixedIdentifier) {
+ if (enclosingLibraryElement != null) {
+ String prefixName = typeIdentifier.prefix.name;
+ for (var import in enclosingLibraryElement.imports) {
+ if (import.prefix?.name == prefixName) {
+ typeIdentifier.prefix.staticElement = import.prefix;
+ break;
+ }
+ }
+ }
+ typeName = typeIdentifier.identifier;
+ } else {
+ typeName = typeIdentifier;
+ }
+
+ Element typeElement = type.element;
+ if (typeElement is GenericFunctionTypeElement &&
+ typeElement.enclosingElement is GenericTypeAliasElement) {
+ typeElement = typeElement.enclosingElement;
+ }
+
+ typeName.staticElement = typeElement;
+ typeName.staticType = type;
+ }
+ if (typeAnnotation is NamedType) {
+ TypeArgumentList typeArguments = typeAnnotation.typeArguments;
+ if (typeArguments != null) {
+ _applyTypeArgumentsToList(
+ enclosingLibraryElement, type, typeArguments.arguments);
+ }
+ }
+ }
+
/**
* Associate each of the annotation [nodes] with the corresponding
* [ElementAnnotation] in [annotations]. If there is a problem, report it
@@ -767,6 +927,31 @@
}
}
+ /// Recursively apply each of the type arguments of the [type] to the
+ /// corresponding type arguments of the [typeArguments].
+ static void _applyTypeArgumentsToList(LibraryElement enclosingLibraryElement,
+ DartType type, List<TypeAnnotation> typeArguments) {
+ if (type != null && type.isUndefined) {
+ for (TypeAnnotation argument in typeArguments) {
+ applyToTypeAnnotation(enclosingLibraryElement, type, argument);
+ }
+ } else if (type is ParameterizedType) {
+ List<DartType> argumentTypes = type.typeArguments;
+ int argumentCount = argumentTypes.length;
+ if (argumentCount != typeArguments.length) {
+ throw new StateError('Found $argumentCount argument types '
+ 'for ${typeArguments.length} type arguments');
+ }
+ for (int i = 0; i < argumentCount; i++) {
+ applyToTypeAnnotation(
+ enclosingLibraryElement, argumentTypes[i], typeArguments[i]);
+ }
+ } else {
+ throw new StateError('Attempting to apply a non-parameterized type '
+ '(${type.runtimeType}) to type arguments');
+ }
+ }
+
static bool _isBodyToCreateElementsFor(FunctionBody node) {
AstNode parent = node.parent;
return parent is ConstructorDeclaration ||
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 94c6855..a782664 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -1622,33 +1622,45 @@
*/
DartType _instantiateGenericMethod(
DartType invokeType, TypeArgumentList typeArguments, AstNode node) {
- // TODO(jmesserly): support generic "call" methods on InterfaceType.
+ DartType parameterizableType;
+ List<TypeParameterElement> parameters;
if (invokeType is FunctionType) {
- List<TypeParameterElement> parameters = invokeType.typeFormals;
+ parameterizableType = invokeType;
+ parameters = invokeType.typeFormals;
+ } else if (invokeType is InterfaceType) {
+ MethodElement callMethod = invokeType.lookUpMethod(
+ FunctionElement.CALL_METHOD_NAME, _resolver.definingLibrary);
+ parameterizableType = callMethod?.type;
+ parameters = (parameterizableType as FunctionType)?.typeFormals;
+ }
+ if (parameterizableType is ParameterizedType) {
NodeList<TypeAnnotation> arguments = typeArguments?.arguments;
if (arguments != null && arguments.length != parameters.length) {
if (_resolver.strongMode) {
_resolver.errorReporter.reportErrorForNode(
StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD,
node,
- [invokeType, parameters.length, arguments?.length ?? 0]);
+ [parameterizableType, parameters.length, arguments?.length ?? 0]);
} else {
_resolver.errorReporter.reportErrorForNode(
HintCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD,
node,
- [invokeType, parameters.length, arguments?.length ?? 0]);
+ [parameterizableType, parameters.length, arguments?.length ?? 0]);
}
// Wrong number of type arguments. Ignore them.
arguments = null;
}
if (parameters.isNotEmpty) {
if (arguments == null) {
- return _resolver.typeSystem.instantiateToBounds(invokeType);
+ return _resolver.typeSystem.instantiateToBounds(parameterizableType);
} else {
- return invokeType.instantiate(arguments.map((n) => n.type).toList());
+ return parameterizableType
+ .instantiate(arguments.map((n) => n.type).toList());
}
}
+
+ return parameterizableType;
}
return invokeType;
}
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 64e7011..3d48bbb 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -1387,7 +1387,7 @@
* A flag indicating whether declaration casts are allowed in [strongMode]
* (they are always allowed in Dart 1.0 mode).
*
- * This option is experimental and subject to change.
+ * This option is deprecated and will be removed in a future release.
*/
bool declarationCasts = true;
@@ -2567,8 +2567,9 @@
* Initialize a newly created exception to represent the removal of the given
* [source].
*/
- ObsoleteSourceAnalysisException(Source source) : super("The source '${source
- .fullName}' was removed while it was being analyzed") {
+ ObsoleteSourceAnalysisException(Source source)
+ : super(
+ "The source '${source.fullName}' was removed while it was being analyzed") {
this._source = source;
}
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 1371020..25343f2 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -467,10 +467,10 @@
_checkForAbstractSuperMemberReference(realTarget, node.methodName);
_checkForNullAwareHints(node, node.operator);
DartType staticInvokeType = node.staticInvokeType;
- if (staticInvokeType is InterfaceType) {
- MethodElement methodElement = staticInvokeType.lookUpMethod(
- FunctionElement.CALL_METHOD_NAME, _currentLibrary);
- _checkForDeprecatedMemberUse(methodElement, node);
+ Element callElement = staticInvokeType?.element;
+ if (callElement is MethodElement &&
+ callElement.name == FunctionElement.CALL_METHOD_NAME) {
+ _checkForDeprecatedMemberUse(callElement, node);
}
return super.visitMethodInvocation(node);
}
@@ -793,9 +793,8 @@
} else if (displayName == FunctionElement.CALL_METHOD_NAME &&
node is MethodInvocation &&
node.staticInvokeType is InterfaceType) {
- displayName = "${resolutionMap
- .staticInvokeTypeForInvocationExpression(node)
- .displayName}.${element.displayName}";
+ displayName =
+ "${resolutionMap.staticInvokeTypeForInvocationExpression(node).displayName}.${element.displayName}";
}
_errorReporter.reportErrorForNode(
HintCode.DEPRECATED_MEMBER_USE, node, [displayName]);
@@ -4706,8 +4705,7 @@
typeAnalyzer.thisType = enclosingClass?.type;
if (enclosingClass == null) {
AnalysisEngine.instance.logger.logInformation(
- "Missing element for class declaration ${node.name
- .name} in ${definingLibrary.source.fullName}",
+ "Missing element for class declaration ${node.name.name} in ${definingLibrary.source.fullName}",
new CaughtException(new AnalysisException(), null));
// Don't try to re-resolve the initializers if we cannot set up the
// right name scope for resolution.
@@ -7443,8 +7441,7 @@
try {
if (classElement == null) {
AnalysisEngine.instance.logger.logInformation(
- "Missing element for class declaration ${node.name
- .name} in ${definingLibrary.source.fullName}",
+ "Missing element for class declaration ${node.name.name} in ${definingLibrary.source.fullName}",
new CaughtException(new AnalysisException(), null));
super.visitClassDeclaration(node);
} else {
@@ -7572,8 +7569,7 @@
try {
if (classElement == null) {
AnalysisEngine.instance.logger.logInformation(
- "Missing element for enum declaration ${node.name
- .name} in ${definingLibrary.source.fullName}",
+ "Missing element for enum declaration ${node.name.name} in ${definingLibrary.source.fullName}",
new CaughtException(new AnalysisException(), null));
super.visitEnumDeclaration(node);
} else {
@@ -7689,8 +7685,7 @@
try {
if (functionElement == null) {
AnalysisEngine.instance.logger.logInformation(
- "Missing element for top-level function ${node.name
- .name} in ${definingLibrary.source.fullName}",
+ "Missing element for top-level function ${node.name.name} in ${definingLibrary.source.fullName}",
new CaughtException(new AnalysisException(), null));
} else {
nameScope = new FunctionScope(nameScope, functionElement);
@@ -7766,8 +7761,7 @@
ParameterElement parameterElement = node.element;
if (parameterElement == null) {
AnalysisEngine.instance.logger.logInformation(
- "Missing element for function typed formal parameter ${node
- .identifier.name} in ${definingLibrary.source.fullName}",
+ "Missing element for function typed formal parameter ${node.identifier.name} in ${definingLibrary.source.fullName}",
new CaughtException(new AnalysisException(), null));
} else {
nameScope = new EnclosedScope(nameScope);
@@ -7868,8 +7862,7 @@
ExecutableElement methodElement = node.element;
if (methodElement == null) {
AnalysisEngine.instance.logger.logInformation(
- "Missing element for method ${node.name.name} in ${definingLibrary
- .source.fullName}",
+ "Missing element for method ${node.name.name} in ${definingLibrary.source.fullName}",
new CaughtException(new AnalysisException(), null));
} else {
nameScope = new FunctionScope(nameScope, methodElement);
diff --git a/pkg/analyzer/lib/src/generated/type_system.dart b/pkg/analyzer/lib/src/generated/type_system.dart
index 3158176..f0c4a9cd 100644
--- a/pkg/analyzer/lib/src/generated/type_system.dart
+++ b/pkg/analyzer/lib/src/generated/type_system.dart
@@ -215,6 +215,22 @@
// more errors (e.g. because `dynamic` is the most common bound).
}
+ if (inferred is FunctionType && inferred.typeFormals.isNotEmpty) {
+ errorReporter
+ ?.reportErrorForNode(StrongModeCode.COULD_NOT_INFER, errorNode, [
+ typeParam,
+ ' Inferred candidate type $inferred has type parameters'
+ ' ${(inferred as FunctionType).typeFormals}, but a function with'
+ ' type parameters cannot be used as a type argument.'
+ ]);
+
+ // Heuristic: Using a generic function type as a bound makes subtyping
+ // undecidable. Therefore, we cannot keep [inferred] unless we wish to
+ // generate bogus subtyping errors. Instead generate plain [Function],
+ // which is the most general function type.
+ inferred = typeProvider.functionType;
+ }
+
if (UnknownInferredType.isKnown(inferred)) {
knownTypes[typeParam] = inferred;
}
@@ -828,10 +844,10 @@
*/
DartType getLeastNullableSupertype(InterfaceType type) {
// compute set of supertypes
- List<InterfaceType> s = InterfaceTypeImpl
- .computeSuperinterfaceSet(type, strong: true)
- .where(isNullableType)
- .toList();
+ List<InterfaceType> s =
+ InterfaceTypeImpl.computeSuperinterfaceSet(type, strong: true)
+ .where(isNullableType)
+ .toList();
return InterfaceTypeImpl.computeTypeAtMaxUniqueDepth(s);
}
diff --git a/pkg/analyzer/lib/src/kernel/resynthesize.dart b/pkg/analyzer/lib/src/kernel/resynthesize.dart
index d3bf1e4..bdbb2c8 100644
--- a/pkg/analyzer/lib/src/kernel/resynthesize.dart
+++ b/pkg/analyzer/lib/src/kernel/resynthesize.dart
@@ -111,11 +111,15 @@
}
String libraryUri = components[--componentPtr];
- String topKindOrClassName = components[--componentPtr];
-
LibraryElementImpl library = getLibrary(libraryUri);
if (library == null) return null;
+ if (componentPtr == 0) {
+ return library;
+ }
+
+ String topKindOrClassName = components[--componentPtr];
+
String takeElementName() {
String publicNameOrLibraryUri = components[--componentPtr];
if (publicNameOrLibraryUri == libraryUri) {
@@ -217,7 +221,9 @@
});
}
- DartType getType(ElementImpl context, kernel.DartType kernelType) {
+ DartType getType(ElementImpl context, kernel.DartType kernelType,
+ {TypeParameterElement Function(kernel.TypeParameter)
+ getLocalTypeParameter}) {
if (kernelType is kernel.DynamicType) return DynamicTypeImpl.instance;
if (kernelType is kernel.InvalidType) return UndefinedTypeImpl.instance;
if (kernelType is kernel.BottomType) return BottomTypeImpl.instance;
@@ -230,16 +236,20 @@
name.parent.name == 'dart:async') {
return DynamicTypeImpl.instance;
}
- return _getInterfaceType(context, name, kernelType.typeArguments);
+ return _getInterfaceType(context, name, kernelType.typeArguments,
+ getLocalTypeParameter: getLocalTypeParameter);
}
if (kernelType is kernel.TypeParameterType) {
kernel.TypeParameter kTypeParameter = kernelType.parameter;
- return getTypeParameter(context, kTypeParameter).type;
+ return getTypeParameter(context, kTypeParameter,
+ getLocalTypeParameter: getLocalTypeParameter)
+ .type;
}
if (kernelType is kernel.FunctionType) {
- return _getFunctionType(context, kernelType);
+ return _getFunctionType(context, kernelType,
+ getLocalTypeParameter: getLocalTypeParameter);
}
// TODO(scheglov) Support other kernel types.
@@ -248,7 +258,13 @@
/// Return the [TypeParameterElement] for the given [kernelTypeParameter].
TypeParameterElement getTypeParameter(
- ElementImpl context, kernel.TypeParameter kernelTypeParameter) {
+ ElementImpl context, kernel.TypeParameter kernelTypeParameter,
+ {TypeParameterElement Function(kernel.TypeParameter)
+ getLocalTypeParameter}) {
+ if (getLocalTypeParameter != null) {
+ var translatedElement = getLocalTypeParameter(kernelTypeParameter);
+ if (translatedElement != null) return translatedElement;
+ }
String name = kernelTypeParameter.name;
for (var ctx = context; ctx != null; ctx = ctx.enclosingElement) {
if (ctx is TypeParameterizedElementMixin) {
@@ -275,9 +291,12 @@
/// Return the [FunctionType] that corresponds to the given [kernelType].
FunctionType _getFunctionType(
- ElementImpl context, kernel.FunctionType kernelType) {
+ ElementImpl context, kernel.FunctionType kernelType,
+ {TypeParameterElement Function(kernel.TypeParameter)
+ getLocalTypeParameter}) {
if (kernelType.typedef != null) {
- var translatedType = _getTypedefType(context, kernelType);
+ var translatedType = _getTypedefType(context, kernelType,
+ getLocalTypeParameter: getLocalTypeParameter);
if (translatedType != null) return translatedType;
}
@@ -307,13 +326,16 @@
namedParameters);
element.parameters = astParameters;
- element.returnType = getType(element, kernelType.returnType);
+ element.returnType = getType(element, kernelType.returnType,
+ getLocalTypeParameter: getLocalTypeParameter);
return new FunctionTypeImpl(element);
}
InterfaceType _getInterfaceType(ElementImpl context,
- kernel.CanonicalName className, List<kernel.DartType> kernelArguments) {
+ kernel.CanonicalName className, List<kernel.DartType> kernelArguments,
+ {TypeParameterElement Function(kernel.TypeParameter)
+ getLocalTypeParameter}) {
var libraryName = className.parent;
var libraryElement = getLibrary(libraryName.name);
ClassElement classElement = libraryElement.getType(className.name);
@@ -326,7 +348,8 @@
return new InterfaceTypeImpl.elementWithNameAndArgs(
classElement, classElement.name, () {
List<DartType> arguments = kernelArguments
- .map((kernel.DartType k) => getType(context, k))
+ .map((kernel.DartType k) =>
+ getType(context, k, getLocalTypeParameter: getLocalTypeParameter))
.toList(growable: false);
return arguments;
});
@@ -342,7 +365,9 @@
/// Return the [FunctionType] for the given typedef based [kernelType].
FunctionType _getTypedefType(
- ElementImpl context, kernel.FunctionType kernelType) {
+ ElementImpl context, kernel.FunctionType kernelType,
+ {TypeParameterElement Function(kernel.TypeParameter)
+ getLocalTypeParameter}) {
kernel.Typedef typedef = kernelType.typedef;
GenericTypeAliasElementImpl typedefElement =
@@ -372,7 +397,8 @@
// Convert kernel type arguments into Analyzer types.
var typeArguments = typedef.typeParameters
.map((t) => substitution.containsKey(t)
- ? getType(context, substitution[t])
+ ? getType(context, substitution[t],
+ getLocalTypeParameter: getLocalTypeParameter)
: _typeProvider.nullType)
.toList();
return typedefElement.instantiate(typeArguments);
@@ -420,14 +446,6 @@
}
/**
- * This exception is thrown when we detect that the Kernel has a compilation
- * error, so we cannot resynthesize the constant expression.
- */
-class _CompilationErrorFound {
- const _CompilationErrorFound();
-}
-
-/**
* Builder of [Expression]s from [kernel.Expression]s.
*/
class _ExprBuilder {
@@ -437,11 +455,10 @@
_ExprBuilder(this._context, this._contextElement);
Expression build(kernel.Expression expr) {
- try {
- return _build(expr);
- } on _CompilationErrorFound {
+ if (_hasInvalidExpression(expr)) {
return AstTestFactory.identifier3('#invalidConst');
}
+ return _build(expr);
}
ConstructorInitializer buildInitializer(kernel.Initializer k) {
@@ -556,22 +573,6 @@
return AstTestFactory.mapLiteral(keyword, typeArguments, entries);
}
- // Invalid initializers and annotations are represented as Let.
- if (expr is kernel.Let) {
- var body = expr.body;
- if (body is kernel.Let) {
- var initializer = body.variable.initializer;
- if (initializer is kernel.Let && _isStaticError(initializer.body)) {
- throw const _CompilationErrorFound();
- }
- }
- }
-
- // Stop if there is an error.
- if (_isStaticError(expr)) {
- throw const _CompilationErrorFound();
- }
-
if (expr is kernel.StaticGet) {
return _buildIdentifier(expr.targetReference, isGet: true);
}
@@ -730,9 +731,6 @@
}
SimpleIdentifier _buildSimpleIdentifier(kernel.Reference reference) {
- if (reference == null) {
- throw const _CompilationErrorFound();
- }
String name = reference.canonicalName.name;
SimpleIdentifier identifier = AstTestFactory.identifier3(name);
Element element = _getElement(reference);
@@ -823,12 +821,19 @@
throw new ArgumentError(name);
}
- /**
- * Return `true` if the given [expr] throws an instance of
- * `_ConstantExpressionError` defined in `dart:core`.
- */
- static bool _isStaticError(kernel.Expression expr) {
- return expr is kernel.InvalidExpression;
+ static bool _hasInvalidExpression(kernel.Expression expr) {
+ var visitor = new _HasInvalidExpressionVisitor();
+ expr.accept(visitor);
+ return visitor.result;
+ }
+}
+
+class _HasInvalidExpressionVisitor extends kernel.RecursiveVisitor<void> {
+ bool result = false;
+
+ @override
+ void visitInvalidExpression(kernel.InvalidExpression node) {
+ result = true;
}
}
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index 6cfa78a..a1ee440 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -1425,7 +1425,7 @@
/// [covariantInterfaces] that may allow those members to be called in an
/// unsound way.
///
- /// See [_findCovariantChecksForMember] for more information and an exmaple.
+ /// See [_findCovariantChecksForMember] for more information and an example.
Set<Element> _findCovariantChecks(Iterable<ExecutableElement> members,
Iterable<ClassElement> covariantInterfaces,
[Set<Element> covariantChecks]) {
diff --git a/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_kernel_test.dart b/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_kernel_test.dart
index 7ffb604..28e878d 100644
--- a/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_kernel_test.dart
@@ -112,6 +112,13 @@
await super.test_fieldFormalParameterNotAssignableToField_typedef();
}
+ @override
+ @failingTest
+ test_fieldFormalParameterAssignableToField_typeSubstitution() {
+ // Bad state: Not found #lib1::A::T in null
+ return super.test_fieldFormalParameterAssignableToField_typeSubstitution();
+ }
+
@failingTest
@override
test_fieldInitializerNotAssignable() async {
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
index e3f152c..814034c 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
@@ -115,21 +115,24 @@
@override
@failingTest
test_conflictingConstructorNameAndMember_field() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, found 0
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR, found 0;
+ // 1 errors of type CompileTimeErrorCode.CONFLICTS_WITH_MEMBER, found 0
await super.test_conflictingConstructorNameAndMember_field();
}
@override
@failingTest
test_conflictingConstructorNameAndMember_getter() async {
- // Bad state: No type information for 42 at 25
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR, found 0;
+ // 1 errors of type CompileTimeErrorCode.CONFLICTS_WITH_MEMBER, found 0
await super.test_conflictingConstructorNameAndMember_getter();
}
@override
@failingTest
test_conflictingConstructorNameAndMember_method() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, found 0
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR, found 0;
+ // 1 errors of type CompileTimeErrorCode.CONFLICTS_WITH_MEMBER, found 0
await super.test_conflictingConstructorNameAndMember_method();
}
@@ -150,69 +153,7 @@
@override
@failingTest
- test_conflictingGetterAndMethod_field_method() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD, found 0
- await super.test_conflictingGetterAndMethod_field_method();
- }
-
- @override
- @failingTest
- test_conflictingGetterAndMethod_getter_method() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD, found 0
- await super.test_conflictingGetterAndMethod_getter_method();
- }
-
- @override
- @failingTest
- test_conflictingGetterAndMethod_method_field() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER, found 0
- await super.test_conflictingGetterAndMethod_method_field();
- }
-
- @override
- @failingTest
- test_conflictingGetterAndMethod_method_getter() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER, found 0
- await super.test_conflictingGetterAndMethod_method_getter();
- }
-
- @override
- @failingTest
- test_conflictingTypeVariableAndClass() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS, found 0
- await super.test_conflictingTypeVariableAndClass();
- }
-
- @override
- @failingTest
- test_conflictingTypeVariableAndMember_field() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
- await super.test_conflictingTypeVariableAndMember_field();
- }
-
- @override
- @failingTest
- test_conflictingTypeVariableAndMember_getter() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
- await super.test_conflictingTypeVariableAndMember_getter();
- }
-
- @override
- @failingTest
- test_conflictingTypeVariableAndMember_method() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
- await super.test_conflictingTypeVariableAndMember_method();
- }
-
- @override
- @failingTest
- test_conflictingTypeVariableAndMember_method_static() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
- await super.test_conflictingTypeVariableAndMember_method_static();
- }
-
- @override
- @failingTest
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/33827')
test_conflictingTypeVariableAndMember_setter() async {
// Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
await super.test_conflictingTypeVariableAndMember_setter();
@@ -226,6 +167,13 @@
@override
@failingTest
+ test_constConstructor_redirect_generic() {
+ // Bad state: Not found #lib4::A::T in null
+ return super.test_constConstructor_redirect_generic();
+ }
+
+ @override
+ @failingTest
test_constConstructorWithFieldInitializedByNonConst() async {
// Expected 1 errors of type CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST, found 0;
// 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
@@ -643,13 +591,6 @@
@override
@failingTest
- test_duplicateDefinition_catch() async {
- // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0
- await super.test_duplicateDefinition_catch();
- }
-
- @override
- @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30857')
test_duplicateDefinition_classMembers_fields() async {
return super.test_duplicateDefinition_classMembers_fields();
@@ -678,13 +619,6 @@
@override
@failingTest
- test_duplicateDefinition_parameters_inLocalFunction() async {
- // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0
- await super.test_duplicateDefinition_parameters_inLocalFunction();
- }
-
- @override
- @failingTest
test_duplicateDefinitionInheritance_instanceGetter_staticGetter() async {
// Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE, found 0
await super
@@ -804,13 +738,6 @@
@override
@failingTest
- test_extraPositionalArguments_const() async {
- // Bad state: No type information for A at 42
- await super.test_extraPositionalArguments_const();
- }
-
- @override
- @failingTest
test_extraPositionalArguments_const_super() async {
// Bad state: No type information for 0 at 65
await super.test_extraPositionalArguments_const_super();
@@ -839,34 +766,6 @@
@override
@failingTest
- test_fieldInitializedByMultipleInitializers() async {
- // Bad state: No reference information for = at 36
- await super.test_fieldInitializedByMultipleInitializers();
- }
-
- @override
- @failingTest
- test_fieldInitializedByMultipleInitializers_multipleInits() async {
- // Bad state: No reference information for = at 36
- await super.test_fieldInitializedByMultipleInitializers_multipleInits();
- }
-
- @override
- @failingTest
- test_fieldInitializedByMultipleInitializers_multipleNames() async {
- // Bad state: Expected element reference for analyzer offset 45; got one for kernel offset 52
- await super.test_fieldInitializedByMultipleInitializers_multipleNames();
- }
-
- @override
- @failingTest
- test_fieldInitializedInParameterAndInitializer() async {
- // Bad state: No reference information for = at 35
- await super.test_fieldInitializedInParameterAndInitializer();
- }
-
- @override
- @failingTest
test_fieldInitializerFactoryConstructor() async {
// Expected 1 errors of type CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR, found 0
await super.test_fieldInitializerFactoryConstructor();
@@ -904,36 +803,6 @@
@override
@failingTest
- test_finalInitializedMultipleTimes_initializers() async {
- // Bad state: No reference information for = at 38
- await super.test_finalInitializedMultipleTimes_initializers();
- }
-
- @override
- @failingTest
- test_finalInitializedMultipleTimes_initializingFormal_initializer() async {
- // Bad state: No reference information for = at 37
- await super
- .test_finalInitializedMultipleTimes_initializingFormal_initializer();
- }
-
- @override
- @failingTest
- test_finalInitializedMultipleTimes_initializingFormals() async {
- // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0;
- // 1 errors of type CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES, found 0
- await super.test_finalInitializedMultipleTimes_initializingFormals();
- }
-
- @override
- @failingTest
- test_finalNotInitialized_local_const() async {
- // Expected 1 errors of type CompileTimeErrorCode.CONST_NOT_INITIALIZED, found 0
- await super.test_finalNotInitialized_local_const();
- }
-
- @override
- @failingTest
test_fromEnvironment_bool_badArgs() async {
// Expected 2 errors of type CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, found 0;
// 2 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
@@ -972,6 +841,27 @@
@override
@failingTest
@potentialAnalyzerProblem
+ test_genericFunctionTypeArgument_inference_function() async {
+ await super.test_genericFunctionTypeArgument_inference_function();
+ }
+
+ @override
+ @failingTest
+ @potentialAnalyzerProblem
+ test_genericFunctionTypeArgument_inference_functionType() async {
+ await super.test_genericFunctionTypeArgument_inference_functionType();
+ }
+
+ @override
+ @failingTest
+ @potentialAnalyzerProblem
+ test_genericFunctionTypeArgument_inference_method() async {
+ await super.test_genericFunctionTypeArgument_inference_method();
+ }
+
+ @override
+ @failingTest
+ @potentialAnalyzerProblem
test_genericFunctionTypeArgument_method() async {
await super.test_genericFunctionTypeArgument_method();
}
@@ -2193,13 +2083,6 @@
@override
@failingTest
- test_notEnoughRequiredArguments_const() async {
- // Bad state: No type information for A at 47
- await super.test_notEnoughRequiredArguments_const();
- }
-
- @override
- @failingTest
test_optionalParameterInOperator_named() async {
// Expected 1 errors of type CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR, found 0
await super.test_optionalParameterInOperator_named();
@@ -2815,13 +2698,6 @@
@override
@failingTest
- test_undefinedNamedParameter() async {
- // Bad state: No type information for A at 42
- await super.test_undefinedNamedParameter();
- }
-
- @override
- @failingTest
test_uriDoesNotExist_export() async {
// Expected 1 errors of type CompileTimeErrorCode.URI_DOES_NOT_EXIST, found 0
await super.test_uriDoesNotExist_export();
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index 18567fb..fb0d657 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -585,16 +585,6 @@
verify([source]);
}
- test_builtInIdentifierAsType_dynamicMissingPrefix() async {
- Source source = addSource(r"""
-import 'dart:core' as core;
-
-dynamic x;
-""");
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
- }
-
test_builtInIdentifierAsMixinName_classTypeAlias() async {
Source source = addSource(r'''
class A {}
@@ -621,6 +611,16 @@
verify([source]);
}
+ test_builtInIdentifierAsType_dynamicMissingPrefix() async {
+ Source source = addSource(r"""
+import 'dart:core' as core;
+
+dynamic x;
+""");
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
+ }
+
test_builtInIdentifierAsType_formalParameter_field() async {
Source source = addSource(r'''
class A {
@@ -731,7 +731,13 @@
}''');
await computeAnalysisResult(source);
assertErrors(
- source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
+ source,
+ useCFE
+ ? [
+ CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR,
+ CompileTimeErrorCode.CONFLICTS_WITH_MEMBER
+ ]
+ : [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
verify([source]);
}
@@ -743,7 +749,13 @@
}''');
await computeAnalysisResult(source);
assertErrors(
- source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
+ source,
+ useCFE
+ ? [
+ CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR,
+ CompileTimeErrorCode.CONFLICTS_WITH_MEMBER
+ ]
+ : [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
verify([source]);
}
@@ -755,7 +767,13 @@
}''');
await computeAnalysisResult(source);
assertErrors(
- source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD]);
+ source,
+ useCFE
+ ? [
+ CompileTimeErrorCode.CONFLICTS_WITH_CONSTRUCTOR,
+ CompileTimeErrorCode.CONFLICTS_WITH_MEMBER
+ ]
+ : [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD]);
verify([source]);
}
@@ -818,7 +836,11 @@
m() {}
}''');
await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.DECLARED_MEMBER_CONFLICTS_WITH_INHERITED]
+ : [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
verify([source]);
}
@@ -831,7 +853,11 @@
m() {}
}''');
await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.DECLARED_MEMBER_CONFLICTS_WITH_INHERITED]
+ : [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
verify([source]);
}
@@ -844,7 +870,11 @@
int m;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.DECLARED_MEMBER_CONFLICTS_WITH_INHERITED]
+ : [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
verify([source]);
}
@@ -857,7 +887,11 @@
get m => 0;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.DECLARED_MEMBER_CONFLICTS_WITH_INHERITED]
+ : [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
verify([source]);
}
@@ -2515,8 +2549,13 @@
A() : x = 0, x = 1 {}
}''');
await computeAnalysisResult(source);
- assertErrors(source,
- [CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]
+ : [
+ CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
+ ]);
verify([source]);
}
@@ -2527,10 +2566,17 @@
A() : x = 0, x = 1, x = 2 {}
}''');
await computeAnalysisResult(source);
- assertErrors(source, [
- CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
- CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
- ]);
+ assertErrors(
+ source,
+ useCFE
+ ? [
+ CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES,
+ CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES
+ ]
+ : [
+ CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
+ CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
+ ]);
verify([source]);
}
@@ -2542,10 +2588,17 @@
A() : x = 0, x = 1, y = 0, y = 1 {}
}''');
await computeAnalysisResult(source);
- assertErrors(source, [
- CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
- CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
- ]);
+ assertErrors(
+ source,
+ useCFE
+ ? [
+ CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES,
+ CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES
+ ]
+ : [
+ CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
+ CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
+ ]);
verify([source]);
}
@@ -2556,8 +2609,14 @@
A(this.x) : x = 1 {}
}''');
await computeAnalysisResult(source);
- assertErrors(source,
- [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]
+ : [
+ CompileTimeErrorCode
+ .FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER
+ ]);
verify([source]);
}
@@ -2658,8 +2717,13 @@
A() : x = 0, x = 0 {}
}''');
await computeAnalysisResult(source);
- assertErrors(source,
- [CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]
+ : [
+ CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
+ ]);
verify([source]);
}
@@ -2678,8 +2742,14 @@
A(this.x) : x = 0 {}
}''');
await computeAnalysisResult(source);
- assertErrors(source,
- [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]
+ : [
+ CompileTimeErrorCode
+ .FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER
+ ]);
verify([source]);
}
@@ -2788,41 +2858,32 @@
verify([source]);
}
- @failingTest
test_genericFunctionTypeArgument_inference_function() async {
- // TODO(mfairhurst) how should these inference errors be reported?
Source source = addSource(r'''
-T f<T>(T) => null;
+T f<T>(T t) => null;
main() { f(<S>(S s) => s); }''');
await computeAnalysisResult(source);
- assertErrors(source,
- [CompileTimeErrorCode.GENERIC_FUNCTION_CANNOT_BE_TYPE_ARGUMENT]);
+ assertErrors(source, [StrongModeCode.COULD_NOT_INFER]);
verify([source]);
}
- @failingTest
test_genericFunctionTypeArgument_inference_functionType() async {
- // TODO(mfairhurst) how should these inference errors be reported?
Source source = addSource(r'''
T Function<T>(T) f;
main() { f(<S>(S s) => s); }''');
await computeAnalysisResult(source);
- assertErrors(source,
- [CompileTimeErrorCode.GENERIC_FUNCTION_CANNOT_BE_TYPE_ARGUMENT]);
+ assertErrors(source, [StrongModeCode.COULD_NOT_INFER]);
verify([source]);
}
- @failingTest
test_genericFunctionTypeArgument_inference_method() async {
- // TODO(mfairhurst) how should these inference errors be reported?
Source source = addSource(r'''
class C {
- T f<T>(T) => null;
+ T f<T>(T t) => null;
}
main() { new C().f(<S>(S s) => s); }''');
await computeAnalysisResult(source);
- assertErrors(source,
- [CompileTimeErrorCode.GENERIC_FUNCTION_CANNOT_BE_TYPE_ARGUMENT]);
+ assertErrors(source, [StrongModeCode.COULD_NOT_INFER]);
verify([source]);
}
diff --git a/pkg/analyzer/test/generated/declaration_resolver_test.dart b/pkg/analyzer/test/generated/declaration_resolver_test.dart
index 119bbd9..af92fd6 100644
--- a/pkg/analyzer/test/generated/declaration_resolver_test.dart
+++ b/pkg/analyzer/test/generated/declaration_resolver_test.dart
@@ -10,7 +10,6 @@
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/generated/declaration_resolver.dart';
-import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/task/api/dart.dart';
import 'package:analyzer/src/task/dart.dart';
diff --git a/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart b/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart
index e668382..05e55e1 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart
@@ -55,6 +55,21 @@
@override
@failingTest
+ test_argumentTypeNotAssignable_fieldFormalParameterElement_member() {
+ // Bad state: Not found #lib1::TimestampedObject::E in null
+ return super
+ .test_argumentTypeNotAssignable_fieldFormalParameterElement_member();
+ }
+
+ @override
+ @failingTest
+ test_argumentTypeNotAssignable_optionalNew() {
+ // NoSuchMethodError: The method 'encloseElement' was called on null.
+ return super.test_argumentTypeNotAssignable_optionalNew();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_beforeConstructor() async {
return super.test_commentReference_beforeConstructor();
@@ -192,16 +207,16 @@
@override
@failingTest
- @FastaProblem('https://github.com/dart-lang/sdk/issues/31758')
- test_invocationOfNonFunction_Object() async {
- return super.test_invocationOfNonFunction_Object();
+ test_invocationOfNonFunction_functionTypeTypeParameter() {
+ // Bad state: Not found #lib2::C::T in null
+ return super.test_invocationOfNonFunction_functionTypeTypeParameter();
}
@override
@failingTest
- @potentialAnalyzerProblem
- test_loadLibraryDefined() async {
- return super.test_loadLibraryDefined();
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31758')
+ test_invocationOfNonFunction_Object() async {
+ return super.test_invocationOfNonFunction_Object();
}
@override
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index 19d4b8e..c47e992 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -2085,7 +2085,7 @@
test_forEach_genericFunctionType() async {
Source source = addSource(r'''
main() {
- for (Null Function<T>(T, Null) e in []) {
+ for (Null Function<T>(T, Null) e in <dynamic>[]) {
e;
}
}''');
@@ -3570,6 +3570,32 @@
verify([source]);
}
+ Future test_issue32114() async {
+ addNamedSource('/a.dart', '''
+class O {}
+
+typedef T Func<T extends O>(T e);
+''');
+ addNamedSource('/b.dart', '''
+import 'a.dart';
+export 'a.dart' show Func;
+
+abstract class A<T extends O> {
+ Func<T> get func;
+}
+''');
+ final Source source = addSource('''
+import 'b.dart';
+
+class B extends A {
+ Func get func => (x) => x;
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
test_issue_24191() async {
Source source = addSource('''
import 'dart:async';
@@ -4940,6 +4966,21 @@
verify([source]);
}
+ test_parametricCallFunction() async {
+ Source source = addSource(r'''
+f() {
+ var c = new C();
+ c<String>().codeUnits;
+}
+
+class C {
+ T call<T>() => null;
+}''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
test_prefixCollidesWithTopLevelMembers() async {
addNamedSource("/lib.dart", r'''
library lib;
@@ -6065,6 +6106,17 @@
assertNoErrors(source);
}
+ Future test_useDynamicWithPrefix() async {
+ final Source source = addSource('''
+import 'dart:core' as core;
+
+core.dynamic dynamicVariable;
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
test_wrongNumberOfParametersForOperator1() async {
await _check_wrongNumberOfParametersForOperator1("<");
await _check_wrongNumberOfParametersForOperator1(">");
@@ -6367,43 +6419,6 @@
verify([source]);
}
- Future test_issue32114() async {
- addNamedSource('/a.dart', '''
-class O {}
-
-typedef T Func<T extends O>(T e);
-''');
- addNamedSource('/b.dart', '''
-import 'a.dart';
-export 'a.dart' show Func;
-
-abstract class A<T extends O> {
- Func<T> get func;
-}
-''');
- final Source source = addSource('''
-import 'b.dart';
-
-class B extends A {
- Func get func => (x) => x;
-}
-''');
- await computeAnalysisResult(source);
- assertNoErrors(source);
- verify([source]);
- }
-
- Future test_useDynamicWithPrefix() async {
- final Source source = addSource('''
-import 'dart:core' as core;
-
-core.dynamic dynamicVariable;
-''');
- await computeAnalysisResult(source);
- assertNoErrors(source);
- verify([source]);
- }
-
Future<Null> _check_wrongNumberOfParametersForOperator(
String name, String parameters) async {
Source source = addSource("""
diff --git a/pkg/analyzer/test/generated/non_hint_code_kernel_test.dart b/pkg/analyzer/test/generated/non_hint_code_kernel_test.dart
index ede068d..82823cb 100644
--- a/pkg/analyzer/test/generated/non_hint_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/non_hint_code_kernel_test.dart
@@ -37,18 +37,12 @@
bool get useCFE => true;
@override
- @failingTest
test_overrideOnNonOverridingField_inInterface() {
- // Expected 1 errors of type
- // StrongModeCode.STRONG_MODE_INVALID_METHOD_OVERRIDE, found 0
return super.test_overrideOnNonOverridingField_inInterface();
}
@override
- @failingTest
test_overrideOnNonOverridingField_inSuperclass() {
- // Expected 1 errors of type
- // StrongModeCode.STRONG_MODE_INVALID_METHOD_OVERRIDE, found 0
return super.test_overrideOnNonOverridingField_inSuperclass();
}
diff --git a/pkg/analyzer/test/generated/parser_fasta_listener.dart b/pkg/analyzer/test/generated/parser_fasta_listener.dart
index 9697a3c..daa3ac4 100644
--- a/pkg/analyzer/test/generated/parser_fasta_listener.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_listener.dart
@@ -795,9 +795,9 @@
}
@override
- void endFunctionTypedFormalParameter() {
+ void endFunctionTypedFormalParameter(Token nameToken) {
end('FunctionTypedFormalParameter');
- super.endFunctionTypedFormalParameter();
+ super.endFunctionTypedFormalParameter(nameToken);
}
@override
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 4ce0687..21c4f38 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -18,7 +18,6 @@
import 'package:analyzer/src/generated/testing/token_factory.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:front_end/src/fasta/scanner/abstract_scanner.dart';
-import 'package:front_end/src/scanner/scanner.dart' as fe;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -89,11 +88,6 @@
bool get usingFastaParser;
/**
- * Flag indicating whether the fasta scanner is being used.
- */
- bool get usingFastaScanner;
-
- /**
* Assert that the number and codes of errors occurred during parsing is the
* same as the [expectedErrorCodes].
*/
@@ -2593,7 +2587,7 @@
expectedError(
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, 10, 8),
expectedError(ParserErrorCode.EXPECTED_TOKEN, 19, 1),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 21, 4)
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 19, 1)
]
: [
expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0),
@@ -3075,11 +3069,11 @@
? [
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 9, 5),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 15, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 9, 5),
expectedError(ParserErrorCode.EXPECTED_CLASS_MEMBER, 15, 1),
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 17, 5),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 23, 1)
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 17, 5)
]
: [
expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 15, 1),
@@ -3097,7 +3091,7 @@
expectedError(ParserErrorCode.EXPECTED_CLASS_MEMBER, 10, 1),
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 12, 5),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 18, 1)
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 12, 5)
]
: [
expectedError(ParserErrorCode.EXPECTED_CLASS_MEMBER, 10, 1),
@@ -3137,11 +3131,11 @@
? [
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 0, 5),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 5),
expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 6, 1),
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 8, 5),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 13, 0),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 5),
]
: [
expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 6, 1),
@@ -3178,7 +3172,7 @@
expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 0, 1),
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 2, 5),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 0),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 2, 5),
]
: [
expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 0, 1),
@@ -3193,19 +3187,16 @@
? [
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 0, 1),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 1, 0)
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 1)
]
: [expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 0, 1)]);
}
void test_expectedInterpolationIdentifier() {
StringLiteral literal = parseExpression("'\$x\$'", errors: [
- fe.Scanner.useFasta
- ? (usingFastaParser
- ? expectedError(
- ScannerErrorCode.UNEXPECTED_DOLLAR_IN_STRING, 4, 1)
- : expectedError(ScannerErrorCode.MISSING_IDENTIFIER, 4, 1))
- : expectedError(ParserErrorCode.MISSING_IDENTIFIER, 3, 1)
+ usingFastaParser
+ ? expectedError(ScannerErrorCode.UNEXPECTED_DOLLAR_IN_STRING, 4, 1)
+ : expectedError(ScannerErrorCode.MISSING_IDENTIFIER, 4, 1)
]);
expectNotNullIfNoErrors(literal);
}
@@ -3214,15 +3205,11 @@
// The scanner inserts an empty string token between the two $'s; we need to
// make sure that the MISSING_IDENTIFIER error that is generated has a
// nonzero width so that it will show up in the editor UI.
- StringLiteral literal = parseExpression("'\$\$foo'",
- errors: fe.Scanner.useFasta
- ? [
- (usingFastaParser
- ? expectedError(
- ScannerErrorCode.UNEXPECTED_DOLLAR_IN_STRING, 2, 1)
- : expectedError(ScannerErrorCode.MISSING_IDENTIFIER, 2, 1))
- ]
- : [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 2, 1)]);
+ StringLiteral literal = parseExpression("'\$\$foo'", errors: [
+ usingFastaParser
+ ? expectedError(ScannerErrorCode.UNEXPECTED_DOLLAR_IN_STRING, 2, 1)
+ : expectedError(ScannerErrorCode.MISSING_IDENTIFIER, 2, 1)
+ ]);
expectNotNullIfNoErrors(literal);
}
@@ -3827,7 +3814,7 @@
// TODO(danrubel): Investigate better recovery.
ExpressionStatement statement = result;
listener
- .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 1)]);
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 3)]);
expect(statement.expression.toSource(), 'get');
} else {
FunctionDeclarationStatement statement = result;
@@ -3842,7 +3829,7 @@
// Fasta considers `get` to be an identifier in this situation.
parseStatement("int get x { return _x; }", expectedEndOffset: 8);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 3)]
: [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 4, 3)]);
}
@@ -3850,7 +3837,7 @@
// Fasta considers `get` to be an identifier in this situation.
parseStatement("get x => _x;", expectedEndOffset: 4);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 3)]
: [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 0, 3)]);
}
@@ -3858,7 +3845,7 @@
// Fasta considers `get` to be an identifier in this situation.
parseStatement("int get x => _x;", expectedEndOffset: 8);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 3)]
: [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 4, 3)]);
}
@@ -3963,7 +3950,7 @@
expectNotNullIfNoErrors(statement);
listener.assertErrors(usingFastaParser
? [
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1),
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 8, 1),
expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1)
]
@@ -3979,9 +3966,9 @@
expectNotNullIfNoErrors(statement);
listener.assertErrors(usingFastaParser
? [
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1),
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 9, 1),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 10, 1)
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 9, 1)
]
: [
expectedError(ParserErrorCode.EXPECTED_TOKEN, 5, 1),
@@ -4085,12 +4072,9 @@
void test_invalidInterpolationIdentifier_startWithDigit() {
StringLiteral literal = parseExpression("'\$1'", errors: [
- fe.Scanner.useFasta
- ? (usingFastaParser
- ? expectedError(
- ScannerErrorCode.UNEXPECTED_DOLLAR_IN_STRING, 2, 1)
- : expectedError(ScannerErrorCode.MISSING_IDENTIFIER, 2, 1))
- : expectedError(ParserErrorCode.MISSING_IDENTIFIER, 2, 1)
+ usingFastaParser
+ ? expectedError(ScannerErrorCode.UNEXPECTED_DOLLAR_IN_STRING, 2, 1)
+ : expectedError(ScannerErrorCode.MISSING_IDENTIFIER, 2, 1)
]);
expectNotNullIfNoErrors(literal);
}
@@ -4343,7 +4327,7 @@
void test_localFunctionDeclarationModifier_factory() {
parseCompilationUnit("class C { m() { factory f() {} } }",
errors: usingFastaParser
- ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 24, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 16, 7)]
: [
expectedError(
ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER, 16, 7)
@@ -4537,12 +4521,9 @@
if (usingFastaParser) {
// Fasta scanner reports missing `)` error
listener.assertNoErrors();
- } else if (fe.Scanner.useFasta) {
+ } else {
listener.errors
.contains(expectedError(ParserErrorCode.EXPECTED_TOKEN, 14, 1));
- } else {
- listener
- .assertErrorsWithCodes([ParserErrorCode.MISSING_CLOSING_PARENTHESIS]);
}
}
@@ -4606,7 +4587,7 @@
// error message is in this case.
parseStatement("int f { return x;}", expectedEndOffset: 6);
listener
- .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 1)]);
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 1)]);
}
void test_missingFunctionParameters_local_nonVoid_expression() {
@@ -4622,7 +4603,7 @@
void test_missingFunctionParameters_local_void_block() {
parseStatement("void f { return x;}", expectedEndOffset: 7);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 5, 1)]
: [expectedError(ParserErrorCode.MISSING_FUNCTION_PARAMETERS, 5, 1)]);
}
@@ -4676,7 +4657,7 @@
? [
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 0, 3),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 3, 1)
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 3)
]
: [
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 3, 1),
@@ -4902,26 +4883,16 @@
createParser('(a, {b: 0)');
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
- if (fe.Scanner.useFasta) {
- listener
- .assertErrors([expectedError(ScannerErrorCode.EXPECTED_TOKEN, 9, 1)]);
- } else {
- listener.assertErrorsWithCodes(
- [ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]);
- }
+ listener
+ .assertErrors([expectedError(ScannerErrorCode.EXPECTED_TOKEN, 9, 1)]);
}
void test_missingTerminatorForParameterGroup_optional() {
createParser('(a, [b = 0)');
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
- if (fe.Scanner.useFasta) {
- listener.assertErrors(
- [expectedError(ScannerErrorCode.EXPECTED_TOKEN, 10, 1)]);
- } else {
- listener.assertErrorsWithCodes(
- [ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]);
- }
+ listener
+ .assertErrors([expectedError(ScannerErrorCode.EXPECTED_TOKEN, 10, 1)]);
}
void test_missingTypedefParameters_nonVoid() {
@@ -5388,28 +5359,18 @@
ParserErrorCode.EXPECTED_TOKEN,
ParserErrorCode.EXPECTED_TOKEN
]
- : fe.Scanner.useFasta
- ? [
- ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
- ScannerErrorCode.EXPECTED_TOKEN,
- ScannerErrorCode.EXPECTED_TOKEN,
- ScannerErrorCode.EXPECTED_TOKEN,
- ScannerErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.UNEXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_EXECUTABLE,
- ]
- : [
- ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ]);
+ : [
+ ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
+ ScannerErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.UNEXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_EXECUTABLE,
+ ]);
}
void test_switchCase_missingColon() {
@@ -5556,7 +5517,7 @@
''',
errors: usingFastaParser
? [
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 51, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 49, 1),
expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 51, 1),
]
: [
@@ -5617,7 +5578,7 @@
void test_unexpectedToken_endOfFieldDeclarationStatement() {
parseStatement("String s = (null));", expectedEndOffset: 17);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 17, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 16, 1)]
: [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 17, 1)]);
}
@@ -5665,10 +5626,8 @@
void main() {
var x = "''', errors: [
expectedError(ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 24, 1),
- fe.Scanner.useFasta
- ? expectedError(ScannerErrorCode.EXPECTED_TOKEN, 25, 1)
- : expectedError(ParserErrorCode.EXPECTED_TOKEN, 12, 1),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 25, 0)
+ expectedError(ScannerErrorCode.EXPECTED_TOKEN, 25, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 24, 1)
]);
}
@@ -5695,15 +5654,11 @@
void main() {
var x = """''', codes: [
ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
- fe.Scanner.useFasta
- ? ScannerErrorCode.EXPECTED_TOKEN
- : ParserErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN,
ParserErrorCode.EXPECTED_TOKEN
], errors: [
expectedError(ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 24, 1),
- fe.Scanner.useFasta
- ? expectedError(ScannerErrorCode.EXPECTED_TOKEN, 30, 0)
- : expectedError(ParserErrorCode.EXPECTED_TOKEN, 30, 0),
+ expectedError(ScannerErrorCode.EXPECTED_TOKEN, 30, 0),
expectedError(ParserErrorCode.EXPECTED_TOKEN, 30, 0)
]);
}
@@ -5717,15 +5672,11 @@
void main() {
var x = """"''', codes: [
ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
- fe.Scanner.useFasta
- ? ScannerErrorCode.EXPECTED_TOKEN
- : ParserErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN,
ParserErrorCode.EXPECTED_TOKEN
], errors: [
expectedError(ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 24, 1),
- fe.Scanner.useFasta
- ? expectedError(ScannerErrorCode.EXPECTED_TOKEN, 31, 0)
- : expectedError(ParserErrorCode.EXPECTED_TOKEN, 31, 0),
+ expectedError(ScannerErrorCode.EXPECTED_TOKEN, 31, 0),
expectedError(ParserErrorCode.EXPECTED_TOKEN, 31, 0)
]);
}
@@ -5739,15 +5690,11 @@
void main() {
var x = """""''', codes: [
ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
- fe.Scanner.useFasta
- ? ScannerErrorCode.EXPECTED_TOKEN
- : ParserErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN,
ParserErrorCode.EXPECTED_TOKEN
], errors: [
expectedError(ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 28, 1),
- fe.Scanner.useFasta
- ? expectedError(ScannerErrorCode.EXPECTED_TOKEN, 32, 0)
- : expectedError(ParserErrorCode.EXPECTED_TOKEN, 32, 0),
+ expectedError(ScannerErrorCode.EXPECTED_TOKEN, 32, 0),
expectedError(ParserErrorCode.EXPECTED_TOKEN, 32, 0)
]);
}
@@ -10550,8 +10497,6 @@
* Intended to be mixed in to parser test case classes.
*/
class ParserTestHelpers {
- bool get usingFastaScanner => fe.Scanner.useFasta;
-
void expectCommentText(Comment comment, String expectedText) {
expect(comment.beginToken, same(comment.endToken));
expect(comment.beginToken.lexeme, expectedText);
@@ -11283,7 +11228,7 @@
? [
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 0, 6),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 0)
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 6)
]
: [expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 0, 6)]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
@@ -11529,9 +11474,8 @@
void test_incompleteForEach() {
ForStatement statement = parseStatement('for (String item i) {}');
listener.assertErrors([
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 17, 1),
- expectedError(
- ParserErrorCode.EXPECTED_TOKEN, usingFastaParser ? 18 : 17, 1)
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 12, 4),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 17, 1)
]);
expect(statement, new TypeMatcher<ForStatement>());
expect(statement.toSource(), 'for (String item; i;) {}');
@@ -11544,7 +11488,7 @@
void test_incompleteLocalVariable_atTheEndOfBlock() {
Statement statement = parseStatement('String v }', expectedEndOffset: 9);
listener
- .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 9, 1)]);
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1)]);
expect(statement, new TypeMatcher<VariableDeclarationStatement>());
expect(statement.toSource(), 'String v;');
}
@@ -11563,7 +11507,7 @@
Statement statement =
parseStatement('String v String v2;', expectedEndOffset: 9);
listener
- .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 9, 6)]);
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1)]);
expect(statement, new TypeMatcher<VariableDeclarationStatement>());
expect(statement.toSource(), 'String v;');
}
@@ -11572,7 +11516,7 @@
Statement statement =
parseStatement('String v if (true) {}', expectedEndOffset: 9);
listener
- .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 9, 2)]);
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1)]);
expect(statement, new TypeMatcher<VariableDeclarationStatement>());
expect(statement.toSource(), 'String v;');
}
@@ -11580,7 +11524,7 @@
void test_incompleteLocalVariable_beforeNextBlock() {
Statement statement = parseStatement('String v {}', expectedEndOffset: 9);
listener
- .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 9, 1)]);
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1)]);
expect(statement, new TypeMatcher<VariableDeclarationStatement>());
expect(statement.toSource(), 'String v;');
}
@@ -11589,7 +11533,7 @@
Statement statement =
parseStatement('List<String> v {}', expectedEndOffset: 15);
listener
- .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 15, 1)]);
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 13, 1)]);
expect(statement, new TypeMatcher<VariableDeclarationStatement>());
expect(statement.toSource(), 'List<String> v;');
}
@@ -12045,7 +11989,7 @@
expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 4),
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 7, 4),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 11, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 4),
expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 11, 1),
expectedError(
ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 12, 2)
@@ -13159,11 +13103,7 @@
createParser('{');
FunctionBody functionBody = parser.parseFunctionBody(false, null, false);
expectNotNullIfNoErrors(functionBody);
- listener.assertErrorsWithCodes([
- fe.Scanner.useFasta
- ? ScannerErrorCode.EXPECTED_TOKEN
- : ParserErrorCode.EXPECTED_TOKEN
- ]);
+ listener.assertErrorsWithCodes([ScannerErrorCode.EXPECTED_TOKEN]);
expect(functionBody, new TypeMatcher<EmptyFunctionBody>());
}
diff --git a/pkg/analyzer/test/generated/scanner_test.dart b/pkg/analyzer/test/generated/scanner_test.dart
index 0454057..7dfebb2 100644
--- a/pkg/analyzer/test/generated/scanner_test.dart
+++ b/pkg/analyzer/test/generated/scanner_test.dart
@@ -8,7 +8,6 @@
import 'package:analyzer/src/dart/scanner/reader.dart';
import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/generated/source.dart';
-import 'package:front_end/src/scanner/scanner.dart' as fe;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -131,8 +130,7 @@
var token = scanner.tokenize();
expect(token.lexeme, 'var');
var lineStarts = scanner.lineStarts;
- expect(
- lineStarts, orderedEquals([0, 5, 7, 9, fe.Scanner.useFasta ? 12 : 11]));
+ expect(lineStarts, orderedEquals([0, 5, 7, 9, 12]));
}
void test_translate_missing_closing_gt_error() {
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart
index fd5c686..408d787 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart
@@ -43,76 +43,6 @@
@override
@failingTest
- test_awaitForIn_declaredVariableWrongType() async {
- // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, found 0
- await super.test_awaitForIn_declaredVariableWrongType();
- }
-
- @override
- @failingTest
- test_awaitForIn_existingVariableWrongType() async {
- // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, found 0
- await super.test_awaitForIn_existingVariableWrongType();
- }
-
- @override
- @failingTest
- test_awaitForIn_notStream() async {
- // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, found 0
- await super.test_awaitForIn_notStream();
- }
-
- @override
- @failingTest
- test_expectedOneListTypeArgument() async {
- // Bad state: Found 1 argument types for 2 type arguments
- await super.test_expectedOneListTypeArgument();
- }
-
- @override
- @failingTest
- test_expectedTwoMapTypeArguments_one() async {
- // Bad state: Found 2 argument types for 1 type arguments
- await super.test_expectedTwoMapTypeArguments_one();
- }
-
- @override
- @failingTest
- test_expectedTwoMapTypeArguments_three() async {
- // Bad state: Found 2 argument types for 3 type arguments
- await super.test_expectedTwoMapTypeArguments_three();
- }
-
- @override
- @failingTest
- test_forIn_declaredVariableWrongType() async {
- // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, found 0
- await super.test_forIn_declaredVariableWrongType();
- }
-
- @override
- @failingTest
- test_forIn_existingVariableWrongType() async {
- // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, found 0
- await super.test_forIn_existingVariableWrongType();
- }
-
- @override
- @failingTest
- test_forIn_notIterable() async {
- // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, found 0
- await super.test_forIn_notIterable();
- }
-
- @override
- @failingTest
- test_forIn_typeBoundBad() async {
- // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, found 0
- await super.test_forIn_typeBoundBad();
- }
-
- @override
- @failingTest
test_illegalAsyncGeneratorReturnType_function_nonStream() async {
// Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, found 0
await super.test_illegalAsyncGeneratorReturnType_function_nonStream();
@@ -890,20 +820,6 @@
@override
@failingTest
- test_wrongNumberOfTypeArguments_typeTest_tooFew() async {
- // Bad state: Found 2 argument types for 1 type arguments
- await super.test_wrongNumberOfTypeArguments_typeTest_tooFew();
- }
-
- @override
- @failingTest
- test_wrongNumberOfTypeArguments_typeTest_tooMany() async {
- // Bad state: Found 1 argument types for 2 type arguments
- await super.test_wrongNumberOfTypeArguments_typeTest_tooMany();
- }
-
- @override
- @failingTest
test_yield_async_to_basic_type() async {
// Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0;
// 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, found 0
diff --git a/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart b/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
index 9d1f172..92bc27e 100644
--- a/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
@@ -513,13 +513,6 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_fieldInitializedInInitializerAndDeclaration_final() async {
- return super.test_fieldInitializedInInitializerAndDeclaration_final();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_fieldInitializerNotAssignable() async {
return super.test_fieldInitializerNotAssignable();
}
@@ -541,14 +534,6 @@
@override
@failingTest
- @potentialAnalyzerProblem
- test_finalInitializedInDeclarationAndConstructor_initializingFormal() async {
- return super
- .test_finalInitializedInDeclarationAndConstructor_initializingFormal();
- }
-
- @override
- @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31073')
test_finalNotInitialized_inConstructor_1() async {
return super.test_finalNotInitialized_inConstructor_1();
@@ -584,13 +569,6 @@
@override
@failingTest
- @potentialAnalyzerProblem
- test_finalNotInitialized_local_final() async {
- return super.test_finalNotInitialized_local_final();
- }
-
- @override
- @failingTest
test_generalizedVoid_invocationOfVoidFieldError() async {
return super.test_generalizedVoid_invocationOfVoidFieldError();
}
@@ -1264,6 +1242,13 @@
@override
@failingTest
+ test_notAType() {
+ // Bad state: No data for f at 18 in /test.dart
+ return super.test_notAType();
+ }
+
+ @override
+ @failingTest
@potentialAnalyzerProblem
test_notEnoughRequiredArguments() async {
return super.test_notEnoughRequiredArguments();
@@ -1411,6 +1396,27 @@
@override
@failingTest
+ test_typeAnnotationDeferredClass_asExpression() {
+ // Bad state: No data for A at 68 in /lib2.dart
+ return super.test_typeAnnotationDeferredClass_asExpression();
+ }
+
+ @override
+ @failingTest
+ test_typeAnnotationDeferredClass_catchClause() {
+ // Bad state: No data for A at 76 in /lib2.dart
+ return super.test_typeAnnotationDeferredClass_catchClause();
+ }
+
+ @override
+ @failingTest
+ test_typeAnnotationDeferredClass_fieldFormalParameter() {
+ // Bad state: No data for A at 73 in /lib2.dart
+ return super.test_typeAnnotationDeferredClass_fieldFormalParameter();
+ }
+
+ @override
+ @failingTest
@potentialAnalyzerProblem
test_typeAnnotationDeferredClass_functionDeclaration_returnType() async {
return super
@@ -1419,6 +1425,21 @@
@override
@failingTest
+ test_typeAnnotationDeferredClass_functionTypedFormalParameter_returnType() {
+ // Bad state: No data for A at 52 in /lib2.dart
+ return super
+ .test_typeAnnotationDeferredClass_functionTypedFormalParameter_returnType();
+ }
+
+ @override
+ @failingTest
+ test_typeAnnotationDeferredClass_isExpression() {
+ // Bad state: No data for A at 77 in /lib2.dart
+ return super.test_typeAnnotationDeferredClass_isExpression();
+ }
+
+ @override
+ @failingTest
@potentialAnalyzerProblem
test_typeAnnotationDeferredClass_methodDeclaration_returnType() async {
return super
@@ -1427,6 +1448,13 @@
@override
@failingTest
+ test_typeAnnotationDeferredClass_simpleFormalParameter() {
+ // Bad state: No data for A at 52 in /lib2.dart
+ return super.test_typeAnnotationDeferredClass_simpleFormalParameter();
+ }
+
+ @override
+ @failingTest
@potentialAnalyzerProblem
test_typeAnnotationDeferredClass_typeParameter_bound() async {
return super.test_typeAnnotationDeferredClass_typeParameter_bound();
diff --git a/pkg/analyzer/test/generated/static_warning_code_test.dart b/pkg/analyzer/test/generated/static_warning_code_test.dart
index b216684..222f88e 100644
--- a/pkg/analyzer/test/generated/static_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_test.dart
@@ -1339,8 +1339,14 @@
A() : x = 1 {}
}''');
await computeAnalysisResult(source);
- assertErrors(source,
- [StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]
+ : [
+ StaticWarningCode
+ .FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION
+ ]);
verify([source]);
}
@@ -1402,8 +1408,14 @@
A(this.x) {}
}''');
await computeAnalysisResult(source);
- assertErrors(source,
- [StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR]);
+ assertErrors(
+ source,
+ useCFE
+ ? [CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]
+ : [
+ StaticWarningCode
+ .FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
+ ]);
verify([source]);
}
diff --git a/pkg/analyzer/test/generated/strong_mode_kernel_test.dart b/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
index 174f423..982bea1 100644
--- a/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
@@ -266,12 +266,6 @@
bool get useCFE => true;
@override
- test_futureOr_promotion3() async {
- // Test passes even though the overridden method fails.
- await super.test_futureOr_promotion3();
- }
-
- @override
@failingTest
test_genericFunction_parameter() async {
// Failed to resolve 1 nodes:
diff --git a/pkg/analyzer/test/src/context/mock_sdk.dart b/pkg/analyzer/test/src/context/mock_sdk.dart
index ed684ec..54d7673 100644
--- a/pkg/analyzer/test/src/context/mock_sdk.dart
+++ b/pkg/analyzer/test/src/context/mock_sdk.dart
@@ -157,6 +157,7 @@
bool get isEmpty => false;
bool get isNotEmpty => false;
int get length => 0;
+ int codeUnitAt(int index);
String substring(int len) => null;
String toLowerCase();
String toUpperCase();
@@ -310,6 +311,10 @@
class Duration implements Comparable<Duration> {}
+class Exception {
+ factory Exception([var message]);
+}
+
external bool identical(Object a, Object b);
void print(Object object) {}
@@ -330,10 +335,6 @@
external _throw(error);
}
-class _DuplicatedFieldInitializerError {
- _DuplicatedFieldInitializerError(String name);
-}
-
class AbstractClassInstantiationError {
AbstractClassInstantiationError(String className);
}
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_kernel_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_kernel_test.dart
index e62131b..026a055 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_kernel_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_kernel_test.dart
@@ -156,6 +156,13 @@
await super.test_getResult_doesNotExist();
}
+ @override
+ @assertFailingTest
+ test_getResult_functionTypeFormalParameter_withTypeParameter() {
+ // Failed assertion: 'element != null': is not true.
+ return super.test_getResult_functionTypeFormalParameter_withTypeParameter();
+ }
+
@failingTest
@potentialAnalyzerProblem
@override
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_kernel_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_kernel_test.dart
index c7b5634..ed008ef 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_kernel_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_kernel_test.dart
@@ -35,27 +35,42 @@
await super.test_annotation_onFormalParameter_redirectingFactory();
}
- @failingTest
- @override
- test_annotation_onVariableList_topLevelVariable() =>
- super.test_annotation_onVariableList_topLevelVariable();
-
@override
@failingTest
- @potentialAnalyzerProblem
- test_closure_generic() async {
- // Bad state: Not found T in main() → dynamic
- // https://github.com/dart-lang/sdk/issues/33722
- await super.test_closure_generic();
+ test_closure_generic() {
+ // Assertion error: 'element != null': is not true.
+ return super.test_closure_generic();
}
@override
@failingTest
- @potentialAnalyzerProblem
- test_local_function_generic() async {
- // Bad state: Not found T in main() → void
- // https://github.com/dart-lang/sdk/issues/33722
- await super.test_local_function_generic();
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/33858')
+ test_invalid_fieldInitializer_this() async {
+ await super.test_invalid_fieldInitializer_this();
+ }
+
+ @override
+ @failingTest
+ test_local_type_parameter_reference_function_named_parameter_type() {
+ // Stack overflow
+ return super
+ .test_local_type_parameter_reference_function_named_parameter_type();
+ }
+
+ @override
+ @failingTest
+ test_local_type_parameter_reference_function_normal_parameter_type() {
+ // Stack overflow
+ return super
+ .test_local_type_parameter_reference_function_normal_parameter_type();
+ }
+
+ @override
+ @failingTest
+ test_local_type_parameter_reference_function_optional_parameter_type() {
+ // Stack overflow
+ return super
+ .test_local_type_parameter_reference_function_optional_parameter_type();
}
@override
@@ -89,48 +104,6 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_unresolved_instanceCreation_name_11() async {
- await super.test_unresolved_instanceCreation_name_11();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_unresolved_instanceCreation_name_21() async {
- await super.test_unresolved_instanceCreation_name_21();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_unresolved_instanceCreation_name_22() async {
- await super.test_unresolved_instanceCreation_name_22();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_unresolved_instanceCreation_name_31() async {
- await super.test_unresolved_instanceCreation_name_31();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_unresolved_instanceCreation_name_32() async {
- await super.test_unresolved_instanceCreation_name_32();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_unresolved_instanceCreation_name_33() async {
- await super.test_unresolved_instanceCreation_name_33();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_unresolved_methodInvocation_noTarget() async {
await super.test_unresolved_methodInvocation_noTarget();
}
@@ -138,42 +111,9 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_unresolved_methodInvocation_target_resolved() async {
- await super.test_unresolved_methodInvocation_target_resolved();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_unresolved_methodInvocation_target_unresolved() async {
await super.test_unresolved_methodInvocation_target_unresolved();
}
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_unresolved_postfix_operand() async {
- // Bad state: No data for a at 11
- await super.test_unresolved_postfix_operand();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_unresolved_postfix_operator() async {
-// Actual: 'dynamic'
-// Which: is different.
-// Expected: A
- await super.test_unresolved_postfix_operator();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_unresolved_prefix_operand() async {
- // Bad state: No data for a at 13
- await super.test_unresolved_prefix_operand();
- }
}
/// Tests marked with this annotation fail because of a Fasta problem.
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
index 18d8fb2..4ff2e26 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
@@ -27,10 +27,14 @@
});
}
+final isBottomType = new TypeMatcher<BottomTypeImpl>();
+
final isDynamicType = new TypeMatcher<DynamicTypeImpl>();
final isUndefinedType = new TypeMatcher<UndefinedTypeImpl>();
+final isVoidType = new TypeMatcher<VoidTypeImpl>();
+
/**
* Integration tests for resolution.
*/
@@ -40,14 +44,24 @@
FindNode findNode;
FindElement findElement;
+ ClassElement get boolElement => typeProvider.boolType.element;
+
+ ClassElement get doubleElement => typeProvider.doubleType.element;
+
InterfaceType get doubleType => typeProvider.doubleType;
+ DynamicTypeImpl get dynamicType => DynamicTypeImpl.instance;
+
+ ClassElement get intElement => typeProvider.intType.element;
+
InterfaceType get intType => typeProvider.intType;
ClassElement get mapElement => typeProvider.mapType.element;
InterfaceType get mapType => typeProvider.mapType;
+ ClassElement get stringElement => typeProvider.stringType.element;
+
TypeProvider get typeProvider => result.unit.element.context.typeProvider;
void assertElement(Expression node, Element expected) {
@@ -60,6 +74,11 @@
expect(actual, isNull);
}
+ void assertInvokeType(InvocationExpression expression, String expected) {
+ DartType actual = expression.staticInvokeType;
+ expect(actual?.toString(), expected);
+ }
+
void assertMember(
Expression node, String expectedDefiningType, Element expectedBase) {
Member actual = getNodeElement(node);
@@ -108,13 +127,11 @@
SimpleIdentifier nameIdentifier = named.name.label;
expect(nameIdentifier.staticElement, isNull);
- if (useCFE) {
- expect(nameIdentifier.staticType, isDynamicType);
- }
+ expect(nameIdentifier.staticType, isNull);
- SimpleIdentifier arg2Node = named.expression;
- expect(arg2Node.staticElement, same(variable.getter));
- expect(arg2Node.staticType, variable.type);
+ SimpleIdentifier expression = named.expression;
+ expect(expression.staticElement, same(variable.getter));
+ expect(expression.staticType, variable.type);
};
}
@@ -2243,6 +2260,135 @@
}
}
+ test_deferredImport_loadLibrary_invocation() async {
+ var a = _p('/test/lib/a.dart');
+ provider.newFile(a, '');
+ addTestFile(r'''
+import 'a.dart' deferred as a;
+main() {
+ a.loadLibrary();
+}
+
+''');
+ await resolveTestFile();
+ var import = findElement.import('package:test/a.dart');
+
+ var invocation = findNode.methodInvocation('loadLibrary');
+ assertType(invocation, 'Future<dynamic>');
+ assertInvokeType(invocation, '() → Future<dynamic>');
+
+ SimpleIdentifier target = invocation.target;
+ assertElement(target, import.prefix);
+ assertType(target, null);
+
+ var name = invocation.methodName;
+ assertElement(name, import.importedLibrary.loadLibraryFunction);
+ assertType(name, useCFE ? '() → Future<dynamic>' : null);
+ }
+
+ test_deferredImport_loadLibrary_invocation_argument() async {
+ var a = _p('/test/lib/a.dart');
+ provider.newFile(a, '');
+ addTestFile(r'''
+import 'a.dart' deferred as a;
+var b = 1;
+var c = 2;
+main() {
+ a.loadLibrary(b, c);
+}
+
+''');
+ await resolveTestFile();
+ var import = findElement.import('package:test/a.dart');
+
+ var invocation = findNode.methodInvocation('loadLibrary');
+ assertType(invocation, 'Future<dynamic>');
+ assertInvokeType(invocation, '() → Future<dynamic>');
+
+ SimpleIdentifier target = invocation.target;
+ assertElement(target, import.prefix);
+ assertType(target, null);
+
+ var name = invocation.methodName;
+ assertElement(name, import.importedLibrary.loadLibraryFunction);
+ assertType(name, useCFE ? '() → Future<dynamic>' : null);
+
+ var bRef = invocation.argumentList.arguments[0];
+ assertElement(bRef, findElement.topGet('b'));
+ assertType(bRef, 'int');
+
+ var cRef = invocation.argumentList.arguments[1];
+ assertElement(cRef, findElement.topGet('c'));
+ assertType(cRef, 'int');
+ }
+
+ test_deferredImport_loadLibrary_tearOff() async {
+ var a = _p('/test/lib/a.dart');
+ provider.newFile(a, '');
+ addTestFile(r'''
+import 'a.dart' deferred as a;
+main() {
+ a.loadLibrary;
+}
+
+''');
+ await resolveTestFile();
+ var import = findElement.import('package:test/a.dart');
+
+ var prefixed = findNode.prefixed('a.loadLibrary');
+ assertType(prefixed, '() → Future<dynamic>');
+
+ var prefix = prefixed.prefix;
+ assertElement(prefix, import.prefix);
+ assertType(prefix, null);
+
+ var identifier = prefixed.identifier;
+ assertElement(identifier, import.importedLibrary.loadLibraryFunction);
+ assertType(identifier, '() → Future<dynamic>');
+ }
+
+ test_deferredImport_variable() async {
+ var a = _p('/test/lib/a.dart');
+ provider.newFile(a, 'var v = 0;');
+ addTestFile(r'''
+import 'a.dart' deferred as a;
+main() async {
+ a.v;
+ a.v = 1;
+}
+
+''');
+ await resolveTestFile();
+ var import = findElement.import('package:test/a.dart');
+ TopLevelVariableElement v = (import.importedLibrary.publicNamespace.get('v')
+ as PropertyAccessorElement)
+ .variable;
+
+ {
+ var prefixed = findNode.prefixed('a.v;');
+ assertElement(prefixed, v.getter);
+ assertType(prefixed, 'int');
+
+ assertElement(prefixed.prefix, import.prefix);
+ assertType(prefixed.prefix, null);
+
+ assertElement(prefixed.identifier, v.getter);
+ assertType(prefixed.identifier, 'int');
+ }
+
+ {
+ var prefixed = findNode.prefixed('a.v = 1;');
+ assertElement(prefixed, v.setter);
+ assertType(prefixed, 'int');
+
+ assertElement(prefixed.prefix, import.prefix);
+ assertType(prefixed.prefix, null);
+
+ assertElement(prefixed.identifier, v.setter);
+ assertType(prefixed.identifier, 'int');
+ }
+ }
+
test_enum_toString() async {
addTestFile(r'''
enum MyEnum { A, B, C }
@@ -2281,11 +2427,7 @@
TypeName typeName = statement.variables.type;
expect(typeName.type, isUndefinedType);
- if (useCFE) {
- expect(typeName.typeArguments.arguments[0].type, isUndefinedType);
- } else {
- expect(typeName.typeArguments.arguments[0].type, typeProvider.intType);
- }
+ expect(typeName.typeArguments.arguments[0].type, typeProvider.intType);
VariableDeclaration vNode = statement.variables.variables[0];
expect(vNode.name.staticType, isUndefinedType);
@@ -3101,6 +3243,153 @@
assertType(aRef, 'int');
}
+ test_invalid_const_methodInvocation() async {
+ addTestFile(r'''
+const a = 'foo';
+const b = 0;
+const c = a.codeUnitAt(b);
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var invocation = findNode.methodInvocation('codeUnitAt');
+ assertType(invocation, 'int');
+ assertInvokeType(invocation, '(int) → int');
+ assertElement(invocation.methodName, stringElement.getMethod('codeUnitAt'));
+
+ var aRef = invocation.target;
+ assertElement(aRef, findElement.topGet('a'));
+ assertType(aRef, 'String');
+
+ var bRef = invocation.argumentList.arguments[0];
+ assertElement(bRef, findElement.topGet('b'));
+ assertType(bRef, 'int');
+ }
+
+ test_invalid_const_methodInvocation_static() async {
+ addTestFile(r'''
+const c = A.m();
+class A {
+ static int m() => 0;
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var invocation = findNode.methodInvocation('m();');
+ assertType(invocation, 'int');
+ assertInvokeType(invocation, '() → int');
+ assertElement(invocation.methodName, findElement.method('m'));
+ }
+
+ test_invalid_const_methodInvocation_topLevelFunction() async {
+ addTestFile(r'''
+const id = identical;
+const a = 0;
+const b = 0;
+const c = id(a, b);
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var invocation = findNode.methodInvocation('id(');
+ assertType(invocation, 'bool');
+ assertInvokeType(invocation, '(Object, Object) → bool');
+ assertElement(invocation.methodName, findElement.topGet('id'));
+
+ var aRef = invocation.argumentList.arguments[0];
+ assertElement(aRef, findElement.topGet('a'));
+ assertType(aRef, 'int');
+
+ var bRef = invocation.argumentList.arguments[1];
+ assertElement(bRef, findElement.topGet('b'));
+ assertType(bRef, 'int');
+ }
+
+ test_invalid_const_throw_local() async {
+ addTestFile(r'''
+main() {
+ const c = throw 42;
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var throwExpression = findNode.throw_('throw 42;');
+ expect(throwExpression.staticType, isBottomType);
+ assertType(throwExpression.expression, 'int');
+ }
+
+ test_invalid_const_throw_topLevel() async {
+ addTestFile(r'''
+const c = throw 42;
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var throwExpression = findNode.throw_('throw 42;');
+ expect(throwExpression.staticType, isBottomType);
+ assertType(throwExpression.expression, 'int');
+ }
+
+ test_invalid_fieldInitializer_field() async {
+ addTestFile(r'''
+class C {
+ final int a = 0;
+ final int b = a + 1;
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var aRef = findNode.simple('a + 1');
+ assertElement(aRef, findElement.getter('a'));
+ assertType(aRef, 'int');
+ }
+
+ test_invalid_fieldInitializer_getter() async {
+ addTestFile(r'''
+class C {
+ int get a => 0;
+ final int b = a + 1;
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var aRef = findNode.simple('a + 1');
+ assertElement(aRef, findElement.getter('a'));
+ assertType(aRef, 'int');
+ }
+
+ test_invalid_fieldInitializer_method() async {
+ addTestFile(r'''
+class C {
+ int a() => 0;
+ final int b = a + 1;
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var aRef = findNode.simple('a + 1');
+ assertElement(aRef, findElement.method('a'));
+ assertType(aRef, '() → int');
+ }
+
+ test_invalid_fieldInitializer_this() async {
+ addTestFile(r'''
+class C {
+ final b = this;
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var thisRef = findNode.this_('this');
+ assertType(thisRef, 'C');
+ }
+
test_invalid_instanceCreation_abstract() async {
addTestFile(r'''
abstract class C<T> {
@@ -3169,6 +3458,74 @@
}
}
+ test_invalid_instanceCreation_arguments_named() async {
+ addTestFile(r'''
+class C {
+ C();
+}
+var a = 0;
+main() {
+ new C(x: a);
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+ var classElement = findElement.class_('C');
+
+ var creation = findNode.instanceCreation('new C(x: a)');
+ _assertConstructorInvocation(creation, classElement);
+
+ NamedExpression argument = creation.argumentList.arguments[0];
+ assertElementNull(argument.name.label);
+ var aRef = argument.expression;
+ assertElement(aRef, findElement.topGet('a'));
+ assertType(aRef, 'int');
+ }
+
+ test_invalid_instanceCreation_arguments_required_01() async {
+ addTestFile(r'''
+class C {
+ C();
+}
+var a = 0;
+main() {
+ new C(a);
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+ var classElement = findElement.class_('C');
+
+ var creation = findNode.instanceCreation('new C(a)');
+ _assertConstructorInvocation(creation, classElement);
+
+ var aRef = creation.argumentList.arguments[0];
+ assertElement(aRef, findElement.topGet('a'));
+ assertType(aRef, 'int');
+ }
+
+ test_invalid_instanceCreation_arguments_required_21() async {
+ addTestFile(r'''
+class C {
+ C(a, b);
+}
+var a = 0;
+main() {
+ new C(a);
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+ var classElement = findElement.class_('C');
+
+ var creation = findNode.instanceCreation('new C(a)');
+ _assertConstructorInvocation(creation, classElement);
+
+ var aRef = creation.argumentList.arguments[0];
+ assertElement(aRef, findElement.topGet('a'));
+ assertType(aRef, 'int');
+ }
+
test_invalid_methodInvocation_simpleIdentifier() async {
addTestFile(r'''
int foo = 0;
@@ -3306,6 +3663,55 @@
expect(breakStatement.label.staticType, isNull);
}
+ test_listLiteral_01() async {
+ addTestFile(r'''
+main() {
+ var v = [];
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var literal = findNode.listLiteral('[];');
+ expect(literal.typeArguments, isNull);
+ assertType(literal, 'List<dynamic>');
+ }
+
+ test_listLiteral_02() async {
+ addTestFile(r'''
+main() {
+ var v = <>[];
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var literal = findNode.listLiteral('[];');
+ expect(literal.typeArguments, isNotNull);
+ assertType(literal, 'List<dynamic>');
+ }
+
+ test_listLiteral_2() async {
+ addTestFile(r'''
+main() {
+ var v = <int, double>[];
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var literal = findNode.listLiteral('<int, double>[]');
+ assertType(literal, 'List<dynamic>');
+
+ var intRef = findNode.simple('int, double');
+ assertElement(intRef, intElement);
+ assertType(intRef, 'int');
+
+ var doubleRef = findNode.simple('double>[]');
+ assertElement(doubleRef, doubleElement);
+ assertType(doubleRef, 'double');
+ }
+
test_local_function() async {
addTestFile(r'''
void main() {
@@ -3687,6 +4093,32 @@
}
}
+ test_local_function_with_function_typed_parameter() async {
+ addTestFile('''
+class C {}
+class D {}
+class E {}
+void f() {
+ void g(C callback<T extends E>(D d)) {}
+}
+''');
+ await resolveTestFile();
+ var callback = findNode.simple('callback');
+ assertType(callback, '<T extends E>(D) → C');
+ var cReference = findNode.simple('C callback');
+ var cElement = findElement.class_('C');
+ assertType(cReference, 'C');
+ assertElement(cReference, cElement);
+ var dReference = findNode.simple('D d');
+ var dElement = findElement.class_('D');
+ assertType(dReference, 'D');
+ assertElement(dReference, dElement);
+ var eReference = findNode.simple('E>');
+ var eElement = findElement.class_('E');
+ assertType(eReference, 'E');
+ assertElement(eReference, eElement);
+ }
+
test_local_parameter() async {
String content = r'''
void main(int p) {
@@ -3775,6 +4207,341 @@
expect(bNode.staticType, typeProvider.doubleType);
}
+ test_local_type_parameter_reference_as_expression() async {
+ addTestFile('''
+void main() {
+ void f<T>(T x) {
+ T;
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var bodyStatement = body.block.statements[0] as ExpressionStatement;
+ var tReference = bodyStatement.expression as SimpleIdentifier;
+ assertElement(tReference, tElement);
+ assertType(tReference, 'Type');
+ }
+
+ test_local_type_parameter_reference_function_named_parameter_type() async {
+ addTestFile('''
+void main() {
+ void f<T>(T x) {
+ void Function({T t}) g = null;
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var gDeclaration = body.block.statements[0] as VariableDeclarationStatement;
+ var gType = gDeclaration.variables.type as GenericFunctionType;
+ var gTypeType = gType.type as FunctionType;
+ var gTypeParameterType =
+ gTypeType.namedParameterTypes['t'] as TypeParameterType;
+ expect(gTypeParameterType.element, same(tElement));
+ var gParameterType =
+ ((gType.parameters.parameters[0] as DefaultFormalParameter).parameter
+ as SimpleFormalParameter)
+ .type as TypeName;
+ var tReference = gParameterType.name;
+ assertElement(tReference, tElement);
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ }
+
+ test_local_type_parameter_reference_function_normal_parameter_type() async {
+ addTestFile('''
+void main() {
+ void f<T>(T x) {
+ void Function(T) g = null;
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var gDeclaration = body.block.statements[0] as VariableDeclarationStatement;
+ var gType = gDeclaration.variables.type as GenericFunctionType;
+ var gTypeType = gType.type as FunctionType;
+ var gTypeParameterType =
+ gTypeType.normalParameterTypes[0] as TypeParameterType;
+ expect(gTypeParameterType.element, same(tElement));
+ var gParameterType =
+ (gType.parameters.parameters[0] as SimpleFormalParameter).type
+ as TypeName;
+ var tReference = gParameterType.name;
+ assertElement(tReference, tElement);
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ }
+
+ test_local_type_parameter_reference_function_optional_parameter_type() async {
+ addTestFile('''
+void main() {
+ void f<T>(T x) {
+ void Function([T]) g = null;
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var gDeclaration = body.block.statements[0] as VariableDeclarationStatement;
+ var gType = gDeclaration.variables.type as GenericFunctionType;
+ var gTypeType = gType.type as FunctionType;
+ var gTypeParameterType =
+ gTypeType.optionalParameterTypes[0] as TypeParameterType;
+ expect(gTypeParameterType.element, same(tElement));
+ var gParameterType =
+ ((gType.parameters.parameters[0] as DefaultFormalParameter).parameter
+ as SimpleFormalParameter)
+ .type as TypeName;
+ var tReference = gParameterType.name;
+ assertElement(tReference, tElement);
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ }
+
+ test_local_type_parameter_reference_function_return_type() async {
+ addTestFile('''
+void main() {
+ void f<T>(T x) {
+ T Function() g = () => x;
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var gDeclaration = body.block.statements[0] as VariableDeclarationStatement;
+ var gType = gDeclaration.variables.type as GenericFunctionType;
+ var gTypeType = gType.type as FunctionType;
+ var gTypeReturnType = gTypeType.returnType as TypeParameterType;
+ expect(gTypeReturnType.element, same(tElement));
+ var gReturnType = gType.returnType as TypeName;
+ var tReference = gReturnType.name;
+ assertElement(tReference, tElement);
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ }
+
+ test_local_type_parameter_reference_interface_type_parameter() async {
+ addTestFile('''
+void main() {
+ void f<T>(T x) {
+ List<T> y = [x];
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var yDeclaration = body.block.statements[0] as VariableDeclarationStatement;
+ var yType = yDeclaration.variables.type as TypeName;
+ var yTypeType = yType.type as InterfaceType;
+ var yTypeTypeArgument = yTypeType.typeArguments[0] as TypeParameterType;
+ expect(yTypeTypeArgument.element, same(tElement));
+ var yElementType = yType.typeArguments.arguments[0] as TypeName;
+ var tReference = yElementType.name;
+ assertElement(tReference, tElement);
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ }
+
+ test_local_type_parameter_reference_simple() async {
+ addTestFile('''
+void main() {
+ void f<T>(T x) {
+ T y = x;
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var yDeclaration = body.block.statements[0] as VariableDeclarationStatement;
+ var yType = yDeclaration.variables.type as TypeName;
+ var tReference = yType.name;
+ assertElement(tReference, tElement);
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ }
+
+ test_local_type_parameter_reference_typedef_named_parameter_type() async {
+ addTestFile('''
+typedef void Consumer<U>({U u});
+void main() {
+ void f<T>(T x) {
+ Consumer<T> g = null;
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var gDeclaration = body.block.statements[0] as VariableDeclarationStatement;
+ var gType = gDeclaration.variables.type as TypeName;
+ var gTypeType = gType.type as FunctionType;
+ var gTypeTypeArgument = gTypeType.typeArguments[0] as TypeParameterType;
+ expect(gTypeTypeArgument.element, same(tElement));
+ var gTypeParameterType =
+ gTypeType.namedParameterTypes['u'] as TypeParameterType;
+ expect(gTypeParameterType.element, same(tElement));
+ var gArgumentType = gType.typeArguments.arguments[0] as TypeName;
+ var tReference = gArgumentType.name;
+ assertElement(tReference, tElement);
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ }
+
+ test_local_type_parameter_reference_typedef_normal_parameter_type() async {
+ addTestFile('''
+typedef void Consumer<U>(U u);
+void main() {
+ void f<T>(T x) {
+ Consumer<T> g = null;
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var gDeclaration = body.block.statements[0] as VariableDeclarationStatement;
+ var gType = gDeclaration.variables.type as TypeName;
+ var gTypeType = gType.type as FunctionType;
+ var gTypeTypeArgument = gTypeType.typeArguments[0] as TypeParameterType;
+ expect(gTypeTypeArgument.element, same(tElement));
+ var gTypeParameterType =
+ gTypeType.normalParameterTypes[0] as TypeParameterType;
+ expect(gTypeParameterType.element, same(tElement));
+ var gArgumentType = gType.typeArguments.arguments[0] as TypeName;
+ var tReference = gArgumentType.name;
+ assertElement(tReference, tElement);
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ }
+
+ test_local_type_parameter_reference_typedef_optional_parameter_type() async {
+ addTestFile('''
+typedef void Consumer<U>([U u]);
+void main() {
+ void f<T>(T x) {
+ Consumer<T> g = null;
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var gDeclaration = body.block.statements[0] as VariableDeclarationStatement;
+ var gType = gDeclaration.variables.type as TypeName;
+ var gTypeType = gType.type as FunctionType;
+ var gTypeTypeArgument = gTypeType.typeArguments[0] as TypeParameterType;
+ expect(gTypeTypeArgument.element, same(tElement));
+ var gTypeParameterType =
+ gTypeType.optionalParameterTypes[0] as TypeParameterType;
+ expect(gTypeParameterType.element, same(tElement));
+ var gArgumentType = gType.typeArguments.arguments[0] as TypeName;
+ var tReference = gArgumentType.name;
+ assertElement(tReference, tElement);
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ }
+
+ test_local_type_parameter_reference_typedef_return_type() async {
+ addTestFile('''
+typedef U Producer<U>();
+void main() {
+ void f<T>(T x) {
+ Producer<T> g = () => x;
+ }
+ f(1);
+}
+''');
+ await resolveTestFile();
+
+ var mainStatements = _getMainStatements(result);
+ var fDeclaration = mainStatements[0] as FunctionDeclarationStatement;
+ var fElement = fDeclaration.functionDeclaration.element;
+ var tElement = fElement.typeParameters[0];
+ var body = fDeclaration.functionDeclaration.functionExpression.body
+ as BlockFunctionBody;
+ var gDeclaration = body.block.statements[0] as VariableDeclarationStatement;
+ var gType = gDeclaration.variables.type as TypeName;
+ var gTypeType = gType.type as FunctionType;
+ var gTypeTypeArgument = gTypeType.typeArguments[0] as TypeParameterType;
+ expect(gTypeTypeArgument.element, same(tElement));
+ var gTypeReturnType = gTypeType.returnType as TypeParameterType;
+ expect(gTypeReturnType.element, same(tElement));
+ var gArgumentType = gType.typeArguments.arguments[0] as TypeName;
+ var tReference = gArgumentType.name;
+ assertElement(tReference, tElement);
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ }
+
test_local_variable() async {
addTestFile(r'''
void main() {
@@ -4111,6 +4878,48 @@
}
}
+ test_mapLiteral_1() async {
+ addTestFile(r'''
+main() {
+ var v = <int>{};
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var literal = findNode.mapLiteral('<int>{}');
+ assertType(literal, 'Map<dynamic, dynamic>');
+
+ var intRef = findNode.simple('int>{}');
+ assertElement(intRef, intElement);
+ assertType(intRef, 'int');
+ }
+
+ test_mapLiteral_3() async {
+ addTestFile(r'''
+main() {
+ var v = <bool, int, double>{};
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+
+ var literal = findNode.mapLiteral('<bool, int, double>{}');
+ assertType(literal, 'Map<dynamic, dynamic>');
+
+ var boolRef = findNode.simple('bool, ');
+ assertElement(boolRef, boolElement);
+ assertType(boolRef, 'bool');
+
+ var intRef = findNode.simple('int, ');
+ assertElement(intRef, intElement);
+ assertType(intRef, 'int');
+
+ var doubleRef = findNode.simple('double>');
+ assertElement(doubleRef, doubleElement);
+ assertType(doubleRef, 'double');
+ }
+
test_method_namedParameters() async {
addTestFile(r'''
class C {
@@ -5233,6 +6042,22 @@
}
}
+ test_reference_to_class_type_parameter() async {
+ addTestFile('''
+class C<T> {
+ void f() {
+ T x;
+ }
+}
+''');
+ await resolveTestFile();
+ var tElement = findElement.class_('C').typeParameters[0];
+ var tReference = findNode.simple('T x');
+ var tReferenceType = tReference.staticType as TypeParameterType;
+ expect(tReferenceType.element, same(tElement));
+ assertElement(tReference, tElement);
+ }
+
test_stringInterpolation() async {
String content = r'''
void main() {
@@ -6422,6 +7247,23 @@
}
}
+ test_type_dynamic() async {
+ addTestFile('''
+main() {
+ dynamic d;
+}
+''');
+ await resolveTestFile();
+ var statements = _getMainStatements(result);
+ var variableDeclarationStatement =
+ statements[0] as VariableDeclarationStatement;
+ var type = variableDeclarationStatement.variables.type as TypeName;
+ expect(type.type, isDynamicType);
+ var typeName = type.name;
+ assertTypeDynamic(typeName);
+ expect(typeName.staticElement, same(typeProvider.dynamicType.element));
+ }
+
test_type_functionTypeAlias() async {
addTestFile(r'''
typedef T F<T>(bool a);
@@ -6457,6 +7299,23 @@
_assertTypeNameSimple(typeArguments[0], typeProvider.intType);
}
+ test_type_void() async {
+ addTestFile('''
+main() {
+ void v;
+}
+''');
+ await resolveTestFile();
+ var statements = _getMainStatements(result);
+ var variableDeclarationStatement =
+ statements[0] as VariableDeclarationStatement;
+ var type = variableDeclarationStatement.variables.type as TypeName;
+ expect(type.type, isVoidType);
+ var typeName = type.name;
+ expect(typeName.staticType, isVoidType);
+ expect(typeName.staticElement, isNull);
+ }
+
test_typeAnnotation_prefixed() async {
var a = _p('/test/lib/a.dart');
var b = _p('/test/lib/b.dart');
@@ -6970,14 +7829,12 @@
SimpleIdentifier typePrefix = typePrefixed.prefix;
expect(typePrefix.staticElement, isNull);
- if (useCFE) {
- expect(typePrefix.staticType, isDynamicType);
- }
+ expect(typePrefix.staticType, isNull);
SimpleIdentifier typeIdentifier = typePrefixed.identifier;
expect(typeIdentifier.staticElement, isNull);
if (useCFE) {
- expect(typePrefix.staticType, isDynamicType);
+ expect(typeIdentifier.staticType, isDynamicType);
}
assertTypeArguments(typeName.typeArguments, [intType, doubleType]);
@@ -7028,7 +7885,7 @@
SimpleIdentifier typeIdentifier = typePrefixed.identifier;
expect(typeIdentifier.staticElement, isNull);
if (useCFE) {
- expect(typePrefix.staticType, isDynamicType);
+ expect(typeIdentifier.staticType, isDynamicType);
}
assertTypeArguments(typeName.typeArguments, [intType, doubleType]);
@@ -7069,20 +7926,16 @@
SimpleIdentifier typePrefix = typePrefixed.prefix;
expect(typePrefix.staticElement, isNull);
- if (useCFE) {
- expect(typePrefix.staticType, isDynamicType);
- }
+ expect(typePrefix.staticType, isNull);
SimpleIdentifier typeIdentifier = typePrefixed.identifier;
expect(typeIdentifier.staticElement, isNull);
if (useCFE) {
- expect(typePrefix.staticType, isDynamicType);
+ expect(typeIdentifier.staticType, isDynamicType);
}
expect(constructorName.name.staticElement, isNull);
- if (useCFE) {
- expect(constructorName.name.staticType, isDynamicType);
- }
+ expect(constructorName.name.staticType, isNull);
assertTypeArguments(typeName.typeArguments, [intType, doubleType]);
_assertInvocationArguments(creation.argumentList,
@@ -7132,7 +7985,7 @@
SimpleIdentifier typeIdentifier = typePrefixed.identifier;
expect(typeIdentifier.staticElement, isNull);
if (useCFE) {
- expect(typePrefix.staticType, isNull);
+ expect(typeIdentifier.staticType, isDynamicType);
}
expect(constructorName.name.staticElement, isNull);
@@ -7176,7 +8029,7 @@
PrefixedIdentifier typePrefixed = typeName.name;
expect(typePrefixed.staticElement, same(randomElement));
- expect(typePrefixed.staticType, randomElement.type);
+ expect(typePrefixed.staticType, useCFE ? dynamicType : randomElement.type);
SimpleIdentifier typePrefix = typePrefixed.prefix;
expect(typePrefix.staticElement, same(foo));
@@ -7184,7 +8037,7 @@
SimpleIdentifier typeIdentifier = typePrefixed.identifier;
expect(typeIdentifier.staticElement, same(randomElement));
- expect(typePrefix.staticType, isNull);
+ expect(typeIdentifier.staticType, useCFE ? dynamicType : null);
expect(constructorName.name.staticElement, isNull);
expect(constructorName.name.staticType, isNull);
@@ -7645,10 +8498,32 @@
if (argument is NamedExpression) {
SimpleIdentifier name = argument.name.label;
expect(name.staticElement, same(actualParameter));
+ expect(name.staticType, isNull);
}
}
}
+ /// Assert that the given [creation] creates instance of the [classElement].
+ /// Limitations: no import prefix, no type arguments, unnamed constructor.
+ void _assertConstructorInvocation(
+ InstanceCreationExpression creation, ClassElement classElement) {
+ assertType(creation, classElement.name);
+
+ var constructorName = creation.constructorName;
+ var constructorElement = classElement.unnamedConstructor;
+ expect(constructorName.staticElement, constructorElement);
+
+ var typeName = constructorName.type;
+ expect(typeName.typeArguments, isNull);
+
+ SimpleIdentifier typeIdentifier = typeName.name;
+ assertElement(typeIdentifier, classElement);
+ assertType(typeIdentifier, classElement.name);
+
+ // Only unnamed constructors are supported now.
+ expect(constructorName.name, isNull);
+ }
+
void _assertDefaultParameter(
DefaultFormalParameter node, ParameterElement element,
{String name, int offset, ParameterKind kind, DartType type}) {
@@ -7790,6 +8665,23 @@
fail('Not found class accessor: $name');
}
+ ImportElement import(String targetUri) {
+ ImportElement importElement;
+ for (var import in unitElement.library.imports) {
+ var importedUri = import.importedLibrary.source.uri.toString();
+ if (importedUri == targetUri) {
+ if (importElement != null) {
+ throw new StateError('Not unique $targetUri import.');
+ }
+ importElement = import;
+ }
+ }
+ if (importElement != null) {
+ return importElement;
+ }
+ fail('Not found import: $targetUri');
+ }
+
MethodElement method(String name) {
for (var type in unitElement.types) {
for (var method in type.methods) {
@@ -7873,6 +8765,14 @@
return _node(search).getAncestor((n) => n is InstanceCreationExpression);
}
+ ListLiteral listLiteral(String search) {
+ return _node(search).getAncestor((n) => n is ListLiteral);
+ }
+
+ MapLiteral mapLiteral(String search) {
+ return _node(search).getAncestor((n) => n is MapLiteral);
+ }
+
MethodInvocation methodInvocation(String search) {
return _node(search).getAncestor((n) => n is MethodInvocation);
}
@@ -7893,6 +8793,10 @@
return _node(search).getAncestor((n) => n is PrefixExpression);
}
+ PrefixedIdentifier prefixed(String search) {
+ return _node(search).getAncestor((n) => n is PrefixedIdentifier);
+ }
+
SimpleIdentifier simple(String search) {
return _node(search);
}
@@ -7901,6 +8805,18 @@
return _node(search).getAncestor((n) => n is SimpleFormalParameter);
}
+ SuperExpression super_(String search) {
+ return _node(search).getAncestor((n) => n is SuperExpression);
+ }
+
+ ThisExpression this_(String search) {
+ return _node(search).getAncestor((n) => n is ThisExpression);
+ }
+
+ ThrowExpression throw_(String search) {
+ return _node(search).getAncestor((n) => n is ThrowExpression);
+ }
+
VariableDeclaration variableDeclaration(String search) {
return _node(search).getAncestor((n) => n is VariableDeclaration);
}
diff --git a/pkg/analyzer/test/src/dart/ast/ast_test.dart b/pkg/analyzer/test/src/dart/ast/ast_test.dart
index d3d9642..d79a662 100644
--- a/pkg/analyzer/test/src/dart/ast/ast_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/ast_test.dart
@@ -822,11 +822,11 @@
}
test_isValidLiteral_hex_negative_equalMax() {
- expect(IntegerLiteralImpl.isValidLiteral('0x7FFFFFFFFFFFFFFF', true), true);
+ expect(IntegerLiteralImpl.isValidLiteral('0x8000000000000000', true), true);
}
test_isValidLiteral_heX_negative_equalMax() {
- expect(IntegerLiteralImpl.isValidLiteral('0X7FFFFFFFFFFFFFFF', true), true);
+ expect(IntegerLiteralImpl.isValidLiteral('0X8000000000000000', true), true);
}
test_isValidLiteral_hex_negative_fewDigits() {
@@ -857,14 +857,22 @@
IntegerLiteralImpl.isValidLiteral('0X007FFFFFFFFFFFFFFF', true), true);
}
+ test_isValidLiteral_hex_negative_oneBelowMax() {
+ expect(IntegerLiteralImpl.isValidLiteral('0x7FFFFFFFFFFFFFFF', true), true);
+ }
+
+ test_isValidLiteral_heX_negative_oneBelowMax() {
+ expect(IntegerLiteralImpl.isValidLiteral('0X7FFFFFFFFFFFFFFF', true), true);
+ }
+
test_isValidLiteral_hex_negative_oneOverMax() {
expect(
- IntegerLiteralImpl.isValidLiteral('0x8000000000000000', true), false);
+ IntegerLiteralImpl.isValidLiteral('0x8000000000000001', true), false);
}
test_isValidLiteral_heX_negative_oneOverMax() {
expect(
- IntegerLiteralImpl.isValidLiteral('0X8000000000000000', true), false);
+ IntegerLiteralImpl.isValidLiteral('0X8000000000000001', true), false);
}
test_isValidLiteral_hex_negative_tooManyDigits() {
diff --git a/pkg/analyzer/test/src/summary/expr_builder_test.dart b/pkg/analyzer/test/src/summary/expr_builder_test.dart
index 4c755b9..c13b903 100644
--- a/pkg/analyzer/test/src/summary/expr_builder_test.dart
+++ b/pkg/analyzer/test/src/summary/expr_builder_test.dart
@@ -446,8 +446,7 @@
checkSimpleExpression('({x}) => 0');
}
- @failingTest
- void test_pushLocalFunctionReference_nested() {
+ void xtest_pushLocalFunctionReference_nested() {
// TODO(devoncarew): This test fails when run in strong mode.
// Failed assertion: line 5116 pos 16:
// 'Linker._initializerTypeInferenceCycle == null': is not true.
@@ -472,8 +471,7 @@
expect(yRef.staticElement, same(yElement));
}
- @failingTest
- void test_pushLocalFunctionReference_paramReference() {
+ void xtest_pushLocalFunctionReference_paramReference() {
// TODO(devoncarew): This test fails when run in strong mode.
prepareAnalysisContext(new AnalysisOptionsImpl()..previewDart2 = false);
var expr = checkSimpleExpression('(x, y) => x + y') as FunctionExpression;
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index d8994bb..50489a7 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -2537,11 +2537,9 @@
int foo() => 42;
''', allowErrors: true);
if (isSharedFrontEnd) {
- // It is OK to keep non-constant initializers.
checkElementText(library, r'''
class C {
- static const int f = 1 +
- foo/*location: test.dart;foo*/();
+ static const int f = #invalidConst;
}
int foo() {}
''');
@@ -2605,10 +2603,8 @@
int foo() => 42;
''', allowErrors: true);
if (isSharedFrontEnd) {
- // It is OK to keep non-constant initializers.
checkElementText(library, r'''
-const int v = 1 +
- foo/*location: test.dart;foo*/();
+const int v = #invalidConst;
int foo() {}
''');
} else if (isStrongMode) {
@@ -4247,6 +4243,23 @@
''');
}
+ test_const_topLevel_throw() async {
+ shouldCompareLibraryElements = false;
+ var library = await checkLibrary(r'''
+const c = throw 42;
+''');
+ if (isSharedFrontEnd) {
+ checkElementText(library, r'''
+const dynamic c = #invalidConst;
+''');
+ } else {
+ // This is a bug.
+ checkElementText(library, r'''
+const dynamic c;
+''');
+ }
+ }
+
test_const_topLevel_typedList() async {
var library = await checkLibrary(r'''
const vNull = const <Null>[];
@@ -4629,8 +4642,18 @@
}
int foo() => 42;
''', allowErrors: true);
- // It is OK to keep non-constant initializers.
- checkElementText(library, r'''
+ if (isSharedFrontEnd) {
+ checkElementText(library, r'''
+class C {
+ final dynamic x;
+ const C() :
+ x/*location: test.dart;C;x*/ = #invalidConst;
+}
+int foo() {}
+''');
+ } else {
+ // It is OK to keep non-constant initializers.
+ checkElementText(library, r'''
class C {
final dynamic x;
const C() :
@@ -4639,6 +4662,7 @@
}
int foo() {}
''');
+ }
}
test_constructor_initializers_field_withParameter() async {
diff --git a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
index 2625f04..7954cdb 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
@@ -242,12 +242,6 @@
}
@failingTest
- @potentialAnalyzerProblem
- test_type_inference_based_on_loadLibrary() async {
- await super.test_type_inference_based_on_loadLibrary();
- }
-
- @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30267')
test_unresolved_annotation_instanceCreation_argument_super() async {
await super.test_unresolved_annotation_instanceCreation_argument_super();
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index 3b90871..1ae7385 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -25,7 +25,6 @@
import 'package:analyzer/src/task/dart.dart';
import 'package:analyzer/src/task/html.dart';
import 'package:analyzer/src/task/strong/ast_properties.dart' as strong_ast;
-import 'package:front_end/src/scanner/scanner.dart' as fe;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -2988,12 +2987,8 @@
_assertHasCore(outputs[IMPORTED_LIBRARIES], 2);
expect(outputs[INCLUDED_PARTS], hasLength(1));
expect(outputs[LIBRARY_SPECIFIC_UNITS], hasLength(2));
- if (fe.Scanner.useFasta) {
- // Missing closing brace error is reported by the Fasta scanner.
- expect(outputs[PARSE_ERRORS], hasLength(0));
- } else {
- expect(outputs[PARSE_ERRORS], hasLength(1));
- }
+ // Missing closing brace error is reported by the Fasta scanner.
+ expect(outputs[PARSE_ERRORS], hasLength(0));
expect(outputs[PARSED_UNIT], isNotNull);
expect(outputs[REFERENCED_SOURCES], hasLength(5));
expect(outputs[SOURCE_KIND], SourceKind.LIBRARY);
@@ -4076,7 +4071,7 @@
expect(outputs, hasLength(4));
expect(outputs[LINE_INFO], isNotNull);
// Missing closing brace error is reported by the Fasta scanner.
- expect(outputs[SCAN_ERRORS], hasLength(fe.Scanner.useFasta ? 1 : 0));
+ expect(outputs[SCAN_ERRORS], hasLength(1));
expect(outputs[TOKEN_STREAM], isNotNull);
IgnoreInfo ignoreInfo = outputs[IGNORE_INFO];
expect(ignoreInfo, isNotNull);
@@ -4114,12 +4109,8 @@
computeResult(script, TOKEN_STREAM, matcher: isScanDartTask);
expect(outputs[LINE_INFO], isNotNull);
- if (fe.Scanner.useFasta) {
- // Missing closing brace error is reported by Fasta scanner.
- expect(outputs[SCAN_ERRORS], hasLength(1));
- } else {
- expect(outputs[SCAN_ERRORS], isEmpty);
- }
+ // Missing closing brace error is reported by Fasta scanner.
+ expect(outputs[SCAN_ERRORS], hasLength(1));
Token tokenStream = outputs[TOKEN_STREAM];
expect(tokenStream, isNotNull);
expect(tokenStream.lexeme, 'void');
diff --git a/pkg/analyzer_cli/analysis_options.yaml b/pkg/analyzer_cli/analysis_options.yaml
index 301f0e6..b8b8389 100644
--- a/pkg/analyzer_cli/analysis_options.yaml
+++ b/pkg/analyzer_cli/analysis_options.yaml
@@ -1,6 +1,6 @@
analyzer:
exclude:
- - 'test/data'
+ - test/data/**
linter:
rules:
#- annotate_overrides
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index 74425a8..4607f06 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -347,8 +347,11 @@
file.createSource(), content, analysisDriver.sourceFactory);
formatter.formatErrors([new AnalysisErrorInfoImpl(errors, lineInfo)]);
for (AnalysisError error in errors) {
- allResult = allResult.max(determineProcessedSeverity(
- error, options, analysisDriver.analysisOptions));
+ ErrorSeverity severity = determineProcessedSeverity(
+ error, options, analysisDriver.analysisOptions);
+ if (severity != null) {
+ allResult = allResult.max(severity);
+ }
}
} else if (shortName == AnalysisEngine.PUBSPEC_YAML_FILE) {
try {
@@ -363,8 +366,9 @@
formatter
.formatErrors([new AnalysisErrorInfoImpl(errors, lineInfo)]);
for (AnalysisError error in errors) {
- allResult = allResult.max(determineProcessedSeverity(
- error, options, analysisDriver.analysisOptions));
+ ErrorSeverity severity = determineProcessedSeverity(
+ error, options, analysisDriver.analysisOptions);
+ allResult = allResult.max(severity);
}
}
} catch (exception) {
@@ -542,6 +546,7 @@
in directory.listSync(recursive: true, followLinks: false)) {
String relative = path.relative(entry.path, from: directory.path);
if (AnalysisEngine.isDartFileName(entry.path) &&
+ entry is io.File &&
!pathFilter.ignored(entry.path) &&
!_isInHiddenDir(relative)) {
files.add(entry);
@@ -701,8 +706,8 @@
'Unable to read package config data from $packageConfigPath: $e');
}
} else if (options.packageRootPath != null) {
- packageMap = _PackageRootPackageMapBuilder
- .buildPackageMap(options.packageRootPath);
+ packageMap = _PackageRootPackageMapBuilder.buildPackageMap(
+ options.packageRootPath);
} else {
file_system.Resource cwd = resourceProvider.getResource('.');
// Look for .packages.
diff --git a/pkg/analyzer_cli/pubspec.yaml b/pkg/analyzer_cli/pubspec.yaml
index 4943ea9..12abf44 100644
--- a/pkg/analyzer_cli/pubspec.yaml
+++ b/pkg/analyzer_cli/pubspec.yaml
@@ -1,10 +1,6 @@
name: analyzer_cli
-version: 1.1.2
-author: Dart Team <misc@dartlang.org>
description: Command line interface for the Dart Analyzer.
-homepage: https://github.com/dart-lang/analyzer_cli
-environment:
- sdk: '>=1.12.0 <2.0.0'
+publish_to: none
dependencies:
analyzer: ^0.27.0
args: '>=0.13.0 <2.0.0'
diff --git a/pkg/analyzer_cli/test/build_mode_test.dart b/pkg/analyzer_cli/test/build_mode_test.dart
index 0756f1f..90655ef 100644
--- a/pkg/analyzer_cli/test/build_mode_test.dart
+++ b/pkg/analyzer_cli/test/build_mode_test.dart
@@ -134,11 +134,12 @@
List<int> _serializeProto(GeneratedMessage message) {
var buffer = message.writeToBuffer();
-
var writer = new CodedBufferWriter();
writer.writeInt32NoTag(buffer.length);
- writer.writeRawBytes(buffer);
- return writer.toBuffer();
+ List<int> result = [];
+ result.addAll(writer.toBuffer());
+ result.addAll(buffer);
+ return result;
}
}
diff --git a/pkg/analyzer_cli/test/data/analysis_options.yaml b/pkg/analyzer_cli/test/data/analysis_options.yaml
new file mode 100644
index 0000000..2cfcfa6
--- /dev/null
+++ b/pkg/analyzer_cli/test/data/analysis_options.yaml
@@ -0,0 +1,2 @@
+# This empty analysis options file creates a new analysis context in order to
+# isolate the tests from the settings in //pkg/analyzer_cli/analysis_options.yaml.
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index e832287..ac524f9 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -692,14 +692,6 @@
class ExitCodesTest_UseCFE extends ExitCodesTest {
@override
bool get useCFE => true;
-
- @override
- @failingTest
- test_fatalWarnings() => callFailingTest(super.test_fatalWarnings);
-
- @override
- @failingTest
- test_notFatalWarnings() => callFailingTest(super.test_notFatalWarnings);
}
@reflectiveTest
diff --git a/pkg/analyzer_plugin/lib/channel/channel.dart b/pkg/analyzer_plugin/lib/channel/channel.dart
index a524811..92283b6 100644
--- a/pkg/analyzer_plugin/lib/channel/channel.dart
+++ b/pkg/analyzer_plugin/lib/channel/channel.dart
@@ -67,7 +67,7 @@
*/
void listen(void onResponse(Response response),
void onNotification(Notification notification),
- {Function onError, void onDone()});
+ {void onError(dynamic error), void onDone()});
/**
* Send the given [request] to the plugin.
diff --git a/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart b/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart
index 2c4e8c7..0014a4c 100644
--- a/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart
+++ b/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart
@@ -228,7 +228,7 @@
@override
Future<Null> listen(void onResponse(Response response),
void onNotification(Notification notification),
- {Function onError, void onDone()}) async {
+ {void onError(dynamic error), void onDone()}) async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
if (_isolate != null) {
diff --git a/pkg/compiler/lib/compiler_new.dart b/pkg/compiler/lib/compiler_new.dart
index 7d0fd23..a85fe85 100644
--- a/pkg/compiler/lib/compiler_new.dart
+++ b/pkg/compiler/lib/compiler_new.dart
@@ -13,7 +13,6 @@
import 'compiler.dart' show Diagnostic;
import 'src/apiimpl.dart';
-import 'src/library_loader.dart';
import 'src/options.dart' show CompilerOptions;
export 'compiler.dart' show Diagnostic, PackagesDiscoveryProvider;
@@ -134,6 +133,9 @@
/// Use only for debugging and testing.
final compiler;
+ /// Shared state between compilations.
+ ///
+ /// This is used to speed up batch mode.
final fe.InitializedCompilerState kernelInitializedCompilerState;
CompilationResult(this.compiler,
@@ -170,12 +172,9 @@
CompilerImpl compiler = new CompilerImpl(
compilerInput, compilerOutput, compilerDiagnostics, compilerOptions);
return compiler.run(compilerOptions.entryPoint).then((bool success) {
- if (compiler.libraryLoader is KernelLibraryLoaderTask) {
- KernelLibraryLoaderTask loader = compiler.libraryLoader;
- return new CompilationResult(compiler,
- isSuccess: success,
- kernelInitializedCompilerState: loader.initializedCompilerState);
- }
- return new CompilationResult(compiler, isSuccess: success);
+ return new CompilationResult(compiler,
+ isSuccess: success,
+ kernelInitializedCompilerState:
+ compiler.libraryLoader.initializedCompilerState);
});
}
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index f0ebe13..3d5e817 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -76,7 +76,7 @@
api.CompilerOutput get outputProvider => _outputProvider;
- Uri mainLibraryUri;
+ Uri _mainLibraryUri;
JClosedWorld backendClosedWorldForTesting;
@@ -151,8 +151,8 @@
_reporter = new CompilerDiagnosticReporter(this, options);
}
kernelFrontEndTask = new GenericTask('Front end', measurer);
- frontendStrategy = new KernelFrontEndStrategy(kernelFrontEndTask, options,
- reporter, environment, options.kernelInitializedCompilerState);
+ frontendStrategy = new KernelFrontEndStrategy(
+ kernelFrontEndTask, options, reporter, environment);
backendStrategy = new KernelBackendStrategy(this);
_impactCache = <Entity, WorldImpact>{};
_impactCacheDeleter = new _MapImpactCacheDeleter(_impactCache);
@@ -166,7 +166,7 @@
tasks = [
libraryLoader =
- frontendStrategy.createLibraryLoader(provider, reporter, measurer),
+ new LibraryLoaderTask(options, provider, reporter, measurer),
kernelFrontEndTask,
globalInference = new GlobalTypeInferenceTask(this),
constants = backend.constantCompilerTask,
@@ -231,7 +231,10 @@
/// The method returns a [Future] allowing for the loading of additional
/// libraries.
LoadedLibraries processLoadedLibraries(LoadedLibraries loadedLibraries) {
- loadedLibraries.forEachLibrary((LibraryEntity library) {
+ frontendStrategy.registerLoadedLibraries(loadedLibraries);
+ loadedLibraries.forEachLibrary((Uri uri) {
+ LibraryEntity library =
+ frontendStrategy.elementEnvironment.lookupLibrary(uri);
backend.setAnnotations(library);
});
@@ -248,7 +251,6 @@
}
Future runInternal(Uri uri) async {
- mainLibraryUri = uri;
// TODO(ahe): This prevents memory leaks when invoking the compiler
// multiple times. Implement a better mechanism where we can store
// such caches in the compiler and get access to them through a
@@ -265,17 +267,14 @@
assert(uri != null);
// As far as I can tell, this branch is only used by test code.
- LibraryEntity mainApp;
- if (uri != null) {
- reporter.log('Compiling $uri (${options.buildId})');
- LoadedLibraries libraries = await libraryLoader.loadLibrary(uri);
- // Note: libraries may be null because of errors trying to find files or
- // parse-time errors (when using `package:front_end` as a loader).
- if (libraries == null) return;
- processLoadedLibraries(libraries);
- mainApp = libraries.rootLibrary;
- }
- compileLoadedLibraries(mainApp);
+ reporter.log('Compiling $uri (${options.buildId})');
+ LoadedLibraries loadedLibraries = await libraryLoader.loadLibraries(uri);
+ // Note: libraries may be null because of errors trying to find files or
+ // parse-time errors (when using `package:front_end` as a loader).
+ if (loadedLibraries == null) return;
+ _mainLibraryUri = loadedLibraries.rootLibraryUri;
+ processLoadedLibraries(loadedLibraries);
+ compileLoadedLibraries(loadedLibraries);
}
/// Starts the resolution phase, creating the [ResolutionEnqueuer] if not
@@ -294,17 +293,16 @@
return resolutionEnqueuer;
}
- JClosedWorld computeClosedWorld(LibraryEntity rootLibrary) {
+ JClosedWorld computeClosedWorld(LoadedLibraries loadedLibraries) {
ResolutionEnqueuer resolutionEnqueuer = startResolution();
WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
- FunctionEntity mainFunction =
- frontendStrategy.computeMain(rootLibrary, mainImpact);
+ FunctionEntity mainFunction = frontendStrategy.computeMain(mainImpact);
// In order to see if a library is deferred, we must compute the
// compile-time constants that are metadata. This means adding
// something to the resolution queue. So we cannot wait with
// this until after the resolution queue is processed.
- deferredLoadTask.beforeResolution(rootLibrary);
+ deferredLoadTask.beforeResolution(loadedLibraries);
impactStrategy = backend.createImpactStrategy(
supportDeferredLoad: deferredLoadTask.isProgramSplit,
supportDumpInfo: options.dumpInfo);
@@ -314,7 +312,7 @@
reporter.log('Resolving...');
processQueue(frontendStrategy.elementEnvironment, resolutionEnqueuer,
- mainFunction, libraryLoader.libraries,
+ mainFunction, loadedLibraries.libraries,
onProgress: showResolutionProgress);
backend.onResolutionEnd();
resolutionEnqueuer.logSummary(reporter.log);
@@ -348,7 +346,9 @@
mainFunction, closedWorld, inferredDataBuilder);
}
- Enqueuer generateJavaScriptCode(JClosedWorld closedWorld,
+ Enqueuer generateJavaScriptCode(
+ LoadedLibraries loadedLibraries,
+ JClosedWorld closedWorld,
GlobalTypeInferenceResults globalInferenceResults) {
FunctionEntity mainFunction = closedWorld.elementEnvironment.mainFunction;
reporter.log('Compiling...');
@@ -357,7 +357,7 @@
Enqueuer codegenEnqueuer =
startCodegen(closedWorld, globalInferenceResults);
processQueue(closedWorld.elementEnvironment, codegenEnqueuer, mainFunction,
- libraryLoader.libraries,
+ loadedLibraries.libraries,
onProgress: showCodegenProgress);
codegenEnqueuer.logSummary(reporter.log);
@@ -375,15 +375,15 @@
}
/// Performs the compilation when all libraries have been loaded.
- void compileLoadedLibraries(LibraryEntity rootLibrary) =>
+ void compileLoadedLibraries(LoadedLibraries loadedLibraries) =>
selfTask.measureSubtask("Compiler.compileLoadedLibraries", () {
- JClosedWorld closedWorld = computeClosedWorld(rootLibrary);
+ JClosedWorld closedWorld = computeClosedWorld(loadedLibraries);
if (closedWorld != null) {
GlobalTypeInferenceResults globalInferenceResults =
performGlobalTypeInference(closedWorld);
if (stopAfterTypeInference) return;
- Enqueuer codegenEnqueuer =
- generateJavaScriptCode(closedWorld, globalInferenceResults);
+ Enqueuer codegenEnqueuer = generateJavaScriptCode(
+ loadedLibraries, closedWorld, globalInferenceResults);
checkQueues(enqueuer.resolution, codegenEnqueuer);
}
});
@@ -433,7 +433,7 @@
}
void processQueue(ElementEnvironment elementEnvironment, Enqueuer enqueuer,
- FunctionEntity mainMethod, Iterable<LibraryEntity> libraries,
+ FunctionEntity mainMethod, Iterable<Uri> libraries,
{void onProgress(Enqueuer enqueuer)}) {
selfTask.measureSubtask("Compiler.processQueue", () {
enqueuer.open(impactStrategy, mainMethod, libraries);
@@ -543,8 +543,8 @@
Iterable<CodeLocation> computeUserCodeLocations(
{bool assumeInUserCode: false}) {
List<CodeLocation> userCodeLocations = <CodeLocation>[];
- if (mainLibraryUri != null) {
- userCodeLocations.add(new CodeLocation(mainLibraryUri));
+ if (_mainLibraryUri != null) {
+ userCodeLocations.add(new CodeLocation(_mainLibraryUri));
}
if (userCodeLocations.isEmpty && assumeInUserCode) {
// Assume in user code since [mainApp] has not been set yet.
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index fa9b677..8b87744 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -19,6 +19,7 @@
InstantiationConstantValue;
import 'elements/types.dart';
import 'elements/entities.dart';
+import 'library_loader.dart';
import 'universe/use.dart';
import 'universe/world_impact.dart'
show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl;
@@ -362,6 +363,7 @@
}
break;
case TypeUseKind.RTI_VALUE:
+ case TypeUseKind.TYPE_ARGUMENT:
failedAt(element, "Unexpected type use: $typeUse.");
break;
}
@@ -791,16 +793,15 @@
/// Frees up strategy-specific temporary data.
void cleanup() {}
- void beforeResolution(LibraryEntity mainLibrary) {
- if (mainLibrary == null) return;
- for (LibraryEntity library in compiler.libraryLoader.libraries) {
+ void beforeResolution(LoadedLibraries loadedLibraries) {
+ for (Uri uri in loadedLibraries.libraries) {
+ LibraryEntity library = elementEnvironment.lookupLibrary(uri);
reporter.withCurrentElement(library, () {
checkForDeferredErrorCases(library);
for (ImportEntity import in elementEnvironment.getImports(library)) {
if (import.isDeferred) {
- Uri mainLibraryUri = compiler.mainLibraryUri;
- _deferredImportDescriptions[import] =
- new ImportDescription(import, library, mainLibraryUri);
+ _deferredImportDescriptions[import] = new ImportDescription(
+ import, library, loadedLibraries.rootLibraryUri);
isProgramSplit = true;
}
}
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index 7e1492e..3ab906a 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -73,7 +73,7 @@
WorldBuilder get worldBuilder;
void open(ImpactStrategy impactStrategy, FunctionEntity mainMethod,
- Iterable<LibraryEntity> libraries);
+ Iterable<Uri> libraries);
void close();
/// Returns [:true:] if this enqueuer is the resolution enqueuer.
@@ -133,8 +133,8 @@
/// backend specific [WorldImpact] of this is returned.
WorldImpact registerUsedConstant(ConstantValue value);
- void onQueueOpen(Enqueuer enqueuer, FunctionEntity mainMethod,
- Iterable<LibraryEntity> libraries);
+ void onQueueOpen(
+ Enqueuer enqueuer, FunctionEntity mainMethod, Iterable<Uri> libraries);
/// Called when [enqueuer]'s queue is empty, but before it is closed.
///
@@ -177,7 +177,7 @@
ImpactStrategy get impactStrategy => _impactStrategy;
void open(ImpactStrategy impactStrategy, FunctionEntity mainMethod,
- Iterable<LibraryEntity> libraries) {
+ Iterable<Uri> libraries) {
_impactStrategy = impactStrategy;
listener.onQueueOpen(this, mainMethod, libraries);
}
@@ -381,6 +381,7 @@
}
break;
case TypeUseKind.RTI_VALUE:
+ case TypeUseKind.TYPE_ARGUMENT:
failedAt(CURRENT_ELEMENT_SPANNABLE, "Unexpected type use: $typeUse.");
break;
}
diff --git a/pkg/compiler/lib/src/frontend_strategy.dart b/pkg/compiler/lib/src/frontend_strategy.dart
index 45f1261..f136390 100644
--- a/pkg/compiler/lib/src/frontend_strategy.dart
+++ b/pkg/compiler/lib/src/frontend_strategy.dart
@@ -4,9 +4,7 @@
library dart2js.frontend_strategy;
-import '../compiler_new.dart' as api;
import 'common/backend_api.dart';
-import 'common/tasks.dart';
import 'common.dart';
import 'common_elements.dart';
import 'compiler.dart' show Compiler;
@@ -30,9 +28,8 @@
/// Strategy pattern that defines the connection between the input format and
/// the resolved element model.
abstract class FrontendStrategy {
- /// Creates library loader task for this strategy.
- LibraryLoaderTask createLibraryLoader(api.CompilerInput compilerInput,
- DiagnosticReporter reporter, Measurer measurer);
+ /// Registers a set of loaded libraries with this strategy.
+ void registerLoadedLibraries(LoadedLibraries loadedLibraries);
/// Returns the [ElementEnvironment] for the element model used in this
/// strategy.
@@ -88,8 +85,7 @@
/// Computes the main function from [mainLibrary] adding additional world
/// impact to [impactBuilder].
- FunctionEntity computeMain(
- LibraryEntity mainLibrary, WorldImpactBuilder impactBuilder);
+ FunctionEntity computeMain(WorldImpactBuilder impactBuilder);
/// Creates the [RuntimeTypesNeedBuilder] for this strategy.
RuntimeTypesNeedBuilder createRuntimeTypesNeedBuilder();
diff --git a/pkg/compiler/lib/src/js_backend/codegen_listener.dart b/pkg/compiler/lib/src/js_backend/codegen_listener.dart
index bb430e2..8332542 100644
--- a/pkg/compiler/lib/src/js_backend/codegen_listener.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen_listener.dart
@@ -88,8 +88,8 @@
}
@override
- void onQueueOpen(Enqueuer enqueuer, FunctionEntity mainMethod,
- Iterable<LibraryEntity> libraries) {
+ void onQueueOpen(
+ Enqueuer enqueuer, FunctionEntity mainMethod, Iterable<Uri> libraries) {
enqueuer.applyImpact(_nativeEnqueuer.processNativeClasses(libraries));
if (mainMethod != null) {
enqueuer.applyImpact(_computeMainImpact(mainMethod));
diff --git a/pkg/compiler/lib/src/js_backend/enqueuer.dart b/pkg/compiler/lib/src/js_backend/enqueuer.dart
index 7d9d0b3..3b78c2f 100644
--- a/pkg/compiler/lib/src/js_backend/enqueuer.dart
+++ b/pkg/compiler/lib/src/js_backend/enqueuer.dart
@@ -211,6 +211,9 @@
}
break;
case TypeUseKind.RTI_VALUE:
+ _worldBuilder.registerConstTypeLiteral(type);
+ break;
+ case TypeUseKind.TYPE_ARGUMENT:
_worldBuilder.registerTypeArgument(type);
break;
}
diff --git a/pkg/compiler/lib/src/js_backend/impact_transformer.dart b/pkg/compiler/lib/src/js_backend/impact_transformer.dart
index a4fb279..46e3e2d4 100644
--- a/pkg/compiler/lib/src/js_backend/impact_transformer.dart
+++ b/pkg/compiler/lib/src/js_backend/impact_transformer.dart
@@ -203,6 +203,7 @@
hasTypeLiteral = true;
break;
case TypeUseKind.RTI_VALUE:
+ case TypeUseKind.TYPE_ARGUMENT:
failedAt(CURRENT_ELEMENT_SPANNABLE, "Unexpected type use: $typeUse.");
break;
}
diff --git a/pkg/compiler/lib/src/js_backend/resolution_listener.dart b/pkg/compiler/lib/src/js_backend/resolution_listener.dart
index c1b2cac..9e79876 100644
--- a/pkg/compiler/lib/src/js_backend/resolution_listener.dart
+++ b/pkg/compiler/lib/src/js_backend/resolution_listener.dart
@@ -134,8 +134,8 @@
}
@override
- void onQueueOpen(Enqueuer enqueuer, FunctionEntity mainMethod,
- Iterable<LibraryEntity> libraries) {
+ void onQueueOpen(
+ Enqueuer enqueuer, FunctionEntity mainMethod, Iterable<Uri> libraries) {
if (_deferredLoadTask.isProgramSplit) {
enqueuer.applyImpact(_computeDeferredLoadingImpact(),
impactSource: 'deferred load');
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index 00dd8de..95682d0 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -511,13 +511,10 @@
ArgumentCollector collector = new ArgumentCollector();
for (ClassEntity target in checks.classes) {
ClassChecks classChecks = checks[target];
- if (classChecks.isNotEmpty) {
- instantiated.add(target);
- for (TypeCheck check in classChecks.checks) {
- Substitution substitution = check.substitution;
- if (substitution != null) {
- collector.collectAll(substitution.arguments);
- }
+ for (TypeCheck check in classChecks.checks) {
+ Substitution substitution = check.substitution;
+ if (substitution != null) {
+ collector.collectAll(substitution.arguments);
}
}
}
@@ -1862,12 +1859,20 @@
class _RuntimeTypesChecks implements RuntimeTypesChecks {
final RuntimeTypesSubstitutions _substitutions;
final TypeChecks requiredChecks;
+ final Iterable<ClassEntity> _typeLiterals;
+ final Iterable<ClassEntity> _typeArguments;
- _RuntimeTypesChecks(this._substitutions, this.requiredChecks);
+ _RuntimeTypesChecks(this._substitutions, this.requiredChecks,
+ this._typeLiterals, this._typeArguments);
@override
Iterable<ClassEntity> get requiredClasses {
- return _substitutions.getClassesUsedInSubstitutions(requiredChecks);
+ Set<ClassEntity> required = new Set<ClassEntity>();
+ required.addAll(_typeArguments);
+ required.addAll(_typeLiterals);
+ required
+ .addAll(_substitutions.getClassesUsedInSubstitutions(requiredChecks));
+ return required;
}
@override
@@ -1936,6 +1941,8 @@
}
Set<FunctionType> checkedFunctionTypes = new Set<FunctionType>();
+ Set<ClassEntity> typeLiterals = new Set<ClassEntity>();
+ Set<ClassEntity> typeArguments = new Set<ClassEntity>();
TypeVisitor liveTypeVisitor =
new TypeVisitor(onClass: (ClassEntity cls, {TypeVisitorState state}) {
@@ -1943,9 +1950,11 @@
switch (state) {
case TypeVisitorState.typeArgument:
classUse.typeArgument = true;
+ typeArguments.add(cls);
break;
case TypeVisitorState.typeLiteral:
classUse.typeLiteral = true;
+ typeLiterals.add(cls);
break;
case TypeVisitorState.direct:
break;
@@ -1959,6 +1968,7 @@
case TypeVisitorState.typeArgument:
classUse.typeArgument = true;
classUse.checkedTypeArgument = true;
+ typeArguments.add(cls);
break;
case TypeVisitorState.typeLiteral:
break;
@@ -1998,6 +2008,9 @@
codegenWorldBuilder.forEachStaticTypeArgument(processMethodTypeArguments);
codegenWorldBuilder.forEachDynamicTypeArgument(processMethodTypeArguments);
+ codegenWorldBuilder.liveTypeArguments.forEach((DartType type) {
+ liveTypeVisitor.visitType(type, TypeVisitorState.typeArgument);
+ });
codegenWorldBuilder.constTypeLiterals.forEach((DartType type) {
liveTypeVisitor.visitType(type, TypeVisitorState.typeLiteral);
});
@@ -2083,7 +2096,8 @@
cachedRequiredChecks = _computeChecks(classUseMap);
rtiChecksBuilderClosed = true;
- return new _RuntimeTypesChecks(this, cachedRequiredChecks);
+ return new _RuntimeTypesChecks(
+ this, cachedRequiredChecks, typeArguments, typeLiterals);
}
}
@@ -2880,8 +2894,6 @@
Iterable<TypeCheck> get checks => _map.values;
- bool get isNotEmpty => _map.isNotEmpty;
-
String toString() {
return 'ClassChecks($checks)';
}
@@ -2944,12 +2956,10 @@
/// Whether the class is used in a constant type literal.
///
- /// For instance `A`, `B` and `C` in:
+ /// For instance `A`:
///
/// class A {}
- /// class B<T> {}
- /// class C {}
- /// main() => A == B<C>;
+ /// main() => A;
///
bool typeLiteral = false;
diff --git a/pkg/compiler/lib/src/kernel/kernel_strategy.dart b/pkg/compiler/lib/src/kernel/kernel_strategy.dart
index 9e91d03..ee4738f 100644
--- a/pkg/compiler/lib/src/kernel/kernel_strategy.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_strategy.dart
@@ -4,9 +4,6 @@
library dart2js.kernel.frontend_strategy;
-import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
-
-import '../../compiler_new.dart' as api;
import '../common.dart';
import '../common/backend_api.dart';
import '../common/resolution.dart';
@@ -51,32 +48,16 @@
final Map<MemberEntity, ScopeModel> closureModels =
<MemberEntity, ScopeModel>{};
- fe.InitializedCompilerState initializedCompilerState;
-
- KernelFrontEndStrategy(
- this._compilerTask,
- this._options,
- DiagnosticReporter reporter,
- env.Environment environment,
- this.initializedCompilerState) {
+ KernelFrontEndStrategy(this._compilerTask, this._options,
+ DiagnosticReporter reporter, env.Environment environment) {
assert(_compilerTask != null);
_elementMap = new KernelToElementMapForImpactImpl(
reporter, environment, this, _options);
}
@override
- LibraryLoaderTask createLibraryLoader(api.CompilerInput compilerInput,
- DiagnosticReporter reporter, Measurer measurer) {
- return new KernelLibraryLoaderTask(
- _options.librariesSpecificationUri,
- _options.platformBinaries,
- _options.packageConfig,
- _elementMap,
- compilerInput,
- reporter,
- measurer,
- verbose: _options.verbose,
- initializedCompilerState: initializedCompilerState);
+ void registerLoadedLibraries(LoadedLibraries loadedLibraries) {
+ _elementMap.addComponent(loadedLibraries.component);
}
@override
@@ -109,8 +90,7 @@
/// Computes the main function from [mainLibrary] adding additional world
/// impact to [impactBuilder].
- FunctionEntity computeMain(
- LibraryEntity mainLibrary, WorldImpactBuilder impactBuilder) {
+ FunctionEntity computeMain(WorldImpactBuilder impactBuilder) {
return elementEnvironment.mainFunction;
}
diff --git a/pkg/compiler/lib/src/kernel/runtime_type_analysis.dart b/pkg/compiler/lib/src/kernel/runtime_type_analysis.dart
index 096c9b2..1edab46 100644
--- a/pkg/compiler/lib/src/kernel/runtime_type_analysis.dart
+++ b/pkg/compiler/lib/src/kernel/runtime_type_analysis.dart
@@ -305,6 +305,6 @@
DartType receiverType = elementMap.getStaticType(receiver);
DartType argumentType =
- argument == null ? argument : elementMap.getStaticType(argument);
+ argument == null ? null : elementMap.getStaticType(argument);
return new RuntimeTypeUse(kind, receiverType, argumentType);
}
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index 25e576b..5a86659 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -7,7 +7,6 @@
import 'dart:async';
import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
-import 'package:front_end/src/fasta/util/link.dart' show Link;
import 'package:kernel/ast.dart' as ir;
import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
import 'package:kernel/kernel.dart' hide LibraryDependency, Combinator;
@@ -19,125 +18,7 @@
import 'common/tasks.dart' show CompilerTask, Measurer;
import 'common.dart';
-import 'elements/entities.dart' show LibraryEntity;
-import 'kernel/element_map_impl.dart' show KernelToElementMapForImpactImpl;
-import 'resolved_uri_translator.dart';
-
-/**
- * [CompilerTask] for loading libraries and setting up the import/export scopes.
- *
- * The library loader uses four different kinds of URIs in different parts of
- * the loading process.
- *
- * ## User URI ##
- *
- * A 'user URI' is a URI provided by the user in code and as the main entry URI
- * at the command line. These generally come in 3 versions:
- *
- * * A relative URI such as 'foo.dart', '../bar.dart', and 'baz/boz.dart'.
- *
- * * A dart URI such as 'dart:core' and 'dart:_js_helper'.
- *
- * * A package URI such as 'package:foo.dart' and 'package:bar/baz.dart'.
- *
- * A user URI can also be absolute, like 'file:///foo.dart' or
- * 'http://example.com/bar.dart', but such URIs cannot necessarily be used for
- * locating source files, since the scheme must be supported by the input
- * provider. The standard input provider for dart2js only supports the 'file'
- * and 'http' scheme.
- *
- * ## Resolved URI ##
- *
- * A 'resolved URI' is a (user) URI that has been resolved to an absolute URI
- * based on the readable URI (see below) from which it was loaded. A URI with an
- * explicit scheme (such as 'dart:', 'package:' or 'file:') is already resolved.
- * A relative URI like for instance '../foo/bar.dart' is translated into an
- * resolved URI in one of three ways:
- *
- * * If provided as the main entry URI at the command line, the URI is resolved
- * relative to the current working directory, say
- * 'file:///current/working/dir/', and the resolved URI is therefore
- * 'file:///current/working/foo/bar.dart'.
- *
- * * If the relative URI is provided in an import, export or part tag, and the
- * readable URI of the enclosing compilation unit is a file URI,
- * 'file://some/path/baz.dart', then the resolved URI is
- * 'file://some/foo/bar.dart'.
- *
- * * If the relative URI is provided in an import, export or part tag, and the
- * readable URI of the enclosing compilation unit is a package URI,
- * 'package:some/path/baz.dart', then the resolved URI is
- * 'package:some/foo/bar.dart'.
- *
- * The resolved URI thus preserves the scheme through resolution: A readable
- * file URI results in an resolved file URI and a readable package URI results
- * in an resolved package URI. Note that since a dart URI is not a readable URI,
- * import, export or part tags within platform libraries are not interpreted as
- * dart URIs but instead relative to the library source file location.
- *
- * The resolved URI of a library is also used as the canonical URI
- * ([LibraryElement.canonicalUri]) by which we identify which libraries are
- * identical. This means that libraries loaded through the 'package' scheme will
- * resolve to the same library when loaded from within using relative URIs (see
- * for instance the test 'standalone/package/package1_test.dart'). But loading a
- * platform library using a relative URI will _not_ result in the same library
- * as when loaded through the dart URI.
- *
- * ## Readable URI ##
- *
- * A 'readable URI' is an absolute URI whose scheme is either 'package' or
- * something supported by the input provider, normally 'file'. Dart URIs such as
- * 'dart:core' and 'dart:_js_helper' are not readable themselves but are instead
- * resolved into a readable URI using the library root URI provided from the
- * command line and the list of platform libraries found in
- * 'sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart'. This is done
- * through a [ResolvedUriTranslator] provided from the compiler. The translator
- * checks whether a library by that name exists and in case of internal
- * libraries whether access is granted.
- *
- * ## Resource URI ##
- *
- * A 'resource URI' is an absolute URI with a scheme supported by the input
- * provider. For the standard implementation this means a URI with the 'file'
- * scheme. Readable URIs are converted into resource URIs as part of the
- * [ScriptLoader.readScript] method. In the standard implementation the package
- * URIs are converted to file URIs using the package root URI provided on the
- * command line as base. If the package root URI is
- * 'file:///current/working/dir/' then the package URI 'package:foo/bar.dart'
- * will be resolved to the resource URI
- * 'file:///current/working/dir/foo/bar.dart'.
- *
- * The distinction between readable URI and resource URI is necessary to ensure
- * that these imports
- *
- * import 'package:foo.dart' as a;
- * import 'packages/foo.dart' as b;
- *
- * do _not_ resolve to the same library when the package root URI happens to
- * point to the 'packages' folder.
- *
- */
-abstract class LibraryLoaderTask implements LibraryProvider, CompilerTask {
- /// Returns all libraries that have been loaded.
- Iterable<LibraryEntity> get libraries;
-
- /// Loads the library specified by the [resolvedUri] and returns the
- /// [LoadedLibraries] that were loaded to load the specified uri. The
- /// [LibraryElement] itself can be found by calling
- /// `loadedLibraries.rootLibrary`.
- ///
- /// If the library is not already loaded, the method creates the
- /// [LibraryElement] for the library and computes the import/export scope,
- /// loading and computing the import/export scopes of all required libraries
- /// in the process. The method handles cyclic dependency between libraries.
- Future<LoadedLibraries> loadLibrary(Uri resolvedUri);
-}
-
-/// Interface for an entity that provide libraries.
-abstract class LibraryProvider {
- /// Looks up the library with the [canonicalUri].
- LibraryEntity lookupLibrary(Uri canonicalUri);
-}
+import 'options.dart';
/// A loader that builds a kernel IR representation of the component.
///
@@ -145,56 +26,35 @@
/// When given .dart source files, it invokes the shared frontend
/// (`package:front_end`) to produce the corresponding kernel IR representation.
// TODO(sigmund): move this class to a new file under src/kernel/.
-class KernelLibraryLoaderTask extends CompilerTask
- implements LibraryLoaderTask {
- final Uri librariesSpecification;
- final Uri platformBinaries;
- final Uri _packageConfig;
+class LibraryLoaderTask extends CompilerTask {
+ final DiagnosticReporter _reporter;
- final DiagnosticReporter reporter;
+ final api.CompilerInput _compilerInput;
- final api.CompilerInput compilerInput;
+ final CompilerOptions _options;
- /// Holds the mapping of Kernel IR to KElements that is constructed as a
- /// result of loading a component.
- final KernelToElementMapForImpactImpl _elementMap;
-
- final bool verbose;
-
- List<LibraryEntity> _allLoadedLibraries;
-
+ /// Shared state between compilations.
fe.InitializedCompilerState initializedCompilerState;
- KernelLibraryLoaderTask(
- this.librariesSpecification,
- this.platformBinaries,
- this._packageConfig,
- this._elementMap,
- this.compilerInput,
- this.reporter,
- Measurer measurer,
- {this.verbose: false,
- this.initializedCompilerState})
- : _allLoadedLibraries = new List<LibraryEntity>(),
+ LibraryLoaderTask(
+ this._options, this._compilerInput, this._reporter, Measurer measurer)
+ : initializedCompilerState = _options.kernelInitializedCompilerState,
super(measurer);
- /// Loads an entire Kernel [Component] from a file on disk (note, not just a
- /// library, so this name is actually a bit of a misnomer).
- // TODO(efortuna): Rename this once the Element library loader class goes
- // away.
- Future<LoadedLibraries> loadLibrary(Uri resolvedUri) {
+ /// Loads an entire Kernel [Component] from a file on disk.
+ Future<LoadedLibraries> loadLibraries(Uri resolvedUri) {
return measure(() async {
var isDill = resolvedUri.path.endsWith('.dill');
ir.Component component;
if (isDill) {
- api.Input input = await compilerInput.readFromUri(resolvedUri,
+ api.Input input = await _compilerInput.readFromUri(resolvedUri,
inputKind: api.InputKind.binary);
component = new ir.Component();
new BinaryBuilder(input.data).readComponent(component);
} else {
- bool strongMode = _elementMap.options.strongMode;
+ bool strongMode = _options.strongMode;
String targetName =
- _elementMap.options.compileForServer ? "dart2js_server" : "dart2js";
+ _options.compileForServer ? "dart2js_server" : "dart2js";
String platform = strongMode
? '${targetName}_platform_strong.dill'
: '${targetName}_platform.dill';
@@ -202,29 +62,28 @@
initializedCompilerState,
new Dart2jsTarget(
targetName, new TargetFlags(strongMode: strongMode)),
- librariesSpecification,
- platformBinaries.resolve(platform),
- _packageConfig);
+ _options.librariesSpecificationUri,
+ _options.platformBinaries.resolve(platform),
+ _options.packageConfig);
component = await fe.compile(
initializedCompilerState,
- verbose,
- new CompilerFileSystem(compilerInput),
- (e) => reportFrontEndMessage(reporter, e),
+ _options.verbose,
+ new CompilerFileSystem(_compilerInput),
+ (e) => reportFrontEndMessage(_reporter, e),
resolvedUri);
}
if (component == null) return null;
- return createLoadedLibraries(component);
+ return _createLoadedLibraries(component);
});
}
// Only visible for unit testing.
- LoadedLibraries createLoadedLibraries(ir.Component component) {
- _elementMap.addComponent(component);
- LibraryEntity rootLibrary = null;
+ LoadedLibraries _createLoadedLibraries(ir.Component component) {
+ Uri rootLibraryUri = null;
Iterable<ir.Library> libraries = component.libraries;
if (component.mainMethod != null) {
var root = component.mainMethod.enclosingLibrary;
- rootLibrary = _elementMap.lookupLibrary(root.importUri);
+ rootLibraryUri = root.importUri;
// Filter unreachable libraries: [Component] was built by linking in the
// entire SDK libraries, not all of them are used. We include anything
@@ -248,74 +107,38 @@
libraries = libraries.where(seen.contains);
}
- _allLoadedLibraries.addAll(
- libraries.map((lib) => _elementMap.lookupLibrary(lib.importUri)));
- return new _LoadedLibrariesAdapter(
- rootLibrary, _allLoadedLibraries, _elementMap);
- }
-
- KernelToElementMapForImpactImpl get elementMap => _elementMap;
-
- Iterable<LibraryEntity> get libraries => _allLoadedLibraries;
-
- LibraryEntity lookupLibrary(Uri canonicalUri) {
- return _elementMap?.lookupLibrary(canonicalUri);
+ return new LoadedLibraries(component, rootLibraryUri,
+ libraries.map((lib) => lib.importUri).toList());
}
}
/// Information on the set libraries loaded as a result of a call to
/// [LibraryLoader.loadLibrary].
-abstract class LoadedLibraries {
- /// The access the library object created corresponding to the library
- /// passed to [LibraryLoader.loadLibrary].
- LibraryEntity get rootLibrary;
+class LoadedLibraries {
+ final ir.Component _component;
+ final Uri _rootLibraryUri;
+ final List<Uri> _libraries;
+
+ LoadedLibraries(this._component, this._rootLibraryUri, this._libraries) {
+ assert(rootLibraryUri != null);
+ }
+
+ /// Returns the root component for the loaded libraries.
+ ir.Component get component => _component;
+
+ /// The [Uri] of the root library.
+ Uri get rootLibraryUri => _rootLibraryUri;
+
+ /// Returns the [Uri]s of all libraries that have been loaded.
+ Iterable<Uri> get libraries => _libraries;
/// Returns `true` if a library with canonical [uri] was loaded in this bulk.
- bool containsLibrary(Uri uri);
-
- /// Returns the library with canonical [uri] that was loaded in this bulk.
- LibraryEntity getLibrary(Uri uri);
-
- /// Applies all libraries in this bulk to [f].
- void forEachLibrary(f(LibraryEntity library));
-
- /// Applies all imports chains of [uri] in this bulk to [callback].
- ///
- /// The argument [importChainReversed] to [callback] contains the chain of
- /// imports uris that lead to importing [uri] starting in [uri] and ending in
- /// the uri that was passed in with [loadLibrary].
- ///
- /// [callback] is called once for each chain of imports leading to [uri] until
- /// [callback] returns `false`.
- void forEachImportChain(Uri uri,
- {bool callback(Link<Uri> importChainReversed)});
-}
-
-/// Adapter class to mimic the behavior of LoadedLibraries for Kernel element
-/// behavior. Ultimately we'll just access worldBuilder instead.
-class _LoadedLibrariesAdapter implements LoadedLibraries {
- final LibraryEntity rootLibrary;
- final List<LibraryEntity> _newLibraries;
- final KernelToElementMapForImpactImpl worldBuilder;
-
- _LoadedLibrariesAdapter(
- this.rootLibrary, this._newLibraries, this.worldBuilder) {
- assert(rootLibrary != null);
- }
-
bool containsLibrary(Uri uri) {
- var lib = getLibrary(uri);
- return lib != null && _newLibraries.contains(lib);
+ return _libraries.contains(uri);
}
- LibraryEntity getLibrary(Uri uri) => worldBuilder.lookupLibrary(uri);
+ /// Applies all library [Uri]s in this bulk to [f].
+ void forEachLibrary(f(Uri Uri)) => _libraries.forEach(f);
- void forEachLibrary(f(LibraryEntity library)) => _newLibraries.forEach(f);
-
- void forEachImportChain(Uri uri,
- {bool callback(Link<Uri> importChainReversed)}) {
- // Currently a no-op. This seems wrong.
- }
-
- String toString() => 'root=$rootLibrary,libraries=${_newLibraries}';
+ String toString() => 'root=$_rootLibraryUri,libraries=${_libraries}';
}
diff --git a/pkg/compiler/lib/src/native/enqueue.dart b/pkg/compiler/lib/src/native/enqueue.dart
index 543d330..968b7cf 100644
--- a/pkg/compiler/lib/src/native/enqueue.dart
+++ b/pkg/compiler/lib/src/native/enqueue.dart
@@ -22,7 +22,7 @@
void onInstantiatedType(InterfaceType type) {}
/// Initial entry point to native enqueuer.
- WorldImpact processNativeClasses(Iterable<LibraryEntity> libraries) =>
+ WorldImpact processNativeClasses(Iterable<Uri> libraries) =>
const WorldImpact();
/// Registers the [nativeBehavior]. Adds the liveness of its instantiated
@@ -191,7 +191,7 @@
Iterable<ClassEntity> get liveNativeClasses => _registeredClasses;
- WorldImpact processNativeClasses(Iterable<LibraryEntity> libraries) {
+ WorldImpact processNativeClasses(Iterable<Uri> libraries) {
WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
Iterable<ClassEntity> nativeClasses =
_nativeClassFinder.computeNativeClasses(libraries);
@@ -227,7 +227,7 @@
this._nativeData)
: super(options, elementEnvironment, commonElements, dartTypes);
- WorldImpact processNativeClasses(Iterable<LibraryEntity> libraries) {
+ WorldImpact processNativeClasses(Iterable<Uri> libraries) {
WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
_unusedClasses.addAll(_nativeClasses);
diff --git a/pkg/compiler/lib/src/native/resolver.dart b/pkg/compiler/lib/src/native/resolver.dart
index 5da0d2e..a404474 100644
--- a/pkg/compiler/lib/src/native/resolver.dart
+++ b/pkg/compiler/lib/src/native/resolver.dart
@@ -146,7 +146,7 @@
/// Determines all native classes in a set of libraries.
abstract class NativeClassFinder {
/// Returns the set of all native classes declared in [libraries].
- Iterable<ClassEntity> computeNativeClasses(Iterable<LibraryEntity> libraries);
+ Iterable<ClassEntity> computeNativeClasses(Iterable<Uri> libraries);
}
class BaseNativeClassFinder implements NativeClassFinder {
@@ -157,10 +157,10 @@
BaseNativeClassFinder(this._elementEnvironment, this._nativeBasicData);
- Iterable<ClassEntity> computeNativeClasses(
- Iterable<LibraryEntity> libraries) {
+ Iterable<ClassEntity> computeNativeClasses(Iterable<Uri> libraries) {
Set<ClassEntity> nativeClasses = new Set<ClassEntity>();
- libraries.forEach((l) => _processNativeClassesInLibrary(l, nativeClasses));
+ libraries.forEach((uri) => _processNativeClassesInLibrary(
+ _elementEnvironment.lookupLibrary(uri), nativeClasses));
_processSubclassesOfNativeClasses(libraries, nativeClasses);
return nativeClasses;
}
@@ -207,7 +207,7 @@
/// Adds all subclasses of [nativeClasses] found in [libraries] to
/// [nativeClasses].
void _processSubclassesOfNativeClasses(
- Iterable<LibraryEntity> libraries, Set<ClassEntity> nativeClasses) {
+ Iterable<Uri> libraries, Set<ClassEntity> nativeClasses) {
Set<ClassEntity> nativeClassesAndSubclasses = new Set<ClassEntity>();
// Collect potential subclasses, e.g.
//
@@ -218,7 +218,8 @@
Map<String, Set<ClassEntity>> potentialExtends =
<String, Set<ClassEntity>>{};
- libraries.forEach((LibraryEntity library) {
+ libraries.forEach((Uri uri) {
+ LibraryEntity library = _elementEnvironment.lookupLibrary(uri);
_elementEnvironment.forEachClass(library, (ClassEntity cls) {
String extendsName = _findExtendsNameOfClass(cls);
if (extendsName != null) {
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 78867a0..188caba 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -2040,7 +2040,7 @@
void visitElse(),
SourceInformation sourceInformation}) {
SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this,
- node == null ? node : _elementMap.getSpannable(targetElement, node));
+ node == null ? null : _elementMap.getSpannable(targetElement, node));
branchBuilder.handleIf(visitCondition, visitThen, visitElse,
sourceInformation: sourceInformation);
}
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 947432d..2b1adbc 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -3098,6 +3098,10 @@
void visitTypeInfoExpression(HTypeInfoExpression node) {
DartType type = node.dartType;
+ if (node.isTypeVariableReplacement) {
+ _registry.registerTypeUse(new TypeUse.typeArgument(type));
+ }
+
List<js.Expression> arguments = <js.Expression>[];
for (HInstruction input in node.inputs) {
use(input);
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index 4451c74..9488821 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -3699,8 +3699,13 @@
class HTypeInfoExpression extends HInstruction {
final TypeInfoExpressionKind kind;
final DartType dartType;
+
+ /// `true` if this
+ final bool isTypeVariableReplacement;
+
HTypeInfoExpression(this.kind, this.dartType, List<HInstruction> inputs,
- AbstractValue instructionType)
+ AbstractValue instructionType,
+ {this.isTypeVariableReplacement: false})
: super(inputs, instructionType) {
setUseGvn();
}
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 17d701f..145497d 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -1404,7 +1404,8 @@
TypeInfoExpressionKind.COMPLETE,
typeArgument,
const <HInstruction>[],
- _abstractValueDomain.dynamicType);
+ _abstractValueDomain.dynamicType,
+ isTypeVariableReplacement: true);
return replacement;
}
return node;
@@ -1436,7 +1437,8 @@
TypeInfoExpressionKind.COMPLETE,
type,
arguments,
- _abstractValueDomain.dynamicType);
+ _abstractValueDomain.dynamicType,
+ isTypeVariableReplacement: true);
return replacement;
}
diff --git a/pkg/compiler/lib/src/universe/codegen_world_builder.dart b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
index cc99a9d..0e371ba 100644
--- a/pkg/compiler/lib/src/universe/codegen_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
@@ -80,6 +80,9 @@
/// Returns the types that are live as constant type literals.
Iterable<DartType> get constTypeLiterals;
+
+ /// Returns the types that are live as constant type literals.
+ Iterable<DartType> get liveTypeArguments;
}
class CodegenWorldBuilderImpl extends WorldBuilderBase
@@ -165,6 +168,7 @@
final KernelToWorldBuilder _elementMap;
final GlobalLocalsMap _globalLocalsMap;
+ final Set<DartType> _constTypeLiterals = new Set<DartType>();
final Set<DartType> _liveTypeArguments = new Set<DartType>();
CodegenWorldBuilderImpl(
@@ -692,9 +696,15 @@
});
}
+ void registerConstTypeLiteral(DartType type) {
+ _constTypeLiterals.add(type);
+ }
+
+ Iterable<DartType> get constTypeLiterals => _constTypeLiterals;
+
void registerTypeArgument(DartType type) {
_liveTypeArguments.add(type);
}
- Iterable<DartType> get constTypeLiterals => _liveTypeArguments;
+ Iterable<DartType> get liveTypeArguments => _liveTypeArguments;
}
diff --git a/pkg/compiler/lib/src/universe/use.dart b/pkg/compiler/lib/src/universe/use.dart
index 9972e88..f6d00aa 100644
--- a/pkg/compiler/lib/src/universe/use.dart
+++ b/pkg/compiler/lib/src/universe/use.dart
@@ -577,6 +577,7 @@
IMPLICIT_CAST,
PARAMETER_CHECK,
RTI_VALUE,
+ TYPE_ARGUMENT,
}
/// Use of a [DartType].
@@ -625,6 +626,9 @@
sb.write('param:');
break;
case TypeUseKind.RTI_VALUE:
+ sb.write('rti:');
+ break;
+ case TypeUseKind.TYPE_ARGUMENT:
sb.write('typeArg:');
break;
}
@@ -695,6 +699,14 @@
return new TypeUse.internal(type, TypeUseKind.RTI_VALUE);
}
+ /// [type] used directly as a type argument.
+ ///
+ /// The happens during optimization where a type variable can be replaced by
+ /// an invariable type argument derived from a constant receiver.
+ factory TypeUse.typeArgument(DartType type) {
+ return new TypeUse.internal(type, TypeUseKind.TYPE_ARGUMENT);
+ }
+
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! TypeUse) return false;
diff --git a/pkg/dev_compiler/karma.conf.js b/pkg/dev_compiler/karma.conf.js
deleted file mode 100644
index f43a6ca..0000000
--- a/pkg/dev_compiler/karma.conf.js
+++ /dev/null
@@ -1,105 +0,0 @@
-// Karma configuration
-// Generated on Mon Apr 20 2015 06:33:20 GMT-0700 (PDT)
-
-module.exports = function(config) {
- var configuration = {
-
- // base path that will be used to resolve all patterns (eg. files, exclude)
- basePath: '',
-
- // frameworks to use
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
- frameworks: ['mocha', 'requirejs', 'chai'],
-
- // list of files / patterns to load in the browser
- files: [
- {pattern: 'lib/js/amd/dart_sdk.js', included: false},
- {pattern: 'gen/codegen_output/*.js', included: false},
- {pattern: 'gen/codegen_output/pkg/*.js', included: false},
- {pattern: 'gen/codegen_output/language/**/*.js', included: false},
- {pattern: 'gen/codegen_output/corelib/**/*.js', included: false},
- {pattern: 'gen/codegen_output/lib/**/*.js', included: false},
- {pattern: 'gen/codegen_tests/lib/**/*.txt', included: false},
- {pattern: 'test/browser/*.js', included: false},
- {pattern: 'node_modules/is_js/*.js', included: false},
- 'test-main.js',
- ],
-
- // list of files to exclude
- exclude: [],
-
- // preprocess matching files before serving them to the browser
- // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
- preprocessors: {
- },
-
- client: {
- captureConsole: false,
- mocha: {
- ui: 'tdd',
- timeout : 6000
- },
- },
-
- // test results reporter to use
- // possible values: 'dots', 'progress'
- // available reporters: https://npmjs.org/browse/keyword/karma-reporter
- reporters: ['progress'],
-
- // web server port
- port: 9876,
-
- // Proxy required to serve resources needed by tests.
- proxies: {
- '/root_dart/tests/lib/': '/base/gen/codegen_tests/lib/'
- },
-
- // enable / disable colors in the output (reporters and logs)
- colors: true,
-
- // level of logging
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
- logLevel: config.LOG_INFO,
-
- // enable / disable watching file and executing tests whenever any file changes
- autoWatch: true,
-
- browserNoActivityTimeout: 60000,
- browserDisconnectTolerance: 5,
-
- // start these browsers
- // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
- customLaunchers: {
- ChromeTravis: {
- base: 'Chrome',
- flags: [ '--no-sandbox' ]
- },
-
- ChromeCanaryTravis: {
- base: 'ChromeCanary',
- flags: [ '--no-sandbox' ]
- },
- },
-
- browsers: ['Chrome'],
-
- // Continuous Integration mode
- // if true, Karma captures browsers, runs the tests and exits
- singleRun: false,
- };
-
- if (process.env.TRAVIS) {
- configuration.browsers = ['ChromeTravis'];
- configuration.autoWatch = false;
- // Enable this for more logging on Travis. It is too much for Travis to
- // automatically display, but still results in a downloadable raw log.
- // configuration.logLevel = config.LOG_DEBUG;
- configuration.client.captureConsole = true;
- }
-
- if (process.env.DDC_BROWSERS) {
- configuration.browsers = process.env.DDC_BROWSERS.split(':');
- }
-
- config.set(configuration);
-};
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index fdda18f..c39397d 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -35,7 +35,6 @@
import 'package:path/path.dart' as path;
import 'package:source_span/source_span.dart' show SourceLocation;
-import '../closure/closure_annotator.dart' show ClosureAnnotator;
import '../compiler/js_metalet.dart' as JS;
import '../compiler/js_names.dart' as JS;
import '../compiler/js_utils.dart' as JS;
@@ -46,9 +45,9 @@
import '../js_ast/source_map_printer.dart' show NodeEnd, NodeSpan, HoverComment;
import 'ast_builder.dart';
import 'element_helpers.dart';
+import 'error_helpers.dart';
import 'extension_types.dart' show ExtensionTypeSet;
import 'js_interop.dart';
-import 'js_typeref_codegen.dart' show JSTypeRefCodegen;
import 'js_typerep.dart';
import 'module_compiler.dart' show BuildUnit, CompilerOptions, JSModuleFile;
import 'nullable_type_inference.dart' show NullableTypeInference;
@@ -73,17 +72,17 @@
// expressions (which result in JS.Expression) and statements
// (which result in (JS.Statement).
class CodeGenerator extends Object
- with
- ClosureAnnotator,
- JSTypeRefCodegen,
- NullableTypeInference,
- SharedCompiler<LibraryElement>
+ with NullableTypeInference, SharedCompiler<LibraryElement>
implements AstVisitor<JS.Node> {
final AnalysisContext context;
final SummaryDataStore summaryData;
final CompilerOptions options;
final StrongTypeSystemImpl rules;
+
+ /// Errors that were produced during compilation, if any.
+ final List<AnalysisError> errors;
+
JSTypeRep jsTypeRep;
/// The set of libraries we are currently compiling, and the temporaries used
@@ -204,8 +203,8 @@
final _usedCovariantPrivateMembers = HashSet<ExecutableElement>();
- CodeGenerator(
- AnalysisContext c, this.summaryData, this.options, this._extensionTypes)
+ CodeGenerator(AnalysisContext c, this.summaryData, this.options,
+ this._extensionTypes, this.errors)
: context = c,
rules = StrongTypeSystemImpl(c.typeProvider),
types = c.typeProvider,
@@ -252,18 +251,53 @@
///
/// Takes the metadata for the build unit, as well as resolved trees and
/// errors, and computes the output module code and optionally the source map.
- JSModuleFile compile(BuildUnit unit, List<CompilationUnit> compilationUnits,
- List<String> errors) {
+ JSModuleFile compile(BuildUnit unit, List<CompilationUnit> compilationUnits) {
_buildUnit = unit;
_libraryRoot = _buildUnit.libraryRoot;
if (!_libraryRoot.endsWith(path.separator)) {
_libraryRoot += path.separator;
}
- var module = _emitModule(compilationUnits, unit.name);
- var dartApiSummary = _summarizeModule(compilationUnits);
+ invalidModule() =>
+ JSModuleFile.invalid(unit.name, formatErrors(context, errors), options);
- return JSModuleFile(unit.name, errors, options, module, dartApiSummary);
+ if (!options.unsafeForceCompile && errors.any(_isFatalError)) {
+ return invalidModule();
+ }
+
+ try {
+ var module = _emitModule(compilationUnits, unit.name);
+ if (!options.unsafeForceCompile && errors.any(_isFatalError)) {
+ return invalidModule();
+ }
+
+ var dartApiSummary = _summarizeModule(compilationUnits);
+ return JSModuleFile(unit.name, formatErrors(context, errors), options,
+ module, dartApiSummary);
+ } catch (e) {
+ if (errors.any(_isFatalError)) {
+ // Force compilation failed. Suppress the exception and report
+ // the static errors instead.
+ assert(options.unsafeForceCompile);
+ return invalidModule();
+ }
+ rethrow;
+ }
+ }
+
+ bool _isFatalError(AnalysisError e) {
+ if (errorSeverity(context, e) != ErrorSeverity.ERROR) return false;
+
+ // These errors are not fatal in the REPL compile mode as we
+ // allow access to private members across library boundaries
+ // and those accesses will show up as undefined members unless
+ // additional analyzer changes are made to support them.
+ // TODO(jacobr): consider checking that the identifier name
+ // referenced by the error is private.
+ return !options.replCompile ||
+ (e.errorCode != StaticTypeWarningCode.UNDEFINED_GETTER &&
+ e.errorCode != StaticTypeWarningCode.UNDEFINED_SETTER &&
+ e.errorCode != StaticTypeWarningCode.UNDEFINED_METHOD);
}
List<int> _summarizeModule(List<CompilationUnit> units) {
@@ -831,13 +865,10 @@
}
}
- JS.Expression body = closureAnnotate(
- runtimeCall('typedef(#, () => #)', [
- js.string(element.name, "'"),
- _emitFunctionType(type, nameType: false)
- ]),
- element,
- node);
+ JS.Expression body = runtimeCall('typedef(#, () => #)', [
+ js.string(element.name, "'"),
+ _emitFunctionType(type, nameType: false)
+ ]);
if (typeFormals.isNotEmpty) {
return _defineClassTypeArguments(element, typeFormals,
@@ -1191,19 +1222,6 @@
.toList(growable: false);
}
- /// Emits a field declaration for TypeScript & Closure's ES6_TYPED
- /// (e.g. `class Foo { i: string; }`)
- JS.VariableDeclarationList _emitTypeScriptField(FieldElement field) {
- return JS.VariableDeclarationList(field.isStatic ? 'static' : null, [
- JS.VariableInitialization(
- JS.Identifier(
- // TODO(ochafik): use a refactored _emitMemberName instead.
- field.name,
- type: emitTypeRef(field.type)),
- null)
- ]);
- }
-
@override
JS.Statement visitEnumDeclaration(EnumDeclaration node) {
return _emitClassDeclaration(node, node.element, []);
@@ -1239,19 +1257,12 @@
JS.Expression className,
JS.Expression heritage,
List<JS.Method> methods) {
- var typeParams = _emitTypeFormals(classElem.typeParameters);
-
- var jsFields = options.closure
- ? classElem.fields.map(_emitTypeScriptField).toList()
- : null;
if (classElem.typeParameters.isNotEmpty) {
- return JS.ClassExpression(className as JS.Identifier, heritage, methods,
- typeParams: typeParams, fields: jsFields)
+ return JS.ClassExpression(className as JS.Identifier, heritage, methods)
.toStatement();
}
- var classExpr = JS.ClassExpression(
- JS.TemporaryId(classElem.name), heritage, methods,
- typeParams: typeParams, fields: jsFields);
+ var classExpr =
+ JS.ClassExpression(JS.TemporaryId(classElem.name), heritage, methods);
return js.statement('# = #;', [className, classExpr]);
}
@@ -1608,8 +1619,7 @@
body.add(js.statement(
'return super.#(#)(#);', [name, typeFormals, jsParams]));
}
- var fn = JS.Fun(jsParams, JS.Block(body),
- typeParams: typeFormals, returnType: emitTypeRef(type.returnType));
+ var fn = JS.Fun(jsParams, JS.Block(body));
methods.add(JS.Method(name, fn));
} else {
throw StateError(
@@ -1624,7 +1634,6 @@
if (isUnsupportedFactoryConstructor(node)) return null;
var element = node.element;
- var returnType = emitTypeRef(element.returnType);
var name = _constructorName(element.name);
JS.Fun fun;
@@ -1647,8 +1656,7 @@
js.statement('return $newKeyword #(#)',
[visitConstructorName(redirect), params])
..sourceInformation = _nodeStart(redirect)
- ]),
- returnType: returnType);
+ ]));
} else {
// Normal factory constructor
var body = <JS.Statement>[];
@@ -1657,16 +1665,13 @@
body.add(_visitStatement(node.body));
var params = _emitParameters(node.parameters?.parameters);
- fun = JS.Fun(params, JS.Block(body), returnType: returnType);
+ fun = JS.Fun(params, JS.Block(body));
}
_currentFunction = savedFunction;
- return closureAnnotate(
- JS.Method(name, fun, isStatic: true)
- ..sourceInformation = _functionEnd(node),
- element,
- node);
+ return JS.Method(name, fun, isStatic: true)
+ ..sourceInformation = _functionEnd(node);
}
/// Given a class C that implements method M from interface I, but does not
@@ -1744,7 +1749,7 @@
return JS.Method(
_declareMemberName(method,
useExtension: _extensionTypes.isNativeClass(type.element)),
- JS.Fun(fnArgs, fnBlock, typeParams: typeParams),
+ JS.Fun(fnArgs, fnBlock),
isGetter: method is PropertyAccessorElement && method.isGetter,
isSetter: method is PropertyAccessorElement && method.isSetter,
isStatic: false);
@@ -2590,14 +2595,11 @@
fn = _emitFunction(node.element, node.parameters, node.body);
}
- return closureAnnotate(
- JS.Method(_declareMemberName(node.element), fn,
- isGetter: node.isGetter,
- isSetter: node.isSetter,
- isStatic: node.isStatic)
- ..sourceInformation = _functionEnd(node),
- node.element,
- node);
+ return JS.Method(_declareMemberName(node.element), fn,
+ isGetter: node.isGetter,
+ isSetter: node.isSetter,
+ isStatic: node.isStatic)
+ ..sourceInformation = _functionEnd(node);
}
@override
@@ -2643,8 +2645,7 @@
var element = resolutionMap.elementDeclaredByFunctionDeclaration(node);
var nameExpr = _emitTopLevelName(element);
- body.add(
- closureAnnotate(js.statement('# = #', [nameExpr, fn]), element, node));
+ body.add(js.statement('# = #', [nameExpr, fn]));
// Function types of top-level/static functions are only needed when
// dart:mirrors is enabled.
// TODO(jmesserly): do we even need this for mirrors, since statics are not
@@ -2678,13 +2679,10 @@
JS.Method _emitTopLevelProperty(FunctionDeclaration node) {
var name = node.name.name;
- return closureAnnotate(
- JS.Method(_propertyName(name),
- _emitFunctionExpression(node.functionExpression),
- isGetter: node.isGetter, isSetter: node.isSetter)
- ..sourceInformation = _functionEnd(node),
- node.element,
- node);
+ return JS.Method(
+ _propertyName(name), _emitFunctionExpression(node.functionExpression),
+ isGetter: node.isGetter, isSetter: node.isSetter)
+ ..sourceInformation = _functionEnd(node);
}
bool _executesAtTopLevel(AstNode node) {
@@ -2748,8 +2746,7 @@
// Convert `function(...) { ... }` to `(...) => ...`
// This is for readability, but it also ensures correct `this` binding.
- return JS.ArrowFun(f.params, body,
- typeParams: f.typeParams, returnType: f.returnType);
+ return JS.ArrowFun(f.params, body);
}
/// Emits a non-arrow FunctionExpression node.
@@ -2784,8 +2781,7 @@
]);
code = super.exitFunction(element.name, formals, code);
- return JS.Fun(formals, code,
- typeParams: typeFormals, returnType: emitTypeRef(type.returnType));
+ return JS.Fun(formals, code);
}
JS.Block _emitFunctionBody(ExecutableElement element,
@@ -2857,8 +2853,7 @@
// TODO(jmesserly): this will emit argument initializers (for default
// values) inside the generator function body. Is that the best place?
var jsBody = _emitFunctionBody(element, parameters, body);
- var genFn = JS.Fun(jsParams, jsBody,
- isGenerator: true, returnType: emitTypeRef(returnType));
+ var genFn = JS.Fun(jsParams, jsBody, isGenerator: true);
// Name the function if possible, to get better stack traces.
var name = element.name;
@@ -3092,9 +3087,8 @@
return JS.PropertyAccess(target, member);
}
- JS.Identifier _emitVariableDef(SimpleIdentifier id, {JS.TypeRef type}) {
- return JS.Identifier(id.name, type: type)
- ..sourceInformation = _nodeStart(id);
+ JS.Identifier _emitVariableDef(SimpleIdentifier id) {
+ return JS.Identifier(id.name)..sourceInformation = _nodeStart(id);
}
/// Returns `true` if the type name referred to by [node] is used in a
@@ -3135,8 +3129,7 @@
element, () => JS.TemporaryId(element.name.substring(1)));
}
- var type = declaration ? emitTypeRef(element.type) : null;
- return JS.Identifier(element.name, type: type);
+ return JS.Identifier(element.name);
}
List<Annotation> _parameterMetadata(FormalParameter p) =>
@@ -4232,8 +4225,7 @@
return null;
}
- var name =
- _emitVariableDef(node.name, type: emitTypeRef(node.element.type));
+ var name = _emitVariableDef(node.name);
return JS.VariableInitialization(
name, _visitInitializer(node.initializer, node.element));
}
@@ -4260,13 +4252,10 @@
_isJSInvocation(init) ||
init is InstanceCreationExpression &&
isSdkInternalRuntime(init.staticElement.library)) {
- moduleItems.add(closureAnnotate(
- js.statement('# = #;', [
- _emitTopLevelName(field.element),
- _visitInitializer(field.initializer, field.element)
- ]),
- field.element,
- field));
+ moduleItems.add(js.statement('# = #;', [
+ _emitTopLevelName(field.element),
+ _visitInitializer(field.initializer, field.element)
+ ]));
} else {
lazyFields.add(field);
}
@@ -4292,41 +4281,24 @@
for (var node in fields) {
var element = node.element;
var access = emitFieldName(element);
- accessors.add(closureAnnotate(
- JS.Method(
- access,
- js.call('function() { return #; }',
- _visitInitializer(node.initializer, element)) as JS.Fun,
- isGetter: true)
- ..sourceInformation =
- _hoverComment(JS.PropertyAccess(objExpr, access), node.name),
- _findAccessor(element, getter: true),
- node));
+ accessors.add(JS.Method(
+ access,
+ js.call('function() { return #; }',
+ _visitInitializer(node.initializer, element)) as JS.Fun,
+ isGetter: true)
+ ..sourceInformation =
+ _hoverComment(JS.PropertyAccess(objExpr, access), node.name));
// TODO(jmesserly): currently uses a dummy setter to indicate writable.
if (!node.isFinal && !node.isConst) {
- accessors.add(closureAnnotate(
- JS.Method(access, js.call('function(_) {}') as JS.Fun,
- isSetter: true),
- _findAccessor(element, getter: false),
- node));
+ accessors.add(JS.Method(access, js.call('function(_) {}') as JS.Fun,
+ isSetter: true));
}
}
return runtimeStatement('defineLazy(#, { # })', [objExpr, accessors]);
}
- PropertyAccessorElement _findAccessor(VariableElement element,
- {bool getter}) {
- var parent = element.enclosingElement;
- if (parent is ClassElement) {
- return getter
- ? parent.getGetter(element.name)
- : parent.getSetter(element.name);
- }
- return null;
- }
-
JS.Expression _emitConstructorName(DartType type, String name) {
return _emitJSInterop(type.element) ??
JS.PropertyAccess(_emitConstructorAccess(type), _constructorName(name));
@@ -4778,8 +4750,10 @@
int _asIntInRange(Expression expr, int low, int high) {
expr = expr.unParenthesized;
if (expr is IntegerLiteral) {
- var value = expr.value;
- if (value != null && value >= low && value <= high) {
+ var value = _intValueForJS(expr);
+ if (value != null &&
+ value >= BigInt.from(low) &&
+ value <= BigInt.from(high)) {
return expr.value;
}
return null;
@@ -4804,8 +4778,9 @@
bool _isDefinitelyNonNegative(Expression expr) {
expr = expr.unParenthesized;
- if (expr is IntegerLiteral && expr.value != null) {
- return expr.value >= 0;
+ if (expr is IntegerLiteral) {
+ var value = _intValueForJS(expr);
+ return value != null && value >= BigInt.from(0);
}
if (_nodeIsBitwiseOperation(expr)) return true;
// TODO(sra): Lengths of known list types etc.
@@ -5637,16 +5612,48 @@
@override
visitIntegerLiteral(IntegerLiteral node) {
- // The analyzer is using int.parse and, in the the VM's new
- // 64-bit mode, it's silently failing if the Literal is out of bounds.
- // If the value is null, fall back on the string representation. This
- // is also fudging the number, but consistent with the old behavior.
- // Ideally, this is a static error.
- // TODO(vsm): Remove this hack.
- if (node.value != null) {
- return js.number(node.value);
+ // TODO(jmesserly): this behaves differently if Analyzer/DDC are run on
+ // dart4web. In that case we may report an error from the analyzer side
+ // (because `int.tryParse` fails). We could harden this by always parsing
+ // from `node.literal.lexeme`, as done below.
+ var value = _intValueForJS(node);
+ if (value == null) {
+ assert(options.unsafeForceCompile);
+ value = BigInt.parse(node.literal.lexeme).toUnsigned(64);
}
- return JS.LiteralNumber('${node.literal}');
+ // Report an error if the integer cannot be represented in a JS double.
+ var valueInJS = BigInt.from(value.toDouble());
+ if (value != valueInJS) {
+ var lexeme = node.literal.lexeme;
+ var nearest = (lexeme.startsWith("0x") || lexeme.startsWith("0X"))
+ ? '0x${valueInJS.toRadixString(16)}'
+ : '$valueInJS';
+ errors.add(AnalysisError(_currentCompilationUnit.source, node.offset,
+ node.length, invalidJSInteger, [lexeme, nearest]));
+ }
+ return JS.LiteralNumber('$valueInJS');
+ }
+
+ /// Returns the integer value for [node].
+ BigInt _intValueForJS(IntegerLiteral node) {
+ // The Dart VM uses signed 64-bit integers, but dart4web supports unsigned
+ // 64-bit integer hex literals if they can be represented in JavaScript.
+ // So we need to reinterpret the value as an unsigned 64-bit integer.
+ //
+ // The current Dart 2.0 rules are:
+ //
+ // - A decimal literal (maybe including a leading minus) is allowed if its
+ // numerical value is in the signed 64-bit range (-2^63..2^63-1).
+ // - A signed hexadecimal literal is allowed if its numerical value is in
+ // the signed 64-bit ranged.
+ // - An unsigned hexadecimal literal is allowed if its numerical value is in
+ // the *unsigned* 64-bit range (0..2^64-1).
+ //
+ // The decimal-vs-hex distinction has already been taken care of by
+ // Analyzer, so we're only concerned with ensuring those unsigned values are
+ // correctly interpreted.
+ var value = node.value;
+ return value != null ? BigInt.from(value).toUnsigned(64) : null;
}
@override
@@ -6144,15 +6151,6 @@
() => JS.TemporaryId(jsLibraryName(_libraryRoot, library)));
}
- T closureAnnotate<T extends JS.Node>(
- T node, Element element, AnnotatedNode original) {
- if (options.closure) {
- node.closureAnnotation =
- closureAnnotationFor(node, original, element, namedArgumentTemp.name);
- }
- return node;
- }
-
/// Return true if this is one of the methods/properties on all Dart Objects
/// (toString, hashCode, noSuchMethod, runtimeType).
///
diff --git a/pkg/dev_compiler/lib/src/analyzer/error_helpers.dart b/pkg/dev_compiler/lib/src/analyzer/error_helpers.dart
index 95a1a26..b2a2cfe 100644
--- a/pkg/dev_compiler/lib/src/analyzer/error_helpers.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/error_helpers.dart
@@ -2,11 +2,23 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:analyzer/analyzer.dart' show AnalysisError, ErrorSeverity;
+import 'package:analyzer/analyzer.dart'
+ show AnalysisError, ErrorSeverity, ErrorType, StrongModeCode;
import 'package:analyzer/source/error_processor.dart' show ErrorProcessor;
import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
import 'package:path/path.dart' as path;
+/// Sorts and formats errors, returning the error messages.
+List<String> formatErrors(AnalysisContext context, List<AnalysisError> errors) {
+ sortErrors(context, errors);
+ var result = <String>[];
+ for (var e in errors) {
+ var m = formatError(context, e);
+ if (m != null) result.add(m);
+ }
+ return result;
+}
+
// TODO(jmesserly): this code was taken from analyzer_cli.
// It really should be in some common place so we can share it.
// TODO(jmesserly): this shouldn't depend on `context` but we need it to compute
@@ -64,3 +76,14 @@
?.severity ??
error.errorCode.errorSeverity;
}
+
+const invalidImportDartMirrors = StrongModeCode(
+ ErrorType.COMPILE_TIME_ERROR,
+ 'IMPORT_DART_MIRRORS',
+ 'Cannot import "dart:mirrors" in web applications (https://goo.gl/R1anEs).');
+
+const invalidJSInteger = StrongModeCode(
+ ErrorType.COMPILE_TIME_ERROR,
+ 'INVALID_JS_INTEGER',
+ "The integer literal '{0}' can't be represented exactly in JavaScript. "
+ "The nearest value that can be represented exactly is '{1}'.");
diff --git a/pkg/dev_compiler/lib/src/analyzer/js_typeref_codegen.dart b/pkg/dev_compiler/lib/src/analyzer/js_typeref_codegen.dart
deleted file mode 100644
index fd61c5a..0000000
--- a/pkg/dev_compiler/lib/src/analyzer/js_typeref_codegen.dart
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
-
-import '../js_ast/js_ast.dart' as JS;
-import 'module_compiler.dart' show CompilerOptions;
-import 'js_interop.dart';
-
-/// Mixin with logic to generate [TypeRef]s out of [DartType]s.
-abstract class JSTypeRefCodegen {
- final _resolved = <DartType, JS.TypeRef>{};
-
- // Mixin dependencies:
- CompilerOptions get options;
- TypeProvider get types;
- LibraryElement get dartJSLibrary;
- JS.Identifier get namedArgumentTemp;
- JS.Identifier emitLibraryName(LibraryElement e);
-
- /// Finds the qualified path to the type.
- JS.TypeRef _emitTopLevelTypeRef(DartType type) {
- var e = type.element;
- return JS.TypeRef.qualified([
- emitLibraryName(e.library),
- JS.Identifier(getJSExportName(e) ?? e.name)
- ]);
- }
-
- JS.TypeRef emitTypeRef(DartType type) {
- if (!options.closure) return null;
-
- return _resolved.putIfAbsent(type, () {
- if (type == null) JS.TypeRef.unknown();
- // TODO(ochafik): Consider calling _loader.declareBeforeUse(type.element).
- if (type.isBottom || type.isDynamic) JS.TypeRef.any();
- if (type.isVoid) return JS.TypeRef.void_();
-
- if (type == types.intType) return JS.TypeRef.number().orNull();
- if (type == types.numType) return JS.TypeRef.number().orNull();
- if (type == types.doubleType) return JS.TypeRef.number().orNull();
- if (type == types.boolType) return JS.TypeRef.boolean().orNull();
- if (type == types.stringType) return JS.TypeRef.string();
-
- if (type is TypeParameterType) return JS.TypeRef.named(type.name);
- if (type is ParameterizedType) {
- JS.TypeRef rawType;
- if (type is FunctionType && type.name == null) {
- var args = <JS.Identifier, JS.TypeRef>{};
- for (var param in type.parameters) {
- if (param.isNamed) break;
- var type = emitTypeRef(param.type);
- args[JS.Identifier(param.name)] =
- param.isPositional ? type.toOptional() : type;
- }
- var namedParamType = emitNamedParamsArgType(type.parameters);
- if (namedParamType != null) {
- args[namedArgumentTemp] = namedParamType.toOptional();
- }
-
- rawType = JS.TypeRef.function(emitTypeRef(type.returnType), args);
- } else {
- var jsTypeRef = _getDartJsTypeRef(type);
- if (jsTypeRef != null) return jsTypeRef;
-
- rawType = _emitTopLevelTypeRef(type);
- }
- var typeArgs = _getOwnTypeArguments(type).map(emitTypeRef);
- return typeArgs.isEmpty
- ? rawType
- : JS.TypeRef.generic(rawType, typeArgs);
- }
- return JS.TypeRef.unknown();
- });
- }
-
- JS.TypeRef emitNamedParamsArgType(Iterable<ParameterElement> params) {
- if (!options.closure) return null;
-
- var namedArgs = <JS.Identifier, JS.TypeRef>{};
- for (ParameterElement param in params) {
- if (param.isPositional) continue;
- namedArgs[JS.Identifier(param.name)] =
- emitTypeRef(param.type).toOptional();
- }
- if (namedArgs.isEmpty) return null;
- return JS.TypeRef.record(namedArgs);
- }
-
- /// Gets the "own" type arguments of [type].
- ///
- /// Method argument with adhoc unnamed [FunctionType] inherit any type params
- /// from their enclosing class:
- ///
- /// class Foo<T> {
- /// void method(f()); // f has [T] as type arguments,
- /// } // but [] as its "own" type arguments.
- Iterable<DartType> _getOwnTypeArguments(ParameterizedType type) sync* {
- for (int i = 0, n = type.typeParameters.length; i < n; i++) {
- if (type.typeParameters[i].enclosingElement == type.element) {
- yield type.typeArguments[i];
- }
- }
- }
-
- /// Special treatment of types from dart:js
- /// TODO(ochafik): Is this the right thing to do? And what about package:js?
- JS.TypeRef _getDartJsTypeRef(DartType type) {
- if (type.element.library == dartJSLibrary) {
- switch (type.name) {
- case 'JsArray':
- return JS.TypeRef.array(
- type is InterfaceType && type.typeArguments.length == 1
- ? emitTypeRef(type.typeArguments.single)
- : null);
- case 'JsObject':
- return JS.TypeRef.object();
- case 'JsFunction':
- return JS.TypeRef.function();
- }
- }
- return null;
- }
-}
diff --git a/pkg/dev_compiler/lib/src/analyzer/module_compiler.dart b/pkg/dev_compiler/lib/src/analyzer/module_compiler.dart
index f5a7a53..74fea79 100644
--- a/pkg/dev_compiler/lib/src/analyzer/module_compiler.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/module_compiler.dart
@@ -6,8 +6,7 @@
import 'dart:convert' show json;
import 'dart:io' show File;
-import 'package:analyzer/analyzer.dart'
- show AnalysisError, CompilationUnit, ErrorSeverity, ErrorType;
+import 'package:analyzer/analyzer.dart' show AnalysisError, CompilationUnit;
import 'package:analyzer/dart/analysis/declared_variables.dart';
import 'package:analyzer/dart/element/element.dart'
show LibraryElement, UriReferencedElement;
@@ -16,8 +15,6 @@
show PhysicalResourceProvider;
import 'package:analyzer/src/context/builder.dart' show ContextBuilder;
import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl;
-import 'package:analyzer/src/error/codes.dart'
- show StaticTypeWarningCode, StrongModeCode;
import 'package:analyzer/src/generated/engine.dart'
show AnalysisContext, AnalysisEngine;
import 'package:analyzer/src/generated/sdk.dart' show DartSdkManager;
@@ -42,7 +39,7 @@
import '../js_ast/source_map_printer.dart' show SourceMapPrintingContext;
import 'code_generator.dart' show CodeGenerator;
import 'context.dart' show AnalyzerOptions, createSourceFactory;
-import 'error_helpers.dart' show errorSeverity, formatError, sortErrors;
+import 'error_helpers.dart';
import 'extension_types.dart' show ExtensionTypeSet;
/// Compiles a set of Dart files into a single JavaScript module.
@@ -130,21 +127,6 @@
return ModuleCompiler._(context, summaryData);
}
- bool _isFatalError(AnalysisError e, CompilerOptions options) {
- if (errorSeverity(context, e) != ErrorSeverity.ERROR) return false;
-
- // These errors are not fatal in the REPL compile mode as we
- // allow access to private members across library boundaries
- // and those accesses will show up as undefined members unless
- // additional analyzer changes are made to support them.
- // TODO(jacobr): consider checking that the identifier name
- // referenced by the error is private.
- return !options.replCompile ||
- (e.errorCode != StaticTypeWarningCode.UNDEFINED_GETTER &&
- e.errorCode != StaticTypeWarningCode.UNDEFINED_SETTER &&
- e.errorCode != StaticTypeWarningCode.UNDEFINED_METHOD);
- }
-
/// Compiles a single Dart build unit into a JavaScript module.
///
/// *Warning* - this may require resolving the entire world.
@@ -214,32 +196,9 @@
}
}
- sortErrors(context, errors);
-
- var messages = <String>[];
- for (var e in errors) {
- var m = formatError(context, e);
- if (m != null) messages.add(m);
- }
-
- if (!options.unsafeForceCompile &&
- errors.any((e) => _isFatalError(e, options))) {
- return JSModuleFile.invalid(unit.name, messages, options);
- }
-
- try {
- var codeGenerator =
- CodeGenerator(context, summaryData, options, _extensionTypes);
- return codeGenerator.compile(unit, trees, messages);
- } catch (e) {
- if (errors.any((e) => _isFatalError(e, options))) {
- // Force compilation failed. Suppress the exception and report
- // the static errors instead.
- assert(options.unsafeForceCompile);
- return JSModuleFile.invalid(unit.name, messages, options);
- }
- rethrow;
- }
+ var codeGenerator =
+ CodeGenerator(context, summaryData, options, _extensionTypes, errors);
+ return codeGenerator.compile(unit, trees);
}
}
@@ -287,9 +246,6 @@
/// to private members across library boundaries.
final bool replCompile;
- /// Whether to emit Closure Compiler-friendly code.
- final bool closure;
-
/// Mapping from absolute file paths to bazel short path to substitute in
/// source maps.
final Map<String, String> bazelMapping;
@@ -308,7 +264,6 @@
this.replCompile = false,
this.emitMetadata = false,
this.enableAsserts = true,
- this.closure = false,
this.bazelMapping = const {},
this.summaryOutPath});
@@ -322,7 +277,6 @@
replCompile = args['repl-compile'] as bool,
emitMetadata = args['emit-metadata'] as bool,
enableAsserts = args['enable-asserts'] as bool,
- closure = args['closure-experimental'] as bool,
bazelMapping =
_parseBazelMappings(args['bazel-mapping'] as List<String>),
summaryOutPath = args['summary-out'] as String;
@@ -456,9 +410,7 @@
JSModuleCode getCode(ModuleFormat format, String jsUrl, String mapUrl,
{bool singleOutFile = false}) {
var opts = JS.JavaScriptPrintingOptions(
- emitTypes: options.closure,
- allowKeywordsInProperties: true,
- allowSingleLineIfStatements: true);
+ allowKeywordsInProperties: true, allowSingleLineIfStatements: true);
JS.SimpleJavaScriptPrintingContext printer;
SourceMapBuilder sourceMap;
if (options.sourceMap) {
@@ -608,8 +560,3 @@
return Uri.file(path.absolute(source));
}
}
-
-const invalidImportDartMirrors = StrongModeCode(
- ErrorType.COMPILE_TIME_ERROR,
- 'IMPORT_DART_MIRRORS',
- 'Cannot import "dart:mirrors" in web applications (https://goo.gl/R1anEs).');
diff --git a/pkg/dev_compiler/lib/src/closure/closure_annotation.dart b/pkg/dev_compiler/lib/src/closure/closure_annotation.dart
deleted file mode 100644
index 7274d65..0000000
--- a/pkg/dev_compiler/lib/src/closure/closure_annotation.dart
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import '../js_ast/js_ast.dart' as JS show TypeRef, ClosureTypePrinter;
-
-/// Set of closure annotations that can be [toString]ed to a single JsDoc comment.
-/// See https://developers.google.com/closure/compiler/docs/js-for-compiler
-///
-/// TODO(ochafik): Support inclusion of 'normal' comments (including @param comments).
-class ClosureAnnotation {
- final String comment;
- final bool isConst;
- final bool isConstructor;
- final bool isFinal;
- final bool isNoCollapse;
- final bool isNoSideEffects;
- final bool isOverride;
- final bool isPrivate;
- final bool isProtected;
- final bool isStruct;
- final bool isTypedef;
- final JS.TypeRef lendsToType;
- final JS.TypeRef returnType;
- final JS.TypeRef superType;
- final JS.TypeRef thisType;
- final JS.TypeRef throwsType;
- final JS.TypeRef type;
- final List<JS.TypeRef> interfaces;
- final List<String> templates;
- final Map<String, JS.TypeRef> paramTypes;
-
- ClosureAnnotation(
- {this.comment,
- this.interfaces = const [],
- this.isConst = false,
- this.isConstructor = false,
- this.isFinal = false,
- this.isNoCollapse = false,
- this.isNoSideEffects = false,
- this.isOverride = false,
- this.isPrivate = false,
- this.isProtected = false,
- this.isStruct = false,
- this.isTypedef = false,
- this.lendsToType,
- this.paramTypes = const {},
- this.returnType,
- this.superType,
- this.templates = const [],
- this.thisType,
- this.throwsType,
- this.type});
-
- @override
- int get hashCode => _cachedString.hashCode;
-
- @override
- bool operator ==(other) =>
- other is ClosureAnnotation && _cachedString == other._cachedString;
-
- @override
- String toString([String indent = '']) =>
- _cachedString.replaceAll('\n', '\n$indent');
-
- String _print(JS.TypeRef t) => (JS.ClosureTypePrinter()..visit(t)).toString();
-
- String __cachedString;
- String get _cachedString {
- if (__cachedString == null) {
- bool isNonWildcard(JS.TypeRef t) => t != null && !t.isAny && !t.isUnknown;
-
- var lines = <String>[];
- if (comment != null) lines.addAll(comment.split('\n'));
- if (templates != null && templates.isNotEmpty) {
- lines.add('@template ${templates.join(', ')}');
- }
- if (thisType != null) lines.add('@this {${_print(thisType)}}');
- if (isOverride) lines.add('@override');
- if (isNoSideEffects) lines.add('@nosideeffects');
- if (isNoCollapse) lines.add('@nocollapse');
- if (lendsToType != null) lines.add('@lends {${_print(lendsToType)}}');
-
- {
- var typeHolders = <String>[];
- if (isPrivate) typeHolders.add('@private');
- if (isProtected) typeHolders.add('@protected');
- if (isFinal) typeHolders.add('@final');
- if (isConst) typeHolders.add('@const');
- if (isTypedef) typeHolders.add('@typedef');
- if (isNonWildcard(type)) {
- if (typeHolders.isEmpty) typeHolders.add('@type');
- typeHolders.add('{${_print(type)}}');
- }
- if (!typeHolders.isEmpty) lines.add(typeHolders.join(' '));
- }
-
- {
- List constructorLine = [];
- if (isConstructor) constructorLine.add('@constructor');
- if (isStruct) constructorLine.add('@struct');
- if (isNonWildcard(superType)) {
- constructorLine.add('@extends {${_print(superType)}}');
- }
-
- if (constructorLine.isNotEmpty) lines.add(constructorLine.join(' '));
- }
-
- if (interfaces != null) {
- for (var interface in interfaces) {
- if (isNonWildcard(interface))
- lines.add('@implements {${_print(interface)}}');
- }
- }
-
- if (paramTypes != null) {
- paramTypes.forEach((String paramName, JS.TypeRef paramType) {
- // Must output params even with wildcard type.
- lines.add('@param {${_print(paramType)}} $paramName');
- });
- }
- if (isNonWildcard(returnType))
- lines.add('@return {${_print(returnType)}}');
- if (isNonWildcard(throwsType))
- lines.add('@throws {${_print(throwsType)}}');
-
- if (lines.length == 0) return '';
- if (lines.length == 1) return '/** ${lines.single} */';
- __cachedString = '/**\n' + lines.map((l) => ' * $l').join('\n') + '\n */';
- }
- return __cachedString;
- }
-}
diff --git a/pkg/dev_compiler/lib/src/closure/closure_annotator.dart b/pkg/dev_compiler/lib/src/closure/closure_annotator.dart
deleted file mode 100644
index 133aae2..0000000
--- a/pkg/dev_compiler/lib/src/closure/closure_annotator.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
-
-import '../js_ast/js_ast.dart' as JS show Node, TypeRef;
-
-import 'closure_annotation.dart';
-
-/// Mixin that can generate [ClosureAnnotation]s for Dart elements and types.
-abstract class ClosureAnnotator {
- TypeProvider get types;
-
- JS.TypeRef emitTypeRef(DartType type);
-
- // TODO(ochafik): Handle destructured params when Closure supports it.
- ClosureAnnotation closureAnnotationFor(JS.Node node, AnnotatedNode original,
- Element e, String namedArgsMapName) {
- // Note: Dart and Closure privacy are not compatible: don't set `isPrivate: e.isPrivate`.
- return ClosureAnnotation(
- comment: original?.documentationComment?.toSource(),
- // Note: we don't set isConst here because Closure's constness and
- // Dart's are not really compatible.
- isFinal: e is VariableElement && (e.isFinal || e.isConst),
- type: e is VariableElement
- ? emitTypeRef(e.type /*, forceTypeDefExpansion: true*/)
- : null,
- superType: e is ClassElement ? emitTypeRef(e.supertype) : null,
- interfaces:
- e is ClassElement ? e.interfaces.map(emitTypeRef).toList() : null,
- isOverride: e.isOverride,
- isTypedef: e is FunctionTypeAliasElement);
- }
-}
diff --git a/pkg/dev_compiler/lib/src/closure/closure_type.dart b/pkg/dev_compiler/lib/src/closure/closure_type.dart
deleted file mode 100644
index bc29be0..0000000
--- a/pkg/dev_compiler/lib/src/closure/closure_type.dart
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Poor-man's representation of a Closure type.
-/// See https://developers.google.com/closure/compiler/docs/js-for-compiler
-///
-/// The goal here is not to completely support Closure's type system, but to
-/// be able to generate just the types needed for DDC's JS output.
-///
-/// TODO(ochafik): Consider convergence with TypeScript, which has no nullability-awareness
-/// (see http://www.typescriptlang.org/Handbook).
-class ClosureType {
- static const ClosureType _ALL = ClosureType._("*");
- static const ClosureType _UNKNOWN = ClosureType._("?");
-
- final String _representation;
- final bool isNullable;
-
- const ClosureType._(this._representation, {this.isNullable = true});
-
- bool get isAll => _representation == "*";
- bool get isUnknown => _representation == "?";
-
- @override
- toString() => _representation;
-
- factory ClosureType.all() => _ALL;
- factory ClosureType.unknown() => _UNKNOWN;
-
- factory ClosureType.record(Map<String, ClosureType> fieldTypes) {
- var entries = <String>[];
- fieldTypes.forEach((n, t) => entries.add('$n: $t'));
- return ClosureType._('{${entries.join(', ')}}');
- }
- factory ClosureType.function(
- [List<ClosureType> paramTypes, ClosureType returnType]) {
- if (paramTypes == null && returnType == null) {
- return ClosureType.type("Function");
- }
- var suffix = returnType == null ? '' : ':$returnType';
- return ClosureType._(
- 'function(${paramTypes == null ? '...*' : paramTypes.join(', ')})$suffix');
- }
-
- factory ClosureType.map([ClosureType keyType, ClosureType valueType]) =>
- ClosureType._("Object<${keyType ?? _ALL}, ${valueType ?? _ALL}>");
-
- factory ClosureType.type([String className = "Object"]) =>
- ClosureType._(className);
-
- factory ClosureType.array([ClosureType componentType]) =>
- ClosureType._("Array<${componentType ?? _ALL}>");
-
- factory ClosureType.undefined() =>
- ClosureType._("undefined", isNullable: false);
- factory ClosureType.number() => ClosureType._("number", isNullable: false);
- factory ClosureType.boolean() => ClosureType._("boolean", isNullable: false);
- factory ClosureType.string() => ClosureType._("string");
-
- ClosureType toOptional() => ClosureType._("$this=");
-
- ClosureType toNullable() => isNullable
- ? this
- : ClosureType._(
- _representation.startsWith('!')
- ? _representation.substring(1)
- : "?$this",
- isNullable: true);
-
- ClosureType toNonNullable() => !isNullable
- ? this
- : ClosureType._(
- _representation.startsWith('?')
- ? _representation.substring(1)
- : "!$this",
- isNullable: false);
-
- /// TODO(ochafik): See which optimizations make sense here (it could be that `(*|undefined)`
- /// cannot be optimized to `*` when used to model optional record fields).
- ClosureType or(ClosureType other) => ClosureType._("($this|$other)",
- isNullable: isNullable || other.isNullable);
-
- ClosureType orUndefined() => or(ClosureType.undefined());
-}
diff --git a/pkg/dev_compiler/lib/src/compiler/js_utils.dart b/pkg/dev_compiler/lib/src/compiler/js_utils.dart
index 76686c0..a0275c6 100644
--- a/pkg/dev_compiler/lib/src/compiler/js_utils.dart
+++ b/pkg/dev_compiler/lib/src/compiler/js_utils.dart
@@ -17,8 +17,7 @@
innerFun.params.isEmpty) {
var body = innerFun.body;
if (body is Block) {
- return Fun(fn.params, body,
- typeParams: fn.typeParams, returnType: fn.returnType);
+ return Fun(fn.params, body);
}
}
}
diff --git a/pkg/dev_compiler/lib/src/js_ast/js_ast.dart b/pkg/dev_compiler/lib/src/js_ast/js_ast.dart
index 21eadd3..ee8289e 100644
--- a/pkg/dev_compiler/lib/src/js_ast/js_ast.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/js_ast.dart
@@ -6,11 +6,8 @@
import 'precedence.dart';
import 'characters.dart' as charCodes;
-import '../closure/closure_annotation.dart';
part 'nodes.dart';
part 'builder.dart';
-part 'js_types.dart';
part 'printer.dart';
part 'template.dart';
-part 'type_printer.dart';
diff --git a/pkg/dev_compiler/lib/src/js_ast/js_types.dart b/pkg/dev_compiler/lib/src/js_ast/js_types.dart
deleted file mode 100644
index e45c96c..0000000
--- a/pkg/dev_compiler/lib/src/js_ast/js_types.dart
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of js_ast;
-
-final _any = AnyTypeRef._();
-final _unknown = UnknownTypeRef._();
-final _null = NullTypeRef();
-
-/// JavaScript type reference, designed to support a subset of the type systems
-/// of the Closure Compiler and TypeScript:
-/// - https://developers.google.com/closure/compiler/docs/js-for-compiler#types
-/// - https://github.com/Microsoft/TypeScript/blob/v1.8.0-beta/doc/spec.md#3
-///
-/// Note that some subtleties like "nullability" or "optionality" are handled
-/// using unions (with a [NullTypeRef] or with an "undefined" named typeref).
-/// Also, primitives aren't modeled differently than named / qualified types,
-/// as it brings little value for now. Primitive-specific type formatting is
-/// handled by the type printers (for instance, the knowledge that
-/// `number|null` is just `number` in TypeScript, and is `number?` in Closure).
-abstract class TypeRef extends Expression {
- int get precedenceLevel => PRIMARY;
-
- TypeRef();
-
- factory TypeRef.any() => _any;
-
- factory TypeRef.void_() => TypeRef.named('void');
-
- factory TypeRef.unknown() => _unknown;
-
- factory TypeRef.generic(TypeRef rawType, Iterable<TypeRef> typeArgs) {
- if (typeArgs.isEmpty) {
- throw ArgumentError.value(typeArgs, "typeArgs", "is empty");
- }
- return GenericTypeRef(rawType, typeArgs.toList());
- }
-
- factory TypeRef.array([TypeRef elementType]) => ArrayTypeRef(elementType);
-
- factory TypeRef.object([TypeRef keyType, TypeRef valueType]) {
- // TODO(ochafik): Roll out a dedicated ObjectTypeRef?
- var rawType = TypeRef.named('Object');
- return keyType == null && valueType == null
- ? rawType
- : GenericTypeRef(rawType, [keyType ?? _any, valueType ?? _any]);
- }
-
- factory TypeRef.function(
- [TypeRef returnType, Map<Identifier, TypeRef> paramTypes]) =>
- FunctionTypeRef(returnType, paramTypes);
-
- factory TypeRef.record(Map<Identifier, TypeRef> types) =>
- RecordTypeRef(types);
-
- factory TypeRef.string() => TypeRef.named('string');
-
- factory TypeRef.number() => TypeRef.named('number');
-
- factory TypeRef.undefined() => TypeRef.named('undefined');
-
- factory TypeRef.boolean() => TypeRef.named('boolean');
-
- factory TypeRef.qualified(List<Identifier> path) => QualifiedTypeRef(path);
-
- factory TypeRef.named(String name) =>
- TypeRef.qualified(<Identifier>[Identifier(name)]);
-
- bool get isAny => this is AnyTypeRef;
- bool get isUnknown => this is UnknownTypeRef;
- bool get isNull => this is NullTypeRef;
-
- TypeRef or(TypeRef other) => UnionTypeRef([this, other]);
-
- TypeRef orUndefined() => or(TypeRef.undefined());
- TypeRef orNull() => or(_null);
-
- TypeRef toOptional() => OptionalTypeRef(this);
-}
-
-class AnyTypeRef extends TypeRef {
- AnyTypeRef._() : super();
-
- factory AnyTypeRef() => _any;
- T accept<T>(NodeVisitor<T> visitor) => visitor.visitAnyTypeRef(this);
- void visitChildren(NodeVisitor visitor) {}
- _clone() => AnyTypeRef();
-}
-
-class NullTypeRef extends QualifiedTypeRef {
- NullTypeRef() : super([Identifier("null")]);
- _clone() => NullTypeRef();
-}
-
-class UnknownTypeRef extends TypeRef {
- UnknownTypeRef._() : super();
-
- factory UnknownTypeRef() => _unknown;
- T accept<T>(NodeVisitor<T> visitor) => visitor.visitUnknownTypeRef(this);
- void visitChildren(NodeVisitor visitor) {}
- _clone() => UnknownTypeRef();
-}
-
-class QualifiedTypeRef extends TypeRef {
- final List<Identifier> path;
- QualifiedTypeRef(this.path);
-
- T accept<T>(NodeVisitor<T> visitor) => visitor.visitQualifiedTypeRef(this);
- void visitChildren(NodeVisitor visitor) =>
- path.forEach((p) => p.accept(visitor));
- _clone() => QualifiedTypeRef(path);
-}
-
-class ArrayTypeRef extends TypeRef {
- final TypeRef elementType;
- ArrayTypeRef(this.elementType);
- T accept<T>(NodeVisitor<T> visitor) => visitor.visitArrayTypeRef(this);
- void visitChildren(NodeVisitor visitor) {
- elementType.accept(visitor);
- }
-
- _clone() => ArrayTypeRef(elementType);
-}
-
-class GenericTypeRef extends TypeRef {
- final TypeRef rawType;
- final List<TypeRef> typeArgs;
- GenericTypeRef(this.rawType, this.typeArgs);
-
- T accept<T>(NodeVisitor<T> visitor) => visitor.visitGenericTypeRef(this);
- void visitChildren(NodeVisitor visitor) {
- rawType.accept(visitor);
- typeArgs.forEach((p) => p.accept(visitor));
- }
-
- _clone() => GenericTypeRef(rawType, typeArgs);
-}
-
-class UnionTypeRef extends TypeRef {
- final List<TypeRef> types;
- UnionTypeRef(this.types);
-
- T accept<T>(NodeVisitor<T> visitor) => visitor.visitUnionTypeRef(this);
- void visitChildren(NodeVisitor visitor) {
- types.forEach((p) => p.accept(visitor));
- }
-
- _clone() => UnionTypeRef(types);
-
- @override
- TypeRef or(TypeRef other) {
- if (types.contains(other)) return this;
- return UnionTypeRef([]
- ..addAll(types)
- ..add(other));
- }
-}
-
-class OptionalTypeRef extends TypeRef {
- final TypeRef type;
- OptionalTypeRef(this.type);
-
- T accept<T>(NodeVisitor<T> visitor) => visitor.visitOptionalTypeRef(this);
- void visitChildren(NodeVisitor visitor) {
- type.accept(visitor);
- }
-
- _clone() => OptionalTypeRef(type);
-
- @override
- TypeRef orUndefined() => this;
-}
-
-class RecordTypeRef extends TypeRef {
- final Map<Identifier, TypeRef> types;
- RecordTypeRef(this.types);
-
- T accept<T>(NodeVisitor<T> visitor) => visitor.visitRecordTypeRef(this);
- void visitChildren(NodeVisitor visitor) {
- types.values.forEach((p) => p.accept(visitor));
- }
-
- _clone() => RecordTypeRef(types);
-}
-
-class FunctionTypeRef extends TypeRef {
- final TypeRef returnType;
- final Map<Identifier, TypeRef> paramTypes;
- FunctionTypeRef(this.returnType, this.paramTypes);
-
- T accept<T>(NodeVisitor<T> visitor) => visitor.visitFunctionTypeRef(this);
- void visitChildren(NodeVisitor visitor) {
- returnType.accept(visitor);
- paramTypes.forEach((n, t) {
- n.accept(visitor);
- t.accept(visitor);
- });
- }
-
- _clone() => FunctionTypeRef(returnType, paramTypes);
-}
diff --git a/pkg/dev_compiler/lib/src/js_ast/nodes.dart b/pkg/dev_compiler/lib/src/js_ast/nodes.dart
index 2af42b1..810bedf 100644
--- a/pkg/dev_compiler/lib/src/js_ast/nodes.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/nodes.dart
@@ -4,7 +4,7 @@
part of js_ast;
-abstract class NodeVisitor<T> implements TypeRefVisitor<T> {
+abstract class NodeVisitor<T> {
T visitProgram(Program node);
T visitBlock(Block node);
@@ -95,18 +95,6 @@
T visitSimpleBindingPattern(SimpleBindingPattern node);
}
-abstract class TypeRefVisitor<T> {
- T visitQualifiedTypeRef(QualifiedTypeRef node);
- T visitGenericTypeRef(GenericTypeRef node);
- T visitUnionTypeRef(UnionTypeRef node);
- T visitRecordTypeRef(RecordTypeRef node);
- T visitOptionalTypeRef(OptionalTypeRef node);
- T visitFunctionTypeRef(FunctionTypeRef node);
- T visitAnyTypeRef(AnyTypeRef node);
- T visitUnknownTypeRef(UnknownTypeRef node);
- T visitArrayTypeRef(ArrayTypeRef node);
-}
-
class BaseVisitor<T> implements NodeVisitor<T> {
T visitNode(Node node) {
node.visitChildren(this);
@@ -229,17 +217,6 @@
visitBindingPattern(node);
T visitDestructuredVariable(DestructuredVariable node) => visitNode(node);
T visitSimpleBindingPattern(SimpleBindingPattern node) => visitNode(node);
-
- T visitTypeRef(TypeRef node) => visitNode(node);
- T visitQualifiedTypeRef(QualifiedTypeRef node) => visitTypeRef(node);
- T visitGenericTypeRef(GenericTypeRef node) => visitTypeRef(node);
- T visitOptionalTypeRef(OptionalTypeRef node) => visitTypeRef(node);
- T visitRecordTypeRef(RecordTypeRef node) => visitTypeRef(node);
- T visitUnionTypeRef(UnionTypeRef node) => visitTypeRef(node);
- T visitFunctionTypeRef(FunctionTypeRef node) => visitTypeRef(node);
- T visitAnyTypeRef(AnyTypeRef node) => visitTypeRef(node);
- T visitUnknownTypeRef(UnknownTypeRef node) => visitTypeRef(node);
- T visitArrayTypeRef(ArrayTypeRef node) => visitTypeRef(node);
}
abstract class Node {
@@ -247,9 +224,6 @@
/// setting this after construction.
Object sourceInformation;
- /// Closure annotation of this node.
- ClosureAnnotation closureAnnotation;
-
T accept<T>(NodeVisitor<T> visitor);
void visitChildren(NodeVisitor visitor);
@@ -892,13 +866,9 @@
final BindingPattern structure;
final Expression defaultValue;
- final TypeRef type;
+
DestructuredVariable(
- {this.name,
- this.property,
- this.structure,
- this.defaultValue,
- this.type}) {
+ {this.name, this.property, this.structure, this.defaultValue}) {
assert(name != null || structure != null);
}
@@ -1177,16 +1147,13 @@
int get precedenceLevel => UNARY;
}
-abstract class Parameter implements Expression, VariableBinding {
- TypeRef get type;
-}
+abstract class Parameter implements Expression, VariableBinding {}
class Identifier extends Expression implements Parameter {
final String name;
final bool allowRename;
- final TypeRef type;
- Identifier(this.name, {this.allowRename = true, this.type}) {
+ Identifier(this.name, {this.allowRename = true}) {
if (!_identifierRE.hasMatch(name)) {
throw ArgumentError.value(name, "name", "not a valid identifier");
}
@@ -1204,7 +1171,6 @@
// This is an expression for convenience in the AST.
class RestParameter extends Expression implements Parameter {
final Identifier parameter;
- TypeRef get type => null;
RestParameter(this.parameter);
@@ -1278,24 +1244,13 @@
}
abstract class FunctionExpression extends Expression {
+ Node get body; // Expression or block
List<Parameter> get params;
-
- get body; // Expression or block
- /// Type parameters passed to this generic function, if any. `null` otherwise.
- // TODO(ochafik): Support type bounds.
- List<Identifier> get typeParams;
-
- /// Return type of this function, if any. `null` otherwise.
- TypeRef get returnType;
}
class Fun extends FunctionExpression {
final List<Parameter> params;
final Block body;
- @override
- final List<Identifier> typeParams;
- @override
- final TypeRef returnType;
/** Whether this is a JS generator (`function*`) that may contain `yield`. */
final bool isGenerator;
@@ -1304,9 +1259,7 @@
Fun(this.params, this.body,
{this.isGenerator = false,
- this.asyncModifier = const AsyncModifier.sync(),
- this.typeParams,
- this.returnType});
+ this.asyncModifier = const AsyncModifier.sync()});
T accept<T>(NodeVisitor<T> visitor) => visitor.visitFun(this);
@@ -1324,12 +1277,8 @@
class ArrowFun extends FunctionExpression {
final List<Parameter> params;
final body; // Expression or Block
- @override
- final List<Identifier> typeParams;
- @override
- final TypeRef returnType;
- ArrowFun(this.params, this.body, {this.typeParams, this.returnType});
+ ArrowFun(this.params, this.body);
T accept<T>(NodeVisitor<T> visitor) => visitor.visitArrowFun(this);
@@ -1627,15 +1576,7 @@
final Expression heritage; // Can be null.
final List<Method> methods;
- /// Type parameters of this class, if any. `null` otherwise.
- // TODO(ochafik): Support type bounds.
- final List<Identifier> typeParams;
-
- /// Field declarations of this class (TypeScript / ES6_TYPED).
- final List<VariableDeclarationList> fields;
-
- ClassExpression(this.name, this.heritage, this.methods,
- {this.typeParams, this.fields});
+ ClassExpression(this.name, this.heritage, this.methods);
T accept<T>(NodeVisitor<T> visitor) => visitor.visitClassExpression(this);
@@ -1643,23 +1584,12 @@
name.accept(visitor);
if (heritage != null) heritage.accept(visitor);
for (Method element in methods) element.accept(visitor);
- if (fields != null) {
- for (var field in fields) {
- field.accept(visitor);
- }
- }
- if (typeParams != null) {
- for (var typeParam in typeParams) {
- typeParam.accept(visitor);
- }
- }
}
@override
ClassDeclaration toStatement() => ClassDeclaration(this);
- ClassExpression _clone() => ClassExpression(name, heritage, methods,
- typeParams: typeParams, fields: fields);
+ ClassExpression _clone() => ClassExpression(name, heritage, methods);
int get precedenceLevel => PRIMARY_LOW_PRECEDENCE;
}
@@ -1726,7 +1656,6 @@
with InterpolatedNode
implements Identifier {
final nameOrPosition;
- TypeRef get type => null;
String get name {
throw "InterpolatedParameter.name must not be invoked";
@@ -1797,7 +1726,6 @@
with InterpolatedNode
implements Identifier {
final nameOrPosition;
- TypeRef get type => null;
InterpolatedIdentifier(this.nameOrPosition);
diff --git a/pkg/dev_compiler/lib/src/js_ast/printer.dart b/pkg/dev_compiler/lib/src/js_ast/printer.dart
index da72745..a85c386 100644
--- a/pkg/dev_compiler/lib/src/js_ast/printer.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/printer.dart
@@ -8,7 +8,6 @@
final bool shouldCompressOutput;
final bool minifyLocalVariables;
final bool preferSemicolonToNewlineInMinifiedOutput;
- final bool emitTypes;
final bool allowSingleLineIfStatements;
/// True to allow keywords in properties, such as `obj.var` or `obj.function`
@@ -19,7 +18,6 @@
{this.shouldCompressOutput = false,
this.minifyLocalVariables = false,
this.preferSemicolonToNewlineInMinifiedOutput = false,
- this.emitTypes = false,
this.allowKeywordsInProperties = false,
this.allowSingleLineIfStatements = false});
}
@@ -58,7 +56,7 @@
// TODO(ochafik): Inline the body of [TypeScriptTypePrinter] here if/when it no
// longer needs to share utils with [ClosureTypePrinter].
-class Printer extends TypeScriptTypePrinter implements NodeVisitor {
+class Printer implements NodeVisitor {
final JavaScriptPrintingOptions options;
final JavaScriptPrintingContext context;
final bool shouldCompressOutput;
@@ -296,7 +294,6 @@
visitExpressionStatement(ExpressionStatement expressionStatement) {
indent();
- outClosureAnnotation(expressionStatement);
visitNestedExpression(expressionStatement.expression, EXPRESSION,
newInForInit: false, newAtStatementBegin: true);
outSemicolonLn();
@@ -558,14 +555,12 @@
newInForInit: false, newAtStatementBegin: false);
}
localNamer.enterScope(fun);
- outTypeParams(fun.typeParams);
out("(");
if (fun.params != null) {
visitCommaSeparated(fun.params, PRIMARY,
newInForInit: false, newAtStatementBegin: false);
}
out(")");
- outTypeAnnotation(fun.returnType);
switch (fun.asyncModifier) {
case const AsyncModifier.sync():
break;
@@ -585,7 +580,6 @@
visitFunctionDeclaration(FunctionDeclaration declaration) {
indent();
- outClosureAnnotation(declaration);
var f = declaration.function;
context.enterNode(f);
functionOut(f, declaration.name);
@@ -623,7 +617,6 @@
}
visitVariableDeclarationList(VariableDeclarationList list) {
- outClosureAnnotation(list);
// Note: keyword can be null for non-static field declarations.
if (list.keyword != null) {
out(list.keyword);
@@ -665,7 +658,6 @@
}
visit(structure);
}
- outTypeAnnotation(node.type);
var defaultValue = node.defaultValue;
if (defaultValue != null) {
spaceOut();
@@ -695,7 +687,6 @@
}
visitVariableInitialization(VariableInitialization init) {
- outClosureAnnotation(init);
visitNestedExpression(init.declaration, LEFT_HAND_SIDE,
newInForInit: inForInit, newAtStatementBegin: atStatementBegin);
if (init.value != null) {
@@ -898,7 +889,6 @@
visitIdentifier(Identifier node) {
out(localNamer.getName(node));
- outTypeAnnotation(node.type);
}
visitRestParameter(RestParameter node) {
@@ -966,9 +956,7 @@
visitArrowFun(ArrowFun fun) {
localNamer.enterScope(fun);
- if (fun.params.length == 1 &&
- fun.params[0] is Identifier &&
- (!options.emitTypes || fun.params[0].type == null)) {
+ if (fun.params.length == 1 && fun.params[0] is Identifier) {
visitNestedExpression(fun.params.single, SPREAD,
newInForInit: false, newAtStatementBegin: false);
} else {
@@ -977,7 +965,6 @@
newInForInit: false, newAtStatementBegin: false);
out(")");
}
- outTypeAnnotation(fun.returnType);
spaceOut();
out("=>");
var body = fun.body;
@@ -1116,24 +1103,10 @@
lineOut();
}
- void outTypeParams(Iterable<Identifier> typeParams) {
- if (typeParams != null && options.emitTypes && typeParams.isNotEmpty) {
- out("<");
- var first = true;
- for (var typeParam in typeParams) {
- if (!first) out(", ");
- first = false;
- visit(typeParam);
- }
- out(">");
- }
- }
-
visitClassExpression(ClassExpression node) {
localNamer.enterScope(node);
out('class ');
visit(node.name);
- outTypeParams(node.typeParams);
if (node.heritage != null) {
out(' extends ');
visit(node.heritage);
@@ -1143,14 +1116,6 @@
out('{');
lineOut();
indentMore();
- if (options.emitTypes && node.fields != null) {
- for (var field in node.fields) {
- indent();
- visit(field);
- out(";");
- lineOut();
- }
- }
for (var method in node.methods) {
indent();
visit(method);
@@ -1166,7 +1131,6 @@
}
visitMethod(Method node) {
- outClosureAnnotation(node);
if (node.isStatic) {
out('static ');
}
@@ -1198,17 +1162,6 @@
localNamer.leaveScope();
}
- void outClosureAnnotation(Node node) {
- if (node != null && node.closureAnnotation != null) {
- String comment = node.closureAnnotation.toString(indentation);
- if (comment.isNotEmpty) {
- out(comment);
- lineOut();
- indent();
- }
- }
- }
-
void propertyNameOut(Expression node,
{bool inMethod = false, bool inAccess = false}) {
if (node is LiteralNumber) {
@@ -1404,18 +1357,6 @@
out("await ");
visit(node.expression);
}
-
- void outTypeAnnotation(TypeRef node) {
- if (node == null || !options.emitTypes || node.isUnknown) return;
-
- if (node is OptionalTypeRef) {
- out("?: ");
- visit(node.type);
- } else {
- out(": ");
- visit(node);
- }
- }
}
// Collects all the var declarations in the function. We need to do this in a
diff --git a/pkg/dev_compiler/lib/src/js_ast/template.dart b/pkg/dev_compiler/lib/src/js_ast/template.dart
index 6475446..178b15c 100644
--- a/pkg/dev_compiler/lib/src/js_ast/template.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/template.dart
@@ -598,7 +598,7 @@
Instantiator<ArrowFun> visitArrowFun(ArrowFun node) {
var paramMakers = node.params.map(visitSplayable).toList();
- Instantiator makeBody = visit(node.body as Node);
+ Instantiator makeBody = visit(node.body);
return (a) => ArrowFun(splayNodes(paramMakers, a), makeBody(a));
}
@@ -700,32 +700,6 @@
Instantiator visitExportClause(ExportClause node) =>
throw UnimplementedError();
- Instantiator visitAnyTypeRef(AnyTypeRef node) => throw UnimplementedError();
-
- Instantiator visitUnknownTypeRef(UnknownTypeRef node) =>
- throw UnimplementedError();
-
- Instantiator visitArrayTypeRef(ArrayTypeRef node) =>
- throw UnimplementedError();
-
- Instantiator visitFunctionTypeRef(FunctionTypeRef node) =>
- throw UnimplementedError();
-
- Instantiator visitGenericTypeRef(GenericTypeRef node) =>
- throw UnimplementedError();
-
- Instantiator visitQualifiedTypeRef(QualifiedTypeRef node) =>
- throw UnimplementedError();
-
- Instantiator visitOptionalTypeRef(OptionalTypeRef node) =>
- throw UnimplementedError();
-
- Instantiator visitRecordTypeRef(RecordTypeRef node) =>
- throw UnimplementedError();
-
- Instantiator visitUnionTypeRef(UnionTypeRef node) =>
- throw UnimplementedError();
-
@override
Instantiator<DestructuredVariable> visitDestructuredVariable(
DestructuredVariable node) {
diff --git a/pkg/dev_compiler/lib/src/js_ast/type_printer.dart b/pkg/dev_compiler/lib/src/js_ast/type_printer.dart
deleted file mode 100644
index 5123482..0000000
--- a/pkg/dev_compiler/lib/src/js_ast/type_printer.dart
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of js_ast;
-
-abstract class _TypePrinterBase implements TypeRefVisitor {
- void out(String s);
- void visit(Node node);
-
- void outSeparated<T extends Node>(String separator, Iterable<T> items,
- [action(T item)]) {
- action ??= visit;
- var first = true;
- for (var item in items) {
- if (first) {
- first = false;
- } else {
- out(separator);
- }
- action(item);
- }
- }
-
- void outTypeArg(Iterable<TypeRef> typeArgs) {
- if (typeArgs.isNotEmpty) {
- // TODO(ochafik): Double-check precedence issues when we start emitting
- // type arguments outside type literals (generic method call, etc).
- out('<');
- outSeparated(", ", typeArgs);
- out('>');
- }
- }
-
- @override
- visitQualifiedTypeRef(QualifiedTypeRef node) {
- outSeparated(".", node.path);
- }
-}
-
-abstract class TypeScriptTypePrinter extends _TypePrinterBase {
- void _outTypeAnnotation(TypeRef type) {
- if (type is OptionalTypeRef) {
- out("?: ");
- visit(type.type);
- } else {
- out(": ");
- visit(type);
- }
- }
-
- @override
- visitGenericTypeRef(GenericTypeRef node) {
- if (node.rawType is FunctionTypeRef) {
- outTypeArg(node.typeArgs);
- visit(node.rawType);
- } else {
- visit(node.rawType);
- outTypeArg(node.typeArgs);
- }
- }
-
- @override
- visitArrayTypeRef(ArrayTypeRef node) {
- if (node.elementType == null) {
- out("Array");
- } else {
- visit(node.elementType);
- out("[]");
- }
- }
-
- @override
- visitOptionalTypeRef(OptionalTypeRef node) {
- visit(node.type);
- }
-
- @override
- visitRecordTypeRef(RecordTypeRef node) {
- out('{');
- outSeparated(", ", node.types.keys, (Identifier name) {
- var type = node.types[name];
- visit(name);
- _outTypeAnnotation(type);
- });
- out('}');
- }
-
- @override
- visitUnionTypeRef(UnionTypeRef node) {
- outSeparated("|", node.types.where((t) => !t.isNull));
- }
-
- @override
- visitFunctionTypeRef(FunctionTypeRef node) {
- if (node.returnType == null) {
- out('Function');
- } else {
- out('(');
- if (node.paramTypes == null) {
- out('...any');
- } else {
- outSeparated(", ", node.paramTypes.keys, (Identifier name) {
- var paramType = node.paramTypes[name];
- visit(name);
- _outTypeAnnotation(paramType);
- });
- }
- out(') => ');
- visit(node.returnType);
- }
- }
-
- @override
- visitAnyTypeRef(AnyTypeRef node) {
- out("any");
- }
-
- @override
- visitUnknownTypeRef(UnknownTypeRef node) {
- out("any");
- }
-}
-
-class ClosureTypePrinter extends _TypePrinterBase implements NodeVisitor {
- final _buffer = StringBuffer();
-
- @override
- void out(String s) => _buffer.write(s);
-
- @override
- void visit(Node node) => node.accept(this);
-
- noSuchMethod(Invocation i) => super.noSuchMethod(i);
-
- @override
- visitGenericTypeRef(GenericTypeRef node) {
- visit(node.rawType);
- outTypeArg(node.typeArgs);
- }
-
- @override
- visitIdentifier(Identifier node) {
- //out(localNamer.getName(node));
- out(node.name);
- }
-
- @override
- visitAccess(PropertyAccess node) {
- var selector = node.selector;
- if (selector is LiteralString) {
- visit(node.receiver);
- out(".");
- out(selector.valueWithoutQuotes);
- } else {
- assert(false);
- out("?");
- }
- }
-
- @override
- toString() => _buffer.toString();
-
- @override
- visitArrayTypeRef(ArrayTypeRef node) {
- out("Array");
- if (node.elementType != null) {
- out("<");
- visit(node.elementType);
- out(">");
- }
- }
-
- @override
- visitOptionalTypeRef(OptionalTypeRef node) {
- visit(node.type);
- out("=");
- }
-
- @override
- visitRecordTypeRef(RecordTypeRef node) {
- out('{');
- outSeparated(", ", node.types.keys, (Identifier name) {
- var type = node.types[name];
- visit(name);
- out(": ");
- visit(type is OptionalTypeRef ? type.orUndefined() : type);
- });
- out('}');
- }
-
- @override
- visitAnyTypeRef(AnyTypeRef node) {
- out("*");
- }
-
- @override
- visitUnknownTypeRef(UnknownTypeRef node) {
- out("?");
- }
-
- @override
- visitUnionTypeRef(UnionTypeRef node) {
- out("(");
- outSeparated("|", node.types);
- out(")");
- }
-
- @override
- visitFunctionTypeRef(FunctionTypeRef node) {
- if (node.returnType == null) {
- out('Function');
- } else {
- out('function(');
- if (node.paramTypes == null) {
- out("...*");
- } else {
- outSeparated(", ", node.paramTypes.values);
- }
- out(')');
- if (node.returnType != null) {
- out(":");
- visit(node.returnType);
- }
- }
- }
-}
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index 3d6f202..d7d658e 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -4839,8 +4839,7 @@
// Convert `function(...) { ... }` to `(...) => ...`
// This is for readability, but it also ensures correct `this` binding.
- return JS.ArrowFun(f.params, body,
- typeParams: f.typeParams, returnType: f.returnType);
+ return JS.ArrowFun(f.params, body);
}
@override
diff --git a/pkg/dev_compiler/lib/src/kernel/constants.dart b/pkg/dev_compiler/lib/src/kernel/constants.dart
index 79448fc..60a79c7 100644
--- a/pkg/dev_compiler/lib/src/kernel/constants.dart
+++ b/pkg/dev_compiler/lib/src/kernel/constants.dart
@@ -252,7 +252,7 @@
if (value != null) return canonicalize(StringConstant(value));
return defaultArg ?? nullConstant;
} else if (targetClass == coreTypes.intClass) {
- var intValue = int.parse(value ?? '', onError: (_) => null);
+ var intValue = int.tryParse(value ?? '');
if (intValue != null) return canonicalize(IntConstant(intValue));
return defaultArg ?? nullConstant;
} else if (targetClass == coreTypes.boolClass) {
diff --git a/pkg/dev_compiler/package.json b/pkg/dev_compiler/package.json
deleted file mode 100644
index 0abdbd3..0000000
--- a/pkg/dev_compiler/package.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "dev_compiler",
- "version": "0.1.24",
- "description": "Dart Development Compiler",
- "homepage": "https://github.com/dart-lang/dev_compiler",
- "bugs": "https://github.com/dart-lang/dev_compiler/issues",
- "contributors": {
- "Dart Team": "dev-compiler@dartlang.org"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/dart-lang/dev_compiler.git"
- },
- "scripts": {
- "postinstall": "./node_modules/.bin/webdriver-manager update",
- "test": "./node_modules/.bin/karma start --single-run"
- },
- "devDependencies": {
- "chai": "^2.2.0",
- "electron-prebuilt": "^0.36.0",
- "is_js": "^0.9.0",
- "karma": "^1.5.0",
- "karma-chai": "^0.1.0",
- "karma-chrome-launcher": "^0.1.8",
- "karma-electron-launcher": "^0.0.5",
- "karma-firefox-launcher": "~0.1",
- "karma-mocha": "^0.1.10",
- "karma-requirejs": "^0.2.2",
- "karma-safari-launcher": "^1.0.0",
- "mocha": "^2.2.4",
- "requirejs": "^2.3.3",
- "webdriver-manager": "8.0.0"
- }
-}
diff --git a/pkg/dev_compiler/test-main.js b/pkg/dev_compiler/test-main.js
deleted file mode 100644
index 68b3ad1..0000000
--- a/pkg/dev_compiler/test-main.js
+++ /dev/null
@@ -1,65 +0,0 @@
-var allTestFiles = [];
-var TEST_REGEXP = /(_test|_multi)\.js$/i;
-
-var pathToModule = function(path) {
- return path.replace(/^\/base\//, '').replace(/\.js$/, '');
-};
-
-var testsToSkip = [
- // syntax error in DDC's generated code (related to break/continue labels):
- '/base/gen/codegen_output/language/execute_finally6_test.js',
- '/base/gen/codegen_output/language/switch_label2_test.js',
- '/base/gen/codegen_output/language/infinite_switch_label_test.js',
- '/base/gen/codegen_output/language/switch_label_test.js',
- '/base/gen/codegen_output/language/nested_switch_label_test.js',
- '/base/gen/codegen_output/language/switch_try_catch_test.js',
-
- // module code execution error in DDC's generated code
- // (types are initialized incorrectly):
- '/base/gen/codegen_output/language/f_bounded_quantification3_test.js',
- '/base/gen/codegen_output/language/regress_16640_test.js',
- '/base/gen/codegen_output/language/cyclic_type_test_02_multi.js',
- '/base/gen/codegen_output/language/cyclic_type_test_03_multi.js',
- '/base/gen/codegen_output/language/cyclic_type_test_04_multi.js',
- '/base/gen/codegen_output/language/cyclic_type2_test.js',
- '/base/gen/codegen_output/language/least_upper_bound_expansive_test_none_multi.js'
-];
-
-Object.keys(window.__karma__.files).forEach(function(file) {
- if (TEST_REGEXP.test(file) && testsToSkip.indexOf(file) == -1) {
- // Normalize paths to RequireJS module names.
- allTestFiles.push(pathToModule(file));
- }
-});
-
-allTestFiles.push('test/browser/language_tests');
-allTestFiles.push('test/browser/runtime_tests');
-
-require.config({
- // Karma serves files under /base.
- baseUrl: '/base',
-
- // Travis bots take a bit longer to load all ~2k test files.
- waitSeconds: 30,
-
- paths: {
- dart_sdk: 'lib/js/amd/dart_sdk',
- async_helper: 'gen/codegen_output/pkg/async_helper',
- expect: 'gen/codegen_output/pkg/expect',
- js: 'gen/codegen_output/pkg/js',
- matcher: 'gen/codegen_output/pkg/matcher',
- meta: 'gen/codegen_output/pkg/meta',
- minitest: 'gen/codegen_output/pkg/minitest',
- path: 'gen/codegen_output/pkg/path',
- stack_trace: 'gen/codegen_output/pkg/stack_trace',
- unittest: 'gen/codegen_output/pkg/unittest',
- is: 'node_modules/is_js/is',
- test_status: 'gen/codegen_output/test_status'
- },
-
- // Require all test files before starting tests.
- deps: allTestFiles,
-
- // We have to kickoff jasmine, as it is asynchronous
- callback: window.__karma__.start
-});
diff --git a/pkg/dev_compiler/test/all_tests.dart b/pkg/dev_compiler/test/all_tests.dart
deleted file mode 100644
index 963e55c..0000000
--- a/pkg/dev_compiler/test/all_tests.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Meta-test that runs all tests we have written.
-library dev_compiler.test.all_tests;
-
-import 'package:test/test.dart';
-
-import 'closure/closure_annotation_test.dart' as closure_annotation_test;
-import 'closure/closure_type_test.dart' as closure_type_test;
-import 'codegen_test.dart' as codegen_test;
-import 'js/builder_test.dart' as builder_test;
-import 'options/options_test.dart' as options_test;
-import 'worker/worker_test.dart' as worker_test;
-
-void main() {
- group('options', options_test.main);
- group('codegen', () => codegen_test.main([]));
- group('closure', () {
- closure_annotation_test.main();
- closure_type_test.main();
- });
- group('js', builder_test.main);
- group('worker', worker_test.main);
-}
diff --git a/pkg/dev_compiler/test/child_server_process.dart b/pkg/dev_compiler/test/child_server_process.dart
deleted file mode 100644
index f274290..0000000
--- a/pkg/dev_compiler/test/child_server_process.dart
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:io';
-import 'dart:async';
-
-class ChildServerProcess {
- /// [IOSink]s like [stdout] don't like to be piped more than one [Stream], but
- /// we want to pipe many of them (basically, every standard output and error
- /// of every child process we open), so we pipe to an accommodating consumer.
- static final _consoleOut = _MultipleStreamConsumer(stdout);
-
- final Process process;
- final String host;
- final int port;
- ChildServerProcess._(this.process, this.host, this.port);
-
- get httpUri => Uri.parse('http://$host:$port');
-
- static build(Future<Process> builder(String host, int port),
- {int defaultPort = 1024,
- int maxPort = 65535,
- String host = '0.0.0.0'}) async {
- var port = await _findUnusedPort(defaultPort, maxPort);
- var p = (await builder(host, port))
- ..stdout.pipe(_consoleOut)
- ..stderr.pipe(_consoleOut);
- await _waitForServer(host, port);
- return ChildServerProcess._(p, host, port);
- }
-
- static _waitForServer(String host, int port,
- {int attempts = 10,
- Duration retryDelay = const Duration(seconds: 1)}) async {
- var lastError;
- for (int i = 0; i < attempts; i++) {
- try {
- await (await Socket.connect(host, port)).close();
- return;
- } catch (e) {
- lastError = e;
- await Future.delayed(retryDelay);
- }
- }
- throw StateError(
- 'Failed to connect to $host:$port after $attempts attempts; '
- 'Last error:\n$lastError');
- }
-
- static Future<int> _findUnusedPort(int fromPort, int toPort) async {
- var lastError;
- for (int port = fromPort; port <= toPort; port++) {
- try {
- await (await ServerSocket.bind(InternetAddress.ANY_IP_V4, port))
- .close();
- return port;
- } catch (e) {
- lastError = e;
- }
- }
- throw StateError(
- 'Failed to find an unused port between $fromPort and $toPort; '
- 'Last error:\n$lastError');
- }
-}
-
-/// A consumer into which we can pipe as many streams as we want, that forwards
-/// everything to an [IOSink] (such as [stdout]).
-class _MultipleStreamConsumer extends StreamConsumer<List<int>> {
- final IOSink _sink;
- _MultipleStreamConsumer(this._sink);
-
- @override
- Future addStream(Stream<List<int>> stream) async {
- await for (var data in stream) {
- _sink.add(data);
- }
- }
-
- @override
- close() {}
-}
diff --git a/pkg/dev_compiler/test/closure/closure_annotation_test.dart b/pkg/dev_compiler/test/closure/closure_annotation_test.dart
deleted file mode 100644
index e3347c6..0000000
--- a/pkg/dev_compiler/test/closure/closure_annotation_test.dart
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dev_compiler.test.closure_annotation_test;
-
-import 'package:test/test.dart';
-
-import 'package:dev_compiler/src/closure/closure_annotation.dart';
-import 'package:dev_compiler/src/js_ast/js_ast.dart' show TypeRef, Identifier;
-
-void main() {
- group('ClosureAnnotation', () {
- var anyType = TypeRef.any();
- var unknownType = TypeRef.unknown();
- var numberType = TypeRef.number();
- var stringType = TypeRef.string();
- var booleanType = TypeRef.boolean();
- var fooType = TypeRef.qualified([Identifier("foo"), Identifier("Foo")]);
- var barType = TypeRef.named("Bar");
- var bazType = TypeRef.named("Baz");
- var bamType = TypeRef.named("Bam");
- var batType = TypeRef.named("Bat");
-
- test('gives empty comment when no has no meaningful info', () {
- expect(ClosureAnnotation().toString(), "");
- expect(ClosureAnnotation(type: anyType).toString(), "");
- expect(ClosureAnnotation(type: unknownType).toString(), "");
- });
-
- test('gives single line comment when it fits', () {
- expect(ClosureAnnotation(type: numberType).toString(),
- "/** @type {number} */");
- expect(ClosureAnnotation(paramTypes: {'foo': anyType}).toString(),
- "/** @param {*} foo */");
- expect(ClosureAnnotation(paramTypes: {'foo': unknownType}).toString(),
- "/** @param {?} foo */");
- });
-
- test('gives multiple line comment when it it does not fit on one line', () {
- expect(
- ClosureAnnotation(
- returnType: stringType,
- paramTypes: {'foo': numberType}).toString(),
- "/**\n"
- " * @param {number} foo\n"
- " * @return {string}\n"
- " */");
- });
-
- test('inserts indentation', () {
- expect(
- ClosureAnnotation(
- returnType: stringType,
- paramTypes: {'foo': numberType}).toString(" "),
- "/**\n" // No indent on first line.
- " * @param {number} foo\n"
- " * @return {string}\n"
- " */");
- });
-
- test('compresses @type, @final, @const, @private, @protected, @typedef',
- () {
- expect(ClosureAnnotation(type: stringType).toString(),
- "/** @type {string} */");
- expect(ClosureAnnotation(type: stringType, isConst: true).toString(),
- "/** @const {string} */");
- expect(ClosureAnnotation(type: stringType, isFinal: true).toString(),
- "/** @final {string} */");
- expect(ClosureAnnotation(type: stringType, isPrivate: true).toString(),
- "/** @private {string} */");
- expect(ClosureAnnotation(type: stringType, isTypedef: true).toString(),
- "/** @typedef {string} */");
- expect(ClosureAnnotation(type: stringType, isProtected: true).toString(),
- "/** @protected {string} */");
- expect(
- ClosureAnnotation(
- type: stringType,
- isPrivate: true,
- isConst: true,
- isFinal: true,
- isProtected: true,
- isTypedef: true)
- .toString(),
- "/** @private @protected @final @const @typedef {string} */");
- });
-
- test('supports a full constructor annotation', () {
- expect(
- ClosureAnnotation(
- returnType: booleanType,
- throwsType: bamType,
- thisType: fooType,
- superType: barType,
- lendsToType: batType,
- interfaces: [bazType],
- isStruct: true,
- isPrivate: true,
- isProtected: true,
- isOverride: true,
- isFinal: true,
- isConst: true,
- isConstructor: true,
- isNoSideEffects: true,
- isNoCollapse: true,
- paramTypes: {'x': stringType, 'y': numberType},
- templates: ['A', 'B']).toString(),
- '/**\n'
- ' * @template A, B\n'
- ' * @this {foo.Foo}\n'
- ' * @override\n'
- ' * @nosideeffects\n'
- ' * @nocollapse\n'
- ' * @lends {Bat}\n'
- ' * @private @protected @final @const\n'
- ' * @constructor @struct @extends {Bar}\n'
- ' * @implements {Baz}\n'
- ' * @param {string} x\n'
- ' * @param {number} y\n'
- ' * @return {boolean}\n'
- ' * @throws {Bam}\n'
- ' */');
- });
- });
-}
diff --git a/pkg/dev_compiler/test/closure/closure_type_test.dart b/pkg/dev_compiler/test/closure/closure_type_test.dart
deleted file mode 100644
index c8b7c62..0000000
--- a/pkg/dev_compiler/test/closure/closure_type_test.dart
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dev_compiler.test.closure_type_test;
-
-import 'package:test/test.dart';
-
-import 'package:dev_compiler/src/closure/closure_type.dart';
-
-void main() {
- expectToString(ClosureType t, String s,
- {String nullable, String nonNullable}) {
- expect(t.toString(), s);
- if (nullable != null) {
- expect(t.toNullable().toString(), nullable);
- }
- if (nonNullable != null) {
- expect(t.toNonNullable().toString(), nonNullable);
- }
- }
-
- group('ClosureType', () {
- test('supports simple types', () {
- expectToString(ClosureType.number(), "number",
- nullable: "?number", nonNullable: "number");
- expectToString(ClosureType.boolean(), "boolean",
- nullable: "?boolean", nonNullable: "boolean");
- expectToString(ClosureType.string(), "string",
- nullable: "string", nonNullable: "!string");
- expectToString(ClosureType.type("foo.Bar"), "foo.Bar",
- nullable: "foo.Bar", nonNullable: "!foo.Bar");
- });
-
- test('supports array types', () {
- expectToString(ClosureType.array(), "Array<*>",
- nullable: "Array<*>", nonNullable: "!Array<*>");
- expectToString(ClosureType.array(ClosureType.type("Foo")), "Array<Foo>",
- nullable: "Array<Foo>", nonNullable: "!Array<Foo>");
- });
-
- test('supports map types', () {
- expectToString(
- ClosureType.map(ClosureType.type("Foo"), ClosureType.type("Bar")),
- "Object<Foo, Bar>",
- nullable: "Object<Foo, Bar>",
- nonNullable: "!Object<Foo, Bar>");
- expectToString(ClosureType.map(), "Object<*, *>",
- nullable: "Object<*, *>", nonNullable: "!Object<*, *>");
- });
-
- test('supports function types', () {
- expectToString(ClosureType.function(), "Function",
- nullable: "Function", nonNullable: "!Function");
- expectToString(
- ClosureType.function([ClosureType.number()]), "function(number)");
- expectToString(ClosureType.function(null, ClosureType.number()),
- "function(...*):number");
- expectToString(
- ClosureType.function([ClosureType.number(), ClosureType.string()],
- ClosureType.boolean()),
- "function(number, string):boolean");
- });
-
- test('supports union types', () {
- expectToString(
- ClosureType.number().or(ClosureType.boolean()), "(number|boolean)");
- expectToString(ClosureType.number().orUndefined(), "(number|undefined)");
- });
-
- test('supports record types', () {
- expectToString(
- ClosureType.record(
- {'x': ClosureType.number(), 'y': ClosureType.boolean()}),
- "{x: number, y: boolean}");
- });
-
- test('supports optional pseudo-types', () {
- expectToString(ClosureType.number().toOptional(), "number=");
- });
- });
-}
diff --git a/pkg/dev_compiler/test/codegen/BenchmarkBase.dart b/pkg/dev_compiler/test/codegen/BenchmarkBase.dart
deleted file mode 100644
index 05dde11..0000000
--- a/pkg/dev_compiler/test/codegen/BenchmarkBase.dart
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
-
-library BenchmarkBase;
-
-class Expect {
- static void equals(var expected, var actual) {
- if (expected != actual) {
- throw "Values not equal: $expected vs $actual";
- }
- }
-
- static void listEquals(List expected, List actual) {
- if (expected.length != actual.length) {
- throw "Lists have different lengths: ${expected.length} vs ${actual.length}";
- }
- for (int i = 0; i < actual.length; i++) {
- equals(expected[i], actual[i]);
- }
- }
-
- fail(message) {
- throw message;
- }
-}
-
-class BenchmarkBase {
- final String name;
-
- // Empty constructor.
- const BenchmarkBase(String name) : this.name = name;
-
- // The benchmark code.
- // This function is not used, if both [warmup] and [exercise] are overwritten.
- void run() {}
-
- // Runs a short version of the benchmark. By default invokes [run] once.
- void warmup() {
- run();
- }
-
- // Exercises the benchmark. By default invokes [run] 10 times.
- void exercise() {
- for (int i = 0; i < 10; i++) {
- run();
- }
- }
-
- // Not measured setup code executed prior to the benchmark runs.
- void setup() {}
-
- // Not measures teardown code executed after the benchmark runs.
- void teardown() {}
-
- // Measures the score for this benchmark by executing it repeately until
- // time minimum has been reached.
- static double measureFor(Function f, int timeMinimum) {
- int time = 0;
- int iter = 0;
- Stopwatch watch = Stopwatch();
- watch.start();
- int elapsed = 0;
- while (elapsed < timeMinimum) {
- f();
- elapsed = watch.elapsedMilliseconds;
- iter++;
- }
- return 1000.0 * elapsed / iter;
- }
-
- // Measures the score for the benchmark and returns it.
- double measure() {
- setup();
- // Warmup for at least 100ms. Discard result.
- measureFor(() {
- this.warmup();
- }, 100);
- // Run the benchmark for at least 2000ms.
- double result = measureFor(() {
- this.exercise();
- }, 2000);
- teardown();
- return result;
- }
-
- void report() {
- double score = measure();
- print("$name(RunTime): $score us.");
- }
-}
diff --git a/pkg/dev_compiler/test/codegen/closure.dart b/pkg/dev_compiler/test/codegen/closure.dart
deleted file mode 100644
index 9d3294b..0000000
--- a/pkg/dev_compiler/test/codegen/closure.dart
+++ /dev/null
@@ -1,70 +0,0 @@
-// compile options: --closure-experimental --destructure-named-params --modules=es6
-library test;
-
-import 'dart:js';
-
-List<T> generic_function<T>(List<T> items, T seed) {
- var strings = items.map((i) => "$i").toList();
- return items;
-}
-
-typedef void Callback({int i});
-
-class Foo<T> {
- final int i;
- bool b;
- String s;
- T v;
-
- Foo(this.i, this.v);
-
- factory Foo.build() => Foo(1, null);
-
- untyped_method(a, b) {}
-
- T pass(T t) => t;
-
- String typed_method(Foo foo, List list, int i, num n, double d, bool b,
- String s, JsArray a, JsObject o, JsFunction f) {
- return '';
- }
-
- optional_params(a, [b, int c]) {}
-
- static named_params(a, {b, int c}) {}
-
- nullary_method() {}
-
- function_params(int f(x, [y]), g(x, {String y, z}), Callback cb) {
- cb(i: i);
- }
-
- run(List a, String b, List c(String d), List<int> e(f(g)),
- {Map<Map, Map> h}) {}
-
- String get prop => null;
- set prop(String value) {}
-
- static String get staticProp => null;
- static set staticProp(String value) {}
-
- static const String some_static_constant = "abc";
- static final String some_static_final = "abc";
- static String some_static_var = "abc";
-}
-
-class Bar {}
-
-class Baz extends Foo<int> with Bar {
- Baz(int i) : super(i, 123);
-}
-
-void main(args) {}
-
-var closure = () {
- return;
-};
-
-const String some_top_level_constant = "abc";
-final String some_top_level_final = "abc";
-String some_top_level_var = "abc";
diff --git a/pkg/dev_compiler/test/codegen/destructuring.dart b/pkg/dev_compiler/test/codegen/destructuring.dart
deleted file mode 100644
index dd8745e..0000000
--- a/pkg/dev_compiler/test/codegen/destructuring.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// compile options: --destructure-named-params
-import 'dart-ext:foo';
-import 'package:js/src/varargs.dart';
-
-f(int a, b, [c = 1]) {
- f(a, b, c);
-}
-
-external f_ext(int a, b, [c = 1]);
-f_nat(int a, b, [c = 1]) native "f_nat";
-f_sync(int a, b, [c = 1]) sync* {}
-f_async(int a, b, [c = 1]) async* {}
-
-g(int a, b, {c = 1}) {
- f(a, b, c);
-}
-
-external g_ext(int a, b, {c = 1});
-g_nat(int a, b, {c = 1}) native "g_nat";
-g_sync(int a, b, {c = 1}) sync* {}
-g_async(int a, b, {c = 1}) async* {}
-
-r(int a, @rest others) {
- r(a, spread(others));
-}
-
-external r_ext(int a, @rest others);
-r_nat(int a, @rest others) native "r_nat";
-r_sync(int a, @rest others) sync* {}
-r_async(int a, @rest others) async* {}
-
-invalid_names1(int let, function, arguments) {
- f(let, function, arguments);
-}
-
-invalid_names2([int let, function = 1, arguments]) {
- f(let, function, arguments);
-}
-
-invalid_names3({int let, function, arguments = 2}) {
- f(let, function, arguments);
-}
-
-names_clashing_with_object_props(
- {int constructor, valueOf, hasOwnProperty = 2}) {
- f(constructor, valueOf, hasOwnProperty);
-}
diff --git a/pkg/dev_compiler/test/codegen/equality_test.dart b/pkg/dev_compiler/test/codegen/equality_test.dart
deleted file mode 100644
index cd1d90d7..0000000
--- a/pkg/dev_compiler/test/codegen/equality_test.dart
+++ /dev/null
@@ -1,1279 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:expect/minitest.dart';
-
-/// Both kinds.
-enum Music { country, western }
-
-class BluesBrother {}
-
-// This class does not override object equality
-class _Jake extends BluesBrother {}
-
-/// This class overrides object equality
-class _Elwood extends BluesBrother {
- bool operator ==(Object other) {
- return (other is _Elwood);
- }
-}
-
-/// Mock BluesBrother
-class _Norman extends BluesBrother {}
-
-/// Hide nullability from the simple minded null analysis
-T hideNull<T>(T x) => x;
-
-/// Generate undefined at a type
-T getUndefined<T>() => (List(1))[0];
-
-main() {
- group('Enum equality', () {
- // Test equality of two enums, various types, nullable
- test('Equal enum/enum (nullable)', () {
- Music e1 = hideNull(Music.country);
- Music e2 = hideNull(Music.western);
- dynamic d1 = hideNull(Music.country);
- dynamic d2 = hideNull(Music.western);
- Object o1 = hideNull(Music.country);
- Object o2 = hideNull(Music.western);
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of two enums, various types, non-nullable
- test('Equal enum/enum (non-null)', () {
- Music e1 = Music.country;
- Music e2 = Music.western;
- dynamic d1 = Music.country;
- dynamic d2 = Music.western;
- Object o1 = Music.country;
- Object o2 = Music.western;
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of enum and other types (static, nullable)
- test('Equal enum/other (static, nullable)', () {
- Music e1 = hideNull(Music.country);
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of enum and other types (static, non-null)
- test('Equal enum/other (static, non-null)', () {
- Music e1 = Music.country;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of enum and other types (dynamic, nullable)
- test('Equal enum/other (dynamic, nullable)', () {
- Music e1 = hideNull(Music.country);
- dynamic d1 = hideNull(Music.country);
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
-
- // Test equality of enum and other types (dynamic, non-null)
- test('Equal enum/other (dynamic, non-null)', () {
- Music e1 = Music.country;
- dynamic d1 = Music.country;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
- });
-
- group('String equality', () {
- // Test equality of two strings, various types, nullable
- test('Equal string/string (nullable)', () {
- String e1 = hideNull("The");
- String e2 = hideNull("Band");
- dynamic d1 = hideNull("The");
- dynamic d2 = hideNull("Band");
- Object o1 = hideNull("The");
- Object o2 = hideNull("Band");
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of two strings, various types, non-nullable
- test('Equal string/string (non-null)', () {
- String e1 = "The";
- String e2 = "Band";
- dynamic d1 = "The";
- dynamic d2 = "Band";
- Object o1 = "The";
- Object o2 = "Band";
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of string and other types (static, nullable)
- test('Equal string/other (static, nullable)', () {
- String e1 = hideNull("The");
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of string and other types (static, non-null)
- test('Equal string/other (static, non-null)', () {
- String e1 = "The";
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of string and other types (dynamic, nullable)
- test('Equal string/other (dynamic, nullable)', () {
- String e1 = hideNull("The");
- dynamic d1 = hideNull("The");
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
-
- // Test equality of string and other types (dynamic, non-null)
- test('Equal string/other (dynamic, non-null)', () {
- String e1 = "The";
- dynamic d1 = "The";
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
- });
-
- group('Boolean equality', () {
- // Test equality of two bools, various types, nullable
- test('Equal bool/bool (nullable)', () {
- bool e1 = hideNull(true);
- bool e2 = hideNull(false);
- dynamic d1 = hideNull(true);
- dynamic d2 = hideNull(false);
- Object o1 = hideNull(true);
- Object o2 = hideNull(false);
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of two bools, various types, non-nullable
- test('Equal bool/bool (non-null)', () {
- bool e1 = true;
- bool e2 = false;
- dynamic d1 = true;
- dynamic d2 = false;
- Object o1 = true;
- Object o2 = false;
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of bool and other types (static, nullable)
- test('Equal bool/other (static, nullable)', () {
- bool e1 = hideNull(true);
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of bool and other types (static, non-null)
- test('Equal bool/other (static, non-null)', () {
- bool e1 = true;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of bool and other types (dynamic, nullable)
- test('Equal bool/other (dynamic, nullable)', () {
- bool e1 = hideNull(true);
- dynamic d1 = hideNull(true);
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
-
- // Test equality of bool and other types (dynamic, non-null)
- test('Equal bool/other (dynamic, non-null)', () {
- bool e1 = true;
- dynamic d1 = true;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
- });
-
- group('String equality', () {
- // Test equality of two strings, various types, nullable
- test('Equal string/string (nullable)', () {
- String e1 = hideNull("The");
- String e2 = hideNull("Band");
- dynamic d1 = hideNull("The");
- dynamic d2 = hideNull("Band");
- Object o1 = hideNull("The");
- Object o2 = hideNull("Band");
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of two strings, various types, non-nullable
- test('Equal string/string (non-null)', () {
- String e1 = "The";
- String e2 = "Band";
- dynamic d1 = "The";
- dynamic d2 = "Band";
- Object o1 = "The";
- Object o2 = "Band";
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of string and other types (static, nullable)
- test('Equal string/other (static, nullable)', () {
- String e1 = hideNull("The");
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of string and other types (static, non-null)
- test('Equal string/other (static, non-null)', () {
- String e1 = "The";
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of string and other types (dynamic, nullable)
- test('Equal string/other (dynamic, nullable)', () {
- String e1 = hideNull("The");
- dynamic d1 = hideNull("The");
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
-
- // Test equality of string and other types (dynamic, non-null)
- test('Equal string/other (dynamic, non-null)', () {
- String e1 = "The";
- dynamic d1 = "The";
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
- });
-
- group('Number equality', () {
- // Test equality of two ints, various types, nullable
- test('Equal int/int (nullable)', () {
- int e1 = hideNull(11);
- int e2 = hideNull(12);
- dynamic d1 = hideNull(11);
- dynamic d2 = hideNull(12);
- Object o1 = hideNull(11);
- Object o2 = hideNull(12);
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of two ints, various types, non-nullable
- test('Equal int/int (non-null)', () {
- int e1 = 11;
- int e2 = 12;
- dynamic d1 = 11;
- dynamic d2 = 12;
- Object o1 = 11;
- Object o2 = 12;
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of int and other types (static, nullable)
- test('Equal int/other (static, nullable)', () {
- int e1 = hideNull(11);
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of int and other types (static, non-null)
- test('Equal int/other (static, non-null)', () {
- int e1 = 11;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of int and other types (dynamic, nullable)
- test('Equal int/other (dynamic, nullable)', () {
- int e1 = hideNull(11);
- dynamic d1 = hideNull(11);
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
-
- // Test equality of int and other types (dynamic, non-null)
- test('Equal int/other (dynamic, non-null)', () {
- int e1 = 11;
- dynamic d1 = 11;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
- });
-
- group('Object equality', () {
- // Test equality of two objects, various types, nullable
- test('Equal object/object (nullable)', () {
- _Jake e1 = hideNull(_Jake());
- _Elwood e2 = hideNull(_Elwood());
- dynamic d1 = hideNull(e1);
- dynamic d2 = hideNull(_Elwood());
- Object o1 = hideNull(e1);
- Object o2 = hideNull(_Elwood());
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of two objects, various types, non-nullable
- test('Equal object/object (non-null)', () {
- _Jake e1 = _Jake();
- _Elwood e2 = _Elwood();
- dynamic d1 = e1;
- dynamic d2 = _Elwood();
- Object o1 = e1;
- Object o2 = _Elwood();
- expect(e1 == e1, true);
- expect(e1 == d1, true);
- expect(e1 == o1, true);
- expect(e1 == e2, false);
- expect(e1 == o2, false);
- expect(e1 == d2, false);
- expect(e1 == e2, false);
- expect(d1 == e1, true);
- expect(d1 == d1, true);
- expect(d1 == o1, true);
- expect(d1 == e2, false);
- expect(d1 == d2, false);
- expect(d1 == o2, false);
- expect(o1 == e1, true);
- expect(o1 == d1, true);
- expect(o1 == o1, true);
- expect(o1 == e2, false);
- expect(o1 == d2, false);
- expect(o1 == o2, false);
- });
-
- // Test equality of object and other types (static, nullable)
- test('Equal object/other (static, nullable)', () {
- _Jake e1 = hideNull(_Jake());
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of object and other types (static, non-null)
- test('Equal object/other (static, non-null)', () {
- _Jake e1 = _Jake();
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
- });
-
- // Test equality of object and other types (dynamic, nullable)
- test('Equal object/other (dynamic, nullable)', () {
- _Jake e1 = hideNull(_Jake());
- dynamic d1 = hideNull(_Jake());
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
-
- // Test equality of object and other types (dynamic, non-null)
- test('Equal object/other (dynamic, non-null)', () {
- _Jake e1 = _Jake();
- dynamic d1 = _Jake();
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(e1 == s1, false);
- expect(e1 == s2, false);
- expect(e1 == i1, false);
- expect(e1 == i2, false);
- expect(e1 == l1, false);
- expect(e1 == b1, false);
-
- expect(s1 == e1, false);
- expect(s2 == e1, false);
- expect(i1 == e1, false);
- expect(i2 == e1, false);
- expect(l1 == e1, false);
- expect(b1 == e1, false);
-
- expect(d1 == s1, false);
- expect(d1 == s2, false);
- expect(d1 == i1, false);
- expect(d1 == i2, false);
- expect(d1 == l1, false);
- expect(d1 == b1, false);
-
- expect(s1 == d1, false);
- expect(s2 == d1, false);
- expect(i1 == d1, false);
- expect(i2 == d1, false);
- expect(l1 == d1, false);
- expect(b1 == d1, false);
- });
- });
-
- // Test that null receiver with undefined argument is handled correctly
- group('Null/undefined equality', () {
- // Test equality of null object and other types
- test('Equal object/other (static, null)', () {
- BluesBrother n = hideNull(null);
- String u1 = getUndefined();
- int u2 = getUndefined();
- bool u3 = getUndefined();
- List u4 = getUndefined();
-
- expect(n == n, true);
-
- expect(n == u1, true);
- expect(n == u2, true);
- expect(n == u3, true);
- expect(n == u4, true);
-
- expect(u1 == n, true);
- expect(u2 == n, true);
- expect(u3 == n, true);
- expect(u4 == n, true);
- });
-
- // Test equality of null string and other types
- test('Equal String/other (static, null)', () {
- BluesBrother u1 = getUndefined();
- String n = hideNull(null);
- int u2 = getUndefined();
- bool u3 = getUndefined();
- List u4 = getUndefined();
-
- expect(n == n, true);
-
- expect(n == u1, true);
- expect(n == u2, true);
- expect(n == u3, true);
- expect(n == u4, true);
-
- expect(u1 == n, true);
- expect(u2 == n, true);
- expect(u3 == n, true);
- expect(u4 == n, true);
- });
-
- // Test equality of null int and other types
- test('Equal int/other (static, null)', () {
- BluesBrother u1 = getUndefined();
- String u2 = getUndefined();
- int n = hideNull(null);
- bool u3 = getUndefined();
- List u4 = getUndefined();
-
- expect(n == n, true);
-
- expect(n == u1, true);
- expect(n == u2, true);
- expect(n == u3, true);
- expect(n == u4, true);
-
- expect(u1 == n, true);
- expect(u2 == n, true);
- expect(u3 == n, true);
- expect(u4 == n, true);
- });
-
- // Test equality of null bool and other types
- test('Equal bool/other (static, null)', () {
- BluesBrother u1 = getUndefined();
- String u2 = getUndefined();
- int u3 = getUndefined();
- bool n = hideNull(null);
- List u4 = getUndefined();
-
- expect(n == n, true);
-
- expect(n == u1, true);
- expect(n == u2, true);
- expect(n == u3, true);
- expect(n == u4, true);
-
- expect(u1 == n, true);
- expect(u2 == n, true);
- expect(u3 == n, true);
- expect(u4 == n, true);
- });
-
- // Test equality of null List and other types
- test('Equal List/other (static, null)', () {
- BluesBrother u1 = getUndefined();
- String u2 = getUndefined();
- int u3 = getUndefined();
- bool u4 = getUndefined();
- List n = hideNull(null);
-
- expect(n == n, true);
-
- expect(n == u1, true);
- expect(n == u2, true);
- expect(n == u3, true);
- expect(n == u4, true);
-
- expect(u1 == n, true);
- expect(u2 == n, true);
- expect(u3 == n, true);
- expect(u4 == n, true);
- });
- });
-}
diff --git a/pkg/dev_compiler/test/codegen/es6_modules.dart b/pkg/dev_compiler/test/codegen/es6_modules.dart
deleted file mode 100644
index 10472b7..0000000
--- a/pkg/dev_compiler/test/codegen/es6_modules.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// compile options: --modules=es6
-library test;
-
-typedef void Callback({int i});
-
-class A {}
-
-class _A {}
-
-class B<T> {}
-
-class _B<T> {}
-
-f() {}
-_f() {}
-
-const String constant = "abc";
-final String finalConstant = "abc";
-final String lazy = (() {
- print('lazy');
- return "abc";
-})();
-String mutable = "abc";
-String lazyMutable = (() {
- print('lazyMutable');
- return "abc";
-})();
diff --git a/pkg/dev_compiler/test/codegen/identity_test.dart b/pkg/dev_compiler/test/codegen/identity_test.dart
deleted file mode 100644
index 3ca0dad..0000000
--- a/pkg/dev_compiler/test/codegen/identity_test.dart
+++ /dev/null
@@ -1,1279 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:expect/minitest.dart';
-
-/// Both kinds.
-enum Music { country, western }
-
-class BluesBrother {}
-
-// This class does not override object equality
-class _Jake extends BluesBrother {}
-
-/// This class overrides object equality
-class _Elwood extends BluesBrother {
- bool operator ==(Object other) {
- return (other is _Elwood);
- }
-}
-
-/// Mock BluesBrother
-class _Norman extends BluesBrother {}
-
-/// Hide nullability from the simple minded null analysis
-T hideNull<T>(T x) => x;
-
-/// Generate undefined at a type
-T getUndefined<T>() => (List(1))[0];
-
-main() {
- group('Enum identity', () {
- // Test identity of two enums, various types, nullable
- test('Identical enum/enum (nullable)', () {
- Music e1 = hideNull(Music.country);
- Music e2 = hideNull(Music.western);
- dynamic d1 = hideNull(Music.country);
- dynamic d2 = hideNull(Music.western);
- Object o1 = hideNull(Music.country);
- Object o2 = hideNull(Music.western);
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of two enums, various types, non-nullable
- test('Identical enum/enum (non-null)', () {
- Music e1 = Music.country;
- Music e2 = Music.western;
- dynamic d1 = Music.country;
- dynamic d2 = Music.western;
- Object o1 = Music.country;
- Object o2 = Music.western;
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of enum and other types (static, nullable)
- test('Identical enum/other (static, nullable)', () {
- Music e1 = hideNull(Music.country);
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of enum and other types (static, non-null)
- test('Identical enum/other (static, non-null)', () {
- Music e1 = Music.country;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of enum and other types (dynamic, nullable)
- test('Identical enum/other (dynamic, nullable)', () {
- Music e1 = hideNull(Music.country);
- dynamic d1 = hideNull(Music.country);
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
-
- // Test identity of enum and other types (dynamic, non-null)
- test('Identical enum/other (dynamic, non-null)', () {
- Music e1 = Music.country;
- dynamic d1 = Music.country;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
- });
-
- group('String identity', () {
- // Test identity of two strings, various types, nullable
- test('Identical string/string (nullable)', () {
- String e1 = hideNull("The");
- String e2 = hideNull("Band");
- dynamic d1 = hideNull("The");
- dynamic d2 = hideNull("Band");
- Object o1 = hideNull("The");
- Object o2 = hideNull("Band");
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of two strings, various types, non-nullable
- test('Identical string/string (non-null)', () {
- String e1 = "The";
- String e2 = "Band";
- dynamic d1 = "The";
- dynamic d2 = "Band";
- Object o1 = "The";
- Object o2 = "Band";
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of string and other types (static, nullable)
- test('Identical string/other (static, nullable)', () {
- String e1 = hideNull("The");
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of string and other types (static, non-null)
- test('Identical string/other (static, non-null)', () {
- String e1 = "The";
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of string and other types (dynamic, nullable)
- test('Identical string/other (dynamic, nullable)', () {
- String e1 = hideNull("The");
- dynamic d1 = hideNull("The");
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
-
- // Test identity of string and other types (dynamic, non-null)
- test('Identical string/other (dynamic, non-null)', () {
- String e1 = "The";
- dynamic d1 = "The";
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
- });
-
- group('Boolean identity', () {
- // Test identity of two bools, various types, nullable
- test('Identical bool/bool (nullable)', () {
- bool e1 = hideNull(true);
- bool e2 = hideNull(false);
- dynamic d1 = hideNull(true);
- dynamic d2 = hideNull(false);
- Object o1 = hideNull(true);
- Object o2 = hideNull(false);
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of two bools, various types, non-nullable
- test('Identical bool/bool (non-null)', () {
- bool e1 = true;
- bool e2 = false;
- dynamic d1 = true;
- dynamic d2 = false;
- Object o1 = true;
- Object o2 = false;
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of bool and other types (static, nullable)
- test('Identical bool/other (static, nullable)', () {
- bool e1 = hideNull(true);
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of bool and other types (static, non-null)
- test('Identical bool/other (static, non-null)', () {
- bool e1 = true;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of bool and other types (dynamic, nullable)
- test('Identical bool/other (dynamic, nullable)', () {
- bool e1 = hideNull(true);
- dynamic d1 = hideNull(true);
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
-
- // Test identity of bool and other types (dynamic, non-null)
- test('Identical bool/other (dynamic, non-null)', () {
- bool e1 = true;
- dynamic d1 = true;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
- });
-
- group('String identity', () {
- // Test identity of two strings, various types, nullable
- test('Identical string/string (nullable)', () {
- String e1 = hideNull("The");
- String e2 = hideNull("Band");
- dynamic d1 = hideNull("The");
- dynamic d2 = hideNull("Band");
- Object o1 = hideNull("The");
- Object o2 = hideNull("Band");
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of two strings, various types, non-nullable
- test('Identical string/string (non-null)', () {
- String e1 = "The";
- String e2 = "Band";
- dynamic d1 = "The";
- dynamic d2 = "Band";
- Object o1 = "The";
- Object o2 = "Band";
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of string and other types (static, nullable)
- test('Identical string/other (static, nullable)', () {
- String e1 = hideNull("The");
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of string and other types (static, non-null)
- test('Identical string/other (static, non-null)', () {
- String e1 = "The";
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of string and other types (dynamic, nullable)
- test('Identical string/other (dynamic, nullable)', () {
- String e1 = hideNull("The");
- dynamic d1 = hideNull("The");
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
-
- // Test identity of string and other types (dynamic, non-null)
- test('Identical string/other (dynamic, non-null)', () {
- String e1 = "The";
- dynamic d1 = "The";
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
- });
-
- group('Number identity', () {
- // Test identity of two ints, various types, nullable
- test('Identical int/int (nullable)', () {
- int e1 = hideNull(11);
- int e2 = hideNull(12);
- dynamic d1 = hideNull(11);
- dynamic d2 = hideNull(12);
- Object o1 = hideNull(11);
- Object o2 = hideNull(12);
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of two ints, various types, non-nullable
- test('Identical int/int (non-null)', () {
- int e1 = 11;
- int e2 = 12;
- dynamic d1 = 11;
- dynamic d2 = 12;
- Object o1 = 11;
- Object o2 = 12;
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of int and other types (static, nullable)
- test('Identical int/other (static, nullable)', () {
- int e1 = hideNull(11);
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of int and other types (static, non-null)
- test('Identical int/other (static, non-null)', () {
- int e1 = 11;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of int and other types (dynamic, nullable)
- test('Identical int/other (dynamic, nullable)', () {
- int e1 = hideNull(11);
- dynamic d1 = hideNull(11);
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
-
- // Test identity of int and other types (dynamic, non-null)
- test('Identical int/other (dynamic, non-null)', () {
- int e1 = 11;
- dynamic d1 = 11;
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
- });
-
- group('Object identity', () {
- // Test identity of two objects, various types, nullable
- test('Identical object/object (nullable)', () {
- _Jake e1 = hideNull(_Jake());
- _Elwood e2 = hideNull(_Elwood());
- dynamic d1 = hideNull(e1);
- dynamic d2 = hideNull(_Elwood());
- Object o1 = hideNull(e1);
- Object o2 = hideNull(_Elwood());
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of two objects, various types, non-nullable
- test('Identical object/object (non-null)', () {
- _Jake e1 = _Jake();
- _Elwood e2 = _Elwood();
- dynamic d1 = e1;
- dynamic d2 = _Elwood();
- Object o1 = e1;
- Object o2 = _Elwood();
- expect(identical(e1, e1), true);
- expect(identical(e1, d1), true);
- expect(identical(e1, o1), true);
- expect(identical(e1, e2), false);
- expect(identical(e1, o2), false);
- expect(identical(e1, d2), false);
- expect(identical(e1, e2), false);
- expect(identical(d1, e1), true);
- expect(identical(d1, d1), true);
- expect(identical(d1, o1), true);
- expect(identical(d1, e2), false);
- expect(identical(d1, d2), false);
- expect(identical(d1, o2), false);
- expect(identical(o1, e1), true);
- expect(identical(o1, d1), true);
- expect(identical(o1, o1), true);
- expect(identical(o1, e2), false);
- expect(identical(o1, d2), false);
- expect(identical(o1, o2), false);
- });
-
- // Test identity of object and other types (static, nullable)
- test('Identical object/other (static, nullable)', () {
- _Jake e1 = hideNull(_Jake());
- String s1 = hideNull("hello");
- String s2 = hideNull("");
- int i1 = hideNull(3);
- int i2 = hideNull(0);
- List l1 = hideNull(List(3));
- BluesBrother b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of object and other types (static, non-null)
- test('Identical object/other (static, non-null)', () {
- _Jake e1 = _Jake();
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
- });
-
- // Test identity of object and other types (dynamic, nullable)
- test('Identical object/other (dynamic, nullable)', () {
- _Jake e1 = hideNull(_Jake());
- dynamic d1 = hideNull(_Jake());
- dynamic s1 = hideNull("hello");
- dynamic s2 = hideNull("");
- dynamic i1 = hideNull(3);
- dynamic i2 = hideNull(0);
- dynamic l1 = hideNull(List(3));
- dynamic b1 = hideNull(_Norman());
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
-
- // Test identity of object and other types (dynamic, non-null)
- test('Identical object/other (dynamic, non-null)', () {
- _Jake e1 = _Jake();
- dynamic d1 = _Jake();
- String s1 = "hello";
- String s2 = "";
- int i1 = 3;
- int i2 = 0;
- List l1 = List(3);
- BluesBrother b1 = _Norman();
-
- expect(identical(e1, s1), false);
- expect(identical(e1, s2), false);
- expect(identical(e1, i1), false);
- expect(identical(e1, i2), false);
- expect(identical(e1, l1), false);
- expect(identical(e1, b1), false);
-
- expect(identical(s1, e1), false);
- expect(identical(s2, e1), false);
- expect(identical(i1, e1), false);
- expect(identical(i2, e1), false);
- expect(identical(l1, e1), false);
- expect(identical(b1, e1), false);
-
- expect(identical(d1, s1), false);
- expect(identical(d1, s2), false);
- expect(identical(d1, i1), false);
- expect(identical(d1, i2), false);
- expect(identical(d1, l1), false);
- expect(identical(d1, b1), false);
-
- expect(identical(s1, d1), false);
- expect(identical(s2, d1), false);
- expect(identical(i1, d1), false);
- expect(identical(i2, d1), false);
- expect(identical(l1, d1), false);
- expect(identical(b1, d1), false);
- });
- });
-
- // Test that null receiver with undefined argument is handled correctly
- group('Null/undefined identity', () {
- // Test identity of null object and other types
- test('Identical object/other (static, null)', () {
- BluesBrother n = hideNull(null);
- String u1 = getUndefined();
- int u2 = getUndefined();
- bool u3 = getUndefined();
- List u4 = getUndefined();
-
- expect(identical(n, n), true);
-
- expect(identical(n, u1), true);
- expect(identical(n, u2), true);
- expect(identical(n, u3), true);
- expect(identical(n, u4), true);
-
- expect(identical(u1, n), true);
- expect(identical(u2, n), true);
- expect(identical(u3, n), true);
- expect(identical(u4, n), true);
- });
-
- // Test identity of null string and other types
- test('Identical String/other (static, null)', () {
- BluesBrother u1 = getUndefined();
- String n = hideNull(null);
- int u2 = getUndefined();
- bool u3 = getUndefined();
- List u4 = getUndefined();
-
- expect(identical(n, n), true);
-
- expect(identical(n, u1), true);
- expect(identical(n, u2), true);
- expect(identical(n, u3), true);
- expect(identical(n, u4), true);
-
- expect(identical(u1, n), true);
- expect(identical(u2, n), true);
- expect(identical(u3, n), true);
- expect(identical(u4, n), true);
- });
-
- // Test identity of null int and other types
- test('Identical int/other (static, null)', () {
- BluesBrother u1 = getUndefined();
- String u2 = getUndefined();
- int n = hideNull(null);
- bool u3 = getUndefined();
- List u4 = getUndefined();
-
- expect(identical(n, n), true);
-
- expect(identical(n, u1), true);
- expect(identical(n, u2), true);
- expect(identical(n, u3), true);
- expect(identical(n, u4), true);
-
- expect(identical(u1, n), true);
- expect(identical(u2, n), true);
- expect(identical(u3, n), true);
- expect(identical(u4, n), true);
- });
-
- // Test identity of null bool and other types
- test('Identical bool/other (static, null)', () {
- BluesBrother u1 = getUndefined();
- String u2 = getUndefined();
- int u3 = getUndefined();
- bool n = hideNull(null);
- List u4 = getUndefined();
-
- expect(identical(n, n), true);
-
- expect(identical(n, u1), true);
- expect(identical(n, u2), true);
- expect(identical(n, u3), true);
- expect(identical(n, u4), true);
-
- expect(identical(u1, n), true);
- expect(identical(u2, n), true);
- expect(identical(u3, n), true);
- expect(identical(u4, n), true);
- });
-
- // Test identity of null List and other types
- test('Identical List/other (static, null)', () {
- BluesBrother u1 = getUndefined();
- String u2 = getUndefined();
- int u3 = getUndefined();
- bool u4 = getUndefined();
- List n = hideNull(null);
-
- expect(identical(n, n), true);
-
- expect(identical(n, u1), true);
- expect(identical(n, u2), true);
- expect(identical(n, u3), true);
- expect(identical(n, u4), true);
-
- expect(identical(u1, n), true);
- expect(identical(u2, n), true);
- expect(identical(u3, n), true);
- expect(identical(u4, n), true);
- });
- });
-}
diff --git a/pkg/dev_compiler/test/codegen/map_keys.dart b/pkg/dev_compiler/test/codegen/map_keys.dart
deleted file mode 100644
index 0bb6e00..0000000
--- a/pkg/dev_compiler/test/codegen/map_keys.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-// compile options: --source-map
-// TODO(jmesserly): more comprehensive strategy for testing the source map.
-// (this is used so we're covering it in at least one test)
-
-import 'dart:math' show Random;
-
-main() {
- // Uses a JS object literal
- print({'1': 2, '3': 4, '5': 6});
- // Uses array literal
- print({1: 2, 3: 4, 5: 6});
- // Uses ES6 enhanced object literal
- print({'1': 2, '${new Random().nextInt(2) + 2}': 4, '5': 6});
- String x = '3';
- // Could use enhanced object literal if we knew `x` was not null
- print({'1': 2, x: 4, '5': 6});
- // Array literal
- print({'1': 2, null: 4, '5': 6});
-}
diff --git a/pkg/dev_compiler/test/codegen/node_modules.dart b/pkg/dev_compiler/test/codegen/node_modules.dart
deleted file mode 100644
index dad8613..0000000
--- a/pkg/dev_compiler/test/codegen/node_modules.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// compile options: --modules=node
-library test;
-
-import 'dart:js';
-
-typedef void Callback({int i});
-
-class A {}
-
-class _A {}
-
-class B<T> {}
-
-class _B<T> {}
-
-f() {}
-_f() {}
-
-const String constant = "abc";
-final String finalConstant = "abc";
-final String lazy = (() {
- print('lazy');
- return "abc";
-})();
-String mutable = "abc";
-String lazyMutable = (() {
- print('lazyMutable');
- return "abc";
-})();
diff --git a/pkg/dev_compiler/test/codegen/script.dart b/pkg/dev_compiler/test/codegen/script.dart
deleted file mode 100755
index c84e012..0000000
--- a/pkg/dev_compiler/test/codegen/script.dart
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env dart
-
-void main(List<String> args) {
- String name = args.join(' ');
- if (name == '') name = 'world';
- print('hello $name');
-}
diff --git a/pkg/dev_compiler/test/codegen/single_test.html b/pkg/dev_compiler/test/codegen/single_test.html
deleted file mode 100644
index e69de29..0000000
--- a/pkg/dev_compiler/test/codegen/single_test.html
+++ /dev/null
diff --git a/pkg/dev_compiler/test/codegen/sunflower/README.md b/pkg/dev_compiler/test/codegen/sunflower/README.md
deleted file mode 100644
index f4fc604..0000000
--- a/pkg/dev_compiler/test/codegen/sunflower/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-This is a copy of https://github.com/dart-lang/sample-sunflower, with minor
-changes to make it compile against "raw DOM" APIs.
-
-The main sunflower.dart file is used as a regression test. You can find it at
-../codegen/sunflower.dart with expected code under ../codegen/expect/sunflower/,
-and the output is at ../codegen/expect/sunflower/sunflower.dart.js.
diff --git a/pkg/dev_compiler/test/codegen/sunflower/circle.dart b/pkg/dev_compiler/test/codegen/sunflower/circle.dart
deleted file mode 100644
index adf4799..0000000
--- a/pkg/dev_compiler/test/codegen/sunflower/circle.dart
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library circle;
-
-class Circle {
- final num x, y, radius;
-
- Circle(this.x, this.y, this.radius);
-}
diff --git a/pkg/dev_compiler/test/codegen/sunflower/math.png b/pkg/dev_compiler/test/codegen/sunflower/math.png
deleted file mode 100644
index 86d881a..0000000
--- a/pkg/dev_compiler/test/codegen/sunflower/math.png
+++ /dev/null
Binary files differ
diff --git a/pkg/dev_compiler/test/codegen/sunflower/painter.dart b/pkg/dev_compiler/test/codegen/sunflower/painter.dart
deleted file mode 100644
index 3488c16..0000000
--- a/pkg/dev_compiler/test/codegen/sunflower/painter.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library painter;
-
-import 'dart:html';
-import 'dart:math';
-
-import 'circle.dart';
-
-const ORANGE = "orange";
-const RED = "red";
-const BLUE = "blue";
-const TAU = PI * 2;
-
-Element querySelector(String selector) => document.querySelector(selector);
-
-final canvas = querySelector("#canvas") as CanvasElement;
-final context = canvas.getContext('2d') as CanvasRenderingContext2D;
-
-abstract class CirclePainter implements Circle {
- // This demonstrates a field in a mixin.
- String color = ORANGE;
-
- /// Draw a small circle representing a seed centered at (x,y).
- void draw(CanvasRenderingContext2D context) {
- context
- ..beginPath()
- ..lineWidth = 2
- ..fillStyle = color
- ..strokeStyle = color
- ..arc(x, y, radius, 0, TAU, false)
- ..fill()
- ..closePath()
- ..stroke();
- }
-}
diff --git a/pkg/dev_compiler/test/codegen/sunflower/sunflower.css b/pkg/dev_compiler/test/codegen/sunflower/sunflower.css
deleted file mode 100644
index b46afb7..0000000
--- a/pkg/dev_compiler/test/codegen/sunflower/sunflower.css
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file */
-/* for details. All rights reserved. Use of this source code is governed by a */
-/* BSD-style license that can be found in the LICENSE file. */
-
-body {
- background-color: #F8F8F8;
- font-family: 'Open Sans', sans-serif;
- font-size: 14px;
- font-weight: normal;
- line-height: 1.2em;
- margin: 15px;
-}
-
-p {
- color: #333;
-}
-
-#container {
- width: 100%;
- height: 400px;
- position: relative;
- border: 1px solid #ccc;
- background-color: #fff;
-}
-
-#summary {
- float: left;
-}
-
-#notes {
- float: right;
- width: 120px;
- text-align: right;
-}
-
-.error {
- font-style: italic;
- color: red;
-}
-
-img {
- border: 1px solid #ccc;
- margin: auto;
-}
-
-.center {
- display: block;
- margin: 0px auto;
- text-align: center;
-}
diff --git a/pkg/dev_compiler/test/codegen/sunflower/sunflower.dart b/pkg/dev_compiler/test/codegen/sunflower/sunflower.dart
deleted file mode 100644
index 42b2417..0000000
--- a/pkg/dev_compiler/test/codegen/sunflower/sunflower.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library sunflower;
-
-import 'dart:html';
-import 'dart:math';
-
-import 'circle.dart';
-import 'painter.dart';
-
-const SEED_RADIUS = 2;
-const SCALE_FACTOR = 4;
-const MAX_D = 300;
-const centerX = MAX_D / 2;
-const centerY = centerX;
-
-Element querySelector(String selector) => document.querySelector(selector);
-final canvas = querySelector("#canvas") as CanvasElement;
-final context = canvas.getContext('2d') as CanvasRenderingContext2D;
-final slider = querySelector("#slider") as InputElement;
-final notes = querySelector("#notes");
-
-final PHI = (sqrt(5) + 1) / 2;
-int seeds = 0;
-
-void main() {
- slider.addEventListener('change', (e) => draw());
- draw();
-}
-
-/// Draw the complete figure for the current number of seeds.
-void draw() {
- seeds = int.parse(slider.value);
- context.clearRect(0, 0, MAX_D, MAX_D);
- for (var i = 0; i < seeds; i++) {
- final theta = i * TAU / PHI;
- final r = sqrt(i) * SCALE_FACTOR;
- final x = centerX + r * cos(theta);
- final y = centerY - r * sin(theta);
- SunflowerSeed(x, y, SEED_RADIUS).draw(context);
- }
- notes.text = "$seeds seeds";
-}
-
-// This example was modified to use classes and mixins.
-class SunflowerSeed extends Circle with CirclePainter {
- SunflowerSeed(num x, num y, num radius, [String color])
- : super(x, y, radius) {
- if (color != null) this.color = color;
- }
-}
diff --git a/pkg/dev_compiler/test/codegen/sunflower/sunflower.html b/pkg/dev_compiler/test/codegen/sunflower/sunflower.html
deleted file mode 100644
index 921d999..0000000
--- a/pkg/dev_compiler/test/codegen/sunflower/sunflower.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-
-<!-- Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
- for details. All rights reserved. Use of this source code is governed by a
- BSD-style license that can be found in the LICENSE file. -->
-
-<html>
- <head>
- <meta charset="utf-8">
- <title>Sunflower Demo</title>
- <link type="text/css" rel="stylesheet" href="sunflower.css">
- </head>
- <body>
- <h1>drfibonacci's Sunflower Spectacular</h1>
- <p>A canvas 2D demo.</p>
-
- <div id="container">
- <canvas id="canvas" width="300" height="300" class="center"></canvas>
- <form class="center">
- <input id="slider" type="range" max="1000" value="500"/>
- </form>
- <br/>
- <img src="math.png" width="350px" height="42px" class="center">
- </div>
-
- <footer>
- <p id="summary"> </p>
- <p id="notes"> </p>
- </footer>
-
-<!--
- <script type="application/dart" src="sunflower.dart"></script>
--->
- <script src="../../../node_modules/requirejs/require.js"></script>
- <script>
- require.config({
- paths: {
- dart_sdk: "../../../lib/js/amd/dart_sdk",
- js: "../../../gen/codegen_output/pkg/js",
- }
- });
- require(["../../../gen/codegen_output/sunflower/sunflower"],
- (sunflower) => {
- sunflower.sunflower.main();
- });
- </script>
- </body>
-</html>
diff --git a/pkg/dev_compiler/test/codegen/unresolved_names.dart b/pkg/dev_compiler/test/codegen/unresolved_names.dart
deleted file mode 100644
index 2a14b21..0000000
--- a/pkg/dev_compiler/test/codegen/unresolved_names.dart
+++ /dev/null
@@ -1,10 +0,0 @@
-// compile options: --unsafe-force-compile
-
-class C {}
-
-main() {
- Foo();
- C.bar();
- print(baz);
- print(C.quux);
-}
diff --git a/pkg/dev_compiler/test/codegen/varargs.dart b/pkg/dev_compiler/test/codegen/varargs.dart
deleted file mode 100644
index f97ac58..0000000
--- a/pkg/dev_compiler/test/codegen/varargs.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-import 'package:js/src/varargs.dart' as js;
-import 'package:js/src/varargs.dart' show rest, spread;
-
-varargsTest(x, @js.rest others) {
- var args = [1, others];
- x.call(js.spread(args));
-}
-
-varargsTest2(x, @rest others) {
- var args = [1, others];
- x.call(spread(args));
-}
diff --git a/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js b/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js
deleted file mode 100644
index 99f2eda..0000000
--- a/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js
+++ /dev/null
@@ -1,114 +0,0 @@
-define(['dart_sdk'], function(dart_sdk) {
- 'use strict';
- const core = dart_sdk.core;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const _root = Object.create(null);
- const BenchmarkBase$ = Object.create(_root);
- const $length = dartx.length;
- const $_get = dartx._get;
- let VoidToNull = () => (VoidToNull = dart.constFn(dart.fnType(core.Null, [])))();
- BenchmarkBase$.Expect = class Expect extends core.Object {
- static equals(expected, actual) {
- if (!dart.equals(expected, actual)) {
- dart.throw(dart.str`Values not equal: ${expected} vs ${actual}`);
- }
- }
- static listEquals(expected, actual) {
- if (expected[$length] != actual[$length]) {
- dart.throw(dart.str`Lists have different lengths: ${expected[$length]} vs ${actual[$length]}`);
- }
- for (let i = 0; i < dart.notNull(actual[$length]); i++) {
- BenchmarkBase$.Expect.equals(expected[$_get](i), actual[$_get](i));
- }
- }
- fail(message) {
- dart.throw(message);
- }
- };
- (BenchmarkBase$.Expect.new = function() {
- }).prototype = BenchmarkBase$.Expect.prototype;
- dart.addTypeTests(BenchmarkBase$.Expect);
- dart.setMethodSignature(BenchmarkBase$.Expect, () => ({
- __proto__: dart.getMethods(BenchmarkBase$.Expect.__proto__),
- fail: dart.fnType(dart.dynamic, [dart.dynamic])
- }));
- dart.setStaticMethodSignature(BenchmarkBase$.Expect, () => ({
- equals: dart.fnType(dart.void, [dart.dynamic, dart.dynamic]),
- listEquals: dart.fnType(dart.void, [core.List, core.List])
- }));
- BenchmarkBase$.BenchmarkBase = class BenchmarkBase extends core.Object {
- get name() {
- return this[name$];
- }
- set name(value) {
- super.name = value;
- }
- run() {}
- warmup() {
- this.run();
- }
- exercise() {
- for (let i = 0; i < 10; i++) {
- this.run();
- }
- }
- setup() {}
- teardown() {}
- static measureFor(f, timeMinimum) {
- let time = 0;
- let iter = 0;
- let watch = new core.Stopwatch.new();
- watch.start();
- let elapsed = 0;
- while (dart.notNull(elapsed) < dart.notNull(timeMinimum)) {
- dart.dcall(f);
- elapsed = watch.elapsedMilliseconds;
- iter++;
- }
- return 1000.0 * dart.notNull(elapsed) / iter;
- }
- measure() {
- this.setup();
- BenchmarkBase$.BenchmarkBase.measureFor(dart.fn(() => {
- this.warmup();
- }, VoidToNull()), 100);
- let result = BenchmarkBase$.BenchmarkBase.measureFor(dart.fn(() => {
- this.exercise();
- }, VoidToNull()), 2000);
- this.teardown();
- return result;
- }
- report() {
- let score = this.measure();
- core.print(dart.str`${this.name}(RunTime): ${score} us.`);
- }
- };
- (BenchmarkBase$.BenchmarkBase.new = function(name) {
- this[name$] = name;
- }).prototype = BenchmarkBase$.BenchmarkBase.prototype;
- dart.addTypeTests(BenchmarkBase$.BenchmarkBase);
- const name$ = Symbol("BenchmarkBase.name");
- dart.setMethodSignature(BenchmarkBase$.BenchmarkBase, () => ({
- __proto__: dart.getMethods(BenchmarkBase$.BenchmarkBase.__proto__),
- run: dart.fnType(dart.void, []),
- warmup: dart.fnType(dart.void, []),
- exercise: dart.fnType(dart.void, []),
- setup: dart.fnType(dart.void, []),
- teardown: dart.fnType(dart.void, []),
- measure: dart.fnType(core.double, []),
- report: dart.fnType(dart.void, [])
- }));
- dart.setStaticMethodSignature(BenchmarkBase$.BenchmarkBase, () => ({measureFor: dart.fnType(core.double, [core.Function, core.int])}));
- dart.setFieldSignature(BenchmarkBase$.BenchmarkBase, () => ({
- __proto__: dart.getFields(BenchmarkBase$.BenchmarkBase.__proto__),
- name: dart.finalFieldType(core.String)
- }));
- dart.trackLibraries("BenchmarkBase", {
- "BenchmarkBase.dart": BenchmarkBase$
- }, null);
- // Exports:
- return {
- BenchmarkBase: BenchmarkBase$
- };
-});
diff --git a/pkg/dev_compiler/test/codegen_expected/closure.js b/pkg/dev_compiler/test/codegen_expected/closure.js
deleted file mode 100644
index 0745261..0000000
--- a/pkg/dev_compiler/test/codegen_expected/closure.js
+++ /dev/null
@@ -1,174 +0,0 @@
-const _root = Object.create(null);
-export const closure = Object.create(_root);
-import { core, js, dart, dartx } from 'dart_sdk';
-const $toList = dartx.toList;
-const $map = dartx.map;
-let dynamic__Toint = () => (dynamic__Toint = dart.constFn(dart.fnTypeFuzzy(core.int, [dart.dynamic], [dart.dynamic])))();
-let dynamic__Todynamic = () => (dynamic__Todynamic = dart.constFn(dart.fnTypeFuzzy(dart.dynamic, [dart.dynamic], {y: core.String, z: dart.dynamic})))();
-let __Tovoid = () => (__Tovoid = dart.constFn(dart.fnTypeFuzzy(dart.void, [], {i: core.int})))();
-let StringToList = () => (StringToList = dart.constFn(dart.fnTypeFuzzy(core.List, [core.String])))();
-let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))();
-let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.fnTypeFuzzy(dart.dynamic, [dart.dynamic])))();
-let FnToListOfint = () => (FnToListOfint = dart.constFn(dart.fnTypeFuzzy(ListOfint(), [dynamicTodynamic()])))();
-let MapOfMap$Map = () => (MapOfMap$Map = dart.constFn(core.Map$(core.Map, core.Map)))();
-let Foo = () => (Foo = dart.constFn(closure.Foo$()))();
-let ListOfTAndTToListOfT = () => (ListOfTAndTToListOfT = dart.constFn(dart.gFnType(T => [core.List$(T), [core.List$(T), T]])))();
-let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.fnType(dart.void, [dart.dynamic])))();
-let VoidToNull = () => (VoidToNull = dart.constFn(dart.fnType(core.Null, [])))();
-closure.generic_function = function<T>(T, items: core.List<T> = null, seed: T = null): core.List<T> {
- let strings = items[$map](core.String, dart.fn((i: T = null): string => dart.str`${i}`, dart.fnType(core.String, [T])))[$toList]();
- return items;
-};
-dart.fn(closure.generic_function, ListOfTAndTToListOfT());
-closure.Callback = dart.typedef('Callback', () => dart.fnTypeFuzzy(dart.void, [], {i: core.int}));
-const _is_Foo_default = Symbol('_is_Foo_default');
-closure.Foo$ = dart.generic(T => {
- let FooOfT = () => (FooOfT = dart.constFn(closure.Foo$(T)))();
- class Foo<T> extends core.Object {
- i: number;
- b: boolean;
- s: string;
- v: T;
- static some_static_constant: string;
- static some_static_final: string;
- static some_static_var: string;
- prop: string;
- static staticProp: string;
- get i() {
- return this[i$];
- }
- set i(value) {
- super.i = value;
- }
- get b() {
- return this[b];
- }
- set b(value) {
- this[b] = value;
- }
- get s() {
- return this[s];
- }
- set s(value) {
- this[s] = value;
- }
- get v() {
- return this[v$];
- }
- set v(value) {
- this[v$] = T._check(value);
- }
- static build() {
- return new (FooOfT()).new(1, null);
- }
- untyped_method(a = null, b = null) {}
- pass(t: T = null) {
- T._check(t);
- return t;
- }
- typed_method(foo: closure.Foo<any> = null, list: core.List<any> = null, i: number = null, n: number = null, d: number = null, b: boolean = null, s: string = null, a: any[] = null, o: Object = null, f: Function = null) {
- return '';
- }
- optional_params(a = null, b = null, c: number = null) {}
- static named_params(a = null, {b = null, c = null}: {b?: any, c?: number} = {}) {}
- nullary_method() {}
- function_params(f: (x: any, y?: any) => number = null, g: (x: any, opts?: {y?: string, z?: any}) => any = null, cb: (opts?: {i?: number}) => void = null) {
- cb({i: this.i});
- }
- run(a: core.List<any> = null, b: string = null, c: (d: string) => core.List<any> = null, e: (f: (g: any) => any) => core.List<number> = null, {h = null}: {h?: core.Map<core.Map<any, any>, core.Map<any, any>>} = {}) {}
- get prop() {
- return null;
- }
- set prop(value: string = null) {}
- static get staticProp() {
- return null;
- }
- static set staticProp(value: string = null) {}
- }
- (Foo.new = function(i: number = null, v: T = null) {
- this[i$] = i;
- this[v$] = v;
- this[b] = null;
- this[s] = null;
- }).prototype = Foo.prototype;
- dart.addTypeTests(Foo);
- Foo.prototype[_is_Foo_default] = true;
- const i$ = Symbol("Foo.i");
- const b = Symbol("Foo.b");
- const s = Symbol("Foo.s");
- const v$ = Symbol("Foo.v");
- dart.setMethodSignature(Foo, () => ({
- __proto__: dart.getMethods(Foo.__proto__),
- untyped_method: dart.fnType(dart.dynamic, [dart.dynamic, dart.dynamic]),
- pass: dart.fnType(T, [core.Object]),
- typed_method: dart.fnType(core.String, [closure.Foo, core.List, core.int, core.num, core.double, core.bool, core.String, js.JsArray, js.JsObject, js.JsFunction]),
- optional_params: dart.fnType(dart.dynamic, [dart.dynamic], [dart.dynamic, core.int]),
- nullary_method: dart.fnType(dart.dynamic, []),
- function_params: dart.fnType(dart.dynamic, [dynamic__Toint(), dynamic__Todynamic(), __Tovoid()]),
- run: dart.fnType(dart.dynamic, [core.List, core.String, StringToList(), FnToListOfint()], {h: MapOfMap$Map()})
- }));
- dart.setStaticMethodSignature(Foo, () => ({named_params: dart.fnType(dart.dynamic, [dart.dynamic], {b: dart.dynamic, c: core.int})}));
- dart.setGetterSignature(Foo, () => ({
- __proto__: dart.getGetters(Foo.__proto__),
- prop: dart.fnType(core.String, [])
- }));
- dart.setSetterSignature(Foo, () => ({
- __proto__: dart.getSetters(Foo.__proto__),
- prop: dart.fnType(dart.void, [core.String])
- }));
- dart.setFieldSignature(Foo, () => ({
- __proto__: dart.getFields(Foo.__proto__),
- i: dart.finalFieldType(core.int),
- b: dart.fieldType(core.bool),
- s: dart.fieldType(core.String),
- v: dart.fieldType(T)
- }));
- return Foo;
-});
-closure.Foo = Foo();
-dart.defineLazy(closure.Foo, {
- get some_static_constant() {
- return "abc";
- },
- get some_static_final() {
- return "abc";
- },
- get some_static_var() {
- return "abc";
- },
- set some_static_var(_) {}
-});
-dart.addTypeTests(closure.Foo, _is_Foo_default);
-closure.Bar = class Bar extends core.Object {};
-(closure.Bar.new = function() {
-}).prototype = closure.Bar.prototype;
-dart.addTypeTests(closure.Bar);
-closure.Baz = class Baz extends dart.mixin(closure.Foo$(core.int), closure.Bar) {};
-(closure.Baz.new = function(i: number = null) {
- closure.Baz.__proto__.new.call(this, i, 123);
-}).prototype = closure.Baz.prototype;
-dart.addTypeTests(closure.Baz);
-closure.main = function(args = null): void {
-};
-dart.fn(closure.main, dynamicTovoid());
-dart.defineLazy(closure, {
- get closure() {
- return dart.fn((): core.Null => {
- return;
- }, VoidToNull());
- },
- set closure(_) {},
- get some_top_level_constant() {
- return "abc";
- },
- get some_top_level_final() {
- return "abc";
- },
- get some_top_level_var() {
- return "abc";
- },
- set some_top_level_var(_) {}
-});
-dart.trackLibraries("closure", {
- "closure.dart": closure
-}, null);
diff --git a/pkg/dev_compiler/test/codegen_expected/destructuring.js b/pkg/dev_compiler/test/codegen_expected/destructuring.js
deleted file mode 100644
index c8525ad..0000000
--- a/pkg/dev_compiler/test/codegen_expected/destructuring.js
+++ /dev/null
@@ -1,97 +0,0 @@
-define(['dart_sdk'], function(dart_sdk) {
- 'use strict';
- const core = dart_sdk.core;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const _root = Object.create(null);
- const destructuring = Object.create(_root);
- const src__varargs = Object.create(_root);
- let intAnddynamic__Todynamic = () => (intAnddynamic__Todynamic = dart.constFn(dart.fnType(dart.dynamic, [core.int, dart.dynamic], [dart.dynamic])))();
- let intAnddynamic__Todynamic$ = () => (intAnddynamic__Todynamic$ = dart.constFn(dart.fnType(dart.dynamic, [core.int, dart.dynamic], {c: dart.dynamic})))();
- let intAnddynamicTodynamic = () => (intAnddynamicTodynamic = dart.constFn(dart.fnType(dart.dynamic, [core.int, dart.dynamic])))();
- let intAnddynamicAnddynamicTodynamic = () => (intAnddynamicAnddynamicTodynamic = dart.constFn(dart.fnType(dart.dynamic, [core.int, dart.dynamic, dart.dynamic])))();
- let __Todynamic = () => (__Todynamic = dart.constFn(dart.fnType(dart.dynamic, [], [core.int, dart.dynamic, dart.dynamic])))();
- let __Todynamic$ = () => (__Todynamic$ = dart.constFn(dart.fnType(dart.dynamic, [], {let: core.int, function: dart.dynamic, arguments: dart.dynamic})))();
- let __Todynamic$0 = () => (__Todynamic$0 = dart.constFn(dart.fnType(dart.dynamic, [], {constructor: core.int, valueOf: dart.dynamic, hasOwnProperty: dart.dynamic})))();
- let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.fnType(dart.dynamic, [dart.dynamic])))();
- destructuring.f = function(a = null, b = null, c = 1) {
- destructuring.f(a, b, c);
- };
- dart.fn(destructuring.f, intAnddynamic__Todynamic());
- destructuring.f_sync = function(a, b, c) {
- return dart.syncStar(function* f_sync(a = null, b = null, c = 1) {
- }, dart.dynamic, a, b, c);
- };
- dart.fn(destructuring.f_sync, intAnddynamic__Todynamic());
- destructuring.f_async = function(a, b, c) {
- return dart.asyncStar(function* f_async(stream, a = null, b = null, c = 1) {
- }, dart.dynamic, a, b, c);
- };
- dart.fn(destructuring.f_async, intAnddynamic__Todynamic());
- destructuring.g = function(a = null, b = null, {c = 1} = {}) {
- destructuring.f(a, b, c);
- };
- dart.fn(destructuring.g, intAnddynamic__Todynamic$());
- destructuring.g_sync = function(a, b, opts) {
- return dart.syncStar(function* g_sync(a = null, b = null, {c = 1} = {}) {
- }, dart.dynamic, a, b, opts);
- };
- dart.fn(destructuring.g_sync, intAnddynamic__Todynamic$());
- destructuring.g_async = function(a, b, opts) {
- return dart.asyncStar(function* g_async(stream, a = null, b = null, {c = 1} = {}) {
- }, dart.dynamic, a, b, opts);
- };
- dart.fn(destructuring.g_async, intAnddynamic__Todynamic$());
- destructuring.r = function(a = null, ...others = null) {
- destructuring.r(a, ...others);
- };
- dart.fn(destructuring.r, intAnddynamicTodynamic());
- destructuring.r_sync = function(a, ...others) {
- return dart.syncStar(function* r_sync(a = null, ...others = null) {
- }, dart.dynamic, a, ...others);
- };
- dart.fn(destructuring.r_sync, intAnddynamicTodynamic());
- destructuring.r_async = function(a, ...others) {
- return dart.asyncStar(function* r_async(stream, a = null, ...others = null) {
- }, dart.dynamic, a, ...others);
- };
- dart.fn(destructuring.r_async, intAnddynamicTodynamic());
- destructuring.invalid_names1 = function(let$ = null, func = null, arguments$ = null) {
- destructuring.f(let$, func, arguments$);
- };
- dart.fn(destructuring.invalid_names1, intAnddynamicAnddynamicTodynamic());
- destructuring.invalid_names2 = function(let$ = null, func = 1, arguments$ = null) {
- destructuring.f(let$, func, arguments$);
- };
- dart.fn(destructuring.invalid_names2, __Todynamic());
- destructuring.invalid_names3 = function({["let"]: let$ = null, ["function"]: func = null, ["arguments"]: arguments$ = 2} = {}) {
- destructuring.f(let$, func, arguments$);
- };
- dart.fn(destructuring.invalid_names3, __Todynamic$());
- destructuring.names_clashing_with_object_props = function({constructor = null, valueOf = null, hasOwnProperty = 2} = Object.create(null)) {
- destructuring.f(constructor, valueOf, hasOwnProperty);
- };
- dart.fn(destructuring.names_clashing_with_object_props, __Todynamic$0());
- src__varargs._Rest = class _Rest extends core.Object {};
- (src__varargs._Rest.new = function() {
- }).prototype = src__varargs._Rest.prototype;
- dart.addTypeTests(src__varargs._Rest);
- dart.defineLazy(src__varargs, {
- get rest() {
- return dart.const(new src__varargs._Rest.new());
- }
- });
- src__varargs.spread = function(args = null) {
- dart.throw(new core.StateError.new('The spread function cannot be called, ' + 'it should be compiled away.'));
- };
- dart.fn(src__varargs.spread, dynamicTodynamic());
- dart.trackLibraries("destructuring", {
- "destructuring.dart": destructuring,
- "package:js/src/varargs.dart": src__varargs
- }, null);
- // Exports:
- return {
- destructuring: destructuring,
- src__varargs: src__varargs
- };
-});
diff --git a/pkg/dev_compiler/test/codegen_expected/equality_test.js b/pkg/dev_compiler/test/codegen_expected/equality_test.js
deleted file mode 100644
index 076c039..0000000
--- a/pkg/dev_compiler/test/codegen_expected/equality_test.js
+++ /dev/null
@@ -1,1158 +0,0 @@
-define(['dart_sdk', 'expect'], function(dart_sdk, expect) {
- 'use strict';
- const core = dart_sdk.core;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const minitest = expect.minitest;
- const _root = Object.create(null);
- const equality_test = Object.create(_root);
- const $_equals = dartx._equals;
- const $_get = dartx._get;
- let TToT = () => (TToT = dart.constFn(dart.gFnType(T => [T, [T]])))();
- let VoidToT = () => (VoidToT = dart.constFn(dart.gFnType(T => [T, []])))();
- let VoidToNull = () => (VoidToNull = dart.constFn(dart.fnType(core.Null, [])))();
- let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.fnType(dart.dynamic, [])))();
- equality_test.Music = class Music extends core.Object {
- toString() {
- return {
- 0: "Music.country",
- 1: "Music.western"
- }[this.index];
- }
- };
- (equality_test.Music.new = function(x) {
- this.index = x;
- }).prototype = equality_test.Music.prototype;
- dart.addTypeTests(equality_test.Music);
- dart.setFieldSignature(equality_test.Music, () => ({
- __proto__: dart.getFields(equality_test.Music.__proto__),
- index: dart.finalFieldType(core.int)
- }));
- dart.defineExtensionMethods(equality_test.Music, ['toString']);
- equality_test.Music.country = dart.const(new equality_test.Music.new(0));
- equality_test.Music.western = dart.const(new equality_test.Music.new(1));
- equality_test.Music.values = dart.constList([equality_test.Music.country, equality_test.Music.western], equality_test.Music);
- equality_test.BluesBrother = class BluesBrother extends core.Object {};
- (equality_test.BluesBrother.new = function() {
- }).prototype = equality_test.BluesBrother.prototype;
- dart.addTypeTests(equality_test.BluesBrother);
- equality_test._Jake = class _Jake extends equality_test.BluesBrother {};
- (equality_test._Jake.new = function() {
- }).prototype = equality_test._Jake.prototype;
- dart.addTypeTests(equality_test._Jake);
- equality_test._Elwood = class _Elwood extends equality_test.BluesBrother {
- _equals(other) {
- if (other == null) return false;
- return equality_test._Elwood.is(other);
- }
- };
- (equality_test._Elwood.new = function() {
- }).prototype = equality_test._Elwood.prototype;
- dart.addTypeTests(equality_test._Elwood);
- dart.setMethodSignature(equality_test._Elwood, () => ({
- __proto__: dart.getMethods(equality_test._Elwood.__proto__),
- _equals: dart.fnType(core.bool, [core.Object]),
- [$_equals]: dart.fnType(core.bool, [core.Object])
- }));
- dart.defineExtensionMethods(equality_test._Elwood, ['_equals']);
- equality_test._Norman = class _Norman extends equality_test.BluesBrother {};
- (equality_test._Norman.new = function() {
- }).prototype = equality_test._Norman.prototype;
- dart.addTypeTests(equality_test._Norman);
- equality_test.hideNull = function(T, x) {
- return x;
- };
- dart.fn(equality_test.hideNull, TToT());
- equality_test.getUndefined = function(T) {
- return T._check(core.List.new(1)[$_get](0));
- };
- dart.fn(equality_test.getUndefined, VoidToT());
- equality_test.main = function() {
- minitest.group('Enum equality', dart.fn(() => {
- minitest.test('Equal enum/enum (nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(equality_test.Music, equality_test.Music.country);
- let e2 = equality_test.hideNull(equality_test.Music, equality_test.Music.western);
- let d1 = equality_test.hideNull(equality_test.Music, equality_test.Music.country);
- let d2 = equality_test.hideNull(equality_test.Music, equality_test.Music.western);
- let o1 = equality_test.hideNull(core.Object, equality_test.Music.country);
- let o2 = equality_test.hideNull(core.Object, equality_test.Music.western);
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(dart.equals(d1, e1), true);
- minitest.expect(dart.equals(d1, d1), true);
- minitest.expect(dart.equals(d1, o1), true);
- minitest.expect(dart.equals(d1, e2), false);
- minitest.expect(dart.equals(d1, d2), false);
- minitest.expect(dart.equals(d1, o2), false);
- minitest.expect(dart.equals(o1, e1), true);
- minitest.expect(dart.equals(o1, d1), true);
- minitest.expect(dart.equals(o1, o1), true);
- minitest.expect(dart.equals(o1, e2), false);
- minitest.expect(dart.equals(o1, d2), false);
- minitest.expect(dart.equals(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Equal enum/enum (non-null)', dart.fn(() => {
- let e1 = equality_test.Music.country;
- let e2 = equality_test.Music.western;
- let d1 = equality_test.Music.country;
- let d2 = equality_test.Music.western;
- let o1 = equality_test.Music.country;
- let o2 = equality_test.Music.western;
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1[$_equals](e1), true);
- minitest.expect(d1[$_equals](d1), true);
- minitest.expect(d1[$_equals](o1), true);
- minitest.expect(d1[$_equals](e2), false);
- minitest.expect(d1[$_equals](d2), false);
- minitest.expect(d1[$_equals](o2), false);
- minitest.expect(o1[$_equals](e1), true);
- minitest.expect(o1[$_equals](d1), true);
- minitest.expect(o1[$_equals](o1), true);
- minitest.expect(o1[$_equals](e2), false);
- minitest.expect(o1[$_equals](d2), false);
- minitest.expect(o1[$_equals](o2), false);
- }, VoidToNull()));
- minitest.test('Equal enum/other (static, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(equality_test.Music, equality_test.Music.country);
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test.BluesBrother, new equality_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(e1 == l1, false);
- minitest.expect(e1 == b1, false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- }, VoidToNull()));
- minitest.test('Equal enum/other (static, non-null)', dart.fn(() => {
- let e1 = equality_test.Music.country;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- }, VoidToNull()));
- minitest.test('Equal enum/other (dynamic, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(equality_test.Music, equality_test.Music.country);
- let d1 = equality_test.hideNull(equality_test.Music, equality_test.Music.country);
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test._Norman, new equality_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(dart.equals(s1, e1), false);
- minitest.expect(dart.equals(s2, e1), false);
- minitest.expect(dart.equals(i1, e1), false);
- minitest.expect(dart.equals(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- minitest.expect(dart.equals(d1, s1), false);
- minitest.expect(dart.equals(d1, s2), false);
- minitest.expect(dart.equals(d1, i1), false);
- minitest.expect(dart.equals(d1, i2), false);
- minitest.expect(dart.equals(d1, l1), false);
- minitest.expect(dart.equals(d1, b1), false);
- minitest.expect(dart.equals(s1, d1), false);
- minitest.expect(dart.equals(s2, d1), false);
- minitest.expect(dart.equals(i1, d1), false);
- minitest.expect(dart.equals(i2, d1), false);
- minitest.expect(dart.equals(l1, d1), false);
- minitest.expect(dart.equals(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Equal enum/other (dynamic, non-null)', dart.fn(() => {
- let e1 = equality_test.Music.country;
- let d1 = equality_test.Music.country;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- minitest.expect(d1[$_equals](s1), false);
- minitest.expect(d1[$_equals](s2), false);
- minitest.expect(d1[$_equals](i1), false);
- minitest.expect(d1[$_equals](i2), false);
- minitest.expect(d1[$_equals](l1), false);
- minitest.expect(d1[$_equals](b1), false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1[$_equals](d1), false);
- minitest.expect(b1._equals(d1), false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('String equality', dart.fn(() => {
- minitest.test('Equal string/string (nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.String, "The");
- let e2 = equality_test.hideNull(core.String, "Band");
- let d1 = equality_test.hideNull(core.String, "The");
- let d2 = equality_test.hideNull(core.String, "Band");
- let o1 = equality_test.hideNull(core.Object, "The");
- let o2 = equality_test.hideNull(core.Object, "Band");
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(dart.equals(d1, e1), true);
- minitest.expect(dart.equals(d1, d1), true);
- minitest.expect(dart.equals(d1, o1), true);
- minitest.expect(dart.equals(d1, e2), false);
- minitest.expect(dart.equals(d1, d2), false);
- minitest.expect(dart.equals(d1, o2), false);
- minitest.expect(dart.equals(o1, e1), true);
- minitest.expect(dart.equals(o1, d1), true);
- minitest.expect(dart.equals(o1, o1), true);
- minitest.expect(dart.equals(o1, e2), false);
- minitest.expect(dart.equals(o1, d2), false);
- minitest.expect(dart.equals(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Equal string/string (non-null)', dart.fn(() => {
- let e1 = "The";
- let e2 = "Band";
- let d1 = "The";
- let d2 = "Band";
- let o1 = "The";
- let o2 = "Band";
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1[$_equals](e1), true);
- minitest.expect(d1[$_equals](d1), true);
- minitest.expect(d1[$_equals](o1), true);
- minitest.expect(d1[$_equals](e2), false);
- minitest.expect(d1[$_equals](d2), false);
- minitest.expect(d1[$_equals](o2), false);
- minitest.expect(o1[$_equals](e1), true);
- minitest.expect(o1[$_equals](d1), true);
- minitest.expect(o1[$_equals](o1), true);
- minitest.expect(o1[$_equals](e2), false);
- minitest.expect(o1[$_equals](d2), false);
- minitest.expect(o1[$_equals](o2), false);
- }, VoidToNull()));
- minitest.test('Equal string/other (static, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.String, "The");
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test.BluesBrother, new equality_test._Norman.new());
- minitest.expect(e1 == s1, false);
- minitest.expect(e1 == s2, false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(s1 == e1, false);
- minitest.expect(s2 == e1, false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- }, VoidToNull()));
- minitest.test('Equal string/other (static, non-null)', dart.fn(() => {
- let e1 = "The";
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- }, VoidToNull()));
- minitest.test('Equal string/other (dynamic, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.String, "The");
- let d1 = equality_test.hideNull(core.String, "The");
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test._Norman, new equality_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(dart.equals(s1, e1), false);
- minitest.expect(dart.equals(s2, e1), false);
- minitest.expect(dart.equals(i1, e1), false);
- minitest.expect(dart.equals(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- minitest.expect(dart.equals(d1, s1), false);
- minitest.expect(dart.equals(d1, s2), false);
- minitest.expect(dart.equals(d1, i1), false);
- minitest.expect(dart.equals(d1, i2), false);
- minitest.expect(dart.equals(d1, l1), false);
- minitest.expect(dart.equals(d1, b1), false);
- minitest.expect(dart.equals(s1, d1), false);
- minitest.expect(dart.equals(s2, d1), false);
- minitest.expect(dart.equals(i1, d1), false);
- minitest.expect(dart.equals(i2, d1), false);
- minitest.expect(dart.equals(l1, d1), false);
- minitest.expect(dart.equals(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Equal string/other (dynamic, non-null)', dart.fn(() => {
- let e1 = "The";
- let d1 = "The";
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- minitest.expect(d1[$_equals](s1), false);
- minitest.expect(d1[$_equals](s2), false);
- minitest.expect(d1[$_equals](i1), false);
- minitest.expect(d1[$_equals](i2), false);
- minitest.expect(d1[$_equals](l1), false);
- minitest.expect(d1[$_equals](b1), false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1[$_equals](d1), false);
- minitest.expect(b1._equals(d1), false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('Boolean equality', dart.fn(() => {
- minitest.test('Equal bool/bool (nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.bool, true);
- let e2 = equality_test.hideNull(core.bool, false);
- let d1 = equality_test.hideNull(core.bool, true);
- let d2 = equality_test.hideNull(core.bool, false);
- let o1 = equality_test.hideNull(core.Object, true);
- let o2 = equality_test.hideNull(core.Object, false);
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(dart.equals(d1, e1), true);
- minitest.expect(dart.equals(d1, d1), true);
- minitest.expect(dart.equals(d1, o1), true);
- minitest.expect(dart.equals(d1, e2), false);
- minitest.expect(dart.equals(d1, d2), false);
- minitest.expect(dart.equals(d1, o2), false);
- minitest.expect(dart.equals(o1, e1), true);
- minitest.expect(dart.equals(o1, d1), true);
- minitest.expect(dart.equals(o1, o1), true);
- minitest.expect(dart.equals(o1, e2), false);
- minitest.expect(dart.equals(o1, d2), false);
- minitest.expect(dart.equals(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Equal bool/bool (non-null)', dart.fn(() => {
- let e1 = true;
- let e2 = false;
- let d1 = true;
- let d2 = false;
- let o1 = true;
- let o2 = false;
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1[$_equals](e1), true);
- minitest.expect(d1[$_equals](d1), true);
- minitest.expect(d1[$_equals](o1), true);
- minitest.expect(d1[$_equals](e2), false);
- minitest.expect(d1[$_equals](d2), false);
- minitest.expect(d1[$_equals](o2), false);
- minitest.expect(o1[$_equals](e1), true);
- minitest.expect(o1[$_equals](d1), true);
- minitest.expect(o1[$_equals](o1), true);
- minitest.expect(o1[$_equals](e2), false);
- minitest.expect(o1[$_equals](d2), false);
- minitest.expect(o1[$_equals](o2), false);
- }, VoidToNull()));
- minitest.test('Equal bool/other (static, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.bool, true);
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test.BluesBrother, new equality_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- }, VoidToNull()));
- minitest.test('Equal bool/other (static, non-null)', dart.fn(() => {
- let e1 = true;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- }, VoidToNull()));
- minitest.test('Equal bool/other (dynamic, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.bool, true);
- let d1 = equality_test.hideNull(core.bool, true);
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test._Norman, new equality_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(dart.equals(s1, e1), false);
- minitest.expect(dart.equals(s2, e1), false);
- minitest.expect(dart.equals(i1, e1), false);
- minitest.expect(dart.equals(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- minitest.expect(dart.equals(d1, s1), false);
- minitest.expect(dart.equals(d1, s2), false);
- minitest.expect(dart.equals(d1, i1), false);
- minitest.expect(dart.equals(d1, i2), false);
- minitest.expect(dart.equals(d1, l1), false);
- minitest.expect(dart.equals(d1, b1), false);
- minitest.expect(dart.equals(s1, d1), false);
- minitest.expect(dart.equals(s2, d1), false);
- minitest.expect(dart.equals(i1, d1), false);
- minitest.expect(dart.equals(i2, d1), false);
- minitest.expect(dart.equals(l1, d1), false);
- minitest.expect(dart.equals(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Equal bool/other (dynamic, non-null)', dart.fn(() => {
- let e1 = true;
- let d1 = true;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- minitest.expect(d1[$_equals](s1), false);
- minitest.expect(d1[$_equals](s2), false);
- minitest.expect(d1[$_equals](i1), false);
- minitest.expect(d1[$_equals](i2), false);
- minitest.expect(d1[$_equals](l1), false);
- minitest.expect(d1[$_equals](b1), false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1[$_equals](d1), false);
- minitest.expect(b1._equals(d1), false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('String equality', dart.fn(() => {
- minitest.test('Equal string/string (nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.String, "The");
- let e2 = equality_test.hideNull(core.String, "Band");
- let d1 = equality_test.hideNull(core.String, "The");
- let d2 = equality_test.hideNull(core.String, "Band");
- let o1 = equality_test.hideNull(core.Object, "The");
- let o2 = equality_test.hideNull(core.Object, "Band");
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(dart.equals(d1, e1), true);
- minitest.expect(dart.equals(d1, d1), true);
- minitest.expect(dart.equals(d1, o1), true);
- minitest.expect(dart.equals(d1, e2), false);
- minitest.expect(dart.equals(d1, d2), false);
- minitest.expect(dart.equals(d1, o2), false);
- minitest.expect(dart.equals(o1, e1), true);
- minitest.expect(dart.equals(o1, d1), true);
- minitest.expect(dart.equals(o1, o1), true);
- minitest.expect(dart.equals(o1, e2), false);
- minitest.expect(dart.equals(o1, d2), false);
- minitest.expect(dart.equals(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Equal string/string (non-null)', dart.fn(() => {
- let e1 = "The";
- let e2 = "Band";
- let d1 = "The";
- let d2 = "Band";
- let o1 = "The";
- let o2 = "Band";
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1[$_equals](e1), true);
- minitest.expect(d1[$_equals](d1), true);
- minitest.expect(d1[$_equals](o1), true);
- minitest.expect(d1[$_equals](e2), false);
- minitest.expect(d1[$_equals](d2), false);
- minitest.expect(d1[$_equals](o2), false);
- minitest.expect(o1[$_equals](e1), true);
- minitest.expect(o1[$_equals](d1), true);
- minitest.expect(o1[$_equals](o1), true);
- minitest.expect(o1[$_equals](e2), false);
- minitest.expect(o1[$_equals](d2), false);
- minitest.expect(o1[$_equals](o2), false);
- }, VoidToNull()));
- minitest.test('Equal string/other (static, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.String, "The");
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test.BluesBrother, new equality_test._Norman.new());
- minitest.expect(e1 == s1, false);
- minitest.expect(e1 == s2, false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(s1 == e1, false);
- minitest.expect(s2 == e1, false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- }, VoidToNull()));
- minitest.test('Equal string/other (static, non-null)', dart.fn(() => {
- let e1 = "The";
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- }, VoidToNull()));
- minitest.test('Equal string/other (dynamic, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.String, "The");
- let d1 = equality_test.hideNull(core.String, "The");
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test._Norman, new equality_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(dart.equals(s1, e1), false);
- minitest.expect(dart.equals(s2, e1), false);
- minitest.expect(dart.equals(i1, e1), false);
- minitest.expect(dart.equals(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- minitest.expect(dart.equals(d1, s1), false);
- minitest.expect(dart.equals(d1, s2), false);
- minitest.expect(dart.equals(d1, i1), false);
- minitest.expect(dart.equals(d1, i2), false);
- minitest.expect(dart.equals(d1, l1), false);
- minitest.expect(dart.equals(d1, b1), false);
- minitest.expect(dart.equals(s1, d1), false);
- minitest.expect(dart.equals(s2, d1), false);
- minitest.expect(dart.equals(i1, d1), false);
- minitest.expect(dart.equals(i2, d1), false);
- minitest.expect(dart.equals(l1, d1), false);
- minitest.expect(dart.equals(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Equal string/other (dynamic, non-null)', dart.fn(() => {
- let e1 = "The";
- let d1 = "The";
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- minitest.expect(d1[$_equals](s1), false);
- minitest.expect(d1[$_equals](s2), false);
- minitest.expect(d1[$_equals](i1), false);
- minitest.expect(d1[$_equals](i2), false);
- minitest.expect(d1[$_equals](l1), false);
- minitest.expect(d1[$_equals](b1), false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1[$_equals](d1), false);
- minitest.expect(b1._equals(d1), false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('Number equality', dart.fn(() => {
- minitest.test('Equal int/int (nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.int, 11);
- let e2 = equality_test.hideNull(core.int, 12);
- let d1 = equality_test.hideNull(core.int, 11);
- let d2 = equality_test.hideNull(core.int, 12);
- let o1 = equality_test.hideNull(core.Object, 11);
- let o2 = equality_test.hideNull(core.Object, 12);
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(dart.equals(d1, e1), true);
- minitest.expect(dart.equals(d1, d1), true);
- minitest.expect(dart.equals(d1, o1), true);
- minitest.expect(dart.equals(d1, e2), false);
- minitest.expect(dart.equals(d1, d2), false);
- minitest.expect(dart.equals(d1, o2), false);
- minitest.expect(dart.equals(o1, e1), true);
- minitest.expect(dart.equals(o1, d1), true);
- minitest.expect(dart.equals(o1, o1), true);
- minitest.expect(dart.equals(o1, e2), false);
- minitest.expect(dart.equals(o1, d2), false);
- minitest.expect(dart.equals(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Equal int/int (non-null)', dart.fn(() => {
- let e1 = 11;
- let e2 = 12;
- let d1 = 11;
- let d2 = 12;
- let o1 = 11;
- let o2 = 12;
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1[$_equals](e1), true);
- minitest.expect(d1[$_equals](d1), true);
- minitest.expect(d1[$_equals](o1), true);
- minitest.expect(d1[$_equals](e2), false);
- minitest.expect(d1[$_equals](d2), false);
- minitest.expect(d1[$_equals](o2), false);
- minitest.expect(o1[$_equals](e1), true);
- minitest.expect(o1[$_equals](d1), true);
- minitest.expect(o1[$_equals](o1), true);
- minitest.expect(o1[$_equals](e2), false);
- minitest.expect(o1[$_equals](d2), false);
- minitest.expect(o1[$_equals](o2), false);
- }, VoidToNull()));
- minitest.test('Equal int/other (static, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.int, 11);
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test.BluesBrother, new equality_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(e1 == i1, false);
- minitest.expect(e1 == i2, false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(i1 == e1, false);
- minitest.expect(i2 == e1, false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- }, VoidToNull()));
- minitest.test('Equal int/other (static, non-null)', dart.fn(() => {
- let e1 = 11;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- }, VoidToNull()));
- minitest.test('Equal int/other (dynamic, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(core.int, 11);
- let d1 = equality_test.hideNull(core.int, 11);
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test._Norman, new equality_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(dart.equals(s1, e1), false);
- minitest.expect(dart.equals(s2, e1), false);
- minitest.expect(dart.equals(i1, e1), false);
- minitest.expect(dart.equals(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- minitest.expect(dart.equals(d1, s1), false);
- minitest.expect(dart.equals(d1, s2), false);
- minitest.expect(dart.equals(d1, i1), false);
- minitest.expect(dart.equals(d1, i2), false);
- minitest.expect(dart.equals(d1, l1), false);
- minitest.expect(dart.equals(d1, b1), false);
- minitest.expect(dart.equals(s1, d1), false);
- minitest.expect(dart.equals(s2, d1), false);
- minitest.expect(dart.equals(i1, d1), false);
- minitest.expect(dart.equals(i2, d1), false);
- minitest.expect(dart.equals(l1, d1), false);
- minitest.expect(dart.equals(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Equal int/other (dynamic, non-null)', dart.fn(() => {
- let e1 = 11;
- let d1 = 11;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- minitest.expect(d1[$_equals](s1), false);
- minitest.expect(d1[$_equals](s2), false);
- minitest.expect(d1[$_equals](i1), false);
- minitest.expect(d1[$_equals](i2), false);
- minitest.expect(d1[$_equals](l1), false);
- minitest.expect(d1[$_equals](b1), false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1[$_equals](d1), false);
- minitest.expect(b1._equals(d1), false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('Object equality', dart.fn(() => {
- minitest.test('Equal object/object (nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(equality_test._Jake, new equality_test._Jake.new());
- let e2 = equality_test.hideNull(equality_test._Elwood, new equality_test._Elwood.new());
- let d1 = equality_test.hideNull(equality_test._Jake, e1);
- let d2 = equality_test.hideNull(equality_test._Elwood, new equality_test._Elwood.new());
- let o1 = equality_test.hideNull(core.Object, e1);
- let o2 = equality_test.hideNull(core.Object, new equality_test._Elwood.new());
- minitest.expect(dart.equals(e1, e1), true);
- minitest.expect(dart.equals(e1, d1), true);
- minitest.expect(dart.equals(e1, o1), true);
- minitest.expect(dart.equals(e1, e2), false);
- minitest.expect(dart.equals(e1, o2), false);
- minitest.expect(dart.equals(e1, d2), false);
- minitest.expect(dart.equals(e1, e2), false);
- minitest.expect(dart.equals(d1, e1), true);
- minitest.expect(dart.equals(d1, d1), true);
- minitest.expect(dart.equals(d1, o1), true);
- minitest.expect(dart.equals(d1, e2), false);
- minitest.expect(dart.equals(d1, d2), false);
- minitest.expect(dart.equals(d1, o2), false);
- minitest.expect(dart.equals(o1, e1), true);
- minitest.expect(dart.equals(o1, d1), true);
- minitest.expect(dart.equals(o1, o1), true);
- minitest.expect(dart.equals(o1, e2), false);
- minitest.expect(dart.equals(o1, d2), false);
- minitest.expect(dart.equals(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Equal object/object (non-null)', dart.fn(() => {
- let e1 = new equality_test._Jake.new();
- let e2 = new equality_test._Elwood.new();
- let d1 = e1;
- let d2 = new equality_test._Elwood.new();
- let o1 = e1;
- let o2 = new equality_test._Elwood.new();
- minitest.expect(e1._equals(e1), true);
- minitest.expect(e1._equals(d1), true);
- minitest.expect(e1._equals(o1), true);
- minitest.expect(e1._equals(e2), false);
- minitest.expect(e1._equals(o2), false);
- minitest.expect(e1._equals(d2), false);
- minitest.expect(e1._equals(e2), false);
- minitest.expect(d1[$_equals](e1), true);
- minitest.expect(d1[$_equals](d1), true);
- minitest.expect(d1[$_equals](o1), true);
- minitest.expect(d1[$_equals](e2), false);
- minitest.expect(d1[$_equals](d2), false);
- minitest.expect(d1[$_equals](o2), false);
- minitest.expect(o1[$_equals](e1), true);
- minitest.expect(o1[$_equals](d1), true);
- minitest.expect(o1[$_equals](o1), true);
- minitest.expect(o1[$_equals](e2), false);
- minitest.expect(o1[$_equals](d2), false);
- minitest.expect(o1[$_equals](o2), false);
- }, VoidToNull()));
- minitest.test('Equal object/other (static, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(equality_test._Jake, new equality_test._Jake.new());
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test.BluesBrother, new equality_test._Norman.new());
- minitest.expect(dart.equals(e1, s1), false);
- minitest.expect(dart.equals(e1, s2), false);
- minitest.expect(dart.equals(e1, i1), false);
- minitest.expect(dart.equals(e1, i2), false);
- minitest.expect(dart.equals(e1, l1), false);
- minitest.expect(dart.equals(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- }, VoidToNull()));
- minitest.test('Equal object/other (static, non-null)', dart.fn(() => {
- let e1 = new equality_test._Jake.new();
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1._equals(s1), false);
- minitest.expect(e1._equals(s2), false);
- minitest.expect(e1._equals(i1), false);
- minitest.expect(e1._equals(i2), false);
- minitest.expect(e1._equals(l1), false);
- minitest.expect(e1._equals(b1), false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- }, VoidToNull()));
- minitest.test('Equal object/other (dynamic, nullable)', dart.fn(() => {
- let e1 = equality_test.hideNull(equality_test._Jake, new equality_test._Jake.new());
- let d1 = equality_test.hideNull(equality_test._Jake, new equality_test._Jake.new());
- let s1 = equality_test.hideNull(core.String, "hello");
- let s2 = equality_test.hideNull(core.String, "");
- let i1 = equality_test.hideNull(core.int, 3);
- let i2 = equality_test.hideNull(core.int, 0);
- let l1 = equality_test.hideNull(core.List, core.List.new(3));
- let b1 = equality_test.hideNull(equality_test._Norman, new equality_test._Norman.new());
- minitest.expect(dart.equals(e1, s1), false);
- minitest.expect(dart.equals(e1, s2), false);
- minitest.expect(dart.equals(e1, i1), false);
- minitest.expect(dart.equals(e1, i2), false);
- minitest.expect(dart.equals(e1, l1), false);
- minitest.expect(dart.equals(e1, b1), false);
- minitest.expect(dart.equals(s1, e1), false);
- minitest.expect(dart.equals(s2, e1), false);
- minitest.expect(dart.equals(i1, e1), false);
- minitest.expect(dart.equals(i2, e1), false);
- minitest.expect(dart.equals(l1, e1), false);
- minitest.expect(dart.equals(b1, e1), false);
- minitest.expect(dart.equals(d1, s1), false);
- minitest.expect(dart.equals(d1, s2), false);
- minitest.expect(dart.equals(d1, i1), false);
- minitest.expect(dart.equals(d1, i2), false);
- minitest.expect(dart.equals(d1, l1), false);
- minitest.expect(dart.equals(d1, b1), false);
- minitest.expect(dart.equals(s1, d1), false);
- minitest.expect(dart.equals(s2, d1), false);
- minitest.expect(dart.equals(i1, d1), false);
- minitest.expect(dart.equals(i2, d1), false);
- minitest.expect(dart.equals(l1, d1), false);
- minitest.expect(dart.equals(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Equal object/other (dynamic, non-null)', dart.fn(() => {
- let e1 = new equality_test._Jake.new();
- let d1 = new equality_test._Jake.new();
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new equality_test._Norman.new();
- minitest.expect(e1._equals(s1), false);
- minitest.expect(e1._equals(s2), false);
- minitest.expect(e1._equals(i1), false);
- minitest.expect(e1._equals(i2), false);
- minitest.expect(e1._equals(l1), false);
- minitest.expect(e1._equals(b1), false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1[$_equals](e1), false);
- minitest.expect(b1._equals(e1), false);
- minitest.expect(d1[$_equals](s1), false);
- minitest.expect(d1[$_equals](s2), false);
- minitest.expect(d1[$_equals](i1), false);
- minitest.expect(d1[$_equals](i2), false);
- minitest.expect(d1[$_equals](l1), false);
- minitest.expect(d1[$_equals](b1), false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1[$_equals](d1), false);
- minitest.expect(b1._equals(d1), false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('Null/undefined equality', dart.fn(() => {
- minitest.test('Equal object/other (static, null)', dart.fn(() => {
- let n = equality_test.hideNull(equality_test.BluesBrother, null);
- let u1 = equality_test.getUndefined(core.String);
- let u2 = equality_test.getUndefined(core.int);
- let u3 = equality_test.getUndefined(core.bool);
- let u4 = equality_test.getUndefined(core.List);
- minitest.expect(dart.equals(n, n), true);
- minitest.expect(dart.equals(n, u1), true);
- minitest.expect(dart.equals(n, u2), true);
- minitest.expect(dart.equals(n, u3), true);
- minitest.expect(dart.equals(n, u4), true);
- minitest.expect(core.identical(u1, n), true);
- minitest.expect(core.identical(u2, n), true);
- minitest.expect(core.identical(u3, n), true);
- minitest.expect(dart.equals(u4, n), true);
- }, VoidToNull()));
- minitest.test('Equal String/other (static, null)', dart.fn(() => {
- let u1 = equality_test.getUndefined(equality_test.BluesBrother);
- let n = equality_test.hideNull(core.String, null);
- let u2 = equality_test.getUndefined(core.int);
- let u3 = equality_test.getUndefined(core.bool);
- let u4 = equality_test.getUndefined(core.List);
- minitest.expect(n == n, true);
- minitest.expect(core.identical(n, u1), true);
- minitest.expect(core.identical(n, u2), true);
- minitest.expect(core.identical(n, u3), true);
- minitest.expect(core.identical(n, u4), true);
- minitest.expect(dart.equals(u1, n), true);
- minitest.expect(core.identical(u2, n), true);
- minitest.expect(core.identical(u3, n), true);
- minitest.expect(dart.equals(u4, n), true);
- }, VoidToNull()));
- minitest.test('Equal int/other (static, null)', dart.fn(() => {
- let u1 = equality_test.getUndefined(equality_test.BluesBrother);
- let u2 = equality_test.getUndefined(core.String);
- let n = equality_test.hideNull(core.int, null);
- let u3 = equality_test.getUndefined(core.bool);
- let u4 = equality_test.getUndefined(core.List);
- minitest.expect(n == n, true);
- minitest.expect(core.identical(n, u1), true);
- minitest.expect(core.identical(n, u2), true);
- minitest.expect(core.identical(n, u3), true);
- minitest.expect(core.identical(n, u4), true);
- minitest.expect(dart.equals(u1, n), true);
- minitest.expect(core.identical(u2, n), true);
- minitest.expect(core.identical(u3, n), true);
- minitest.expect(dart.equals(u4, n), true);
- }, VoidToNull()));
- minitest.test('Equal bool/other (static, null)', dart.fn(() => {
- let u1 = equality_test.getUndefined(equality_test.BluesBrother);
- let u2 = equality_test.getUndefined(core.String);
- let u3 = equality_test.getUndefined(core.int);
- let n = equality_test.hideNull(core.bool, null);
- let u4 = equality_test.getUndefined(core.List);
- minitest.expect(n == n, true);
- minitest.expect(core.identical(n, u1), true);
- minitest.expect(core.identical(n, u2), true);
- minitest.expect(core.identical(n, u3), true);
- minitest.expect(core.identical(n, u4), true);
- minitest.expect(dart.equals(u1, n), true);
- minitest.expect(core.identical(u2, n), true);
- minitest.expect(core.identical(u3, n), true);
- minitest.expect(dart.equals(u4, n), true);
- }, VoidToNull()));
- minitest.test('Equal List/other (static, null)', dart.fn(() => {
- let u1 = equality_test.getUndefined(equality_test.BluesBrother);
- let u2 = equality_test.getUndefined(core.String);
- let u3 = equality_test.getUndefined(core.int);
- let u4 = equality_test.getUndefined(core.bool);
- let n = equality_test.hideNull(core.List, null);
- minitest.expect(dart.equals(n, n), true);
- minitest.expect(dart.equals(n, u1), true);
- minitest.expect(dart.equals(n, u2), true);
- minitest.expect(dart.equals(n, u3), true);
- minitest.expect(dart.equals(n, u4), true);
- minitest.expect(dart.equals(u1, n), true);
- minitest.expect(core.identical(u2, n), true);
- minitest.expect(core.identical(u3, n), true);
- minitest.expect(core.identical(u4, n), true);
- }, VoidToNull()));
- }, VoidToNull()));
- };
- dart.fn(equality_test.main, VoidTodynamic());
- dart.trackLibraries("equality_test", {
- "equality_test.dart": equality_test
- }, null);
- // Exports:
- return {
- equality_test: equality_test
- };
-});
diff --git a/pkg/dev_compiler/test/codegen_expected/es6_modules.js b/pkg/dev_compiler/test/codegen_expected/es6_modules.js
deleted file mode 100644
index f2cb5f2..0000000
--- a/pkg/dev_compiler/test/codegen_expected/es6_modules.js
+++ /dev/null
@@ -1,72 +0,0 @@
-const _root = Object.create(null);
-export const es6_modules = Object.create(_root);
-import { core, dart, dartx } from 'dart_sdk';
-let B = () => (B = dart.constFn(es6_modules.B$()))();
-let _B = () => (_B = dart.constFn(es6_modules._B$()))();
-let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.fnType(dart.dynamic, [])))();
-let VoidToString = () => (VoidToString = dart.constFn(dart.fnType(core.String, [])))();
-es6_modules.Callback = dart.typedef('Callback', () => dart.fnTypeFuzzy(dart.void, [], {i: core.int}));
-es6_modules.A = class A extends core.Object {};
-(es6_modules.A.new = function() {
-}).prototype = es6_modules.A.prototype;
-dart.addTypeTests(es6_modules.A);
-es6_modules._A = class _A extends core.Object {};
-(es6_modules._A.new = function() {
-}).prototype = es6_modules._A.prototype;
-dart.addTypeTests(es6_modules._A);
-const _is_B_default = Symbol('_is_B_default');
-es6_modules.B$ = dart.generic(T => {
- class B extends core.Object {}
- (B.new = function() {
- }).prototype = B.prototype;
- dart.addTypeTests(B);
- B.prototype[_is_B_default] = true;
- return B;
-});
-es6_modules.B = B();
-dart.addTypeTests(es6_modules.B, _is_B_default);
-const _is__B_default = Symbol('_is__B_default');
-es6_modules._B$ = dart.generic(T => {
- class _B extends core.Object {}
- (_B.new = function() {
- }).prototype = _B.prototype;
- dart.addTypeTests(_B);
- _B.prototype[_is__B_default] = true;
- return _B;
-});
-es6_modules._B = _B();
-dart.addTypeTests(es6_modules._B, _is__B_default);
-es6_modules.f = function() {
-};
-dart.fn(es6_modules.f, VoidTodynamic());
-es6_modules._f = function() {
-};
-dart.fn(es6_modules._f, VoidTodynamic());
-dart.defineLazy(es6_modules, {
- get constant() {
- return "abc";
- },
- get finalConstant() {
- return "abc";
- },
- get lazy() {
- return dart.fn(() => {
- core.print('lazy');
- return "abc";
- }, VoidToString())();
- },
- get mutable() {
- return "abc";
- },
- set mutable(_) {},
- get lazyMutable() {
- return dart.fn(() => {
- core.print('lazyMutable');
- return "abc";
- }, VoidToString())();
- },
- set lazyMutable(_) {}
-});
-dart.trackLibraries("es6_modules", {
- "es6_modules.dart": es6_modules
-}, null);
diff --git a/pkg/dev_compiler/test/codegen_expected/expect.js b/pkg/dev_compiler/test/codegen_expected/expect.js
deleted file mode 100644
index 793ac41..0000000
--- a/pkg/dev_compiler/test/codegen_expected/expect.js
+++ /dev/null
@@ -1,338 +0,0 @@
-define(['dart_sdk'], function(dart_sdk) {
- 'use strict';
- const core = dart_sdk.core;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const expect = Object.create(null);
- let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.functionType(dart.void, [])))();
- let dynamicAnddynamicTobool = () => (dynamicAnddynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic, dart.dynamic])))();
- expect.Expect = class Expect extends core.Object {
- static _truncateString(string, start, end, length) {
- if (dart.notNull(end) - dart.notNull(start) > dart.notNull(length)) {
- end = dart.notNull(start) + dart.notNull(length);
- } else if (dart.notNull(end) - dart.notNull(start) < dart.notNull(length)) {
- let overflow = dart.notNull(length) - (dart.notNull(end) - dart.notNull(start));
- if (overflow > 10) overflow = 10;
- start = dart.notNull(start) - ((overflow + 1) / 2)[dartx.truncate]();
- end = dart.notNull(end) + (overflow / 2)[dartx.truncate]();
- if (dart.notNull(start) < 0) start = 0;
- if (dart.notNull(end) > dart.notNull(string[dartx.length])) end = string[dartx.length];
- }
- if (start == 0 && end == string[dartx.length]) return string;
- let buf = new core.StringBuffer();
- if (dart.notNull(start) > 0) buf.write("...");
- for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
- let code = string[dartx.codeUnitAt](i);
- if (dart.notNull(code) < 32) {
- buf.write("\\x");
- buf.write("0123456789abcdef"[dartx.get]((dart.notNull(code) / 16)[dartx.truncate]()));
- buf.write("0123456789abcdef"[dartx.get](code[dartx['%']](16)));
- } else {
- buf.writeCharCode(string[dartx.codeUnitAt](i));
- }
- }
- if (dart.notNull(end) < dart.notNull(string[dartx.length])) buf.write("...");
- return buf.toString();
- }
- static _stringDifference(expected, actual) {
- if (dart.notNull(expected[dartx.length]) < 20 && dart.notNull(actual[dartx.length]) < 20) return null;
- for (let i = 0; i < dart.notNull(expected[dartx.length]) && i < dart.notNull(actual[dartx.length]); i++) {
- if (expected[dartx.codeUnitAt](i) != actual[dartx.codeUnitAt](i)) {
- let start = i;
- i++;
- while (i < dart.notNull(expected[dartx.length]) && i < dart.notNull(actual[dartx.length])) {
- if (expected[dartx.codeUnitAt](i) == actual[dartx.codeUnitAt](i)) break;
- i++;
- }
- let end = i;
- let truncExpected = expect.Expect._truncateString(expected, start, end, 20);
- let truncActual = expect.Expect._truncateString(actual, start, end, 20);
- return dart.str`at index ${start}: Expected <${truncExpected}>, ` + dart.str`Found: <${truncActual}>`;
- }
- }
- return null;
- }
- static equals(expected, actual, reason) {
- if (reason === void 0) reason = null;
- if (dart.equals(expected, actual)) return;
- let msg = expect.Expect._getMessage(reason);
- if (typeof expected == 'string' && typeof actual == 'string') {
- let stringDifference = expect.Expect._stringDifference(expected, actual);
- if (stringDifference != null) {
- expect.Expect._fail(dart.str`Expect.equals(${stringDifference}${msg}) fails.`);
- }
- }
- expect.Expect._fail(dart.str`Expect.equals(expected: <${expected}>, actual: <${actual}>${msg}) fails.`);
- }
- static isTrue(actual, reason) {
- if (reason === void 0) reason = null;
- if (dart.test(expect._identical(actual, true))) return;
- let msg = expect.Expect._getMessage(reason);
- expect.Expect._fail(dart.str`Expect.isTrue(${actual}${msg}) fails.`);
- }
- static isFalse(actual, reason) {
- if (reason === void 0) reason = null;
- if (dart.test(expect._identical(actual, false))) return;
- let msg = expect.Expect._getMessage(reason);
- expect.Expect._fail(dart.str`Expect.isFalse(${actual}${msg}) fails.`);
- }
- static isNull(actual, reason) {
- if (reason === void 0) reason = null;
- if (null == actual) return;
- let msg = expect.Expect._getMessage(reason);
- expect.Expect._fail(dart.str`Expect.isNull(actual: <${actual}>${msg}) fails.`);
- }
- static isNotNull(actual, reason) {
- if (reason === void 0) reason = null;
- if (null != actual) return;
- let msg = expect.Expect._getMessage(reason);
- expect.Expect._fail(dart.str`Expect.isNotNull(actual: <${actual}>${msg}) fails.`);
- }
- static identical(expected, actual, reason) {
- if (reason === void 0) reason = null;
- if (dart.test(expect._identical(expected, actual))) return;
- let msg = expect.Expect._getMessage(reason);
- expect.Expect._fail(dart.str`Expect.identical(expected: <${expected}>, actual: <${actual}>${msg}) ` + "fails.");
- }
- static fail(msg) {
- expect.Expect._fail(dart.str`Expect.fail('${msg}')`);
- }
- static approxEquals(expected, actual, tolerance, reason) {
- if (tolerance === void 0) tolerance = null;
- if (reason === void 0) reason = null;
- if (tolerance == null) {
- tolerance = (dart.notNull(expected) / 10000.0)[dartx.abs]();
- }
- if (dart.notNull((dart.notNull(expected) - dart.notNull(actual))[dartx.abs]()) <= dart.notNull(tolerance)) return;
- let msg = expect.Expect._getMessage(reason);
- expect.Expect._fail(dart.str`Expect.approxEquals(expected:<${expected}>, actual:<${actual}>, ` + dart.str`tolerance:<${tolerance}>${msg}) fails`);
- }
- static notEquals(unexpected, actual, reason) {
- if (reason === void 0) reason = null;
- if (!dart.equals(unexpected, actual)) return;
- let msg = expect.Expect._getMessage(reason);
- expect.Expect._fail(dart.str`Expect.notEquals(unexpected: <${unexpected}>, actual:<${actual}>${msg}) ` + "fails.");
- }
- static listEquals(expected, actual, reason) {
- if (reason === void 0) reason = null;
- let msg = expect.Expect._getMessage(reason);
- let n = dart.notNull(expected[dartx.length]) < dart.notNull(actual[dartx.length]) ? expected[dartx.length] : actual[dartx.length];
- for (let i = 0; i < dart.notNull(n); i++) {
- if (!dart.equals(expected[dartx.get](i), actual[dartx.get](i))) {
- expect.Expect._fail(dart.str`Expect.listEquals(at index ${i}, ` + dart.str`expected: <${expected[dartx.get](i)}>, actual: <${actual[dartx.get](i)}>${msg}) fails`);
- }
- }
- if (expected[dartx.length] != actual[dartx.length]) {
- expect.Expect._fail('Expect.listEquals(list length, ' + dart.str`expected: <${expected[dartx.length]}>, actual: <${actual[dartx.length]}>${msg}) ` + 'fails: Next element <' + dart.str`${dart.notNull(expected[dartx.length]) > dart.notNull(n) ? expected[dartx.get](n) : actual[dartx.get](n)}>`);
- }
- }
- static mapEquals(expected, actual, reason) {
- if (reason === void 0) reason = null;
- let msg = expect.Expect._getMessage(reason);
- for (let key of expected[dartx.keys]) {
- if (!dart.test(actual[dartx.containsKey](key))) {
- expect.Expect._fail(dart.str`Expect.mapEquals(missing expected key: <${key}>${msg}) fails`);
- }
- expect.Expect.equals(expected[dartx.get](key), actual[dartx.get](key));
- }
- for (let key of actual[dartx.keys]) {
- if (!dart.test(expected[dartx.containsKey](key))) {
- expect.Expect._fail(dart.str`Expect.mapEquals(unexpected key: <${key}>${msg}) fails`);
- }
- }
- }
- static stringEquals(expected, actual, reason) {
- if (reason === void 0) reason = null;
- if (expected == actual) return;
- let msg = expect.Expect._getMessage(reason);
- let defaultMessage = dart.str`Expect.stringEquals(expected: <${expected}>", <${actual}>${msg}) fails`;
- if (expected == null || actual == null) {
- expect.Expect._fail(dart.str`${defaultMessage}`);
- }
- let left = 0;
- let right = 0;
- let eLen = expected[dartx.length];
- let aLen = actual[dartx.length];
- while (true) {
- if (left == eLen || left == aLen || expected[dartx.get](left) != actual[dartx.get](left)) {
- break;
- }
- left++;
- }
- let eRem = dart.notNull(eLen) - left;
- let aRem = dart.notNull(aLen) - left;
- while (true) {
- if (right == eRem || right == aRem || expected[dartx.get](dart.notNull(eLen) - right - 1) != actual[dartx.get](dart.notNull(aLen) - right - 1)) {
- break;
- }
- right++;
- }
- let leftSnippet = expected[dartx.substring](left < 10 ? 0 : left - 10, left);
- let rightSnippetLength = right < 10 ? right : 10;
- let rightSnippet = expected[dartx.substring](dart.notNull(eLen) - right, dart.notNull(eLen) - right + rightSnippetLength);
- let eSnippet = expected[dartx.substring](left, dart.notNull(eLen) - right);
- let aSnippet = actual[dartx.substring](left, dart.notNull(aLen) - right);
- if (dart.notNull(eSnippet[dartx.length]) > 43) {
- eSnippet = dart.notNull(eSnippet[dartx.substring](0, 20)) + "..." + dart.notNull(eSnippet[dartx.substring](dart.notNull(eSnippet[dartx.length]) - 20));
- }
- if (dart.notNull(aSnippet[dartx.length]) > 43) {
- aSnippet = dart.notNull(aSnippet[dartx.substring](0, 20)) + "..." + dart.notNull(aSnippet[dartx.substring](dart.notNull(aSnippet[dartx.length]) - 20));
- }
- let leftLead = "...";
- let rightTail = "...";
- if (left <= 10) leftLead = "";
- if (right <= 10) rightTail = "";
- let diff = dart.str`\nDiff (${left}..${dart.notNull(eLen) - right}/${dart.notNull(aLen) - right}):\n` + dart.str`${leftLead}${leftSnippet}[ ${eSnippet} ]${rightSnippet}${rightTail}\n` + dart.str`${leftLead}${leftSnippet}[ ${aSnippet} ]${rightSnippet}${rightTail}`;
- expect.Expect._fail(dart.str`${defaultMessage}${diff}`);
- }
- static setEquals(expected, actual, reason) {
- if (reason === void 0) reason = null;
- let missingSet = core.Set.from(expected);
- missingSet.removeAll(actual);
- let extraSet = core.Set.from(actual);
- extraSet.removeAll(expected);
- if (dart.test(extraSet.isEmpty) && dart.test(missingSet.isEmpty)) return;
- let msg = expect.Expect._getMessage(reason);
- let sb = new core.StringBuffer(dart.str`Expect.setEquals(${msg}) fails`);
- if (!dart.test(missingSet.isEmpty)) {
- sb.write('\nExpected collection does not contain: ');
- }
- for (let val of missingSet) {
- sb.write(dart.str`${val} `);
- }
- if (!dart.test(extraSet.isEmpty)) {
- sb.write('\nExpected collection should not contain: ');
- }
- for (let val of extraSet) {
- sb.write(dart.str`${val} `);
- }
- expect.Expect._fail(sb.toString());
- }
- static deepEquals(expected, actual) {
- if (dart.equals(expected, actual)) return;
- if (typeof expected == 'string' && typeof actual == 'string') {
- expect.Expect.stringEquals(expected, actual);
- } else if (core.Iterable.is(expected) && core.Iterable.is(actual)) {
- let expectedLength = expected[dartx.length];
- let actualLength = actual[dartx.length];
- let length = dart.notNull(expectedLength) < dart.notNull(actualLength) ? expectedLength : actualLength;
- for (let i = 0; i < dart.notNull(length); i++) {
- expect.Expect.deepEquals(expected[dartx.elementAt](i), actual[dartx.elementAt](i));
- }
- if (expectedLength != actualLength) {
- let nextElement = (dart.notNull(expectedLength) > dart.notNull(length) ? expected : actual)[dartx.elementAt](length);
- expect.Expect._fail('Expect.deepEquals(list length, ' + dart.str`expected: <${expectedLength}>, actual: <${actualLength}>) ` + dart.str`fails: Next element <${nextElement}>`);
- }
- } else if (core.Map.is(expected) && core.Map.is(actual)) {
- for (let key of expected[dartx.keys]) {
- if (!dart.test(actual[dartx.containsKey](key))) {
- expect.Expect._fail(dart.str`Expect.deepEquals(missing expected key: <${key}>) fails`);
- }
- expect.Expect.deepEquals(expected[dartx.get](key), actual[dartx.get](key));
- }
- for (let key of actual[dartx.keys]) {
- if (!dart.test(expected[dartx.containsKey](key))) {
- expect.Expect._fail(dart.str`Expect.deepEquals(unexpected key: <${key}>) fails`);
- }
- }
- } else {
- expect.Expect._fail(dart.str`Expect.deepEquals(expected: <${expected}>, actual: <${actual}>) ` + "fails.");
- }
- }
- static throws(f, check, reason) {
- if (check === void 0) check = null;
- if (reason === void 0) reason = null;
- let msg = reason == null ? "" : dart.str`(${reason})`;
- if (!expect._Nullary.is(f)) {
- expect.Expect._fail(dart.str`Expect.throws${msg}: Function f not callable with zero arguments`);
- }
- try {
- f();
- } catch (e) {
- let s = dart.stackTrace(e);
- if (check != null) {
- if (!dart.test(dart.dcall(check, e))) {
- expect.Expect._fail(dart.str`Expect.throws${msg}: Unexpected '${e}'\n${s}`);
- }
- }
- return;
- }
-
- expect.Expect._fail(dart.str`Expect.throws${msg} fails: Did not throw`);
- }
- static _getMessage(reason) {
- return reason == null ? "" : dart.str`, '${reason}'`;
- }
- static _fail(message) {
- dart.throw(new expect.ExpectException(message));
- }
- };
- dart.setSignature(expect.Expect, {
- statics: () => ({
- _truncateString: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, core.int]),
- _stringDifference: dart.definiteFunctionType(core.String, [core.String, core.String]),
- equals: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.String]),
- isTrue: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.String]),
- isFalse: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.String]),
- isNull: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.String]),
- isNotNull: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.String]),
- identical: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.String]),
- fail: dart.definiteFunctionType(dart.void, [core.String]),
- approxEquals: dart.definiteFunctionType(dart.void, [core.num, core.num], [core.num, core.String]),
- notEquals: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.String]),
- listEquals: dart.definiteFunctionType(dart.void, [core.List, core.List], [core.String]),
- mapEquals: dart.definiteFunctionType(dart.void, [core.Map, core.Map], [core.String]),
- stringEquals: dart.definiteFunctionType(dart.void, [core.String, core.String], [core.String]),
- setEquals: dart.definiteFunctionType(dart.void, [core.Iterable, core.Iterable], [core.String]),
- deepEquals: dart.definiteFunctionType(dart.void, [core.Object, core.Object]),
- throws: dart.definiteFunctionType(dart.void, [VoidTovoid()], [expect._CheckExceptionFn, core.String]),
- _getMessage: dart.definiteFunctionType(core.String, [core.String]),
- _fail: dart.definiteFunctionType(dart.void, [core.String])
- }),
- names: ['_truncateString', '_stringDifference', 'equals', 'isTrue', 'isFalse', 'isNull', 'isNotNull', 'identical', 'fail', 'approxEquals', 'notEquals', 'listEquals', 'mapEquals', 'stringEquals', 'setEquals', 'deepEquals', 'throws', '_getMessage', '_fail']
- });
- expect._identical = function(a, b) {
- return core.identical(a, b);
- };
- dart.fn(expect._identical, dynamicAnddynamicTobool());
- expect._CheckExceptionFn = dart.typedef('_CheckExceptionFn', () => dart.functionType(core.bool, [dart.dynamic]));
- expect._Nullary = dart.typedef('_Nullary', () => dart.functionType(dart.dynamic, []));
- expect.ExpectException = class ExpectException extends core.Object {
- new(message) {
- this.message = message;
- }
- toString() {
- return this.message;
- }
- };
- expect.ExpectException[dart.implements] = () => [core.Exception];
- dart.setSignature(expect.ExpectException, {
- constructors: () => ({new: dart.definiteFunctionType(expect.ExpectException, [core.String])}),
- fields: () => ({message: core.String})
- });
- expect.NoInline = class NoInline extends core.Object {
- new() {
- }
- };
- dart.setSignature(expect.NoInline, {
- constructors: () => ({new: dart.definiteFunctionType(expect.NoInline, [])})
- });
- expect.TrustTypeAnnotations = class TrustTypeAnnotations extends core.Object {
- new() {
- }
- };
- dart.setSignature(expect.TrustTypeAnnotations, {
- constructors: () => ({new: dart.definiteFunctionType(expect.TrustTypeAnnotations, [])})
- });
- expect.AssumeDynamic = class AssumeDynamic extends core.Object {
- new() {
- }
- };
- dart.setSignature(expect.AssumeDynamic, {
- constructors: () => ({new: dart.definiteFunctionType(expect.AssumeDynamic, [])})
- });
- // Exports:
- return {
- expect: expect
- };
-});
diff --git a/pkg/dev_compiler/test/codegen_expected/identity_test.js b/pkg/dev_compiler/test/codegen_expected/identity_test.js
deleted file mode 100644
index bc77a8b..0000000
--- a/pkg/dev_compiler/test/codegen_expected/identity_test.js
+++ /dev/null
@@ -1,1158 +0,0 @@
-define(['dart_sdk', 'expect'], function(dart_sdk, expect) {
- 'use strict';
- const core = dart_sdk.core;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const minitest = expect.minitest;
- const _root = Object.create(null);
- const identity_test = Object.create(_root);
- const $_equals = dartx._equals;
- const $_get = dartx._get;
- let TToT = () => (TToT = dart.constFn(dart.gFnType(T => [T, [T]])))();
- let VoidToT = () => (VoidToT = dart.constFn(dart.gFnType(T => [T, []])))();
- let VoidToNull = () => (VoidToNull = dart.constFn(dart.fnType(core.Null, [])))();
- let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.fnType(dart.dynamic, [])))();
- identity_test.Music = class Music extends core.Object {
- toString() {
- return {
- 0: "Music.country",
- 1: "Music.western"
- }[this.index];
- }
- };
- (identity_test.Music.new = function(x) {
- this.index = x;
- }).prototype = identity_test.Music.prototype;
- dart.addTypeTests(identity_test.Music);
- dart.setFieldSignature(identity_test.Music, () => ({
- __proto__: dart.getFields(identity_test.Music.__proto__),
- index: dart.finalFieldType(core.int)
- }));
- dart.defineExtensionMethods(identity_test.Music, ['toString']);
- identity_test.Music.country = dart.const(new identity_test.Music.new(0));
- identity_test.Music.western = dart.const(new identity_test.Music.new(1));
- identity_test.Music.values = dart.constList([identity_test.Music.country, identity_test.Music.western], identity_test.Music);
- identity_test.BluesBrother = class BluesBrother extends core.Object {};
- (identity_test.BluesBrother.new = function() {
- }).prototype = identity_test.BluesBrother.prototype;
- dart.addTypeTests(identity_test.BluesBrother);
- identity_test._Jake = class _Jake extends identity_test.BluesBrother {};
- (identity_test._Jake.new = function() {
- }).prototype = identity_test._Jake.prototype;
- dart.addTypeTests(identity_test._Jake);
- identity_test._Elwood = class _Elwood extends identity_test.BluesBrother {
- _equals(other) {
- if (other == null) return false;
- return identity_test._Elwood.is(other);
- }
- };
- (identity_test._Elwood.new = function() {
- }).prototype = identity_test._Elwood.prototype;
- dart.addTypeTests(identity_test._Elwood);
- dart.setMethodSignature(identity_test._Elwood, () => ({
- __proto__: dart.getMethods(identity_test._Elwood.__proto__),
- _equals: dart.fnType(core.bool, [core.Object]),
- [$_equals]: dart.fnType(core.bool, [core.Object])
- }));
- dart.defineExtensionMethods(identity_test._Elwood, ['_equals']);
- identity_test._Norman = class _Norman extends identity_test.BluesBrother {};
- (identity_test._Norman.new = function() {
- }).prototype = identity_test._Norman.prototype;
- dart.addTypeTests(identity_test._Norman);
- identity_test.hideNull = function(T, x) {
- return x;
- };
- dart.fn(identity_test.hideNull, TToT());
- identity_test.getUndefined = function(T) {
- return T._check(core.List.new(1)[$_get](0));
- };
- dart.fn(identity_test.getUndefined, VoidToT());
- identity_test.main = function() {
- minitest.group('Enum identity', dart.fn(() => {
- minitest.test('Identical enum/enum (nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(identity_test.Music, identity_test.Music.country);
- let e2 = identity_test.hideNull(identity_test.Music, identity_test.Music.western);
- let d1 = identity_test.hideNull(identity_test.Music, identity_test.Music.country);
- let d2 = identity_test.hideNull(identity_test.Music, identity_test.Music.western);
- let o1 = identity_test.hideNull(core.Object, identity_test.Music.country);
- let o2 = identity_test.hideNull(core.Object, identity_test.Music.western);
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(d1, e1), true);
- minitest.expect(core.identical(d1, d1), true);
- minitest.expect(core.identical(d1, o1), true);
- minitest.expect(core.identical(d1, e2), false);
- minitest.expect(core.identical(d1, d2), false);
- minitest.expect(core.identical(d1, o2), false);
- minitest.expect(core.identical(o1, e1), true);
- minitest.expect(core.identical(o1, d1), true);
- minitest.expect(core.identical(o1, o1), true);
- minitest.expect(core.identical(o1, e2), false);
- minitest.expect(core.identical(o1, d2), false);
- minitest.expect(core.identical(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Identical enum/enum (non-null)', dart.fn(() => {
- let e1 = identity_test.Music.country;
- let e2 = identity_test.Music.western;
- let d1 = identity_test.Music.country;
- let d2 = identity_test.Music.western;
- let o1 = identity_test.Music.country;
- let o2 = identity_test.Music.western;
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1 === e1, true);
- minitest.expect(d1 === d1, true);
- minitest.expect(d1 === o1, true);
- minitest.expect(d1 === e2, false);
- minitest.expect(d1 === d2, false);
- minitest.expect(d1 === o2, false);
- minitest.expect(o1 === e1, true);
- minitest.expect(o1 === d1, true);
- minitest.expect(o1 === o1, true);
- minitest.expect(o1 === e2, false);
- minitest.expect(o1 === d2, false);
- minitest.expect(o1 === o2, false);
- }, VoidToNull()));
- minitest.test('Identical enum/other (static, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(identity_test.Music, identity_test.Music.country);
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test.BluesBrother, new identity_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(e1 == l1, false);
- minitest.expect(e1 == b1, false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(l1 == e1, false);
- minitest.expect(b1 == e1, false);
- }, VoidToNull()));
- minitest.test('Identical enum/other (static, non-null)', dart.fn(() => {
- let e1 = identity_test.Music.country;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- }, VoidToNull()));
- minitest.test('Identical enum/other (dynamic, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(identity_test.Music, identity_test.Music.country);
- let d1 = identity_test.hideNull(identity_test.Music, identity_test.Music.country);
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test._Norman, new identity_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(core.identical(l1, e1), false);
- minitest.expect(core.identical(b1, e1), false);
- minitest.expect(core.identical(d1, s1), false);
- minitest.expect(core.identical(d1, s2), false);
- minitest.expect(core.identical(d1, i1), false);
- minitest.expect(core.identical(d1, i2), false);
- minitest.expect(core.identical(d1, l1), false);
- minitest.expect(core.identical(d1, b1), false);
- minitest.expect(core.identical(s1, d1), false);
- minitest.expect(core.identical(s2, d1), false);
- minitest.expect(core.identical(i1, d1), false);
- minitest.expect(core.identical(i2, d1), false);
- minitest.expect(core.identical(l1, d1), false);
- minitest.expect(core.identical(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Identical enum/other (dynamic, non-null)', dart.fn(() => {
- let e1 = identity_test.Music.country;
- let d1 = identity_test.Music.country;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- minitest.expect(d1 === s1, false);
- minitest.expect(d1 === s2, false);
- minitest.expect(d1 === i1, false);
- minitest.expect(d1 === i2, false);
- minitest.expect(d1 === l1, false);
- minitest.expect(d1 === b1, false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1 === d1, false);
- minitest.expect(b1 === d1, false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('String identity', dart.fn(() => {
- minitest.test('Identical string/string (nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.String, "The");
- let e2 = identity_test.hideNull(core.String, "Band");
- let d1 = identity_test.hideNull(core.String, "The");
- let d2 = identity_test.hideNull(core.String, "Band");
- let o1 = identity_test.hideNull(core.Object, "The");
- let o2 = identity_test.hideNull(core.Object, "Band");
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(d1, e1), true);
- minitest.expect(core.identical(d1, d1), true);
- minitest.expect(core.identical(d1, o1), true);
- minitest.expect(core.identical(d1, e2), false);
- minitest.expect(core.identical(d1, d2), false);
- minitest.expect(core.identical(d1, o2), false);
- minitest.expect(core.identical(o1, e1), true);
- minitest.expect(core.identical(o1, d1), true);
- minitest.expect(core.identical(o1, o1), true);
- minitest.expect(core.identical(o1, e2), false);
- minitest.expect(core.identical(o1, d2), false);
- minitest.expect(core.identical(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Identical string/string (non-null)', dart.fn(() => {
- let e1 = "The";
- let e2 = "Band";
- let d1 = "The";
- let d2 = "Band";
- let o1 = "The";
- let o2 = "Band";
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1 === e1, true);
- minitest.expect(d1 === d1, true);
- minitest.expect(d1 === o1, true);
- minitest.expect(d1 === e2, false);
- minitest.expect(d1 === d2, false);
- minitest.expect(d1 === o2, false);
- minitest.expect(o1 === e1, true);
- minitest.expect(o1 === d1, true);
- minitest.expect(o1 === o1, true);
- minitest.expect(o1 === e2, false);
- minitest.expect(o1 === d2, false);
- minitest.expect(o1 === o2, false);
- }, VoidToNull()));
- minitest.test('Identical string/other (static, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.String, "The");
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test.BluesBrother, new identity_test._Norman.new());
- minitest.expect(e1 == s1, false);
- minitest.expect(e1 == s2, false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(s1 == e1, false);
- minitest.expect(s2 == e1, false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(core.identical(l1, e1), false);
- minitest.expect(core.identical(b1, e1), false);
- }, VoidToNull()));
- minitest.test('Identical string/other (static, non-null)', dart.fn(() => {
- let e1 = "The";
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- }, VoidToNull()));
- minitest.test('Identical string/other (dynamic, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.String, "The");
- let d1 = identity_test.hideNull(core.String, "The");
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test._Norman, new identity_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(core.identical(l1, e1), false);
- minitest.expect(core.identical(b1, e1), false);
- minitest.expect(core.identical(d1, s1), false);
- minitest.expect(core.identical(d1, s2), false);
- minitest.expect(core.identical(d1, i1), false);
- minitest.expect(core.identical(d1, i2), false);
- minitest.expect(core.identical(d1, l1), false);
- minitest.expect(core.identical(d1, b1), false);
- minitest.expect(core.identical(s1, d1), false);
- minitest.expect(core.identical(s2, d1), false);
- minitest.expect(core.identical(i1, d1), false);
- minitest.expect(core.identical(i2, d1), false);
- minitest.expect(core.identical(l1, d1), false);
- minitest.expect(core.identical(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Identical string/other (dynamic, non-null)', dart.fn(() => {
- let e1 = "The";
- let d1 = "The";
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- minitest.expect(d1 === s1, false);
- minitest.expect(d1 === s2, false);
- minitest.expect(d1 === i1, false);
- minitest.expect(d1 === i2, false);
- minitest.expect(d1 === l1, false);
- minitest.expect(d1 === b1, false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1 === d1, false);
- minitest.expect(b1 === d1, false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('Boolean identity', dart.fn(() => {
- minitest.test('Identical bool/bool (nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.bool, true);
- let e2 = identity_test.hideNull(core.bool, false);
- let d1 = identity_test.hideNull(core.bool, true);
- let d2 = identity_test.hideNull(core.bool, false);
- let o1 = identity_test.hideNull(core.Object, true);
- let o2 = identity_test.hideNull(core.Object, false);
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(d1, e1), true);
- minitest.expect(core.identical(d1, d1), true);
- minitest.expect(core.identical(d1, o1), true);
- minitest.expect(core.identical(d1, e2), false);
- minitest.expect(core.identical(d1, d2), false);
- minitest.expect(core.identical(d1, o2), false);
- minitest.expect(core.identical(o1, e1), true);
- minitest.expect(core.identical(o1, d1), true);
- minitest.expect(core.identical(o1, o1), true);
- minitest.expect(core.identical(o1, e2), false);
- minitest.expect(core.identical(o1, d2), false);
- minitest.expect(core.identical(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Identical bool/bool (non-null)', dart.fn(() => {
- let e1 = true;
- let e2 = false;
- let d1 = true;
- let d2 = false;
- let o1 = true;
- let o2 = false;
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1 === e1, true);
- minitest.expect(d1 === d1, true);
- minitest.expect(d1 === o1, true);
- minitest.expect(d1 === e2, false);
- minitest.expect(d1 === d2, false);
- minitest.expect(d1 === o2, false);
- minitest.expect(o1 === e1, true);
- minitest.expect(o1 === d1, true);
- minitest.expect(o1 === o1, true);
- minitest.expect(o1 === e2, false);
- minitest.expect(o1 === d2, false);
- minitest.expect(o1 === o2, false);
- }, VoidToNull()));
- minitest.test('Identical bool/other (static, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.bool, true);
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test.BluesBrother, new identity_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(core.identical(l1, e1), false);
- minitest.expect(core.identical(b1, e1), false);
- }, VoidToNull()));
- minitest.test('Identical bool/other (static, non-null)', dart.fn(() => {
- let e1 = true;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- }, VoidToNull()));
- minitest.test('Identical bool/other (dynamic, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.bool, true);
- let d1 = identity_test.hideNull(core.bool, true);
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test._Norman, new identity_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(core.identical(l1, e1), false);
- minitest.expect(core.identical(b1, e1), false);
- minitest.expect(core.identical(d1, s1), false);
- minitest.expect(core.identical(d1, s2), false);
- minitest.expect(core.identical(d1, i1), false);
- minitest.expect(core.identical(d1, i2), false);
- minitest.expect(core.identical(d1, l1), false);
- minitest.expect(core.identical(d1, b1), false);
- minitest.expect(core.identical(s1, d1), false);
- minitest.expect(core.identical(s2, d1), false);
- minitest.expect(core.identical(i1, d1), false);
- minitest.expect(core.identical(i2, d1), false);
- minitest.expect(core.identical(l1, d1), false);
- minitest.expect(core.identical(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Identical bool/other (dynamic, non-null)', dart.fn(() => {
- let e1 = true;
- let d1 = true;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- minitest.expect(d1 === s1, false);
- minitest.expect(d1 === s2, false);
- minitest.expect(d1 === i1, false);
- minitest.expect(d1 === i2, false);
- minitest.expect(d1 === l1, false);
- minitest.expect(d1 === b1, false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1 === d1, false);
- minitest.expect(b1 === d1, false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('String identity', dart.fn(() => {
- minitest.test('Identical string/string (nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.String, "The");
- let e2 = identity_test.hideNull(core.String, "Band");
- let d1 = identity_test.hideNull(core.String, "The");
- let d2 = identity_test.hideNull(core.String, "Band");
- let o1 = identity_test.hideNull(core.Object, "The");
- let o2 = identity_test.hideNull(core.Object, "Band");
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(d1, e1), true);
- minitest.expect(core.identical(d1, d1), true);
- minitest.expect(core.identical(d1, o1), true);
- minitest.expect(core.identical(d1, e2), false);
- minitest.expect(core.identical(d1, d2), false);
- minitest.expect(core.identical(d1, o2), false);
- minitest.expect(core.identical(o1, e1), true);
- minitest.expect(core.identical(o1, d1), true);
- minitest.expect(core.identical(o1, o1), true);
- minitest.expect(core.identical(o1, e2), false);
- minitest.expect(core.identical(o1, d2), false);
- minitest.expect(core.identical(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Identical string/string (non-null)', dart.fn(() => {
- let e1 = "The";
- let e2 = "Band";
- let d1 = "The";
- let d2 = "Band";
- let o1 = "The";
- let o2 = "Band";
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1 === e1, true);
- minitest.expect(d1 === d1, true);
- minitest.expect(d1 === o1, true);
- minitest.expect(d1 === e2, false);
- minitest.expect(d1 === d2, false);
- minitest.expect(d1 === o2, false);
- minitest.expect(o1 === e1, true);
- minitest.expect(o1 === d1, true);
- minitest.expect(o1 === o1, true);
- minitest.expect(o1 === e2, false);
- minitest.expect(o1 === d2, false);
- minitest.expect(o1 === o2, false);
- }, VoidToNull()));
- minitest.test('Identical string/other (static, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.String, "The");
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test.BluesBrother, new identity_test._Norman.new());
- minitest.expect(e1 == s1, false);
- minitest.expect(e1 == s2, false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(s1 == e1, false);
- minitest.expect(s2 == e1, false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(core.identical(l1, e1), false);
- minitest.expect(core.identical(b1, e1), false);
- }, VoidToNull()));
- minitest.test('Identical string/other (static, non-null)', dart.fn(() => {
- let e1 = "The";
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- }, VoidToNull()));
- minitest.test('Identical string/other (dynamic, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.String, "The");
- let d1 = identity_test.hideNull(core.String, "The");
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test._Norman, new identity_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(core.identical(l1, e1), false);
- minitest.expect(core.identical(b1, e1), false);
- minitest.expect(core.identical(d1, s1), false);
- minitest.expect(core.identical(d1, s2), false);
- minitest.expect(core.identical(d1, i1), false);
- minitest.expect(core.identical(d1, i2), false);
- minitest.expect(core.identical(d1, l1), false);
- minitest.expect(core.identical(d1, b1), false);
- minitest.expect(core.identical(s1, d1), false);
- minitest.expect(core.identical(s2, d1), false);
- minitest.expect(core.identical(i1, d1), false);
- minitest.expect(core.identical(i2, d1), false);
- minitest.expect(core.identical(l1, d1), false);
- minitest.expect(core.identical(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Identical string/other (dynamic, non-null)', dart.fn(() => {
- let e1 = "The";
- let d1 = "The";
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- minitest.expect(d1 === s1, false);
- minitest.expect(d1 === s2, false);
- minitest.expect(d1 === i1, false);
- minitest.expect(d1 === i2, false);
- minitest.expect(d1 === l1, false);
- minitest.expect(d1 === b1, false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1 === d1, false);
- minitest.expect(b1 === d1, false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('Number identity', dart.fn(() => {
- minitest.test('Identical int/int (nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.int, 11);
- let e2 = identity_test.hideNull(core.int, 12);
- let d1 = identity_test.hideNull(core.int, 11);
- let d2 = identity_test.hideNull(core.int, 12);
- let o1 = identity_test.hideNull(core.Object, 11);
- let o2 = identity_test.hideNull(core.Object, 12);
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(d1, e1), true);
- minitest.expect(core.identical(d1, d1), true);
- minitest.expect(core.identical(d1, o1), true);
- minitest.expect(core.identical(d1, e2), false);
- minitest.expect(core.identical(d1, d2), false);
- minitest.expect(core.identical(d1, o2), false);
- minitest.expect(core.identical(o1, e1), true);
- minitest.expect(core.identical(o1, d1), true);
- minitest.expect(core.identical(o1, o1), true);
- minitest.expect(core.identical(o1, e2), false);
- minitest.expect(core.identical(o1, d2), false);
- minitest.expect(core.identical(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Identical int/int (non-null)', dart.fn(() => {
- let e1 = 11;
- let e2 = 12;
- let d1 = 11;
- let d2 = 12;
- let o1 = 11;
- let o2 = 12;
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1 === e1, true);
- minitest.expect(d1 === d1, true);
- minitest.expect(d1 === o1, true);
- minitest.expect(d1 === e2, false);
- minitest.expect(d1 === d2, false);
- minitest.expect(d1 === o2, false);
- minitest.expect(o1 === e1, true);
- minitest.expect(o1 === d1, true);
- minitest.expect(o1 === o1, true);
- minitest.expect(o1 === e2, false);
- minitest.expect(o1 === d2, false);
- minitest.expect(o1 === o2, false);
- }, VoidToNull()));
- minitest.test('Identical int/other (static, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.int, 11);
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test.BluesBrother, new identity_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(e1 == i1, false);
- minitest.expect(e1 == i2, false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(i1 == e1, false);
- minitest.expect(i2 == e1, false);
- minitest.expect(core.identical(l1, e1), false);
- minitest.expect(core.identical(b1, e1), false);
- }, VoidToNull()));
- minitest.test('Identical int/other (static, non-null)', dart.fn(() => {
- let e1 = 11;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- }, VoidToNull()));
- minitest.test('Identical int/other (dynamic, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(core.int, 11);
- let d1 = identity_test.hideNull(core.int, 11);
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test._Norman, new identity_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(core.identical(l1, e1), false);
- minitest.expect(core.identical(b1, e1), false);
- minitest.expect(core.identical(d1, s1), false);
- minitest.expect(core.identical(d1, s2), false);
- minitest.expect(core.identical(d1, i1), false);
- minitest.expect(core.identical(d1, i2), false);
- minitest.expect(core.identical(d1, l1), false);
- minitest.expect(core.identical(d1, b1), false);
- minitest.expect(core.identical(s1, d1), false);
- minitest.expect(core.identical(s2, d1), false);
- minitest.expect(core.identical(i1, d1), false);
- minitest.expect(core.identical(i2, d1), false);
- minitest.expect(core.identical(l1, d1), false);
- minitest.expect(core.identical(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Identical int/other (dynamic, non-null)', dart.fn(() => {
- let e1 = 11;
- let d1 = 11;
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- minitest.expect(d1 === s1, false);
- minitest.expect(d1 === s2, false);
- minitest.expect(d1 === i1, false);
- minitest.expect(d1 === i2, false);
- minitest.expect(d1 === l1, false);
- minitest.expect(d1 === b1, false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1 === d1, false);
- minitest.expect(b1 === d1, false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('Object identity', dart.fn(() => {
- minitest.test('Identical object/object (nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(identity_test._Jake, new identity_test._Jake.new());
- let e2 = identity_test.hideNull(identity_test._Elwood, new identity_test._Elwood.new());
- let d1 = identity_test.hideNull(identity_test._Jake, e1);
- let d2 = identity_test.hideNull(identity_test._Elwood, new identity_test._Elwood.new());
- let o1 = identity_test.hideNull(core.Object, e1);
- let o2 = identity_test.hideNull(core.Object, new identity_test._Elwood.new());
- minitest.expect(e1 == e1, true);
- minitest.expect(core.identical(e1, d1), true);
- minitest.expect(core.identical(e1, o1), true);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(e1, o2), false);
- minitest.expect(core.identical(e1, d2), false);
- minitest.expect(e1 == e2, false);
- minitest.expect(core.identical(d1, e1), true);
- minitest.expect(core.identical(d1, d1), true);
- minitest.expect(core.identical(d1, o1), true);
- minitest.expect(core.identical(d1, e2), false);
- minitest.expect(core.identical(d1, d2), false);
- minitest.expect(core.identical(d1, o2), false);
- minitest.expect(core.identical(o1, e1), true);
- minitest.expect(core.identical(o1, d1), true);
- minitest.expect(core.identical(o1, o1), true);
- minitest.expect(core.identical(o1, e2), false);
- minitest.expect(core.identical(o1, d2), false);
- minitest.expect(core.identical(o1, o2), false);
- }, VoidToNull()));
- minitest.test('Identical object/object (non-null)', dart.fn(() => {
- let e1 = new identity_test._Jake.new();
- let e2 = new identity_test._Elwood.new();
- let d1 = e1;
- let d2 = new identity_test._Elwood.new();
- let o1 = e1;
- let o2 = new identity_test._Elwood.new();
- minitest.expect(e1 === e1, true);
- minitest.expect(e1 === d1, true);
- minitest.expect(e1 === o1, true);
- minitest.expect(e1 === e2, false);
- minitest.expect(e1 === o2, false);
- minitest.expect(e1 === d2, false);
- minitest.expect(e1 === e2, false);
- minitest.expect(d1 === e1, true);
- minitest.expect(d1 === d1, true);
- minitest.expect(d1 === o1, true);
- minitest.expect(d1 === e2, false);
- minitest.expect(d1 === d2, false);
- minitest.expect(d1 === o2, false);
- minitest.expect(o1 === e1, true);
- minitest.expect(o1 === d1, true);
- minitest.expect(o1 === o1, true);
- minitest.expect(o1 === e2, false);
- minitest.expect(o1 === d2, false);
- minitest.expect(o1 === o2, false);
- }, VoidToNull()));
- minitest.test('Identical object/other (static, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(identity_test._Jake, new identity_test._Jake.new());
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test.BluesBrother, new identity_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(e1 == l1, false);
- minitest.expect(e1 == b1, false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(l1 == e1, false);
- minitest.expect(b1 == e1, false);
- }, VoidToNull()));
- minitest.test('Identical object/other (static, non-null)', dart.fn(() => {
- let e1 = new identity_test._Jake.new();
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- }, VoidToNull()));
- minitest.test('Identical object/other (dynamic, nullable)', dart.fn(() => {
- let e1 = identity_test.hideNull(identity_test._Jake, new identity_test._Jake.new());
- let d1 = identity_test.hideNull(identity_test._Jake, new identity_test._Jake.new());
- let s1 = identity_test.hideNull(core.String, "hello");
- let s2 = identity_test.hideNull(core.String, "");
- let i1 = identity_test.hideNull(core.int, 3);
- let i2 = identity_test.hideNull(core.int, 0);
- let l1 = identity_test.hideNull(core.List, core.List.new(3));
- let b1 = identity_test.hideNull(identity_test._Norman, new identity_test._Norman.new());
- minitest.expect(core.identical(e1, s1), false);
- minitest.expect(core.identical(e1, s2), false);
- minitest.expect(core.identical(e1, i1), false);
- minitest.expect(core.identical(e1, i2), false);
- minitest.expect(core.identical(e1, l1), false);
- minitest.expect(core.identical(e1, b1), false);
- minitest.expect(core.identical(s1, e1), false);
- minitest.expect(core.identical(s2, e1), false);
- minitest.expect(core.identical(i1, e1), false);
- minitest.expect(core.identical(i2, e1), false);
- minitest.expect(core.identical(l1, e1), false);
- minitest.expect(core.identical(b1, e1), false);
- minitest.expect(core.identical(d1, s1), false);
- minitest.expect(core.identical(d1, s2), false);
- minitest.expect(core.identical(d1, i1), false);
- minitest.expect(core.identical(d1, i2), false);
- minitest.expect(core.identical(d1, l1), false);
- minitest.expect(core.identical(d1, b1), false);
- minitest.expect(core.identical(s1, d1), false);
- minitest.expect(core.identical(s2, d1), false);
- minitest.expect(core.identical(i1, d1), false);
- minitest.expect(core.identical(i2, d1), false);
- minitest.expect(core.identical(l1, d1), false);
- minitest.expect(core.identical(b1, d1), false);
- }, VoidToNull()));
- minitest.test('Identical object/other (dynamic, non-null)', dart.fn(() => {
- let e1 = new identity_test._Jake.new();
- let d1 = new identity_test._Jake.new();
- let s1 = "hello";
- let s2 = "";
- let i1 = 3;
- let i2 = 0;
- let l1 = core.List.new(3);
- let b1 = new identity_test._Norman.new();
- minitest.expect(e1 === s1, false);
- minitest.expect(e1 === s2, false);
- minitest.expect(e1 === i1, false);
- minitest.expect(e1 === i2, false);
- minitest.expect(e1 === l1, false);
- minitest.expect(e1 === b1, false);
- minitest.expect(s1 === e1, false);
- minitest.expect(s2 === e1, false);
- minitest.expect(i1 === e1, false);
- minitest.expect(i2 === e1, false);
- minitest.expect(l1 === e1, false);
- minitest.expect(b1 === e1, false);
- minitest.expect(d1 === s1, false);
- minitest.expect(d1 === s2, false);
- minitest.expect(d1 === i1, false);
- minitest.expect(d1 === i2, false);
- minitest.expect(d1 === l1, false);
- minitest.expect(d1 === b1, false);
- minitest.expect(s1 === d1, false);
- minitest.expect(s2 === d1, false);
- minitest.expect(i1 === d1, false);
- minitest.expect(i2 === d1, false);
- minitest.expect(l1 === d1, false);
- minitest.expect(b1 === d1, false);
- }, VoidToNull()));
- }, VoidToNull()));
- minitest.group('Null/undefined identity', dart.fn(() => {
- minitest.test('Identical object/other (static, null)', dart.fn(() => {
- let n = identity_test.hideNull(identity_test.BluesBrother, null);
- let u1 = identity_test.getUndefined(core.String);
- let u2 = identity_test.getUndefined(core.int);
- let u3 = identity_test.getUndefined(core.bool);
- let u4 = identity_test.getUndefined(core.List);
- minitest.expect(n == n, true);
- minitest.expect(core.identical(n, u1), true);
- minitest.expect(core.identical(n, u2), true);
- minitest.expect(core.identical(n, u3), true);
- minitest.expect(n == u4, true);
- minitest.expect(core.identical(u1, n), true);
- minitest.expect(core.identical(u2, n), true);
- minitest.expect(core.identical(u3, n), true);
- minitest.expect(u4 == n, true);
- }, VoidToNull()));
- minitest.test('Identical String/other (static, null)', dart.fn(() => {
- let u1 = identity_test.getUndefined(identity_test.BluesBrother);
- let n = identity_test.hideNull(core.String, null);
- let u2 = identity_test.getUndefined(core.int);
- let u3 = identity_test.getUndefined(core.bool);
- let u4 = identity_test.getUndefined(core.List);
- minitest.expect(n == n, true);
- minitest.expect(core.identical(n, u1), true);
- minitest.expect(core.identical(n, u2), true);
- minitest.expect(core.identical(n, u3), true);
- minitest.expect(core.identical(n, u4), true);
- minitest.expect(core.identical(u1, n), true);
- minitest.expect(core.identical(u2, n), true);
- minitest.expect(core.identical(u3, n), true);
- minitest.expect(core.identical(u4, n), true);
- }, VoidToNull()));
- minitest.test('Identical int/other (static, null)', dart.fn(() => {
- let u1 = identity_test.getUndefined(identity_test.BluesBrother);
- let u2 = identity_test.getUndefined(core.String);
- let n = identity_test.hideNull(core.int, null);
- let u3 = identity_test.getUndefined(core.bool);
- let u4 = identity_test.getUndefined(core.List);
- minitest.expect(n == n, true);
- minitest.expect(core.identical(n, u1), true);
- minitest.expect(core.identical(n, u2), true);
- minitest.expect(core.identical(n, u3), true);
- minitest.expect(core.identical(n, u4), true);
- minitest.expect(core.identical(u1, n), true);
- minitest.expect(core.identical(u2, n), true);
- minitest.expect(core.identical(u3, n), true);
- minitest.expect(core.identical(u4, n), true);
- }, VoidToNull()));
- minitest.test('Identical bool/other (static, null)', dart.fn(() => {
- let u1 = identity_test.getUndefined(identity_test.BluesBrother);
- let u2 = identity_test.getUndefined(core.String);
- let u3 = identity_test.getUndefined(core.int);
- let n = identity_test.hideNull(core.bool, null);
- let u4 = identity_test.getUndefined(core.List);
- minitest.expect(n == n, true);
- minitest.expect(core.identical(n, u1), true);
- minitest.expect(core.identical(n, u2), true);
- minitest.expect(core.identical(n, u3), true);
- minitest.expect(core.identical(n, u4), true);
- minitest.expect(core.identical(u1, n), true);
- minitest.expect(core.identical(u2, n), true);
- minitest.expect(core.identical(u3, n), true);
- minitest.expect(core.identical(u4, n), true);
- }, VoidToNull()));
- minitest.test('Identical List/other (static, null)', dart.fn(() => {
- let u1 = identity_test.getUndefined(identity_test.BluesBrother);
- let u2 = identity_test.getUndefined(core.String);
- let u3 = identity_test.getUndefined(core.int);
- let u4 = identity_test.getUndefined(core.bool);
- let n = identity_test.hideNull(core.List, null);
- minitest.expect(n == n, true);
- minitest.expect(n == u1, true);
- minitest.expect(core.identical(n, u2), true);
- minitest.expect(core.identical(n, u3), true);
- minitest.expect(core.identical(n, u4), true);
- minitest.expect(u1 == n, true);
- minitest.expect(core.identical(u2, n), true);
- minitest.expect(core.identical(u3, n), true);
- minitest.expect(core.identical(u4, n), true);
- }, VoidToNull()));
- }, VoidToNull()));
- };
- dart.fn(identity_test.main, VoidTodynamic());
- dart.trackLibraries("identity_test", {
- "identity_test.dart": identity_test
- }, null);
- // Exports:
- return {
- identity_test: identity_test
- };
-});
diff --git a/pkg/dev_compiler/test/codegen_expected/map_keys.js b/pkg/dev_compiler/test/codegen_expected/map_keys.js
deleted file mode 100644
index 1e4b655..0000000
--- a/pkg/dev_compiler/test/codegen_expected/map_keys.js
+++ /dev/null
@@ -1,31 +0,0 @@
-define(['dart_sdk'], function(dart_sdk) {
- 'use strict';
- const core = dart_sdk.core;
- const _js_helper = dart_sdk._js_helper;
- const math = dart_sdk.math;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const _root = Object.create(null);
- const map_keys = Object.create(_root);
- let IdentityMapOfString$int = () => (IdentityMapOfString$int = dart.constFn(_js_helper.IdentityMap$(core.String, core.int)))();
- let IdentityMapOfint$int = () => (IdentityMapOfint$int = dart.constFn(_js_helper.IdentityMap$(core.int, core.int)))();
- let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.fnType(dart.dynamic, [])))();
- map_keys.main = function() {
- core.print(new (IdentityMapOfString$int()).from(['1', 2, '3', 4, '5', 6]));
- core.print(new (IdentityMapOfint$int()).from([1, 2, 3, 4, 5, 6]));
- core.print(new (IdentityMapOfString$int()).from(['1', 2, dart.str`${dart.notNull(math.Random.new().nextInt(2)) + 2}`, 4, '5', 6]));
- let x = '3';
- core.print(new (IdentityMapOfString$int()).from(['1', 2, x, 4, '5', 6]));
- core.print(new (IdentityMapOfString$int()).from(['1', 2, null, 4, '5', 6]));
- };
- dart.fn(map_keys.main, VoidTodynamic());
- dart.trackLibraries("map_keys", {
- "map_keys.dart": map_keys
- }, null);
- // Exports:
- return {
- map_keys: map_keys
- };
-});
-
-//# sourceMappingURL=map_keys.js.map
diff --git a/pkg/dev_compiler/test/codegen_expected/map_keys.js.map b/pkg/dev_compiler/test/codegen_expected/map_keys.js.map
deleted file mode 100644
index 149356b..0000000
--- a/pkg/dev_compiler/test/codegen_expected/map_keys.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sourceRoot":"","sources":["../../gen/codegen_tests/map_keys.dart"],"names":["print","x"],"mappings":";;;;;;;;;;;;kBAMI,WAAG;AAEL,IAAA,AAAAA,UAAK,CAAC,sCAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC,CAAC;AACjC,AACE,IAAA,AAAAA,UAAK,CAAC,mCAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,CAAC;AAC3B,AACE,IAAA,AAAAA,UAAK,CAAC,sCAAC,GAAG,EAAE,CAAC,EAAE,WAAC,aAAE,AAAA,iBAAY,SAAS,CAAC,CAAC,IAAG,CAAC,AAAC,EAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC,CAAC;AAC9D,AAAE,YAAW,GAAG;AAChB,AACE,IAAAA,AAAA,UAAK,CAAC,sCAAC,GAAG,EAAE,CAAC,EAAEC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC,CAAC;AAC/B,AACE,IAAA,AAAAD,UAAK,CAAC,sCAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC,CAAC;AAClC,GACA,AAAA","file":"map_keys.js"}
\ No newline at end of file
diff --git a/pkg/dev_compiler/test/codegen_expected/minitest.js b/pkg/dev_compiler/test/codegen_expected/minitest.js
deleted file mode 100644
index f251c5e..0000000
--- a/pkg/dev_compiler/test/codegen_expected/minitest.js
+++ /dev/null
@@ -1,229 +0,0 @@
-define(['dart_sdk', 'expect'], function(dart_sdk, expect) {
- 'use strict';
- const core = dart_sdk.core;
- const _interceptors = dart_sdk._interceptors;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const expect$ = expect.expect;
- const minitest = Object.create(null);
- let JSArrayOf_Group = () => (JSArrayOf_Group = dart.constFn(_interceptors.JSArray$(minitest._Group)))();
- let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.functionType(dart.dynamic, [])))();
- let ObjectTobool = () => (ObjectTobool = dart.constFn(dart.functionType(core.bool, [core.Object])))();
- let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
- let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
- let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
- let StringAndFnTovoid = () => (StringAndFnTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, VoidTodynamic()])))();
- let FnTovoid = () => (FnTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [VoidTodynamic()])))();
- let ObjectAndObject__Tovoid = () => (ObjectAndObject__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object, core.Object], {reason: core.String})))();
- let StringTovoid = () => (StringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))();
- let ObjectToObject = () => (ObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object])))();
- let Fn__ToObject = () => (Fn__ToObject = dart.constFn(dart.definiteFunctionType(core.Object, [ObjectTobool()], [core.String])))();
- let numAndnumToObject = () => (numAndnumToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.num, core.num])))();
- let numToObject = () => (numToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.num])))();
- minitest._Action = dart.typedef('_Action', () => dart.functionType(dart.void, []));
- minitest._ExpectationFunction = dart.typedef('_ExpectationFunction', () => dart.functionType(dart.void, [core.Object]));
- dart.defineLazy(minitest, {
- get _groups() {
- return JSArrayOf_Group().of([new minitest._Group()]);
- }
- });
- dart.defineLazy(minitest, {
- get isFalse() {
- return new minitest._Expectation(expect$.Expect.isFalse);
- }
- });
- dart.defineLazy(minitest, {
- get isNotNull() {
- return new minitest._Expectation(expect$.Expect.isNotNull);
- }
- });
- dart.defineLazy(minitest, {
- get isNull() {
- return new minitest._Expectation(expect$.Expect.isNull);
- }
- });
- dart.defineLazy(minitest, {
- get isTrue() {
- return new minitest._Expectation(expect$.Expect.isTrue);
- }
- });
- dart.defineLazy(minitest, {
- get returnsNormally() {
- return new minitest._Expectation(dart.fn(actual => {
- try {
- minitest._Action.as(actual)();
- } catch (error) {
- expect$.Expect.fail(dart.str`Expected function to return normally, but threw:\n${error}`);
- }
-
- }, ObjectTovoid()));
- }
- });
- dart.defineLazy(minitest, {
- get throws() {
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.throws(minitest._Action.as(actual));
- }, ObjectTovoid()));
- }
- });
- dart.defineLazy(minitest, {
- get throwsArgumentError() {
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.throws(minitest._Action.as(actual), dart.fn(error => core.ArgumentError.is(error), dynamicTobool()));
- }, ObjectTovoid()));
- }
- });
- dart.defineLazy(minitest, {
- get throwsNoSuchMethodError() {
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.throws(minitest._Action.as(actual), dart.fn(error => core.NoSuchMethodError.is(error), dynamicTobool()));
- }, ObjectTovoid()));
- }
- });
- dart.defineLazy(minitest, {
- get throwsRangeError() {
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.throws(minitest._Action.as(actual), dart.fn(error => core.RangeError.is(error), dynamicTobool()));
- }, ObjectTovoid()));
- }
- });
- dart.defineLazy(minitest, {
- get throwsStateError() {
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.throws(minitest._Action.as(actual), dart.fn(error => core.StateError.is(error), dynamicTobool()));
- }, ObjectTovoid()));
- }
- });
- dart.defineLazy(minitest, {
- get throwsUnsupportedError() {
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.throws(minitest._Action.as(actual), dart.fn(error => core.UnsupportedError.is(error), dynamicTobool()));
- }, ObjectTovoid()));
- }
- });
- minitest.finishTests = function() {
- minitest._groups[dartx.clear]();
- minitest._groups[dartx.add](new minitest._Group());
- };
- dart.fn(minitest.finishTests, VoidTovoid());
- minitest.group = function(description, body) {
- minitest._groups[dartx.add](new minitest._Group());
- try {
- body();
- } finally {
- minitest._groups[dartx.removeLast]();
- }
- };
- dart.fn(minitest.group, StringAndFnTovoid());
- minitest.test = function(description, body) {
- for (let group of minitest._groups) {
- if (group.setUpFunction != null) group.setUpFunction();
- }
- try {
- body();
- } finally {
- for (let i = dart.notNull(minitest._groups[dartx.length]) - 1; i >= 0; i--) {
- let group = minitest._groups[dartx.get](i);
- if (group.tearDownFunction != null) group.tearDownFunction();
- }
- }
- };
- dart.fn(minitest.test, StringAndFnTovoid());
- minitest.setUp = function(body) {
- dart.assert(minitest._groups[dartx.last].setUpFunction == null);
- minitest._groups[dartx.last].setUpFunction = body;
- };
- dart.fn(minitest.setUp, FnTovoid());
- minitest.tearDown = function(body) {
- dart.assert(minitest._groups[dartx.last].tearDownFunction == null);
- minitest._groups[dartx.last].tearDownFunction = body;
- };
- dart.fn(minitest.tearDown, FnTovoid());
- minitest.expect = function(actual, expected, opts) {
- let reason = opts && 'reason' in opts ? opts.reason : null;
- if (!minitest._Expectation.is(expected)) {
- expected = minitest.equals(expected);
- }
- let expectation = minitest._Expectation.as(expected);
- expectation.function(actual);
- };
- dart.fn(minitest.expect, ObjectAndObject__Tovoid());
- minitest.fail = function(message) {
- expect$.Expect.fail(message);
- };
- dart.fn(minitest.fail, StringTovoid());
- minitest.equals = function(value) {
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.deepEquals(value, actual);
- }, ObjectTovoid()));
- };
- dart.fn(minitest.equals, ObjectToObject());
- minitest.notEquals = function(value) {
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.notEquals(value, actual);
- }, ObjectTovoid()));
- };
- dart.fn(minitest.notEquals, ObjectToObject());
- minitest.unorderedEquals = function(value) {
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.setEquals(core.Iterable._check(value), core.Iterable._check(actual));
- }, ObjectTovoid()));
- };
- dart.fn(minitest.unorderedEquals, ObjectToObject());
- minitest.predicate = function(fn, description) {
- if (description === void 0) description = null;
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.isTrue(fn(actual));
- }, ObjectTovoid()));
- };
- dart.fn(minitest.predicate, Fn__ToObject());
- minitest.inInclusiveRange = function(min, max) {
- return new minitest._Expectation(dart.fn(actual => {
- let actualNum = core.num.as(actual);
- if (dart.notNull(actualNum) < dart.notNull(min) || dart.notNull(actualNum) > dart.notNull(max)) {
- minitest.fail(dart.str`Expected ${actualNum} to be in the inclusive range [${min}, ${max}].`);
- }
- }, ObjectTovoid()));
- };
- dart.fn(minitest.inInclusiveRange, numAndnumToObject());
- minitest.greaterThan = function(value) {
- return new minitest._Expectation(dart.fn(actual => {
- let actualNum = core.num.as(actual);
- if (dart.notNull(actualNum) <= dart.notNull(value)) {
- minitest.fail(dart.str`Expected ${actualNum} to be greater than ${value}.`);
- }
- }, ObjectTovoid()));
- };
- dart.fn(minitest.greaterThan, numToObject());
- minitest.same = function(value) {
- return new minitest._Expectation(dart.fn(actual => {
- expect$.Expect.identical(value, actual);
- }, ObjectTovoid()));
- };
- dart.fn(minitest.same, ObjectToObject());
- minitest._Group = class _Group extends core.Object {
- new() {
- this.setUpFunction = null;
- this.tearDownFunction = null;
- }
- };
- dart.setSignature(minitest._Group, {
- fields: () => ({
- setUpFunction: minitest._Action,
- tearDownFunction: minitest._Action
- })
- });
- minitest._Expectation = class _Expectation extends core.Object {
- new(func) {
- this.function = func;
- }
- };
- dart.setSignature(minitest._Expectation, {
- constructors: () => ({new: dart.definiteFunctionType(minitest._Expectation, [minitest._ExpectationFunction])}),
- fields: () => ({function: minitest._ExpectationFunction})
- });
- // Exports:
- return {
- minitest: minitest
- };
-});
diff --git a/pkg/dev_compiler/test/codegen_expected/node_modules.js b/pkg/dev_compiler/test/codegen_expected/node_modules.js
deleted file mode 100644
index 9b4c57e..0000000
--- a/pkg/dev_compiler/test/codegen_expected/node_modules.js
+++ /dev/null
@@ -1,78 +0,0 @@
-'use strict';
-const dart_sdk = require('dart_sdk');
-const core = dart_sdk.core;
-const dart = dart_sdk.dart;
-const dartx = dart_sdk.dartx;
-const _root = Object.create(null);
-const node_modules = Object.create(_root);
-let B = () => (B = dart.constFn(node_modules.B$()))();
-let _B = () => (_B = dart.constFn(node_modules._B$()))();
-let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.fnType(dart.dynamic, [])))();
-let VoidToString = () => (VoidToString = dart.constFn(dart.fnType(core.String, [])))();
-node_modules.Callback = dart.typedef('Callback', () => dart.fnTypeFuzzy(dart.void, [], {i: core.int}));
-node_modules.A = class A extends core.Object {};
-(node_modules.A.new = function() {
-}).prototype = node_modules.A.prototype;
-dart.addTypeTests(node_modules.A);
-node_modules._A = class _A extends core.Object {};
-(node_modules._A.new = function() {
-}).prototype = node_modules._A.prototype;
-dart.addTypeTests(node_modules._A);
-const _is_B_default = Symbol('_is_B_default');
-node_modules.B$ = dart.generic(T => {
- class B extends core.Object {}
- (B.new = function() {
- }).prototype = B.prototype;
- dart.addTypeTests(B);
- B.prototype[_is_B_default] = true;
- return B;
-});
-node_modules.B = B();
-dart.addTypeTests(node_modules.B, _is_B_default);
-const _is__B_default = Symbol('_is__B_default');
-node_modules._B$ = dart.generic(T => {
- class _B extends core.Object {}
- (_B.new = function() {
- }).prototype = _B.prototype;
- dart.addTypeTests(_B);
- _B.prototype[_is__B_default] = true;
- return _B;
-});
-node_modules._B = _B();
-dart.addTypeTests(node_modules._B, _is__B_default);
-node_modules.f = function() {
-};
-dart.fn(node_modules.f, VoidTodynamic());
-node_modules._f = function() {
-};
-dart.fn(node_modules._f, VoidTodynamic());
-dart.defineLazy(node_modules, {
- get constant() {
- return "abc";
- },
- get finalConstant() {
- return "abc";
- },
- get lazy() {
- return dart.fn(() => {
- core.print('lazy');
- return "abc";
- }, VoidToString())();
- },
- get mutable() {
- return "abc";
- },
- set mutable(_) {},
- get lazyMutable() {
- return dart.fn(() => {
- core.print('lazyMutable');
- return "abc";
- }, VoidToString())();
- },
- set lazyMutable(_) {}
-});
-dart.trackLibraries("node_modules", {
- "node_modules.dart": node_modules
-}, null);
-// Exports:
-exports.node_modules = node_modules;
diff --git a/pkg/dev_compiler/test/codegen_expected/script.js b/pkg/dev_compiler/test/codegen_expected/script.js
deleted file mode 100644
index f8541f7..0000000
--- a/pkg/dev_compiler/test/codegen_expected/script.js
+++ /dev/null
@@ -1,24 +0,0 @@
-define(['dart_sdk'], function(dart_sdk) {
- 'use strict';
- const core = dart_sdk.core;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const _root = Object.create(null);
- const script = Object.create(_root);
- const $join = dartx.join;
- let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))();
- let ListOfStringTovoid = () => (ListOfStringTovoid = dart.constFn(dart.fnType(dart.void, [ListOfString()])))();
- script.main = function(args) {
- let name = args[$join](' ');
- if (name === '') name = 'world';
- core.print(dart.str`hello ${name}`);
- };
- dart.fn(script.main, ListOfStringTovoid());
- dart.trackLibraries("script", {
- "script.dart": script
- }, null);
- // Exports:
- return {
- script: script
- };
-});
diff --git a/pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js b/pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js
deleted file mode 100644
index ed69422..0000000
--- a/pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js
+++ /dev/null
@@ -1,193 +0,0 @@
-define(['dart_sdk'], function(dart_sdk) {
- 'use strict';
- const core = dart_sdk.core;
- const html = dart_sdk.html;
- const math = dart_sdk.math;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const _root = Object.create(null);
- const sunflower = Object.create(_root);
- const circle = Object.create(_root);
- const painter = Object.create(_root);
- const $getContext = dartx.getContext;
- const $addEventListener = dartx.addEventListener;
- const $text = dartx.text;
- const $arc = dartx.arc;
- const $fill = dartx.fill;
- let StringToElement = () => (StringToElement = dart.constFn(dart.fnType(html.Element, [core.String])))();
- let EventTovoid = () => (EventTovoid = dart.constFn(dart.fnType(dart.void, [html.Event])))();
- let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.fnType(dart.void, [])))();
- dart.defineLazy(sunflower, {
- get SEED_RADIUS() {
- return 2;
- },
- get SCALE_FACTOR() {
- return 4;
- },
- get MAX_D() {
- return 300;
- },
- get centerX() {
- return 300 / 2;
- },
- get centerY() {
- return sunflower.centerX;
- }
- });
- sunflower.querySelector = function(selector) {
- return html.document.querySelector(selector);
- };
- dart.fn(sunflower.querySelector, StringToElement());
- dart.defineLazy(sunflower, {
- get canvas() {
- return html.CanvasElement.as(sunflower.querySelector("#canvas"));
- },
- get context() {
- return html.CanvasRenderingContext2D.as(sunflower.canvas[$getContext]('2d'));
- },
- get slider() {
- return html.InputElement.as(sunflower.querySelector("#slider"));
- },
- get notes() {
- return sunflower.querySelector("#notes");
- },
- get PHI() {
- return (math.sqrt(5) + 1) / 2;
- },
- get seeds() {
- return 0;
- },
- set seeds(_) {}
- });
- sunflower.main = function() {
- sunflower.slider[$addEventListener]('change', dart.fn(e => sunflower.draw(), EventTovoid()));
- sunflower.draw();
- };
- dart.fn(sunflower.main, VoidTovoid());
- sunflower.draw = function() {
- sunflower.seeds = core.int.parse(sunflower.slider.value);
- sunflower.context.clearRect(0, 0, 300, 300);
- for (let i = 0; i < dart.notNull(sunflower.seeds); i++) {
- let theta = i * painter.TAU / dart.notNull(sunflower.PHI);
- let r = math.sqrt(i) * 4;
- let x = sunflower.centerX + r * math.cos(theta);
- let y = sunflower.centerY - r * math.sin(theta);
- new sunflower.SunflowerSeed.new(x, y, 2).draw(sunflower.context);
- }
- sunflower.notes[$text] = dart.str`${sunflower.seeds} seeds`;
- };
- dart.fn(sunflower.draw, VoidTovoid());
- circle.Circle = class Circle extends core.Object {
- get x() {
- return this[x$];
- }
- set x(value) {
- super.x = value;
- }
- get y() {
- return this[y$];
- }
- set y(value) {
- super.y = value;
- }
- get radius() {
- return this[radius$];
- }
- set radius(value) {
- super.radius = value;
- }
- };
- (circle.Circle.new = function(x, y, radius) {
- this[x$] = x;
- this[y$] = y;
- this[radius$] = radius;
- }).prototype = circle.Circle.prototype;
- dart.addTypeTests(circle.Circle);
- const x$ = Symbol("Circle.x");
- const y$ = Symbol("Circle.y");
- const radius$ = Symbol("Circle.radius");
- dart.setFieldSignature(circle.Circle, () => ({
- __proto__: dart.getFields(circle.Circle.__proto__),
- x: dart.finalFieldType(core.num),
- y: dart.finalFieldType(core.num),
- radius: dart.finalFieldType(core.num)
- }));
- painter.CirclePainter = class CirclePainter extends core.Object {
- get color() {
- return this[color];
- }
- set color(value) {
- this[color] = value;
- }
- draw(context) {
- context.beginPath();
- context.lineWidth = 2;
- context.fillStyle = this.color;
- context.strokeStyle = this.color;
- context[$arc](this.x, this.y, this.radius, 0, painter.TAU, false);
- context[$fill]();
- context.closePath();
- context.stroke();
- }
- };
- (painter.CirclePainter.new = function() {
- this[color] = "orange";
- }).prototype = painter.CirclePainter.prototype;
- dart.addTypeTests(painter.CirclePainter);
- const color = Symbol("CirclePainter.color");
- painter.CirclePainter[dart.implements] = () => [circle.Circle];
- dart.setMethodSignature(painter.CirclePainter, () => ({
- __proto__: dart.getMethods(painter.CirclePainter.__proto__),
- draw: dart.fnType(dart.void, [html.CanvasRenderingContext2D])
- }));
- dart.setFieldSignature(painter.CirclePainter, () => ({
- __proto__: dart.getFields(painter.CirclePainter.__proto__),
- color: dart.fieldType(core.String)
- }));
- sunflower.SunflowerSeed = class SunflowerSeed extends dart.mixin(circle.Circle, painter.CirclePainter) {};
- (sunflower.SunflowerSeed.new = function(x, y, radius, color) {
- if (color === void 0) color = null;
- sunflower.SunflowerSeed.__proto__.new.call(this, x, y, radius);
- if (color != null) this.color = color;
- }).prototype = sunflower.SunflowerSeed.prototype;
- dart.addTypeTests(sunflower.SunflowerSeed);
- dart.defineLazy(painter, {
- get ORANGE() {
- return "orange";
- },
- get RED() {
- return "red";
- },
- get BLUE() {
- return "blue";
- },
- get TAU() {
- return math.PI * 2;
- }
- });
- painter.querySelector = function(selector) {
- return html.document.querySelector(selector);
- };
- dart.fn(painter.querySelector, StringToElement());
- dart.defineLazy(painter, {
- get canvas() {
- return html.CanvasElement.as(painter.querySelector("#canvas"));
- },
- get context() {
- return html.CanvasRenderingContext2D.as(painter.canvas[$getContext]('2d'));
- }
- });
- dart.trackLibraries("sunflower", {
- "sunflower.dart": sunflower,
- "circle.dart": circle,
- "painter.dart": painter
- }, null);
- // Exports:
- return {
- sunflower: sunflower,
- circle: circle,
- painter: painter
- };
-});
-
-//# sourceMappingURL=sunflower.js.map
diff --git a/pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js.map b/pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js.map
deleted file mode 100644
index 2bcc814..0000000
--- a/pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sourceRoot":"","sources":["../../codegen/sunflower/sunflower.dart","../../codegen/sunflower/circle.dart","../../codegen/sunflower/painter.dart"],"names":["MAX_D","centerX","document","selector","querySelector","canvas","sqrt","slider","draw","seeds","context","i","TAU","PHI","SCALE_FACTOR","r","cos","theta","centerY","sin","x","y","SEED_RADIUS","notes","color","radius","ORANGE","PI"],"mappings":";;;;;;;;;;;;;;;;;;;;IAYM;YAAc,EAAC;KAAA;IACf;YAAe,EAAC;KAAA;IAChB;YAAQ,IAAG;KAAA;IACX;YAAU,AAAAA,IAAK,GAAG,CAAC,AAAA;KAAA;IACnB;YAAUC,kBAAO;KAAA;;4BAEF,SAAC,QAAe,EAAE;AAAG,UAAA,AAAAC,cAAQ,eAAeC,QAAQ,CAAC;AAAA,GAC1E,AAAA;;;IAAM;YAAS,uBAAA,AAAAC,uBAAa,CAAC,SAAS,CAAC,CAAiB;KAAA;IAClD;YAAU,kCAAA,AAAAC,gBAAM,cAAY,IAAI,CAAC,CAA4B;KAAA;IAC7D;YAAS,sBAAA,AAAAD,uBAAa,CAAC,SAAS,CAAC,CAAgB;KAAA;IACjD;YAAQ,AAAAA,wBAAa,CAAC,QAAQ,CAAC;KAAA;IAE/B;YAAM,EAAA,AAAC,AAAAE,SAAI,CAAC,CAAC,CAAC,GAAG,CAAC,AAAC,IAAG,CAAC,AAAA;KAAA;IACzB;YAAQ,EAAC;KAAA;IAAT,eAAS;;mBAEJ,WAAG;AACV,IAAA,AAAAC,gBAAM,oBAAkB,QAAQ,EAAE,QAAA,AAAC,CAAC,IAAK,AAAAC,cAAI,EAAE,AAAA,gBAAA,CAAC;AAClD,AAAE,IAAA,AAAAA,cAAI,EAAE;AACR,GACA,AAAA;;mBAES,WAAG;AACV,IAAA,AAAAC,eAAK,GAAG,eAAU,AAAAF,gBAAM,MAAM,CAAC,AAAA;AACjC,AAAE,IAAA,AAAAG,iBAAO,WAAW,CAAC,EAAE,CAAC,EAAEV,GAAK,EAAEA,GAAK,CAAC;AACvC,AAAE,SAAK,IAAI,IAAI,CAAC,AAAA,AAAA,EAAE,AAAAW,CAAC,gBAAGF,eAAK,CAAA,EAAE,AAAAE,CAAC,EAAE,EAAE;AAC9B,kBAAc,AAAA,AAAAA,CAAC,GAAGC,WAAG,AAAA,gBAAGC,aAAG,CAAA;AAC/B,AAAI,cAAU,AAAA,AAAAP,SAAI,CAACK,CAAC,CAAC,GAAGG,CAAY,AAAA;AACpC,AAAI,cAAU,AAAAb,iBAAO,GAAG,AAAAc,CAAC,GAAGC,AAAA,QAAG,CAACC,KAAK,CAAC,AAAA,AAAA;AACtC,AAAI,cAAU,AAAAC,iBAAO,GAAG,AAAAH,CAAC,GAAG,AAAAI,QAAG,CAACF,KAAK,CAAC,AAAA,AAAA;AACtC,AAAI,MAAA,AAAA,gCAAkBG,CAAC,EAAEC,CAAC,EAAEC,CAAW,CAAC,MAAMZ,iBAAO,CAAC;AACtD,KACA;AAAA,AAAE,IAAA,AAAA,AAAAa,eAAK,OAAK,GAAG,WAAC,eAAM,QAAO,AAAA;AAC7B,GACA,AAAA;;;;;;;;;;;;;;;;;;;;;;gCCpCS,CAAM,EAAE,CAAM,EAAE,MAAW,EAAlC;;;;AAAmC,AACrC,GAAA;;;;;;;;;;;;;;;;;;SCgBY,OAAgC,EAAE;AAC1C,MAAAb,AACE,OAAN,YACA;MAFIA,AAEE,AAAA,OADN,UACiB,GAAG,CACpB,AAAA;MAHIA,AAGE,AAAA,OAFN,UAEiB,GAAGc,UACpB,AAAA;MAJId,AAIE,AAAA,OAHN,YAGmB,GAAGc,UACtB,AAAA;MALId,AAKE,OAJN,OAIYU,MAAC,EAAEC,MAAC,EAAEI,WAAM,EAAE,CAAC,EAAEb,WAAG,EAAE,KAAK,CACvC;MANIF,AAME,OALN,SAMA;MAPIA,AAOE,OANN,YAOA;MARIA,AAQE,OAPN,SAOgB;AAChB,KACA;;;kBAdiBgB,QAAM;;;;;;;;;;;;;;0CFyBP,CAAK,EAAE,CAAK,EAAE,MAAU,EAAG,KAAY,EAArD;;AACM,qDAAMN,CAAC,EAAEC,CAAC,EAAEI,MAAM;AAAC,AAAC,AACxB,QAAI,AAAAD,KAAK,IAAI,IAAI,AAAA,EAAE,AAAA,AAAA,AAAA,IAAI,MAAM,GAAGA,KAAK,AAAA;AACzC,AAAA,AACA,GAAA;;;IEzCM;YAAS,SAAQ;KAAA;IACjB;YAAM,MAAK;KAAA;IACX;YAAO,OAAM;KAAA;IACb;YAAM,AAAAG,QAAE,GAAG,CAAC,AAAA;KAAA;;0BAEG,SAAC,QAAe,EAAE;AAAG,UAAA,AAAAzB,cAAQ,eAAeC,QAAQ,CAAC;AAAA,GAC1E,AAAA;;;IACM;YAAS,uBAAA,AAAAC,qBAAa,CAAC,SAAS,CAAC,CAAiB;KAAA;IAClD;YAAU,kCAAA,AAAAC,cAAM,cAAY,IAAI,CAAC,CAA4B;KAAA","file":"sunflower.js"}
\ No newline at end of file
diff --git a/pkg/dev_compiler/test/codegen_expected/unresolved_names.js b/pkg/dev_compiler/test/codegen_expected/unresolved_names.js
deleted file mode 100644
index 6c09a04..0000000
--- a/pkg/dev_compiler/test/codegen_expected/unresolved_names.js
+++ /dev/null
@@ -1,27 +0,0 @@
-define(['dart_sdk'], function(dart_sdk) {
- 'use strict';
- const core = dart_sdk.core;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const _root = Object.create(null);
- const unresolved_names = Object.create(_root);
- let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.fnType(dart.dynamic, [])))();
- unresolved_names.C = class C extends core.Object {};
- (unresolved_names.C.new = function() {
- }).prototype = unresolved_names.C.prototype;
- dart.addTypeTests(unresolved_names.C);
- unresolved_names.main = function() {
- dart.throw(Error("compile error: unresolved constructor: dynamic.<unnamed>"));
- dart.throw(Error("compile error: unresolved constructor: C.bar"));
- core.print(dart.throw(Error("compile error: unresolved identifier: baz")));
- core.print(dart.dload(unresolved_names.C, 'quux'));
- };
- dart.fn(unresolved_names.main, VoidTodynamic());
- dart.trackLibraries("unresolved_names", {
- "unresolved_names.dart": unresolved_names
- }, null);
- // Exports:
- return {
- unresolved_names: unresolved_names
- };
-});
diff --git a/pkg/dev_compiler/test/codegen_expected/varargs.js b/pkg/dev_compiler/test/codegen_expected/varargs.js
deleted file mode 100644
index 6e615fa..0000000
--- a/pkg/dev_compiler/test/codegen_expected/varargs.js
+++ /dev/null
@@ -1,43 +0,0 @@
-define(['dart_sdk'], function(dart_sdk) {
- 'use strict';
- const core = dart_sdk.core;
- const dart = dart_sdk.dart;
- const dartx = dart_sdk.dartx;
- const _root = Object.create(null);
- const varargs = Object.create(_root);
- const src__varargs = Object.create(_root);
- let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.constFn(dart.fnType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
- let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.fnType(dart.dynamic, [dart.dynamic])))();
- varargs.varargsTest = function(x, ...others) {
- let args = [1, others];
- dart.dcall(x, ...args);
- };
- dart.fn(varargs.varargsTest, dynamicAnddynamicTodynamic());
- varargs.varargsTest2 = function(x, ...others) {
- let args = [1, others];
- dart.dcall(x, ...args);
- };
- dart.fn(varargs.varargsTest2, dynamicAnddynamicTodynamic());
- src__varargs._Rest = class _Rest extends core.Object {};
- (src__varargs._Rest.new = function() {
- }).prototype = src__varargs._Rest.prototype;
- dart.addTypeTests(src__varargs._Rest);
- dart.defineLazy(src__varargs, {
- get rest() {
- return dart.const(new src__varargs._Rest.new());
- }
- });
- src__varargs.spread = function(args) {
- dart.throw(new core.StateError.new('The spread function cannot be called, ' + 'it should be compiled away.'));
- };
- dart.fn(src__varargs.spread, dynamicTodynamic());
- dart.trackLibraries("varargs", {
- "varargs.dart": varargs,
- "package:js/src/varargs.dart": src__varargs
- }, null);
- // Exports:
- return {
- varargs: varargs,
- src__varargs: src__varargs
- };
-});
diff --git a/pkg/dev_compiler/test/codegen_test.dart b/pkg/dev_compiler/test/codegen_test.dart
deleted file mode 100644
index 0d5df3f..0000000
--- a/pkg/dev_compiler/test/codegen_test.dart
+++ /dev/null
@@ -1,454 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Tests code generation.
-///
-/// Runs Dart Dev Compiler on all input in the `codegen` directory and checks
-/// that the output is what we expected.
-library dev_compiler.test.codegen_test;
-
-// TODO(rnystrom): This doesn't actually run any tests any more. It just
-// compiles stuff. This should be changed to not use unittest and just be a
-// regular program that outputs files.
-
-import 'dart:convert';
-import 'dart:io' show Directory, File, Platform;
-import 'package:analyzer/analyzer.dart' show StringLiteral, parseDirectives;
-import 'package:analyzer/src/command_line/arguments.dart'
- show defineAnalysisArguments;
-import 'package:analyzer/src/dart/ast/ast.dart';
-import 'package:analyzer/src/generated/source.dart' show Source;
-import 'package:args/args.dart' show ArgParser, ArgResults;
-import 'package:dev_compiler/src/analyzer/context.dart';
-import 'package:dev_compiler/src/analyzer/module_compiler.dart'
- show BuildUnit, CompilerOptions, JSModuleFile, ModuleCompiler;
-import 'package:dev_compiler/src/compiler/module_builder.dart'
- show ModuleFormat, addModuleFormatOptions, parseModuleFormatOption;
-import 'package:path/path.dart' as path;
-import 'package:test/test.dart' show expect, isFalse, isTrue, test;
-import 'package:status_file/expectation.dart';
-import 'package:test_dart/path.dart' as test_dart;
-import 'package:test_dart/test_suite.dart' show StandardTestSuite;
-import 'package:test_dart/options.dart';
-
-import '../tool/build_sdk.dart' as build_sdk;
-import 'multitest.dart' show extractTestsFromMultitest, isMultiTest;
-import 'testing.dart' show repoDirectory, testDirectory;
-
-final ArgParser argParser = ArgParser()
- ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null);
-
-/// The `test/codegen` directory.
-final codegenDir = path.join(testDirectory, 'codegen');
-
-/// The `test/codegen/expect` directory.
-final codegenExpectDir = path.join(testDirectory, 'codegen_expected');
-
-/// The generated directory where tests, expanded multitests, and other test
-/// support libraries are copied to.
-///
-/// The tests sometimes import utility libraries using a relative path.
-/// Likewise, the multitests do too, and one multitest even imports its own
-/// non-expanded form (!). To make that simpler, we copy the entire test tree
-/// to a generated directory and expand that multitests in there too.
-final codegenTestDir = path.join(repoDirectory, 'gen', 'codegen_tests');
-
-/// The generated directory where tests and packages compiled to JS are
-/// output.
-final codegenOutputDir = path.join(repoDirectory, 'gen', 'codegen_output');
-
-final codeCoverage = Platform.environment.containsKey('COVERALLS_TOKEN');
-
-RegExp filePattern;
-
-main(List<String> arguments) {
- if (arguments == null) arguments = [];
- ArgResults args = argParser.parse(arguments);
- filePattern = RegExp(args.rest.length > 0 ? args.rest[0] : '.');
-
- var sdkDir = path.join(repoDirectory, 'gen', 'patched_sdk');
- var sdkSummaryFile =
- path.join(testDirectory, '..', 'gen', 'sdk', 'ddc_sdk.sum');
-
- var summaryPaths = Directory(path.join(codegenOutputDir, 'pkg'))
- .listSync()
- .map((e) => e.path)
- .where((p) => p.endsWith('.sum'))
- .toList();
-
- var sharedCompiler = ModuleCompiler(AnalyzerOptions.basic(
- dartSdkSummaryPath: sdkSummaryFile, summaryPaths: summaryPaths));
-
- var testDirs = ['language', 'corelib_2', 'lib'];
-
- // Copy all of the test files and expanded multitest files to
- // gen/codegen_tests. We'll compile from there.
- var testFiles = _setUpTests(testDirs);
- _writeRuntimeStatus(testFiles);
-
- // Our default compiler options. Individual tests can override these.
- var defaultOptions = ['--no-source-map', '--no-summarize'];
- var compileArgParser = ArgParser();
- defineAnalysisArguments(compileArgParser, ddc: true);
- AnalyzerOptions.addArguments(compileArgParser);
- CompilerOptions.addArguments(compileArgParser);
- addModuleFormatOptions(compileArgParser);
-
- var testFileOptionsMatcher =
- RegExp(r'// (compile options: |SharedOptions=)(.*)', multiLine: true);
-
- // Ignore dart2js options that we don't support in DDC.
- var ignoreOptions = [
- '--enable-enum',
- '--experimental-trust-js-interop-type-annotations',
- '--trust-type-annotations',
- '--supermixin'
- ];
-
- // Compile each test file to JS and put the result in gen/codegen_output.
- testFiles.forEach((testFile, status) {
- var relativePath = path.relative(testFile, from: codegenTestDir);
-
- // Only compile the top-level files for generating coverage.
- bool isTopLevelTest = path.dirname(relativePath) == ".";
- if (codeCoverage && !isTopLevelTest) return;
-
- if (status.contains(Expectation.skip) ||
- status.contains(Expectation.skipByDesign)) {
- return;
- }
-
- var name = path.withoutExtension(relativePath);
- test('dartdevc $name', () {
- // Check if we need to use special compile options.
- var contents = File(testFile).readAsStringSync();
- var match = testFileOptionsMatcher.firstMatch(contents);
-
- var args = defaultOptions.toList();
- if (match != null) {
- var matchedArgs = match.group(2).split(' ');
- args.addAll(matchedArgs.where((s) => !ignoreOptions.contains(s)));
- }
-
- ArgResults argResults = compileArgParser.parse(args);
- var analyzerOptions = AnalyzerOptions.fromArguments(argResults,
- dartSdkSummaryPath: sdkSummaryFile, summaryPaths: summaryPaths);
-
- var options = CompilerOptions.fromArguments(argResults);
-
- var moduleFormat = parseModuleFormatOption(argResults).first;
-
- // Collect any other files we've imported.
- var files = Set<String>();
- _collectTransitiveImports(contents, files, from: testFile);
- var unit = BuildUnit(
- name, path.dirname(testFile), files.toList(), _moduleForLibrary);
-
- var compiler = sharedCompiler;
- if (analyzerOptions.declaredVariables.isNotEmpty) {
- compiler = ModuleCompiler(analyzerOptions);
- }
- JSModuleFile module = null;
- var exception, stackTrace;
- try {
- module = compiler.compile(unit, options);
- } catch (e, st) {
- exception = e;
- stackTrace = st;
- }
-
- // This covers tests where the intent of the test is to validate that
- // some static error is produced.
- var intentionalCompileError =
- (contents.contains(': compile-time error') ||
- // Use adjacent strings so test.dart doesn't match this line
- // as an expected compile error.
- contents.contains('/*@' 'compile-error=')) &&
- !status.contains(Expectation.missingCompileTimeError);
-
- var crashing = status.contains(Expectation.crash);
- if (module == null) {
- expect(crashing, isTrue,
- reason: "test $name crashes during compilation.\n"
- "$exception\n$stackTrace");
- return;
- }
-
- // Write out JavaScript and/or compilation errors/warnings.
- _writeModule(
- path.join(codegenOutputDir, name),
- isTopLevelTest ? path.join(codegenExpectDir, name) : null,
- moduleFormat,
- module);
-
- expect(crashing, isFalse, reason: "test $name no longer crashes.");
-
- var knownCompileError = status.contains(Expectation.compileTimeError) ||
- status.contains(Expectation.fail);
- // TODO(jmesserly): we could also invert negative_test, however analyzer
- // in test.dart does not do this.
- // name.endsWith('negative_test') && !status.contains(Expectation.fail)
- if (module.isValid) {
- expect(knownCompileError, isFalse,
- reason: "test $name expected static errors, but compiled.");
- } else {
- var reason = intentionalCompileError ? "intended" : "unexpected";
- expect(intentionalCompileError || knownCompileError, isTrue,
- reason: "test $name failed to compile due to $reason errors:"
- "\n\n${module.errors.join('\n')}.");
- }
- });
- });
-
- if (filePattern.hasMatch('sunflower')) {
- test('sunflower', () {
- _buildSunflower(sharedCompiler, codegenOutputDir, codegenExpectDir);
- });
- }
-
- if (codeCoverage) {
- test('build_sdk code coverage', () {
- return build_sdk.main(['--dart-sdk', sdkDir, '-o', codegenOutputDir]);
- });
- }
-}
-
-void _writeModule(String outPath, String expectPath, ModuleFormat format,
- JSModuleFile result) {
- _ensureDirectory(path.dirname(outPath));
-
- String errors = result.errors.join('\n');
- if (errors.isNotEmpty && !errors.endsWith('\n')) errors += '\n';
- File(outPath + '.txt').writeAsStringSync(errors);
-
- if (result.isValid) {
- result.writeCodeSync(format, outPath + '.js');
- }
-
- if (result.summaryBytes != null) {
- File(outPath + '.sum').writeAsBytesSync(result.summaryBytes);
- }
-
- // Write the expectation file if needed.
- // Generally speaking we try to avoid these tests, but they are occasionally
- // useful.
- if (expectPath != null) {
- _ensureDirectory(path.dirname(expectPath));
-
- var expectFile = File(expectPath + '.js');
- if (result.isValid) {
- result.writeCodeSync(format, expectFile.path);
- } else {
- expectFile.writeAsStringSync("//FAILED TO COMPILE");
- }
- }
-}
-
-void _buildSunflower(
- ModuleCompiler compiler, String outputDir, String expectDir) {
- var baseDir = path.join(codegenDir, 'sunflower');
- var files = ['sunflower', 'circle', 'painter']
- .map((f) => path.join(baseDir, '$f.dart'))
- .toList();
- var input = BuildUnit('sunflower', baseDir, files, _moduleForLibrary);
- var options = CompilerOptions(summarizeApi: false);
-
- var built = compiler.compile(input, options);
- _writeModule(path.join(outputDir, 'sunflower', 'sunflower'),
- path.join(expectDir, 'sunflower', 'sunflower'), ModuleFormat.amd, built);
-}
-
-String _moduleForLibrary(Source source) {
- var scheme = source.uri.scheme;
- if (scheme == 'package') {
- return source.uri.pathSegments.first;
- }
- throw Exception('Module not found for library "${source.fullName}"');
-}
-
-void _writeRuntimeStatus(Map<String, Set<Expectation>> testFiles) {
- var runtimeStatus = <String, String>{};
- testFiles.forEach((name, status) {
- name = path.withoutExtension(path.relative(name, from: codegenTestDir));
- // Skip tests that we don't expect to compile.
- if (status.contains(Expectation.compileTimeError) ||
- status.contains(Expectation.crash) ||
- status.contains(Expectation.skip) ||
- status.contains(Expectation.fail) ||
- status.contains(Expectation.skipByDesign)) {
- return;
- }
- // Normalize the expectations for the Karma language_test.js runner.
- if (status.remove(Expectation.ok)) assert(status.isNotEmpty);
- if (status.remove(Expectation.missingCompileTimeError) ||
- status.remove(Expectation.missingRuntimeError)) {
- status.add(Expectation.pass);
- }
-
- // Don't include status for passing tests, as that is the default.
- // TODO(jmesserly): we could record these for extra sanity checks.
- if (status.length == 1 && status.contains(Expectation.pass)) {
- return;
- }
-
- runtimeStatus[name] = status.map((s) => '$s').join(',');
- });
- File(path.join(codegenOutputDir, 'test_status.js')).writeAsStringSync('''
-define([], function() {
- 'use strict';
- return ${new JsonEncoder.withIndent(' ').convert(runtimeStatus)};
-});
-''');
-}
-
-Map<String, Set<Expectation>> _setUpTests(List<String> testDirs) {
- var testFiles = <String, Set<Expectation>>{};
- for (var testDir in testDirs) {
- // TODO(rnystrom): Simplify this when the Dart 2.0 test migration is
- // complete (#30183).
- // Look for the tests in the "_strong" and "_2" directories in the SDK's
- // main "tests" directory.
- var dirParts = path.split(testDir);
-
- for (var suffix in const ["_2", "_strong"]) {
- var sdkTestDir = path.join(
- 'tests', dirParts[0] + suffix, path.joinAll(dirParts.skip(1)));
- var inputPath = path.join(testDirectory, '..', '..', '..', sdkTestDir);
-
- if (!Directory(inputPath).existsSync()) continue;
-
- var browsers = Platform.environment['DDC_BROWSERS'];
- var runtime = browsers == 'Firefox' ? 'firefox' : 'chrome';
- var config = OptionsParser()
- .parse('-m release -c dartdevc --use-sdk --strong'.split(' ')
- ..addAll(['-r', runtime, '--suite_dir', sdkTestDir]))
- .single;
-
- var testSuite =
- StandardTestSuite.forDirectory(config, test_dart.Path(sdkTestDir));
- var expectations = testSuite.readExpectations();
-
- for (var file in _listFiles(inputPath, recursive: true)) {
- var relativePath = path.relative(file, from: inputPath);
- var outputPath = path.join(codegenTestDir, testDir, relativePath);
-
- _ensureDirectory(path.dirname(outputPath));
-
- if (file.endsWith("_test.dart")) {
- var statusPath = path.withoutExtension(relativePath);
-
- void _writeTest(String outputPath, String contents) {
- if (contents.contains('package:unittest/')) {
- // TODO(jmesserly): we could use directive parsing, but that
- // feels like overkill.
- // Alternatively, we could detect "unittest" use at runtime.
- // We really need a better solution for Karma+mocha+unittest
- // integration.
- contents += '\nfinal _usesUnittestPackage = true;\n';
- }
- File(outputPath).writeAsStringSync(contents);
- }
-
- var contents = File(file).readAsStringSync();
- if (isMultiTest(contents)) {
- // It's a multitest, so expand it and add all of the variants.
- var tests = <String, String>{};
- extractTestsFromMultitest(file, contents, tests);
-
- var fileName = path.basenameWithoutExtension(file);
- var outputDir = path.dirname(outputPath);
- tests.forEach((name, contents) {
- var multiFile =
- path.join(outputDir, '${fileName}_${name}_multi.dart');
- testFiles[multiFile] =
- expectations.expectations("$statusPath/$name");
-
- _writeTest(multiFile, contents);
- });
- } else {
- // It's a single test suite.
- testFiles[outputPath] = expectations.expectations(statusPath);
- }
-
- // Write the test file.
- //
- // We do this even for multitests because import_self_test
- // is a multitest, yet imports its own unexpanded form (!).
- _writeTest(outputPath, contents);
- } else {
- // Copy the non-test file over, in case it is used as an import.
- File(file).copySync(outputPath);
- }
- }
- }
- }
-
- // Also include the other special files that live at the top level directory.
- for (var file in _listFiles(codegenDir)) {
- var relativePath = path.relative(file, from: codegenDir);
- var outputPath = path.join(codegenTestDir, relativePath);
-
- File(file).copySync(outputPath);
- if (file.endsWith(".dart")) {
- testFiles[outputPath] = Set()..add(Expectation.pass);
- }
- }
-
- return testFiles;
-}
-
-/// Recursively creates [dir] if it doesn't exist.
-void _ensureDirectory(String dir) {
- Directory(dir).createSync(recursive: true);
-}
-
-/// Lists all of the files within [dir] that match [filePattern].
-Iterable<String> _listFiles(String dir, {bool recursive = false}) {
- return Directory(dir)
- .listSync(recursive: recursive, followLinks: false)
- .where((e) => e is File && filePattern.hasMatch(e.path))
- .map((f) => f.path);
-}
-
-/// Parse directives from [contents] and find the complete set of transitive
-/// imports, reading files as needed.
-///
-/// This will not include dart:* libraries, as those are implicitly available.
-void _collectTransitiveImports(String contents, Set<String> libraries,
- {String packageRoot, String from}) {
- var uri = from;
- if (packageRoot != null && path.isWithin(packageRoot, from)) {
- uri = 'package:${path.relative(from, from: packageRoot)}';
- }
- if (!libraries.add(uri)) return;
-
- var unit = parseDirectives(contents, name: from, suppressErrors: true);
- for (var d in unit.directives) {
- if (d is NamespaceDirectiveImpl) {
- String uri = _resolveDirective(d);
- if (uri == null ||
- uri.startsWith('dart:') ||
- uri.startsWith('package:')) {
- continue;
- }
-
- var f = File(path.join(path.dirname(from), uri));
- if (f.existsSync()) {
- _collectTransitiveImports(f.readAsStringSync(), libraries,
- packageRoot: packageRoot, from: f.path);
- }
- }
- }
-}
-
-/// Simplified from ParseDartTask.resolveDirective.
-String _resolveDirective(NamespaceDirectiveImpl directive) {
- StringLiteral uriLiteral = directive.uri;
- String uriContent = uriLiteral.stringValue;
- if (uriContent != null) {
- uriContent = uriContent.trim();
- directive.uriContent = uriContent;
- }
- return directive.validate() == null ? uriContent : null;
-}
diff --git a/pkg/dev_compiler/test/multitest.dart b/pkg/dev_compiler/test/multitest.dart
deleted file mode 100644
index f498744..0000000
--- a/pkg/dev_compiler/test/multitest.dart
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// TODO(jmesserly): this was factored out of
-// dart-lang/sdk/tools/testing/dart/multitest.dart
-library dev_compiler.test.tools.multitest;
-
-final validMultitestOutcomes = Set<String>.from([
- 'ok',
- 'compile-time error',
- 'runtime error',
- 'static type warning',
- 'dynamic type error',
- 'checked mode compile-time error'
-]);
-
-final runtimeErrorOutcomes = [
- 'runtime error',
- 'dynamic type error',
-];
-
-// Require at least one non-space character before '//#'
-// Handle both //# and the legacy /// multitest regexp patterns.
-final _multiTestRegExp = RegExp(r"\S *//[#/] \w+:(.*)");
-
-final _multiTestRegExpSeperator = RegExp(r"//[#/]");
-
-bool isMultiTest(String contents) => _multiTestRegExp.hasMatch(contents);
-
-// Multitests are Dart test scripts containing lines of the form
-// " [some dart code] /// [key]: [error type]"
-//
-// For each key in the file, a new test file is made containing all
-// the normal lines of the file, and all of the multitest lines containing
-// that key, in the same order as in the source file. The new test is expected
-// to pass if the error type listed is 'ok', or to fail if there is an error
-// type of type 'compile-time error', 'runtime error', 'static type warning', or
-// 'dynamic type error'. The type error tests fail only in checked mode.
-// There is also a test created from only the untagged lines of the file,
-// with key "none", which is expected to pass. This library extracts these
-// tests, writes them into a temporary directory, and passes them to the test
-// runner. These tests may be referred to in the status files with the
-// pattern [test name]/[key].
-//
-// For example: file I_am_a_multitest.dart
-// aaa
-// bbb //# 02: runtime error
-// ccc //# 02: continued
-// ddd //# 07: static type warning
-// eee //# 10: ok
-// fff
-//
-// should create four tests:
-// I_am_a_multitest_none.dart
-// aaa
-// fff
-//
-// I_am_a_multitest_02.dart
-// aaa
-// bbb //# 02: runtime error
-// ccc //# 02: continued
-// fff
-//
-// I_am_a_multitest_07.dart
-// aaa
-// ddd //# 07: static type warning
-// fff
-//
-// and I_am_a_multitest_10.dart
-// aaa
-// eee //# 10: ok
-// fff
-//
-// Note that it is possible to indicate more than one acceptable outcome
-// in the case of dynamic and static type warnings
-// aaa
-// ddd //# 07: static type warning, dynamic type error
-// fff
-
-void extractTestsFromMultitest(
- String filePath, String contents, Map<String, String> tests) {
- int first_newline = contents.indexOf('\n');
- final String line_separator =
- (first_newline == 0 || contents[first_newline - 1] != '\r')
- ? '\n'
- : '\r\n';
- List<String> lines = contents.split(line_separator);
- if (lines.last == '') lines.removeLast();
- contents = null;
-
- // Create the set of multitests, which will have a new test added each
- // time we see a multitest line with a new key.
- var testsAsLines = Map<String, List<String>>();
- var outcomes = Map<String, Set<String>>();
-
- // Add the default case with key "none".
- testsAsLines['none'] = List<String>();
- outcomes['none'] = Set<String>();
-
- int lineCount = 0;
- for (String line in lines) {
- lineCount++;
- var annotation = _Annotation.from(line);
- if (annotation != null) {
- testsAsLines.putIfAbsent(
- annotation.key, () => List<String>.from(testsAsLines["none"]));
- // Add line to test with annotation.key as key, empty line to the rest.
- for (var key in testsAsLines.keys) {
- testsAsLines[key].add(annotation.key == key ? line : "");
- }
- outcomes.putIfAbsent(annotation.key, () => Set<String>());
- if (annotation.rest != 'continued') {
- for (String nextOutcome in annotation.outcomesList) {
- if (validMultitestOutcomes.contains(nextOutcome)) {
- outcomes[annotation.key].add(nextOutcome);
- } else {
- print("Warning: Invalid test directive '$nextOutcome' on line "
- "${lineCount}:\n${annotation.rest} ");
- }
- }
- }
- } else {
- for (var test in testsAsLines.values) test.add(line);
- }
- }
- // End marker, has a final line separator so we don't need to add it after
- // joining the lines.
- var marker = '// Test created from multitest named $filePath.'
- '$line_separator';
- testsAsLines.forEach((key, test) {
- if (runtimeErrorOutcomes.any(outcomes[key].contains)) {
- test.add('final _expectRuntimeError = true;');
- }
- test.add(marker);
- });
-
- var keysToDelete = [];
- // Check that every key (other than the none case) has at least one outcome
- for (var outcomeKey in outcomes.keys) {
- if (outcomeKey != 'none' && outcomes[outcomeKey].isEmpty) {
- print("Warning: Test ${outcomeKey} has no valid annotated outcomes.\n"
- "Expected one of: ${validMultitestOutcomes.toString()}");
- // If this multitest doesn't have an outcome, mark the multitest for
- // deletion.
- keysToDelete.add(outcomeKey);
- }
- }
- // If a key/multitest was marked for deletion, do the necessary cleanup.
- keysToDelete.forEach(outcomes.remove);
- keysToDelete.forEach(testsAsLines.remove);
-
- // Copy all the tests into the output map tests, as multiline strings.
- for (String key in testsAsLines.keys) {
- tests[key] = testsAsLines[key].join(line_separator);
- }
-}
-
-// Represents a mutlitest annotation in the special //# comment.
-class _Annotation {
- String key;
- String rest;
- List<String> outcomesList;
- _Annotation() {}
- factory _Annotation.from(String line) {
- // Do an early return with "null" if this is not a valid multitest
- // annotation.
- if (!line.contains(_multiTestRegExpSeperator)) {
- return null;
- }
- var parts = line
- .split(_multiTestRegExpSeperator)[1]
- .split(':')
- .map((s) => s.trim())
- .where((s) => s.length > 0)
- .toList();
- if (parts.length <= 1) {
- return null;
- }
-
- var annotation = _Annotation();
- annotation.key = parts[0];
- annotation.rest = parts[1];
- annotation.outcomesList =
- annotation.rest.split(',').map((s) => s.trim()).toList();
- return annotation;
- }
-}
diff --git a/pkg/dev_compiler/test/options/options_test.dart b/pkg/dev_compiler/test/options/options_test.dart
index c553d95..06a2f6f 100644
--- a/pkg/dev_compiler/test/options/options_test.dart
+++ b/pkg/dev_compiler/test/options/options_test.dart
@@ -37,7 +37,7 @@
var compiler = ModuleCompiler(options, analysisRoot: optionsDir);
var context = compiler.context;
var sdk = context.sourceFactory.dartSdk;
- expect(sdk, isInstanceOf<SummaryBasedDartSdk>());
+ expect(sdk, const TypeMatcher<SummaryBasedDartSdk>());
var processors = context.analysisOptions.errorProcessors;
expect(processors, hasLength(1));
expect(processors[0].code, CompileTimeErrorCode.UNDEFINED_CLASS.name);
diff --git a/pkg/dev_compiler/tool/README.md b/pkg/dev_compiler/tool/README.md
deleted file mode 100644
index 0aade89..0000000
--- a/pkg/dev_compiler/tool/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-## Tools for processing the Dart SDK
-
-# patch_sdk.dart
-
-This script combines:
-
- tool/input_sdk/lib/...
- tool/input_sdk/patch/...
- tool/input_sdk/private/...
-
-and produces the merged SDK sources in:
-
- gen/patched_sdk/...
-
-The result has all "external" keywords replaced with the @patch implementations.
-
-Generally local edits should be to `input_sdk/patch` and `input_sdk/private`,
-as those two directories are specific to DDC. `input_sdk/lib` should represent
-unmodified SDK sources to the maximum extent possible. Currently there are
-slight edits to the type annotations in some cases.
-
-See patch_sdk.dart for more information.
-
-# sdk_version_check.dart
-
-Asserts that the Dart VM is at least a particular semantic version.
-It returns an exit code to make it easy to integrate with shell scripts.
diff --git a/pkg/dev_compiler/tool/analyze.sh b/pkg/dev_compiler/tool/analyze.sh
deleted file mode 100755
index 7786289..0000000
--- a/pkg/dev_compiler/tool/analyze.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-set -e
-
-# Switch to the root directory of dev_compiler
-cd $( dirname "${BASH_SOURCE[0]}" )/..
-
-function fail {
- echo -e "[31mAnalyzer found problems[0m"
- return 1
-}
-
-# Run analyzer on bin/dartdevc.dart, as it includes most of the code we care
-# about via transitive dependencies. This seems to be the only fast way to avoid
-# repeated analysis of the same code.
-# TODO(jmesserly): ideally we could do test/all_tests.dart, but
-# dart_runtime_test.dart creates invalid generic type instantiation AA.
-echo "Running dartanalyzer to check for errors/warnings..."
-dart ../analyzer_cli/bin/analyzer.dart --strong --package-warnings \
- bin/dartdevc.dart web/main.dart \
- | grep -v "\[info\]" | grep -v "\[hint\]" | (! grep $PWD) || fail
diff --git a/pkg/dev_compiler/tool/browser_test.sh b/pkg/dev_compiler/tool/browser_test.sh
deleted file mode 100755
index ffef3712..0000000
--- a/pkg/dev_compiler/tool/browser_test.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-# Check that node exists and refers to nodejs
-checknodejs=$(hash node 2> /dev/null && node --help | grep js)
-if [[ $? -ne 0 ]]; then
- echo 'NodeJS (node) is not properly installed'
- echo 'Note, on Ubuntu / Debian, you may need to also install:'
- echo '$ sudo apt-get install nodejs-legacy'
- exit 1
-fi
-
-# Check that npm is installed
-checknpm=$(hash npm 2> /dev/null)
-if [[ $? -ne 0 ]]; then
- echo 'Node Package Manager (npm) is not properly installed'
- exit 1
-fi
-
-# Check for Chrome Canary on Ubuntu
-# The default install path is sometimes google-chrome-unstable
-# instead of google-chrome-canary as karma expects.
-if [[ "$OSTYPE" == "linux-gnu" ]] && [[ -z "$CHROME_CANARY_BIN" ]]; then
- checkcanary=$(hash google-chrome-canary 2> /dev/null)
- if [[ $? -ne 0 ]]; then
- checkunstable=$(hash google-chrome-unstable 2> /dev/null)
- if [[ $? -ne 0 ]]; then
- echo 'Chrome Canary is not found'
- echo 'Please install and/or set CHROME_CANARY_BIN to its path'
- exit 1
- else
- export CHROME_CANARY_BIN=google-chrome-unstable
- fi
- fi
-fi
-
-npm install
-npm test
diff --git a/pkg/dev_compiler/tool/build_sdk.sh b/pkg/dev_compiler/tool/build_sdk.sh
deleted file mode 100755
index 62c012d..0000000
--- a/pkg/dev_compiler/tool/build_sdk.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-set -e
-# switch to the root directory of dev_compiler
-cd $( dirname "${BASH_SOURCE[0]}" )/..
-
-echo "*** Patching SDK"
-{ # Try
- dart -c tool/patch_sdk.dart ../.. tool/input_sdk gen/patched_sdk \
- > gen/sdk_analyzer_errors.txt
-} || { # Catch
- # Show errors if the sdk didn't compile.
- cat gen/sdk_analyzer_errors.txt
- exit 1
-}
-
-echo "*** Compiling SDK to JavaScript"
-{ # Try
- # TODO(jmesserly): break out dart:html & friends into a module.
- dart -c tool/build_sdk.dart \
- --dart-sdk gen/patched_sdk \
- --dart-sdk-summary=build \
- --summary-out gen/sdk/ddc_sdk.sum \
- --source-map \
- --source-map-comment \
- --inline-source-map \
- --modules=amd \
- -o gen/sdk/amd/dart_sdk.js \
- --modules=es6 \
- -o gen/sdk/es6/dart_sdk.js \
- --modules=common \
- -o gen/sdk/common/dart_sdk.js \
- --modules=legacy \
- -o gen/sdk/legacy/dart_sdk.js \
- "$@" > gen/sdk_analyzer_errors.txt
-} || { # Catch
- # Show errors if the sdk didn't compile.
- cat gen/sdk_analyzer_errors.txt
- exit 1
-}
diff --git a/pkg/dev_compiler/tool/coverage.sh b/pkg/dev_compiler/tool/coverage.sh
deleted file mode 100755
index 70d7a01..0000000
--- a/pkg/dev_compiler/tool/coverage.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-set -e # bail on error
-
-# Prerequisite: ./tool/build_sdk.sh has been run.
-
-# Install dart_coveralls; gather and send coverage data.
-if [ "$COVERALLS_TOKEN" ] && [ "$TRAVIS_DART_VERSION" = "dev" ]; then
- echo "*** Running dart_coveralls"
- pub global run dart_coveralls report \
- --token $COVERALLS_TOKEN \
- --retry 2 \
- --throw-on-connectivity-error \
- --exclude-test-files \
- test/all_tests.dart
- echo "*** Done running dart_coveralls"
-fi
diff --git a/pkg/dev_compiler/tool/dd8 b/pkg/dev_compiler/tool/dd8
deleted file mode 100755
index 6f3154c..0000000
--- a/pkg/dev_compiler/tool/dd8
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/bash
-#
-# Compiles code with DDC and runs the resulting code in d8 (the v8 command
-# line tool). Only recent versions of v8/d8 that include es6 modules are
-# supported.
-#
-# The first script supplied should be the one with `main()`.
-#
-# Saves the output in the same directory as the sources for convenient
-# inspection, modification or rerunning the code.
-#
-# TODO(vsm): Investigate what polyfills from dart2js would be useful here:
-# sdk/lib/_internal/js_runtime/lib/preambles/d8.js
-#
-D8=$(type -P d8)
-if [ ! $D8 ]; then
- echo "Please add d8 to your PATH."
- exit 1
-fi
-set -e
-DDC_PATH=$( cd $( dirname "${BASH_SOURCE[0]}" )/.. && pwd )
-BASENAME=$( basename "${1%.*}")
-LIBROOT=$(cd $( dirname "${1%.*}") && pwd)
-
-# Build the SDK in a place where we can find it if it's not already there.
-if [ ! -e gen/sdk/ddc_sdk.sum ]; then
- ./tool/build_sdk.sh
-fi
-
-# D8 uses relative paths. That won't work for the sdk right now as the
-# summary is in a slightly different location.
-# D8/ES6 imports also do not add a ".js" extension, so this is "dart_sdk"
-# instead of "dart_sdk.js".
-if [ ! -f dart_sdk ]; then
- ln -s $DDC_PATH/gen/sdk/es6/dart_sdk.js dart_sdk
-fi
-
-dart -c $DDC_PATH/bin/dartdevc.dart --modules=es6 --library-root=$LIBROOT \
- --dart-sdk-summary=$DDC_PATH/gen/sdk/ddc_sdk.sum \
- -o $LIBROOT/$BASENAME.js $*
-pushd $LIBROOT > /dev/null
-echo "
- import { dart, _isolate_helper } from 'dart_sdk';
- import { $BASENAME } from '$BASENAME.js';
- let main = $BASENAME.main;
- dart.ignoreWhitelistedErrors(false);
- try {
- _isolate_helper.startRootIsolate(() => {}, []);
- main();
- } catch(e) {
- console.error(e.toString(), dart.stackTrace(e).toString());
- }" \
- > $LIBROOT/$BASENAME.d8.js
-$D8 --module $BASENAME.d8.js || exit 1
-popd > /dev/null
diff --git a/pkg/dev_compiler/tool/dependency_overrides.sh b/pkg/dev_compiler/tool/dependency_overrides.sh
deleted file mode 100644
index 2b0c159..0000000
--- a/pkg/dev_compiler/tool/dependency_overrides.sh
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/bash
-
-function add_dependency_override() {
- local name=$1
- local path=$2
- if ! cat pubspec.yaml | grep "dependency_overrides:" ; then
- echo "dependency_overrides:" >> pubspec.yaml
- fi
- local pubspec=`cat pubspec.yaml | grep -v "$name: .path: "`
- echo "$pubspec" > pubspec.yaml
- if [[ -n "$path" ]]; then
- echo " $name: {path: $path}" >> pubspec.yaml
- fi
-}
-
-function checkout_dependency_override_from_github() {
- local dependency_name=$1
- local org_project=$2
- local branch=$3
- local path=${4:-/}
-
- local url=https://github.com/$org_project
-
- echo "** Checking out $dependency_name override from $url$path#$branch"
-
- : ${TMPDIR:="/tmp"}
- local dep_dir=$TMPDIR/dependency_overrides/$dependency_name
-
- [[ -d `dirname $dep_dir` ]] || mkdir `dirname $dep_dir`
-
- if [[ -d $dep_dir ]]; then
- # Check there's no local modifications before removing existing directory.
- (
- cd $dep_dir
- if git status -s | grep . ; then
- echo "Found local modifications in $dep_dir: aborting"
- exit 1
- fi
- )
- rm -fR $dep_dir
- fi
-
- if [[ "$path" == "/" ]]; then
- # Checkout only the branch, with no history:
- git clone --depth 1 --branch $branch $url $dep_dir
- else
- (
- mkdir $dep_dir
- cd $dep_dir
-
- # Sparse-checkout only the path + branch, with no history:
- git init
- git remote add origin $url
- git config core.sparsecheckout true
- echo $path >> .git/info/sparse-checkout
- git pull --depth=1 origin $branch
- )
- fi
- add_dependency_override $dependency_name $dep_dir$path
-}
diff --git a/pkg/dev_compiler/tool/format.sh b/pkg/dev_compiler/tool/format.sh
deleted file mode 100755
index 01f7e3b..0000000
--- a/pkg/dev_compiler/tool/format.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-set -e
-
-# Switch to the root directory of dev_compiler
-cd $( dirname "${BASH_SOURCE[0]}" )/..
-
-# Run formatter in rewrite mode on all files that are part of the project.
-# This checks that all files are commited first to git, so no state is lost.
-# The formatter ignores:
-# * local files that have never been added to git,
-# * subdirectories of test/ and tool/, unless explicitly added. Those dirs
-# contain a lot of generated or external source we should not reformat.
-(files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \
- tool/*.dart | grep -v lib/src/js_ast/`; git status -s $files | grep -q . \
- && echo "Did not run the formatter, please commit edited files first." \
- || (echo "Running dart formatter" ; \
- dart ../../third_party/pkg_tested/dart_style/bin/format.dart -w $files))
diff --git a/pkg/dev_compiler/tool/get_chrome_canary.sh b/pkg/dev_compiler/tool/get_chrome_canary.sh
deleted file mode 100755
index 8f02313..0000000
--- a/pkg/dev_compiler/tool/get_chrome_canary.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-#
-# Ensures the latest Chrome Canary is available, downloading it
-# if necessary.
-#
-# Directory ~/.chrome/canary can safely be cached as the existing
-# version will be checked before reusing a previously downloaded
-# canary.
-#
-
-set -eu
-
-readonly CHROME_SNAPSHOTS=https://storage.googleapis.com/chromium-browser-snapshots
-declare CHROME_URL
-declare CHROME_NAME
-declare CHROME_RELATIVE_BIN
-
-if [[ "$OSTYPE" == "linux"* ]]; then
- CHROME_URL=$CHROME_SNAPSHOTS/Linux_x64
- CHROME_NAME=chrome-linux
- CHROME_RELATIVE_BIN=chrome
-elif [[ "$OSTYPE" == "darwin"* ]]; then
- CHROME_URL=$CHROME_SNAPSHOTS/Mac
- CHROME_NAME=chrome-mac
- CHROME_RELATIVE_BIN=Chromium.app/Contents/MacOS/Chromium
-elif [[ "$OSTYPE" == "cygwin" ]]; then
- CHROME_URL=$CHROME_SNAPSHOTS/Win
- CHROME_NAME=chrome-win32
- CHROME_RELATIVE_BIN=chrome.exe
-else
- echo "Unknown platform: $OSTYPE" >&2
- exit 1
-fi
-
-readonly CHROME_CANARY_DIR=$HOME/.chrome/canary
-readonly CHROME_CANARY_BIN=$CHROME_CANARY_DIR/$CHROME_NAME/$CHROME_RELATIVE_BIN
-readonly CHROME_CANARY_REV_FILE=$CHROME_CANARY_DIR/VERSION
-readonly CHROME_REV=$(curl -s ${CHROME_URL}/LAST_CHANGE)
-
-function getCanary() {
- local existing_version=""
- if [[ -f $CHROME_CANARY_REV_FILE && -x $CHROME_CANARY_BIN ]]; then
- existing_version=`cat $CHROME_CANARY_REV_FILE`
- echo "Found cached Chrome Canary version: $existing_version"
- fi
-
- if [[ "$existing_version" != "$CHROME_REV" ]]; then
- echo "Downloading Chrome Canary version: $CHROME_REV"
- rm -fR $CHROME_CANARY_DIR
- mkdir -p $CHROME_CANARY_DIR
-
- local file=$CHROME_NAME.zip
- curl ${CHROME_URL}/${CHROME_REV}/$file -o $file
- unzip $file -d $CHROME_CANARY_DIR
- rm $file
- echo $CHROME_REV > $CHROME_CANARY_REV_FILE
- fi
-}
-
-getCanary >&2
-
-echo $CHROME_CANARY_BIN
diff --git a/pkg/dev_compiler/tool/global_compile.dart b/pkg/dev_compiler/tool/global_compile.dart
index ec294b5..d3090ae 100644
--- a/pkg/dev_compiler/tool/global_compile.dart
+++ b/pkg/dev_compiler/tool/global_compile.dart
@@ -85,7 +85,7 @@
out.writeAsStringSync(dartLibrary);
var dartSdk = File(path.join(ddcPath, 'lib', 'js', 'legacy', 'dart_sdk.js'))
.readAsStringSync();
- out.writeAsStringSync(dartSdk, mode: FileMode.APPEND);
+ out.writeAsStringSync(dartSdk, mode: FileMode.append);
// Linearize module concatenation for deterministic output
var last = Future.value();
@@ -138,7 +138,7 @@
linearizerMap[module]
.then((_) => codefile.readAsString())
.then((code) =>
- out.writeAsString(code, mode: FileMode.APPEND, flush: true))
+ out.writeAsString(code, mode: FileMode.append, flush: true))
.then((_) => completerMap[module].complete());
});
});
@@ -152,7 +152,7 @@
var libraryName =
path.withoutExtension(entry).replaceAll(path.separator, '__');
out.writeAsStringSync('dart_library.start("$ENTRY", "$libraryName");\n',
- mode: FileMode.APPEND);
+ mode: FileMode.append);
});
}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/debugger.dart b/pkg/dev_compiler/tool/input_sdk/private/debugger.dart
index 9fa9679..492291a 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/debugger.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/debugger.dart
@@ -379,7 +379,7 @@
// This is stylistically a bit ugly but it eases distinguishing Dart and
// JS objects.
var element = JsonMLElement('span')
- ..setStyle('background-color: #d9edf7;')
+ ..setStyle('background-color: #d9edf7;color: black')
..createTextChild(c);
return element.toJsonML();
}
@@ -394,7 +394,7 @@
'margin-bottom: 0px;'
'margin-left: 12px;');
if (object is StackTrace) {
- body.addStyle('color: rgb(196, 26, 22);');
+ body.addStyle('background-color: thistle;color: rgb(196, 26, 22);');
}
var children = _simpleFormatter.children(object, config);
if (children == null) return body.toJsonML();
@@ -411,7 +411,8 @@
nameSpan = JsonMLElement('span')
..createTextChild(
child.displayName.isNotEmpty ? '${child.displayName}: ' : '')
- ..setStyle('color: rgb(136, 19, 145); margin-right: -13px');
+ ..setStyle(
+ 'background-color: thistle; color: rgb(136, 19, 145); margin-right: -13px');
valueStyle = 'margin-left: 13px';
}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
index 5b4a54b..306b1a2 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
@@ -597,11 +597,7 @@
Iterable<E> followedBy(Iterable<E> other) =>
FollowedByIterable<E>.firstEfficient(this, other);
- // TODO(leafp): Restore this functionality once generic methods are enabled
- // in the VM and dart2js.
- // https://github.com/dart-lang/sdk/issues/32463
- Iterable<T> whereType<T>() =>
- throw UnimplementedError("whereType is not yet supported");
+ Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
List<E> operator +(List<E> other) {
int totalLength = this.length + other.length;
diff --git a/pkg/dev_compiler/tool/override_analyzer_dependency.sh b/pkg/dev_compiler/tool/override_analyzer_dependency.sh
deleted file mode 100755
index a887498..0000000
--- a/pkg/dev_compiler/tool/override_analyzer_dependency.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-cd $( dirname "${BASH_SOURCE[0]}" )/..
-
-. ./tool/dependency_overrides.sh
-
-checkout_dependency_override_from_github \
- analyzer dart-lang/sdk $1 /pkg/analyzer/
diff --git a/pkg/dev_compiler/tool/patch_sdk.sh b/pkg/dev_compiler/tool/patch_sdk.sh
deleted file mode 100755
index 45370d1..0000000
--- a/pkg/dev_compiler/tool/patch_sdk.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-set -e
-
-cd "$(dirname "$BASH_SOURCE[0]")/.."
-dart -c tool/patch_sdk.dart ../.. tool/input_sdk gen/patched_sdk
diff --git a/pkg/dev_compiler/tool/presubmit.sh b/pkg/dev_compiler/tool/presubmit.sh
deleted file mode 100755
index 5ad1726..0000000
--- a/pkg/dev_compiler/tool/presubmit.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-DIR=$(dirname "${BASH_SOURCE[0]}")
-$DIR/build_sdk.sh
-$DIR/test.sh
-$DIR/browser_test.sh
-$DIR/analyze.sh
-echo "*** Presubmit finished"
diff --git a/pkg/dev_compiler/tool/sdk_version_check.dart b/pkg/dev_compiler/tool/sdk_version_check.dart
deleted file mode 100755
index 4d64c43..0000000
--- a/pkg/dev_compiler/tool/sdk_version_check.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env dart
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Checks that the Dart VM is at least the requested version
-import 'dart:io' show Platform, exit;
-import 'package:pub_semver/pub_semver.dart' show Version;
-
-void main(List<String> argv) {
- if (argv.length == 0 || argv[0] == '--help') {
- print('usage: sdk_version_check.dart <minimum-version>');
- print('for example: sdk_version_check.dart 1.9.0-dev.4.0');
- exit(2);
- }
- var minVersion = Version.parse(argv[0]);
-
- var vmStr = Platform.version;
- vmStr = vmStr.substring(0, vmStr.indexOf(' '));
- var vmVersion = Version.parse(vmStr);
- if (vmVersion < minVersion) {
- print('Requires VM $minVersion but actual version $vmVersion');
- exit(1);
- }
-}
diff --git a/pkg/dev_compiler/tool/test.sh b/pkg/dev_compiler/tool/test.sh
deleted file mode 100755
index 4f1db8c..0000000
--- a/pkg/dev_compiler/tool/test.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/bash
-set -e # bail on error
-
-function fail {
- echo -e "[31mSome tests failed[0m"
- return 1
-}
-
-# Some tests require being run from the package root
-# switch to the root directory of dev_compiler
-cd $( dirname "${BASH_SOURCE[0]}" )/..
-
-# Check minimum SDK version
-./tool/sdk_version_check.dart 1.9.0-dev.4.0 || fail
-
-# Delete codegen expectation files to be sure that if a test fails to compile
-# we don't erroneously pick up the old version.
-if [ -d test/codegen/expect ]; then
- rm -r test/codegen/expect || fail
-fi
-
-if [ -d gen/codegen_input ]; then
- rm -r gen/codegen_input || fail
-fi
-
-if [ -d gen/codegen_output ]; then
- rm -r gen/codegen_output || fail
-fi
-
-# Build the SDK summary in a place where the tests can find it if it's not
-# already there.
-if [ ! -e gen/sdk/ddc_sdk.sum ]; then
- ./tool/build_sdk.sh
-fi
-
-./tool/build_pkgs.dart \
- --analyzer-sdk=gen/sdk/ddc_sdk.sum \
- --output=gen/codegen_output/pkg
-
-# Make sure we don't run tests in code coverage mode.
-# this will cause us to generate files that are not part of the baseline
-# TODO(jmesserly): we should move diff into Dart code, so we don't need to
-# worry about this. Also if we're in code coverage mode, we should avoid running
-# all_tests twice. Finally self_host_test is not currently being tracked by
-# code coverage.
-unset COVERALLS_TOKEN
-dart test/all_tests.dart || fail
-
-{
- fc=`find test -name "*.dart" |\
- xargs grep "/\*\S* should be \S*\*/" | wc -l`
- echo "There are" $fc "tests marked as known failures."
-}
-
-echo -e "[32mAll tests built - run tool/browser_test.sh to run tests[0m"
diff --git a/pkg/expect/lib/expect.dart b/pkg/expect/lib/expect.dart
index 4803de0..423242f 100644
--- a/pkg/expect/lib/expect.dart
+++ b/pkg/expect/lib/expect.dart
@@ -598,6 +598,20 @@
_fail("Test error: $message");
}
+ /// Checks that [object] has type [T].
+ static void type<T>(Object object, [String reason]) {
+ if (object is T) return;
+ String msg = _getMessage(reason);
+ _fail("Expect.type($object is $T$msg) fails, was ${object.runtimeType}");
+ }
+
+ /// Checks that [object] does not have type [T].
+ static void notType<T>(Object object, [String reason]) {
+ if (object is! T) return;
+ String msg = _getMessage(reason);
+ _fail("Expect.type($object is! $T$msg) fails, was ${object.runtimeType}");
+ }
+
static String _getMessage(String reason) =>
(reason == null) ? "" : ", '$reason'";
diff --git a/pkg/front_end/lib/src/byte_store/file_byte_store.dart b/pkg/front_end/lib/src/byte_store/file_byte_store.dart
index 9a9bc29..00d3630 100644
--- a/pkg/front_end/lib/src/byte_store/file_byte_store.dart
+++ b/pkg/front_end/lib/src/byte_store/file_byte_store.dart
@@ -46,9 +46,7 @@
}
@override
- List<int> get(String key) {
- return _fileByteStore.get(key);
- }
+ List<int> get(String key) => _fileByteStore.get(key);
@override
void put(String key, List<int> bytes) {
@@ -97,16 +95,16 @@
SendPort initialReplyTo = message;
ReceivePort port = new ReceivePort();
initialReplyTo.send(port.sendPort);
- port.listen((request) async {
+ port.listen((request) {
if (request is CacheCleanUpRequest) {
- await _cleanUpFolder(request.cachePath, request.maxSizeBytes);
+ _cleanUpFolder(request.cachePath, request.maxSizeBytes);
// Let the client know that we're done.
request.replyTo.send(true);
}
});
}
- static Future<Null> _cleanUpFolder(String cachePath, int maxSizeBytes) async {
+ static void _cleanUpFolder(String cachePath, int maxSizeBytes) {
// Prepare the list of files and their statistics.
List<File> files = <File>[];
Map<File, FileStat> fileStatMap = {};
@@ -115,10 +113,14 @@
for (FileSystemEntity resource in resources) {
if (resource is File) {
try {
- FileStat fileStat = await resource.stat();
- files.add(resource);
- fileStatMap[resource] = fileStat;
- currentSizeBytes += fileStat.size;
+ final FileStat fileStat = resource.statSync();
+ // Make sure that the file was not deleted out from under us (a return
+ // value of FileSystemEntityType.notFound).
+ if (fileStat.type == FileSystemEntityType.file) {
+ files.add(resource);
+ fileStatMap[resource] = fileStat;
+ currentSizeBytes += fileStat.size;
+ }
} catch (_) {}
}
}
@@ -133,7 +135,7 @@
break;
}
try {
- await file.delete();
+ file.deleteSync();
} catch (_) {}
currentSizeBytes -= fileStatMap[file].size;
}
@@ -144,51 +146,71 @@
* [ByteStore] that stores values as files.
*/
class FileByteStore implements ByteStore {
+ static final FileByteStoreValidator _validator = new FileByteStoreValidator();
+
final String _cachePath;
- final String _tempName;
- final FileByteStoreValidator _validator = new FileByteStoreValidator();
+ final String _tempSuffix;
+ final Map<String, List<int>> _writeInProgress = {};
+ final FuturePool _pool = new FuturePool(20);
/**
* If the same cache path is used from more than one isolate of the same
* process, then a unique [tempNameSuffix] must be provided for each isolate.
*/
FileByteStore(this._cachePath, {String tempNameSuffix: ''})
- : _tempName = 'temp_${pid}_${tempNameSuffix}';
+ : _tempSuffix =
+ '-temp-${pid}${tempNameSuffix.isEmpty ? '' : '-$tempNameSuffix'}';
@override
List<int> get(String key) {
+ List<int> bytes = _writeInProgress[key];
+ if (bytes != null) {
+ return bytes;
+ }
+
try {
- File file = _getFileForKey(key);
- List<int> rawBytes = file.readAsBytesSync();
- return _validator.getData(rawBytes);
+ final File file = _getFileForKey(key);
+ if (!file.existsSync()) {
+ return null;
+ }
+ return _validator.getData(file.readAsBytesSync());
} catch (_) {
+ // ignore exceptions
return null;
}
}
@override
void put(String key, List<int> bytes) {
- try {
- bytes = _validator.wrapData(bytes);
- File tempFile = _getFileForKey(_tempName);
- tempFile.writeAsBytesSync(bytes);
- File file = _getFileForKey(key);
- tempFile.renameSync(file.path);
- } catch (_) {}
+ _writeInProgress[key] = bytes;
+
+ final List<int> wrappedBytes = _validator.wrapData(bytes);
+
+ // We don't wait for the write and rename to complete.
+ _pool.execute(() {
+ final File tempFile = _getFileForKey('$key$_tempSuffix');
+ return tempFile.writeAsBytes(wrappedBytes).then((_) {
+ return tempFile.rename(join(_cachePath, key));
+ }).catchError((_) {
+ // ignore exceptions
+ }).whenComplete(() {
+ if (_writeInProgress[key] == bytes) {
+ _writeInProgress.remove(key);
+ }
+ });
+ });
}
- File _getFileForKey(String key) {
- return new File(join(_cachePath, key));
- }
+ File _getFileForKey(String key) => new File(join(_cachePath, key));
}
/**
- * Generally speaking, we cannot guarantee that any data written into a
- * file will stay the same - there is always a chance of a hardware problem,
- * file system problem, truncated data, etc.
+ * Generally speaking, we cannot guarantee that any data written into a file
+ * will stay the same - there is always a chance of a hardware problem, file
+ * system problem, truncated data, etc.
*
- * So, we need to embed some validation into data itself.
- * This class append the version and the checksum to data.
+ * So, we need to embed some validation into data itself. This class append the
+ * version and the checksum to data.
*/
class FileByteStoreValidator {
static const List<int> _VERSION = const [0x01, 0x00, 0x00, 0x00];
@@ -253,3 +275,30 @@
return bytes;
}
}
+
+class FuturePool {
+ int _available;
+ List waiting = [];
+
+ FuturePool(this._available);
+
+ void execute(Future Function() fn) {
+ if (_available > 0) {
+ _run(fn);
+ } else {
+ waiting.add(fn);
+ }
+ }
+
+ void _run(Future Function() fn) {
+ _available--;
+
+ fn().whenComplete(() {
+ _available++;
+
+ if (waiting.isNotEmpty) {
+ _run(waiting.removeAt(0));
+ }
+ });
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/builder/library_builder.dart b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
index dcd6413..5b43657 100644
--- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
@@ -126,7 +126,7 @@
int finishDeferredLoadTearoffs() => 0;
- int finishNoSuchMethodForwarders() => 0;
+ int finishForwarders() => 0;
int finishNativeMethods() => 0;
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index fc89ebc..fc453d5 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -692,6 +692,8 @@
const Code<Message Function(String name)> codeConflictsWithConstructor =
const Code<Message Function(String name)>(
"ConflictsWithConstructor", templateConflictsWithConstructor,
+ analyzerCode: "CONFLICTS_WITH_CONSTRUCTOR",
+ dart2jsCode: "*fatal*",
severity: Severity.error);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -730,6 +732,8 @@
const Code<Message Function(String name)> codeConflictsWithMember =
const Code<Message Function(String name)>(
"ConflictsWithMember", templateConflictsWithMember,
+ analyzerCode: "CONFLICTS_WITH_MEMBER",
+ dart2jsCode: "*fatal*",
severity: Severity.error);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -809,6 +813,8 @@
const Code<Message Function(String name)> codeConflictsWithTypeVariable =
const Code<Message Function(String name)>(
"ConflictsWithTypeVariable", templateConflictsWithTypeVariable,
+ analyzerCode: "CONFLICTING_TYPE_VARIABLE_AND_MEMBER",
+ dart2jsCode: "*fatal*",
severity: Severity.error);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -1329,6 +1335,17 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstructorNotSync = messageConstructorNotSync;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstructorNotSync = const MessageCode(
+ "ConstructorNotSync",
+ analyzerCode: "NON_SYNC_CONSTRUCTOR",
+ dart2jsCode: "*ignored*",
+ message:
+ r"""Constructor bodies can't use 'async', 'async*', or 'sync*'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeConstructorWithReturnType =
messageConstructorWithReturnType;
@@ -1552,6 +1569,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageDeclaredMemberConflictsWithInheritedMember =
const MessageCode("DeclaredMemberConflictsWithInheritedMember",
+ analyzerCode: "DECLARED_MEMBER_CONFLICTS_WITH_INHERITED",
+ dart2jsCode: "*fatal*",
severity: Severity.errorLegacyWarning,
message:
r"""Can't declare a member that conflicts with an inherited one.""");
@@ -1998,7 +2017,9 @@
const Code<Message Function(String name)> codeDuplicatedParameterName =
const Code<Message Function(String name)>(
"DuplicatedParameterName", templateDuplicatedParameterName,
- analyzerCode: "DUPLICATE_DEFINITION", dart2jsCode: "*fatal*");
+ analyzerCode: "DUPLICATE_DEFINITION",
+ dart2jsCode: "*fatal*",
+ severity: Severity.error);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsDuplicatedParameterName(String name) {
@@ -2115,6 +2136,26 @@
tip: r"""Try re-writing the expression.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(String string)> templateExpectedAfterButGot =
+ const Template<Message Function(String string)>(
+ messageTemplate: r"""Expected '#string' after this.""",
+ withArguments: _withArgumentsExpectedAfterButGot);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String string)> codeExpectedAfterButGot =
+ const Code<Message Function(String string)>(
+ "ExpectedAfterButGot", templateExpectedAfterButGot,
+ analyzerCode: "EXPECTED_TOKEN",
+ dart2jsCode: "MISSING_TOKEN_AFTER_THIS");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsExpectedAfterButGot(String string) {
+ return new Message(codeExpectedAfterButGot,
+ message: """Expected '${string}' after this.""",
+ arguments: {'string': string});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeExpectedAnInitializer = messageExpectedAnInitializer;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -2665,9 +2706,9 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageFactoryNotSync = const MessageCode("FactoryNotSync",
- analyzerCode: "NON_SYNC_FACTORY_METHOD",
+ analyzerCode: "NON_SYNC_FACTORY",
dart2jsCode: "*ignored*",
- message: r"""Factories can't use 'async', 'async*', or 'sync*'.""");
+ message: r"""Factory bodies can't use 'async', 'async*', or 'sync*'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeFactoryTopLevelDeclaration =
@@ -2841,6 +2882,8 @@
const Code<Message Function(String name)>(
"FinalInstanceVariableAlreadyInitialized",
templateFinalInstanceVariableAlreadyInitialized,
+ analyzerCode: "FINAL_INITIALIZED_MULTIPLE_TIMES",
+ dart2jsCode: "*fatal*",
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -2876,6 +2919,46 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ DartType _type,
+ DartType
+ _type2)> templateForInLoopElementTypeNotAssignable = const Template<
+ Message Function(DartType _type, DartType _type2)>(
+ messageTemplate:
+ r"""A value of type '#type' can't be assigned to a variable of type '#type2'.""",
+ tipTemplate: r"""Try changing the type of the variable.""",
+ withArguments: _withArgumentsForInLoopElementTypeNotAssignable);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(DartType _type, DartType _type2)>
+ codeForInLoopElementTypeNotAssignable =
+ const Code<Message Function(DartType _type, DartType _type2)>(
+ "ForInLoopElementTypeNotAssignable",
+ templateForInLoopElementTypeNotAssignable,
+ analyzerCode: "FOR_IN_OF_INVALID_ELEMENT_TYPE",
+ dart2jsCode: "*fatal*");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsForInLoopElementTypeNotAssignable(
+ DartType _type, DartType _type2) {
+ NameSystem nameSystem = new NameSystem();
+ StringBuffer buffer = new StringBuffer();
+ new Printer(buffer, syntheticNames: nameSystem).writeNode(_type);
+ String type = '$buffer';
+
+ buffer = new StringBuffer();
+ new Printer(buffer, syntheticNames: nameSystem).writeNode(_type2);
+ String type2 = '$buffer';
+
+ return new Message(codeForInLoopElementTypeNotAssignable,
+ message:
+ """A value of type '${type}' can't be assigned to a variable of type '${type2}'.""",
+ tip: """Try changing the type of the variable.""",
+ arguments: {'type': _type, 'type2': _type2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeForInLoopExactlyOneVariable =
messageForInLoopExactlyOneVariable;
@@ -2896,6 +2979,42 @@
r"""Can't assign to this, so it can't be used in a for-in loop.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ DartType _type,
+ DartType
+ _type2)> templateForInLoopTypeNotIterable = const Template<
+ Message Function(DartType _type, DartType _type2)>(
+ messageTemplate:
+ r"""The type '#type' used in the 'for' loop must implement '#type2'.""",
+ withArguments: _withArgumentsForInLoopTypeNotIterable);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(DartType _type, DartType _type2)>
+ codeForInLoopTypeNotIterable =
+ const Code<Message Function(DartType _type, DartType _type2)>(
+ "ForInLoopTypeNotIterable", templateForInLoopTypeNotIterable,
+ analyzerCode: "FOR_IN_OF_INVALID_TYPE", dart2jsCode: "*fatal*");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsForInLoopTypeNotIterable(
+ DartType _type, DartType _type2) {
+ NameSystem nameSystem = new NameSystem();
+ StringBuffer buffer = new StringBuffer();
+ new Printer(buffer, syntheticNames: nameSystem).writeNode(_type);
+ String type = '$buffer';
+
+ buffer = new StringBuffer();
+ new Printer(buffer, syntheticNames: nameSystem).writeNode(_type2);
+ String type2 = '$buffer';
+
+ return new Message(codeForInLoopTypeNotIterable,
+ message:
+ """The type '${type}' used in the 'for' loop must implement '${type2}'.""",
+ arguments: {'type': _type, 'type2': _type2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeFunctionTypeDefaultValue = messageFunctionTypeDefaultValue;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -2929,6 +3048,19 @@
message: r"""'sync*' and 'async*' can't return a value.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeGenericFunctionTypeInBound =
+ messageGenericFunctionTypeInBound;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageGenericFunctionTypeInBound = const MessageCode(
+ "GenericFunctionTypeInBound",
+ analyzerCode: "GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND",
+ dart2jsCode: "*fatal*",
+ severity: Severity.error,
+ message:
+ r"""Type variables can't have generic function types in their bounds.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)> templateGetterNotFound =
const Template<Message Function(String name)>(
messageTemplate: r"""Getter not found: '#name'.""",
@@ -3131,6 +3263,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageInheritedMembersConflict = const MessageCode(
"InheritedMembersConflict",
+ analyzerCode: "CONFLICTS_WITH_INHERITED_MEMBER",
+ dart2jsCode: "*fatal*",
severity: Severity.errorLegacyWarning,
message: r"""Can't inherit members that conflict with each other.""");
@@ -4190,18 +4324,10 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageListLiteralTooManyTypeArguments = const MessageCode(
"ListLiteralTooManyTypeArguments",
+ analyzerCode: "EXPECTED_ONE_LIST_TYPE_ARGUMENTS",
+ dart2jsCode: "*fatal*",
severity: Severity.errorLegacyWarning,
- message: r"""Too many type arguments on List literal.""");
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Null> codeListLiteralTypeArgumentMismatch =
- messageListLiteralTypeArgumentMismatch;
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const MessageCode messageListLiteralTypeArgumentMismatch = const MessageCode(
- "ListLiteralTypeArgumentMismatch",
- severity: Severity.errorLegacyWarning,
- message: r"""Map literal requires two type arguments.""");
+ message: r"""List literal requires exactly one type argument.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
@@ -4235,6 +4361,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageLoadLibraryTakesNoArguments = const MessageCode(
"LoadLibraryTakesNoArguments",
+ analyzerCode: "LOAD_LIBRARY_TAKES_NO_ARGUMENTS",
+ dart2jsCode: "*fatal*",
severity: Severity.errorLegacyWarning,
message: r"""'loadLibrary' takes no arguments.""");
@@ -4285,6 +4413,18 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeMapLiteralTypeArgumentMismatch =
+ messageMapLiteralTypeArgumentMismatch;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageMapLiteralTypeArgumentMismatch = const MessageCode(
+ "MapLiteralTypeArgumentMismatch",
+ analyzerCode: "EXPECTED_TWO_MAP_TYPE_ARGUMENTS",
+ dart2jsCode: "*fatal*",
+ severity: Severity.errorLegacyWarning,
+ message: r"""Map literal requires exactly two type arguments.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeMemberWithSameNameAsClass =
messageMemberWithSameNameAsClass;
@@ -4781,6 +4921,31 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeNonConstConstructor = messageNonConstConstructor;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageNonConstConstructor = const MessageCode(
+ "NonConstConstructor",
+ analyzerCode: "NOT_CONSTANT_EXPRESSION",
+ dart2jsCode: "*fatal*",
+ severity: Severity.error,
+ message:
+ r"""Cannot invoke a non-'const' constructor where a const expression is expected.""",
+ tip: r"""Try using a constructor or factory that is 'const'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeNonConstFactory = messageNonConstFactory;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageNonConstFactory = const MessageCode("NonConstFactory",
+ analyzerCode: "NOT_CONSTANT_EXPRESSION",
+ dart2jsCode: "*fatal*",
+ severity: Severity.error,
+ message:
+ r"""Cannot invoke a non-'const' factory where a const expression is expected.""",
+ tip: r"""Try using a constructor or factory that is 'const'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeNonInstanceTypeVariableUse =
messageNonInstanceTypeVariableUse;
@@ -4850,6 +5015,17 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeNotAConstantExpression = messageNotAConstantExpression;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageNotAConstantExpression = const MessageCode(
+ "NotAConstantExpression",
+ analyzerCode: "NOT_CONSTANT_EXPRESSION",
+ dart2jsCode: "*fatal*",
+ severity: Severity.error,
+ message: r"""Not a constant expression.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
Token token,
@@ -4906,6 +5082,25 @@
const MessageCode("NotAnLvalue", message: r"""Can't assign to this.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(String string)> templateNotConstantExpression =
+ const Template<Message Function(String string)>(
+ messageTemplate: r"""#string is not a constant expression.""",
+ withArguments: _withArgumentsNotConstantExpression);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String string)> codeNotConstantExpression =
+ const Code<Message Function(String string)>(
+ "NotConstantExpression", templateNotConstantExpression,
+ analyzerCode: "NOT_CONSTANT_EXPRESSION", dart2jsCode: "*fatal*");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsNotConstantExpression(String string) {
+ return new Message(codeNotConstantExpression,
+ message: """${string} is not a constant expression.""",
+ arguments: {'string': string});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeOnlyTry = messageOnlyTry;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -5912,6 +6107,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageSuperAsExpression = const MessageCode(
"SuperAsExpression",
+ analyzerCode: "SUPER_AS_EXPRESSION",
+ dart2jsCode: "*fatal*",
message: r"""Can't use 'super' as an expression.""",
tip:
r"""To delegate a constructor to a super constructor, put the super call as an initializer.""");
@@ -6143,9 +6340,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeThisAccessInFieldInitializer =
const Code<Message Function(String name)>(
- "ThisAccessInFieldInitializer",
- templateThisAccessInFieldInitializer,
-);
+ "ThisAccessInFieldInitializer", templateThisAccessInFieldInitializer,
+ analyzerCode: "THIS_ACCESS_FROM_INITIALIZER", dart2jsCode: "*fatal*");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsThisAccessInFieldInitializer(String name) {
@@ -6356,6 +6552,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageTypeVariableSameNameAsEnclosing = const MessageCode(
"TypeVariableSameNameAsEnclosing",
+ analyzerCode: "CONFLICTING_TYPE_VARIABLE_AND_CLASS",
+ dart2jsCode: "*fatal*",
message:
r"""A type variable can't have the same name as its enclosing declaration.""");
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index f9430d9..1f5e6b5 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -933,7 +933,7 @@
int offset = builder.body?.fileOffset ?? builder.charOffset;
constructor.initializers.add(buildInvalidInitializer(
deprecated_buildCompileTimeError(
- "A constructor can't be '${asyncModifier}'.", offset),
+ null, offset, fasta.messageConstructorNotSync),
offset));
}
if (needsImplicitSuperInitializer) {
@@ -1518,7 +1518,7 @@
classBuilder.origin.findStaticBuilder(name, charOffset, uri, library);
}
if (declaration != null && member.isField && declaration.isInstanceMember) {
- return new IncompleteErrorGenerator(this, token,
+ return new IncompleteErrorGenerator(this, token, declaration.target,
fasta.templateThisAccessInFieldInitializer.withArguments(name));
}
if (declaration == null ||
@@ -1542,16 +1542,16 @@
if (constantContext != ConstantContext.none &&
declaration.isTypeVariable &&
!member.isConstructor) {
- deprecated_addCompileTimeError(
- charOffset, "Not a constant expression.");
+ addCompileTimeError(
+ fasta.messageNotAConstantExpression, charOffset, token.length);
}
return new TypeUseGenerator(this, token, declaration, name);
} else if (declaration.isLocal) {
if (constantContext != ConstantContext.none &&
!declaration.isConst &&
!member.isConstructor) {
- deprecated_addCompileTimeError(
- charOffset, "Not a constant expression.");
+ addCompileTimeError(
+ fasta.messageNotAConstantExpression, charOffset, token.length);
}
// An initializing formal parameter might be final without its
// VariableDeclaration being final. See
@@ -1578,8 +1578,8 @@
// semantics, such parameters introduces a new parameter with that
// name that should be resolved here.
!member.isConstructor) {
- deprecated_addCompileTimeError(
- charOffset, "Not a constant expression.");
+ addCompileTimeError(
+ fasta.messageNotAConstantExpression, charOffset, token.length);
}
Name n = new Name(name, library.library);
Member getter;
@@ -1619,8 +1619,8 @@
if (!(readTarget is Field && readTarget.isConst ||
// Static tear-offs are also compile time constants.
readTarget is Procedure)) {
- deprecated_addCompileTimeError(
- charOffset, "Not a constant expression.");
+ addCompileTimeError(
+ fasta.messageNotAConstantExpression, charOffset, token.length);
}
}
return generator;
@@ -1810,10 +1810,16 @@
// one variable it must be followed by `in`.
if (isConst) {
initializer = deprecated_buildCompileTimeError(
- "A 'const' variable must be initialized.", token.charOffset);
+ null,
+ token.charOffset,
+ fasta.templateConstFieldWithoutInitializer
+ .withArguments(token.lexeme));
} else if (isFinal) {
initializer = deprecated_buildCompileTimeError(
- "A 'final' variable must be initialized.", token.charOffset);
+ null,
+ token.charOffset,
+ fasta.templateFinalFieldWithoutInitializer
+ .withArguments(token.lexeme));
}
}
pushNewLocalVariable(initializer);
@@ -1893,17 +1899,25 @@
}
push(variable);
} else {
- List<VariableDeclaration> variables = popList(count,
- new List<VariableDeclaration>.filled(count, null, growable: true));
+ List<VariableDeclarationJudgment> variables = popList(
+ count,
+ new List<VariableDeclarationJudgment>.filled(count, null,
+ growable: true));
constantContext = pop();
currentLocalVariableType = pop();
currentLocalVariableModifiers = pop();
List<Expression> annotations = pop();
if (annotations != null) {
- for (VariableDeclaration variable in variables) {
+ bool isFirstVariable = true;
+ for (VariableDeclarationJudgment variable in variables) {
for (Expression annotation in annotations) {
variable.addAnnotation(annotation);
}
+ if (isFirstVariable) {
+ isFirstVariable = false;
+ } else {
+ variable.infersAnnotations = false;
+ }
}
}
push(forest.variablesDeclaration(variables, uri));
@@ -2114,7 +2128,7 @@
if (typeArguments != null) {
if (forest.getTypeCount(typeArguments) != 2) {
addProblem(
- fasta.messageListLiteralTypeArgumentMismatch,
+ fasta.messageMapLiteralTypeArgumentMismatch,
offsetForToken(leftBrace),
lengthOfSpan(leftBrace, leftBrace.endGroup));
} else {
@@ -2199,7 +2213,8 @@
}
}
if (name is Generator) {
- push(name.buildTypeWithBuiltArguments(arguments));
+ push(name.buildTypeWithBuiltArguments(arguments,
+ typeInferrer: _typeInferrer));
} else if (name is TypeBuilder) {
push(name.build(library));
} else {
@@ -2221,6 +2236,8 @@
ScopeBuilder scopeBuilder = new ScopeBuilder(scope);
for (KernelTypeVariableBuilder builder in typeVariables) {
String name = builder.name;
+ builder.binder = _typeInferrer.binderForTypeVariable(
+ builder, builder.charOffset, name);
KernelTypeVariableBuilder existing = scopeBuilder[name];
if (existing == null) {
scopeBuilder.addMember(name, builder);
@@ -2241,6 +2258,7 @@
DartType returnType = pop();
List<TypeParameter> typeVariables = typeVariableBuildersToKernel(pop());
FunctionType type = formals.toFunctionType(returnType, typeVariables);
+ _typeInferrer.functionType(functionToken.offset, type);
exitLocalScope();
push(type);
}
@@ -2248,7 +2266,9 @@
@override
void handleVoidKeyword(Token token) {
debugEvent("VoidKeyword");
- push(const VoidType());
+ var type = const VoidType();
+ _typeInferrer.voidType(token.offset, token, type);
+ push(type);
}
@override
@@ -2257,8 +2277,10 @@
DartType type = pop();
Expression expression = popForValue();
if (constantContext != ConstantContext.none) {
- push(deprecated_buildCompileTimeError(
- "Not a constant expression.", operator.charOffset));
+ push(buildCompileTimeError(
+ fasta.templateNotConstantExpression.withArguments('As expression'),
+ operator.charOffset,
+ operator.length));
} else {
push(forest.asExpression(expression, type, operator));
}
@@ -2277,8 +2299,10 @@
type, functionNestingLevel);
}
if (constantContext != ConstantContext.none) {
- push(deprecated_buildCompileTimeError(
- "Not a constant expression.", isOperator.charOffset));
+ push(buildCompileTimeError(
+ fasta.templateNotConstantExpression.withArguments('Is expression'),
+ isOperator.charOffset,
+ isOperator.length));
} else {
push(isExpression);
}
@@ -2315,14 +2339,17 @@
void handleThrowExpression(Token throwToken, Token endToken) {
debugEvent("ThrowExpression");
Expression expression = popForValue();
+
+ Expression error;
if (constantContext != ConstantContext.none) {
- push(deprecated_buildCompileTimeError(
- "Not a constant expression.", throwToken.charOffset));
- // TODO(brianwilkerson): For analyzer, we need to produce the error above
- // but then we need to produce the AST as in the `else` clause below.
- } else {
- push(forest.throwExpression(throwToken, expression));
+ error = buildCompileTimeError(
+ fasta.templateNotConstantExpression.withArguments('Throw'),
+ throwToken.offset,
+ throwToken.length);
}
+
+ push(new ThrowJudgment(throwToken, expression, desugaredError: error)
+ ..fileOffset = offsetForToken(throwToken));
}
@override
@@ -2411,7 +2438,7 @@
}
@override
- void endFunctionTypedFormalParameter() {
+ void endFunctionTypedFormalParameter(Token nameToken) {
debugEvent("FunctionTypedFormalParameter");
if (inCatchClause || functionNestingLevel != 0) {
exitLocalScope();
@@ -2420,6 +2447,7 @@
DartType returnType = pop();
List<TypeParameter> typeVariables = typeVariableBuildersToKernel(pop());
FunctionType type = formals.toFunctionType(returnType, typeVariables);
+ _typeInferrer.functionTypedFormalParameter(nameToken.offset, type);
exitLocalScope();
push(type);
functionNestingLevel--;
@@ -2725,7 +2753,9 @@
@override
Expression buildStaticInvocation(Member target, Arguments arguments,
- {Constness constness: Constness.implicit, int charOffset: -1}) {
+ {Constness constness: Constness.implicit,
+ int charOffset: -1,
+ Expression error}) {
// The argument checks for the initial target of redirecting factories
// invocations are skipped in Dart 1.
if (library.loader.target.strongMode || !isRedirectingFactory(target)) {
@@ -2737,13 +2767,20 @@
LocatedMessage argMessage = checkArgumentsForFunction(
target.function, arguments, charOffset, typeParameters);
if (argMessage != null) {
- return new SyntheticExpressionJudgment(throwNoSuchMethodError(
+ var error = throwNoSuchMethodError(
forest.literalNull(null)..fileOffset = charOffset,
target.name.name,
arguments,
charOffset,
candidate: target,
- argMessage: argMessage));
+ argMessage: argMessage);
+ if (target is Constructor) {
+ return new InvalidConstructorInvocationJudgment(
+ error, target, arguments)
+ ..fileOffset = charOffset;
+ } else {
+ return new SyntheticExpressionJudgment(error);
+ }
}
}
@@ -2754,7 +2791,7 @@
if ((isConst || constantContext == ConstantContext.inferred) &&
!target.isConst) {
return deprecated_buildCompileTimeError(
- "Not a const constructor.", charOffset);
+ null, charOffset, fasta.messageNonConstConstructor);
}
return new ConstructorInvocationJudgment(
target, forest.castArguments(arguments),
@@ -2768,7 +2805,7 @@
if ((isConst || constantContext == ConstantContext.inferred) &&
!procedure.isConst) {
return deprecated_buildCompileTimeError(
- "Not a const factory.", charOffset);
+ null, charOffset, fasta.messageNonConstFactory);
}
return new FactoryConstructorInvocationJudgment(
target, forest.castArguments(arguments),
@@ -2777,7 +2814,7 @@
} else {
return new StaticInvocationJudgment(
target, forest.castArguments(arguments),
- isConst: isConst)
+ desugaredError: error, isConst: isConst)
..fileOffset = charOffset;
}
}
@@ -2864,8 +2901,10 @@
debugEvent("beginNewExpression");
super.push(constantContext);
if (constantContext != ConstantContext.none) {
- deprecated_addCompileTimeError(
- token.charOffset, "Not a constant expression.");
+ addCompileTimeError(
+ fasta.templateNotConstantExpression.withArguments('New expression'),
+ token.charOffset,
+ token.length);
}
constantContext = ConstantContext.none;
}
@@ -3054,7 +3093,7 @@
push(new ThisAccessGenerator(this, token, inInitializer));
} else {
push(new IncompleteErrorGenerator(
- this, token, fasta.messageThisAsIdentifier));
+ this, token, null, fasta.messageThisAsIdentifier));
}
}
@@ -3067,7 +3106,7 @@
push(new ThisAccessGenerator(this, token, inInitializer, isSuper: true));
} else {
push(new IncompleteErrorGenerator(
- this, token, fasta.messageSuperAsIdentifier));
+ this, token, null, fasta.messageSuperAsIdentifier));
}
}
@@ -3247,7 +3286,7 @@
..fileEndOffset = token.charOffset);
if (constantContext != ConstantContext.none) {
push(deprecated_buildCompileTimeError(
- "Not a constant expression.", formals.charOffset));
+ null, formals.charOffset, fasta.messageNotAConstantExpression));
} else {
push(new FunctionExpressionJudgment(function)
..fileOffset = offsetForToken(beginToken));
@@ -3776,8 +3815,9 @@
// Assume an error is reported elsewhere.
variable = new KernelTypeVariableBuilder(
name.name, library, offsetForToken(name.token), null);
+ variable.binder = _typeInferrer.binderForTypeVariable(
+ variable, variable.charOffset, variable.name);
}
- storeTypeUse(offsetForToken(token), variable.target);
if (annotations != null) {
_typeInferrer.inferMetadata(this, factory, annotations);
for (Expression annotation in annotations) {
@@ -3858,7 +3898,10 @@
growable: true);
int i = 0;
for (KernelTypeVariableBuilder builder in typeVariableBuilders) {
- typeParameters[i++] = builder.target;
+ var typeParameter = builder.target;
+ _typeInferrer.typeVariableDeclaration(
+ builder.charOffset, builder.binder, typeParameter);
+ typeParameters[i++] = typeParameter;
}
return typeParameters;
}
@@ -3871,9 +3914,10 @@
@override
Expression deprecated_buildCompileTimeError(String error,
- [int charOffset = -1]) {
- return new SyntheticExpressionJudgment(buildCompileTimeError(
- fasta.templateUnspecified.withArguments(error), charOffset, noLength));
+ [int charOffset = -1, fasta.Message message]) {
+ message ??= fasta.templateUnspecified.withArguments(error);
+ return new SyntheticExpressionJudgment(
+ buildCompileTimeError(message, charOffset, noLength));
}
@override
@@ -3947,9 +3991,9 @@
}
Statement deprecated_buildCompileTimeErrorStatement(error,
- [int charOffset = -1]) {
+ [int charOffset = -1, fasta.Message message]) {
return new ExpressionStatementJudgment(
- deprecated_buildCompileTimeError(error, charOffset), null);
+ deprecated_buildCompileTimeError(error, charOffset, message), null);
}
Statement buildCompileTimeErrorStatement(Message message, int charOffset,
@@ -3977,15 +4021,16 @@
..fileOffset = charOffset;
}
- Initializer buildDuplicatedInitializer(
+ Initializer buildDuplicatedInitializer(Field field, Expression value,
String name, int offset, int previousInitializerOffset) {
- Initializer initializer = buildInvalidInitializer(
- deprecated_buildCompileTimeError(
- "'$name' has already been initialized.", offset),
- offset);
- deprecated_addCompileTimeError(
- initializedFields[name], "'$name' was initialized here.");
- return initializer;
+ var error = buildCompileTimeError(
+ fasta.templateFinalInstanceVariableAlreadyInitialized
+ .withArguments(name),
+ offset,
+ noLength);
+ return new ShadowInvalidFieldInitializer(
+ field, value, new VariableDeclaration.forValue(error))
+ ..fileOffset = offset;
}
/// Parameter [formalType] should only be passed in the special case of
@@ -4007,7 +4052,7 @@
initializedFields ??= <String, int>{};
if (initializedFields.containsKey(name)) {
return buildDuplicatedInitializer(
- name, offset, initializedFields[name]);
+ builder.field, expression, name, offset, initializedFields[name]);
}
initializedFields[name] = offset;
if (builder.isFinal && builder.hasInitializer) {
@@ -4025,14 +4070,16 @@
]);
Declaration constructor =
library.loader.getDuplicatedFieldInitializerError();
- return buildInvalidInitializer(
- new Throw(buildStaticInvocation(
+ return new ShadowInvalidFieldInitializer(
+ builder.field,
+ expression,
+ new VariableDeclaration.forValue(new Throw(buildStaticInvocation(
constructor.target,
forest.arguments(<Expression>[
forest.literalString(name, null)..fileOffset = offset
], noLocation),
- charOffset: offset)),
- offset);
+ charOffset: offset))))
+ ..fileOffset = offset;
} else {
if (library.loader.target.strongMode &&
formalType != null &&
@@ -4117,12 +4164,12 @@
}
@override
- void deprecated_addCompileTimeError(int charOffset, String message,
- {bool wasHandled: false}) {
+ void deprecated_addCompileTimeError(int charOffset, String error,
+ {fasta.Message message, bool wasHandled: false}) {
// TODO(ahe): Consider setting [constantContext] to `ConstantContext.none`
// to avoid a long list of errors.
return library.addCompileTimeError(
- fasta.templateUnspecified.withArguments(message),
+ message ?? fasta.templateUnspecified.withArguments(error),
charOffset,
noLength,
uri,
@@ -4137,8 +4184,8 @@
push(forest.block(
token,
<Statement>[
- deprecated_buildCompileTimeErrorStatement(
- "Expected '{'.", token.charOffset)
+ deprecated_buildCompileTimeErrorStatement(null, token.charOffset,
+ fasta.templateExpectedFunctionBody.withArguments(token))
],
null));
}
@@ -4188,14 +4235,18 @@
@override
Expression buildMethodInvocation(
Expression receiver, Name name, Arguments arguments, int offset,
- {bool isConstantExpression: false,
+ {Expression error,
+ bool isConstantExpression: false,
bool isNullAware: false,
bool isImplicitCall: false,
bool isSuper: false,
Member interfaceTarget}) {
if (constantContext != ConstantContext.none && !isConstantExpression) {
- return deprecated_buildCompileTimeError(
- "Not a constant expression.", offset);
+ error = buildCompileTimeError(
+ fasta.templateNotConstantExpression
+ .withArguments('Method invocation'),
+ offset,
+ name.name.length);
}
if (isSuper) {
// We can ignore [isNullAware] on super sends.
@@ -4214,15 +4265,17 @@
name.name.length);
}
return new SuperMethodInvocationJudgment(
- name, forest.castArguments(arguments), target)
+ name, forest.castArguments(arguments),
+ interfaceTarget: target, desugaredError: error)
..fileOffset = offset;
}
- receiver = new SuperPropertyGetJudgment(name, target)
+ receiver = new SuperPropertyGetJudgment(name,
+ interfaceTarget: target, desugaredError: error)
..fileOffset = offset;
return new MethodInvocationJudgment(
receiver, callName, forest.castArguments(arguments),
- isImplicitCall: true)
+ isImplicitCall: true, desugaredError: error)
..fileOffset = forest.readOffset(arguments);
}
@@ -4238,12 +4291,15 @@
new MethodInvocation(new VariableGet(variable), name,
forest.castArguments(arguments), interfaceTarget)
..fileOffset = offset)
- ..fileOffset = offset)
+ ..fileOffset = offset,
+ desugaredError: error)
..fileOffset = offset;
} else {
return new MethodInvocationJudgment(
receiver, name, forest.castArguments(arguments),
- isImplicitCall: isImplicitCall, interfaceTarget: interfaceTarget)
+ isImplicitCall: isImplicitCall,
+ interfaceTarget: interfaceTarget,
+ desugaredError: error)
..fileOffset = offset;
}
}
@@ -4327,6 +4383,11 @@
void storeTypeUse(int offset, Node node) {
_typeInferrer.storeTypeUse(offset, node);
}
+
+ @override
+ void storeUnresolvedPrefix(Token token) {
+ _typeInferrer.storePrefix(token, null);
+ }
}
class Identifier {
@@ -4559,20 +4620,26 @@
Map<String, Declaration> local = <String, Declaration>{};
for (VariableDeclaration parameter in required) {
- if (local[parameter.name] != null) {
- helper.deprecated_addCompileTimeError(
- parameter.fileOffset, "Duplicated name.");
+ String name = parameter.name;
+ if (local[name] != null) {
+ helper.addProblem(
+ fasta.templateDuplicatedParameterName.withArguments(name),
+ parameter.fileOffset,
+ name.length);
}
- local[parameter.name] = new KernelVariableBuilder(
+ local[name] = new KernelVariableBuilder(
parameter, declaration, declaration.fileUri);
}
if (optional != null) {
for (VariableDeclaration parameter in optional.formals) {
- if (local[parameter.name] != null) {
- helper.deprecated_addCompileTimeError(
- parameter.fileOffset, "Duplicated name.");
+ String name = parameter.name;
+ if (local[name] != null) {
+ helper.addProblem(
+ fasta.templateDuplicatedParameterName.withArguments(name),
+ parameter.fileOffset,
+ name.length);
}
- local[parameter.name] = new KernelVariableBuilder(
+ local[name] = new KernelVariableBuilder(
parameter, declaration, declaration.fileUri);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
index 104f94f..48ac12e 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
@@ -16,6 +16,7 @@
messageCantUsePrefixAsExpression,
messageCantUsePrefixWithNullAware,
messageInvalidInitializer,
+ messageNotAConstantExpression,
templateCantUseDeferredPrefixAsConstant,
templateDeferredTypeAnnotation,
templateIntegerLiteralIsOutOfRange,
@@ -43,6 +44,8 @@
import '../problems.dart' show unhandled, unsupported;
+import '../type_inference/type_inferrer.dart' show TypeInferrer;
+
import 'constness.dart' show Constness;
import 'expression_generator_helper.dart' show ExpressionGeneratorHelper;
@@ -64,23 +67,30 @@
DynamicType,
Expression,
Initializer,
+ InvalidConstructorInvocationJudgment,
InvalidType,
Member,
Name,
Procedure,
SyntheticExpressionJudgment,
+ TreeNode,
TypeParameterType,
+ UnresolvedVariableUnaryJudgment,
VariableDeclaration;
import 'kernel_builder.dart'
show
AccessErrorBuilder,
BuiltinTypeBuilder,
+ ClassBuilder,
Declaration,
+ DynamicTypeBuilder,
FunctionTypeAliasBuilder,
+ InvalidTypeBuilder,
KernelClassBuilder,
KernelFunctionTypeAliasBuilder,
- KernelTypeVariableBuilder;
+ KernelTypeVariableBuilder,
+ TypeVariableBuilder;
import 'kernel_expression_generator.dart'
show IncompleteSendGenerator, SendAccessGenerator;
@@ -202,8 +212,8 @@
} else {
if (helper.constantContext != ConstantContext.none &&
send.name != lengthName) {
- helper.deprecated_addCompileTimeError(
- offsetForToken(token), "Not a constant expression.");
+ helper.addCompileTimeError(
+ messageNotAConstantExpression, offsetForToken(token), token.length);
}
return PropertyAccessGenerator.make(helper, send.token, buildSimpleRead(),
send.name, null, null, isNullAware);
@@ -211,7 +221,7 @@
}
DartType buildTypeWithBuiltArguments(List<DartType> arguments,
- {bool nonInstanceAccessIsError: false}) {
+ {bool nonInstanceAccessIsError: false, TypeInferrer typeInferrer}) {
helper.addProblem(templateNotAType.withArguments(token.lexeme),
offsetForToken(token), lengthForToken(token));
return const InvalidType();
@@ -227,11 +237,14 @@
assert(forest.argumentsTypeArguments(arguments).isEmpty);
forest.argumentsSetTypeArguments(arguments, typeArguments);
}
- return new SyntheticExpressionJudgment(helper.throwNoSuchMethodError(
+ helper.storeTypeUse(offsetForToken(token), const InvalidType());
+ var error = helper.throwNoSuchMethodError(
forest.literalNull(token),
name == "" ? plainNameForRead : "${plainNameForRead}.$name",
arguments,
- nameToken.charOffset));
+ nameToken.charOffset);
+
+ return new InvalidConstructorInvocationJudgment(error, null, arguments);
}
bool get isThisPropertyAccess => false;
@@ -502,7 +515,7 @@
@override
DartType buildTypeWithBuiltArguments(List<DartType> arguments,
- {bool nonInstanceAccessIsError: false}) {
+ {bool nonInstanceAccessIsError: false, TypeInferrer typeInferrer}) {
helper.addProblem(
templateDeferredTypeAnnotation.withArguments(
suffixGenerator.buildTypeWithBuiltArguments(arguments,
@@ -554,7 +567,8 @@
@override
DartType buildTypeWithBuiltArguments(List<DartType> arguments,
- {bool nonInstanceAccessIsError: false}) {
+ {bool nonInstanceAccessIsError: false, TypeInferrer typeInferrer}) {
+ var declaration = this.declaration;
if (arguments != null) {
int expected = 0;
if (declaration is KernelClassBuilder) {
@@ -600,6 +614,28 @@
type =
declaration.buildTypesWithBuiltArguments(helper.library, arguments);
}
+ TreeNode declarationTarget;
+ Object declarationBinder;
+ if (declaration is KernelTypeVariableBuilder &&
+ declaration.binder != null) {
+ declarationBinder = declaration.binder;
+ } else if (declaration is DynamicTypeBuilder ||
+ declaration is InvalidTypeBuilder) {
+ // There's no target associated with these types, so we have to let
+ // the analyzer fill it in.
+ } else if (declaration is ClassBuilder ||
+ declaration is TypeVariableBuilder ||
+ declaration is FunctionTypeAliasBuilder) {
+ declarationTarget = declaration.target;
+ } else {
+ return unhandled(
+ "${declaration.runtimeType}",
+ "TypeUseGenerator.buildTypeWithBuiltArguments",
+ offsetForToken(token),
+ helper.uri);
+ }
+ typeInferrer?.storeTypeReference(
+ token.charOffset, declarationTarget, declarationBinder, type);
if (type is TypeParameterType) {
return helper.validatedTypeVariableUse(
type, offsetForToken(token), nonInstanceAccessIsError);
@@ -713,25 +749,25 @@
@override
Expression buildPrefixIncrement(Name binaryOperator,
{int offset: -1, bool voidContext: false, Procedure interfaceTarget}) {
- // TODO(ahe): For the Analyzer, we probably need to build a prefix
- // increment node that wraps an error.
- return new SyntheticExpressionJudgment(buildError(
+ var error = buildError(
forest.arguments(
<Expression>[forest.literalInt(1, null)..fileOffset = offset],
token),
- isGetter: true));
+ isGetter: true);
+ return new UnresolvedVariableUnaryJudgment(error, token)
+ ..fileOffset = offset;
}
@override
Expression buildPostfixIncrement(Name binaryOperator,
{int offset: -1, bool voidContext: false, Procedure interfaceTarget}) {
- // TODO(ahe): For the Analyzer, we probably need to build a post increment
- // node that wraps an error.
- return new SyntheticExpressionJudgment(buildError(
+ var error = buildError(
forest.arguments(
<Expression>[forest.literalInt(1, null)..fileOffset = offset],
token),
- isGetter: true));
+ isGetter: true);
+ return new UnresolvedVariableUnaryJudgment(error, token)
+ ..fileOffset = offset;
}
@override
@@ -761,11 +797,13 @@
@override
Expression invokeConstructor(List<DartType> typeArguments, String name,
Arguments arguments, Token nameToken, Constness constness) {
+ helper.storeTypeUse(offsetForToken(token), const InvalidType());
if (typeArguments != null) {
assert(forest.argumentsTypeArguments(arguments).isEmpty);
forest.argumentsSetTypeArguments(arguments, typeArguments);
}
- return new SyntheticExpressionJudgment(buildError(arguments));
+ var error = buildError(arguments);
+ return new InvalidConstructorInvocationJudgment(error, null, arguments);
}
}
@@ -799,6 +837,7 @@
@override
/* Expression | Generator */ Object prefixedLookup(Token name) {
+ helper.storeUnresolvedPrefix(token);
return new UnexpectedQualifiedUseGenerator(helper, name, this, true);
}
}
@@ -910,7 +949,7 @@
Expression handleAssignment(bool voidContext) {
if (helper.constantContext != ConstantContext.none) {
return helper.deprecated_buildCompileTimeError(
- "Not a constant expression.", offsetForToken(token));
+ null, offsetForToken(token), messageNotAConstantExpression);
}
if (identical("=", assignmentOperator)) {
return generator.buildAssignment(value, voidContext: voidContext);
@@ -1133,7 +1172,7 @@
@override
DartType buildTypeWithBuiltArguments(List<DartType> arguments,
- {bool nonInstanceAccessIsError: false}) {
+ {bool nonInstanceAccessIsError: false, TypeInferrer typeInferrer}) {
Template<Message Function(Token, Token)> template = isUnresolved
? templateUnresolvedPrefixInTypeAnnotation
: templateNotAPrefixInTypeAnnotation;
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
index 2a554c6..e8b0d48 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
@@ -77,7 +77,8 @@
Expression wrapInCompileTimeError(Expression expression, Message message);
- Expression deprecated_buildCompileTimeError(String error, [int offset]);
+ Expression deprecated_buildCompileTimeError(String error,
+ [int offset, Message message]);
Initializer buildInvalidInitializer(Expression expression, [int offset]);
@@ -94,7 +95,7 @@
[int charOffset = -1]);
Expression buildStaticInvocation(Procedure target, Arguments arguments,
- {Constness constness, int charOffset});
+ {Constness constness, int charOffset, Expression error});
Expression buildProblemExpression(
ProblemBuilder builder, int offset, int length);
@@ -125,7 +126,8 @@
Expression buildMethodInvocation(
Expression receiver, Name name, Arguments arguments, int offset,
- {bool isConstantExpression,
+ {Expression error,
+ bool isConstantExpression,
bool isNullAware,
bool isImplicitCall,
bool isSuper,
@@ -143,6 +145,9 @@
DartType validatedTypeVariableUse(
TypeParameterType type, int offset, bool nonInstanceAccessIsError);
+ void addCompileTimeError(Message message, int charOffset, int length,
+ {List<LocatedMessage> context});
+
void addProblem(Message message, int charOffset, int length);
void addProblemErrorIfConst(Message message, int charOffset, int length);
@@ -163,4 +168,6 @@
Arguments arguments, Expression expression);
void storeTypeUse(int offset, Node node);
+
+ void storeUnresolvedPrefix(Token token);
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/factory.dart b/pkg/front_end/lib/src/fasta/kernel/factory.dart
index 7018d22..2976ba9 100644
--- a/pkg/front_end/lib/src/fasta/kernel/factory.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/factory.dart
@@ -2,7 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:kernel/ast.dart' show Catch, DartType, FunctionType, Node;
+import 'package:kernel/ast.dart'
+ show Catch, DartType, FunctionType, Node, TypeParameter;
import 'package:kernel/type_algebra.dart' show Substitution;
@@ -15,6 +16,8 @@
StatementJudgment,
SwitchCaseJudgment;
+import 'kernel_type_variable_builder.dart' show KernelTypeVariableBuilder;
+
/// Abstract base class for factories that can construct trees of expressions,
/// statements, initializers, and literal types based on tokens, inferred types,
/// and invocation targets.
@@ -51,6 +54,21 @@
Expression awaitExpression(ExpressionJudgment judgment, int fileOffset,
Token awaitKeyword, Expression expression, DartType inferredType);
+ Object binderForFunctionDeclaration(
+ StatementJudgment judgment, int fileOffset, String name);
+
+ Object binderForStatementLabel(
+ StatementJudgment judgment, int fileOffset, String name);
+
+ Object binderForSwitchLabel(
+ SwitchCaseJudgment judgment, int fileOffset, String name);
+
+ Object binderForTypeVariable(
+ KernelTypeVariableBuilder builder, int fileOffset, String name);
+
+ Object binderForVariableDeclaration(
+ StatementJudgment judgment, int fileOffset, String name);
+
Statement block(StatementJudgment judgment, int fileOffset, Token leftBracket,
List<Statement> statements, Token rightBracket);
@@ -183,12 +201,13 @@
Statement functionDeclaration(
covariant Object binder, FunctionType inferredType);
- Object binderForFunctionDeclaration(
- StatementJudgment judgment, int fileOffset, String name);
-
Expression functionExpression(
ExpressionJudgment judgment, int fileOffset, DartType inferredType);
+ Object functionType(int fileOffset, DartType type);
+
+ Object functionTypedFormalParameter(int fileOffset, DartType type);
+
Expression ifNull(
ExpressionJudgment judgment,
int fileOffset,
@@ -237,11 +256,6 @@
Statement labeledStatement(List<Object> labels, Statement statement);
- Object statementLabel(covariant Object binder, Token label, Token colon);
-
- Object binderForStatementLabel(
- StatementJudgment judgment, int fileOffset, String name);
-
Expression listLiteral(
ExpressionJudgment judgment,
int fileOffset,
@@ -333,6 +347,8 @@
Statement returnStatement(StatementJudgment judgment, int fileOffset,
Token returnKeyword, Expression expression, Token semicolon);
+ Object statementLabel(covariant Object binder, Token label, Token colon);
+
Expression staticAssign(
ExpressionJudgment judgment,
int fileOffset,
@@ -353,6 +369,12 @@
Substitution substitution,
DartType inferredType);
+ /// TODO(paulberry): this isn't really shaped properly for a factory class.
+ void storeClassReference(int fileOffset, Node reference, DartType rawType);
+
+ /// TODO(paulberry): this isn't really shaped properly for a factory class.
+ void storePrefixInfo(int fileOffset, int prefixImportIndex);
+
Expression stringConcatenation(
ExpressionJudgment judgment, int fileOffset, DartType inferredType);
@@ -377,9 +399,6 @@
Object switchLabel(covariant Object binder, Token label, Token colon);
- Object binderForSwitchLabel(
- SwitchCaseJudgment judgment, int fileOffset, String name);
-
Statement switchStatement(
StatementJudgment judgment,
int fileOffset,
@@ -419,6 +438,18 @@
Expression typeLiteral(ExpressionJudgment judgment, int fileOffset,
Node expressionType, DartType inferredType);
+ Type typeReference(
+ int fileOffset,
+ Token leftBracket,
+ List<Type> typeArguments,
+ Token rightBracket,
+ Node reference,
+ covariant Object binder,
+ DartType type);
+
+ Object typeVariableDeclaration(
+ int fileOffset, covariant Object binder, TypeParameter typeParameter);
+
Expression variableAssign(
ExpressionJudgment judgment,
int fileOffset,
@@ -430,9 +461,6 @@
Statement variableDeclaration(
covariant Object binder, DartType statementType, DartType inferredType);
- Object binderForVariableDeclaration(
- StatementJudgment judgment, int fileOffset, String name);
-
Expression variableGet(ExpressionJudgment judgment, int fileOffset,
bool isInCascade, covariant Object variableBinder, DartType inferredType);
@@ -447,10 +475,4 @@
Statement yieldStatement(StatementJudgment judgment, int fileOffset,
Token yieldKeyword, Token star, Expression expression, Token semicolon);
-
- /// TODO(paulberry): this isn't really shaped properly for a factory class.
- void storePrefixInfo(int fileOffset, int prefixImportIndex);
-
- /// TODO(paulberry): this isn't really shaped properly for a factory class.
- void storeClassReference(int fileOffset, Node reference, DartType rawType);
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
index 85c163a..9fcdcb3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
@@ -257,8 +257,8 @@
DartType getTypeAt(List typeArguments, int index) => typeArguments[index];
@override
- Expression loadLibrary(LibraryDependency dependency) {
- return new LoadLibraryJudgment(dependency);
+ Expression loadLibrary(LibraryDependency dependency, Arguments arguments) {
+ return new LoadLibraryJudgment(dependency, arguments);
}
@override
diff --git a/pkg/front_end/lib/src/fasta/kernel/forest.dart b/pkg/front_end/lib/src/fasta/kernel/forest.dart
index 19f4b7d..b66c371 100644
--- a/pkg/front_end/lib/src/fasta/kernel/forest.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/forest.dart
@@ -158,7 +158,7 @@
/// associated with the argument at the given [index].
DartType getTypeAt(covariant typeArguments, int index);
- Expression loadLibrary(covariant dependency);
+ Expression loadLibrary(covariant dependency, Arguments arguments);
Expression checkLibraryIsLoaded(covariant dependency);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
index dd37979..962ceae 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
@@ -92,9 +92,12 @@
IllegalAssignmentJudgment,
IndexAssignmentJudgment,
InvalidConstructorInvocationJudgment,
+ InvalidPropertyGetJudgment,
InvalidVariableWriteJudgment,
+ ShadowInvalidFieldInitializer,
ShadowInvalidInitializer,
LabeledStatementJudgment,
+ LoadLibraryTearOffJudgment,
LogicalJudgment,
MethodInvocationJudgment,
NamedFunctionExpressionJudgment,
@@ -113,9 +116,11 @@
SwitchCaseJudgment,
SwitchStatementJudgment,
SyntheticExpressionJudgment,
+ ThrowJudgment,
UnresolvedTargetInvocationJudgment,
UnresolvedVariableGetJudgment,
UnresolvedVariableAssignmentJudgment,
+ UnresolvedVariableUnaryJudgment,
VariableAssignmentJudgment,
VariableDeclarationJudgment,
VariableGetJudgment,
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
index e30260e..854ac86 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
@@ -289,8 +289,26 @@
void checkOverrides(
ClassHierarchy hierarchy, TypeEnvironment typeEnvironment) {
- hierarchy.forEachOverridePair(cls,
- (Member declaredMember, Member interfaceMember, bool isSetter) {
+ handleSeenCovariant(
+ Member declaredMember,
+ Member interfaceMember,
+ bool isSetter,
+ callback(
+ Member declaredMember, Member interfaceMember, bool isSetter)) {
+ // When a parameter is covariant we have to check that we also
+ // override the same member in all parents.
+ for (Supertype supertype in interfaceMember.enclosingClass.supers) {
+ Member m = hierarchy.getInterfaceMember(
+ supertype.classNode, interfaceMember.name,
+ setter: isSetter);
+ if (m != null) {
+ callback(declaredMember, m, isSetter);
+ }
+ }
+ }
+
+ overridePairCallback(
+ Member declaredMember, Member interfaceMember, bool isSetter) {
if (declaredMember is Constructor || interfaceMember is Constructor) {
unimplemented("Constructor in override check.",
declaredMember.fileOffset, fileUri);
@@ -298,8 +316,12 @@
if (declaredMember is Procedure && interfaceMember is Procedure) {
if (declaredMember.kind == ProcedureKind.Method &&
interfaceMember.kind == ProcedureKind.Method) {
- checkMethodOverride(
+ bool seenCovariant = checkMethodOverride(
hierarchy, typeEnvironment, declaredMember, interfaceMember);
+ if (seenCovariant) {
+ handleSeenCovariant(declaredMember, interfaceMember, isSetter,
+ overridePairCallback);
+ }
}
if (declaredMember.kind == ProcedureKind.Getter &&
interfaceMember.kind == ProcedureKind.Getter) {
@@ -308,12 +330,38 @@
}
if (declaredMember.kind == ProcedureKind.Setter &&
interfaceMember.kind == ProcedureKind.Setter) {
- checkSetterOverride(
+ bool seenCovariant = checkSetterOverride(
hierarchy, typeEnvironment, declaredMember, interfaceMember);
+ if (seenCovariant) {
+ handleSeenCovariant(declaredMember, interfaceMember, isSetter,
+ overridePairCallback);
+ }
+ }
+ } else {
+ bool declaredMemberHasGetter = declaredMember is Field ||
+ declaredMember is Procedure && declaredMember.isGetter;
+ bool interfaceMemberHasGetter = interfaceMember is Field ||
+ interfaceMember is Procedure && interfaceMember.isGetter;
+ bool declaredMemberHasSetter = declaredMember is Field ||
+ declaredMember is Procedure && declaredMember.isSetter;
+ bool interfaceMemberHasSetter = interfaceMember is Field ||
+ interfaceMember is Procedure && interfaceMember.isSetter;
+ if (declaredMemberHasGetter && interfaceMemberHasGetter) {
+ checkGetterOverride(
+ hierarchy, typeEnvironment, declaredMember, interfaceMember);
+ } else if (declaredMemberHasSetter && interfaceMemberHasSetter) {
+ bool seenCovariant = checkSetterOverride(
+ hierarchy, typeEnvironment, declaredMember, interfaceMember);
+ if (seenCovariant) {
+ handleSeenCovariant(declaredMember, interfaceMember, isSetter,
+ overridePairCallback);
+ }
}
}
// TODO(ahe): Handle other cases: accessors, operators, and fields.
- });
+ }
+
+ hierarchy.forEachOverridePair(cls, overridePairCallback);
}
void checkAbstractMembers(CoreTypes coreTypes, ClassHierarchy hierarchy) {
@@ -432,8 +480,8 @@
cloned.parent = cls;
KernelLibraryBuilder library = this.library;
- library.noSuchMethodForwardersOrigins.add(cloned);
- library.noSuchMethodForwardersOrigins.add(procedure);
+ library.forwardersOrigins.add(cloned);
+ library.forwardersOrigins.add(procedure);
}
void addNoSuchMethodForwarderGetterForField(Member noSuchMethod,
@@ -621,8 +669,32 @@
declaredFunction?.typeParameters != null) {
var substitution = <TypeParameter, DartType>{};
for (int i = 0; i < declaredFunction.typeParameters.length; ++i) {
- var declaredParameter = declaredFunction.typeParameters[i];
- var interfaceParameter = interfaceFunction.typeParameters[i];
+ TypeParameter declaredParameter = declaredFunction.typeParameters[i];
+ TypeParameter interfaceParameter = interfaceFunction.typeParameters[i];
+ if (!interfaceParameter.isGenericCovariantImpl) {
+ DartType declaredBound = declaredParameter.bound;
+ DartType interfaceBound = interfaceParameter.bound;
+ if (interfaceSubstitution != null) {
+ declaredBound = interfaceSubstitution.substituteType(declaredBound);
+ interfaceBound =
+ interfaceSubstitution.substituteType(interfaceBound);
+ }
+ if (declaredBound != interfaceBound) {
+ addProblem(
+ templateOverrideTypeVariablesMismatch.withArguments(
+ "$name::${declaredMember.name.name}",
+ "${interfaceMember.enclosingClass.name}::"
+ "${interfaceMember.name.name}"),
+ declaredMember.fileOffset,
+ noLength,
+ context: [
+ templateOverriddenMethodCause
+ .withArguments(interfaceMember.name.name)
+ .withLocation(_getMemberUri(interfaceMember),
+ interfaceMember.fileOffset, noLength)
+ ]);
+ }
+ }
substitution[interfaceParameter] =
new TypeParameterType(declaredParameter);
}
@@ -642,14 +714,15 @@
DartType declaredType,
DartType interfaceType,
bool isCovariant,
- VariableDeclaration declaredParameter) {
+ VariableDeclaration declaredParameter,
+ {bool asIfDeclaredParameter = false}) {
if (!library.loader.target.backendTarget.strongMode) return false;
if (interfaceSubstitution != null) {
interfaceType = interfaceSubstitution.substituteType(interfaceType);
}
- bool inParameter = declaredParameter != null;
+ bool inParameter = declaredParameter != null || asIfDeclaredParameter;
DartType subtype = inParameter ? interfaceType : declaredType;
DartType supertype = inParameter ? declaredType : interfaceType;
@@ -687,7 +760,9 @@
return false;
}
- void checkMethodOverride(
+ /// Returns whether a covariant parameter was seen and more methods thus have
+ /// to be checked.
+ bool checkMethodOverride(
ClassHierarchy hierarchy,
TypeEnvironment typeEnvironment,
Procedure declaredMember,
@@ -695,10 +770,11 @@
if (declaredMember.enclosingClass != cls) {
// TODO(ahe): Include these checks as well, but the message needs to
// explain that [declaredMember] is inherited.
- return;
+ return false;
}
assert(declaredMember.kind == ProcedureKind.Method);
assert(interfaceMember.kind == ProcedureKind.Method);
+ bool seenCovariant = false;
FunctionNode declaredFunction = declaredMember.function;
FunctionNode interfaceFunction = interfaceMember.function;
@@ -766,10 +842,11 @@
interfaceFunction.positionalParameters[i].type,
declaredParameter.isCovariant,
declaredParameter);
+ if (declaredParameter.isCovariant) seenCovariant = true;
}
if (declaredFunction.namedParameters.isEmpty &&
interfaceFunction.namedParameters.isEmpty) {
- return;
+ return seenCovariant;
}
if (declaredFunction.namedParameters.length <
interfaceFunction.namedParameters.length) {
@@ -834,14 +911,16 @@
interfaceNamedParameters.current.type,
declaredParameter.isCovariant,
declaredParameter);
+ if (declaredParameter.isCovariant) seenCovariant = true;
}
+ return seenCovariant;
}
void checkGetterOverride(
ClassHierarchy hierarchy,
TypeEnvironment typeEnvironment,
- Procedure declaredMember,
- Procedure interfaceMember) {
+ Member declaredMember,
+ Member interfaceMember) {
if (declaredMember.enclosingClass != cls) {
// TODO(paulberry): Include these checks as well, but the message needs to
// explain that [declaredMember] is inherited.
@@ -855,22 +934,26 @@
interfaceMember, declaredType, interfaceType, false, null);
}
- void checkSetterOverride(
+ /// Returns whether a covariant parameter was seen and more methods thus have
+ /// to be checked.
+ bool checkSetterOverride(
ClassHierarchy hierarchy,
TypeEnvironment typeEnvironment,
- Procedure declaredMember,
- Procedure interfaceMember) {
+ Member declaredMember,
+ Member interfaceMember) {
if (declaredMember.enclosingClass != cls) {
// TODO(paulberry): Include these checks as well, but the message needs to
// explain that [declaredMember] is inherited.
- return;
+ return false;
}
Substitution interfaceSubstitution = _computeInterfaceSubstitution(
hierarchy, declaredMember, interfaceMember, null, null);
var declaredType = declaredMember.setterType;
var interfaceType = interfaceMember.setterType;
- var declaredParameter = declaredMember.function.positionalParameters[0];
- bool isCovariant = declaredParameter.isCovariant;
+ var declaredParameter =
+ declaredMember.function?.positionalParameters?.elementAt(0);
+ bool isCovariant = declaredParameter?.isCovariant ?? false;
+ if (declaredMember is Field) isCovariant = declaredMember.isCovariant;
_checkTypes(
typeEnvironment,
interfaceSubstitution,
@@ -879,7 +962,9 @@
declaredType,
interfaceType,
isCovariant,
- declaredParameter);
+ declaredParameter,
+ asIfDeclaredParameter: true);
+ return isCovariant;
}
String get fullNameForErrors {
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
index 4e5426b..0b4dadd 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
@@ -13,7 +13,9 @@
show
LocatedMessage,
messageLoadLibraryTakesNoArguments,
- messageSuperAsExpression;
+ messageNotAConstantExpression,
+ messageSuperAsExpression,
+ templateNotConstantExpression;
import '../messages.dart' show Message, noLength;
@@ -23,6 +25,8 @@
import '../problems.dart' show unhandled, unsupported;
+import '../type_inference/type_inferrer.dart' show TypeInferrer;
+
import 'body_builder.dart' show noLocation;
import 'constness.dart' show Constness;
@@ -77,7 +81,9 @@
ComplexAssignmentJudgment,
IllegalAssignmentJudgment,
IndexAssignmentJudgment,
+ InvalidPropertyGetJudgment,
InvalidVariableWriteJudgment,
+ LoadLibraryTearOffJudgment,
MethodInvocationJudgment,
NullAwarePropertyGetJudgment,
PropertyAssignmentJudgment,
@@ -166,9 +172,11 @@
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget,
- bool isPreIncDec: false}) {
+ bool isPreIncDec: false,
+ bool isPostIncDec: false}) {
var complexAssignment = startComplexAssignment(value);
complexAssignment?.isPreIncDec = isPreIncDec;
+ complexAssignment?.isPostIncDec = isPostIncDec;
var combiner = makeBinary(_makeRead(complexAssignment), binaryOperator,
interfaceTarget, value, helper,
offset: offset);
@@ -196,8 +204,12 @@
bool voidContext: false,
Procedure interfaceTarget}) {
if (voidContext) {
- return buildPrefixIncrement(binaryOperator,
- offset: offset, voidContext: true, interfaceTarget: interfaceTarget);
+ return buildCompoundAssignment(
+ binaryOperator, forest.literalInt(1, null)..fileOffset = offset,
+ offset: offset,
+ voidContext: voidContext,
+ interfaceTarget: interfaceTarget,
+ isPostIncDec: true);
}
var rhs = forest.literalInt(1, null)..fileOffset = offset;
var complexAssignment = startComplexAssignment(rhs);
@@ -611,7 +623,7 @@
helper.warnUnresolvedGet(name, offsetForToken(token), isSuper: true);
}
// TODO(ahe): Use [DirectPropertyGet] when possible.
- var read = new SuperPropertyGetJudgment(name, getter)
+ var read = new SuperPropertyGetJudgment(name, interfaceTarget: getter)
..fileOffset = offsetForToken(token);
complexAssignment?.read = read;
return read;
@@ -633,8 +645,8 @@
@override
Expression doInvocation(int offset, Arguments arguments) {
if (helper.constantContext != ConstantContext.none) {
- helper.deprecated_addCompileTimeError(
- offset, "Not a constant expression.");
+ // TODO(brianwilkerson) Fix the length
+ helper.addCompileTimeError(messageNotAConstantExpression, offset, 1);
}
if (getter == null || isFieldOrGetter(getter)) {
return helper.buildMethodInvocation(
@@ -974,10 +986,9 @@
isSuper: true);
}
// TODO(ahe): Use [DirectMethodInvocation] when possible.
- return new SuperMethodInvocationJudgment(
- indexGetName,
+ return new SuperMethodInvocationJudgment(indexGetName,
forest.castArguments(forest.arguments(<Expression>[index], token)),
- getter)
+ interfaceTarget: getter)
..fileOffset = offsetForToken(token);
}
@@ -1106,21 +1117,25 @@
@override
Expression doInvocation(int offset, Arguments arguments) {
+ Expression error;
if (helper.constantContext != ConstantContext.none &&
!helper.isIdentical(readTarget)) {
- helper.deprecated_addCompileTimeError(
- offset, "Not a constant expression.");
+ error = helper.buildCompileTimeError(
+ templateNotConstantExpression.withArguments('Method invocation'),
+ offset,
+ readTarget?.name?.name?.length ?? 0);
}
if (readTarget == null || isFieldOrGetter(readTarget)) {
return helper.buildMethodInvocation(buildSimpleRead(), callName,
arguments, offset + (readTarget?.name?.name?.length ?? 0),
+ error: error,
// This isn't a constant expression, but we have checked if a
// constant expression error should be emitted already.
isConstantExpression: true,
isImplicitCall: true);
} else {
return helper.buildStaticInvocation(readTarget, arguments,
- charOffset: offset);
+ charOffset: offset, error: error);
}
}
@@ -1148,8 +1163,10 @@
@override
Expression _makeRead(ComplexAssignmentJudgment complexAssignment) {
- var read =
- helper.makeStaticGet(builder.createTearoffMethod(helper.forest), token);
+ builder.importDependency.targetLibrary;
+ var read = new LoadLibraryTearOffJudgment(
+ builder.importDependency, builder.createTearoffMethod(helper.forest))
+ ..fileOffset = offsetForToken(token);
complexAssignment?.read = read;
return read;
}
@@ -1161,7 +1178,7 @@
helper.addProblemErrorIfConst(
messageLoadLibraryTakesNoArguments, offset, 'loadLibrary'.length);
}
- return builder.createLoadLibrary(offset, forest);
+ return builder.createLoadLibrary(offset, forest, arguments);
}
@override
@@ -1205,6 +1222,10 @@
prefixGenerator.prefix,
token.charOffset);
}
+
+ @override
+ ComplexAssignmentJudgment startComplexAssignment(Expression rhs) =>
+ new StaticAssignmentJudgment(rhs);
}
class KernelTypeUseGenerator extends KernelReadOnlyAccessGenerator
@@ -1417,6 +1438,15 @@
..fileOffset = token.charOffset;
}
+ DartType buildTypeWithBuiltArguments(List<DartType> arguments,
+ {bool nonInstanceAccessIsError: false, TypeInferrer typeInferrer}) {
+ var type = super.buildTypeWithBuiltArguments(arguments,
+ nonInstanceAccessIsError: nonInstanceAccessIsError,
+ typeInferrer: typeInferrer);
+ typeInferrer.storeTypeReference(token.offset, null, null, type);
+ return type;
+ }
+
@override
void printOn(StringSink sink) {
sink.write(", name: ");
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart
index e08ca25..392ac7d 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart
@@ -141,7 +141,8 @@
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget,
- bool isPreIncDec: false}) {
+ bool isPreIncDec: false,
+ bool isPostIncDec: false}) {
return buildAssignmentError();
}
@@ -195,10 +196,11 @@
class IncompleteErrorGenerator extends IncompleteSendGenerator
with ErroneousExpressionGenerator {
+ final Member member;
final Message message;
IncompleteErrorGenerator(
- ExpressionGeneratorHelper helper, Token token, this.message)
+ ExpressionGeneratorHelper helper, Token token, this.member, this.message)
: super(helper, token, null);
String get debugName => "IncompleteErrorGenerator";
@@ -218,6 +220,13 @@
doInvocation(int offset, Arguments arguments) => this;
@override
+ Expression buildSimpleRead() {
+ var error = buildError(forest.argumentsEmpty(token), isGetter: true);
+ return new InvalidPropertyGetJudgment(error, member)
+ ..fileOffset = offsetForToken(token);
+ }
+
+ @override
void printOn(StringSink sink) {
sink.write(", message: ");
sink.write(message.code.name);
@@ -266,7 +275,8 @@
{int offset,
bool voidContext: false,
Procedure interfaceTarget,
- bool isPreIncDec: false}) {
+ bool isPreIncDec: false,
+ bool isPostIncDec: false}) {
return unsupported(
"buildCompoundAssignment", offset ?? offsetForToken(token), uri);
}
@@ -335,7 +345,8 @@
{int offset,
bool voidContext: false,
Procedure interfaceTarget,
- bool isPreIncDec: false}) {
+ bool isPreIncDec: false,
+ bool isPostIncDec: false}) {
return unsupported(
"buildCompoundAssignment", offset ?? offsetForToken(token), uri);
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_factory.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_factory.dart
index 070f006..7305d14 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_factory.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_factory.dart
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:front_end/src/fasta/kernel/kernel_type_variable_builder.dart';
import 'package:front_end/src/scanner/token.dart' show Token;
import 'package:kernel/ast.dart'
@@ -15,6 +16,7 @@
Node,
Statement,
SwitchCase,
+ TypeParameter,
VariableDeclaration;
import 'package:kernel/type_algebra.dart' show Substitution;
@@ -28,6 +30,8 @@
StatementJudgment,
SwitchCaseJudgment;
+import 'kernel_type_variable_builder.dart' show KernelTypeVariableBuilder;
+
/// Implementation of [Factory] that builds source code into a kernel
/// representation.
class KernelFactory
@@ -77,6 +81,36 @@
}
@override
+ Object binderForFunctionDeclaration(
+ StatementJudgment judgment, int fileOffset, String name) {
+ return judgment;
+ }
+
+ @override
+ Object binderForStatementLabel(
+ StatementJudgment judgment, int fileOffset, String name) {
+ return judgment;
+ }
+
+ @override
+ SwitchCase binderForSwitchLabel(
+ SwitchCaseJudgment judgment, int fileOffset, String name) {
+ return judgment;
+ }
+
+ @override
+ KernelTypeVariableBuilder binderForTypeVariable(
+ KernelTypeVariableBuilder builder, int fileOffset, String name) {
+ return builder;
+ }
+
+ @override
+ Object binderForVariableDeclaration(
+ StatementJudgment judgment, int fileOffset, String name) {
+ return judgment;
+ }
+
+ @override
Statement block(StatementJudgment judgment, int fileOffset, Token leftBracket,
List<Statement> statements, Token rightBracket) {
return judgment;
@@ -263,18 +297,18 @@
}
@override
- Object binderForFunctionDeclaration(
- StatementJudgment judgment, int fileOffset, String name) {
- return judgment;
- }
-
- @override
Expression functionExpression(
ExpressionJudgment judgment, int fileOffset, DartType inferredType) {
return judgment;
}
@override
+ void functionType(int fileOffset, DartType type) {}
+
+ @override
+ void functionTypedFormalParameter(int fileOffset, DartType type) {}
+
+ @override
Expression ifNull(
ExpressionJudgment judgment,
int fileOffset,
@@ -346,17 +380,6 @@
return labels[0];
}
- Object statementLabel(
- covariant StatementJudgment binder, Token label, Token colon) {
- return binder;
- }
-
- @override
- Object binderForStatementLabel(
- StatementJudgment judgment, int fileOffset, String name) {
- return judgment;
- }
-
@override
Expression listLiteral(
ExpressionJudgment judgment,
@@ -496,6 +519,11 @@
return judgment;
}
+ Object statementLabel(
+ covariant StatementJudgment binder, Token label, Token colon) {
+ return binder;
+ }
+
@override
Expression staticAssign(
ExpressionJudgment judgment,
@@ -569,11 +597,6 @@
return binder;
}
- SwitchCase binderForSwitchLabel(
- SwitchCaseJudgment judgment, int fileOffset, String name) {
- return judgment;
- }
-
@override
Statement switchStatement(
StatementJudgment judgment,
@@ -635,6 +658,22 @@
}
@override
+ void typeReference(
+ int fileOffset,
+ Token leftBracket,
+ List<void> typeArguments,
+ Token rightBracket,
+ Node reference,
+ covariant KernelTypeVariableBuilder binder,
+ DartType type) {}
+
+ @override
+ TypeParameter typeVariableDeclaration(int fileOffset,
+ covariant KernelTypeVariableBuilder binder, TypeParameter typeParameter) {
+ return typeParameter;
+ }
+
+ @override
Expression variableAssign(
ExpressionJudgment judgment,
int fileOffset,
@@ -652,12 +691,6 @@
}
@override
- Object binderForVariableDeclaration(
- StatementJudgment judgment, int fileOffset, String name) {
- return judgment;
- }
-
- @override
Expression variableGet(
ExpressionJudgment judgment,
int fileOffset,
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 009fd3a..efbcf07 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -39,6 +39,7 @@
LocatedMessage,
Message,
messageConflictsWithTypeVariableCause,
+ messageGenericFunctionTypeInBound,
messageTypeVariableDuplicatedName,
messageTypeVariableSameNameAsEnclosing,
noLength,
@@ -115,6 +116,7 @@
import 'type_algorithms.dart'
show
calculateBounds,
+ findGenericFunctionTypes,
getNonSimplicityIssuesForDeclaration,
getNonSimplicityIssuesForTypeVariables;
@@ -129,11 +131,11 @@
final List<KernelTypeVariableBuilder> boundlessTypeVariables =
<KernelTypeVariableBuilder>[];
- // A list of alternating noSuchMethod forwarders and the abstract procedures
- // they were generated for. Note that it may not include a forwarder-origin
- // pair in cases when the former does not need to be updated after the body of
- // the latter was built.
- final List<Procedure> noSuchMethodForwardersOrigins = <Procedure>[];
+ // A list of alternating forwarders and the procedures they were generated
+ // for. Note that it may not include a forwarder-origin pair in cases when
+ // the former does not need to be updated after the body of the latter was
+ // built.
+ final List<Procedure> forwardersOrigins = <Procedure>[];
/// Exports that can't be serialized.
///
@@ -1012,12 +1014,12 @@
return total;
}
- int finishNoSuchMethodForwarders() {
+ int finishForwarders() {
int count = 0;
CloneVisitor cloner = new CloneVisitor();
- for (int i = 0; i < noSuchMethodForwardersOrigins.length; i += 2) {
- Procedure forwarder = noSuchMethodForwardersOrigins[i];
- Procedure origin = noSuchMethodForwardersOrigins[i + 1];
+ for (int i = 0; i < forwardersOrigins.length; i += 2) {
+ Procedure forwarder = forwardersOrigins[i];
+ Procedure origin = forwardersOrigins[i + 1];
int positionalCount = origin.function.positionalParameters.length;
if (forwarder.function.positionalParameters.length != positionalCount) {
@@ -1057,7 +1059,7 @@
++count;
}
- noSuchMethodForwardersOrigins.clear();
+ forwardersOrigins.clear();
return count;
}
@@ -1107,13 +1109,30 @@
bool strongMode) {
if (variables == null) return 0;
+ bool haveErroneousBounds = false;
if (strongMode) {
- List<KernelTypeBuilder> calculatedBounds =
- calculateBounds(variables, dynamicType, bottomType, objectClass);
for (int i = 0; i < variables.length; ++i) {
- variables[i].defaultType = calculatedBounds[i];
+ TypeVariableBuilder<TypeBuilder, Object> variable = variables[i];
+ List<TypeBuilder> genericFunctionTypes = <TypeBuilder>[];
+ findGenericFunctionTypes(variable.bound,
+ result: genericFunctionTypes);
+ if (genericFunctionTypes.length > 0) {
+ haveErroneousBounds = true;
+ addProblem(messageGenericFunctionTypeInBound, variable.charOffset,
+ variable.name.length, variable.fileUri);
+ }
}
- } else {
+
+ if (!haveErroneousBounds) {
+ List<KernelTypeBuilder> calculatedBounds =
+ calculateBounds(variables, dynamicType, bottomType, objectClass);
+ for (int i = 0; i < variables.length; ++i) {
+ variables[i].defaultType = calculatedBounds[i];
+ }
+ }
+ }
+
+ if (!strongMode || haveErroneousBounds) {
// In Dart 1, put `dynamic` everywhere.
for (int i = 0; i < variables.length; ++i) {
variables[i].defaultType = dynamicType;
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index b3c17bb..71d3160 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -41,7 +41,9 @@
show
noLength,
templateCantInferTypeDueToCircularity,
- templateCantUseSuperBoundedTypeForInstanceCreation;
+ templateCantUseSuperBoundedTypeForInstanceCreation,
+ templateForInLoopElementTypeNotAssignable,
+ templateForInLoopTypeNotIterable;
import '../problems.dart' show unhandled, unsupported;
@@ -469,8 +471,9 @@
/// annotations, and creates forwarding stubs as needed.
void finalizeCovariance(InterfaceResolver interfaceResolver) {
interfaceResolver.finalizeCovariance(
- this, _inferenceInfo.gettersAndMethods);
- interfaceResolver.finalizeCovariance(this, _inferenceInfo.setters);
+ this, _inferenceInfo.gettersAndMethods, _inferenceInfo.builder.library);
+ interfaceResolver.finalizeCovariance(
+ this, _inferenceInfo.setters, _inferenceInfo.builder.library);
interfaceResolver.recordInstrumentation(this);
}
@@ -995,7 +998,8 @@
fileOffset,
target.function.functionType,
computeConstructorReturnType(target),
- argumentJudgments);
+ argumentJudgments,
+ isConst: isConst);
var inferredType = inferenceResult.type;
this.inferredType = inferredType;
inferrer.listener.constructorInvocation(
@@ -1123,7 +1127,8 @@
inferrer.wrapType(const DynamicType(), iterableClass),
inferredExpressionType,
iterable,
- iterable.fileOffset);
+ iterable.fileOffset,
+ template: templateForInLoopTypeNotIterable);
DartType inferredType;
if (typeNeeded || typeChecksNeeded) {
@@ -1157,7 +1162,8 @@
var variableGet = new VariableGet(tempVar)
..fileOffset = this.variable.fileOffset;
var implicitDowncast = inferrer.ensureAssignable(
- variable.type, inferredType, variableGet, fileOffset);
+ variable.type, inferredType, variableGet, fileOffset,
+ template: templateForInLoopElementTypeNotAssignable);
if (implicitDowncast != null) {
this.variable = tempVar..parent = this;
variable.initializer = implicitDowncast..parent = variable;
@@ -1169,7 +1175,8 @@
greatestClosure(inferrer.coreTypes, syntheticWriteType),
this.variable.type,
syntheticAssignment.rhs,
- syntheticAssignment.rhs.fileOffset);
+ syntheticAssignment.rhs.fileOffset,
+ template: templateForInLoopElementTypeNotAssignable);
if (syntheticAssignment is PropertyAssignmentJudgment) {
syntheticAssignment._handleWriteContravariance(
inferrer, inferrer.thisType);
@@ -1697,6 +1704,30 @@
}
}
+/// Concrete shadow object representing an invalid initializer in kernel form.
+class ShadowInvalidFieldInitializer extends LocalInitializer
+ implements InitializerJudgment {
+ final Field field;
+ final Expression value;
+
+ ShadowInvalidFieldInitializer(
+ this.field, this.value, VariableDeclaration variable)
+ : super(variable) {
+ value?.parent = this;
+ }
+
+ ExpressionJudgment get judgment => value;
+
+ @override
+ void infer<Expression, Statement, Initializer, Type>(
+ ShadowTypeInferrer inferrer,
+ Factory<Expression, Statement, Initializer, Type> factory) {
+ inferrer.inferExpression(factory, value, field.type, false);
+ inferrer.listener.fieldInitializer(
+ this, fileOffset, null, null, null, null, null, field);
+ }
+}
+
/// Concrete shadow object representing a non-inverted "is" test in kernel form.
class IsJudgment extends IsExpression implements ExpressionJudgment {
final Token isOperator;
@@ -2059,6 +2090,7 @@
/// Shadow object for [MethodInvocation].
class MethodInvocationJudgment extends MethodInvocation
implements ExpressionJudgment {
+ final kernel.Expression desugaredError;
DartType inferredType;
/// Indicates whether this method invocation is a call to a `call` method
@@ -2067,7 +2099,7 @@
MethodInvocationJudgment(
Expression receiver, Name name, ArgumentsJudgment arguments,
- {bool isImplicitCall: false, Member interfaceTarget})
+ {this.desugaredError, bool isImplicitCall: false, Member interfaceTarget})
: _isImplicitCall = isImplicitCall,
super(receiver, name, arguments, interfaceTarget);
@@ -2082,6 +2114,10 @@
factory, this, receiver, fileOffset, _isImplicitCall, typeContext,
desugaredInvocation: this);
inferredType = inferenceResult.type;
+ if (desugaredError != null) {
+ parent.replaceChild(this, desugaredError);
+ parent = null;
+ }
return null;
}
}
@@ -2158,10 +2194,12 @@
/// let v = a in v == null ? null : v.b(...)
class NullAwareMethodInvocationJudgment extends Let
implements ExpressionJudgment {
+ final kernel.Expression desugaredError;
DartType inferredType;
NullAwareMethodInvocationJudgment(
- VariableDeclaration variable, Expression body)
+ VariableDeclaration variable, Expression body,
+ {this.desugaredError})
: super(variable, body);
@override
@@ -2542,10 +2580,11 @@
/// Shadow object for [StaticInvocation].
class StaticInvocationJudgment extends StaticInvocation
implements ExpressionJudgment {
+ final kernel.Expression desugaredError;
DartType inferredType;
StaticInvocationJudgment(Procedure target, ArgumentsJudgment arguments,
- {bool isConst: false})
+ {this.desugaredError, bool isConst: false})
: super(target, arguments, isConst: isConst);
ArgumentsJudgment get argumentJudgments => arguments;
@@ -2568,6 +2607,10 @@
inferrer.lastCalleeType,
inferrer.lastInferredSubstitution,
inferredType);
+ if (desugaredError != null) {
+ parent.replaceChild(this, desugaredError);
+ parent = null;
+ }
return null;
}
}
@@ -2656,10 +2699,11 @@
/// Shadow object for [SuperMethodInvocation].
class SuperMethodInvocationJudgment extends SuperMethodInvocation
implements ExpressionJudgment {
+ final kernel.Expression desugaredError;
DartType inferredType;
SuperMethodInvocationJudgment(Name name, ArgumentsJudgment arguments,
- [Procedure interfaceTarget])
+ {this.desugaredError, Procedure interfaceTarget})
: super(name, arguments, interfaceTarget);
ArgumentsJudgment get argumentJudgments => arguments;
@@ -2679,6 +2723,10 @@
methodName: name,
arguments: arguments);
inferredType = inferenceResult.type;
+ if (desugaredError != null) {
+ parent.replaceChild(this, desugaredError);
+ parent = null;
+ }
return null;
}
}
@@ -2686,9 +2734,11 @@
/// Shadow object for [SuperPropertyGet].
class SuperPropertyGetJudgment extends SuperPropertyGet
implements ExpressionJudgment {
+ final kernel.Expression desugaredError;
DartType inferredType;
- SuperPropertyGetJudgment(Name name, [Member interfaceTarget])
+ SuperPropertyGetJudgment(Name name,
+ {this.desugaredError, Member interfaceTarget})
: super(name, interfaceTarget);
@override
@@ -2702,6 +2752,10 @@
}
inferrer.inferPropertyGet(factory, this, null, fileOffset, typeContext,
interfaceMember: interfaceTarget, propertyName: name);
+ if (desugaredError != null) {
+ parent.replaceChild(this, desugaredError);
+ parent = null;
+ }
return null;
}
}
@@ -2809,8 +2863,9 @@
}
}
-/// Synthetic judgment class representing an attempt to invoke a constructor
-/// that cannot be invoked.
+/// Synthetic judgment class representing an attempt to invoke an unresolved
+/// constructor, or a constructor that cannot be invoked, or a resolved
+/// constructor with wrong number of arguments.
class InvalidConstructorInvocationJudgment extends SyntheticExpressionJudgment {
final Constructor constructor;
final Arguments arguments;
@@ -2826,13 +2881,21 @@
ShadowTypeInferrer inferrer,
Factory<Expression, Statement, Initializer, Type> factory,
DartType typeContext) {
- var calleeType = constructor.function.functionType;
- var inferenceResult = inferrer.inferInvocation(
+ FunctionType calleeType;
+ DartType returnType;
+ if (constructor != null) {
+ calleeType = constructor.function.functionType;
+ returnType = computeConstructorReturnType(constructor);
+ } else {
+ calleeType = new FunctionType([], const DynamicType());
+ returnType = const DynamicType();
+ }
+ ExpressionInferenceResult inferenceResult = inferrer.inferInvocation(
factory,
typeContext,
fileOffset,
calleeType,
- computeConstructorReturnType(constructor),
+ returnType,
argumentJudgments);
this.inferredType = inferenceResult.type;
inferrer.listener.constructorInvocation(
@@ -2861,6 +2924,25 @@
}
}
+/// Synthetic judgment class representing an attempt reference a member
+/// that is not allowed at this location.
+class InvalidPropertyGetJudgment extends SyntheticExpressionJudgment {
+ final Member member;
+
+ InvalidPropertyGetJudgment(kernel.Expression desugared, this.member)
+ : super(desugared);
+
+ @override
+ Expression infer<Expression, Statement, Initializer, Type>(
+ ShadowTypeInferrer inferrer,
+ Factory<Expression, Statement, Initializer, Type> factory,
+ DartType typeContext) {
+ var inferredType = member?.getterType ?? const DynamicType();
+ inferrer.listener.propertyGet(this, fileOffset, member, inferredType);
+ return super.infer(inferrer, factory, typeContext);
+ }
+}
+
/// Shadow object for expressions that are introduced by the front end as part
/// of desugaring or the handling of error conditions.
///
@@ -2951,12 +3033,14 @@
class ThrowJudgment extends Throw implements ExpressionJudgment {
final Token throwKeyword;
+ final kernel.Expression desugaredError;
DartType inferredType;
ExpressionJudgment get judgment => expression;
- ThrowJudgment(this.throwKeyword, Expression expression) : super(expression);
+ ThrowJudgment(this.throwKeyword, Expression expression, {this.desugaredError})
+ : super(expression);
@override
Expression infer<Expression, Statement, Initializer, Type>(
@@ -2967,6 +3051,10 @@
inferredType = const BottomType();
inferrer.listener
.throw_(this, fileOffset, throwKeyword, null, inferredType);
+ if (desugaredError != null) {
+ parent.replaceChild(this, desugaredError);
+ parent = null;
+ }
return null;
}
}
@@ -3363,6 +3451,12 @@
Object binder;
+ /// The same [annotations] list is used for all [VariableDeclarationJudgment]s
+ /// of a variable declaration statement. But we need to perform inference
+ /// only once. So, we set this flag to `false` for the second and subsequent
+ /// judgments.
+ bool infersAnnotations = true;
+
VariableDeclarationJudgment(String name, this._functionNestingLevel,
{Expression initializer,
DartType type,
@@ -3402,7 +3496,9 @@
ShadowTypeInferrer inferrer,
Factory<Expression, Statement, Initializer, Type> factory) {
if (annotationJudgments.isNotEmpty) {
- inferrer.inferMetadataKeepingHelper(factory, annotationJudgments);
+ if (infersAnnotations) {
+ inferrer.inferMetadataKeepingHelper(factory, annotationJudgments);
+ }
// After the inference was done on the annotations, we may clone them for
// this instance of VariableDeclaration in order to avoid having the same
@@ -3526,6 +3622,27 @@
}
}
+/// Synthetic judgment class representing an attempt to apply a prefix or
+/// postfix operator to an unresolved variable.
+class UnresolvedVariableUnaryJudgment extends SyntheticExpressionJudgment {
+ final Token token;
+
+ UnresolvedVariableUnaryJudgment(kernel.Expression desugared, this.token)
+ : super(desugared);
+
+ @override
+ Expression infer<Expression, Statement, Initializer, Type>(
+ ShadowTypeInferrer inferrer,
+ Factory<Expression, Statement, Initializer, Type> factory,
+ DartType typeContext) {
+ inferrer.listener
+ .variableGet(this, token.offset, false, null, const DynamicType());
+ inferrer.listener.variableAssign(
+ this, fileOffset, const DynamicType(), null, null, inferredType);
+ return super.infer(inferrer, factory, typeContext);
+ }
+}
+
/// Synthetic judgment class representing an attempt to read an unresolved
/// variable.
class UnresolvedVariableGetJudgment extends SyntheticExpressionJudgment {
@@ -3663,9 +3780,13 @@
/// Concrete shadow object representing a deferred load library call.
class LoadLibraryJudgment extends LoadLibrary implements ExpressionJudgment {
+ final Arguments arguments;
+
DartType inferredType;
- LoadLibraryJudgment(LibraryDependency import) : super(import);
+ LoadLibraryJudgment(LibraryDependency import, this.arguments) : super(import);
+
+ ArgumentsJudgment get argumentJudgments => arguments;
@override
Expression infer<Expression, Statement, Initializer, Type>(
@@ -3674,6 +3795,35 @@
DartType typeContext) {
inferredType =
inferrer.typeSchemaEnvironment.futureType(const DynamicType());
+ if (arguments != null) {
+ var calleeType = new FunctionType([], inferredType);
+ inferrer.inferInvocation(factory, typeContext, fileOffset, calleeType,
+ calleeType.returnType, argumentJudgments);
+ inferrer.listener.loadLibrary(this, arguments.fileOffset,
+ import.targetLibrary, calleeType, inferredType);
+ }
+ return null;
+ }
+}
+
+/// Concrete shadow object representing a tear-off of a `loadLibrary` function.
+class LoadLibraryTearOffJudgment extends StaticGet
+ implements ExpressionJudgment {
+ final LibraryDependency import;
+
+ DartType inferredType;
+
+ LoadLibraryTearOffJudgment(this.import, Procedure target) : super(target);
+
+ @override
+ Expression infer<Expression, Statement, Initializer, Type>(
+ ShadowTypeInferrer inferrer,
+ Factory<Expression, Statement, Initializer, Type> factory,
+ DartType typeContext) {
+ inferredType = new FunctionType(
+ [], inferrer.typeSchemaEnvironment.futureType(const DynamicType()));
+ inferrer.listener.loadLibraryTearOff(
+ this, fileOffset, import.targetLibrary, inferredType);
return null;
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart
index 1290f11..017c9fc 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart
@@ -27,6 +27,8 @@
KernelTypeVariableBuilder actualOrigin;
+ Object binder;
+
KernelTypeVariableBuilder(
String name, KernelLibraryBuilder compilationUnit, int charOffset,
[KernelTypeBuilder bound, TypeParameter actual])
diff --git a/pkg/front_end/lib/src/fasta/kernel/load_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/load_library_builder.dart
index 8524f51..dfa7a81 100644
--- a/pkg/front_end/lib/src/fasta/kernel/load_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/load_library_builder.dart
@@ -4,6 +4,7 @@
import 'package:kernel/ast.dart'
show
+ Arguments,
DartType,
DynamicType,
FunctionNode,
@@ -37,13 +38,15 @@
Uri get fileUri => parent.fileUri;
- LoadLibrary createLoadLibrary(int charOffset, Forest forest) {
- return forest.loadLibrary(importDependency)..fileOffset = charOffset;
+ LoadLibrary createLoadLibrary(
+ int charOffset, Forest forest, Arguments arguments) {
+ return forest.loadLibrary(importDependency, arguments)
+ ..fileOffset = charOffset;
}
Procedure createTearoffMethod(Forest forest) {
if (tearoff != null) return tearoff;
- LoadLibrary expression = createLoadLibrary(charOffset, forest);
+ LoadLibrary expression = createLoadLibrary(charOffset, forest, null);
String prefix = expression.import.name;
tearoff = new Procedure(
new Name('__loadLibrary_$prefix', parent.target),
diff --git a/pkg/front_end/lib/src/fasta/kernel/toplevel_inference_factory.dart b/pkg/front_end/lib/src/fasta/kernel/toplevel_inference_factory.dart
index 62f7c16..f0161b3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/toplevel_inference_factory.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/toplevel_inference_factory.dart
@@ -2,9 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:front_end/src/fasta/kernel/kernel_type_variable_builder.dart';
import 'package:front_end/src/scanner/token.dart' show Token;
-import 'package:kernel/ast.dart' show Catch, DartType, FunctionType, Node;
+import 'package:kernel/ast.dart'
+ show Catch, DartType, FunctionType, Node, TypeParameter;
import 'package:kernel/type_algebra.dart' show Substitution;
@@ -17,6 +19,10 @@
StatementJudgment,
SwitchCaseJudgment;
+import 'kernel_type_variable_builder.dart' show KernelTypeVariableBuilder;
+
+const toplevelInferenceFactory = const ToplevelInferenceFactory();
+
/// Implementation of [Factory] for use during top level type inference, when
/// no representation of the code semantics needs to be created (only the type
/// needs to be inferred).
@@ -60,6 +66,26 @@
Token awaitKeyword, void expression, DartType inferredType) {}
@override
+ void binderForFunctionDeclaration(
+ StatementJudgment judgment, int fileOffset, String name) {}
+
+ @override
+ void binderForStatementLabel(
+ StatementJudgment judgment, int fileOffset, String name) {}
+
+ @override
+ void binderForSwitchLabel(
+ SwitchCaseJudgment judgment, int fileOffset, String name) {}
+
+ @override
+ void binderForTypeVariable(
+ KernelTypeVariableBuilder builder, int fileOffset, String name) {}
+
+ @override
+ void binderForVariableDeclaration(
+ StatementJudgment judgment, int fileOffset, String name) {}
+
+ @override
void block(StatementJudgment judgment, int fileOffset, Token leftBracket,
void statements, Token rightBracket) {}
@@ -211,14 +237,16 @@
void functionDeclaration(covariant void binder, FunctionType inferredType) {}
@override
- void binderForFunctionDeclaration(
- StatementJudgment judgment, int fileOffset, String name) {}
-
- @override
void functionExpression(
ExpressionJudgment judgment, int fileOffset, DartType inferredType) {}
@override
+ void functionType(int fileOffset, DartType type) {}
+
+ @override
+ void functionTypedFormalParameter(int fileOffset, DartType type) {}
+
+ @override
void ifNull(ExpressionJudgment judgment, int fileOffset, void leftOperand,
Token operator, void rightOperand, DartType inferredType) {}
@@ -270,13 +298,6 @@
void labeledStatement(List<Object> labels, void statement) {}
@override
- void statementLabel(covariant void binder, Token label, Token colon) {}
-
- @override
- void binderForStatementLabel(
- StatementJudgment judgment, int fileOffset, String name) {}
-
- @override
void listLiteral(
ExpressionJudgment judgment,
int fileOffset,
@@ -384,6 +405,9 @@
Token returnKeyword, void expression, Token semicolon) {}
@override
+ void statementLabel(covariant void binder, Token label, Token colon) {}
+
+ @override
void staticAssign(
ExpressionJudgment judgment,
int fileOffset,
@@ -437,10 +461,6 @@
void switchLabel(covariant void binder, Token label, Token colon) {}
@override
- void binderForSwitchLabel(
- SwitchCaseJudgment judgment, int fileOffset, String name) {}
-
- @override
void switchStatement(
StatementJudgment judgment,
int fileOffset,
@@ -481,6 +501,20 @@
Node expressionType, DartType inferredType) {}
@override
+ void typeReference(
+ int fileOffset,
+ Token leftBracket,
+ List<void> typeArguments,
+ Token rightBracket,
+ Node reference,
+ covariant void binder,
+ DartType type) {}
+
+ @override
+ void typeVariableDeclaration(
+ int fileOffset, covariant void binder, TypeParameter typeParameter) {}
+
+ @override
void variableAssign(
ExpressionJudgment judgment,
int fileOffset,
@@ -493,9 +527,6 @@
void variableDeclaration(
covariant void binder, DartType statementType, DartType inferredType) {}
- void binderForVariableDeclaration(
- StatementJudgment judgment, int fileOffset, String name) {}
-
@override
void variableGet(ExpressionJudgment judgment, int fileOffset,
bool isInCascade, covariant void variableBinder, DartType inferredType) {}
@@ -514,5 +545,3 @@
void yieldStatement(StatementJudgment judgment, int fileOffset,
Token yieldKeyword, Token star, void expression, Token semicolon) {}
}
-
-const toplevelInferenceFactory = const ToplevelInferenceFactory();
diff --git a/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart b/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart
index 81b72d7..a45b739 100644
--- a/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart
@@ -693,3 +693,29 @@
issues.addAll(convertRawTypeCyclesIntoIssues(declaration, cyclesToReport));
return issues;
}
+
+void findGenericFunctionTypes(TypeBuilder type, {List<TypeBuilder> result}) {
+ result ??= <TypeBuilder>[];
+ if (type is FunctionTypeBuilder) {
+ if (type.typeVariables != null && type.typeVariables.length > 0) {
+ result.add(type);
+
+ for (TypeVariableBuilder<TypeBuilder, Object> typeVariable
+ in type.typeVariables) {
+ findGenericFunctionTypes(typeVariable.bound, result: result);
+ findGenericFunctionTypes(typeVariable.defaultType, result: result);
+ }
+ }
+ findGenericFunctionTypes(type.returnType, result: result);
+ if (type.formals != null) {
+ for (FormalParameterBuilder<TypeBuilder> formal in type.formals) {
+ findGenericFunctionTypes(formal.type, result: result);
+ }
+ }
+ } else if (type is NamedTypeBuilder<TypeBuilder, Object> &&
+ type.arguments != null) {
+ for (TypeBuilder argument in type.arguments) {
+ findGenericFunctionTypes(argument, result: result);
+ }
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart b/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart
index 3af09ee..467e833 100644
--- a/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart
@@ -641,8 +641,8 @@
}
@override
- void endFunctionTypedFormalParameter() {
- listener?.endFunctionTypedFormalParameter();
+ void endFunctionTypedFormalParameter(Token nameToken) {
+ listener?.endFunctionTypedFormalParameter(nameToken);
}
@override
diff --git a/pkg/front_end/lib/src/fasta/parser/listener.dart b/pkg/front_end/lib/src/fasta/parser/listener.dart
index c69cf17..1f6dd5c 100644
--- a/pkg/front_end/lib/src/fasta/parser/listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/listener.dart
@@ -996,7 +996,7 @@
/// - type variables
/// - return type
/// - formal parameters
- void endFunctionTypedFormalParameter() {
+ void endFunctionTypedFormalParameter(Token nameToken) {
logEvent("FunctionTypedFormalParameter");
}
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index 8aa932d..74b59cd 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -88,7 +88,12 @@
noType,
noTypeParamOrArg;
-import 'util.dart' show findNonSyntheticToken, isOneOf, optional;
+import 'util.dart'
+ show
+ findPreviousNonZeroLengthToken,
+ findNonZeroLengthToken,
+ isOneOf,
+ optional;
/// An event generating parser of Dart programs. This parser expects all tokens
/// in a linked list (aka a token stream).
@@ -1083,10 +1088,7 @@
new SyntheticKeywordToken(Keyword.WITH, withKeyword.charOffset);
rewriter.insertTokenAfter(token, withKeyword);
if (!isValidTypeReference(withKeyword.next)) {
- rewriter.insertTokenAfter(
- withKeyword,
- new SyntheticStringToken(
- TokenType.IDENTIFIER, '', withKeyword.charOffset));
+ rewriter.insertSyntheticIdentifier(withKeyword);
}
}
listener.beginMixinApplication(withKeyword);
@@ -1353,7 +1355,7 @@
token = typeInfo.parseType(beforeType, this);
endInlineFunctionType = parseFormalParametersRequiredOpt(
endInlineFunctionType, MemberKind.FunctionTypedParameter);
- listener.endFunctionTypedFormalParameter();
+ listener.endFunctionTypedFormalParameter(beforeInlineFunctionType);
// Generalized function types don't allow inline function types.
// The following isn't allowed:
@@ -1872,10 +1874,7 @@
Token next = token.next;
reportRecoverableError(messageOnToken ?? next,
message ?? context.recoveryTemplate.withArguments(next));
- Token identifier =
- new SyntheticStringToken(TokenType.IDENTIFIER, '', next.charOffset, 0);
- rewriter.insertTokenAfter(token, identifier);
- return token.next;
+ return rewriter.insertSyntheticIdentifier(token);
}
/// Parse a simple identifier at the given [token], and return the identifier
@@ -2308,10 +2307,7 @@
next, fasta.templateExpectedButGot.withArguments('.'));
rewriter.insertTokenAfter(
token, new SyntheticToken(TokenType.PERIOD, next.offset));
- token = token.next;
- rewriter.insertTokenAfter(token,
- new SyntheticStringToken(TokenType.IDENTIFIER, '', next.offset));
- token = token.next;
+ token = rewriter.insertSyntheticIdentifier(token.next);
next = token.next;
}
// Fall through to recovery
@@ -2436,9 +2432,15 @@
// from the handleError method in element_listener.dart.
Token next = token.next;
if (optional(';', next)) return next;
- Message message = fasta.templateExpectedButGot.withArguments(';');
- Token newToken = new SyntheticToken(TokenType.SEMICOLON, next.charOffset);
- return rewriteAndRecover(token, message, newToken).next;
+
+ // Find a token on the same line as where the ';' should be inserted.
+ // Reporting the error on this token makes it easier
+ // for users to understand and fix the error.
+ reportRecoverableError(findPreviousNonZeroLengthToken(token),
+ fasta.templateExpectedAfterButGot.withArguments(';'));
+
+ return rewriter.insertToken(
+ token, new SyntheticToken(TokenType.SEMICOLON, next.charOffset));
}
/// Report an error at the token after [token] that has the given [message].
@@ -5677,7 +5679,7 @@
reportErrorToken(token);
} else {
// Find a non-synthetic token on which to report the error.
- token = findNonSyntheticToken(token);
+ token = findNonZeroLengthToken(token);
listener.handleRecoverableError(message, token, token);
}
}
@@ -5688,7 +5690,7 @@
reportErrorToken(token);
} else {
// Find a non-synthetic token on which to report the error.
- token = findNonSyntheticToken(token);
+ token = findNonZeroLengthToken(token);
listener.handleRecoverableError(
template.withArguments(token), token, token);
}
diff --git a/pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart b/pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart
index 38b68b6..27af960 100644
--- a/pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart
+++ b/pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart
@@ -55,20 +55,29 @@
next = next.setNext(new SyntheticToken(TokenType.CLOSE_PAREN, offset));
leftParen.endGroup = next;
next.setNext(token.next);
+
+ // A no-op rewriter could skip this step.
token.setNext(leftParen);
+
return leftParen;
}
/// Insert a synthetic identifier after [token] and return the new identifier.
Token insertSyntheticIdentifier(Token token) {
- Token identifier = new SyntheticStringToken(
- TokenType.IDENTIFIER, '', token.next.charOffset, 0)
- ..setNext(token.next);
+ return insertToken(
+ token,
+ new SyntheticStringToken(
+ TokenType.IDENTIFIER, '', token.next.charOffset, 0));
+ }
- // A no-op rewriter could simply return the synthetic identifier here.
+ /// Insert [newToken] after [token] and return [newToken].
+ Token insertToken(Token token, Token newToken) {
+ newToken.setNext(token.next);
- token.setNext(identifier);
- return identifier;
+ // A no-op rewriter could skip this step.
+ token.setNext(newToken);
+
+ return newToken;
}
/// Insert the chain of tokens starting at the [insertedToken] immediately
diff --git a/pkg/front_end/lib/src/fasta/parser/util.dart b/pkg/front_end/lib/src/fasta/parser/util.dart
index 96495e7..ab00611 100644
--- a/pkg/front_end/lib/src/fasta/parser/util.dart
+++ b/pkg/front_end/lib/src/fasta/parser/util.dart
@@ -33,11 +33,24 @@
return token;
}
-/// Return [token] if it is non-synthetic,
-/// otherwise find the next non-synthetic token.
+/// Return [token] or a token before [token] which is either
+/// not synthetic or synthetic with non-zero length.
+Token findPreviousNonZeroLengthToken(Token token) {
+ while (token.isSynthetic && token.length == 0) {
+ Token previous = token.beforeSynthetic;
+ if (previous == null) {
+ break;
+ }
+ token = previous;
+ }
+ return token;
+}
+
+/// Return [token] or a token after [token] which is either
+/// not synthetic or synthetic with non-zero length.
/// This may return EOF if there are no more non-synthetic tokens in the stream.
-Token findNonSyntheticToken(Token token) {
- while (token.isSynthetic && !token.isEof) {
+Token findNonZeroLengthToken(Token token) {
+ while (token.isSynthetic && token.length == 0 && !token.isEof) {
token = token.next;
}
return token;
diff --git a/pkg/front_end/lib/src/fasta/scanner/token.dart b/pkg/front_end/lib/src/fasta/scanner/token.dart
index cea026d..bd837c1 100644
--- a/pkg/front_end/lib/src/fasta/scanner/token.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/token.dart
@@ -235,7 +235,7 @@
int get length;
/**
- * If this substring is based on a String, the [boolValue] indicates wheter
+ * If this substring is based on a String, the [boolValue] indicates whether
* the resulting substring should be canonicalized.
*
* For substrings based on a byte array, the [boolValue] is true if the
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index 8f8c5c1..597ecd0 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -1016,7 +1016,7 @@
}
@override
- void endFunctionTypedFormalParameter() {
+ void endFunctionTypedFormalParameter(Token nameToken) {
debugEvent("FunctionTypedFormalParameter");
List<FormalParameterBuilder> formals = pop();
int formalsOffset = pop();
diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
index 6e1045b..6135e72 100644
--- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -158,6 +158,7 @@
constructors.forEach((String name, Declaration constructor) {
Declaration member = scopeBuilder[name];
if (member == null) return;
+ if (!member.isStatic) return;
// TODO(ahe): Revisit these messages. It seems like the last two should
// be `context` parameter to this message.
addCompileTimeError(templateConflictsWithMember.withArguments(name),
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index 3304efc..aab29be 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -387,10 +387,10 @@
int count = 0;
builders.forEach((Uri uri, LibraryBuilder library) {
if (library.loader == this) {
- count += library.finishNoSuchMethodForwarders();
+ count += library.finishForwarders();
}
});
- ticker.logMs("Finished noSuchMethod forwarders for $count procedures");
+ ticker.logMs("Finished forwarders for $count procedures");
}
void resolveConstructors() {
diff --git a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
index bf2284c..02395c0 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
@@ -43,6 +43,8 @@
import '../builder/builder.dart' show LibraryBuilder;
+import '../kernel/kernel_library_builder.dart' show KernelLibraryBuilder;
+
import '../kernel/kernel_shadow_ast.dart'
show
ShadowClass,
@@ -292,8 +294,7 @@
IncludesTypeParametersCovariantly needsCheckVisitor =
enclosingClass.typeParameters.isEmpty
? null
- : ShadowClass
- .getClassInferenceInfo(enclosingClass)
+ : ShadowClass.getClassInferenceInfo(enclosingClass)
.needsCheckVisitor ??=
new IncludesTypeParametersCovariantly(
enclosingClass.typeParameters);
@@ -774,8 +775,8 @@
}
var positionalParameters = method.function.positionalParameters;
for (int i = 0; i < positionalParameters.length; ++i) {
- if (VariableDeclarationJudgment
- .isImplicitlyTyped(positionalParameters[i])) {
+ if (VariableDeclarationJudgment.isImplicitlyTyped(
+ positionalParameters[i])) {
// Note that if the parameter is not present in the overridden method,
// getPositionalParameterType treats it as dynamic. This is consistent
// with the behavior called for in the informal top level type inference
@@ -905,6 +906,20 @@
conflict.fileUri, conflict.fileOffset, noLength)
]);
}
+ } else {
+ // If it's a setter conflicting with a method and both are
+ // declared in the same class, it hasn't been signaled as a
+ // duplicated definition so it's reported here.
+ library.addProblem(
+ messageDeclaredMemberConflictsWithInheritedMember,
+ member.fileOffset,
+ noLength,
+ member.fileUri,
+ context: [
+ messageDeclaredMemberConflictsWithInheritedMemberCause
+ .withLocation(
+ conflict.fileUri, conflict.fileOffset, noLength)
+ ]);
}
return;
}
@@ -917,6 +932,11 @@
var forwardingNode = new ForwardingNode(
this, null, class_, name, kind, candidates, start, end);
getters[getterIndex++] = forwardingNode.finalize();
+ if (library is KernelLibraryBuilder &&
+ forwardingNode.finalize() != forwardingNode.resolve()) {
+ library.forwardersOrigins.add(forwardingNode.finalize());
+ library.forwardersOrigins.add(forwardingNode.resolve());
+ }
return;
}
@@ -1029,12 +1049,18 @@
setters.length = setterIndex;
}
- void finalizeCovariance(Class class_, List<Member> apiMembers) {
+ void finalizeCovariance(
+ Class class_, List<Member> apiMembers, LibraryBuilder library) {
for (int i = 0; i < apiMembers.length; i++) {
var member = apiMembers[i];
Member resolution;
if (member is ForwardingNode) {
apiMembers[i] = resolution = member.finalize();
+ if (library is KernelLibraryBuilder &&
+ member.finalize() != member.resolve()) {
+ library.forwardersOrigins.add(member.finalize());
+ library.forwardersOrigins.add(member.resolve());
+ }
} else {
resolution = member;
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart
index 579af3f..42aa400 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart
@@ -2,19 +2,26 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE.md file.
+import 'package:kernel/ast.dart'
+ show Catch, DartType, FunctionType, Node, TypeParameter;
+
import 'package:kernel/ast.dart' show Catch, DartType, FunctionType, Node;
import 'package:kernel/type_algebra.dart' show Substitution;
import '../../scanner/token.dart' show Token;
-
import '../kernel/kernel_shadow_ast.dart'
show
ExpressionJudgment,
InitializerJudgment,
+ LoadLibraryJudgment,
+ LoadLibraryTearOffJudgment,
StatementJudgment,
SwitchCaseJudgment;
+import '../kernel/kernel_type_variable_builder.dart'
+ show KernelTypeVariableBuilder;
+
/// Callback interface used by [TypeInferrer] to report the results of type
/// inference to a client.
///
@@ -60,6 +67,21 @@
void awaitExpression(ExpressionJudgment judgment, Location location,
Token awaitKeyword, void expression, DartType inferredType);
+ Object binderForFunctionDeclaration(
+ StatementJudgment judgment, Location location, String name);
+
+ Object binderForStatementLabel(
+ StatementJudgment judgment, int fileOffset, String name);
+
+ Object binderForSwitchLabel(
+ SwitchCaseJudgment judgment, int fileOffset, String name);
+
+ Object binderForTypeVariable(
+ KernelTypeVariableBuilder builder, int fileOffset, String name);
+
+ Object binderForVariableDeclaration(
+ StatementJudgment judgment, int fileOffset, String name);
+
void block(StatementJudgment judgment, Location location, Token leftBracket,
List<void> statements, Token rightBracket);
@@ -191,12 +213,13 @@
void functionDeclaration(covariant Object binder, FunctionType inferredType);
- Object binderForFunctionDeclaration(
- StatementJudgment judgment, Location location, String name);
-
void functionExpression(
ExpressionJudgment judgment, Location location, DartType inferredType);
+ void functionType(Location location, DartType type);
+
+ void functionTypedFormalParameter(Location location, DartType type);
+
void ifNull(ExpressionJudgment judgment, Location location, void leftOperand,
Token operator, void rightOperand, DartType inferredType);
@@ -240,11 +263,6 @@
void labeledStatement(List<Object> labels, void statement);
- Object statementLabel(covariant Object binder, Token label, Token colon);
-
- Object binderForStatementLabel(
- StatementJudgment judgment, int fileOffset, String name);
-
void listLiteral(
ExpressionJudgment judgment,
Location location,
@@ -255,6 +273,12 @@
Token rightBracket,
DartType inferredType);
+ void loadLibrary(LoadLibraryJudgment judgment, Location location,
+ Reference library, FunctionType calleeType, DartType inferredType);
+
+ void loadLibraryTearOff(LoadLibraryTearOffJudgment judgment,
+ Location location, Reference library, DartType inferredType);
+
void logicalExpression(
ExpressionJudgment judgment,
Location location,
@@ -336,6 +360,8 @@
void returnStatement(StatementJudgment judgment, Location location,
Token returnKeyword, void expression, Token semicolon);
+ Object statementLabel(covariant Object binder, Token label, Token colon);
+
void staticAssign(
ExpressionJudgment judgment,
Location location,
@@ -356,6 +382,11 @@
Substitution substitution,
DartType inferredType);
+ void storeClassReference(
+ Location location, Reference reference, DartType rawType);
+
+ void storePrefixInfo(Location location, PrefixInfo prefixInfo);
+
void stringConcatenation(
ExpressionJudgment judgment, Location location, DartType inferredType);
@@ -375,9 +406,6 @@
Object switchLabel(covariant Object binder, Token label, Token colon);
- Object binderForSwitchLabel(
- SwitchCaseJudgment judgment, int fileOffset, String name);
-
void switchStatement(
StatementJudgment judgment,
Location location,
@@ -417,6 +445,18 @@
void typeLiteral(ExpressionJudgment judgment, Location location,
Reference expressionType, DartType inferredType);
+ void typeReference(
+ Location location,
+ Token leftBracket,
+ List<void> typeArguments,
+ Token rightBracket,
+ Reference reference,
+ covariant Object binder,
+ DartType type);
+
+ void typeVariableDeclaration(
+ Location location, covariant Object binder, TypeParameter typeParameter);
+
void variableAssign(
ExpressionJudgment judgment,
Location location,
@@ -428,12 +468,11 @@
void variableDeclaration(
covariant Object binder, DartType statementType, DartType inferredType);
- Object binderForVariableDeclaration(
- StatementJudgment judgment, int fileOffset, String name);
-
void variableGet(ExpressionJudgment judgment, Location location,
bool isInCascade, covariant Object variableBinder, DartType inferredType);
+ void voidType(Location location, Token token, DartType type);
+
void whileStatement(
StatementJudgment judgment,
Location location,
@@ -445,11 +484,6 @@
void yieldStatement(StatementJudgment judgment, Location location,
Token yieldKeyword, Token star, void expression, Token semicolon);
-
- void storePrefixInfo(Location location, PrefixInfo prefixInfo);
-
- void storeClassReference(
- Location location, Reference reference, DartType rawType);
}
/// Kernel implementation of TypeInferenceListener; does nothing.
@@ -489,6 +523,26 @@
Token awaitKeyword, void expression, DartType inferredType) {}
@override
+ void binderForFunctionDeclaration(
+ StatementJudgment judgment, location, String name) {}
+
+ @override
+ void binderForStatementLabel(
+ StatementJudgment judgment, int fileOffset, String name) {}
+
+ @override
+ void binderForSwitchLabel(
+ SwitchCaseJudgment judgment, int fileOffset, String name) {}
+
+ @override
+ void binderForTypeVariable(
+ KernelTypeVariableBuilder builder, int fileOffset, String name) {}
+
+ @override
+ void binderForVariableDeclaration(
+ StatementJudgment judgment, int fileOffset, String name) {}
+
+ @override
void block(StatementJudgment judgment, location, Token leftBracket,
List<void> statements, Token rightBracket) {}
@@ -633,13 +687,13 @@
void functionDeclaration(covariant void binder, FunctionType inferredType) {}
@override
- void binderForFunctionDeclaration(
- StatementJudgment judgment, location, String name) {}
-
- @override
void functionExpression(
ExpressionJudgment judgment, location, DartType inferredType) {}
+ void functionType(int location, DartType type) {}
+
+ void functionTypedFormalParameter(int location, DartType type) {}
+
@override
void ifNull(ExpressionJudgment judgment, location, void leftOperand,
Token operator, void rightOperand, DartType inferredType) {}
@@ -692,13 +746,6 @@
void labeledStatement(List<Object> labels, void statement) {}
@override
- void statementLabel(covariant void binder, Token label, Token colon) {}
-
- @override
- void binderForStatementLabel(
- StatementJudgment judgment, int fileOffset, String name) {}
-
- @override
void listLiteral(
ExpressionJudgment judgment,
location,
@@ -710,6 +757,14 @@
DartType inferredType) {}
@override
+ void loadLibrary(LoadLibraryJudgment judgment, location, library,
+ FunctionType calleeType, DartType inferredType) {}
+
+ @override
+ void loadLibraryTearOff(LoadLibraryTearOffJudgment judgment, location,
+ library, DartType inferredType) {}
+
+ @override
void logicalExpression(
ExpressionJudgment judgment,
location,
@@ -800,6 +855,9 @@
Token returnKeyword, void expression, Token semicolon) {}
@override
+ void statementLabel(covariant void binder, Token label, Token colon) {}
+
+ @override
void staticAssign(ExpressionJudgment judgment, location, writeMember,
DartType writeContext, combiner, DartType inferredType) {}
@@ -848,10 +906,6 @@
void switchLabel(covariant void binder, Token label, Token colon) {}
@override
- void binderForSwitchLabel(
- SwitchCaseJudgment judgment, int fileOffset, String name) {}
-
- @override
void switchStatement(
StatementJudgment judgment,
location,
@@ -887,6 +941,14 @@
DartType inferredType) {}
@override
+ void typeReference(location, Token leftBracket, List<void> typeArguments,
+ Token rightBracket, reference, covariant void binder, DartType type) {}
+
+ @override
+ void typeVariableDeclaration(
+ location, covariant void binder, TypeParameter typeParameter) {}
+
+ @override
void variableAssign(
ExpressionJudgment judgment,
location,
@@ -900,14 +962,13 @@
covariant void binder, DartType statementType, DartType inferredType) {}
@override
- void binderForVariableDeclaration(
- StatementJudgment judgment, int fileOffset, String name) {}
-
- @override
void variableGet(ExpressionJudgment judgment, location, bool isInCascade,
expressionVariable, DartType inferredType) {}
@override
+ void voidType(location, Token token, DartType type) {}
+
+ @override
void whileStatement(
StatementJudgment judgment,
location,
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 016092a..5ded6a7b 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -42,6 +42,7 @@
SuperPropertySet,
Supertype,
ThisExpression,
+ TreeNode,
TypeParameter,
TypeParameterType,
Typedef,
@@ -85,6 +86,9 @@
VariableDeclarationJudgment,
getExplicitTypeArguments;
+import '../kernel/kernel_type_variable_builder.dart'
+ show KernelTypeVariableBuilder;
+
import '../names.dart' show callName;
import '../problems.dart' show unexpected, unhandled;
@@ -335,6 +339,13 @@
/// performed--this is used for testing.
Uri get uri;
+ Object binderForTypeVariable(
+ KernelTypeVariableBuilder builder, int fileOffset, String name);
+
+ void functionType(int offset, DartType type);
+
+ void functionTypedFormalParameter(int offset, DartType type);
+
/// Performs full type inference on the given field initializer.
void inferFieldInitializer<Expression, Statement, Initializer, Type>(
InferenceHelper helper,
@@ -378,7 +389,15 @@
void storePrefix(Token token, PrefixBuilder prefix);
+ void storeTypeReference(
+ int offset, TreeNode reference, Object binder, DartType type);
+
void storeTypeUse(int offset, Node node);
+
+ void typeVariableDeclaration(
+ int offset, Object binder, TypeParameter typeParameter);
+
+ void voidType(int offset, Token token, DartType type);
}
/// Implementation of [TypeInferrer] which doesn't do any type inference.
@@ -398,6 +417,14 @@
Uri get uri => null;
@override
+ void binderForTypeVariable(
+ KernelTypeVariableBuilder builder, int fileOffset, String name) {}
+
+ void functionType(int offset, DartType type) {}
+
+ void functionTypedFormalParameter(int offset, DartType type) {}
+
+ @override
void inferFieldInitializer<Expression, Statement, Initializer, Type>(
InferenceHelper helper,
Factory<Expression, Statement, Initializer, Type> factory,
@@ -440,7 +467,18 @@
void storePrefix(Token token, PrefixBuilder prefix) {}
@override
+ void storeTypeReference(
+ int offset, TreeNode reference, Object binder, DartType type) {}
+
+ @override
void storeTypeUse(int offset, Node node) {}
+
+ @override
+ void typeVariableDeclaration(
+ int offset, Object binder, TypeParameter typeParameter) {}
+
+ @override
+ void voidType(int offset, Token token, DartType type) {}
}
/// Derived class containing generic implementations of [TypeInferrer].
@@ -507,6 +545,20 @@
/// inference.
TypePromoter get typePromoter;
+ @override
+ Object binderForTypeVariable(
+ KernelTypeVariableBuilder builder, int fileOffset, String name) {
+ return listener.binderForTypeVariable(builder, fileOffset, name);
+ }
+
+ void functionType(int offset, DartType type) {
+ listener.functionType(offset, type);
+ }
+
+ void functionTypedFormalParameter(int offset, DartType type) {
+ listener.functionTypedFormalParameter(offset, type);
+ }
+
bool isAssignable(DartType expectedType, DartType actualType) {
return typeSchemaEnvironment.isSubtypeOf(expectedType, actualType) ||
typeSchemaEnvironment.isSubtypeOf(actualType, expectedType);
@@ -1695,7 +1747,13 @@
@override
void storePrefix(Token token, PrefixBuilder prefix) {
- listener.storePrefixInfo(token.offset, prefix.importIndex);
+ listener.storePrefixInfo(token.offset, prefix?.importIndex);
+ }
+
+ @override
+ void storeTypeReference(
+ int offset, TreeNode reference, Object binder, DartType type) {
+ listener.typeReference(offset, null, null, null, reference, binder, type);
}
@override
@@ -1710,12 +1768,24 @@
// TODO(paulberry): handle this case.
} else if (node is InvalidType) {
// TODO(paulberry): handle this case.
+ listener.storeClassReference(offset, null, const DynamicType());
} else {
// TODO(paulberry): handle this case.
return unhandled("${node.runtimeType}", "storeTypeUse", offset, uri);
}
}
+ @override
+ void typeVariableDeclaration(
+ int offset, Object binder, TypeParameter typeParameter) {
+ return listener.typeVariableDeclaration(offset, binder, typeParameter);
+ }
+
+ @override
+ void voidType(int offset, Token token, DartType type) {
+ listener.voidType(offset, token, type);
+ }
+
DartType wrapFutureOrType(DartType type) {
if (type is InterfaceType &&
identical(type.classNode, coreTypes.futureOrClass)) {
diff --git a/pkg/front_end/lib/src/scanner/scanner.dart b/pkg/front_end/lib/src/scanner/scanner.dart
index 6091c28..f4b1e96 100644
--- a/pkg/front_end/lib/src/scanner/scanner.dart
+++ b/pkg/front_end/lib/src/scanner/scanner.dart
@@ -126,13 +126,6 @@
*/
abstract class Scanner {
/**
- * A flag indicating whether the analyzer [Scanner] factory method
- * will return a fasta based scanner or an analyzer based scanner.
- */
- static bool useFasta =
- const bool.fromEnvironment("useFastaScanner", defaultValue: true);
-
- /**
* The reader used to access the characters in the source.
*/
final CharacterReader _reader;
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index f458984..77ca5a3 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -39,11 +39,9 @@
CantUseSuperBoundedTypeForInstanceCreation/analyzerCode: Fail
CantUseSuperBoundedTypeForInstanceCreation/example: Fail
ColonInPlaceOfIn/example: Fail
-ConflictsWithConstructor/analyzerCode: Fail
ConflictsWithConstructor/example: Fail
ConflictsWithFactory/analyzerCode: Fail
ConflictsWithFactory/example: Fail
-ConflictsWithMember/analyzerCode: Fail
ConflictsWithMember/example: Fail
ConflictsWithMemberWarning/analyzerCode: Fail
ConflictsWithMemberWarning/example: Fail
@@ -51,7 +49,6 @@
ConflictsWithSetter/example: Fail
ConflictsWithSetterWarning/analyzerCode: Fail
ConflictsWithSetterWarning/example: Fail
-ConflictsWithTypeVariable/analyzerCode: Fail
ConflictsWithTypeVariable/example: Fail
ConstAfterFactory/script1: Fail
ConstAndCovariant/script2: Fail
@@ -86,6 +83,7 @@
ConstFieldWithoutInitializer/example: Fail
ConstructorNotFound/analyzerCode: Fail
ConstructorNotFound/example: Fail
+ConstructorNotSync/example: Fail
ContinueOutsideOfLoop/script1: Fail
ContinueWithoutLabelInCase/script1: Fail
CouldNotParseUri/analyzerCode: Fail
@@ -99,7 +97,6 @@
CyclicClassHierarchy/analyzerCode: Fail
CyclicClassHierarchy/example: Fail
CyclicTypedef/example: Fail
-DeclaredMemberConflictsWithInheritedMember/analyzerCode: Fail
DeferredAfterPrefix/example: Fail
DeferredPrefixDuplicated/example: Fail
DeferredTypeAnnotation/example: Fail
@@ -175,12 +172,13 @@
FieldInitializerOutsideConstructor/script1: Fail
FinalAndCovariant/script2: Fail
FinalFieldWithoutInitializer/example: Fail
-FinalInstanceVariableAlreadyInitialized/analyzerCode: Fail
FinalInstanceVariableAlreadyInitialized/example: Fail
+ForInLoopElementTypeNotAssignable/example: Fail
ForInLoopExactlyOneVariable/analyzerCode: Fail # The analyzer doesn't recover well.
ForInLoopExactlyOneVariable/statement: Fail # Fasta reports too many errors.
ForInLoopNotAssignable/analyzerCode: Fail # The analyzer reports a different error.
ForInLoopNotAssignable/statement: Fail
+ForInLoopTypeNotIterable/example: Fail
FunctionTypeDefaultValue/example: Fail
FunctionTypedParameterVar/script1: Fail
GeneratorReturnsValue/example: Fail
@@ -195,7 +193,6 @@
ImplementsBeforeWith/script: Fail
ImplicitCallOfNonMethod/example: Fail
ImportAfterPart/script1: Fail
-InheritedMembersConflict/analyzerCode: Fail
InputFileNotFound/analyzerCode: Fail
InputFileNotFound/example: Fail
IntegerLiteralIsOutOfRange/example: Fail
@@ -217,12 +214,9 @@
InvalidVoid/script2: Fail
LibraryDirectiveNotFirst/script2: Fail
LibraryDirectiveNotFirst/script3: Fail
-ListLiteralTooManyTypeArguments/analyzerCode: Fail
ListLiteralTooManyTypeArguments/example: Fail
-ListLiteralTypeArgumentMismatch/analyzerCode: Fail
-ListLiteralTypeArgumentMismatch/example: Fail
-LoadLibraryTakesNoArguments/analyzerCode: Fail
LoadLibraryTakesNoArguments/example: Fail
+MapLiteralTypeArgumentMismatch/example: Fail
MemberWithSameNameAsClass/analyzerCode: Fail
MemberWithSameNameAsClass/example: Fail
MetadataTypeArguments/analyzerCode: Fail
@@ -250,12 +244,16 @@
NoUnnamedConstructorInObject/analyzerCode: Fail
NoUnnamedConstructorInObject/example: Fail
NonAsciiIdentifier/expression: Fail
+NonConstConstructor/example: Fail
+NonConstFactory/example: Fail
NonInstanceTypeVariableUse/example: Fail
NonPartOfDirectiveInPart/script1: Fail
+NotAConstantExpression/example: Fail
NotAPrefixInTypeAnnotation/example: Fail
NotAType/example: Fail
NotAnLvalue/analyzerCode: Fail
NotAnLvalue/example: Fail
+NotConstantExpression/example: Fail
OperatorMinusParameterMismatch/example: Fail
OperatorParameterMismatch0/analyzerCode: Fail
OperatorParameterMismatch0/example: Fail
@@ -319,7 +317,6 @@
SourceOutlineSummary/example: Fail
StackOverflow/example: Fail
StaticAfterConst/script1: Fail
-SuperAsExpression/analyzerCode: Fail
SuperAsExpression/example: Fail
SuperAsIdentifier/analyzerCode: Fail
SuperAsIdentifier/example: Fail
@@ -339,7 +336,6 @@
SupertypeIsTypeVariable/analyzerCode: Fail
SupertypeIsTypeVariable/example: Fail
SwitchCaseFallThrough/example: Fail
-ThisAccessInFieldInitializer/analyzerCode: Fail
ThisAccessInFieldInitializer/example: Fail
ThisAsIdentifier/analyzerCode: Fail
ThisAsIdentifier/example: Fail
@@ -354,7 +350,6 @@
TypeNotFound/example: Fail
TypeVariableDuplicatedName/example: Fail
TypeVariableInStaticContext/example: Fail
-TypeVariableSameNameAsEnclosing/analyzerCode: Fail
TypeVariableSameNameAsEnclosing/example: Fail
TypedefNotFunction/example: Fail
UnexpectedDollarInString/script1: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index e6e0060..7c48b34 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -135,6 +135,17 @@
template: "The variable '#string' is not a constant, only constant expressions are allowed."
analyzerCode: NON_CONSTANT_VALUE_IN_INITIALIZER
+NotConstantExpression:
+ template: "#string is not a constant expression."
+ analyzerCode: NOT_CONSTANT_EXPRESSION
+ dart2jsCode: "*fatal*"
+
+NotAConstantExpression:
+ template: "Not a constant expression."
+ severity: ERROR
+ analyzerCode: NOT_CONSTANT_EXPRESSION
+ dart2jsCode: "*fatal*"
+
NonAsciiIdentifier:
template: "The non-ASCII character '#character' (#unicode) can't be used in identifiers, only in strings and comments."
tip: "Try using an US-ASCII letter, a digit, '_' (an underscore), or '$' (a dollar sign)."
@@ -207,6 +218,7 @@
statement: "void;"
ExpectedButGot:
+ # Also see ExpectedAfterButGot
template: "Expected '#string' before this."
# Consider the second example below: the parser expects a ')' before 'y', but
# a ',' would also have worked. We don't have enough information to give a
@@ -217,6 +229,32 @@
- "main() => true ? 1;"
- "main() => foo(x: 1 y: 2);"
+ExpectedAfterButGot:
+ # Also see ExpectedButGot
+ template: "Expected '#string' after this."
+ # This is an alternative to ExpectedButGot when it's better for the error to be
+ # associated with the last consumed token rather than the token being parsed.
+ # Doing so can make it cognitively easier for the user to understand and fix.
+ #
+ # For example, this is ok...
+ #
+ # x = 7
+ # class Foo {
+ # ^^^^^
+ # Expected ';' before this
+ #
+ # but this is easier for the user...
+ #
+ # x = 7
+ # ^
+ # Expected ';' after this
+ # class Foo {
+ #
+ analyzerCode: EXPECTED_TOKEN
+ dart2jsCode: MISSING_TOKEN_AFTER_THIS
+ script:
+ - "main() { return true }"
+
MultipleLibraryDirectives:
template: "Only one library directive may be declared in a file."
tip: "Try removing all but one of the library directives."
@@ -463,6 +501,20 @@
script:
- "class C { const factory C() {} }"
+NonConstFactory:
+ template: "Cannot invoke a non-'const' factory where a const expression is expected."
+ tip: "Try using a constructor or factory that is 'const'."
+ severity: ERROR
+ analyzerCode: NOT_CONSTANT_EXPRESSION
+ dart2jsCode: "*fatal*"
+
+NonConstConstructor:
+ template: "Cannot invoke a non-'const' constructor where a const expression is expected."
+ tip: "Try using a constructor or factory that is 'const'."
+ severity: ERROR
+ analyzerCode: NOT_CONSTANT_EXPRESSION
+ dart2jsCode: "*fatal*"
+
ConstAfterFactory:
template: "The modifier 'const' should be before the modifier 'factory'."
tip: "Try re-ordering the modifiers."
@@ -949,9 +1001,14 @@
await for (var e in o) {}
}
+ConstructorNotSync:
+ template: "Constructor bodies can't use 'async', 'async*', or 'sync*'."
+ analyzerCode: NON_SYNC_CONSTRUCTOR
+ dart2jsCode: "*ignored*"
+
FactoryNotSync:
- template: "Factories can't use 'async', 'async*', or 'sync*'."
- analyzerCode: NON_SYNC_FACTORY_METHOD
+ template: "Factory bodies can't use 'async', 'async*', or 'sync*'."
+ analyzerCode: NON_SYNC_FACTORY
dart2jsCode: "*ignored*"
GeneratorReturnsValue:
@@ -1213,16 +1270,22 @@
severity: CONTEXT
ListLiteralTooManyTypeArguments:
- template: "Too many type arguments on List literal."
+ template: "List literal requires exactly one type argument."
severity: ERROR_LEGACY_WARNING
+ analyzerCode: EXPECTED_ONE_LIST_TYPE_ARGUMENTS
+ dart2jsCode: "*fatal*"
-ListLiteralTypeArgumentMismatch:
- template: "Map literal requires two type arguments."
+MapLiteralTypeArgumentMismatch:
+ template: "Map literal requires exactly two type arguments."
severity: ERROR_LEGACY_WARNING
+ analyzerCode: EXPECTED_TWO_MAP_TYPE_ARGUMENTS
+ dart2jsCode: "*fatal*"
LoadLibraryTakesNoArguments:
template: "'loadLibrary' takes no arguments."
severity: ERROR_LEGACY_WARNING
+ analyzerCode: LOAD_LIBRARY_TAKES_NO_ARGUMENTS
+ dart2jsCode: "*fatal*"
LoadLibraryHidesMember:
template: "The library '#uri' defines a top-level member named 'loadLibrary'. This member is hidden by the special member 'loadLibrary' that the language adds to support deferred loading."
@@ -1523,6 +1586,8 @@
ConflictsWithConstructor:
template: "Conflicts with constructor '#name'."
severity: ERROR
+ analyzerCode: CONFLICTS_WITH_CONSTRUCTOR
+ dart2jsCode: "*fatal*"
ConflictsWithFactory:
template: "Conflicts with factory '#name'."
@@ -1531,6 +1596,8 @@
ConflictsWithMember:
template: "Conflicts with member '#name'."
severity: ERROR
+ analyzerCode: CONFLICTS_WITH_MEMBER
+ dart2jsCode: "*fatal*"
ConflictsWithMemberWarning:
template: "Conflicts with member '#name'."
@@ -1547,6 +1614,8 @@
ConflictsWithTypeVariable:
template: "Conflicts with type variable '#name'."
severity: ERROR
+ analyzerCode: CONFLICTING_TYPE_VARIABLE_AND_MEMBER
+ dart2jsCode: "*fatal*"
ConflictsWithTypeVariableCause:
template: "This is the type variable."
@@ -1555,6 +1624,8 @@
DeclaredMemberConflictsWithInheritedMember:
template: "Can't declare a member that conflicts with an inherited one."
severity: ERROR_LEGACY_WARNING
+ analyzerCode: DECLARED_MEMBER_CONFLICTS_WITH_INHERITED
+ dart2jsCode: "*fatal*"
script:
- >-
class A {
@@ -1592,6 +1663,8 @@
InheritedMembersConflict:
template: "Can't inherit members that conflict with each other."
severity: ERROR_LEGACY_WARNING
+ analyzerCode: CONFLICTS_WITH_INHERITED_MEMBER
+ dart2jsCode: "*fatal*"
script:
- >-
class A {
@@ -1690,6 +1763,8 @@
TypeVariableSameNameAsEnclosing:
template: "A type variable can't have the same name as its enclosing declaration."
+ analyzerCode: CONFLICTING_TYPE_VARIABLE_AND_CLASS
+ dart2jsCode: "*fatal*"
ExpectedEnumBody:
template: "Expected a enum body, but got '#lexeme'."
@@ -1928,6 +2003,7 @@
DuplicatedParameterName:
template: "Duplicated parameter name '#name'."
+ severity: ERROR
analyzerCode: DUPLICATE_DEFINITION
dart2jsCode: "*fatal*"
@@ -2024,6 +2100,8 @@
ThisAccessInFieldInitializer:
template: "Can't access 'this' in a field initializer to read '#name'."
+ analyzerCode: THIS_ACCESS_FROM_INITIALIZER
+ dart2jsCode: "*fatal*"
ThisAsIdentifier:
template: "Expected identifier, but got 'this'."
@@ -2034,6 +2112,8 @@
SuperAsExpression:
template: "Can't use 'super' as an expression."
tip: "To delegate a constructor to a super constructor, put the super call as an initializer."
+ analyzerCode: SUPER_AS_EXPRESSION
+ dart2jsCode: "*fatal*"
SwitchHasCaseAfterDefault:
template: "The default case should be the last case in a switch statement."
@@ -2060,6 +2140,8 @@
FinalInstanceVariableAlreadyInitialized:
template: "'#name' is a final instance variable that has already been initialized."
severity: ERROR_LEGACY_WARNING
+ analyzerCode: FINAL_INITIALIZED_MULTIPLE_TIMES
+ dart2jsCode: "*fatal*"
FinalInstanceVariableAlreadyInitializedCause:
template: "'#name' was initialized here."
@@ -2385,6 +2467,17 @@
severity: ERROR
statement: "for (var x, y in []) {}"
+ForInLoopElementTypeNotAssignable:
+ template: "A value of type '#type' can't be assigned to a variable of type '#type2'."
+ tip: "Try changing the type of the variable."
+ analyzerCode: FOR_IN_OF_INVALID_ELEMENT_TYPE
+ dart2jsCode: "*fatal*"
+
+ForInLoopTypeNotIterable:
+ template: "The type '#type' used in the 'for' loop must implement '#type2'."
+ analyzerCode: FOR_IN_OF_INVALID_TYPE
+ dart2jsCode: "*fatal*"
+
InitializingFormalTypeMismatch:
template: "The type of parameter '#name' (#type) is not a subtype of the corresponding field's type (#type2)."
tip: "Try changing the type of parameter '#name' to a subtype of #type2."
@@ -2517,3 +2610,11 @@
factory Foo.bar() = Foo.foo;
}
main() { var foo = new Foo.foo(); }
+
+GenericFunctionTypeInBound:
+ template: "Type variables can't have generic function types in their bounds."
+ analyzerCode: GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND
+ dart2jsCode: "*fatal*"
+ severity: ERROR
+ script: |
+ class Hest<X extends Y Function<Y>(Y)> {}
diff --git a/pkg/front_end/test/fasta/generator_to_string_test.dart b/pkg/front_end/test/fasta/generator_to_string_test.dart
index 3ba613b..45642d3 100644
--- a/pkg/front_end/test/fasta/generator_to_string_test.dart
+++ b/pkg/front_end/test/fasta/generator_to_string_test.dart
@@ -205,7 +205,7 @@
"ThisAccessGenerator(offset: 4, isInitializer: false, isSuper: false)",
new ThisAccessGenerator(helper, token, false));
check("IncompleteErrorGenerator(offset: 4, message: Unspecified)",
- new IncompleteErrorGenerator(helper, token, message));
+ new IncompleteErrorGenerator(helper, token, getter, message));
check("SendAccessGenerator(offset: 4, name: bar, arguments: (\"arg\"))",
new SendAccessGenerator(helper, token, name, arguments));
check("IncompletePropertyAccessGenerator(offset: 4, name: bar)",
diff --git a/pkg/front_end/test/src/byte_store/crc32_test.dart b/pkg/front_end/test/src/byte_store/crc32_test.dart
index 0119bb8..0d209bb 100644
--- a/pkg/front_end/test/src/byte_store/crc32_test.dart
+++ b/pkg/front_end/test/src/byte_store/crc32_test.dart
@@ -33,6 +33,6 @@
}
test_string() {
- expect(getCrc32(UTF8.encode('My very long test string.')), 0x88B8252E);
+ expect(getCrc32(utf8.encode('My very long test string.')), 0x88B8252E);
}
}
diff --git a/pkg/front_end/test/src/byte_store/protected_file_byte_store_test.dart b/pkg/front_end/test/src/byte_store/protected_file_byte_store_test.dart
index d117bf4..e1fc175 100644
--- a/pkg/front_end/test/src/byte_store/protected_file_byte_store_test.dart
+++ b/pkg/front_end/test/src/byte_store/protected_file_byte_store_test.dart
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'dart:async';
import 'dart:io' as io;
import 'package:front_end/src/byte_store/protected_file_byte_store.dart';
@@ -49,7 +50,7 @@
} on io.FileSystemException {}
}
- test_flush() {
+ test_flush() async {
store.put('a', _b(1));
store.put('b', _b(2));
store.put('c', _b(3));
@@ -57,6 +58,9 @@
store.updateProtectedKeys(add: ['b', 'd']);
+ // Add a delay to give the store time to write to disk.
+ await new Future.delayed(const Duration(milliseconds: 200));
+
// Flush, only protected 'b' and 'd' survive.
store.flush();
store.flush();
@@ -69,7 +73,7 @@
_assertCacheContent({'d': 4}, ['b']);
}
- test_put() {
+ test_put() async {
store.put('a', _b(65));
store.put('b', _b(63));
store.put('c', _b(1));
@@ -78,6 +82,10 @@
expect(store.get('a'), hasLength(65));
expect(store.get('b'), hasLength(63));
expect(store.get('c'), hasLength(1));
+
+ // Add a delay to give the store time to write to disk.
+ await new Future.delayed(const Duration(milliseconds: 200));
+
_assertCacheContent({'a': 65, 'b': 63, 'c': 1}, []);
}
diff --git a/pkg/front_end/testcases/check_deferred_before_args.dart.strong.expect b/pkg/front_end/testcases/check_deferred_before_args.dart.strong.expect
index 0ff5bf9..3748727 100644
--- a/pkg/front_end/testcases/check_deferred_before_args.dart.strong.expect
+++ b/pkg/front_end/testcases/check_deferred_before_args.dart.strong.expect
@@ -1,10 +1,11 @@
library;
import self as self;
import "./deferred_lib.dart" as def;
+import "dart:core" as core;
static method main() → dynamic {}
static method test() → dynamic {
- let final dynamic #t1 = CheckLibraryIsLoaded(lib) in def::x = self::m2();
+ let final dynamic #t1 = CheckLibraryIsLoaded(lib) in def::x = self::m2() as{TypeError} core::int;
let final dynamic #t2 = CheckLibraryIsLoaded(lib) in def::m(self::m2());
}
static method m2() → dynamic
diff --git a/pkg/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect b/pkg/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect
index 74489ed..0cf7c47 100644
--- a/pkg/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/check_deferred_before_args.dart.strong.transformed.expect
@@ -5,7 +5,7 @@
static method main() → dynamic {}
static method test() → dynamic {
- let final core::Object #t1 = CheckLibraryIsLoaded(lib) in def::x = self::m2();
+ let final core::Object #t1 = CheckLibraryIsLoaded(lib) in def::x = self::m2() as{TypeError} core::int;
let final core::Object #t2 = CheckLibraryIsLoaded(lib) in def::m(self::m2());
}
static method m2() → dynamic
diff --git a/pkg/front_end/testcases/compile.status b/pkg/front_end/testcases/compile.status
index f34d98f..cd8199e 100644
--- a/pkg/front_end/testcases/compile.status
+++ b/pkg/front_end/testcases/compile.status
@@ -117,6 +117,8 @@
runtime_checks_new/mixin_forwarding_stub_getter: RuntimeError # Test exercises strong mode semantics
runtime_checks_new/mixin_forwarding_stub_setter: RuntimeError # Test exercises strong mode semantics
runtime_checks_new/stub_checked_via_target: RuntimeError # Test exercises strong mode semantics
+constructor_const_inference: RuntimeError # Test exercises strong mode semantics. See also Issue #33813.
+redirecting_factory_const_inference: RuntimeError # Test exercises strong mode semantics. See also Issue #33813.
ambiguous_exports: RuntimeError # Expected, this file exports two main methods.
rasta/duplicated_mixin: RuntimeError # Expected, this file has no main method.
diff --git a/pkg/front_end/testcases/constructor_const_inference.dart b/pkg/front_end/testcases/constructor_const_inference.dart
new file mode 100644
index 0000000..824e517
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_const_inference.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that the type inference implementation correctly uses least
+// closure of the inferred type arguments in invocations of 'const' constructors
+// in case there are type variables in them.
+
+class _Y<T> {
+ const _Y();
+}
+
+class A<T> {
+ _Y<T> x;
+ A(this.x);
+}
+
+class B<T> extends A<T> {
+ B() : super(const _Y());
+}
+
+main() {
+ dynamic x = new B().x;
+ if (x is! _Y<Null>) {
+ throw "Unexpected run-time type: `new B().x` is ${x.runtimeType}, "
+ "but `_Y<Null>` expected";
+ }
+}
diff --git a/pkg/front_end/testcases/constructor_const_inference.dart.direct.expect b/pkg/front_end/testcases/constructor_const_inference.dart.direct.expect
new file mode 100644
index 0000000..00cffbc
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_const_inference.dart.direct.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class _Y<T extends core::Object = dynamic> extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class A<T extends core::Object = dynamic> extends core::Object {
+ field self::_Y<self::A::T> x;
+ constructor •(self::_Y<self::A::T> x) → void
+ : self::A::x = x, super core::Object::•()
+ ;
+}
+class B<T extends core::Object = dynamic> extends self::A<self::B::T> {
+ constructor •() → void
+ : super self::A::•(const self::_Y::•<dynamic>())
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::B::•<dynamic>().x;
+ if(!(x is self::_Y<core::Null>)) {
+ throw "Unexpected run-time type: `new B().x` is ${x.runtimeType}, but `_Y<Null>` expected";
+ }
+}
diff --git a/pkg/front_end/testcases/constructor_const_inference.dart.direct.transformed.expect b/pkg/front_end/testcases/constructor_const_inference.dart.direct.transformed.expect
new file mode 100644
index 0000000..00cffbc
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_const_inference.dart.direct.transformed.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class _Y<T extends core::Object = dynamic> extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class A<T extends core::Object = dynamic> extends core::Object {
+ field self::_Y<self::A::T> x;
+ constructor •(self::_Y<self::A::T> x) → void
+ : self::A::x = x, super core::Object::•()
+ ;
+}
+class B<T extends core::Object = dynamic> extends self::A<self::B::T> {
+ constructor •() → void
+ : super self::A::•(const self::_Y::•<dynamic>())
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::B::•<dynamic>().x;
+ if(!(x is self::_Y<core::Null>)) {
+ throw "Unexpected run-time type: `new B().x` is ${x.runtimeType}, but `_Y<Null>` expected";
+ }
+}
diff --git a/pkg/front_end/testcases/constructor_const_inference.dart.outline.expect b/pkg/front_end/testcases/constructor_const_inference.dart.outline.expect
new file mode 100644
index 0000000..0e89f88
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_const_inference.dart.outline.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class _Y<T extends core::Object = dynamic> extends core::Object {
+ const constructor •() → void
+ ;
+}
+class A<T extends core::Object = dynamic> extends core::Object {
+ field self::_Y<self::A::T> x;
+ constructor •(self::_Y<self::A::T> x) → void
+ ;
+}
+class B<T extends core::Object = dynamic> extends self::A<self::B::T> {
+ constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/constructor_const_inference.dart.strong.expect b/pkg/front_end/testcases/constructor_const_inference.dart.strong.expect
new file mode 100644
index 0000000..0ec23a5
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_const_inference.dart.strong.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class _Y<T extends core::Object = dynamic> extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class A<T extends core::Object = dynamic> extends core::Object {
+ generic-covariant-impl field self::_Y<self::A::T> x;
+ constructor •(self::_Y<self::A::T> x) → void
+ : self::A::x = x, super core::Object::•()
+ ;
+}
+class B<T extends core::Object = dynamic> extends self::A<self::B::T> {
+ constructor •() → void
+ : super self::A::•(const self::_Y::•<core::Null>())
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::B::•<dynamic>().{self::A::x};
+ if(!(x is self::_Y<core::Null>)) {
+ throw "Unexpected run-time type: `new B().x` is ${x.{core::Object::runtimeType}}, but `_Y<Null>` expected";
+ }
+}
diff --git a/pkg/front_end/testcases/constructor_const_inference.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_const_inference.dart.strong.transformed.expect
new file mode 100644
index 0000000..0ec23a5
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_const_inference.dart.strong.transformed.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class _Y<T extends core::Object = dynamic> extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class A<T extends core::Object = dynamic> extends core::Object {
+ generic-covariant-impl field self::_Y<self::A::T> x;
+ constructor •(self::_Y<self::A::T> x) → void
+ : self::A::x = x, super core::Object::•()
+ ;
+}
+class B<T extends core::Object = dynamic> extends self::A<self::B::T> {
+ constructor •() → void
+ : super self::A::•(const self::_Y::•<core::Null>())
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::B::•<dynamic>().{self::A::x};
+ if(!(x is self::_Y<core::Null>)) {
+ throw "Unexpected run-time type: `new B().x` is ${x.{core::Object::runtimeType}}, but `_Y<Null>` expected";
+ }
+}
diff --git a/pkg/front_end/testcases/expression/lib_nonshown_ctor.expression.yaml.expect b/pkg/front_end/testcases/expression/lib_nonshown_ctor.expression.yaml.expect
index f6b2dd6..f7f9eda 100644
--- a/pkg/front_end/testcases/expression/lib_nonshown_ctor.expression.yaml.expect
+++ b/pkg/front_end/testcases/expression/lib_nonshown_ctor.expression.yaml.expect
@@ -1,5 +1,6 @@
Errors: {
Method not found: 'Directory'. (@4)
+ Too many positional arguments: 0 allowed, 1 given. (@0)
}
method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
return throw new dart.core::NoSuchMethodError::withInvocation(null, new dart.core::_InvocationMirror::_withType(#Directory, 32, const <dart.core::Type>[], dart.core::List::unmodifiable<dynamic>(<dynamic>["test"]), dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(const <dart.core::Symbol, dynamic>{})));
diff --git a/pkg/front_end/testcases/inference/conflicts_can_happen.dart b/pkg/front_end/testcases/inference/conflicts_can_happen.dart
index aaebf32..ce73f69 100644
--- a/pkg/front_end/testcases/inference/conflicts_can_happen.dart
+++ b/pkg/front_end/testcases/inference/conflicts_can_happen.dart
@@ -22,13 +22,13 @@
}
class C1 implements A, B {
- get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>
+ get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
null;
}
// Still ambiguous
class C2 implements B, A {
- get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>
+ get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
null;
}
diff --git a/pkg/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect b/pkg/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect
index 9cc64f9..c37d0e9 100644
--- a/pkg/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect
@@ -1,14 +1,34 @@
// Errors:
//
-// pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:79: Error: Can't infer the type of 'a': overridden members must all have the same type.
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:163: Error: Can't infer the type of 'a': overridden members must all have the same type.
// Specify the type explicitly.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>
-// ^
+// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
+// ^
//
-// pkg/front_end/testcases/inference/conflicts_can_happen.dart:31:79: Error: Can't infer the type of 'a': overridden members must all have the same type.
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:31:163: Error: Can't infer the type of 'a': overridden members must all have the same type.
// Specify the type explicitly.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>
-// ^
+// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
+// ^
+//
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:163: Error: The return type of the method 'C1::a' is dynamic, which does not match the return type of the overridden method (test::I1).
+// Change to a subtype of test::I1.
+// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
+// ^
+//
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:163: Error: The return type of the method 'C1::a' is dynamic, which does not match the return type of the overridden method (test::I2).
+// Change to a subtype of test::I2.
+// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
+// ^
+//
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:31:163: Error: The return type of the method 'C2::a' is dynamic, which does not match the return type of the overridden method (test::I2).
+// Change to a subtype of test::I2.
+// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
+// ^
+//
+// pkg/front_end/testcases/inference/conflicts_can_happen.dart:31:163: Error: The return type of the method 'C2::a' is dynamic, which does not match the return type of the overridden method (test::I1).
+// Change to a subtype of test::I1.
+// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
+// ^
library test;
import self as self;
diff --git a/pkg/front_end/testcases/inference/conflicts_can_happen2.dart b/pkg/front_end/testcases/inference/conflicts_can_happen2.dart
index 85e0bd5..150baa5 100644
--- a/pkg/front_end/testcases/inference/conflicts_can_happen2.dart
+++ b/pkg/front_end/testcases/inference/conflicts_can_happen2.dart
@@ -31,7 +31,7 @@
}
class C2 implements A, B {
- get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>
+ get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
null;
}
diff --git a/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect b/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect
index 69d9cd1..746541f 100644
--- a/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect
@@ -1,9 +1,19 @@
// Errors:
//
-// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:79: Error: Can't infer the type of 'a': overridden members must all have the same type.
+// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:163: Error: Can't infer the type of 'a': overridden members must all have the same type.
// Specify the type explicitly.
-// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>
-// ^
+// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
+// ^
+//
+// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:163: Error: The return type of the method 'C2::a' is dynamic, which does not match the return type of the overridden method (test::I1).
+// Change to a subtype of test::I1.
+// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
+// ^
+//
+// pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:163: Error: The return type of the method 'C2::a' is dynamic, which does not match the return type of the overridden method (test::I2).
+// Change to a subtype of test::I2.
+// get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ a =>
+// ^
library test;
import self as self;
diff --git a/pkg/front_end/testcases/inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer.dart.strong.expect b/pkg/front_end/testcases/inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer.dart.strong.expect
index fcd76d6..d3420e5 100644
--- a/pkg/front_end/testcases/inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer.dart.strong.expect
@@ -1,3 +1,10 @@
+// Errors:
+//
+// pkg/front_end/testcases/inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer.dart:13:49: Error: The return type of the method 'B::x' is dynamic, which does not match the return type of the overridden method (dart.core::int).
+// Change to a subtype of dart.core::int.
+// /*error:INVALID_METHOD_OVERRIDE*/ dynamic get x => 3;
+// ^
+
library test;
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/inference/infer_field_override_multiple.dart b/pkg/front_end/testcases/inference/infer_field_override_multiple.dart
index a7484f4..8b6336a 100644
--- a/pkg/front_end/testcases/inference/infer_field_override_multiple.dart
+++ b/pkg/front_end/testcases/inference/infer_field_override_multiple.dart
@@ -29,15 +29,15 @@
// Superclasses don't have a consistent type for `x` so inference fails, even if
// the types are related.
class F extends A implements C {
- var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;
+ var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
}
class G extends A implements D {
- var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;
+ var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
}
class H extends C implements D {
- var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;
+ var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
}
main() {}
diff --git a/pkg/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect b/pkg/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect
index e636683..ec15c8d 100644
--- a/pkg/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect
@@ -1,19 +1,49 @@
// Errors:
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:79: Error: Can't infer the type of 'x': overridden members must all have the same type.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:163: Error: Can't infer the type of 'x': overridden members must all have the same type.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;
-// ^
+// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+// ^
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:79: Error: Can't infer the type of 'x': overridden members must all have the same type.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:163: Error: Can't infer the type of 'x': overridden members must all have the same type.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;
-// ^
+// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+// ^
//
-// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:79: Error: Can't infer the type of 'x': overridden members must all have the same type.
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:163: Error: Can't infer the type of 'x': overridden members must all have the same type.
// Specify the type explicitly.
-// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;
-// ^
+// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+// ^
+//
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:163: Error: The return type of the method 'F::x' is dynamic, which does not match the return type of the overridden method (dart.core::int).
+// Change to a subtype of dart.core::int.
+// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+// ^
+//
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:163: Error: The return type of the method 'F::x' is dynamic, which does not match the return type of the overridden method (dart.core::num).
+// Change to a subtype of dart.core::num.
+// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+// ^
+//
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:163: Error: The return type of the method 'G::x' is dynamic, which does not match the return type of the overridden method (dart.core::int).
+// Change to a subtype of dart.core::int.
+// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+// ^
+//
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:163: Error: The return type of the method 'G::x' is dynamic, which does not match the return type of the overridden method (dart.core::double).
+// Change to a subtype of dart.core::double.
+// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+// ^
+//
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:163: Error: The return type of the method 'H::x' is dynamic, which does not match the return type of the overridden method (dart.core::num).
+// Change to a subtype of dart.core::num.
+// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+// ^
+//
+// pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:163: Error: The return type of the method 'H::x' is dynamic, which does not match the return type of the overridden method (dart.core::double).
+// Change to a subtype of dart.core::double.
+// var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ /*@error=OverrideTypeMismatchReturnType*/ /*@error=OverrideTypeMismatchReturnType*/ x;
+// ^
library test;
import self as self;
diff --git a/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_infer.dart.strong.expect b/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_infer.dart.strong.expect
index 615fcf8..9b83615 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_infer.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_infer.dart.strong.expect
@@ -1,3 +1,10 @@
+// Errors:
+//
+// pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_infer.dart:13:49: Error: The return type of the method 'B::x' is dynamic, which does not match the return type of the overridden method (dart.core::int).
+// Change to a subtype of dart.core::int.
+// /*error:INVALID_METHOD_OVERRIDE*/ dynamic get x => 3;
+// ^
+
library test;
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect
index 4b7c312..f79f8f4 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect
@@ -48,7 +48,7 @@
}
for (final self::Foo #t7 in list) {
core::String x = let dynamic _ = null in let final dynamic #t8 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:39:15: Error: A value of type 'test::Foo' can't be assigned to a variable of type 'dart.core::String'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.
+Try changing the type of the variable.
for (String x in /*error:FOR_IN_OF_INVALID_ELEMENT_TYPE*/ list) {
^" in let final dynamic #t9 = #t7 in null;
core::String y = x;
@@ -69,8 +69,7 @@
self::Foo y = x;
}
core::Map<core::String, self::Foo> map = <core::String, self::Foo>{};
- for (dynamic x in let dynamic _ = null in let final dynamic #t13 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:60:68: Error: A value of type 'dart.core::Map<dart.core::String, test::Foo>' can't be assigned to a variable of type 'dart.core::Iterable<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::Iterable<dynamic>'.
+ for (dynamic x in let dynamic _ = null in let final dynamic #t13 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:60:68: Error: The type 'dart.core::Map<dart.core::String, test::Foo>' used in the 'for' loop must implement 'dart.core::Iterable<dynamic>'.
for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) {
^" in let final dynamic #t14 = map in null) {
core::String y = x as{TypeError} core::String;
diff --git a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.transformed.expect
index 674ff5c..c3336c2 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.transformed.expect
@@ -48,7 +48,7 @@
}
for (final self::Foo #t7 in list) {
core::String x = let<BottomType> _ = null in let final dynamic #t8 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:39:15: Error: A value of type 'test::Foo' can't be assigned to a variable of type 'dart.core::String'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.
+Try changing the type of the variable.
for (String x in /*error:FOR_IN_OF_INVALID_ELEMENT_TYPE*/ list) {
^" in let final self::Foo #t9 = #t7 in null;
core::String y = x;
@@ -69,8 +69,7 @@
self::Foo y = x;
}
core::Map<core::String, self::Foo> map = <core::String, self::Foo>{};
- for (dynamic x in let<BottomType> _ = null in let final dynamic #t13 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:60:68: Error: A value of type 'dart.core::Map<dart.core::String, test::Foo>' can't be assigned to a variable of type 'dart.core::Iterable<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::Iterable<dynamic>'.
+ for (dynamic x in let<BottomType> _ = null in let final dynamic #t13 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:60:68: Error: The type 'dart.core::Map<dart.core::String, test::Foo>' used in the 'for' loop must implement 'dart.core::Iterable<dynamic>'.
for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) {
^" in let final core::Map<core::String, self::Foo> #t14 = map in null) {
core::String y = x as{TypeError} core::String;
diff --git a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.expect b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.expect
index 5ebd147..a915514 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.expect
@@ -53,7 +53,7 @@
}
await for (final self::Foo #t7 in myStream) {
core::String x = let dynamic _ = null in let final dynamic #t8 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:45:21: Error: A value of type 'test::Foo' can't be assigned to a variable of type 'dart.core::String'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.
+Try changing the type of the variable.
await for (String x in /*error:FOR_IN_OF_INVALID_ELEMENT_TYPE*/ myStream) {
^" in let final dynamic #t9 = #t7 in null;
core::String y = x;
@@ -74,8 +74,7 @@
self::Foo y = x;
}
core::Map<core::String, self::Foo> map = <core::String, self::Foo>{};
- await for (dynamic x in let dynamic _ = null in let final dynamic #t13 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:66:74: Error: A value of type 'dart.core::Map<dart.core::String, test::Foo>' can't be assigned to a variable of type 'dart.async::Stream<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.async::Stream<dynamic>'.
+ await for (dynamic x in let dynamic _ = null in let final dynamic #t13 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:66:74: Error: The type 'dart.core::Map<dart.core::String, test::Foo>' used in the 'for' loop must implement 'dart.async::Stream<dynamic>'.
await for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) {
^" in let final dynamic #t14 = map in null) {
core::String y = x as{TypeError} core::String;
diff --git a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect
index f191019..a3426db 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect
@@ -202,7 +202,7 @@
final self::Foo #t16 = :for-iterator.{asy::_StreamIterator::current};
{
core::String x = let<BottomType> _ = null in let final dynamic #t17 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:45:21: Error: A value of type 'test::Foo' can't be assigned to a variable of type 'dart.core::String'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.
+Try changing the type of the variable.
await for (String x in /*error:FOR_IN_OF_INVALID_ELEMENT_TYPE*/ myStream) {
^" in let final self::Foo #t18 = #t16 in null;
core::String y = x;
@@ -288,8 +288,7 @@
}
core::Map<core::String, self::Foo> map = <core::String, self::Foo>{};
{
- asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(let<BottomType> _ = null in let final dynamic #t29 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:66:74: Error: A value of type 'dart.core::Map<dart.core::String, test::Foo>' can't be assigned to a variable of type 'dart.async::Stream<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.async::Stream<dynamic>'.
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(let<BottomType> _ = null in let final dynamic #t29 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:66:74: Error: The type 'dart.core::Map<dart.core::String, test::Foo>' used in the 'for' loop must implement 'dart.async::Stream<dynamic>'.
await for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) {
^" in let final core::Map<core::String, self::Foo> #t30 = map in null);
try
diff --git a/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart b/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart
index 5360fa7..da9ed77 100644
--- a/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart
+++ b/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart
@@ -7,11 +7,11 @@
test() async {
String s;
- for (int x in /*@error=InvalidAssignment*/ s) {}
- await for (int x in /*@error=InvalidAssignment*/ s) {}
+ for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ await for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
int y;
- for (y in /*@error=InvalidAssignment*/ s) {}
- await for (y in /*@error=InvalidAssignment*/ s) {}
+ for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ await for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
}
main() {}
diff --git a/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.expect b/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.expect
index cb323c5..9e2999f 100644
--- a/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.expect
@@ -4,29 +4,25 @@
static method test() → dynamic async {
core::String s;
- for (final dynamic #t1 in let dynamic _ = null in let final dynamic #t2 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:46: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::Iterable<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::Iterable<dynamic>'.
- for (int x in /*@error=InvalidAssignment*/ s) {}
- ^" in let final dynamic #t3 = s in null) {
+ for (final dynamic #t1 in let dynamic _ = null in let final dynamic #t2 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:53: Error: The type 'dart.core::String' used in the 'for' loop must implement 'dart.core::Iterable<dynamic>'.
+ for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ ^" in let final dynamic #t3 = s in null) {
core::int x = #t1 as{TypeError} core::int;
}
- await for (final dynamic #t4 in let dynamic _ = null in let final dynamic #t5 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:52: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.async::Stream<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.async::Stream<dynamic>'.
- await for (int x in /*@error=InvalidAssignment*/ s) {}
- ^" in let final dynamic #t6 = s in null) {
+ await for (final dynamic #t4 in let dynamic _ = null in let final dynamic #t5 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:59: Error: The type 'dart.core::String' used in the 'for' loop must implement 'dart.async::Stream<dynamic>'.
+ await for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ ^" in let final dynamic #t6 = s in null) {
core::int x = #t4 as{TypeError} core::int;
}
core::int y;
- for (final dynamic #t7 in let dynamic _ = null in let final dynamic #t8 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:42: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::Iterable<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::Iterable<dynamic>'.
- for (y in /*@error=InvalidAssignment*/ s) {}
- ^" in let final dynamic #t9 = s in null) {
+ for (final dynamic #t7 in let dynamic _ = null in let final dynamic #t8 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:49: Error: The type 'dart.core::String' used in the 'for' loop must implement 'dart.core::Iterable<dynamic>'.
+ for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ ^" in let final dynamic #t9 = s in null) {
y = #t7 as{TypeError} core::int;
}
- await for (final dynamic #t10 in let dynamic _ = null in let final dynamic #t11 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:48: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.async::Stream<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.async::Stream<dynamic>'.
- await for (y in /*@error=InvalidAssignment*/ s) {}
- ^" in let final dynamic #t12 = s in null) {
+ await for (final dynamic #t10 in let dynamic _ = null in let final dynamic #t11 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:55: Error: The type 'dart.core::String' used in the 'for' loop must implement 'dart.async::Stream<dynamic>'.
+ await for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ ^" in let final dynamic #t12 = s in null) {
y = #t10 as{TypeError} core::int;
}
}
diff --git a/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect b/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect
index 475b64a..ca1eeb2 100644
--- a/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect
@@ -20,17 +20,15 @@
#L1:
{
core::String s;
- for (final dynamic #t1 in let<BottomType> _ = null in let final dynamic #t2 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:46: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::Iterable<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::Iterable<dynamic>'.
- for (int x in /*@error=InvalidAssignment*/ s) {}
- ^" in let final core::String #t3 = s in null) {
+ for (final dynamic #t1 in let<BottomType> _ = null in let final dynamic #t2 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:10:53: Error: The type 'dart.core::String' used in the 'for' loop must implement 'dart.core::Iterable<dynamic>'.
+ for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ ^" in let final core::String #t3 = s in null) {
core::int x = #t1 as{TypeError} core::int;
}
{
- asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(let<BottomType> _ = null in let final dynamic #t4 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:52: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.async::Stream<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.async::Stream<dynamic>'.
- await for (int x in /*@error=InvalidAssignment*/ s) {}
- ^" in let final core::String #t5 = s in null);
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(let<BottomType> _ = null in let final dynamic #t4 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:59: Error: The type 'dart.core::String' used in the 'for' loop must implement 'dart.async::Stream<dynamic>'.
+ await for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ ^" in let final core::String #t5 = s in null);
try
#L2:
while (true) {
@@ -51,17 +49,15 @@
}
}
core::int y;
- for (final dynamic #t9 in let<BottomType> _ = null in let final dynamic #t10 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:42: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::Iterable<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::Iterable<dynamic>'.
- for (y in /*@error=InvalidAssignment*/ s) {}
- ^" in let final core::String #t11 = s in null) {
+ for (final dynamic #t9 in let<BottomType> _ = null in let final dynamic #t10 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:13:49: Error: The type 'dart.core::String' used in the 'for' loop must implement 'dart.core::Iterable<dynamic>'.
+ for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ ^" in let final core::String #t11 = s in null) {
y = #t9 as{TypeError} core::int;
}
{
- asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(let<BottomType> _ = null in let final dynamic #t12 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:48: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.async::Stream<dynamic>'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.async::Stream<dynamic>'.
- await for (y in /*@error=InvalidAssignment*/ s) {}
- ^" in let final core::String #t13 = s in null);
+ asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(let<BottomType> _ = null in let final dynamic #t12 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:55: Error: The type 'dart.core::String' used in the 'for' loop must implement 'dart.async::Stream<dynamic>'.
+ await for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
+ ^" in let final core::String #t13 = s in null);
try
#L3:
while (true) {
diff --git a/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart b/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart
index 06ba28b..9ffdfe8 100644
--- a/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart
+++ b/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart
@@ -23,8 +23,8 @@
await for (a in stream) {}
for (b in iterable) {}
await for (b in stream) {}
- for (i /*@error=InvalidAssignment*/ in iterable) {}
- await for (i /*@error=InvalidAssignment*/ in stream) {}
+ for (i /*@error=ForInLoopElementTypeNotAssignable*/ in iterable) {}
+ await for (i /*@error=ForInLoopElementTypeNotAssignable*/ in stream) {}
for (a in /*@typeArgs=Iterable<A>*/ f()) {}
await for (a in /*@typeArgs=Stream<A>*/ f()) {}
}
diff --git a/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.expect b/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.expect
index 4c88501..9ac5ea0 100644
--- a/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.expect
@@ -34,16 +34,16 @@
b = #t4 as{TypeError} self::B;
}
for (final self::A #t5 in iterable) {
- i = let dynamic _ = null in let final dynamic #t6 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:39: Error: A value of type 'test::A' can't be assigned to a variable of type 'dart.core::int'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
- for (i /*@error=InvalidAssignment*/ in iterable) {}
- ^" in let final dynamic #t7 = #t5 in null;
+ i = let dynamic _ = null in let final dynamic #t6 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:55: Error: A value of type 'test::A' can't be assigned to a variable of type 'dart.core::int'.
+Try changing the type of the variable.
+ for (i /*@error=ForInLoopElementTypeNotAssignable*/ in iterable) {}
+ ^" in let final dynamic #t7 = #t5 in null;
}
await for (final self::A #t8 in stream) {
- i = let dynamic _ = null in let final dynamic #t9 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:45: Error: A value of type 'test::A' can't be assigned to a variable of type 'dart.core::int'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
- await for (i /*@error=InvalidAssignment*/ in stream) {}
- ^" in let final dynamic #t10 = #t8 in null;
+ i = let dynamic _ = null in let final dynamic #t9 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:61: Error: A value of type 'test::A' can't be assigned to a variable of type 'dart.core::int'.
+Try changing the type of the variable.
+ await for (i /*@error=ForInLoopElementTypeNotAssignable*/ in stream) {}
+ ^" in let final dynamic #t10 = #t8 in null;
}
for (final self::A #t11 in self::f<core::Iterable<self::A>>()) {
a = #t11;
diff --git a/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect b/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect
index 399a9d4..e371b6c 100644
--- a/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect
@@ -85,10 +85,10 @@
}
}
for (final self::A #t9 in iterable) {
- i = let<BottomType> _ = null in let final dynamic #t10 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:39: Error: A value of type 'test::A' can't be assigned to a variable of type 'dart.core::int'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
- for (i /*@error=InvalidAssignment*/ in iterable) {}
- ^" in let final self::A #t11 = #t9 in null;
+ i = let<BottomType> _ = null in let final dynamic #t10 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:26:55: Error: A value of type 'test::A' can't be assigned to a variable of type 'dart.core::int'.
+Try changing the type of the variable.
+ for (i /*@error=ForInLoopElementTypeNotAssignable*/ in iterable) {}
+ ^" in let final self::A #t11 = #t9 in null;
}
{
asy::_StreamIterator<self::A> :for-iterator = new asy::_StreamIterator::•<self::A>(stream);
@@ -99,10 +99,10 @@
if(:result) {
final self::A #t13 = :for-iterator.{asy::_StreamIterator::current};
{
- i = let<BottomType> _ = null in let final dynamic #t14 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:45: Error: A value of type 'test::A' can't be assigned to a variable of type 'dart.core::int'.
-Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
- await for (i /*@error=InvalidAssignment*/ in stream) {}
- ^" in let final self::A #t15 = #t13 in null;
+ i = let<BottomType> _ = null in let final dynamic #t14 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:61: Error: A value of type 'test::A' can't be assigned to a variable of type 'dart.core::int'.
+Try changing the type of the variable.
+ await for (i /*@error=ForInLoopElementTypeNotAssignable*/ in stream) {}
+ ^" in let final self::A #t15 = #t13 in null;
}
}
else
diff --git a/pkg/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart.strong.expect b/pkg/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart.strong.expect
index ad2a9c8..dcef35c 100644
--- a/pkg/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart.strong.expect
@@ -1,3 +1,10 @@
+// Errors:
+//
+// pkg/front_end/testcases/inference_new/infer_field_getter_setter_mismatch.dart:16:24: Error: The return type of the method 'B::x' is dart.core::int, which does not match the return type of the overridden method (dart.core::double).
+// Change to a subtype of dart.core::double.
+// var /*@topType=int*/ x;
+// ^
+
library test;
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart.strong.expect b/pkg/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart.strong.expect
index 85d23e6..d765039 100644
--- a/pkg/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart.strong.expect
@@ -1,3 +1,10 @@
+// Errors:
+//
+// pkg/front_end/testcases/inference_new/infer_field_override_getter_overrides_setter.dart:19:24: Error: The return type of the method 'C::x' is dart.core::int, which does not match the return type of the overridden method (dart.core::num).
+// Change to a subtype of dart.core::num.
+// var /*@topType=int*/ x;
+// ^
+
library test;
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/non_simple_generic_function_in_bound_regress.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/non_simple_generic_function_in_bound_regress.dart.strong.expect
index 372b447..c807c38 100644
--- a/pkg/front_end/testcases/instantiate_to_bound/non_simple_generic_function_in_bound_regress.dart.strong.expect
+++ b/pkg/front_end/testcases/instantiate_to_bound/non_simple_generic_function_in_bound_regress.dart.strong.expect
@@ -1,3 +1,9 @@
+// Errors:
+//
+// pkg/front_end/testcases/instantiate_to_bound/non_simple_generic_function_in_bound_regress.dart:11:12: Error: Type variables can't have generic function types in their bounds.
+// class Fisk<TypeY extends Function<TypeZ extends Hest<Null>>(TypeZ)> {}
+// ^^^^^
+
library;
import self as self;
import "dart:core" as core;
@@ -7,7 +13,7 @@
: super core::Object::•()
;
}
-class Fisk<TypeY extends <TypeZ extends self::Hest<core::Null> = dynamic>(TypeZ) → dynamic = <TypeZ extends self::Hest<core::Null> = dynamic>(TypeZ) → dynamic> extends core::Object {
+class Fisk<TypeY extends <TypeZ extends self::Hest<core::Null> = dynamic>(TypeZ) → dynamic = dynamic> extends core::Object {
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/non_simple_generic_function_in_bound_regress.dart.strong.transformed.expect b/pkg/front_end/testcases/instantiate_to_bound/non_simple_generic_function_in_bound_regress.dart.strong.transformed.expect
index 372b447..c807c38 100644
--- a/pkg/front_end/testcases/instantiate_to_bound/non_simple_generic_function_in_bound_regress.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/instantiate_to_bound/non_simple_generic_function_in_bound_regress.dart.strong.transformed.expect
@@ -1,3 +1,9 @@
+// Errors:
+//
+// pkg/front_end/testcases/instantiate_to_bound/non_simple_generic_function_in_bound_regress.dart:11:12: Error: Type variables can't have generic function types in their bounds.
+// class Fisk<TypeY extends Function<TypeZ extends Hest<Null>>(TypeZ)> {}
+// ^^^^^
+
library;
import self as self;
import "dart:core" as core;
@@ -7,7 +13,7 @@
: super core::Object::•()
;
}
-class Fisk<TypeY extends <TypeZ extends self::Hest<core::Null> = dynamic>(TypeZ) → dynamic = <TypeZ extends self::Hest<core::Null> = dynamic>(TypeZ) → dynamic> extends core::Object {
+class Fisk<TypeY extends <TypeZ extends self::Hest<core::Null> = dynamic>(TypeZ) → dynamic = dynamic> extends core::Object {
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/magic_const.dart.direct.expect b/pkg/front_end/testcases/magic_const.dart.direct.expect
index 31bfe5f..0e35d4e 100644
--- a/pkg/front_end/testcases/magic_const.dart.direct.expect
+++ b/pkg/front_end/testcases/magic_const.dart.direct.expect
@@ -14,7 +14,8 @@
}
static method foo({dynamic a = new self::Constant::•(), dynamic b = new self::Constant::•(), dynamic c = <dynamic>[]}) → dynamic {}
static method test() → dynamic {
- invalid-expression "pkg/front_end/testcases/magic_const.dart:18:9: Error: Not a const constructor.
+ invalid-expression "pkg/front_end/testcases/magic_const.dart:18:9: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
const NotConstant();
^";
new self::Constant::•();
diff --git a/pkg/front_end/testcases/magic_const.dart.direct.transformed.expect b/pkg/front_end/testcases/magic_const.dart.direct.transformed.expect
index 31bfe5f..0e35d4e 100644
--- a/pkg/front_end/testcases/magic_const.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/magic_const.dart.direct.transformed.expect
@@ -14,7 +14,8 @@
}
static method foo({dynamic a = new self::Constant::•(), dynamic b = new self::Constant::•(), dynamic c = <dynamic>[]}) → dynamic {}
static method test() → dynamic {
- invalid-expression "pkg/front_end/testcases/magic_const.dart:18:9: Error: Not a const constructor.
+ invalid-expression "pkg/front_end/testcases/magic_const.dart:18:9: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
const NotConstant();
^";
new self::Constant::•();
diff --git a/pkg/front_end/testcases/magic_const.dart.strong.expect b/pkg/front_end/testcases/magic_const.dart.strong.expect
index d60f57e..990b71e 100644
--- a/pkg/front_end/testcases/magic_const.dart.strong.expect
+++ b/pkg/front_end/testcases/magic_const.dart.strong.expect
@@ -14,7 +14,8 @@
}
static method foo({dynamic a = new self::Constant::•(), dynamic b = new self::Constant::•(), dynamic c = <dynamic>[]}) → dynamic {}
static method test() → dynamic {
- invalid-expression "pkg/front_end/testcases/magic_const.dart:18:9: Error: Not a const constructor.
+ invalid-expression "pkg/front_end/testcases/magic_const.dart:18:9: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
const NotConstant();
^";
new self::Constant::•();
diff --git a/pkg/front_end/testcases/magic_const.dart.strong.transformed.expect b/pkg/front_end/testcases/magic_const.dart.strong.transformed.expect
index d60f57e..990b71e 100644
--- a/pkg/front_end/testcases/magic_const.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/magic_const.dart.strong.transformed.expect
@@ -14,7 +14,8 @@
}
static method foo({dynamic a = new self::Constant::•(), dynamic b = new self::Constant::•(), dynamic c = <dynamic>[]}) → dynamic {}
static method test() → dynamic {
- invalid-expression "pkg/front_end/testcases/magic_const.dart:18:9: Error: Not a const constructor.
+ invalid-expression "pkg/front_end/testcases/magic_const.dart:18:9: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
const NotConstant();
^";
new self::Constant::•();
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/setter_not_shadowed_by_method.dart.strong.expect b/pkg/front_end/testcases/no_such_method_forwarders/setter_not_shadowed_by_method.dart.strong.expect
index 081ba63..26812a7 100644
--- a/pkg/front_end/testcases/no_such_method_forwarders/setter_not_shadowed_by_method.dart.strong.expect
+++ b/pkg/front_end/testcases/no_such_method_forwarders/setter_not_shadowed_by_method.dart.strong.expect
@@ -1,3 +1,9 @@
+// Errors:
+//
+// pkg/front_end/testcases/no_such_method_forwarders/setter_not_shadowed_by_method.dart:10:8: Error: Can't declare a member that conflicts with an inherited one.
+// void foo(int x) {}
+// ^
+
library;
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/setter_not_shadowed_by_method.dart.strong.transformed.expect b/pkg/front_end/testcases/no_such_method_forwarders/setter_not_shadowed_by_method.dart.strong.transformed.expect
index 081ba63..26812a7 100644
--- a/pkg/front_end/testcases/no_such_method_forwarders/setter_not_shadowed_by_method.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/no_such_method_forwarders/setter_not_shadowed_by_method.dart.strong.transformed.expect
@@ -1,3 +1,9 @@
+// Errors:
+//
+// pkg/front_end/testcases/no_such_method_forwarders/setter_not_shadowed_by_method.dart:10:8: Error: Can't declare a member that conflicts with an inherited one.
+// void foo(int x) {}
+// ^
+
library;
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/rasta/super.dart.strong.expect b/pkg/front_end/testcases/rasta/super.dart.strong.expect
index 4d36a7b..d4f9d08 100644
--- a/pkg/front_end/testcases/rasta/super.dart.strong.expect
+++ b/pkg/front_end/testcases/rasta/super.dart.strong.expect
@@ -1,5 +1,9 @@
// Errors:
//
+// pkg/front_end/testcases/rasta/super.dart:26:8: Error: Can't declare a member that conflicts with an inherited one.
+// void n() {}
+// ^
+//
// pkg/front_end/testcases/rasta/super.dart:43:5: Error: '+' is not a prefix operator.
// Try removing '+'.
// +super;
diff --git a/pkg/front_end/testcases/redirecting_factory_const_inference.dart b/pkg/front_end/testcases/redirecting_factory_const_inference.dart
new file mode 100644
index 0000000..8d904fd
--- /dev/null
+++ b/pkg/front_end/testcases/redirecting_factory_const_inference.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that the type inference implementation correctly uses least
+// closure of the inferred type arguments in invocations of 'const' redirecting
+// factory constructors in case there are type variables in them.
+
+class _X<T> {
+ const factory _X() = _Y<T>;
+}
+
+class _Y<T> implements _X<T> {
+ const _Y();
+}
+
+class A<T> {
+ _X<T> x;
+ A(this.x);
+}
+
+class B<T> extends A<T> {
+ B() : super(const _X());
+}
+
+main() {
+ dynamic x = new B().x;
+ if (x is! _Y<Null>) {
+ throw "Unexpected run-time type: `new B().x` is ${x.runtimeType}, "
+ "but `_Y<Null>` expected";
+ }
+}
diff --git a/pkg/front_end/testcases/redirecting_factory_const_inference.dart.direct.expect b/pkg/front_end/testcases/redirecting_factory_const_inference.dart.direct.expect
new file mode 100644
index 0000000..5e1d683
--- /dev/null
+++ b/pkg/front_end/testcases/redirecting_factory_const_inference.dart.direct.expect
@@ -0,0 +1,31 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class _X<T extends core::Object = dynamic> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::_X::•];
+ static factory •<T extends core::Object = dynamic>() → self::_X<self::_X::•::T>
+ let dynamic #redirecting_factory = self::_Y::• in let self::_X::•::T #typeArg0 = null in invalid-expression;
+}
+class _Y<T extends core::Object = dynamic> extends core::Object implements self::_X<self::_Y::T> {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class A<T extends core::Object = dynamic> extends core::Object {
+ field self::_X<self::A::T> x;
+ constructor •(self::_X<self::A::T> x) → void
+ : self::A::x = x, super core::Object::•()
+ ;
+}
+class B<T extends core::Object = dynamic> extends self::A<self::B::T> {
+ constructor •() → void
+ : super self::A::•(const self::_Y::•<dynamic>())
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::B::•<dynamic>().x;
+ if(!(x is self::_Y<core::Null>)) {
+ throw "Unexpected run-time type: `new B().x` is ${x.runtimeType}, but `_Y<Null>` expected";
+ }
+}
diff --git a/pkg/front_end/testcases/redirecting_factory_const_inference.dart.direct.transformed.expect b/pkg/front_end/testcases/redirecting_factory_const_inference.dart.direct.transformed.expect
new file mode 100644
index 0000000..5e1d683
--- /dev/null
+++ b/pkg/front_end/testcases/redirecting_factory_const_inference.dart.direct.transformed.expect
@@ -0,0 +1,31 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class _X<T extends core::Object = dynamic> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::_X::•];
+ static factory •<T extends core::Object = dynamic>() → self::_X<self::_X::•::T>
+ let dynamic #redirecting_factory = self::_Y::• in let self::_X::•::T #typeArg0 = null in invalid-expression;
+}
+class _Y<T extends core::Object = dynamic> extends core::Object implements self::_X<self::_Y::T> {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class A<T extends core::Object = dynamic> extends core::Object {
+ field self::_X<self::A::T> x;
+ constructor •(self::_X<self::A::T> x) → void
+ : self::A::x = x, super core::Object::•()
+ ;
+}
+class B<T extends core::Object = dynamic> extends self::A<self::B::T> {
+ constructor •() → void
+ : super self::A::•(const self::_Y::•<dynamic>())
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::B::•<dynamic>().x;
+ if(!(x is self::_Y<core::Null>)) {
+ throw "Unexpected run-time type: `new B().x` is ${x.runtimeType}, but `_Y<Null>` expected";
+ }
+}
diff --git a/pkg/front_end/testcases/redirecting_factory_const_inference.dart.outline.expect b/pkg/front_end/testcases/redirecting_factory_const_inference.dart.outline.expect
new file mode 100644
index 0000000..1b16077
--- /dev/null
+++ b/pkg/front_end/testcases/redirecting_factory_const_inference.dart.outline.expect
@@ -0,0 +1,24 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class _X<T extends core::Object = dynamic> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::_X::•];
+ static factory •<T extends core::Object = dynamic>() → self::_X<self::_X::•::T>
+ let dynamic #redirecting_factory = self::_Y::• in let self::_X::•::T #typeArg0 = null in invalid-expression;
+}
+class _Y<T extends core::Object = dynamic> extends core::Object implements self::_X<self::_Y::T> {
+ const constructor •() → void
+ ;
+}
+class A<T extends core::Object = dynamic> extends core::Object {
+ field self::_X<self::A::T> x;
+ constructor •(self::_X<self::A::T> x) → void
+ ;
+}
+class B<T extends core::Object = dynamic> extends self::A<self::B::T> {
+ constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/redirecting_factory_const_inference.dart.strong.expect b/pkg/front_end/testcases/redirecting_factory_const_inference.dart.strong.expect
new file mode 100644
index 0000000..3e7197c
--- /dev/null
+++ b/pkg/front_end/testcases/redirecting_factory_const_inference.dart.strong.expect
@@ -0,0 +1,31 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class _X<T extends core::Object = dynamic> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::_X::•];
+ static factory •<T extends core::Object = dynamic>() → self::_X<self::_X::•::T>
+ let dynamic #redirecting_factory = self::_Y::• in let self::_X::•::T #typeArg0 = null in invalid-expression;
+}
+class _Y<T extends core::Object = dynamic> extends core::Object implements self::_X<self::_Y::T> {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class A<T extends core::Object = dynamic> extends core::Object {
+ generic-covariant-impl field self::_X<self::A::T> x;
+ constructor •(self::_X<self::A::T> x) → void
+ : self::A::x = x, super core::Object::•()
+ ;
+}
+class B<T extends core::Object = dynamic> extends self::A<self::B::T> {
+ constructor •() → void
+ : super self::A::•(const self::_Y::•<core::Null>())
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::B::•<dynamic>().{self::A::x};
+ if(!(x is self::_Y<core::Null>)) {
+ throw "Unexpected run-time type: `new B().x` is ${x.{core::Object::runtimeType}}, but `_Y<Null>` expected";
+ }
+}
diff --git a/pkg/front_end/testcases/redirecting_factory_const_inference.dart.strong.transformed.expect b/pkg/front_end/testcases/redirecting_factory_const_inference.dart.strong.transformed.expect
new file mode 100644
index 0000000..c825208
--- /dev/null
+++ b/pkg/front_end/testcases/redirecting_factory_const_inference.dart.strong.transformed.expect
@@ -0,0 +1,31 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class _X<T extends core::Object = dynamic> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::_X::•];
+ static factory •<T extends core::Object = dynamic>() → self::_X<self::_X::•::T>
+ let<BottomType> #redirecting_factory = self::_Y::• in let self::_X::•::T #typeArg0 = null in invalid-expression;
+}
+class _Y<T extends core::Object = dynamic> extends core::Object implements self::_X<self::_Y::T> {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class A<T extends core::Object = dynamic> extends core::Object {
+ generic-covariant-impl field self::_X<self::A::T> x;
+ constructor •(self::_X<self::A::T> x) → void
+ : self::A::x = x, super core::Object::•()
+ ;
+}
+class B<T extends core::Object = dynamic> extends self::A<self::B::T> {
+ constructor •() → void
+ : super self::A::•(const self::_Y::•<core::Null>())
+ ;
+}
+static method main() → dynamic {
+ dynamic x = new self::B::•<dynamic>().{self::A::x};
+ if(!(x is self::_Y<core::Null>)) {
+ throw "Unexpected run-time type: `new B().x` is ${x.{core::Object::runtimeType}}, but `_Y<Null>` expected";
+ }
+}
diff --git a/pkg/front_end/testcases/regress/issue_29976.dart.direct.expect b/pkg/front_end/testcases/regress/issue_29976.dart.direct.expect
index 7bb3ead..ad177b0 100644
--- a/pkg/front_end/testcases/regress/issue_29976.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_29976.dart.direct.expect
@@ -25,9 +25,9 @@
// )
// ^
//
-// pkg/front_end/testcases/regress/issue_29976.dart:9:1: Error: Expected ';' before this.
-// }
-// ^
+// pkg/front_end/testcases/regress/issue_29976.dart:8:3: Error: Expected ';' after this.
+// )
+// ^
library;
import self as self;
diff --git a/pkg/front_end/testcases/regress/issue_29976.dart.direct.transformed.expect b/pkg/front_end/testcases/regress/issue_29976.dart.direct.transformed.expect
index 7bb3ead..ad177b0 100644
--- a/pkg/front_end/testcases/regress/issue_29976.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_29976.dart.direct.transformed.expect
@@ -25,9 +25,9 @@
// )
// ^
//
-// pkg/front_end/testcases/regress/issue_29976.dart:9:1: Error: Expected ';' before this.
-// }
-// ^
+// pkg/front_end/testcases/regress/issue_29976.dart:8:3: Error: Expected ';' after this.
+// )
+// ^
library;
import self as self;
diff --git a/pkg/front_end/testcases/regress/issue_29976.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29976.dart.strong.expect
index 1e14bbe..125df90 100644
--- a/pkg/front_end/testcases/regress/issue_29976.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29976.dart.strong.expect
@@ -33,9 +33,9 @@
// f(
// ^
//
-// pkg/front_end/testcases/regress/issue_29976.dart:9:1: Error: Expected ';' before this.
-// }
-// ^
+// pkg/front_end/testcases/regress/issue_29976.dart:8:3: Error: Expected ';' after this.
+// )
+// ^
library;
import self as self;
diff --git a/pkg/front_end/testcases/regress/issue_29985.dart.direct.expect b/pkg/front_end/testcases/regress/issue_29985.dart.direct.expect
index 4ef9968..d87258e 100644
--- a/pkg/front_end/testcases/regress/issue_29985.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_29985.dart.direct.expect
@@ -5,9 +5,9 @@
// 🔛
// ^
//
-// pkg/front_end/testcases/regress/issue_29985.dart:7:1: Error: Expected ';' before this.
-// }
-// ^
+// pkg/front_end/testcases/regress/issue_29985.dart:6:3: Error: Expected ';' after this.
+// 🔛
+// ^^
library;
import self as self;
diff --git a/pkg/front_end/testcases/regress/issue_29985.dart.direct.transformed.expect b/pkg/front_end/testcases/regress/issue_29985.dart.direct.transformed.expect
index 4ef9968..d87258e 100644
--- a/pkg/front_end/testcases/regress/issue_29985.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_29985.dart.direct.transformed.expect
@@ -5,9 +5,9 @@
// 🔛
// ^
//
-// pkg/front_end/testcases/regress/issue_29985.dart:7:1: Error: Expected ';' before this.
-// }
-// ^
+// pkg/front_end/testcases/regress/issue_29985.dart:6:3: Error: Expected ';' after this.
+// 🔛
+// ^^
library;
import self as self;
diff --git a/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect
index 9eae89d..2ec7cc8 100644
--- a/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect
@@ -5,9 +5,9 @@
// 🔛
// ^
//
-// pkg/front_end/testcases/regress/issue_29985.dart:7:1: Error: Expected ';' before this.
-// }
-// ^
+// pkg/front_end/testcases/regress/issue_29985.dart:6:3: Error: Expected ';' after this.
+// 🔛
+// ^^
//
// pkg/front_end/testcases/regress/issue_29985.dart:6:3: Error: Getter not found: '🔛'.
// 🔛
diff --git a/pkg/front_end/testcases/regress/issue_29985.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/issue_29985.dart.strong.transformed.expect
index 9eae89d..2ec7cc8 100644
--- a/pkg/front_end/testcases/regress/issue_29985.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_29985.dart.strong.transformed.expect
@@ -5,9 +5,9 @@
// 🔛
// ^
//
-// pkg/front_end/testcases/regress/issue_29985.dart:7:1: Error: Expected ';' before this.
-// }
-// ^
+// pkg/front_end/testcases/regress/issue_29985.dart:6:3: Error: Expected ';' after this.
+// 🔛
+// ^^
//
// pkg/front_end/testcases/regress/issue_29985.dart:6:3: Error: Getter not found: '🔛'.
// 🔛
diff --git a/pkg/front_end/testcases/regress/issue_31155.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31155.dart.direct.expect
index 226845f..0f54478 100644
--- a/pkg/front_end/testcases/regress/issue_31155.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_31155.dart.direct.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:18: Error: Expected ';' after this.
// var f = Map<A, B> {};
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceeded by the keyword 'operator'.
// Try adding the keyword 'operator'.
diff --git a/pkg/front_end/testcases/regress/issue_31155.dart.direct.transformed.expect b/pkg/front_end/testcases/regress/issue_31155.dart.direct.transformed.expect
index 226845f..0f54478 100644
--- a/pkg/front_end/testcases/regress/issue_31155.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31155.dart.direct.transformed.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:18: Error: Expected ';' after this.
// var f = Map<A, B> {};
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceeded by the keyword 'operator'.
// Try adding the keyword 'operator'.
diff --git a/pkg/front_end/testcases/regress/issue_31155.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31155.dart.strong.expect
index f4bc906..f805c54 100644
--- a/pkg/front_end/testcases/regress/issue_31155.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31155.dart.strong.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:18: Error: Expected ';' after this.
// var f = Map<A, B> {};
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceeded by the keyword 'operator'.
// Try adding the keyword 'operator'.
diff --git a/pkg/front_end/testcases/regress/issue_31155.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/issue_31155.dart.strong.transformed.expect
index c20c97e..e7de89b 100644
--- a/pkg/front_end/testcases/regress/issue_31155.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31155.dart.strong.transformed.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31155.dart:11:18: Error: Expected ';' after this.
// var f = Map<A, B> {};
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31155.dart:11:19: Error: Operator declarations must be preceeded by the keyword 'operator'.
// Try adding the keyword 'operator'.
diff --git a/pkg/front_end/testcases/regress/issue_31171.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31171.dart.direct.expect
index fbeb2bc..49b38eb 100644
--- a/pkg/front_end/testcases/regress/issue_31171.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_31171.dart.direct.expect
@@ -4,7 +4,7 @@
// typedef F = Map<String, dynamic> Function();
// ^^^^^^^
//
-// pkg/front_end/testcases/regress/issue_31171.dart:8:1: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31171.dart:8:1: Error: Expected ';' after this.
// typedef F = Map<String, dynamic> Function();
// ^^^^^^^
//
diff --git a/pkg/front_end/testcases/regress/issue_31171.dart.direct.transformed.expect b/pkg/front_end/testcases/regress/issue_31171.dart.direct.transformed.expect
index fbeb2bc..49b38eb 100644
--- a/pkg/front_end/testcases/regress/issue_31171.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31171.dart.direct.transformed.expect
@@ -4,7 +4,7 @@
// typedef F = Map<String, dynamic> Function();
// ^^^^^^^
//
-// pkg/front_end/testcases/regress/issue_31171.dart:8:1: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31171.dart:8:1: Error: Expected ';' after this.
// typedef F = Map<String, dynamic> Function();
// ^^^^^^^
//
diff --git a/pkg/front_end/testcases/regress/issue_31171.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31171.dart.strong.expect
index fbeb2bc..49b38eb 100644
--- a/pkg/front_end/testcases/regress/issue_31171.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31171.dart.strong.expect
@@ -4,7 +4,7 @@
// typedef F = Map<String, dynamic> Function();
// ^^^^^^^
//
-// pkg/front_end/testcases/regress/issue_31171.dart:8:1: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31171.dart:8:1: Error: Expected ';' after this.
// typedef F = Map<String, dynamic> Function();
// ^^^^^^^
//
diff --git a/pkg/front_end/testcases/regress/issue_31171.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/issue_31171.dart.strong.transformed.expect
index fbeb2bc..49b38eb 100644
--- a/pkg/front_end/testcases/regress/issue_31171.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31171.dart.strong.transformed.expect
@@ -4,7 +4,7 @@
// typedef F = Map<String, dynamic> Function();
// ^^^^^^^
//
-// pkg/front_end/testcases/regress/issue_31171.dart:8:1: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31171.dart:8:1: Error: Expected ';' after this.
// typedef F = Map<String, dynamic> Function();
// ^^^^^^^
//
diff --git a/pkg/front_end/testcases/regress/issue_31184.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31184.dart.direct.expect
index 8d617e0..0e18d33 100644
--- a/pkg/front_end/testcases/regress/issue_31184.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_31184.dart.direct.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31184.dart:6:21: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31184.dart:6:19: Error: Expected ';' after this.
// for (int i = 0, i > 10; i++) {}
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31184.dart:6:21: Error: Expected an identifier, but got '>'.
// for (int i = 0, i > 10; i++) {}
diff --git a/pkg/front_end/testcases/regress/issue_31184.dart.direct.transformed.expect b/pkg/front_end/testcases/regress/issue_31184.dart.direct.transformed.expect
index 8d617e0..0e18d33 100644
--- a/pkg/front_end/testcases/regress/issue_31184.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31184.dart.direct.transformed.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31184.dart:6:21: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31184.dart:6:19: Error: Expected ';' after this.
// for (int i = 0, i > 10; i++) {}
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31184.dart:6:21: Error: Expected an identifier, but got '>'.
// for (int i = 0, i > 10; i++) {}
diff --git a/pkg/front_end/testcases/regress/issue_31184.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31184.dart.strong.expect
index 0485037..b3ffbf8 100644
--- a/pkg/front_end/testcases/regress/issue_31184.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31184.dart.strong.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31184.dart:6:21: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31184.dart:6:19: Error: Expected ';' after this.
// for (int i = 0, i > 10; i++) {}
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31184.dart:6:21: Error: Expected an identifier, but got '>'.
// for (int i = 0, i > 10; i++) {}
diff --git a/pkg/front_end/testcases/regress/issue_31185.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31185.dart.direct.expect
index 3b34000..d3a912f 100644
--- a/pkg/front_end/testcases/regress/issue_31185.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_31185.dart.direct.expect
@@ -1,12 +1,12 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31185.dart:8:15: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31185.dart:8:12: Error: Expected ';' after this.
// return i ++ (i);
-// ^
+// ^^
//
-// pkg/front_end/testcases/regress/issue_31185.dart:12:17: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31185.dart:12:14: Error: Expected ';' after this.
// return (i) ++ (i);
-// ^
+// ^^
library;
import self as self;
diff --git a/pkg/front_end/testcases/regress/issue_31185.dart.direct.transformed.expect b/pkg/front_end/testcases/regress/issue_31185.dart.direct.transformed.expect
index 3b34000..d3a912f 100644
--- a/pkg/front_end/testcases/regress/issue_31185.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31185.dart.direct.transformed.expect
@@ -1,12 +1,12 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31185.dart:8:15: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31185.dart:8:12: Error: Expected ';' after this.
// return i ++ (i);
-// ^
+// ^^
//
-// pkg/front_end/testcases/regress/issue_31185.dart:12:17: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31185.dart:12:14: Error: Expected ';' after this.
// return (i) ++ (i);
-// ^
+// ^^
library;
import self as self;
diff --git a/pkg/front_end/testcases/regress/issue_31185.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31185.dart.strong.expect
index 96522f4..f26aee4 100644
--- a/pkg/front_end/testcases/regress/issue_31185.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31185.dart.strong.expect
@@ -1,12 +1,12 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31185.dart:8:15: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31185.dart:8:12: Error: Expected ';' after this.
// return i ++ (i);
-// ^
+// ^^
//
-// pkg/front_end/testcases/regress/issue_31185.dart:12:17: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31185.dart:12:14: Error: Expected ';' after this.
// return (i) ++ (i);
-// ^
+// ^^
library;
import self as self;
diff --git a/pkg/front_end/testcases/regress/issue_31185.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/issue_31185.dart.strong.transformed.expect
index a48a597..1e08909 100644
--- a/pkg/front_end/testcases/regress/issue_31185.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31185.dart.strong.transformed.expect
@@ -1,12 +1,12 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31185.dart:8:15: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31185.dart:8:12: Error: Expected ';' after this.
// return i ++ (i);
-// ^
+// ^^
//
-// pkg/front_end/testcases/regress/issue_31185.dart:12:17: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31185.dart:12:14: Error: Expected ';' after this.
// return (i) ++ (i);
-// ^
+// ^^
library;
import self as self;
diff --git a/pkg/front_end/testcases/regress/issue_31188.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31188.dart.direct.expect
index 404127d..eb3888b 100644
--- a/pkg/front_end/testcases/regress/issue_31188.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_31188.dart.direct.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31188.dart:7:18: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31188.dart:7:17: Error: Expected ';' after this.
// type T = Map<A, B>
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31188.dart:7:18: Error: Expected a declaration, but got '>'.
// type T = Map<A, B>
diff --git a/pkg/front_end/testcases/regress/issue_31188.dart.direct.transformed.expect b/pkg/front_end/testcases/regress/issue_31188.dart.direct.transformed.expect
index 404127d..eb3888b 100644
--- a/pkg/front_end/testcases/regress/issue_31188.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31188.dart.direct.transformed.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31188.dart:7:18: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31188.dart:7:17: Error: Expected ';' after this.
// type T = Map<A, B>
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31188.dart:7:18: Error: Expected a declaration, but got '>'.
// type T = Map<A, B>
diff --git a/pkg/front_end/testcases/regress/issue_31188.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31188.dart.strong.expect
index 51447393..c9a4233 100644
--- a/pkg/front_end/testcases/regress/issue_31188.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31188.dart.strong.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31188.dart:7:18: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31188.dart:7:17: Error: Expected ';' after this.
// type T = Map<A, B>
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31188.dart:7:18: Error: Expected a declaration, but got '>'.
// type T = Map<A, B>
diff --git a/pkg/front_end/testcases/regress/issue_31188.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/issue_31188.dart.strong.transformed.expect
index c128307..b9f1830 100644
--- a/pkg/front_end/testcases/regress/issue_31188.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31188.dart.strong.transformed.expect
@@ -1,8 +1,8 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31188.dart:7:18: Error: Expected ';' before this.
+// pkg/front_end/testcases/regress/issue_31188.dart:7:17: Error: Expected ';' after this.
// type T = Map<A, B>
-// ^
+// ^
//
// pkg/front_end/testcases/regress/issue_31188.dart:7:18: Error: Expected a declaration, but got '>'.
// type T = Map<A, B>
diff --git a/pkg/front_end/testcases/regress/issue_31299.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31299.dart.direct.expect
index 2af900e..30d4403 100644
--- a/pkg/front_end/testcases/regress/issue_31299.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_31299.dart.direct.expect
@@ -1,13 +1,3 @@
-// Errors:
-//
-// pkg/front_end/testcases/regress/issue_31299.dart:10:3: Error: Conflicts with member 'foo'.
-// A.foo() : m = 2;
-// ^
-//
-// pkg/front_end/testcases/regress/issue_31299.dart:11:7: Error: Conflicts with constructor 'A.foo'.
-// int foo(int a, int b) => a + b * m;
-// ^
-
library;
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_31299.dart.direct.transformed.expect b/pkg/front_end/testcases/regress/issue_31299.dart.direct.transformed.expect
index 2af900e..30d4403 100644
--- a/pkg/front_end/testcases/regress/issue_31299.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31299.dart.direct.transformed.expect
@@ -1,13 +1,3 @@
-// Errors:
-//
-// pkg/front_end/testcases/regress/issue_31299.dart:10:3: Error: Conflicts with member 'foo'.
-// A.foo() : m = 2;
-// ^
-//
-// pkg/front_end/testcases/regress/issue_31299.dart:11:7: Error: Conflicts with constructor 'A.foo'.
-// int foo(int a, int b) => a + b * m;
-// ^
-
library;
import self as self;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/regress/issue_31299.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31299.dart.strong.expect
index 8a7471d..33b03d6 100644
--- a/pkg/front_end/testcases/regress/issue_31299.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31299.dart.strong.expect
@@ -1,13 +1,5 @@
// Errors:
//
-// pkg/front_end/testcases/regress/issue_31299.dart:10:3: Error: Conflicts with member 'foo'.
-// A.foo() : m = 2;
-// ^
-//
-// pkg/front_end/testcases/regress/issue_31299.dart:11:7: Error: Conflicts with constructor 'A.foo'.
-// int foo(int a, int b) => a + b * m;
-// ^
-//
// pkg/front_end/testcases/regress/issue_31299.dart:18:7: Error: Too many positional arguments: 0 allowed, 2 given.
// new A.foo(1, 2);
// ^
diff --git a/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart
new file mode 100644
index 0000000..cdf7460
--- /dev/null
+++ b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart
@@ -0,0 +1,10 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that generic function types are rejected with an appropriate
+// compile-time error message if encountered in bounds of type variables.
+
+class Hest<TypeX extends TypeY Function<TypeY>(TypeY)> {}
+
+main() {}
diff --git a/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.direct.expect b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.direct.expect
new file mode 100644
index 0000000..8abcc85
--- /dev/null
+++ b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.direct.expect
@@ -0,0 +1,10 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Hest<TypeX extends <TypeY extends core::Object = dynamic>(TypeY) → TypeY = dynamic> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.direct.transformed.expect b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.direct.transformed.expect
new file mode 100644
index 0000000..8abcc85
--- /dev/null
+++ b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.direct.transformed.expect
@@ -0,0 +1,10 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Hest<TypeX extends <TypeY extends core::Object = dynamic>(TypeY) → TypeY = dynamic> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.outline.expect b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.outline.expect
new file mode 100644
index 0000000..1149d7f
--- /dev/null
+++ b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.outline.expect
@@ -0,0 +1,10 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Hest<TypeX extends <TypeY extends core::Object = dynamic>(TypeY) → TypeY = dynamic> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.strong.expect b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.strong.expect
new file mode 100644
index 0000000..8bd0c4b
--- /dev/null
+++ b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.strong.expect
@@ -0,0 +1,16 @@
+// Errors:
+//
+// pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart:8:12: Error: Type variables can't have generic function types in their bounds.
+// class Hest<TypeX extends TypeY Function<TypeY>(TypeY)> {}
+// ^^^^^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class Hest<TypeX extends <TypeY extends core::Object = dynamic>(TypeY) → TypeY = dynamic> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.strong.transformed.expect b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.strong.transformed.expect
new file mode 100644
index 0000000..8bd0c4b
--- /dev/null
+++ b/pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart.strong.transformed.expect
@@ -0,0 +1,16 @@
+// Errors:
+//
+// pkg/front_end/testcases/reject_generic_function_types_in_bounds.dart:8:12: Error: Type variables can't have generic function types in their bounds.
+// class Hest<TypeX extends TypeY Function<TypeY>(TypeY)> {}
+// ^^^^^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class Hest<TypeX extends <TypeY extends core::Object = dynamic>(TypeY) → TypeY = dynamic> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.expect
index 3234a21..36ff607b 100644
--- a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.expect
@@ -30,9 +30,9 @@
synthetic constructor •() → void
: super self::B::•()
;
- forwarding-stub method f([generic-covariant-impl core::num x]) → void
+ forwarding-stub method f([generic-covariant-impl core::num x = 10]) → void
return super.{self::B::f}(x);
- forwarding-stub method g({generic-covariant-impl core::num x}) → void
+ forwarding-stub method g({generic-covariant-impl core::num x = 20}) → void
return super.{self::B::g}(x: x);
}
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.transformed.expect
index 3234a21..36ff607b 100644
--- a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.transformed.expect
@@ -30,9 +30,9 @@
synthetic constructor •() → void
: super self::B::•()
;
- forwarding-stub method f([generic-covariant-impl core::num x]) → void
+ forwarding-stub method f([generic-covariant-impl core::num x = 10]) → void
return super.{self::B::f}(x);
- forwarding-stub method g({generic-covariant-impl core::num x}) → void
+ forwarding-stub method g({generic-covariant-impl core::num x = 20}) → void
return super.{self::B::g}(x: x);
}
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index 4c3a11f..b5d4f7b 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -201,7 +201,6 @@
regress/issue_31299: TypeCheckError
regress/issue_33452: RuntimeError # Test has an intentional error
-runtime_checks/forwarding_stub_with_default_values: RuntimeError # Bug 31027
runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast: RuntimeError
runtime_checks_new/mixin_forwarding_stub_field: TypeCheckError
runtime_checks_new/mixin_forwarding_stub_getter: TypeCheckError
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index 5332ba5..9813833 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -1943,6 +1943,7 @@
var annotation = annotations[i];
annotation.parent = node;
}
+ node.annotations = annotations;
}
return node;
}
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index b59903b..06207a7 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -823,7 +823,7 @@
writeOffset(node.fileEndOffset);
writeByte(node.kind.index);
writeByte(node.flags);
- writeName(node.name ?? '');
+ writeName(node.name ?? _emptyName);
writeAnnotationList(node.annotations);
writeOptionalReference(node.forwardingStubSuperTargetReference);
writeOptionalReference(node.forwardingStubInterfaceTargetReference);
diff --git a/pkg/kernel/lib/verifier.dart b/pkg/kernel/lib/verifier.dart
index 4239b87..3d8e362 100644
--- a/pkg/kernel/lib/verifier.dart
+++ b/pkg/kernel/lib/verifier.dart
@@ -27,7 +27,7 @@
// TODO(ahe): Fix the compiler instead.
}
if (location != null) {
- String file = location.file ?? "";
+ String file = location.file?.toString() ?? "";
return "$file:${location.line}:${location.column}: Verification error:"
" $details";
} else {
diff --git a/pkg/kernel/test/class_hierarchy_basic.dart b/pkg/kernel/test/class_hierarchy_basic.dart
index 1f69a0e..6179cb0 100644
--- a/pkg/kernel/test/class_hierarchy_basic.dart
+++ b/pkg/kernel/test/class_hierarchy_basic.dart
@@ -4,12 +4,13 @@
library kernel.class_hierarchy_basic;
+import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/type_algebra.dart';
import 'package:kernel/ast.dart';
/// A simple implementation of the class hierarchy interface using
/// hash tables for everything.
-class BasicClassHierarchy {
+class BasicClassHierarchy implements ClassHierarchy {
final Map<Class, Set<Class>> superclasses = <Class, Set<Class>>{};
final Map<Class, Set<Class>> superMixtures = <Class, Set<Class>>{};
final Map<Class, Set<Class>> supertypes = <Class, Set<Class>>{};
@@ -215,7 +216,7 @@
return setter ? setters[class_][name] : gettersAndCalls[class_][name];
}
- Iterable<Member> getDispatchTargets(Class class_, {bool setters: false}) {
+ List<Member> getDispatchTargets(Class class_, {bool setters: false}) {
return setters
? this.setters[class_].values
: gettersAndCalls[class_].values;
@@ -237,7 +238,7 @@
return iterable == null ? const <Member>[] : iterable;
}
- Iterable<Member> getInterfaceMembers(Class class_, {bool setters: false}) {
+ List<Member> getInterfaceMembers(Class class_, {bool setters: false}) {
return setters
? interfaceSetters[class_].values.expand((x) => x)
: interfaceGettersAndCalls[class_].values.expand((x) => x);
diff --git a/pkg/meta/CHANGELOG.md b/pkg/meta/CHANGELOG.md
index ed639d0..dd92cbe 100644
--- a/pkg/meta/CHANGELOG.md
+++ b/pkg/meta/CHANGELOG.md
@@ -1,5 +1,7 @@
## 1.1.5
+* Set max SDK version to <3.0.0.
+
* Introduce @isTest and @isTestGroup to declare a function that is a
test, or a test group.
diff --git a/pkg/meta/pubspec.yaml b/pkg/meta/pubspec.yaml
index 73e1dfd..e908e08 100644
--- a/pkg/meta/pubspec.yaml
+++ b/pkg/meta/pubspec.yaml
@@ -1,5 +1,5 @@
name: meta
-version: 1.1.5
+version: 1.1.6
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/meta
description: >
@@ -7,4 +7,4 @@
semantic information about the program being annotated. These annotations are
intended to be used by tools to provide a better user experience.
environment:
- sdk: '>=1.12.0 <2.0.0'
+ sdk: '>=1.12.0 <3.0.0'
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 66c275c..e2a1a1a 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -26,13 +26,10 @@
analyzer_plugin/test/plugin/folding_mixin_test: Slow, Pass
analyzer_plugin/tool/spec/check_all_test: Skip # Issue 29133
dart_messages/test/dart_messages_test: Skip # Requires a package root.
-dev_compiler/gen/*: SkipByDesign # Skip dev_compiler codegen tests
-dev_compiler/test/codegen/*: Skip # Skip dev_compiler codegen tests
-dev_compiler/test/codegen_test: Skip # Skip dev_compiler codegen tests
-dev_compiler/test/options/*: Skip # Skip dev_compiler codegen tests
-dev_compiler/test/sourcemap/*: SkipByDesign # Skip dev_compiler codegen tests
+dev_compiler/test/options/*: Skip # test needs fixes
+dev_compiler/test/sourcemap/*: SkipByDesign # Skip sourcemap tests
dev_compiler/test/sourcemap/testfiles/*: SkipByDesign # Skip dev_compiler codegen tests
-dev_compiler/test/worker/*: Skip # Skip dev_compiler codegen tests
+dev_compiler/test/worker/*: Skip # test needs fixes
front_end/test/fasta/analyze_test: Pass, Slow
front_end/test/fasta/ast_builder_test: Pass, Slow
front_end/test/fasta/bootstrap_test: Pass, Slow
@@ -181,8 +178,7 @@
analysis_server/test/domain_completion_test: Fail
analysis_server/test/edit/fixes_test: Fail
analysis_server/test/integration/analysis/package_root_test: Pass, RuntimeError # Issue 33382
-analysis_server/test/services/completion/dart/keyword_contributor_test: Fail
-analysis_server/test/services/completion/dart/override_contributor_test: Fail
+analysis_server/test/services/completion/dart/keyword_contributor_test: Pass, Slow
analysis_server/test/services/completion/statement/statement_completion_test: Fail
analysis_server/test/services/correction/fix_test: Fail, Timeout
analysis_server/test/services/refactoring/extract_local_test: Fail
diff --git a/pkg/vm/bin/kernel_service.dart b/pkg/vm/bin/kernel_service.dart
index 4d383d5..90dd842 100644
--- a/pkg/vm/bin/kernel_service.dart
+++ b/pkg/vm/bin/kernel_service.dart
@@ -38,7 +38,8 @@
import 'package:kernel/kernel.dart' show Component, Procedure;
import 'package:kernel/target/targets.dart' show TargetFlags;
import 'package:kernel/target/vm.dart' show VmTarget;
-import 'package:vm/incremental_compiler.dart';
+import '../lib/incremental_compiler.dart';
+import '../lib/http_filesystem.dart';
final bool verbose = new bool.fromEnvironment('DFE_VERBOSE');
const String platformKernelFile = 'virtual_platform_kernel.dill';
@@ -305,18 +306,20 @@
int isolateId, Component component, String packageConfig) {
final dependencies = isolateDependencies[isolateId] ??= new List<Uri>();
- for (var lib in component.libraries) {
- if (lib.importUri.scheme == "dart") continue;
+ if (component != null) {
+ for (var lib in component.libraries) {
+ if (lib.importUri.scheme == "dart") continue;
- dependencies.add(lib.fileUri);
- for (var part in lib.parts) {
- final fileUri = lib.fileUri.resolve(part.partUri);
- if (fileUri.scheme != "" && fileUri.scheme != "file") {
- // E.g. part 'package:foo/foo.dart';
- // Maybe the front end should resolve this?
- continue;
+ dependencies.add(lib.fileUri);
+ for (var part in lib.parts) {
+ final fileUri = lib.fileUri.resolve(part.partUri);
+ if (fileUri.scheme != "" && fileUri.scheme != "file") {
+ // E.g. part 'package:foo/foo.dart';
+ // Maybe the front end should resolve this?
+ continue;
+ }
+ dependencies.add(fileUri);
}
- dependencies.add(fileUri);
}
}
@@ -447,7 +450,7 @@
FileSystem fileSystem = _buildFileSystem(
sourceFiles, platformKernel, multirootFilepaths, multirootScheme);
compiler = new SingleShotCompilerWrapper(fileSystem, platformKernelPath,
- requireMain: sourceFiles.isEmpty,
+ requireMain: false,
strongMode: strong,
suppressWarnings: suppressWarnings,
syncAsync: syncAsync,
@@ -461,12 +464,17 @@
}
Component component = await compiler.compile(script);
- _recordDependencies(isolateId, component, packageConfig);
if (compiler.errors.isNotEmpty) {
- result = new CompilationResult.errors(compiler.errors,
- serializeComponent(component, filter: (lib) => !lib.isExternal));
+ if (component != null) {
+ result = new CompilationResult.errors(compiler.errors,
+ serializeComponent(component, filter: (lib) => !lib.isExternal));
+ } else {
+ result = new CompilationResult.errors(compiler.errors, null);
+ }
} else {
+ // Record dependencies only if compilation was error free.
+ _recordDependencies(isolateId, component, packageConfig);
// We serialize the component excluding vm_platform.dill because the VM has
// these sources built-in. Everything loaded as a summary in
// [kernelForProgram] is marked `external`, so we can use that bit to
@@ -507,11 +515,9 @@
/// frontend.
FileSystem _buildFileSystem(List sourceFiles, List<int> platformKernel,
String multirootFilepaths, String multirootScheme) {
- FileSystem fileSystem;
+ FileSystem fileSystem = new HttpAwareFileSystem(StandardFileSystem.instance);
- if (sourceFiles.isEmpty && platformKernel == null) {
- fileSystem = StandardFileSystem.instance;
- } else {
+ if (!sourceFiles.isEmpty || platformKernel != null) {
MemoryFileSystem memoryFileSystem =
new MemoryFileSystem(Uri.parse('file:///'));
if (sourceFiles != null) {
@@ -526,7 +532,7 @@
.entityForUri(Uri.parse(platformKernelFile))
.writeAsBytesSync(platformKernel);
}
- fileSystem = new HybridFileSystem(memoryFileSystem);
+ fileSystem = new HybridFileSystem(memoryFileSystem, fileSystem);
}
if (multirootFilepaths != null) {
diff --git a/pkg/vm/lib/http_filesystem.dart b/pkg/vm/lib/http_filesystem.dart
new file mode 100644
index 0000000..ed036cd
--- /dev/null
+++ b/pkg/vm/lib/http_filesystem.dart
@@ -0,0 +1,67 @@
+import 'dart:async';
+import 'dart:io' as io;
+
+import 'package:front_end/src/api_unstable/build_integration.dart';
+
+class HttpAwareFileSystem implements FileSystem {
+ FileSystem original;
+
+ HttpAwareFileSystem(this.original);
+
+ @override
+ FileSystemEntity entityForUri(Uri uri) {
+ if (uri.scheme == 'http' || uri.scheme == 'https') {
+ return new HttpFileSystemEntity(this, uri);
+ } else {
+ return original.entityForUri(uri);
+ }
+ }
+}
+
+class HttpFileSystemEntity implements FileSystemEntity {
+ HttpAwareFileSystem fileSystem;
+ Uri uri;
+
+ HttpFileSystemEntity(this.fileSystem, this.uri);
+
+ @override
+ Future<bool> exists() async {
+ return connectAndRun((io.HttpClient httpClient) async {
+ io.HttpClientRequest request = await httpClient.headUrl(uri);
+ io.HttpClientResponse response = await request.close();
+ return response.statusCode == io.HttpStatus.ok;
+ });
+ }
+
+ @override
+ Future<List<int>> readAsBytes() async {
+ return connectAndRun((io.HttpClient httpClient) async {
+ io.HttpClientRequest request = await httpClient.getUrl(uri);
+ io.HttpClientResponse response = await request.close();
+ if (response.statusCode != io.HttpStatus.ok) {
+ throw new FileSystemException(uri, response.toString());
+ }
+ List<List<int>> list = await response.toList();
+ return list.expand((list) => list).toList();
+ });
+ }
+
+ @override
+ Future<String> readAsString() async {
+ return String.fromCharCodes(await readAsBytes());
+ }
+
+ T connectAndRun<T>(T body(io.HttpClient httpClient)) {
+ io.HttpClient httpClient;
+ try {
+ httpClient = new io.HttpClient();
+ // Set timeout to be shorter than anticipated OS default
+ httpClient.connectionTimeout = const Duration(seconds: 5);
+ return body(httpClient);
+ } on Exception catch (e) {
+ throw new FileSystemException(uri, e.toString());
+ } finally {
+ httpClient?.close(force: true);
+ }
+ }
+}
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index 27506b0..5cd4241 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -682,18 +682,18 @@
template("bin_to_assembly") {
assert(defined(invoker.deps), "Must define deps")
assert(defined(invoker.input), "Must define input binary file")
- assert(defined(invoker.output), "Must define output assembly file")
assert(defined(invoker.symbol), "Must define symbol name")
assert(defined(invoker.executable), "Must define boolean executable")
action(target_name) {
deps = invoker.deps
script = "../tools/bin_to_assembly.py"
+ output = invoker.input + ".S"
args = [
"--input",
rebase_path(invoker.input),
"--output",
- rebase_path(invoker.output),
+ rebase_path(output),
"--symbol_name",
invoker.symbol,
"--target_os",
@@ -711,114 +711,162 @@
args += [ "--executable" ]
}
inputs = [
- script,
invoker.input,
]
outputs = [
- invoker.output,
+ output,
]
}
}
-bin_to_assembly("vm_snapshot_data_assembly") {
+# Generates an object file defining a given symbol with the bytes from a
+# binary file. Places the symbol in the read-only data section.
+template("bin_to_coff") {
+ assert(defined(invoker.deps), "Must define deps")
+ assert(defined(invoker.input), "Must define input binary file")
+ assert(defined(invoker.symbol), "Must define symbol name")
+ assert(defined(invoker.executable), "Must define executable")
+
+ action(target_name) {
+ deps = invoker.deps
+ script = "../tools/bin_to_coff.py"
+ output = invoker.input + ".o"
+ args = [
+ "--input",
+ rebase_path(invoker.input),
+ "--output",
+ rebase_path(output),
+ "--symbol_name",
+ invoker.symbol,
+ ]
+
+ if (defined(invoker.size_symbol)) {
+ args += [
+ "--size_symbol_name",
+ invoker.size_symbol,
+ ]
+ }
+
+ if (invoker.executable) {
+ args += [ "--executable" ]
+ }
+
+ if (current_cpu == "x64") {
+ args += [ "--64-bit" ]
+ }
+ inputs = [
+ invoker.input,
+ ]
+ outputs = [
+ output,
+ ]
+ }
+}
+
+template("bin_to_linkable") {
+ assert(defined(invoker.deps), "Must define deps")
+ assert(defined(invoker.input), "Must define input binary file")
+ assert(defined(invoker.symbol), "Must define symbol name")
+ target_type = "bin_to_assembly"
+ if (is_win) {
+ target_type = "bin_to_coff"
+ }
+
+ target(target_type, target_name) {
+ forward_variables_from(invoker, "*")
+ }
+}
+
+bin_to_linkable("vm_snapshot_data_linkable") {
deps = [
":generate_snapshot_bin",
]
input = "$target_gen_dir/vm_snapshot_data.bin"
- output = "$target_gen_dir/vm_snapshot_data.S"
symbol = "kDartVmSnapshotData"
executable = false
}
-bin_to_assembly("vm_snapshot_instructions_assembly") {
+bin_to_linkable("vm_snapshot_instructions_linkable") {
deps = [
":generate_snapshot_bin",
]
input = "$target_gen_dir/vm_snapshot_instructions.bin"
- output = "$target_gen_dir/vm_snapshot_instructions.S"
symbol = "kDartVmSnapshotInstructions"
executable = true
}
-bin_to_assembly("isolate_snapshot_data_assembly") {
+bin_to_linkable("isolate_snapshot_data_linkable") {
deps = [
":generate_snapshot_bin",
]
input = "$target_gen_dir/isolate_snapshot_data.bin"
- output = "$target_gen_dir/isolate_snapshot_data.S"
symbol = "kDartCoreIsolateSnapshotData"
executable = false
}
-bin_to_assembly("isolate_snapshot_instructions_assembly") {
+bin_to_linkable("isolate_snapshot_instructions_linkable") {
deps = [
":generate_snapshot_bin",
]
input = "$target_gen_dir/isolate_snapshot_instructions.bin"
- output = "$target_gen_dir/isolate_snapshot_instructions.S"
symbol = "kDartCoreIsolateSnapshotInstructions"
executable = true
}
-bin_to_assembly("kernel_service_dill_S") {
+bin_to_linkable("kernel_service_dill_linkable") {
deps = [
"../../utils/kernel-service:kernel_service_dill",
]
input = "$root_gen_dir/kernel_service.dill"
- output = "$root_gen_dir/kernel_service.dill.S"
symbol = "kKernelServiceDill"
size_symbol = "kKernelServiceDillSize"
executable = false
}
-bin_to_assembly("platform_dill_S") {
+bin_to_linkable("platform_dill_linkable") {
deps = [
"../vm:vm_legacy_platform",
]
input = "$root_out_dir/vm_platform.dill"
- output = "$target_gen_dir/vm_platform.dill.S"
symbol = "kPlatformDill"
size_symbol = "kPlatformDillSize"
executable = false
}
-bin_to_assembly("platform_strong_dill_S") {
+bin_to_linkable("platform_strong_dill_linkable") {
deps = [
"../vm:vm_platform",
]
input = "$root_out_dir/vm_platform_strong.dill"
- output = "$target_gen_dir/vm_platform_strong.dill.S"
symbol = "kPlatformStrongDill"
size_symbol = "kPlatformStrongDillSize"
executable = false
}
source_set("dart_snapshot_cc") {
+ visibility = [ ":*" ]
deps = [
- ":isolate_snapshot_data_assembly",
- ":isolate_snapshot_instructions_assembly",
- ":vm_snapshot_data_assembly",
- ":vm_snapshot_instructions_assembly",
+ ":isolate_snapshot_data_linkable",
+ ":isolate_snapshot_instructions_linkable",
+ ":vm_snapshot_data_linkable",
+ ":vm_snapshot_instructions_linkable",
]
- sources = [
- "$target_gen_dir/isolate_snapshot_data.S",
- "$target_gen_dir/isolate_snapshot_instructions.S",
- "$target_gen_dir/vm_snapshot_data.S",
- "$target_gen_dir/vm_snapshot_instructions.S",
- ]
+ sources = get_target_outputs(":isolate_snapshot_data_linkable") +
+ get_target_outputs(":isolate_snapshot_instructions_linkable") +
+ get_target_outputs(":vm_snapshot_data_linkable") +
+ get_target_outputs(":vm_snapshot_instructions_linkable")
}
source_set("dart_kernel_platform_cc") {
+ visibility = [ ":*" ]
deps = [
- ":kernel_service_dill_S",
- ":platform_dill_S",
- ":platform_strong_dill_S",
+ ":kernel_service_dill_linkable",
+ ":platform_dill_linkable",
+ ":platform_strong_dill_linkable",
]
- sources = [
- "$root_gen_dir/kernel_service.dill.S",
- "$target_gen_dir/vm_platform.dill.S",
- "$target_gen_dir/vm_platform_strong.dill.S",
- ]
+ sources = get_target_outputs(":kernel_service_dill_linkable") +
+ get_target_outputs(":platform_dill_linkable") +
+ get_target_outputs(":platform_strong_dill_linkable")
}
template("dart_executable") {
@@ -881,6 +929,7 @@
}
sources = [
+ "dart_embedder_api_impl.cc",
"error_exit.cc",
"error_exit.h",
"main.cc",
diff --git a/runtime/bin/dart_embedder_api_impl.cc b/runtime/bin/dart_embedder_api_impl.cc
new file mode 100644
index 0000000..645a7bb
--- /dev/null
+++ b/runtime/bin/dart_embedder_api_impl.cc
@@ -0,0 +1,106 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "include/dart_embedder_api.h"
+
+#include "bin/dartutils.h"
+#include "bin/eventhandler.h"
+#include "bin/isolate_data.h"
+#include "bin/thread.h"
+#include "bin/utils.h"
+#include "bin/vmservice_impl.h"
+
+namespace dart {
+namespace embedder {
+
+static char* MallocFormatedString(const char* format, ...) {
+ va_list args;
+ va_start(args, format);
+ intptr_t len = vsnprintf(NULL, 0, format, args);
+ va_end(args);
+
+ char* buffer = reinterpret_cast<char*>(malloc(len + 1));
+ MSAN_UNPOISON(buffer, (len + 1));
+ va_list args2;
+ va_start(args2, format);
+ vsnprintf(buffer, (len + 1), format, args2);
+ va_end(args2);
+ return buffer;
+}
+
+bool InitOnce(char** error) {
+ if (!bin::DartUtils::SetOriginalWorkingDirectory()) {
+ bin::OSError err;
+ *error = MallocFormatedString("Error determining current directory: %s\n",
+ err.message());
+ return false;
+ }
+ bin::Thread::InitOnce();
+ bin::TimerUtils::InitOnce();
+ bin::EventHandler::Start();
+ return true;
+}
+
+Dart_Isolate CreateKernelServiceIsolate(const IsolateCreationData& data,
+ const uint8_t* buffer,
+ intptr_t buffer_size,
+ char** error) {
+ Dart_Isolate kernel_isolate = Dart_CreateIsolateFromKernel(
+ data.script_uri, data.main, buffer, buffer_size, data.flags,
+ data.callback_data, error);
+ if (kernel_isolate == nullptr) {
+ return nullptr;
+ }
+
+ Dart_EnterScope();
+ Dart_Handle result = Dart_LoadScriptFromKernel(buffer, buffer_size);
+ if (Dart_IsError(result)) {
+ *error = strdup(Dart_GetError(result));
+ Dart_ExitScope();
+ Dart_ShutdownIsolate();
+ return nullptr;
+ }
+ result = bin::DartUtils::PrepareForScriptLoading(/*is_service_isolate=*/false,
+ /*trace_loading=*/false);
+ Dart_ExitScope();
+ Dart_ExitIsolate();
+ return kernel_isolate;
+}
+
+Dart_Isolate CreateVmServiceIsolate(const IsolateCreationData& data,
+ const VmServiceConfiguration& config,
+ const uint8_t* kernel_buffer,
+ intptr_t kernel_buffer_size,
+ char** error) {
+ if (data.flags == nullptr) {
+ *error = strdup("Expected non-null flags");
+ return nullptr;
+ }
+ data.flags->load_vmservice_library = true;
+
+ Dart_Isolate service_isolate = Dart_CreateIsolateFromKernel(
+ data.script_uri, data.main, kernel_buffer, kernel_buffer_size, data.flags,
+ data.callback_data, error);
+ if (service_isolate == nullptr) {
+ return nullptr;
+ }
+
+ Dart_EnterScope();
+ // Load embedder specific bits and return.
+ if (!bin::VmService::Setup(config.ip, config.port,
+ /*running_precompiled=*/true, config.dev_mode,
+ /*trace_loading=*/false, config.deterministic)) {
+ *error = strdup(bin::VmService::GetErrorMessage());
+ Dart_ExitScope();
+ Dart_ShutdownIsolate();
+ return nullptr;
+ }
+
+ Dart_ExitScope();
+ Dart_ExitIsolate();
+ return service_isolate;
+}
+
+} // namespace embedder
+} // namespace dart
diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
index e7c7886..6bba557 100644
--- a/runtime/bin/dartutils.cc
+++ b/runtime/bin/dartutils.cc
@@ -385,18 +385,16 @@
}
Dart_Handle DartUtils::SetWorkingDirectory() {
- IsolateData* isolate_data =
- reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
- Dart_Handle builtin_lib = isolate_data->builtin_lib();
Dart_Handle directory = NewString(original_working_directory);
- return SingleArgDart_Invoke(builtin_lib, "_setWorkingDirectory", directory);
+ return SingleArgDart_Invoke(LookupBuiltinLib(), "_setWorkingDirectory",
+ directory);
}
Dart_Handle DartUtils::ResolveUriInWorkingDirectory(Dart_Handle script_uri) {
const int kNumArgs = 1;
Dart_Handle dart_args[kNumArgs];
dart_args[0] = script_uri;
- return Dart_Invoke(DartUtils::BuiltinLib(),
+ return Dart_Invoke(DartUtils::LookupBuiltinLib(),
NewString("_resolveInWorkingDirectory"), kNumArgs,
dart_args);
}
@@ -405,16 +403,16 @@
const int kNumArgs = 1;
Dart_Handle dart_args[kNumArgs];
dart_args[0] = library_uri;
- return Dart_Invoke(DartUtils::BuiltinLib(), NewString("_libraryFilePath"),
- kNumArgs, dart_args);
+ return Dart_Invoke(DartUtils::LookupBuiltinLib(),
+ NewString("_libraryFilePath"), kNumArgs, dart_args);
}
Dart_Handle DartUtils::ResolveScript(Dart_Handle url) {
const int kNumArgs = 1;
Dart_Handle dart_args[kNumArgs];
dart_args[0] = url;
- return Dart_Invoke(DartUtils::BuiltinLib(), NewString("_resolveScriptUri"),
- kNumArgs, dart_args);
+ return Dart_Invoke(DartUtils::LookupBuiltinLib(),
+ NewString("_resolveScriptUri"), kNumArgs, dart_args);
}
static bool CheckMagicNumber(const uint8_t* buffer,
@@ -569,16 +567,16 @@
const int kNumArgs = 1;
Dart_Handle dart_args[kNumArgs];
dart_args[0] = result;
- result = Dart_Invoke(DartUtils::BuiltinLib(), NewString("_setPackageRoot"),
- kNumArgs, dart_args);
+ result = Dart_Invoke(DartUtils::LookupBuiltinLib(),
+ NewString("_setPackageRoot"), kNumArgs, dart_args);
} else if (packages_config != NULL) {
result = NewString(packages_config);
RETURN_IF_ERROR(result);
const int kNumArgs = 1;
Dart_Handle dart_args[kNumArgs];
dart_args[0] = result;
- result = Dart_Invoke(DartUtils::BuiltinLib(), NewString("_setPackagesMap"),
- kNumArgs, dart_args);
+ result = Dart_Invoke(DartUtils::LookupBuiltinLib(),
+ NewString("_setPackagesMap"), kNumArgs, dart_args);
}
return result;
}
@@ -613,13 +611,6 @@
RETURN_IF_ERROR(cli_lib);
Builtin::SetNativeResolver(Builtin::kCLILibrary);
- // Setup the builtin library in a persistent handle attached the isolate
- // specific data as we seem to lookup and use builtin lib a lot.
- IsolateData* isolate_data =
- reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
- ASSERT(isolate_data != NULL);
- isolate_data->set_builtin_lib(builtin_lib);
-
// We need to ensure that all the scripts loaded so far are finalized
// as we are about to invoke some Dart code below to setup closures.
Dart_Handle result = Dart_FinalizeLoading(false);
diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h
index 661ec7f..68cd47f 100644
--- a/runtime/bin/dartutils.h
+++ b/runtime/bin/dartutils.h
@@ -204,10 +204,8 @@
static Dart_Handle NewError(const char* format, ...);
static Dart_Handle NewInternalError(const char* message);
- static Dart_Handle BuiltinLib() {
- IsolateData* isolate_data =
- reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
- return isolate_data->builtin_lib();
+ static Dart_Handle LookupBuiltinLib() {
+ return Dart_LookupLibrary(NewString(kBuiltinLibURL));
}
static bool SetOriginalWorkingDirectory();
diff --git a/runtime/bin/dfe.cc b/runtime/bin/dfe.cc
index 5f1721d..6c0dafb 100644
--- a/runtime/bin/dfe.cc
+++ b/runtime/bin/dfe.cc
@@ -81,6 +81,7 @@
DFE::DFE()
: use_dfe_(false),
+ use_incremental_compiler_(false),
frontend_filename_(NULL),
application_kernel_buffer_(NULL),
application_kernel_buffer_size_(0) {}
@@ -218,8 +219,8 @@
int* exit_code,
bool strong,
const char* package_config) {
- Dart_KernelCompilationResult result =
- CompileScript(script_uri, strong, true, package_config);
+ Dart_KernelCompilationResult result = CompileScript(
+ script_uri, strong, use_incremental_compiler(), package_config);
switch (result.status) {
case Dart_KernelCompilationStatus_Ok:
*kernel_buffer = result.kernel;
diff --git a/runtime/bin/dfe.h b/runtime/bin/dfe.h
index 6efb45c..433550f 100644
--- a/runtime/bin/dfe.h
+++ b/runtime/bin/dfe.h
@@ -34,6 +34,11 @@
void set_use_dfe(bool value = true) { use_dfe_ = value; }
bool UseDartFrontend() const { return use_dfe_; }
+ void set_use_incremental_compiler(bool value) {
+ use_incremental_compiler_ = value;
+ }
+ bool use_incremental_compiler() const { return use_incremental_compiler_; }
+
// Returns the platform binary file name if the path to
// kernel binaries was set using SetKernelBinaries.
const char* GetPlatformBinaryFilename();
@@ -100,6 +105,7 @@
private:
bool use_dfe_;
+ bool use_incremental_compiler_;
char* frontend_filename_;
// Kernel binary specified on the cmd line.
diff --git a/runtime/bin/file_test.cc b/runtime/bin/file_test.cc
index 548f7b4..967eec8 100644
--- a/runtime/bin/file_test.cc
+++ b/runtime/bin/file_test.cc
@@ -2,18 +2,19 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+#include "bin/dartutils.h"
+#include "bin/directory.h"
#include "bin/file.h"
#include "platform/assert.h"
#include "platform/globals.h"
#include "vm/unit_test.h"
namespace dart {
-namespace bin {
// Helper method to be able to run the test from the runtime
// directory, or the top directory.
static const char* GetFileName(const char* name) {
- if (File::Exists(NULL, name)) {
+ if (bin::File::Exists(NULL, name)) {
return name;
} else {
static const int kRuntimeLength = strlen("runtime/");
@@ -23,7 +24,7 @@
TEST_CASE(Read) {
const char* kFilename = GetFileName("runtime/bin/file_test.cc");
- File* file = File::Open(NULL, kFilename, File::kRead);
+ bin::File* file = bin::File::Open(NULL, kFilename, bin::File::kRead);
EXPECT(file != NULL);
char buffer[16];
buffer[0] = '\0';
@@ -34,9 +35,10 @@
file->Release();
}
-TEST_CASE(OpenUri) {
+TEST_CASE(OpenUri_RelativeFilename) {
const char* kFilename = GetFileName("runtime/bin/file_test.cc");
- char* encoded = reinterpret_cast<char*>(malloc(strlen(kFilename) * 3 + 1));
+ char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
+ strlen(kFilename) * 3 + 1));
char* t = encoded;
// percent-encode all characters 'c'
for (const char* p = kFilename; *p; p++) {
@@ -49,8 +51,7 @@
}
}
*t = 0;
- File* file = File::OpenUri(NULL, encoded, File::kRead);
- free(encoded);
+ bin::File* file = bin::File::OpenUri(NULL, encoded, bin::File::kRead);
EXPECT(file != NULL);
char buffer[16];
buffer[0] = '\0';
@@ -61,9 +62,122 @@
file->Release();
}
+TEST_CASE(OpenUri_AbsoluteFilename) {
+ const char* kRelativeFilename = GetFileName("runtime/bin/file_test.cc");
+ const char* kFilename = bin::File::GetCanonicalPath(NULL, kRelativeFilename);
+ EXPECT_NOTNULL(kFilename);
+ char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
+ strlen(kFilename) * 3 + 1));
+ char* t = encoded;
+ // percent-encode all characters 'c'
+ for (const char* p = kFilename; *p; p++) {
+ if (*p == 'c') {
+ *t++ = '%';
+ *t++ = '6';
+ *t++ = '3';
+ } else {
+ *t++ = *p;
+ }
+ }
+ *t = 0;
+ bin::File* file = bin::File::OpenUri(NULL, encoded, bin::File::kRead);
+ EXPECT(file != NULL);
+ char buffer[16];
+ buffer[0] = '\0';
+ EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true.
+ buffer[13] = '\0';
+ EXPECT_STREQ("// Copyright ", buffer);
+ EXPECT(!file->WriteByte(1)); // Cannot write to a read-only file.
+ file->Release();
+}
+
+static const char* Concat(const char* a, const char* b) {
+ const intptr_t len = strlen(a) + strlen(b);
+ char* c = bin::DartUtils::ScopedCString(len + 1);
+ EXPECT_NOTNULL(c);
+ snprintf(c, len + 1, "%s%s", a, b);
+ return c;
+}
+
+TEST_CASE(OpenUri_ValidUri) {
+ const char* kRelativeFilename = GetFileName("runtime/bin/file_test.cc");
+ const char* kAbsoluteFilename = bin::File::GetCanonicalPath(NULL,
+ kRelativeFilename);
+ EXPECT_NOTNULL(kAbsoluteFilename);
+ const char* kFilename = Concat("file:///", kAbsoluteFilename);
+
+ char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
+ strlen(kFilename) * 3 + 1));
+ char* t = encoded;
+ // percent-encode all characters 'c'
+ for (const char* p = kFilename; *p; p++) {
+ if (*p == 'c') {
+ *t++ = '%';
+ *t++ = '6';
+ *t++ = '3';
+ } else {
+ *t++ = *p;
+ }
+ }
+ *t = 0;
+ bin::File* file = bin::File::OpenUri(NULL, encoded, bin::File::kRead);
+ EXPECT(file != NULL);
+ char buffer[16];
+ buffer[0] = '\0';
+ EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true.
+ buffer[13] = '\0';
+ EXPECT_STREQ("// Copyright ", buffer);
+ EXPECT(!file->WriteByte(1)); // Cannot write to a read-only file.
+ file->Release();
+}
+
+TEST_CASE(OpenUri_UriWithSpaces) {
+ const char* kRelativeFilename = GetFileName("runtime/bin/file_test.cc");
+ const char* strSystemTemp = bin::Directory::SystemTemp(NULL);
+ EXPECT_NOTNULL(strSystemTemp);
+ const char* kTempDir = Concat(strSystemTemp, "/foo bar");
+ const char* strTempDir = bin::Directory::CreateTemp(NULL, kTempDir);
+ EXPECT_NOTNULL(strTempDir);
+ const char* kTargetFilename = Concat(strTempDir, "/file test.cc");
+ bool result = bin::File::Copy(NULL, kRelativeFilename, kTargetFilename);
+ EXPECT(result);
+
+ const char* kAbsoluteFilename = bin::File::GetCanonicalPath(NULL,
+ kTargetFilename);
+ EXPECT_NOTNULL(kAbsoluteFilename);
+ const char* kFilename = Concat("file:///", kAbsoluteFilename);
+
+ char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
+ strlen(kFilename) * 3 + 1));
+ char* t = encoded;
+ // percent-encode all spaces
+ for (const char* p = kFilename; *p; p++) {
+ if (*p == ' ') {
+ *t++ = '%';
+ *t++ = '2';
+ *t++ = '0';
+ } else {
+ *t++ = *p;
+ }
+ }
+ *t = 0;
+ printf("encoded: %s\n", encoded);
+ bin::File* file = bin::File::OpenUri(NULL, encoded, bin::File::kRead);
+ EXPECT(file != NULL);
+ char buffer[16];
+ buffer[0] = '\0';
+ EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true.
+ buffer[13] = '\0';
+ EXPECT_STREQ("// Copyright ", buffer);
+ EXPECT(!file->WriteByte(1)); // Cannot write to a read-only file.
+ file->Release();
+ bin::Directory::Delete(NULL, strTempDir, /* recursive= */ true);
+}
+
TEST_CASE(OpenUri_InvalidUriPercentEncoding) {
const char* kFilename = GetFileName("runtime/bin/file_test.cc");
- char* encoded = reinterpret_cast<char*>(malloc(strlen(kFilename) * 3 + 1));
+ char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
+ strlen(kFilename) * 3 + 1));
char* t = encoded;
// percent-encode all characters 'c'
for (const char* p = kFilename; *p; p++) {
@@ -76,14 +190,14 @@
}
}
*t = 0;
- File* file = File::OpenUri(NULL, encoded, File::kRead);
- free(encoded);
+ bin::File* file = bin::File::OpenUri(NULL, encoded, bin::File::kRead);
EXPECT(file == NULL);
}
TEST_CASE(OpenUri_TruncatedUriPercentEncoding) {
const char* kFilename = GetFileName("runtime/bin/file_test.cc");
- char* encoded = reinterpret_cast<char*>(malloc(strlen(kFilename) * 3 + 1));
+ char* encoded = reinterpret_cast<char*>(bin::DartUtils::ScopedCString(
+ strlen(kFilename) * 3 + 1));
char* t = encoded;
// percent-encode all characters 'c'
for (const char* p = kFilename; *p; p++) {
@@ -96,15 +210,14 @@
}
}
*(t - 1) = 0; // truncate last uri encoding
- File* file = File::OpenUri(NULL, encoded, File::kRead);
- free(encoded);
+ bin::File* file = bin::File::OpenUri(NULL, encoded, bin::File::kRead);
EXPECT(file == NULL);
}
TEST_CASE(FileLength) {
const char* kFilename =
GetFileName("runtime/tests/vm/data/fixed_length_file");
- File* file = File::Open(NULL, kFilename, File::kRead);
+ bin::File* file = bin::File::Open(NULL, kFilename, bin::File::kRead);
EXPECT(file != NULL);
EXPECT_EQ(42, file->Length());
file->Release();
@@ -114,7 +227,7 @@
char buf[42];
const char* kFilename =
GetFileName("runtime/tests/vm/data/fixed_length_file");
- File* file = File::Open(NULL, kFilename, File::kRead);
+ bin::File* file = bin::File::Open(NULL, kFilename, bin::File::kRead);
EXPECT(file != NULL);
EXPECT(file->ReadFully(buf, 12));
EXPECT_EQ(12, file->Position());
@@ -123,5 +236,4 @@
file->Release();
}
-} // namespace bin
} // namespace dart
diff --git a/runtime/bin/isolate_data.cc b/runtime/bin/isolate_data.cc
index c7f1779..dfd440c 100644
--- a/runtime/bin/isolate_data.cc
+++ b/runtime/bin/isolate_data.cc
@@ -15,7 +15,6 @@
: script_url((url != NULL) ? strdup(url) : NULL),
package_root(NULL),
packages_file(NULL),
- builtin_lib_(NULL),
loader_(NULL),
app_snapshot_(app_snapshot),
dependencies_(NULL),
@@ -32,10 +31,6 @@
}
void IsolateData::OnIsolateShutdown() {
- if (builtin_lib_ != NULL) {
- Dart_DeletePersistentHandle(builtin_lib_);
- builtin_lib_ = NULL;
- }
}
IsolateData::~IsolateData() {
diff --git a/runtime/bin/isolate_data.h b/runtime/bin/isolate_data.h
index 575d1b0..ceab601 100644
--- a/runtime/bin/isolate_data.h
+++ b/runtime/bin/isolate_data.h
@@ -36,18 +36,6 @@
AppSnapshot* app_snapshot);
~IsolateData();
- Dart_Handle builtin_lib() const {
- ASSERT(builtin_lib_ != NULL);
- ASSERT(!Dart_IsError(builtin_lib_));
- return builtin_lib_;
- }
- void set_builtin_lib(Dart_Handle lib) {
- ASSERT(builtin_lib_ == NULL);
- ASSERT(lib != NULL);
- ASSERT(!Dart_IsError(lib));
- builtin_lib_ = Dart_NewPersistentHandle(lib);
- }
-
char* script_url;
char* package_root;
char* packages_file;
@@ -99,7 +87,6 @@
void OnIsolateShutdown();
private:
- Dart_Handle builtin_lib_;
Loader* loader_;
AppSnapshot* app_snapshot_;
MallocGrowableArray<char*>* dependencies_;
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 38b59c3..51bbe73 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -7,6 +7,7 @@
#include <string.h>
#include "include/dart_api.h"
+#include "include/dart_embedder_api.h"
#include "include/dart_tools_api.h"
#include "bin/builtin.h"
@@ -267,11 +268,6 @@
Dart_EnterScope();
Dart_Handle library = Dart_LoadScriptFromKernel(payload, payload_length);
CHECK_RESULT(library);
- Dart_Handle url = DartUtils::NewString("dart:_builtin");
- CHECK_RESULT(url);
- Dart_Handle builtin_lib = Dart_LookupLibrary(url);
- CHECK_RESULT(builtin_lib);
- isolate_data->set_builtin_lib(builtin_lib);
Dart_ExitScope();
Dart_ExitIsolate();
@@ -1018,7 +1014,7 @@
Dart_Handle root_lib = Dart_RootLibrary();
// Import the root library into the builtin library so that we can easily
// lookup the main entry point exported from the root library.
- result = Dart_LibraryImportLibrary(isolate_data->builtin_lib(), root_lib,
+ result = Dart_LibraryImportLibrary(DartUtils::LookupBuiltinLib(), root_lib,
Dart_Null());
#if !defined(DART_PRECOMPILED_RUNTIME)
if (Options::gen_snapshot_kind() == kAppAOT) {
@@ -1222,8 +1218,6 @@
}
}
- Thread::InitOnce();
-
Loader::InitOnce();
if (!DartUtils::SetOriginalWorkingDirectory()) {
@@ -1284,7 +1278,14 @@
Process::SetExitHook(SnapshotOnExitHook);
}
- char* error = Dart_SetVMFlags(vm_options.count(), vm_options.arguments());
+ char* error = nullptr;
+ if (!dart::embedder::InitOnce(&error)) {
+ Log::PrintErr("Stanalone embedder initialization failed: %s\n", error);
+ free(error);
+ Platform::Exit(kErrorExitCode);
+ }
+
+ error = Dart_SetVMFlags(vm_options.count(), vm_options.arguments());
if (error != NULL) {
Log::PrintErr("Setting VM flags failed: %s\n", error);
free(error);
@@ -1309,10 +1310,6 @@
}
#endif
- // Start event handler.
- TimerUtils::InitOnce();
- EventHandler::Start();
-
// Initialize the Dart VM.
Dart_InitializeParams init_params;
memset(&init_params, 0, sizeof(init_params));
diff --git a/runtime/bin/main_options.cc b/runtime/bin/main_options.cc
index cf88c86..ae4d441 100644
--- a/runtime/bin/main_options.cc
+++ b/runtime/bin/main_options.cc
@@ -296,6 +296,9 @@
"Use --enable-vm-service[=<port number>[/<bind address>]]\n");
return false;
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ dfe()->set_use_incremental_compiler(true);
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
return true;
}
@@ -320,6 +323,9 @@
vm_options->AddArgument("--pause-isolates-on-unhandled-exceptions");
vm_options->AddArgument("--profiler");
vm_options->AddArgument("--warn-on-pause-with-no-debugger");
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ dfe()->set_use_incremental_compiler(true);
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
return true;
}
diff --git a/runtime/bin/vmservice_impl.cc b/runtime/bin/vmservice_impl.cc
index 74f96e6..f512dfb 100644
--- a/runtime/bin/vmservice_impl.cc
+++ b/runtime/bin/vmservice_impl.cc
@@ -41,7 +41,7 @@
int length_;
};
-#if defined(DART_PRECOMPILED_RUNTIME)
+#if defined(DART_PRECOMPILED_RUNTIME) || defined(DART_DART2_ONLY_MODE)
ResourcesEntry __service_bin_resources_[] = {{NULL, NULL, 0}};
#else
extern ResourcesEntry __service_bin_resources_[];
@@ -185,7 +185,8 @@
// Prepare builtin and its dependent libraries for use to resolve URIs.
// Set up various closures, e.g: printing, timers etc.
// Set up 'package root' for URI resolution.
- result = DartUtils::PrepareForScriptLoading(true, false);
+ result = DartUtils::PrepareForScriptLoading(/*is_service_isolate=*/true,
+ trace_loading);
SHUTDOWN_ON_ERROR(result);
if (running_precompiled) {
@@ -261,12 +262,6 @@
Dart_SetField(library, DartUtils::NewString("_isFuchsia"), is_fuchsia);
SHUTDOWN_ON_ERROR(result);
- if (trace_loading) {
- result = Dart_SetField(library, DartUtils::NewString("_traceLoading"),
- Dart_True());
- SHUTDOWN_ON_ERROR(result);
- }
-
if (deterministic) {
result = Dart_SetField(library, DartUtils::NewString("_deterministic"),
Dart_True());
diff --git a/runtime/include/dart_embedder_api.h b/runtime/include/dart_embedder_api.h
new file mode 100644
index 0000000..eda9059
--- /dev/null
+++ b/runtime/include/dart_embedder_api.h
@@ -0,0 +1,80 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef RUNTIME_INCLUDE_DART_EMBEDDER_API_H_
+#define RUNTIME_INCLUDE_DART_EMBEDDER_API_H_
+
+#include "dart_api.h"
+#include "dart_tools_api.h"
+
+namespace dart {
+namespace embedder {
+
+// Initialize all subsystems of the embedder.
+// Returns true on success and false otherwise, in which case error would
+// contain error message.
+DART_WARN_UNUSED_RESULT bool InitOnce(char** error);
+
+// Common arguments that are passed to isolate creation callback and to
+// API methods that create isolates.
+struct IsolateCreationData {
+ // URI for the main script that will be running in the isolate.
+ const char* script_uri;
+
+ // Advisory name of the main method that will be run by isolate.
+ // Only used for error messages.
+ const char* main;
+
+ // Isolate creation flags. Might be absent.
+ Dart_IsolateFlags* flags;
+
+ // Isolate callback data.
+ void* callback_data;
+};
+
+// Create and initialize kernel-service isolate. This method should be used
+// when VM invokes isolate creation callback with DART_KERNEL_ISOLATE_NAME as
+// script_uri.
+// The isolate is created from the given snapshot (might be kernel data or
+// app-jit snapshot).
+DART_WARN_UNUSED_RESULT Dart_Isolate
+CreateKernelServiceIsolate(const IsolateCreationData& data,
+ const uint8_t* buffer,
+ intptr_t buffer_size,
+ char** error);
+
+// Service isolate configuration.
+struct VmServiceConfiguration {
+ enum {
+ kBindHttpServerToAFreePort = 0,
+ kDoNotAutoStartHttpServer = -1
+ };
+
+ // Address to which HTTP server will be bound.
+ const char* ip;
+
+ // Default port. See enum above for special values.
+ int port;
+
+ // TODO(vegorov) document these ones.
+ bool dev_mode;
+ bool deterministic;
+};
+
+// Create and initialize vm-service isolate. This method should be used
+// when VM invokes isolate creation callback with DART_VM_SERVICE_ISOLATE_NAME
+// as script_uri.
+// The isolate is created from the given kernel binary that is expected to
+// contain all necessary vmservice libraries.
+DART_WARN_UNUSED_RESULT Dart_Isolate
+CreateVmServiceIsolate(const IsolateCreationData& data,
+ const VmServiceConfiguration& config,
+ const uint8_t* kernel_buffer,
+ intptr_t kernel_buffer_size,
+ char** error);
+
+} // namespace embedder
+} // namespace dart
+
+#endif // RUNTIME_INCLUDE_DART_EMBEDDER_API_H_
diff --git a/runtime/include/dart_native_api.h b/runtime/include/dart_native_api.h
index eea02fd..b401d37 100644
--- a/runtime/include/dart_native_api.h
+++ b/runtime/include/dart_native_api.h
@@ -27,6 +27,12 @@
* kTypedData. The specific type from dart:typed_data is in the type
* field of the as_typed_data structure. The length in the
* as_typed_data structure is always in bytes.
+ *
+ * The data for kTypedData is copied on message send and ownership remains with
+ * the caller. The ownership of data for kExternalTyped is passed to the VM on
+ * message send and returned when the VM invokes the
+ * Dart_WeakPersistentHandleFinalizer callback; a non-NULL callback must be
+ * provided.
*/
typedef enum {
Dart_CObject_kNull = 0,
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 352a2ec..e4ead66 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -774,6 +774,8 @@
ThrowLanguageError("no library handler registered");
}
+ NoReloadScope no_reload(isolate, thread);
+
// Canonicalize library URI.
String& canonical_uri = String::Handle(zone);
if (uri.StartsWith(Symbols::DartScheme())) {
diff --git a/runtime/lib/typed_data_patch.dart b/runtime/lib/typed_data_patch.dart
index 29ab7b7..c8aea53 100644
--- a/runtime/lib/typed_data_patch.dart
+++ b/runtime/lib/typed_data_patch.dart
@@ -114,11 +114,7 @@
List<int> _createList(int length);
- // TODO(leafp): Restore this functionality once generic methods are enabled
- // in the VM and dart2js.
- // https://github.com/dart-lang/sdk/issues/32463
- Iterable<T> whereType<T>() =>
- throw new UnimplementedError("whereType is not yet supported");
+ Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
Iterable<int> followedBy(Iterable<int> other) =>
new FollowedByIterable<int>.firstEfficient(this, other);
@@ -471,11 +467,7 @@
List<double> _createList(int length);
- // TODO(leafp): Restore this functionality once generic methods are enabled
- // in the VM and dart2js.
- // https://github.com/dart-lang/sdk/issues/32463
- Iterable<T> whereType<T>() =>
- throw new UnimplementedError("whereType is not yet supported");
+ Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
Iterable<double> followedBy(Iterable<double> other) =>
new FollowedByIterable<double>.firstEfficient(this, other);
@@ -831,11 +823,7 @@
List<Float32x4> _createList(int length);
- // TODO(leafp): Restore this functionality once generic methods are enabled
- // in the VM and dart2js.
- // https://github.com/dart-lang/sdk/issues/32463
- Iterable<T> whereType<T>() =>
- throw new UnimplementedError("whereType is not yet supported");
+ Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
Iterable<Float32x4> followedBy(Iterable<Float32x4> other) =>
new FollowedByIterable<Float32x4>.firstEfficient(this, other);
@@ -1195,11 +1183,7 @@
List<Int32x4> _createList(int length);
- // TODO(leafp): Restore this functionality once generic methods are enabled
- // in the VM and dart2js.
- // https://github.com/dart-lang/sdk/issues/32463
- Iterable<T> whereType<T>() =>
- throw new UnimplementedError("whereType is not yet supported");
+ Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
Iterable<Int32x4> followedBy(Iterable<Int32x4> other) =>
new FollowedByIterable<Int32x4>.firstEfficient(this, other);
@@ -1558,11 +1542,7 @@
List<Float64x2> _createList(int length);
- // TODO(leafp): Restore this functionality once generic methods are enabled
- // in the VM and dart2js.
- // https://github.com/dart-lang/sdk/issues/32463
- Iterable<T> whereType<T>() =>
- throw new UnimplementedError("whereType is not yet supported");
+ Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
Iterable<Float64x2> followedBy(Iterable<Float64x2> other) =>
new FollowedByIterable<Float64x2>.firstEfficient(this, other);
diff --git a/runtime/lib/vmservice.cc b/runtime/lib/vmservice.cc
index d5092c7..76d5fc9 100644
--- a/runtime/lib/vmservice.cc
+++ b/runtime/lib/vmservice.cc
@@ -21,7 +21,6 @@
namespace dart {
DECLARE_FLAG(bool, trace_service);
-DECLARE_FLAG(bool, show_kernel_isolate);
#ifndef PRODUCT
class RegisterRunningIsolatesVisitor : public IsolateVisitor {
@@ -47,12 +46,7 @@
virtual void VisitIsolate(Isolate* isolate) {
ASSERT(ServiceIsolate::IsServiceIsolate(Isolate::Current()));
- bool is_kernel_isolate = false;
-#ifndef DART_PRECOMPILED_RUNTIME
- is_kernel_isolate =
- KernelIsolate::IsKernelIsolate(isolate) && !FLAG_show_kernel_isolate;
-#endif
- if (IsVMInternalIsolate(isolate) || is_kernel_isolate) {
+ if (IsVMInternalIsolate(isolate)) {
// We do not register the service (and descendants), the vm-isolate, or
// the kernel isolate.
return;
diff --git a/runtime/observatory/BUILD.gn b/runtime/observatory/BUILD.gn
index f9d1fee..4c1c2e0 100644
--- a/runtime/observatory/BUILD.gn
+++ b/runtime/observatory/BUILD.gn
@@ -2,10 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("../../build/dart/copy_tree.gni")
import("../../build/dart/dart_action.gni")
import("observatory_sources.gni")
prebuilt_dart2js_action("build_observatory") {
+ visibility = [ ":copy_main_dart_js" ]
+
script = "web/main.dart"
# dart2js produces a .deps file, but it is not in a format that is understood
@@ -38,32 +41,139 @@
]
}
-# TODO(zra): Investigate using GN's copy() with set_sources_assignment_filter
-# instead of using a python script.
-action("deploy_observatory") {
+# The rules here down to "deploy_observatory" copy files into place such that
+# they can be packaged into a tar file. These rules do the following copies:
+#
+# web/* ->
+# $target_out_dir/observatory/deployed/web
+# $target_gen_dir/observatory/web/main.dart.js ->
+# $target_out_dir/observatory/deployed/web/main.dart.js
+# ../../third_party/observatory_pub_packages/packages/$PACKAGE/lib/* ->
+# $target_out_dir/observatory/deployed/web/packages/$PACKAGE
+# lib/* ->
+# $target_out_dir/observatory/deployed/web/packages/observatory
+#
+# Files matching "observatory_ignore_patterns" are excluded.
+
+# Files matching these patterns are filtered out of the Observatory assets.
+observatory_ignore_patterns = [
+ # "\$sdk", this is the first element concatenated into the string below.
+ "*.concat.js",
+ "*.dart",
+ "*.log",
+ "*.map",
+ "*.precompiled.js",
+ "*.scriptUrls",
+ "*_buildLogs*",
+ "*~",
+ "CustomElements.*",
+ "HTMLImports.*",
+ "MutationObserver.*",
+ "ShadowDOM.*",
+ "bower.json",
+ "dart_support.*",
+ "interop_support.*",
+ "package.json",
+ "unittest*",
+ "webcomponents-lite.js",
+ "webcomponents.*",
+]
+
+# The ignore_patterns entry in the scopes accepted by copy_trees() is a
+# string of comma delimited patterns.
+observatory_ignore_string = "\$sdk"
+foreach(pattern, observatory_ignore_patterns) {
+ observatory_ignore_string = "$observatory_ignore_string,$pattern"
+}
+
+copy_tree_specs = []
+
+copy_tree_specs += [
+ {
+ target = "copy_web_package"
+ visibility = [ ":deploy_observatory" ]
+ source = "web"
+ dest = "$target_out_dir/observatory/deployed/web"
+ ignore_patterns = observatory_ignore_string
+ },
+]
+
+copy_tree_specs += [
+ {
+ target = "copy_observatory_package"
+ visibility = [ ":deploy_observatory" ]
+ source = "lib"
+ dest = "$target_out_dir/observatory/deployed/web/packages/observatory"
+ ignore_patterns = observatory_ignore_string
+ },
+]
+
+# All the contents of third_party/observatory_pub_packages should be
+# accounted for here. Uncommented entries are those packages that have
+# files that pass the observatory_ignore_patterns filters.
+observatory_pub_packages = [
+ "browser",
+ "charted",
+ "intl",
+
+ # Dependent packages that have no files that pass the above filter.
+ # "collection",
+ # "logging",
+ # "matcher",
+ # "meta",
+ # "observable",
+ # "path",
+ # "quiver",
+ # "stack_trace",
+ # "usage",
+
+ # Only needed for testing.
+ # "unittest",
+]
+
+foreach(package, observatory_pub_packages) {
+ copy_tree_specs += [
+ {
+ target = "copy_${package}_package"
+ visibility = [ ":deploy_observatory" ]
+ source =
+ "../../third_party/observatory_pub_packages/packages/$package/lib"
+ dest = "$target_out_dir/observatory/deployed/web/packages/$package"
+ ignore_patterns = observatory_ignore_string
+ },
+ ]
+}
+
+# This is not a rule, rather, it generates rules with names of the form:
+# "copy_$package_package" for the packages in observatory_pub_packages.
+copy_trees("copy_observatory_packages") {
+ sources = copy_tree_specs
+}
+
+copy("copy_main_dart_js") {
+ visibility = [ ":deploy_observatory" ]
deps = [
":build_observatory",
]
-
- script = "../../tools/observatory_tool.py"
-
- inputs = [
+ sources = [
"$target_gen_dir/observatory/web/main.dart.js",
]
-
- args = [
- rebase_path("$target_out_dir/observatory/deployed"),
- rebase_path("web"),
- rebase_path("lib"),
- rebase_path("$target_gen_dir/observatory/web/main.dart.js"),
- rebase_path("../../third_party/observatory_pub_packages/packages"),
- ]
-
outputs = [
"$target_out_dir/observatory/deployed/web/main.dart.js",
]
}
+group("deploy_observatory") {
+ deps = [
+ ":copy_browser_package",
+ ":copy_charted_package",
+ ":copy_intl_package",
+ ":copy_main_dart_js",
+ ":copy_observatory_package",
+ ":copy_web_package",
+ ]
+}
+
template("observatory_archive") {
enable_compression = false
if (defined(invoker.compress) && invoker.compress) {
@@ -74,10 +184,6 @@
":deploy_observatory",
]
- inputs = [
- "$target_out_dir/observatory/deployed/web/main.dart.js",
- ]
-
output_name = target_name
output = "$target_gen_dir/${output_name}.tar"
diff --git a/runtime/observatory/.analysis_options b/runtime/observatory/analysis_options.yaml
similarity index 100%
rename from runtime/observatory/.analysis_options
rename to runtime/observatory/analysis_options.yaml
diff --git a/runtime/observatory/lib/object_graph.dart b/runtime/observatory/lib/object_graph.dart
index e89d074..3ccc6c3 100644
--- a/runtime/observatory/lib/object_graph.dart
+++ b/runtime/observatory/lib/object_graph.dart
@@ -359,7 +359,7 @@
var next = _graph._mergedDomNext;
var cids = _graph._cids;
- var domChildren = [];
+ var domChildren = <MergedObjectVertex>[];
var prev = SENTINEL;
var child = _graph._mergedDomHead[_id];
// Walk the list of children and look for the representative objects, i.e.
diff --git a/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart b/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart
index d84be6c..fce8ce3 100644
--- a/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart
+++ b/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart
@@ -13,7 +13,7 @@
final S.HeapSpace oldSpace;
final Iterable<M.ClassHeapStats> members;
- AllocationProfile(S.ServiceMap map, {Map<String, List<String>> defaults})
+ AllocationProfile(S.ServiceMap map, {Map/*<String, List<String>>*/ defaults})
: lastAccumulatorReset = _intString2DateTime(map[_lastAccumulatorReset]),
lastServiceGC = _intString2DateTime(map[_lastServiceGC]),
oldSpace = new S.HeapSpace()..update(map['heaps']['old']),
@@ -27,14 +27,15 @@
return new DateTime.fromMillisecondsSinceEpoch(int.parse(milliseconds));
}
- static ClassHeapStats _convertMember(S.ServiceMap map) {
+ static ClassHeapStats _convertMember(/*S.ServiceMap*/ map) {
assert(map['type'] == 'ClassHeapStats');
return new ClassHeapStats(map);
}
- static List<M.ClassHeapStats> _convertMembers(Iterable<S.ServiceMap> raw,
- {Map<String, List<String>> defaults}) {
- final List<M.ClassHeapStats> members = raw.map(_convertMember).toList();
+ static List<M.ClassHeapStats> _convertMembers(Iterable/*<S.ServiceMap>*/ raw,
+ {Map/*<String, List<String>>*/ defaults}) {
+ final List<M.ClassHeapStats> members =
+ raw.map<ClassHeapStats>(_convertMember).toList();
if (defaults == null) {
return members;
}
@@ -42,7 +43,7 @@
new Map.fromIterable(defaults.keys, value: (_) => <ClassHeapStats>[]);
final Map<String, List<ClassHeapStats>> accumulators =
<String, List<ClassHeapStats>>{};
- defaults.forEach((String key, List<String> values) {
+ defaults.forEach((/*String*/ key, /*List<String>*/ values) {
final classes = aliases[key];
accumulators.addAll(new Map.fromIterable(values, value: (_) => classes));
});
@@ -68,7 +69,7 @@
final int promotedInstances;
final int promotedBytes;
- ClassHeapStats(S.ServiceMap map)
+ ClassHeapStats(Map map)
: clazz = map['class'],
oldSpace = new S.Allocations()..update(map['old']),
newSpace = new S.Allocations()..update(map['new']),
diff --git a/runtime/observatory/lib/src/app/location_manager.dart b/runtime/observatory/lib/src/app/location_manager.dart
index cf77504..a0e1af1 100644
--- a/runtime/observatory/lib/src/app/location_manager.dart
+++ b/runtime/observatory/lib/src/app/location_manager.dart
@@ -95,7 +95,7 @@
var newPath = ((_app.vm == null || _app.vm.isDisconnected)
? '/vm-connect'
: '/isolate-reconnect');
- var parameters = {};
+ var parameters = <String, dynamic>{};
parameters.addAll(_uri.queryParameters);
parameters['originalUri'] = _uri.toString();
parameters['isolateId'] = parameters['isolateId'];
diff --git a/runtime/observatory/lib/src/app/page.dart b/runtime/observatory/lib/src/app/page.dart
index 248cacc..0009df1 100644
--- a/runtime/observatory/lib/src/app/page.dart
+++ b/runtime/observatory/lib/src/app/page.dart
@@ -172,7 +172,7 @@
}
app.vm.reload().then((serviceObject) {
VM vm = serviceObject;
- container.children = [
+ container.children = <Element>[
new VMViewElement(vm, _vmrepository, app.events, app.notifications,
new IsolateRepository(app.vm), _scriptRepository,
queue: app.queue)
@@ -243,10 +243,10 @@
}
Future _visitObject(obj) async {
- container.children = [];
+ container.children = <Element>[];
await obj.reload();
if (obj is Class) {
- container.children = [
+ container.children = <Element>[
new ClassViewElement(
app.vm,
obj.isolate,
@@ -269,7 +269,7 @@
];
} else if (obj is Code) {
await obj.loadScript();
- container.children = [
+ container.children = <Element>[
new CodeViewElement(
app.vm,
obj.isolate,
@@ -284,7 +284,7 @@
queue: app.queue)
];
} else if (obj is Context) {
- container.children = [
+ container.children = <Element>[
new ContextViewElement(
app.vm,
obj.isolate,
@@ -300,11 +300,11 @@
queue: app.queue)
];
} else if (obj is DartError) {
- container.children = [
+ container.children = <Element>[
new ErrorViewElement(app.notifications, obj, queue: app.queue)
];
} else if (obj is Field) {
- container.children = [
+ container.children = <Element>[
new FieldViewElement(
app.vm,
obj.isolate,
@@ -322,7 +322,7 @@
queue: app.queue)
];
} else if (obj is Instance) {
- container.children = [
+ container.children = <Element>[
new InstanceViewElement(
app.vm,
obj.isolate,
@@ -343,7 +343,7 @@
queue: app.queue)
];
} else if (obj is Isolate) {
- container.children = [
+ container.children = <Element>[
new IsolateViewElement(
app.vm,
obj,
@@ -358,7 +358,7 @@
queue: app.queue)
];
} else if (obj is ServiceFunction) {
- container.children = [
+ container.children = <Element>[
new FunctionViewElement(
app.vm,
obj.isolate,
@@ -376,7 +376,7 @@
queue: app.queue)
];
} else if (obj is ICData) {
- container.children = [
+ container.children = <Element>[
new ICDataViewElement(
app.vm,
obj.isolate,
@@ -392,7 +392,7 @@
queue: app.queue)
];
} else if (obj is SingleTargetCache) {
- container.children = [
+ container.children = <Element>[
new SingleTargetCacheViewElement(
app.vm,
obj.isolate,
@@ -408,7 +408,7 @@
queue: app.queue)
];
} else if (obj is SubtypeTestCache) {
- container.children = [
+ container.children = <Element>[
new SubtypeTestCacheViewElement(
app.vm,
obj.isolate,
@@ -424,7 +424,7 @@
queue: app.queue)
];
} else if (obj is UnlinkedCall) {
- container.children = [
+ container.children = <Element>[
new UnlinkedCallViewElement(
app.vm,
obj.isolate,
@@ -440,7 +440,7 @@
queue: app.queue)
];
} else if (obj is Library) {
- container.children = [
+ container.children = <Element>[
new LibraryViewElement(
app.vm,
obj.isolate,
@@ -459,7 +459,7 @@
queue: app.queue)
];
} else if (obj is MegamorphicCache) {
- container.children = [
+ container.children = <Element>[
new MegamorphicCacheViewElement(
app.vm,
obj.isolate,
@@ -475,7 +475,7 @@
queue: app.queue)
];
} else if (obj is ObjectPool) {
- container.children = [
+ container.children = <Element>[
new ObjectPoolViewElement(
app.vm,
obj.isolate,
@@ -497,7 +497,7 @@
pos = int.parse(app.locationManager.internalArguments['pos']);
} catch (_) {}
}
- container.children = [
+ container.children = <Element>[
new ScriptViewElement(
app.vm,
obj.isolate,
@@ -514,7 +514,7 @@
queue: app.queue)
];
} else if (obj is HeapObject) {
- container.children = [
+ container.children = <Element>[
new ObjectViewElement(
app.vm,
obj.isolate,
@@ -529,13 +529,13 @@
queue: app.queue)
];
} else if (obj is Sentinel) {
- container.children = [
+ container.children = <Element>[
new SentinelViewElement(
app.vm, obj.isolate, obj, app.events, app.notifications,
queue: app.queue)
];
} else {
- container.children = [
+ container.children = <Element>[
new JSONViewElement(obj, app.notifications, queue: app.queue)
];
}
@@ -556,7 +556,7 @@
void _visit(Uri uri) {
super._visit(uri);
getIsolate(uri).then((isolate) {
- container.children = [
+ container.children = <Element>[
new ClassTreeElement(
app.vm, isolate, app.events, app.notifications, _classRepository)
];
@@ -572,7 +572,7 @@
void _visit(Uri uri) {
super._visit(uri);
getIsolate(uri).then((isolate) async {
- container.children = [
+ container.children = <Element>[
new DebuggerPageElement(
isolate, _objectRepository, _scriptRepository, app.events)
];
@@ -601,7 +601,7 @@
void _visit(Uri uri) {
super._visit(uri);
getIsolate(uri).then((isolate) async {
- container.children = [
+ container.children = <Element>[
new ObjectStoreViewElement(isolate.vm, isolate, app.events,
app.notifications, _objectstoreRepository, _objectRepository)
];
@@ -624,7 +624,7 @@
void _visit(Uri uri) {
super._visit(uri);
getIsolate(uri).then((isolate) {
- container.children = [
+ container.children = <Element>[
new CpuProfileElement(isolate.vm, isolate, app.events,
app.notifications, _isolateSampleProfileRepository)
];
@@ -647,7 +647,7 @@
void _visit(Uri uri) {
super._visit(uri);
getIsolate(uri).then((isolate) {
- container.children = [
+ container.children = <Element>[
new CpuProfileTableElement(isolate.vm, isolate, app.events,
app.notifications, _isolateSampleProfileRepository)
];
@@ -670,7 +670,7 @@
void _visit(Uri uri) {
super._visit(uri);
getIsolate(uri).then((isolate) {
- container.children = [
+ container.children = <Element>[
new AllocationProfileElement(isolate.vm, isolate, app.events,
app.notifications, _allocationProfileRepository,
queue: app.queue)
@@ -711,7 +711,7 @@
VM vm = serviceObject;
// Preload all isolates to avoid sorting problems.
await Future.wait(vm.isolates.map((i) => i.load()));
- container.children = [
+ container.children = <Element>[
new MemoryDashboardElement(
vm,
_vmrepository,
@@ -754,7 +754,7 @@
void _visit(Uri uri) {
super._visit(uri);
getIsolate(uri).then((isolate) {
- container.children = [
+ container.children = <Element>[
new PortsElement(isolate.vm, isolate, app.events, app.notifications,
_portsRepository, _objectRepository,
queue: app.queue)
@@ -777,7 +777,7 @@
void _visit(Uri uri) {
super._visit(uri);
getIsolate(uri).then((isolate) {
- container.children = [
+ container.children = <Element>[
new PersistentHandlesPageElement(isolate.vm, isolate, app.events,
app.notifications, _persistentHandlesRepository, _objectRepository,
queue: app.queue)
@@ -800,7 +800,7 @@
void _visit(Uri uri) {
super._visit(uri);
getIsolate(uri).then((isolate) {
- container.children = [
+ container.children = <Element>[
new HeapMapElement(isolate.vm, isolate, app.events, app.notifications,
queue: app.queue)
];
@@ -822,7 +822,7 @@
void _visit(Uri uri) {
super._visit(uri);
getIsolate(uri).then((isolate) {
- container.children = [
+ container.children = <Element>[
new HeapSnapshotElement(isolate.vm, isolate, app.events,
app.notifications, _heapSnapshotRepository, _objectRepository,
queue: app.queue)
@@ -860,7 +860,7 @@
assert(element != null);
assert(canVisit(uri));
getIsolate(uri).then((isolate) {
- container.children = [
+ container.children = <Element>[
new LoggingPageElement(app.vm, isolate, app.events, app.notifications,
queue: app.queue)
];
@@ -919,7 +919,7 @@
void _visit(Uri uri) {
app.vm.reload();
- container.children = [
+ container.children = <Element>[
new IsolateReconnectElement(
app.vm,
app.events,
@@ -947,7 +947,7 @@
lastIsolate = isolate;
container.children = const [];
await _metricRepository.startSampling(isolate);
- container.children = [
+ container.children = <Element>[
new MetricsPageElement(isolate.vm, isolate, app.events,
app.notifications, _metricRepository,
queue: app.queue)
@@ -999,7 +999,7 @@
void _visit(Uri uri) {
assert(canVisit(uri));
app.vm.load().then((_) {
- container.children = [
+ container.children = <Element>[
new TimelineDashboardElement(
app.vm, _timelineRepository, app.notifications,
queue: app.queue)
diff --git a/runtime/observatory/lib/src/elements/allocation_profile.dart b/runtime/observatory/lib/src/elements/allocation_profile.dart
index f11e63a..d1e4f86 100644
--- a/runtime/observatory/lib/src/elements/allocation_profile.dart
+++ b/runtime/observatory/lib/src/elements/allocation_profile.dart
@@ -84,7 +84,7 @@
assert(notifications != null);
assert(repository != null);
AllocationProfileElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<AllocationProfileElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -111,13 +111,13 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
_gcSubscription.cancel();
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -133,7 +133,7 @@
..onRefresh.listen((_) => _refresh()),
new DivElement()
..classes = ['nav-option']
- ..children = [
+ ..children = <Element>[
new CheckboxInputElement()
..id = 'allocation-profile-auto-refresh'
..checked = _autoRefresh
@@ -146,7 +146,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Allocation Profile',
new HRElement()
]
@@ -155,7 +155,7 @@
children.addAll([
new DivElement()
..classes = ['content-centered-big']
- ..children = [new HeadingElement.h2()..text = 'Loading...']
+ ..children = <Element>[new HeadingElement.h2()..text = 'Loading...']
]);
} else {
final newChartHost = new DivElement()..classes = ['host'];
@@ -170,10 +170,10 @@
: [
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'last forced GC at',
@@ -185,7 +185,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'last accumulator reset at',
@@ -200,7 +200,7 @@
],
new DivElement()
..classes = ['content-centered-big', 'compactable']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['heap-space', 'left']
..children = _isCompacted
@@ -218,7 +218,7 @@
new BRElement(),
new DivElement()
..classes = ['chart']
- ..children = [newChartLegend, newChartHost]
+ ..children = <Element>[newChartLegend, newChartHost]
],
new DivElement()
..classes = ['heap-space', 'right']
@@ -237,7 +237,7 @@
new BRElement(),
new DivElement()
..classes = ['chart']
- ..children = [oldChartLegend, oldChartHost]
+ ..children = <Element>[oldChartLegend, oldChartHost]
],
new ButtonElement()
..classes = ['compact']
@@ -250,7 +250,7 @@
],
new DivElement()
..classes = _isCompacted ? ['collection', 'expanded'] : ['collection']
- ..children = [
+ ..children = <Element>[
new VirtualCollectionElement(
_createCollectionLine, _updateCollectionLine,
createHeader: _createCollectionHeader,
@@ -309,15 +309,21 @@
}
switch (_sortingDirection) {
case _SortingDirection.ascending:
- return (a, b) => getter(a).compareTo(getter(b));
+ int sort(M.ClassHeapStats a, M.ClassHeapStats b) {
+ return getter(a).compareTo(getter(b));
+ }
+ return sort;
case _SortingDirection.descending:
- return (a, b) => getter(b).compareTo(getter(a));
+ int sort(M.ClassHeapStats a, M.ClassHeapStats b) {
+ return getter(b).compareTo(getter(a));
+ }
+ return sort;
}
}
static HtmlElement _createCollectionLine() => new DivElement()
..classes = ['collection-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['bytes']
..text = '0B',
@@ -360,7 +366,7 @@
List<HtmlElement> _createCollectionHeader() => [
new DivElement()
..classes = ['collection-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['group']
..text = 'Accumulated',
@@ -382,7 +388,7 @@
],
new DivElement()
..classes = ['collection-item']
- ..children = [
+ ..children = <Element>[
_createHeaderButton(const ['bytes'], 'Size',
_SortingField.accumulatedSize, _SortingDirection.descending),
_createHeaderButton(
@@ -473,7 +479,8 @@
..classes = ['name'];
}
- bool _search(Pattern pattern, M.ClassHeapStats item) {
+ bool _search(Pattern pattern, itemDynamic) {
+ M.ClassHeapStats item = itemDynamic;
return item.clazz.name.contains(pattern);
}
@@ -495,7 +502,7 @@
return [
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'used',
@@ -505,7 +512,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'external',
@@ -515,7 +522,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'collections',
@@ -525,7 +532,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'average collection time',
@@ -535,7 +542,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'cumulative collection time',
@@ -545,7 +552,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'average time between collections',
@@ -570,7 +577,7 @@
final config = new ChartConfig(series, [0])
..minimumSize = minSize
..legend = new ChartLegend(legend, showValues: true);
- final data = new ChartData(_columns, [
+ final data = new ChartData(_columns, <List>[
['Used', space.used],
['Free', space.capacity - space.used],
['External', space.external]
diff --git a/runtime/observatory/lib/src/elements/class_allocation_profile.dart b/runtime/observatory/lib/src/elements/class_allocation_profile.dart
index 36df884..60dadc3 100644
--- a/runtime/observatory/lib/src/elements/class_allocation_profile.dart
+++ b/runtime/observatory/lib/src/elements/class_allocation_profile.dart
@@ -46,7 +46,8 @@
assert(cls != null);
assert(profiles != null);
ClassAllocationProfileElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r =
+ new RenderingScheduler<ClassAllocationProfileElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._cls = cls;
@@ -66,7 +67,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
diff --git a/runtime/observatory/lib/src/elements/class_instances.dart b/runtime/observatory/lib/src/elements/class_instances.dart
index 84ba605..beb1049 100644
--- a/runtime/observatory/lib/src/elements/class_instances.dart
+++ b/runtime/observatory/lib/src/elements/class_instances.dart
@@ -60,7 +60,7 @@
assert(topRetainingInstances != null);
assert(objects != null);
ClassInstancesElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ClassInstancesElement>(e, queue: queue);
e._isolate = isolate;
e._cls = cls;
e._retainedSizes = retainedSizes;
@@ -83,7 +83,7 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
StronglyReachableInstancesElement _strong;
@@ -102,13 +102,13 @@
_cls.newSpace.current.instances + _cls.oldSpace.current.instances;
final size = Utils
.formatSize(_cls.newSpace.current.bytes + _cls.oldSpace.current.bytes);
- children = [
+ children = <Element>[
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = const ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = const ['memberName']
..text = 'currently allocated',
@@ -118,19 +118,19 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'strongly reachable ',
new DivElement()
..classes = ['memberValue']
- ..children = [_strong]
+ ..children = <Element>[_strong]
],
new DivElement()
..classes = ['memberItem']
..title = 'Space reachable from this object, '
'excluding class references'
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Reachable size ',
@@ -142,7 +142,7 @@
..classes = ['memberItem']
..title = 'Space that would be reclaimed if references to this '
'object were replaced with null'
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Retained size ',
@@ -152,13 +152,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'toplist by retained memory ',
new DivElement()
..classes = ['memberValue']
- ..children = [_topRetainig]
+ ..children = <Element>[_topRetainig]
]
]
];
diff --git a/runtime/observatory/lib/src/elements/class_ref.dart b/runtime/observatory/lib/src/elements/class_ref.dart
index f17d161..eee3cb6 100644
--- a/runtime/observatory/lib/src/elements/class_ref.dart
+++ b/runtime/observatory/lib/src/elements/class_ref.dart
@@ -26,7 +26,7 @@
{RenderingQueue queue}) {
assert(cls != null);
ClassRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ClassRefElement>(e, queue: queue);
e._isolate = isolate;
e._class = cls;
return e;
@@ -44,11 +44,11 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(
href: (_isolate == null)
? null
diff --git a/runtime/observatory/lib/src/elements/class_tree.dart b/runtime/observatory/lib/src/elements/class_tree.dart
index 904014c..505eef9 100644
--- a/runtime/observatory/lib/src/elements/class_tree.dart
+++ b/runtime/observatory/lib/src/elements/class_tree.dart
@@ -55,7 +55,7 @@
assert(notifications != null);
assert(classes != null);
ClassTreeElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ClassTreeElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -76,15 +76,15 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
VirtualTreeElement _tree;
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -93,7 +93,7 @@
]),
new DivElement()
..classes = ['content-centered']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()
..text = 'Class Hierarchy (${_subclasses.length})',
new BRElement(),
@@ -146,7 +146,7 @@
static HtmlElement _create(toggle) {
return new DivElement()
..classes = ['class-tree-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()..classes = ['lines'],
new ButtonElement()
..classes = ['expander']
@@ -155,14 +155,15 @@
];
}
- void _update(HtmlElement el, M.Class cls, int index) {
+ void _update(HtmlElement el, classDynamic, int index) {
+ M.Class cls = classDynamic;
virtualTreeUpdateLines(el.children[0], index);
if (cls.subclasses.isEmpty) {
el.children[1].text = '';
} else {
el.children[1].text = _tree.isExpanded(cls) ? 'â–¼' : 'â–º';
}
- el.children[2].children = [
+ el.children[2].children = <Element>[
new ClassRefElement(_isolate, cls, queue: _r.queue)
];
if (_mixins[cls.id] != null) {
@@ -170,13 +171,14 @@
}
}
- bool _search(Pattern pattern, M.Class cls) {
+ bool _search(Pattern pattern, classDynamic) {
+ M.Class cls = classDynamic;
return cls.name.contains(pattern);
}
List<Element> _createMixins(List<M.Instance> types) {
final children = types
- .expand((type) => [
+ .expand((type) => <Element>[
new SpanElement()..text = ', ',
type.typeClass == null
? (new SpanElement()..text = type.name.split('<').first)
diff --git a/runtime/observatory/lib/src/elements/class_view.dart b/runtime/observatory/lib/src/elements/class_view.dart
index 95c5279..f2ceec0 100644
--- a/runtime/observatory/lib/src/elements/class_view.dart
+++ b/runtime/observatory/lib/src/elements/class_view.dart
@@ -121,7 +121,7 @@
assert(topRetained != null);
assert(profiles != null);
ClassViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ClassViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -155,7 +155,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
ObjectCommonElement _common;
@@ -184,8 +184,8 @@
if (_cls.isPatch) {
header += 'patch ';
}
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -210,7 +210,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = '$header class ${_cls.name}',
new HRElement(),
_common,
@@ -240,7 +240,7 @@
new HeadingElement.h2()..text = 'Allocations',
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Tracing allocations? ',
@@ -300,13 +300,13 @@
if (_cls.library != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'library',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new LibraryRefElement(_isolate, _cls.library, queue: _r.queue)
]
]);
@@ -314,13 +314,13 @@
if (_cls.location != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'script',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new SourceLinkElement(_isolate, _cls.location, _scripts,
queue: _r.queue)
]
@@ -329,13 +329,13 @@
if (_cls.superclass != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'superclass',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new ClassRefElement(_isolate, _cls.superclass, queue: _r.queue)
]
]);
@@ -343,13 +343,13 @@
if (_cls.superType != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'supertype',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new InstanceRefElement(_isolate, _cls.superType, _objects,
queue: _r.queue)
]
@@ -358,13 +358,13 @@
if (cls.mixin != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'mixin',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new InstanceRefElement(_isolate, _cls.mixin, _objects,
queue: _r.queue)
]
@@ -373,14 +373,14 @@
if (_cls.subclasses.length > 0) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'extended by',
new DivElement()
..classes = ['memberValue']
..children = (_cls.subclasses
- .expand((subcls) => [
+ .expand((subcls) => <Element>[
new ClassRefElement(_isolate, subcls, queue: _r.queue),
new SpanElement()..text = ', '
])
@@ -394,14 +394,14 @@
if (_cls.interfaces.length > 0) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'implements',
new DivElement()
..classes = ['memberValue']
..children = (_cls.interfaces
- .expand((interf) => [
+ .expand((interf) => <Element>[
new InstanceRefElement(_isolate, interf, _objects,
queue: _r.queue),
new SpanElement()..text = ', '
@@ -413,7 +413,7 @@
if (_cls.name != _cls.vmName) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'vm name',
@@ -432,25 +432,25 @@
_fieldsExpanded = _fieldsExpanded ?? (fields.length <= 8);
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'fields ${fields.length}',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new CurlyBlockElement(expanded: _fieldsExpanded)
..onToggle.listen((e) => _fieldsExpanded = e.control.expanded)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['memberList']
..children = (fields
- .map((f) => new DivElement()
+ .map<Element>((f) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new FieldRefElement(_isolate, f, _objects,
queue: _r.queue)
],
@@ -474,20 +474,20 @@
_functionsExpanded = _functionsExpanded ?? (functions.length <= 8);
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'functions (${functions.length})',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new CurlyBlockElement(expanded: _functionsExpanded)
..onToggle
.listen((e) => _functionsExpanded = e.control.expanded)
..content = (functions
- .map((f) => new DivElement()
+ .map<Element>((f) => new DivElement()
..classes = ['indent']
- ..children = [
+ ..children = <Element>[
new FunctionRefElement(_isolate, f, queue: _r.queue)
])
.toList())
diff --git a/runtime/observatory/lib/src/elements/code_ref.dart b/runtime/observatory/lib/src/elements/code_ref.dart
index bf62390..fc35ef8 100644
--- a/runtime/observatory/lib/src/elements/code_ref.dart
+++ b/runtime/observatory/lib/src/elements/code_ref.dart
@@ -29,7 +29,7 @@
{RenderingQueue queue}) {
assert(code != null);
CodeRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<CodeRefElement>(e, queue: queue);
e._isolate = isolate;
e._code = code;
return e;
@@ -46,12 +46,12 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(
href: ((M.isSyntheticCode(_code.kind)) || (_isolate == null))
? null
diff --git a/runtime/observatory/lib/src/elements/code_view.dart b/runtime/observatory/lib/src/elements/code_view.dart
index cfec45b..b943be5 100644
--- a/runtime/observatory/lib/src/elements/code_view.dart
+++ b/runtime/observatory/lib/src/elements/code_view.dart
@@ -98,7 +98,7 @@
assert(references != null);
assert(retainingPaths != null);
CodeViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<CodeViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -140,7 +140,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
TableElement _disassemblyTable;
@@ -151,9 +151,9 @@
void render() {
if (_inlineRangeTable == null) {
_inlineRangeTable = new TableElement()..classes = ['table'];
- _inlineRangeTable.createTHead().children = [
+ _inlineRangeTable.createTHead().children = <Element>[
new TableRowElement()
- ..children = [
+ ..children = <Element>[
document.createElement('th')
..classes = ['address']
..text = 'Address Range',
@@ -171,9 +171,9 @@
}
if (_disassemblyTable == null) {
_disassemblyTable = new TableElement()..classes = ['table'];
- _disassemblyTable.createTHead().children = [
+ _disassemblyTable.createTHead().children = <Element>[
new TableRowElement()
- ..children = [
+ ..children = <Element>[
document.createElement('th')
..classes = ['address']
..text = 'Address Range',
@@ -198,8 +198,8 @@
}
final inlinedFunctions = _code.inlinedFunctions.toList();
final S.Code code = _code as S.Code;
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -218,7 +218,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()
..text = (M.isDartCode(_code.kind) && _code.isOptimized)
? 'Optimized code for ${_code.name}'
@@ -230,10 +230,10 @@
new BRElement(),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Kind',
@@ -255,13 +255,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Function',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new FunctionRefElement(_isolate, _code.function,
queue: _r.queue)
]
@@ -292,13 +292,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Object pool',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new ObjectPoolRefElement(_isolate, _code.objectPool,
queue: _r.queue)
]
@@ -314,12 +314,12 @@
'inlined functions (${inlinedFunctions.length})',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new CurlyBlockElement(
expanded: inlinedFunctions.length < 8,
queue: _r.queue)
..content = inlinedFunctions
- .map((f) => new FunctionRefElement(
+ .map<Element>((f) => new FunctionRefElement(
_isolate, f,
queue: _r.queue))
.toList()
@@ -476,7 +476,9 @@
final cell = tr.children[i];
final content = row.values[i];
if (content is S.HeapObject) {
- cell.children = [anyRef(_isolate, content, _objects, queue: _r.queue)];
+ cell.children = <Element>[
+ anyRef(_isolate, content, _objects, queue: _r.queue)
+ ];
} else if (content != null) {
String text = '$content';
if (i == kDisassemblyColumnIndex) {
diff --git a/runtime/observatory/lib/src/elements/containers/search_bar.dart b/runtime/observatory/lib/src/elements/containers/search_bar.dart
index e3cc4ea..c07c495 100644
--- a/runtime/observatory/lib/src/elements/containers/search_bar.dart
+++ b/runtime/observatory/lib/src/elements/containers/search_bar.dart
@@ -59,7 +59,7 @@
assert(search != null);
assert(isOpen != null);
SearchBarElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<SearchBarElement>(e, queue: queue);
e._search = search;
e._isOpen = isOpen;
e._workspace = workspace;
@@ -128,7 +128,7 @@
}
});
_resultsArea = new SpanElement();
- children = [
+ children = <Element>[
_input,
_resultsArea,
new ButtonElement()
diff --git a/runtime/observatory/lib/src/elements/containers/virtual_collection.dart b/runtime/observatory/lib/src/elements/containers/virtual_collection.dart
index 4f9839e..b1a9169 100644
--- a/runtime/observatory/lib/src/elements/containers/virtual_collection.dart
+++ b/runtime/observatory/lib/src/elements/containers/virtual_collection.dart
@@ -54,7 +54,7 @@
assert(update != null);
assert(items != null);
VirtualCollectionElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<VirtualCollectionElement>(e, queue: queue);
e._create = create;
e._createHeader = createHeader;
e._update = update;
@@ -126,12 +126,12 @@
void render() {
if (children.isEmpty) {
- children = [
+ children = <Element>[
_viewport
- ..children = [
+ ..children = <Element>[
_spacer
- ..children = [
- _buffer..children = [_create()]
+ ..children = <Element>[
+ _buffer..children = <Element>[_create()]
],
]
];
@@ -216,7 +216,7 @@
_updateHeader();
}
- double _foldWidth(double value, HtmlElement child) {
+ double _foldWidth(double value, Element child) {
return math.max(value, child.getBoundingClientRect().width);
}
diff --git a/runtime/observatory/lib/src/elements/containers/virtual_tree.dart b/runtime/observatory/lib/src/elements/containers/virtual_tree.dart
index 82dc906..0c9b38b 100644
--- a/runtime/observatory/lib/src/elements/containers/virtual_tree.dart
+++ b/runtime/observatory/lib/src/elements/containers/virtual_tree.dart
@@ -57,7 +57,7 @@
assert(children != null);
assert(items != null);
VirtualTreeElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<VirtualTreeElement>(e, queue: queue);
e._children = children;
e._collection = new VirtualCollectionElement(() {
var element;
@@ -151,7 +151,7 @@
void render() {
if (children.length == 0) {
- children = [_collection];
+ children = <Element>[_collection];
}
final items = [];
diff --git a/runtime/observatory/lib/src/elements/context_ref.dart b/runtime/observatory/lib/src/elements/context_ref.dart
index 25b1fa5..c4c06b2 100644
--- a/runtime/observatory/lib/src/elements/context_ref.dart
+++ b/runtime/observatory/lib/src/elements/context_ref.dart
@@ -36,7 +36,7 @@
assert(context != null);
assert(objects != null);
ContextRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ContextRefElement>(e, queue: queue);
e._isolate = isolate;
e._context = context;
e._objects = objects;
@@ -56,7 +56,7 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
Future _refresh() async {
@@ -67,7 +67,7 @@
void render() {
var children = <HtmlElement>[
new AnchorElement(href: Uris.inspect(_isolate, object: _context))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = 'Context',
@@ -78,7 +78,7 @@
children.addAll([
new SpanElement()..text = ' ',
new CurlyBlockElement(expanded: _expanded, queue: _r.queue)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['indent']
..children = _createValue()
@@ -104,13 +104,13 @@
if (_loadedContext.parentContext != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'parent context',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new ContextRefElement(
_isolate, _loadedContext.parentContext, _objects,
queue: _r.queue)
@@ -123,13 +123,13 @@
var variable = variables[index];
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = '[ $index ]',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, variable.value, _objects, queue: _r.queue)
]
]);
diff --git a/runtime/observatory/lib/src/elements/context_view.dart b/runtime/observatory/lib/src/elements/context_view.dart
index f89e578..15dd1a6 100644
--- a/runtime/observatory/lib/src/elements/context_view.dart
+++ b/runtime/observatory/lib/src/elements/context_view.dart
@@ -82,7 +82,7 @@
assert(retainingPaths != null);
assert(objects != null);
ContextViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ContextViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -109,12 +109,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- var content = [
- navBar([
+ var content = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -130,7 +130,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Context',
new HRElement(),
new ObjectCommonElement(_isolate, _context, _retainedSizes,
@@ -143,19 +143,19 @@
new BRElement(),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'parent context',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new ContextRefElement(
_isolate, _context.parentContext, _objects,
queue: _r.queue)
@@ -171,22 +171,22 @@
content.addAll([
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'Variables ',
new CurlyBlockElement(expanded: true, queue: _r.queue)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['memberList']
..children = _context.variables
- .map((variable) => new DivElement()
+ .map<Element>((variable) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = '[ ${++index} ]',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, variable.value, _objects,
queue: _r.queue)
]
@@ -198,7 +198,7 @@
}
content.add(new DivElement()
..classes = ['content-centered-big']
- ..children = [new ViewFooterElement(queue: _r.queue)]);
+ ..children = <Element>[new ViewFooterElement(queue: _r.queue)]);
children = content;
}
}
diff --git a/runtime/observatory/lib/src/elements/cpu_profile.dart b/runtime/observatory/lib/src/elements/cpu_profile.dart
index f5e5180..4c8bc31 100644
--- a/runtime/observatory/lib/src/elements/cpu_profile.dart
+++ b/runtime/observatory/lib/src/elements/cpu_profile.dart
@@ -68,7 +68,7 @@
assert(notifications != null);
assert(profiles != null);
CpuProfileElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<CpuProfileElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -90,12 +90,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- var content = [
- navBar([
+ var content = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
diff --git a/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart b/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart
index c4caa7c..3ee7325 100644
--- a/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart
+++ b/runtime/observatory/lib/src/elements/cpu_profile/virtual_tree.dart
@@ -58,7 +58,7 @@
assert(mode != null);
assert(direction != null);
CpuProfileVirtualTreeElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<CpuProfileVirtualTreeElement>(e, queue: queue);
e._isolate = owner;
e._profile = profile;
e._mode = mode;
@@ -79,7 +79,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
VirtualTreeElement _tree;
@@ -128,28 +128,28 @@
});
}
if (tree == null) {
- children = [new HeadingElement.h1()..text = 'No Results'];
+ children = <Element>[new HeadingElement.h1()..text = 'No Results'];
return;
}
_tree = new VirtualTreeElement(create, update, _getChildren,
items: tree.root.children, search: search, queue: _r.queue);
if (tree.root.children.length == 0) {
- children = [
+ children = <Element>[
new DivElement()
..classes = ['tree-item']
- ..children = [new HeadingElement.h1()..text = 'No Samples']
+ ..children = <Element>[new HeadingElement.h1()..text = 'No Samples']
];
return;
} else if (tree.root.children.length == 1) {
_tree.expand(tree.root.children.first, autoExpandSingleChildNodes: true);
}
- children = [_tree];
+ children = <Element>[_tree];
}
- static Element _createCpuRow(toggle) {
+ static HtmlElement _createCpuRow(toggle) {
return new DivElement()
..classes = ['tree-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['inclusive']
..title = 'global % on stack',
@@ -167,10 +167,10 @@
];
}
- static Element _createMemoryRow(toggle) {
+ static HtmlElement _createMemoryRow(toggle) {
return new DivElement()
..classes = ['tree-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['inclusive']
..title = 'memory allocated from resulting calls: ',
@@ -197,7 +197,8 @@
static const String _collapsedIcon = 'â–º';
void _updateCpuFunctionRow(
- HtmlElement element, M.FunctionCallTreeNode item, int depth) {
+ HtmlElement element, itemDynamic, int depth) {
+ M.FunctionCallTreeNode item = itemDynamic;
element.children[0].text = Utils
.formatPercentNormalized(item.profileFunction.normalizedInclusiveTicks);
element.children[1].text = Utils
@@ -217,7 +218,8 @@
}
void _updateMemoryFunctionRow(
- HtmlElement element, M.FunctionCallTreeNode item, int depth) {
+ HtmlElement element, itemDynamic, int depth) {
+ M.FunctionCallTreeNode item = itemDynamic;
element.children[0].text =
Utils.formatSize(item.inclusiveNativeAllocations);
element.children[0].title = 'memory allocated from resulting calls: '
@@ -240,11 +242,14 @@
..classes = ['name'];
}
- bool _searchFunction(Pattern pattern, M.FunctionCallTreeNode item) =>
- M.getFunctionFullName(item.profileFunction.function).contains(pattern);
+ bool _searchFunction(Pattern pattern, itemDynamic) {
+ M.FunctionCallTreeNode item = itemDynamic;
+ return M.getFunctionFullName(item.profileFunction.function).contains(pattern);
+ }
void _updateCpuCodeRow(
- HtmlElement element, M.CodeCallTreeNode item, int depth) {
+ HtmlElement element, itemDynamic, int depth) {
+ M.CodeCallTreeNode item = itemDynamic;
element.children[0].text = Utils
.formatPercentNormalized(item.profileCode.normalizedInclusiveTicks);
element.children[1].text = Utils
@@ -263,7 +268,8 @@
}
void _updateMemoryCodeRow(
- HtmlElement element, M.CodeCallTreeNode item, int depth) {
+ HtmlElement element, itemDynamic, int depth) {
+ M.CodeCallTreeNode item = itemDynamic;
element.children[0].text =
Utils.formatSize(item.inclusiveNativeAllocations);
element.children[0].title = 'memory allocated from resulting calls: '
@@ -285,8 +291,10 @@
..classes = ['name'];
}
- bool _searchCode(Pattern pattern, M.CodeCallTreeNode item) =>
- item.profileCode.code.name.contains(pattern);
+ bool _searchCode(Pattern pattern, itemDynamic) {
+ M.CodeCallTreeNode item = itemDynamic;
+ return item.profileCode.code.name.contains(pattern);
+ }
static _updateLines(List<Element> lines, int n) {
n = Math.max(0, n);
diff --git a/runtime/observatory/lib/src/elements/cpu_profile_table.dart b/runtime/observatory/lib/src/elements/cpu_profile_table.dart
index 3e141a1..a78e2a4 100644
--- a/runtime/observatory/lib/src/elements/cpu_profile_table.dart
+++ b/runtime/observatory/lib/src/elements/cpu_profile_table.dart
@@ -85,7 +85,7 @@
assert(notifications != null);
assert(profiles != null);
CpuProfileTableElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<CpuProfileTableElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -107,12 +107,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- var content = [
- navBar([
+ var content = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -171,19 +171,19 @@
_callers.items = const [];
_callees.items = const [];
}
- return [
+ return <Element>[
new DivElement()
..classes = ['profile-trees']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['profile-trees-all']
- ..children = [_functions],
+ ..children = <Element>[_functions],
new DivElement()
..classes = ['profile-trees-current']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['profile-trees-caller']
- ..children = [_callers],
+ ..children = <Element>[_callers],
new DivElement()
..classes = ['profile-trees-selected']
..children = _selected == null
@@ -194,16 +194,16 @@
],
new DivElement()
..classes = ['profile-trees-callee']
- ..children = [_callees]
+ ..children = <Element>[_callees]
]
]
];
}
- Element _createFunction() {
+ HtmlElement _createFunction() {
final element = new DivElement()
..classes = ['function-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['exclusive']
..text = '0%',
@@ -237,7 +237,7 @@
List<HtmlElement> _createFunctionHeader() => [
new DivElement()
..classes = ['function-item']
- ..children = [
+ ..children = <Element>[
_createHeaderButton(
const ['exclusive'],
'Execution(%)',
@@ -255,7 +255,8 @@
]
];
- bool _searchFunction(Pattern pattern, M.ProfileFunction item) {
+ bool _searchFunction(Pattern pattern, itemDynamic) {
+ M.ProfileFunction item = itemDynamic;
return M.getFunctionFullName(item.function).contains(pattern);
}
@@ -277,10 +278,10 @@
_r.dirty();
}
- Element _createCallee() {
+ HtmlElement _createCallee() {
final element = new DivElement()
..classes = ['function-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['inclusive']
..text = '0%',
@@ -304,7 +305,7 @@
List<HtmlElement> _createCalleeHeader() => [
new DivElement()
..classes = ['function-item']
- ..children = [
+ ..children = <Element>[
_createHeaderButton(
const ['inclusive'],
'Callees(%)',
@@ -316,10 +317,10 @@
]
];
- Element _createCaller() {
+ HtmlElement _createCaller() {
final element = new DivElement()
..classes = ['function-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['inclusive']
..text = '0%',
@@ -343,7 +344,7 @@
List<HtmlElement> _createCallerHeader() => [
new DivElement()
..classes = ['function-item']
- ..children = [
+ ..children = <Element>[
_createHeaderButton(
const ['inclusive'],
'Callers(%)',
@@ -403,8 +404,10 @@
];
}
- bool _filterTree(M.FunctionCallTreeNode node) =>
- node.profileFunction == _selected;
+ bool _filterTree(nodeDynamic) {
+ M.FunctionCallTreeNode node = nodeDynamic;
+ return node.profileFunction == _selected;
+ }
Future _request({bool clear: false, bool forceFetch: false}) async {
_progress = null;
@@ -452,9 +455,15 @@
}
switch (_sortingDirection[table]) {
case _SortingDirection.ascending:
- return (a, b) => getter(a).compareTo(getter(b));
+ int sort(M.ProfileFunction a, M.ProfileFunction b) {
+ return getter(a).compareTo(getter(b));
+ }
+ return sort;
case _SortingDirection.descending:
- return (a, b) => getter(b).compareTo(getter(a));
+ int sort(M.ProfileFunction a, M.ProfileFunction b) {
+ return getter(b).compareTo(getter(a));
+ }
+ return sort;
}
}
diff --git a/runtime/observatory/lib/src/elements/curly_block.dart b/runtime/observatory/lib/src/elements/curly_block.dart
index 12ef047..3d88727 100644
--- a/runtime/observatory/lib/src/elements/curly_block.dart
+++ b/runtime/observatory/lib/src/elements/curly_block.dart
@@ -49,7 +49,7 @@
assert(expanded != null);
assert(disabled != null);
CurlyBlockElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<CurlyBlockElement>(e, queue: queue);
e._expanded = expanded;
e._disabled = disabled;
return e;
@@ -67,7 +67,7 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void toggle() {
@@ -79,7 +79,7 @@
}
void render() {
- List<Element> content = [new SpanElement()..text = '{'];
+ List<Element> content = <Element>[new SpanElement()..text = '{'];
SpanElement label = new SpanElement()
..classes = disabled ? ['curly-block', 'disabled'] : ['curly-block']
..innerHtml = expanded
@@ -92,7 +92,7 @@
..onClick.listen((_) {
toggle();
})
- ..children = [label]);
+ ..children = <Element>[label]);
}
if (expanded) {
content.add(new BRElement());
diff --git a/runtime/observatory/lib/src/elements/debugger.dart b/runtime/observatory/lib/src/elements/debugger.dart
index 5b15543..1c70579 100644
--- a/runtime/observatory/lib/src/elements/debugger.dart
+++ b/runtime/observatory/lib/src/elements/debugger.dart
@@ -36,7 +36,7 @@
abstract class DebuggerCommand extends Command {
ObservatoryDebugger debugger;
- DebuggerCommand(this.debugger, name, children) : super(name, children);
+ DebuggerCommand(this.debugger, name, List<Command> children) : super(name, children);
String get helpShort;
String get helpLong;
@@ -46,7 +46,7 @@
// provided by the cli library.
class HelpCommand extends DebuggerCommand {
HelpCommand(Debugger debugger)
- : super(debugger, 'help', [
+ : super(debugger, 'help', <Command>[
new HelpHotkeysCommand(debugger),
]);
@@ -62,7 +62,7 @@
var con = debugger.console;
if (args.length == 0) {
// Print list of all top-level commands.
- var commands = debugger.cmd.matchCommand([], false);
+ var commands = debugger.cmd.matchCommand(<String>[], false);
commands.sort((a, b) => a.name.compareTo(b.name));
con.print('List of commands:\n');
for (DebuggerCommand command in commands) {
@@ -92,7 +92,7 @@
con.printBold(_nameAndAlias(command));
con.print(command.helpLong);
- var newArgs = [];
+ var newArgs = <String>[];
newArgs.addAll(args.take(args.length - 1));
newArgs.add(command.name);
newArgs.add('');
@@ -129,7 +129,7 @@
}
class HelpHotkeysCommand extends DebuggerCommand {
- HelpHotkeysCommand(Debugger debugger) : super(debugger, 'hotkeys', []);
+ HelpHotkeysCommand(Debugger debugger) : super(debugger, 'hotkeys', <Command>[]);
Future run(List<String> args) {
var con = debugger.console;
@@ -160,7 +160,7 @@
}
class PrintCommand extends DebuggerCommand {
- PrintCommand(Debugger debugger) : super(debugger, 'print', []) {
+ PrintCommand(Debugger debugger) : super(debugger, 'print', <Command>[]) {
alias = 'p';
}
@@ -193,7 +193,7 @@
}
class DownCommand extends DebuggerCommand {
- DownCommand(Debugger debugger) : super(debugger, 'down', []);
+ DownCommand(Debugger debugger) : super(debugger, 'down', <Command>[]);
Future run(List<String> args) {
int count = 1;
@@ -227,7 +227,7 @@
}
class UpCommand extends DebuggerCommand {
- UpCommand(Debugger debugger) : super(debugger, 'up', []);
+ UpCommand(Debugger debugger) : super(debugger, 'up', <Command>[]);
Future run(List<String> args) {
int count = 1;
@@ -261,7 +261,7 @@
}
class FrameCommand extends DebuggerCommand {
- FrameCommand(Debugger debugger) : super(debugger, 'frame', []) {
+ FrameCommand(Debugger debugger) : super(debugger, 'frame', <Command>[]) {
alias = 'f';
}
@@ -295,7 +295,7 @@
}
class PauseCommand extends DebuggerCommand {
- PauseCommand(Debugger debugger) : super(debugger, 'pause', []);
+ PauseCommand(Debugger debugger) : super(debugger, 'pause', <Command>[]);
Future run(List<String> args) {
return debugger.pause();
@@ -311,7 +311,7 @@
}
class ContinueCommand extends DebuggerCommand {
- ContinueCommand(Debugger debugger) : super(debugger, 'continue', []) {
+ ContinueCommand(Debugger debugger) : super(debugger, 'continue', <Command>[]) {
alias = 'c';
}
@@ -330,7 +330,7 @@
}
class SmartNextCommand extends DebuggerCommand {
- SmartNextCommand(Debugger debugger) : super(debugger, 'next', []) {
+ SmartNextCommand(Debugger debugger) : super(debugger, 'next', <Command>[]) {
alias = 'n';
}
@@ -352,7 +352,7 @@
}
class SyncNextCommand extends DebuggerCommand {
- SyncNextCommand(Debugger debugger) : super(debugger, 'next-sync', []);
+ SyncNextCommand(Debugger debugger) : super(debugger, 'next-sync', <Command>[]);
Future run(List<String> args) {
return debugger.syncNext();
@@ -368,7 +368,7 @@
}
class AsyncNextCommand extends DebuggerCommand {
- AsyncNextCommand(Debugger debugger) : super(debugger, 'next-async', []);
+ AsyncNextCommand(Debugger debugger) : super(debugger, 'next-async', <Command>[]);
Future run(List<String> args) {
return debugger.asyncNext();
@@ -384,7 +384,7 @@
}
class StepCommand extends DebuggerCommand {
- StepCommand(Debugger debugger) : super(debugger, 'step', []) {
+ StepCommand(Debugger debugger) : super(debugger, 'step', <Command>[]) {
alias = 's';
}
@@ -406,7 +406,7 @@
}
class RewindCommand extends DebuggerCommand {
- RewindCommand(Debugger debugger) : super(debugger, 'rewind', []);
+ RewindCommand(Debugger debugger) : super(debugger, 'rewind', <Command>[]);
Future run(List<String> args) async {
try {
@@ -443,7 +443,7 @@
final M.IsolateRepository _isolates;
ReloadCommand(Debugger debugger, this._isolates)
- : super(debugger, 'reload', []);
+ : super(debugger, 'reload', <Command>[]);
Future run(List<String> args) async {
try {
@@ -477,7 +477,7 @@
}
class ClsCommand extends DebuggerCommand {
- ClsCommand(Debugger debugger) : super(debugger, 'cls', []) {}
+ ClsCommand(Debugger debugger) : super(debugger, 'cls', <Command>[]) {}
Future run(List<String> args) {
debugger.console.clear();
@@ -493,7 +493,7 @@
}
class LogCommand extends DebuggerCommand {
- LogCommand(Debugger debugger) : super(debugger, 'log', []);
+ LogCommand(Debugger debugger) : super(debugger, 'log', <Command>[]);
Future run(List<String> args) async {
if (args.length == 0) {
@@ -560,7 +560,7 @@
}
class FinishCommand extends DebuggerCommand {
- FinishCommand(Debugger debugger) : super(debugger, 'finish', []);
+ FinishCommand(Debugger debugger) : super(debugger, 'finish', <Command>[]);
Future run(List<String> args) {
if (debugger.isolatePaused()) {
@@ -591,7 +591,7 @@
}
class SetCommand extends DebuggerCommand {
- SetCommand(Debugger debugger) : super(debugger, 'set', []);
+ SetCommand(Debugger debugger) : super(debugger, 'set', <Command>[]);
static var _boeValues = ['All', 'None', 'Unhandled'];
static var _boolValues = ['false', 'true'];
@@ -737,7 +737,7 @@
}
class BreakCommand extends DebuggerCommand {
- BreakCommand(Debugger debugger) : super(debugger, 'break', []);
+ BreakCommand(Debugger debugger) : super(debugger, 'break', <Command>[]);
Future run(List<String> args) async {
if (args.length > 1) {
@@ -821,7 +821,7 @@
}
class ClearCommand extends DebuggerCommand {
- ClearCommand(Debugger debugger) : super(debugger, 'clear', []);
+ ClearCommand(Debugger debugger) : super(debugger, 'clear', <Command>[]);
Future run(List<String> args) async {
if (args.length > 1) {
@@ -908,7 +908,7 @@
// TODO(turnidge): Add argument completion.
class DeleteCommand extends DebuggerCommand {
- DeleteCommand(Debugger debugger) : super(debugger, 'delete', []);
+ DeleteCommand(Debugger debugger) : super(debugger, 'delete', <Command>[]);
Future run(List<String> args) {
if (args.length < 1) {
@@ -948,7 +948,7 @@
class InfoBreakpointsCommand extends DebuggerCommand {
InfoBreakpointsCommand(Debugger debugger)
- : super(debugger, 'breakpoints', []);
+ : super(debugger, 'breakpoints', <Command>[]);
Future run(List<String> args) async {
if (debugger.isolate.breakpoints.isEmpty) {
@@ -975,7 +975,7 @@
}
class InfoFrameCommand extends DebuggerCommand {
- InfoFrameCommand(Debugger debugger) : super(debugger, 'frame', []);
+ InfoFrameCommand(Debugger debugger) : super(debugger, 'frame', <Command>[]);
Future run(List<String> args) {
if (args.length > 0) {
@@ -995,7 +995,7 @@
class IsolateCommand extends DebuggerCommand {
IsolateCommand(Debugger debugger)
- : super(debugger, 'isolate', [
+ : super(debugger, 'isolate', <Command>[
new IsolateListCommand(debugger),
new IsolateNameCommand(debugger),
]) {
@@ -1077,7 +1077,7 @@
}
class IsolateListCommand extends DebuggerCommand {
- IsolateListCommand(Debugger debugger) : super(debugger, 'list', []);
+ IsolateListCommand(Debugger debugger) : super(debugger, 'list', <Command>[]);
Future run(List<String> args) async {
if (debugger.vm == null) {
@@ -1123,7 +1123,7 @@
}
class IsolateNameCommand extends DebuggerCommand {
- IsolateNameCommand(Debugger debugger) : super(debugger, 'name', []);
+ IsolateNameCommand(Debugger debugger) : super(debugger, 'name', <Command>[]);
Future run(List<String> args) {
if (args.length != 1) {
@@ -1142,7 +1142,7 @@
class InfoCommand extends DebuggerCommand {
InfoCommand(Debugger debugger)
- : super(debugger, 'info', [
+ : super(debugger, 'info', <Command>[
new InfoBreakpointsCommand(debugger),
new InfoFrameCommand(debugger)
]);
@@ -1160,7 +1160,7 @@
}
class RefreshStackCommand extends DebuggerCommand {
- RefreshStackCommand(Debugger debugger) : super(debugger, 'stack', []);
+ RefreshStackCommand(Debugger debugger) : super(debugger, 'stack', <Command>[]);
Future run(List<String> args) {
return debugger.refreshStack();
@@ -1175,7 +1175,7 @@
class RefreshCommand extends DebuggerCommand {
RefreshCommand(Debugger debugger)
- : super(debugger, 'refresh', [
+ : super(debugger, 'refresh', <Command>[
new RefreshStackCommand(debugger),
]);
@@ -1193,7 +1193,7 @@
}
class VmListCommand extends DebuggerCommand {
- VmListCommand(Debugger debugger) : super(debugger, 'list', []);
+ VmListCommand(Debugger debugger) : super(debugger, 'list', <Command>[]);
Future run(List<String> args) async {
if (args.length > 0) {
@@ -1235,7 +1235,7 @@
}
class VmNameCommand extends DebuggerCommand {
- VmNameCommand(Debugger debugger) : super(debugger, 'name', []);
+ VmNameCommand(Debugger debugger) : super(debugger, 'name', <Command>[]);
Future run(List<String> args) async {
if (args.length != 1) {
@@ -1258,7 +1258,7 @@
class VmCommand extends DebuggerCommand {
VmCommand(Debugger debugger)
- : super(debugger, 'vm', [
+ : super(debugger, 'vm', <Command>[
new VmListCommand(debugger),
new VmNameCommand(debugger),
]);
@@ -2054,17 +2054,17 @@
final stackDiv = new DivElement()..classes = ['stack'];
final stackElement = new DebuggerStackElement(
_isolate, _debugger, stackDiv, _objects, _scripts, _events);
- stackDiv.children = [stackElement];
+ stackDiv.children = <Element>[stackElement];
final consoleDiv = new DivElement()
..classes = ['console']
- ..children = [consoleElement];
+ ..children = <Element>[consoleElement];
final commandElement = new DebuggerInputElement(_isolate, _debugger);
final commandDiv = new DivElement()
..classes = ['commandline']
- ..children = [commandElement];
+ ..children = <Element>[commandElement];
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: app.queue),
new NavVMMenuElement(app.vm, app.events, queue: app.queue),
new NavIsolateMenuElement(_isolate, app.events, queue: app.queue),
@@ -2074,10 +2074,10 @@
]),
new DivElement()
..classes = ['variable']
- ..children = [
+ ..children = <Element>[
stackDiv,
new DivElement()
- ..children = [
+ ..children = <Element>[
new HRElement()..classes = ['splitter']
],
consoleDiv,
@@ -2221,10 +2221,10 @@
var btnPause;
var btnRefresh;
- e.children = [
+ e.children = <Element>[
e._isSampled = new DivElement()
..classes = ['sampledMessage', 'hidden']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..text = 'The program is not paused. '
'The stack trace below may be out of date.',
@@ -2534,10 +2534,10 @@
content.addAll([
new DivElement()
..classes = ['frameDetails']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['flex-row-wrap']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['flex-item-script']
..children = _frame.function?.location == null
@@ -2556,7 +2556,7 @@
],
new DivElement()
..classes = ['flex-item-vars']
- ..children = [
+ ..children = <Element>[
_varsDiv = new DivElement()
..classes = ['memberList', 'frameVars']
..children = ([
@@ -2570,22 +2570,22 @@
..text = homeMethodName,
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, homeMethod.dartOwner,
_objects,
queue: _r.queue)
]
]
]..addAll(_frame.variables
- .map((v) => new DivElement()
+ .map<Element>((v) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = v.name,
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, v['value'], _objects,
queue: _r.queue)
]
@@ -2595,14 +2595,14 @@
],
new DivElement()
..classes = ['frameContractor']
- ..children = [
+ ..children = <Element>[
collapseButton = new ButtonElement()
..onClick.listen((e) async {
collapseButton.disabled = true;
await _toggleExpand();
collapseButton.disabled = false;
})
- ..children = [iconExpandLess.clone(true)]
+ ..children = <Element>[iconExpandLess.clone(true)]
]
]
]);
@@ -2611,10 +2611,10 @@
}
List<Element> _createMarkerHeader(String marker) {
- final content = [
+ final content = <Element>[
new DivElement()
..classes = ['frameSummaryText']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['frameId']
..text = 'Frame ${_frame.index}',
@@ -2629,10 +2629,10 @@
}
List<Element> _createHeader() {
- final content = [
+ final content = <Element>[
new DivElement()
..classes = ['frameSummaryText']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['frameId']
..text = 'Frame ${_frame.index}',
@@ -2658,7 +2658,7 @@
if (!_expanded) {
content.add(new DivElement()
..classes = ['frameExpander']
- ..children = [iconExpandMore.clone(true)]);
+ ..children = <Element>[iconExpandMore.clone(true)]);
}
return [
new DivElement()
@@ -2810,7 +2810,7 @@
assert(objects != null);
assert(events != null);
final DebuggerMessageElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<DebuggerMessageElement>(e, queue: queue);
e._isolate = isolate;
e._message = message;
e._objects = objects;
@@ -2851,10 +2851,10 @@
content.addAll([
new DivElement()
..classes = ['messageDetails']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['flex-row-wrap']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['flex-item-script']
..children = _message.handler == null
@@ -2871,10 +2871,10 @@
],
new DivElement()
..classes = ['flex-item-vars']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()..classes = ['memberName'],
new DivElement()
..classes = ['memberValue']
@@ -2895,14 +2895,14 @@
],
new DivElement()
..classes = ['messageContractor']
- ..children = [
+ ..children = <Element>[
collapseButton = new ButtonElement()
..onClick.listen((e) async {
collapseButton.disabled = true;
await _toggleExpand();
collapseButton.disabled = false;
})
- ..children = [iconExpandLess.clone(true)]
+ ..children = <Element>[iconExpandLess.clone(true)]
]
]
]);
@@ -2917,10 +2917,10 @@
}
List<Element> _createHeader() {
- final content = [
+ final content = <Element>[
new DivElement()
..classes = ['messageSummaryText']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['messageId']
..text = 'message ${_message.index}',
@@ -2945,7 +2945,7 @@
if (!_expanded) {
content.add(new DivElement()
..classes = ['messageExpander']
- ..children = [iconExpandMore.clone(true)]);
+ ..children = <Element>[iconExpandMore.clone(true)]);
}
return [
new DivElement()
@@ -2975,7 +2975,7 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
Future _toggleExpand() async {
@@ -3001,7 +3001,7 @@
factory DebuggerConsoleElement() {
final DebuggerConsoleElement e = document.createElement(tag.name);
- e.children = [new BRElement()];
+ e.children = <Element>[new BRElement()];
return e;
}
@@ -3133,7 +3133,7 @@
factory DebuggerInputElement(
S.Isolate isolate, ObservatoryDebugger debugger) {
final DebuggerInputElement e = document.createElement(tag.name);
- e.children = [e._modalPromptDiv, e._textBox];
+ e.children = <Element>[e._modalPromptDiv, e._textBox];
e._textBox.select();
e._textBox.onKeyDown.listen(e._onKeyDown);
return e;
@@ -3282,7 +3282,7 @@
final SvgSvgElement iconExpandLess = new SvgSvgElement()
..setAttribute('width', '24')
..setAttribute('height', '24')
- ..children = [
+ ..children = <Element>[
new PolygonElement()
..setAttribute('points', '12,8 6,14 7.4,15.4 12,10.8 16.6,15.4 18,14 ')
];
@@ -3290,7 +3290,7 @@
final SvgSvgElement iconExpandMore = new SvgSvgElement()
..setAttribute('width', '24')
..setAttribute('height', '24')
- ..children = [
+ ..children = <Element>[
new PolygonElement()
..setAttribute('points', '16.6,8.6 12,13.2 7.4,8.6 6,10 12,16 18,10 ')
];
@@ -3298,7 +3298,7 @@
final SvgSvgElement iconChevronRight = new SvgSvgElement()
..setAttribute('width', '24')
..setAttribute('height', '24')
- ..children = [
+ ..children = <Element>[
new PathElement()
..setAttribute('d', 'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z')
];
@@ -3306,7 +3306,7 @@
final SvgSvgElement iconChevronLeft = new SvgSvgElement()
..setAttribute('width', '24')
..setAttribute('height', '24')
- ..children = [
+ ..children = <Element>[
new PathElement()
..setAttribute('d', 'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z')
];
@@ -3314,7 +3314,7 @@
final SvgSvgElement iconHorizontalThreeDot = new SvgSvgElement()
..setAttribute('width', '24')
..setAttribute('height', '24')
- ..children = [
+ ..children = <Element>[
new PathElement()
..setAttribute(
'd',
@@ -3327,7 +3327,7 @@
final SvgSvgElement iconVerticalThreeDot = new SvgSvgElement()
..setAttribute('width', '24')
..setAttribute('height', '24')
- ..children = [
+ ..children = <Element>[
new PathElement()
..setAttribute(
'd',
@@ -3340,7 +3340,7 @@
final SvgSvgElement iconInfo = new SvgSvgElement()
..setAttribute('width', '24')
..setAttribute('height', '24')
- ..children = [
+ ..children = <Element>[
new PathElement()
..setAttribute(
'd',
@@ -3351,7 +3351,7 @@
final SvgSvgElement iconInfoOutline = new SvgSvgElement()
..setAttribute('width', '24')
..setAttribute('height', '24')
- ..children = [
+ ..children = <Element>[
new PathElement()
..setAttribute(
'd',
diff --git a/runtime/observatory/lib/src/elements/error_ref.dart b/runtime/observatory/lib/src/elements/error_ref.dart
index 20cc4e3..ef7f04a 100644
--- a/runtime/observatory/lib/src/elements/error_ref.dart
+++ b/runtime/observatory/lib/src/elements/error_ref.dart
@@ -40,11 +40,11 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [new PreElement()..text = error.message];
+ children = <Element>[new PreElement()..text = error.message];
}
}
diff --git a/runtime/observatory/lib/src/elements/error_view.dart b/runtime/observatory/lib/src/elements/error_view.dart
index cfc4cd959..0d1d9b8 100644
--- a/runtime/observatory/lib/src/elements/error_view.dart
+++ b/runtime/observatory/lib/src/elements/error_view.dart
@@ -37,7 +37,7 @@
assert(error != null);
assert(notifications != null);
ErrorViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ErrorViewElement>(e, queue: queue);
e._error = error;
e._notifications = notifications;
return e;
@@ -54,25 +54,25 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavNotifyElement(_notifications, queue: _r.queue)
]),
new DivElement()
..classes = ['content-centered']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()
..text = 'Error: ${_kindToString(_error.kind)}',
new BRElement(),
new DivElement()
..classes = ['well']
- ..children = [new PreElement()..text = error.message]
+ ..children = <Element>[new PreElement()..text = error.message]
],
new ViewFooterElement(queue: _r.queue)
];
diff --git a/runtime/observatory/lib/src/elements/eval_box.dart b/runtime/observatory/lib/src/elements/eval_box.dart
index 5096d75..0bf7b0c 100644
--- a/runtime/observatory/lib/src/elements/eval_box.dart
+++ b/runtime/observatory/lib/src/elements/eval_box.dart
@@ -44,7 +44,7 @@
assert(multiline != null);
assert(quickExpressions != null);
EvalBoxElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<EvalBoxElement>(e, queue: queue);
e._isolate = isolate;
e._context = context;
e._objects = objects;
@@ -66,16 +66,16 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
_results.clear();
}
void render() {
- children = [
+ children = <Element>[
new DivElement()
..classes = ['quicks']
..children = _quickExpressions
- .map((q) => new ButtonElement()
+ .map<Element>((q) => new ButtonElement()
..text = q
..onClick.listen((_) {
_expression = q;
@@ -84,14 +84,14 @@
.toList(),
new DivElement()
..classes = ['heading']
- ..children = [
+ ..children = <Element>[
new FormElement()
..autocomplete = 'on'
- ..children = [
+ ..children = <Element>[
_multiline ? _createEvalTextArea() : _createEvalTextBox(),
new SpanElement()
..classes = ['buttons']
- ..children = [
+ ..children = <Element>[
_createEvalButton(),
_createMultilineCheckbox(),
new SpanElement()..text = 'Multi-line'
@@ -100,11 +100,11 @@
],
new TableElement()
..children = _results.reversed
- .map((result) => new TableRowElement()
- ..children = [
+ .map<Element>((result) => new TableRowElement()
+ ..children = <Element>[
new TableCellElement()
..classes = ['historyExpr']
- ..children = [
+ ..children = <Element>[
new ButtonElement()
..text = result.expression
..onClick.listen((_) {
@@ -114,7 +114,7 @@
],
new TableCellElement()
..classes = ['historyValue']
- ..children = [
+ ..children = <Element>[
result.isPending
? (new SpanElement()..text = 'Pending...')
: anyRef(_isolate, result.value, _objects,
@@ -122,7 +122,7 @@
],
new TableCellElement()
..classes = ['historyDelete']
- ..children = [
+ ..children = <Element>[
new ButtonElement()
..text = '✖ Remove'
..onClick.listen((_) {
diff --git a/runtime/observatory/lib/src/elements/field_ref.dart b/runtime/observatory/lib/src/elements/field_ref.dart
index 3e6181b..ab4f170 100644
--- a/runtime/observatory/lib/src/elements/field_ref.dart
+++ b/runtime/observatory/lib/src/elements/field_ref.dart
@@ -33,7 +33,7 @@
assert(field != null);
assert(objects != null);
FieldRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<FieldRefElement>(e, queue: queue);
e._isolate = isolate;
e._field = field;
e._objects = objects;
@@ -53,7 +53,7 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
@@ -73,13 +73,13 @@
header += 'var ';
}
if (_field.declaredType.name == 'dynamic') {
- children = [
+ children = <Element>[
new SpanElement()..text = header,
new AnchorElement(href: Uris.inspect(_isolate, object: _field))
..text = _field.name
];
} else {
- children = [
+ children = <Element>[
new SpanElement()..text = header,
new InstanceRefElement(_isolate, _field.declaredType, _objects,
queue: _r.queue, expandable: _expandable),
diff --git a/runtime/observatory/lib/src/elements/field_view.dart b/runtime/observatory/lib/src/elements/field_view.dart
index be64960..27422a4 100644
--- a/runtime/observatory/lib/src/elements/field_view.dart
+++ b/runtime/observatory/lib/src/elements/field_view.dart
@@ -97,7 +97,7 @@
assert(scripts != null);
assert(objects != null);
FieldViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<FieldViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -130,7 +130,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
@@ -152,11 +152,11 @@
} else {
header += _field.declaredType.name;
}
- children = [
+ children = <Element>[
navBar(_createMenu()),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = '$header ${field.name}',
new HRElement(),
new ObjectCommonElement(_isolate, _field, _retainedSizes,
@@ -183,19 +183,18 @@
}
List<Element> _createMenu() {
- final menu = [
+ final menu = <Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue)
];
if (_library != null) {
- menu.add(new NavLibraryMenuElement(_isolate, _field.dartOwner,
- queue: _r.queue));
+ menu.add(new NavLibraryMenuElement(_isolate, _library, queue: _r.queue));
} else if (_field.dartOwner is M.ClassRef) {
menu.add(
new NavClassMenuElement(_isolate, _field.dartOwner, queue: _r.queue));
}
- menu.addAll([
+ menu.addAll(<Element>[
navMenu(_field.name),
new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) {
@@ -211,13 +210,13 @@
final members = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'owner',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
_field.dartOwner == null
? (new SpanElement()..text = '...')
: anyRef(_isolate, _field.dartOwner, _objects,
@@ -226,13 +225,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'script',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new SourceLinkElement(_isolate, field.location, _scripts,
queue: _r.queue)
]
@@ -244,7 +243,7 @@
..title = 'The types observed for this field at runtime. '
'Fields that are observed to have a single type at runtime '
'or to never be null may allow for additional optimization.'
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'observed types',
@@ -256,13 +255,13 @@
if (_field.staticValue != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'static value',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, _field.staticValue, _objects, queue: _r.queue)
]
]);
diff --git a/runtime/observatory/lib/src/elements/flag_list.dart b/runtime/observatory/lib/src/elements/flag_list.dart
index cddef85..b0ca6e1 100644
--- a/runtime/observatory/lib/src/elements/flag_list.dart
+++ b/runtime/observatory/lib/src/elements/flag_list.dart
@@ -48,7 +48,7 @@
assert(repository != null);
assert(notifications != null);
FlagListElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<FlagListElement>(e, queue: queue);
e._vm = vm;
e._events = events;
e._repository = repository;
@@ -68,7 +68,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
@@ -97,8 +97,8 @@
}
}
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
navMenu('flags', link: Uris.flags()),
@@ -138,7 +138,7 @@
new DivElement()
..classes =
flag.modified ? ['flag', 'modified'] : ['flag', 'unmodified']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['name']
..text = flag.name,
diff --git a/runtime/observatory/lib/src/elements/function_ref.dart b/runtime/observatory/lib/src/elements/function_ref.dart
index c769fde..54ace9e 100644
--- a/runtime/observatory/lib/src/elements/function_ref.dart
+++ b/runtime/observatory/lib/src/elements/function_ref.dart
@@ -39,7 +39,7 @@
assert(function != null);
assert(qualified != null);
FunctionRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<FunctionRefElement>(e, queue: queue);
e._isolate = isolate;
e._function = function;
e._qualified = qualified;
@@ -57,7 +57,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
title = '';
_r.disable(notify: true);
}
diff --git a/runtime/observatory/lib/src/elements/function_view.dart b/runtime/observatory/lib/src/elements/function_view.dart
index c3edda8..57d775a 100644
--- a/runtime/observatory/lib/src/elements/function_view.dart
+++ b/runtime/observatory/lib/src/elements/function_view.dart
@@ -103,7 +103,7 @@
assert(scripts != null);
assert(objects != null);
FunctionViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<FunctionViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -136,15 +136,15 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
navBar(_createMenu()),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Function ${_function.name}',
new HRElement(),
new ObjectCommonElement(_isolate, _function, _retainedSizes,
@@ -169,19 +169,19 @@
}
List<Element> _createMenu() {
- final menu = [
+ final menu = <Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue)
];
if (_library != null) {
- menu.add(new NavLibraryMenuElement(_isolate, _function.dartOwner,
+ menu.add(new NavLibraryMenuElement(_isolate, _library,
queue: _r.queue));
} else if (_function.dartOwner is M.ClassRef) {
menu.add(new NavClassMenuElement(_isolate, _function.dartOwner,
queue: _r.queue));
}
- menu.addAll([
+ menu.addAll(<Element>[
navMenu(_function.name),
new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) {
@@ -197,13 +197,13 @@
final members = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'kind',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..text = '${_function.isStatic ? "static ": ""}'
'${_function.isConst ? "const ": ""}'
@@ -212,13 +212,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'owner',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
_function.dartOwner == null
? (new SpanElement()..text = '...')
: anyRef(_isolate, _function.dartOwner, _objects,
@@ -229,13 +229,13 @@
if (_function.field != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'script',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new FieldRefElement(_isolate, _function.field, _objects,
queue: _r.queue)
]
@@ -243,13 +243,13 @@
}
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'script',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new SourceLinkElement(_isolate, _function.location, _scripts,
queue: _r.queue)
]
@@ -257,13 +257,13 @@
if (_function.code != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'current code',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new CodeRefElement(_isolate, _function.code, queue: _r.queue)
]
]);
@@ -271,13 +271,13 @@
if (_function.unoptimizedCode != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'unoptimized code',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new CodeRefElement(_isolate, _function.unoptimizedCode,
queue: _r.queue),
new SpanElement()
@@ -295,13 +295,13 @@
if (_function.icDataArray != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'ic data array',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new InstanceRefElement(_isolate, _function.icDataArray, _objects,
queue: _r.queue)
]
@@ -311,7 +311,7 @@
members.addAll([
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'deoptimizations',
@@ -321,7 +321,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'optimizable',
@@ -331,7 +331,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'inlinable',
@@ -341,7 +341,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'intrinsic',
@@ -351,7 +351,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'recognized',
@@ -361,7 +361,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'native',
@@ -371,7 +371,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'vm name',
diff --git a/runtime/observatory/lib/src/elements/general_error.dart b/runtime/observatory/lib/src/elements/general_error.dart
index f902da8..152df99 100644
--- a/runtime/observatory/lib/src/elements/general_error.dart
+++ b/runtime/observatory/lib/src/elements/general_error.dart
@@ -33,7 +33,7 @@
assert(notifications != null);
assert(message != null);
GeneralErrorElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<GeneralErrorElement>(e, queue: queue);
e._message = message;
e._notifications = notifications;
return e;
@@ -50,19 +50,19 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavNotifyElement(_notifications, queue: _r.queue)
]),
new DivElement()
..classes = ['content-centered']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()..text = 'Error',
new BRElement(),
new DivElement()
diff --git a/runtime/observatory/lib/src/elements/heap_map.dart b/runtime/observatory/lib/src/elements/heap_map.dart
index b2f7f81..6db1ce8 100644
--- a/runtime/observatory/lib/src/elements/heap_map.dart
+++ b/runtime/observatory/lib/src/elements/heap_map.dart
@@ -49,7 +49,7 @@
assert(events != null);
assert(notifications != null);
HeapMapElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<HeapMapElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -70,7 +70,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
CanvasElement _canvas;
@@ -102,8 +102,8 @@
// Set hover text to describe the object under the cursor.
_canvas.title = _status;
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -120,13 +120,13 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = _status,
new HRElement(),
],
new DivElement()
..classes = ['flex-row']
- ..children = [_canvas]
+ ..children = <Element>[_canvas]
];
}
@@ -169,12 +169,12 @@
return [rng.nextInt(128), rng.nextInt(128), rng.nextInt(128), 255];
}
- String _classNameAt(Point<int> point) {
+ String _classNameAt(Point<num> point) {
var color = new PixelReference(_fragmentationData, point).color;
return _classIdToName[_colorToClassId[_packColor(color)]];
}
- ObjectInfo _objectAt(Point<int> point) {
+ ObjectInfo _objectAt(Point<num> point) {
if (_fragmentation == null || _canvas == null) {
return null;
}
@@ -302,13 +302,13 @@
var _dataIndex;
static const NUM_COLOR_COMPONENTS = 4;
- PixelReference(ImageData data, Point<int> point)
+ PixelReference(ImageData data, Point<num> point)
: _data = data,
_dataIndex = (point.y * data.width + point.x) * NUM_COLOR_COMPONENTS;
PixelReference._fromDataIndex(this._data, this._dataIndex);
- Point<int> get point => new Point(index % _data.width, index ~/ _data.width);
+ Point<num> get point => new Point(index % _data.width, index ~/ _data.width);
void set color(Iterable<int> color) {
_data.data.setRange(_dataIndex, _dataIndex + NUM_COLOR_COMPONENTS, color);
diff --git a/runtime/observatory/lib/src/elements/heap_snapshot.dart b/runtime/observatory/lib/src/elements/heap_snapshot.dart
index a6b0953..3e6e455 100644
--- a/runtime/observatory/lib/src/elements/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/elements/heap_snapshot.dart
@@ -80,7 +80,7 @@
assert(snapshots != null);
assert(objects != null);
HeapSnapshotElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<HeapSnapshotElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -103,12 +103,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- final content = [
- navBar([
+ final content = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -165,10 +165,10 @@
return [
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['statusBox', 'shadow', 'center']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['statusMessage']
..text = message,
@@ -191,13 +191,13 @@
var report = <HtmlElement>[
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Refreshed ',
@@ -207,7 +207,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Objects ',
@@ -217,7 +217,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'References ',
@@ -227,7 +227,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Size ',
@@ -237,7 +237,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Roots ',
@@ -247,7 +247,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Analysis ',
@@ -329,7 +329,7 @@
static HtmlElement _createDominator(toggle) {
return new DivElement()
..classes = ['tree-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['size']
..title = 'retained size',
@@ -347,7 +347,7 @@
static HtmlElement _createMergedDominator(toggle) {
return new DivElement()
..classes = ['tree-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['size']
..title = 'retained size',
@@ -365,7 +365,7 @@
static HtmlElement _createGroup(toggle) {
return new DivElement()
..classes = ['tree-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['size']
..title = 'shallow size',
@@ -383,7 +383,7 @@
static HtmlElement _createOwnershipClass(toggle) {
return new DivElement()
..classes = ['tree-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['size']
..title = 'owned size',
@@ -430,8 +430,8 @@
return const [];
}
- void _updateDominator(
- HtmlElement element, M.HeapSnapshotDominatorNode node, int depth) {
+ void _updateDominator(HtmlElement element, nodeDynamic, int depth) {
+ M.HeapSnapshotDominatorNode node = nodeDynamic;
element.children[0].text = Utils.formatSize(node.retainedSize);
_updateLines(element.children[1].children, depth);
if (_getChildrenDominator(node).isNotEmpty) {
@@ -448,14 +448,14 @@
if (node.isStack) {
wrapper
..text = ''
- ..children = [
+ ..children = <Element>[
new AnchorElement(href: Uris.debugger(isolate))..text = 'stack frames'
];
} else {
node.object.then((object) {
wrapper
..text = ''
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, object, _objects,
queue: _r.queue, expandable: false)
];
@@ -463,8 +463,8 @@
}
}
- void _updateMergedDominator(
- HtmlElement element, M.HeapSnapshotMergedDominatorNode node, int depth) {
+ void _updateMergedDominator(HtmlElement element, nodeDynamic, int depth) {
+ M.HeapSnapshotMergedDominatorNode node = nodeDynamic;
element.children[0].text = Utils.formatSize(node.retainedSize);
_updateLines(element.children[1].children, depth);
if (_getChildrenMergedDominator(node).isNotEmpty) {
@@ -481,14 +481,14 @@
if (node.isStack) {
wrapper
..text = ''
- ..children = [
+ ..children = <Element>[
new AnchorElement(href: Uris.debugger(isolate))..text = 'stack frames'
];
} else {
node.klass.then((klass) {
wrapper
..text = ''
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = '${node.instanceCount} instances of ',
anyRef(_isolate, klass, _objects,
queue: _r.queue, expandable: false)
@@ -535,12 +535,12 @@
if (item is M.HeapSnapshotClassInbound) {
element.children[3].text =
'${item.count} references from instances of ';
- element.children[4].children = [
+ element.children[4].children = <Element>[
new ClassRefElement(_isolate, item.source, queue: _r.queue)
];
} else if (item is M.HeapSnapshotClassOutbound) {
element.children[3]..text = '${item.count} references to instances of ';
- element.children[4].children = [
+ element.children[4].children = <Element>[
new ClassRefElement(_isolate, item.target, queue: _r.queue)
];
}
@@ -554,7 +554,7 @@
Utils.formatPercentNormalized(item.size * 1.0 / _snapshot.size);
element.children[2] = new SpanElement()
..classes = ['name']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = ' instances of ',
new ClassRefElement(_isolate, item.clazz, queue: _r.queue)
..classes = ['name']
diff --git a/runtime/observatory/lib/src/elements/helpers/nav_bar.dart b/runtime/observatory/lib/src/elements/helpers/nav_bar.dart
index f15acfa..050041b 100644
--- a/runtime/observatory/lib/src/elements/helpers/nav_bar.dart
+++ b/runtime/observatory/lib/src/elements/helpers/nav_bar.dart
@@ -8,7 +8,7 @@
assert(content != null);
return document.createElement('nav')
..classes = ['nav-bar']
- ..children = [
+ ..children = <Element>[
new UListElement()..children = content,
];
}
diff --git a/runtime/observatory/lib/src/elements/helpers/nav_menu.dart b/runtime/observatory/lib/src/elements/helpers/nav_menu.dart
index a23f109..02cf8ef 100644
--- a/runtime/observatory/lib/src/elements/helpers/nav_menu.dart
+++ b/runtime/observatory/lib/src/elements/helpers/nav_menu.dart
@@ -9,10 +9,10 @@
assert(content != null);
return new LIElement()
..classes = ['nav-menu']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['nav-menu_label']
- ..children = [
+ ..children = <Element>[
new AnchorElement(href: link)..text = label,
new UListElement()..children = content
]
diff --git a/runtime/observatory/lib/src/elements/icdata_ref.dart b/runtime/observatory/lib/src/elements/icdata_ref.dart
index 613118c..5a4f4d7 100644
--- a/runtime/observatory/lib/src/elements/icdata_ref.dart
+++ b/runtime/observatory/lib/src/elements/icdata_ref.dart
@@ -27,7 +27,7 @@
assert(isolate != null);
assert(icdata != null);
ICDataRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ICDataRefElement>(e, queue: queue);
e._isolate = isolate;
e._icdata = icdata;
return e;
@@ -45,13 +45,13 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _icdata))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = 'ICData',
diff --git a/runtime/observatory/lib/src/elements/icdata_view.dart b/runtime/observatory/lib/src/elements/icdata_view.dart
index 58e7bca..3729a73 100644
--- a/runtime/observatory/lib/src/elements/icdata_view.dart
+++ b/runtime/observatory/lib/src/elements/icdata_view.dart
@@ -78,7 +78,7 @@
assert(retainingPaths != null);
assert(objects != null);
ICDataViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ICDataViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -105,12 +105,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -125,7 +125,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'ICData',
new HRElement(),
new ObjectCommonElement(_isolate, _icdata, _retainedSizes,
@@ -133,10 +133,10 @@
queue: _r.queue),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'selector',
@@ -146,13 +146,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'owner',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
_icdata.dartOwner == null
? (new SpanElement()..text = '<none>')
: anyRef(_isolate, _icdata.dartOwner, _objects,
@@ -161,13 +161,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'argumentsDescriptor',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
_icdata.argumentsDescriptor == null
? (new SpanElement()..text = '<none>')
: anyRef(
@@ -177,13 +177,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'entries',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
_icdata.entries == null
? (new SpanElement()..text = '<none>')
: anyRef(_isolate, _icdata.entries, _objects,
diff --git a/runtime/observatory/lib/src/elements/inbound_references.dart b/runtime/observatory/lib/src/elements/inbound_references.dart
index f58724f..bfd9d29 100644
--- a/runtime/observatory/lib/src/elements/inbound_references.dart
+++ b/runtime/observatory/lib/src/elements/inbound_references.dart
@@ -38,7 +38,7 @@
assert(references != null);
assert(objects != null);
InboundReferencesElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<InboundReferencesElement>(e, queue: queue);
e._isolate = isolate;
e._object = object;
e._references = references;
@@ -57,7 +57,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
@@ -73,7 +73,7 @@
e.control.disabled = false;
}
});
- children = [curlyBlock];
+ children = <Element>[curlyBlock];
_r.waitFor([curlyBlock.onRendered.first]);
}
@@ -86,7 +86,7 @@
if (_inbounds == null) {
return const [];
}
- return _inbounds.elements.map(_createItem).toList();
+ return _inbounds.elements.map<Element>(_createItem).toList();
}
Element _createItem(M.InboundReference reference) {
diff --git a/runtime/observatory/lib/src/elements/instance_ref.dart b/runtime/observatory/lib/src/elements/instance_ref.dart
index 748acbe..9130e69 100644
--- a/runtime/observatory/lib/src/elements/instance_ref.dart
+++ b/runtime/observatory/lib/src/elements/instance_ref.dart
@@ -38,7 +38,7 @@
assert(instance != null);
assert(objects != null);
InstanceRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<InstanceRefElement>(e, queue: queue);
e._isolate = isolate;
e._instance = instance;
e._objects = objects;
@@ -57,7 +57,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
@@ -68,7 +68,7 @@
content.addAll([
new SpanElement()..text = ' ',
new CurlyBlockElement(expanded: _expanded, queue: _r.queue)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['indent']
..children = _createValue()
@@ -136,7 +136,7 @@
case M.InstanceKind.closure:
return [
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = 'Closure',
@@ -146,7 +146,7 @@
case M.InstanceKind.regExp:
return [
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = _instance.clazz.name,
@@ -156,7 +156,7 @@
case M.InstanceKind.stackTrace:
return [
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = _instance.clazz.name,
@@ -186,7 +186,7 @@
case M.InstanceKind.float64x2List:
return [
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = _instance.clazz.name,
@@ -245,24 +245,30 @@
}
switch (_instance.kind) {
case M.InstanceKind.closure:
- return [
- new DivElement()
- ..children = [
- new SpanElement()..text = 'function = ',
- anyRef(_isolate, _loadedInstance.closureFunction, _objects,
- queue: _r.queue)
- ],
- new DivElement()
- ..children = [
- new SpanElement()..text = 'context = ',
- anyRef(_isolate, _loadedInstance.closureContext, _objects,
- queue: _r.queue)
- ],
- ];
+ {
+ var members = <Element>[];
+ if (_loadedInstance.closureFunction != null) {
+ members.add(new DivElement()
+ ..children = <Element>[
+ new SpanElement()..text = 'function = ',
+ anyRef(_isolate, _loadedInstance.closureFunction, _objects,
+ queue: _r.queue)
+ ]);
+ }
+ if (_loadedInstance.closureContext != null) {
+ members.add(new DivElement()
+ ..children = <Element>[
+ new SpanElement()..text = 'context = ',
+ anyRef(_isolate, _loadedInstance.closureContext, _objects,
+ queue: _r.queue)
+ ]);
+ }
+ return members;
+ }
case M.InstanceKind.plainInstance:
return _loadedInstance.fields
- .map((f) => new DivElement()
- ..children = [
+ .map<Element>((f) => new DivElement()
+ ..children = <Element>[
new FieldRefElement(_isolate, f.decl, _objects,
queue: _r.queue),
new SpanElement()..text = ' = ',
@@ -273,7 +279,7 @@
var index = 0;
return _loadedInstance.elements
.map<Element>((element) => new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = '[ ${index++} ] : ',
anyRef(_isolate, element, _objects, queue: _r.queue)
])
@@ -282,7 +288,7 @@
case M.InstanceKind.map:
return _loadedInstance.associations
.map<Element>((association) => new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = '[ ',
anyRef(_isolate, association.key, _objects, queue: _r.queue),
new SpanElement()..text = ' ] : ',
diff --git a/runtime/observatory/lib/src/elements/instance_view.dart b/runtime/observatory/lib/src/elements/instance_view.dart
index 85df20b..174af31 100644
--- a/runtime/observatory/lib/src/elements/instance_view.dart
+++ b/runtime/observatory/lib/src/elements/instance_view.dart
@@ -118,7 +118,7 @@
assert(breakpoints != null);
assert(functions != null);
InstanceViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<InstanceViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -151,11 +151,11 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- final content = [
+ final content = <Element>[
new HeadingElement.h2()
..text = M.isAbstractType(_instance.kind)
? 'type ${_instance.name}'
@@ -181,7 +181,7 @@
]);
}
content.addAll([new HRElement(), new ViewFooterElement(queue: _r.queue)]);
- children = [
+ children = <Element>[
navBar(_createMenu()),
new DivElement()
..classes = ['content-centered-big']
@@ -190,7 +190,7 @@
}
List<Element> _createMenu() {
- final menu = [
+ final menu = <Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue)
@@ -198,7 +198,7 @@
if (_library != null) {
menu.add(new NavLibraryMenuElement(_isolate, _library, queue: _r.queue));
}
- menu.addAll([
+ menu.addAll(<Element>[
new NavClassMenuElement(_isolate, _instance.clazz, queue: _r.queue),
navMenu('instance'),
new NavRefreshElement(queue: _r.queue)
@@ -216,7 +216,7 @@
if (_instance.valueAsString != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = _instance.kind == M.InstanceKind.string
@@ -233,13 +233,13 @@
if (_instance.typeClass != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'type class',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new ClassRefElement(_isolate, _instance.typeClass,
queue: _r.queue)
]
@@ -248,7 +248,7 @@
if (_typeArguments != null && _typeArguments.types.isNotEmpty) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'type arguments',
@@ -267,13 +267,13 @@
if (_instance.parameterizedClass != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'parameterized class',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new ClassRefElement(_isolate, _instance.parameterizedClass,
queue: _r.queue)
]
@@ -282,7 +282,7 @@
if (_instance.parameterIndex != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'parameter index',
@@ -294,13 +294,13 @@
if (_instance.targetType != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'target type',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new InstanceRefElement(_isolate, _instance.targetType, _objects,
queue: _r.queue)
]
@@ -309,13 +309,13 @@
if (_instance.bound != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'bound',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new InstanceRefElement(_isolate, _instance.bound, _objects,
queue: _r.queue)
]
@@ -324,13 +324,13 @@
if (_instance.closureFunction != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'closure function',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new FunctionRefElement(_isolate, _instance.closureFunction,
queue: _r.queue)
]
@@ -339,13 +339,13 @@
if (_instance.closureContext != null) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'closure context',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new ContextRefElement(
_isolate, _instance.closureContext, _objects,
queue: _r.queue)
@@ -356,13 +356,13 @@
ButtonElement btn;
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'closure breakpoint',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
btn = new ButtonElement()
..text = _instance.activationBreakpoint == null
? 'break on activation'
@@ -379,23 +379,23 @@
int i = 0;
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'native fields (${_instance.nativeFields.length})',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new CurlyBlockElement(
expanded: _instance.nativeFields.length <= 100,
queue: _r.queue)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['memberList']
..children = _instance.nativeFields
- .map((f) => new DivElement()
+ .map<Element>((f) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = '[ ${i++} ]',
@@ -413,31 +413,31 @@
final fields = _instance.fields.toList();
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'fields (${fields.length})',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new CurlyBlockElement(
expanded: fields.length <= 100, queue: _r.queue)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['memberList']
..children = fields
- .map((f) => new DivElement()
+ .map<Element>((f) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new FieldRefElement(_isolate, f.decl, _objects,
queue: _r.queue)
],
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = ' = ',
anyRef(_isolate, f.value, _objects,
queue: _r.queue)
@@ -454,28 +454,28 @@
int i = 0;
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'elements (${_instance.length})',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new CurlyBlockElement(
expanded: elements.length <= 100, queue: _r.queue)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['memberList']
..children = elements
- .map((element) => new DivElement()
+ .map<Element>((element) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = '[ ${i++} ]',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, element, _objects,
queue: _r.queue)
]
@@ -487,7 +487,7 @@
if (_instance.length != elements.length) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = '...',
@@ -502,25 +502,25 @@
final associations = _instance.associations.toList();
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'associations (${_instance.length})',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new CurlyBlockElement(
expanded: associations.length <= 100, queue: _r.queue)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['memberList']
..children = associations
- .map((a) => new DivElement()
+ .map<Element>((a) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = '[ ',
anyRef(_isolate, a.key, _objects,
queue: _r.queue),
@@ -528,7 +528,7 @@
],
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, a.value, _objects,
queue: _r.queue)
]
@@ -540,7 +540,7 @@
if (_instance.length != associations.length) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = '...',
@@ -557,22 +557,22 @@
int i = 0;
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'elements (${_instance.length})',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new CurlyBlockElement(
expanded: typedElements.length <= 100, queue: _r.queue)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['memberList']
..children = typedElements
- .map((e) => new DivElement()
+ .map<Element>((e) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = '[ ${i++} ]',
@@ -587,7 +587,7 @@
if (_instance.length != typedElements.length) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = '...',
@@ -603,19 +603,19 @@
members.addAll([
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'pattern',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, _instance.pattern, _objects, queue: _r.queue)
]
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'isCaseSensitive',
@@ -625,7 +625,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'isMultiLine',
@@ -635,39 +635,39 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'oneByteFunction',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new FunctionRefElement(_isolate, _instance.oneByteFunction,
queue: _r.queue)
]
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'twoByteFunction',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new FunctionRefElement(_isolate, _instance.twoByteFunction,
queue: _r.queue)
]
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'externalOneByteFunction',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new FunctionRefElement(
_isolate, _instance.externalOneByteFunction,
queue: _r.queue)
@@ -675,13 +675,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'externalTwoByteFunction',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new FunctionRefElement(
_isolate, _instance.externalTwoByteFunction,
queue: _r.queue)
@@ -689,13 +689,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'oneByteBytecode',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new InstanceRefElement(
_isolate, _instance.oneByteBytecode, _objects,
queue: _r.queue)
@@ -703,13 +703,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'twoByteBytecode',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new InstanceRefElement(
_isolate, _instance.twoByteBytecode, _objects,
queue: _r.queue)
@@ -721,13 +721,13 @@
if (_instance.kind == M.InstanceKind.mirrorReference) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'referent',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, _instance.referent, _objects, queue: _r.queue)
]
]);
@@ -736,26 +736,26 @@
members.addAll([
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'key',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new InstanceRefElement(_isolate, _instance.key, _objects,
queue: _r.queue),
]
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'value',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new InstanceRefElement(_isolate, _instance.value, _objects,
queue: _r.queue),
]
diff --git a/runtime/observatory/lib/src/elements/isolate/counter_chart.dart b/runtime/observatory/lib/src/elements/isolate/counter_chart.dart
index b3917ec..37f8098 100644
--- a/runtime/observatory/lib/src/elements/isolate/counter_chart.dart
+++ b/runtime/observatory/lib/src/elements/isolate/counter_chart.dart
@@ -24,7 +24,7 @@
factory IsolateCounterChartElement(Map counters, {RenderingQueue queue}) {
assert(counters != null);
IsolateCounterChartElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<IsolateCounterChartElement>(e, queue: queue);
e._counters = counters;
return e;
}
@@ -41,7 +41,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
_subscription.cancel();
}
@@ -58,7 +58,7 @@
];
final areaHost = new DivElement()..classes = ['host'];
final legendHost = new DivElement()..classes = ['legend'];
- children = [areaHost, legendHost];
+ children = <Element>[areaHost, legendHost];
final rect = areaHost.getBoundingClientRect();
final minSize = new Rect.size(rect.width, rect.height);
final config = new ChartConfig(_series, const [0])
diff --git a/runtime/observatory/lib/src/elements/isolate/location.dart b/runtime/observatory/lib/src/elements/isolate/location.dart
index 6f565ce..161917e 100644
--- a/runtime/observatory/lib/src/elements/isolate/location.dart
+++ b/runtime/observatory/lib/src/elements/isolate/location.dart
@@ -31,7 +31,7 @@
assert(events != null);
assert(scripts != null);
IsolateLocationElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<IsolateLocationElement>(e, queue: queue);
e._isolate = isolate;
e._events = events;
e._scripts = scripts;
@@ -51,7 +51,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
_debugSubscription.cancel();
_isolateSubscription.cancel();
@@ -60,10 +60,10 @@
void render() {
switch (_isolate.status) {
case M.IsolateStatus.loading:
- children = [new SpanElement()..text = 'not yet runnable'];
+ children = <Element>[new SpanElement()..text = 'not yet runnable'];
break;
case M.IsolateStatus.running:
- children = [
+ children = <Element>[
new SpanElement()..text = 'at ',
new FunctionRefElement(
_isolate, M.topFrame(_isolate.pauseEvent).function,
@@ -77,11 +77,11 @@
break;
case M.IsolateStatus.paused:
if (_isolate.pauseEvent is M.PauseStartEvent) {
- children = [new SpanElement()..text = 'at isolate start'];
+ children = <Element>[new SpanElement()..text = 'at isolate start'];
} else if (_isolate.pauseEvent is M.PauseExitEvent) {
- children = [new SpanElement()..text = 'at isolate exit'];
+ children = <Element>[new SpanElement()..text = 'at isolate exit'];
} else if (_isolate.pauseEvent is M.NoneEvent) {
- children = [new SpanElement()..text = 'not yet runnable'];
+ children = <Element>[new SpanElement()..text = 'not yet runnable'];
} else {
final content = <Element>[];
if (_isolate.pauseEvent is M.PauseBreakpointEvent) {
diff --git a/runtime/observatory/lib/src/elements/isolate/run_state.dart b/runtime/observatory/lib/src/elements/isolate/run_state.dart
index 0919cee..6dfc005 100644
--- a/runtime/observatory/lib/src/elements/isolate/run_state.dart
+++ b/runtime/observatory/lib/src/elements/isolate/run_state.dart
@@ -25,7 +25,7 @@
assert(isolate != null);
assert(events != null);
IsolateRunStateElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<IsolateRunStateElement>(e, queue: queue);
e._isolate = isolate;
e._events = events;
return e;
@@ -44,7 +44,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
_debugSubscription.cancel();
_isolateSubscription.cancel();
@@ -53,16 +53,16 @@
void render() {
switch (_isolate.status) {
case M.IsolateStatus.loading:
- children = [new SpanElement()..text = 'loading... '];
+ children = <Element>[new SpanElement()..text = 'loading... '];
break;
case M.IsolateStatus.running:
- children = [new SpanElement()..text = 'running '];
+ children = <Element>[new SpanElement()..text = 'running '];
break;
case M.IsolateStatus.idle:
- children = [new SpanElement()..text = 'idle '];
+ children = <Element>[new SpanElement()..text = 'idle '];
break;
case M.IsolateStatus.paused:
- children = [
+ children = <Element>[
new SpanElement()
..title = '${_isolate.pauseEvent.timestamp}'
..text = 'paused '
diff --git a/runtime/observatory/lib/src/elements/isolate/shared_summary.dart b/runtime/observatory/lib/src/elements/isolate/shared_summary.dart
index e13e8ad..be163f2 100644
--- a/runtime/observatory/lib/src/elements/isolate/shared_summary.dart
+++ b/runtime/observatory/lib/src/elements/isolate/shared_summary.dart
@@ -31,7 +31,7 @@
assert(isolate != null);
assert(events != null);
IsolateSharedSummaryElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<IsolateSharedSummaryElement>(e, queue: queue);
e._isolate = isolate;
e._events = events;
return e;
@@ -49,7 +49,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
_isolateSubscription.cancel();
}
@@ -59,16 +59,16 @@
final newHeapCapacity = Utils.formatSize(_isolate.newSpace.capacity);
final oldHeapUsed = Utils.formatSize(_isolate.oldSpace.used);
final oldHeapCapacity = Utils.formatSize(_isolate.oldSpace.capacity);
- final content = [
+ final content = <Element>[
new DivElement()
..classes = ['menu']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'new heap',
@@ -78,7 +78,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'old heap',
@@ -89,63 +89,63 @@
],
new BRElement(),
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.debugger(_isolate))..text = 'debug'
],
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.classTree(_isolate))
..text = 'class hierarchy'
],
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.cpuProfiler(_isolate))
..text = 'cpu profile'
],
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.cpuProfilerTable(_isolate))
..text = 'cpu profile (table)'
],
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.allocationProfiler(_isolate))
..text = 'allocation profile'
],
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.heapSnapshot(_isolate))
..text = 'heap snapshot'
],
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.heapMap(_isolate))..text = 'heap map'
],
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.metrics(_isolate))..text = 'metrics'
],
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.persistentHandles(_isolate))
..text = 'persistent handles'
],
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.ports(_isolate))..text = 'ports'
],
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.logging(_isolate))..text = 'logging'
]
@@ -153,7 +153,7 @@
new IsolateCounterChartElement(_isolate.counters, queue: _r.queue)
];
if (_isolate.error != null) {
- children = [
+ children = <Element>[
new PreElement()
..classes = ['errorBox']
..text = _isolate.error.message,
@@ -162,7 +162,7 @@
..children = content
];
} else {
- children = [
+ children = <Element>[
new DivElement()
..classes = ['summary']
..children = content
diff --git a/runtime/observatory/lib/src/elements/isolate/summary.dart b/runtime/observatory/lib/src/elements/isolate/summary.dart
index 0943996..434e1fa 100644
--- a/runtime/observatory/lib/src/elements/isolate/summary.dart
+++ b/runtime/observatory/lib/src/elements/isolate/summary.dart
@@ -43,7 +43,7 @@
assert(events != null);
assert(scripts != null);
IsolateSummaryElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<IsolateSummaryElement>(e, queue: queue);
e._isolate = isolate;
e._isolates = isolates;
e._events = events;
@@ -63,30 +63,30 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
if (_loadedIsolate == null) {
- children = [
+ children = <Element>[
new SpanElement()..text = 'loading ',
new IsolateRefElement(_isolate, _events, queue: _r.queue)
];
} else {
- children = [
+ children = <Element>[
new DivElement()
..classes = ['flex-row']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['isolate-ref-container']
- ..children = [
+ ..children = <Element>[
new IsolateRefElement(_isolate, _events, queue: _r.queue)
],
new DivElement()..style.flex = '1',
new DivElement()
..classes = ['flex-row', 'isolate-state-container']
- ..children = [
+ ..children = <Element>[
new IsolateRunStateElement(_isolate, _events, queue: _r.queue),
new IsolateLocationElement(_isolate, _events, _scripts,
queue: _r.queue),
diff --git a/runtime/observatory/lib/src/elements/isolate_reconnect.dart b/runtime/observatory/lib/src/elements/isolate_reconnect.dart
index 49032c8..0820d41 100644
--- a/runtime/observatory/lib/src/elements/isolate_reconnect.dart
+++ b/runtime/observatory/lib/src/elements/isolate_reconnect.dart
@@ -48,7 +48,7 @@
assert(uri != null);
assert(notifications != null);
IsolateReconnectElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<IsolateReconnectElement>(e, queue: queue);
e._vm = vm;
e._events = events;
e._missing = missing;
@@ -72,32 +72,32 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
_subscription.cancel();
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavNotifyElement(_notifications, queue: _r.queue)
]),
new DivElement()
..classes = ['content-centered']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()..text = 'Isolate $_missing no longer exists',
new HRElement(),
new BRElement(),
new DivElement()
..classes = ['memberList']
- ..children = (_vm.isolates.map((isolate) {
- final query = new Map.from(_uri.queryParameters);
+ ..children = (_vm.isolates.map<Element>((isolate) {
+ final query = new Map<String, dynamic>.from(_uri.queryParameters);
query['isolateId'] = isolate.id;
final href = new Uri(path: _uri.path, queryParameters: query);
return new DivElement()
..classes = ['memberItem', 'doubleSpaced']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'Continue in ',
new AnchorElement(href: '#$href')
..classes = ['isolate-link']
@@ -106,7 +106,7 @@
}).toList()
..add(new DivElement()
..classes = ['memberItem', 'doubleSpaced']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'Go to ',
new AnchorElement(href: Uris.vm())..text = 'isolates summary',
]))
diff --git a/runtime/observatory/lib/src/elements/isolate_ref.dart b/runtime/observatory/lib/src/elements/isolate_ref.dart
index 3b32c18..49a2182 100644
--- a/runtime/observatory/lib/src/elements/isolate_ref.dart
+++ b/runtime/observatory/lib/src/elements/isolate_ref.dart
@@ -29,7 +29,7 @@
assert(isolate != null);
assert(events != null);
IsolateRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<IsolateRefElement>(e, queue: queue);
e._isolate = isolate;
e._events = events;
return e;
@@ -52,13 +52,13 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
_updatesSubscription.cancel();
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(isolate))
..text = 'Isolate ${isolate.number} (${isolate.name})'
..classes = ['isolate-ref']
diff --git a/runtime/observatory/lib/src/elements/isolate_view.dart b/runtime/observatory/lib/src/elements/isolate_view.dart
index e199135..01f5b60 100644
--- a/runtime/observatory/lib/src/elements/isolate_view.dart
+++ b/runtime/observatory/lib/src/elements/isolate_view.dart
@@ -96,7 +96,7 @@
assert(eval != null);
assert(libraries != null);
IsolateViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<IsolateViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -129,7 +129,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
_subscription.cancel();
}
@@ -137,8 +137,8 @@
final uptime = new DateTime.now().difference(_isolate.startTime);
final libraries = _isolate.libraries.toList();
final List<M.Thread> threads = _isolate.threads;
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -159,15 +159,15 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Isolate ${_isolate.name}',
new BRElement(),
new DivElement()
..classes = ['flex-row']
- ..children = [
+ ..children = <Element>[
new DivElement()..style.flex = '1',
new DivElement()
- ..children = [
+ ..children = <Element>[
new IsolateRunStateElement(_isolate, _events,
queue: _r.queue),
new IsolateLocationElement(_isolate, _events, _scripts,
@@ -195,10 +195,10 @@
new HRElement(),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'started at',
@@ -208,7 +208,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'uptime',
@@ -218,13 +218,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'root library',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
_isolate.rootLibrary == null
? (new SpanElement()..text = 'loading...')
: new LibraryRefElement(
@@ -241,7 +241,7 @@
..text = 'entry',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new FunctionRefElement(_isolate, _isolate.entry,
queue: _r.queue)
]
@@ -249,7 +249,7 @@
: const [],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'isolate id',
@@ -259,7 +259,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'service protocol extensions',
@@ -269,7 +269,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'allocated zone handle count',
@@ -279,7 +279,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'allocated scoped handle count',
@@ -289,20 +289,20 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'object store',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new AnchorElement(href: Uris.objectStore(_isolate))
..text = 'object store'
]
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'zone capacity high watermark'
@@ -316,17 +316,17 @@
new BRElement(),
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'libraries (${libraries.length})',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new CurlyBlockElement(queue: _r.queue)
..content = libraries
- .map((l) => new DivElement()
- ..children = [
+ .map<Element>((l) => new DivElement()
+ ..children = <Element>[
new LibraryRefElement(_isolate, l,
queue: _r.queue)
])
@@ -335,15 +335,15 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'threads (${threads.length})',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new CurlyBlockElement(queue: _r.queue)
- ..content = threads.map(_populateThreadInfo)
+ ..content = threads.map<Element>(_populateThreadInfo)
]
]
],
@@ -368,10 +368,10 @@
DivElement _populateThreadInfo(M.Thread t) {
return new DivElement()
..classes = ['indent']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = '${t.id} ',
new CurlyBlockElement(queue: _r.queue)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['indent']
..text = 'kind ${t.kindString}',
diff --git a/runtime/observatory/lib/src/elements/json_view.dart b/runtime/observatory/lib/src/elements/json_view.dart
index 5ce987b..6b452ef 100644
--- a/runtime/observatory/lib/src/elements/json_view.dart
+++ b/runtime/observatory/lib/src/elements/json_view.dart
@@ -37,7 +37,7 @@
assert(notifications != null);
assert(map != null);
JSONViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<JSONViewElement>(e, queue: queue);
e._notifications = notifications;
e._map = map;
return e;
@@ -55,18 +55,18 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavNotifyElement(_notifications, queue: _r.queue)
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Object',
new HRElement(),
new PreElement()..text = JSONPretty.stringify(_map),
diff --git a/runtime/observatory/lib/src/elements/library_ref.dart b/runtime/observatory/lib/src/elements/library_ref.dart
index fbc396b..dcfe17a 100644
--- a/runtime/observatory/lib/src/elements/library_ref.dart
+++ b/runtime/observatory/lib/src/elements/library_ref.dart
@@ -29,7 +29,7 @@
assert(isolate != null);
assert(library != null);
LibraryRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<LibraryRefElement>(e, queue: queue);
e._isolate = isolate;
e._library = library;
return e;
@@ -47,12 +47,12 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
final name = _library.name;
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _library))
..text = (name == null || name.isEmpty) ? 'unnamed' : name
];
diff --git a/runtime/observatory/lib/src/elements/library_view.dart b/runtime/observatory/lib/src/elements/library_view.dart
index 5da66e9..2f9f2d4 100644
--- a/runtime/observatory/lib/src/elements/library_view.dart
+++ b/runtime/observatory/lib/src/elements/library_view.dart
@@ -105,7 +105,7 @@
assert(objects != null);
assert(eval != null);
LibraryViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<LibraryViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -136,12 +136,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -155,7 +155,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Library',
new HRElement(),
new ObjectCommonElement(_isolate, _library, _retainedSizes,
@@ -163,10 +163,10 @@
queue: _r.queue),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'uri',
@@ -176,7 +176,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'vm name',
@@ -223,13 +223,13 @@
}
final dependencies = _library.dependencies.toList();
return new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'dependencies (${dependencies.length}) ',
new CurlyBlockElement(queue: _r.queue)
..content = dependencies
- .map((d) => new DivElement()
+ .map<Element>((d) => new DivElement()
..classes = ['indent']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = d.isImport ? 'import ' : 'export ',
new LibraryRefElement(_isolate, d.target, queue: _r.queue),
new SpanElement()
@@ -246,13 +246,13 @@
}
final scripts = _library.scripts.toList();
return new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'scripts (${scripts.length}) ',
new CurlyBlockElement(queue: _r.queue)
..content = scripts
- .map((s) => new DivElement()
+ .map<Element>((s) => new DivElement()
..classes = ['indent']
- ..children = [
+ ..children = <Element>[
new ScriptRefElement(_isolate, s, queue: _r.queue)
])
.toList()
@@ -265,13 +265,13 @@
}
final classes = _library.classes.toList();
return new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'classes (${classes.length}) ',
new CurlyBlockElement(queue: _r.queue)
..content = classes
- .map((c) => new DivElement()
+ .map<Element>((c) => new DivElement()
..classes = ['indent']
- ..children = [
+ ..children = <Element>[
new ClassRefElement(_isolate, c, queue: _r.queue)
])
.toList()
@@ -284,27 +284,27 @@
}
final variables = _library.variables.toList();
return new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'variables (${variables.length}) ',
new CurlyBlockElement(queue: _r.queue)
- ..content = [
+ ..content = <Element>[
_variables == null
? (new SpanElement()..text = 'loading...')
: (new DivElement()
..classes = ['indent', 'memberList']
..children = _variables
- .map((f) => new DivElement()
+ .map<Element>((f) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new FieldRefElement(_isolate, f, _objects,
queue: _r.queue)
],
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = ' = ',
anyRef(_isolate, f.staticValue, _objects,
queue: _r.queue)
@@ -321,13 +321,13 @@
}
final functions = _library.functions.toList();
return new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'functions (${functions.length}) ',
new CurlyBlockElement(queue: _r.queue)
..content = functions
- .map((f) => new DivElement()
+ .map<Element>((f) => new DivElement()
..classes = ['indent']
- ..children = [
+ ..children = <Element>[
new FunctionRefElement(_isolate, f, queue: _r.queue)
])
.toList()
diff --git a/runtime/observatory/lib/src/elements/local_var_descriptors_ref.dart b/runtime/observatory/lib/src/elements/local_var_descriptors_ref.dart
index ce3981c..578a148 100644
--- a/runtime/observatory/lib/src/elements/local_var_descriptors_ref.dart
+++ b/runtime/observatory/lib/src/elements/local_var_descriptors_ref.dart
@@ -30,7 +30,8 @@
assert(isolate != null);
assert(localVar != null);
LocalVarDescriptorsRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r =
+ new RenderingScheduler<LocalVarDescriptorsRefElement>(e, queue: queue);
e._isolate = isolate;
e._localVar = localVar;
return e;
@@ -48,14 +49,14 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
final text = (_localVar.name == null || _localVar.name == '')
? 'LocalVarDescriptors'
: _localVar.name;
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _localVar))
..text = text
];
diff --git a/runtime/observatory/lib/src/elements/logging.dart b/runtime/observatory/lib/src/elements/logging.dart
index 5350a30..8e168fa 100644
--- a/runtime/observatory/lib/src/elements/logging.dart
+++ b/runtime/observatory/lib/src/elements/logging.dart
@@ -56,7 +56,7 @@
assert(events != null);
assert(notifications != null);
LoggingPageElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<LoggingPageElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -76,7 +76,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
LoggingListElement _logs;
@@ -84,8 +84,8 @@
void render() {
_logs = _logs ?? new LoggingListElement(_isolate, _events);
_logs.level = _level;
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -100,7 +100,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Logging',
new SpanElement()..text = 'Show messages with severity ',
_createLevelSelector(),
diff --git a/runtime/observatory/lib/src/elements/logging_list.dart b/runtime/observatory/lib/src/elements/logging_list.dart
index 8b8b77d..ac9c728 100644
--- a/runtime/observatory/lib/src/elements/logging_list.dart
+++ b/runtime/observatory/lib/src/elements/logging_list.dart
@@ -33,7 +33,7 @@
assert(isolate != null);
assert(events != null);
LoggingListElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<LoggingListElement>(e, queue: queue);
e._isolate = isolate;
e._events = events;
return e;
@@ -59,16 +59,16 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
_subscription.cancel();
}
void render() {
children = _logs
.where(_shouldBeVisible)
- .map((logRecord) => new DivElement()
+ .map<Element>((logRecord) => new DivElement()
..classes = ['logItem', logRecord['level'].name]
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['level']
..text = logRecord['level'].name,
diff --git a/runtime/observatory/lib/src/elements/megamorphiccache_ref.dart b/runtime/observatory/lib/src/elements/megamorphiccache_ref.dart
index 36a4aa9..b7eb6c2 100644
--- a/runtime/observatory/lib/src/elements/megamorphiccache_ref.dart
+++ b/runtime/observatory/lib/src/elements/megamorphiccache_ref.dart
@@ -31,7 +31,7 @@
assert(isolate != null);
assert(cache != null);
MegamorphicCacheRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<MegamorphicCacheRefElement>(e, queue: queue);
e._isolate = isolate;
e._cache = cache;
return e;
@@ -49,13 +49,13 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _cache))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = 'MegarmorphicCache',
diff --git a/runtime/observatory/lib/src/elements/megamorphiccache_view.dart b/runtime/observatory/lib/src/elements/megamorphiccache_view.dart
index d3f1ccf..5a35092 100644
--- a/runtime/observatory/lib/src/elements/megamorphiccache_view.dart
+++ b/runtime/observatory/lib/src/elements/megamorphiccache_view.dart
@@ -84,7 +84,7 @@
assert(retainingPaths != null);
assert(objects != null);
MegamorphicCacheViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<MegamorphicCacheViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -111,12 +111,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -131,7 +131,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Megamorphic Cache',
new HRElement(),
new ObjectCommonElement(_isolate, _cache, _retainedSizes,
@@ -140,10 +140,10 @@
new BRElement(),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'selector',
@@ -153,7 +153,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'mask',
@@ -163,26 +163,26 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'buckets',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, _cache.buckets, _objects,
queue: _r.queue)
]
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'argumentsDescriptor',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, _cache.argumentsDescriptor, _objects,
queue: _r.queue)
]
diff --git a/runtime/observatory/lib/src/elements/memory/allocations.dart b/runtime/observatory/lib/src/elements/memory/allocations.dart
index ad3c5dd..1d8c4ba 100644
--- a/runtime/observatory/lib/src/elements/memory/allocations.dart
+++ b/runtime/observatory/lib/src/elements/memory/allocations.dart
@@ -55,7 +55,7 @@
assert(editor != null);
assert(repository != null);
MemoryAllocationsElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<MemoryAllocationsElement>(e, queue: queue);
e._isolate = isolate;
e._editor = editor;
e._repository = repository;
@@ -75,7 +75,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
Future reload({bool gc = false, bool reset = false}) async {
@@ -84,13 +84,13 @@
void render() {
if (_profile == null) {
- children = [
+ children = <Element>[
new DivElement()
..classes = ['content-centered-big']
- ..children = [new HeadingElement.h2()..text = 'Loading...']
+ ..children = <Element>[new HeadingElement.h2()..text = 'Loading...']
];
} else {
- children = [
+ children = <Element>[
new VirtualCollectionElement(
_createCollectionLine, _updateCollectionLine,
createHeader: _createCollectionHeader,
@@ -129,15 +129,21 @@
}
switch (_sortingDirection) {
case _SortingDirection.ascending:
- return (a, b) => getter(a).compareTo(getter(b));
+ int sort(M.ClassHeapStats a, M.ClassHeapStats b) {
+ return getter(a).compareTo(getter(b));
+ }
+ return sort;
case _SortingDirection.descending:
- return (a, b) => getter(b).compareTo(getter(a));
+ int sort(M.ClassHeapStats a, M.ClassHeapStats b) {
+ return getter(b).compareTo(getter(a));
+ }
+ return sort;
}
}
static HtmlElement _createCollectionLine() => new DivElement()
..classes = ['collection-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['bytes']
..text = '0B',
@@ -158,7 +164,7 @@
return [
new DivElement()
..classes = ['collection-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['group']
..nodes = [
@@ -178,7 +184,7 @@
],
new DivElement()
..classes = ['collection-item']
- ..children = [
+ ..children = <Element>[
_createHeaderButton(const ['bytes'], 'Size',
_SortingField.accumulatedSize, _SortingDirection.descending),
_createHeaderButton(const ['instances'], 'Instances',
@@ -243,7 +249,8 @@
});
}
- bool _search(Pattern pattern, M.ClassHeapStats item) {
+ bool _search(Pattern pattern, itemDynamic) {
+ M.ClassHeapStats item = itemDynamic;
final String value = item.clazz?.name ?? item.displayName;
return value.contains(pattern);
}
diff --git a/runtime/observatory/lib/src/elements/memory/dashboard.dart b/runtime/observatory/lib/src/elements/memory/dashboard.dart
index e02882b..802bed5 100644
--- a/runtime/observatory/lib/src/elements/memory/dashboard.dart
+++ b/runtime/observatory/lib/src/elements/memory/dashboard.dart
@@ -72,7 +72,7 @@
assert(events != null);
assert(notifications != null);
MemoryDashboardElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<MemoryDashboardElement>(e, queue: queue);
e._vm = vm;
e._vms = vms;
e._isolates = isolates;
@@ -97,7 +97,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
M.IsolateRef _isolate;
@@ -110,11 +110,11 @@
new MemoryGraphElement(vm, _vms, _isolates, _events, queue: _r.queue)
..onIsolateSelected.listen(_onIsolateSelected);
}
- children = [
- navBar([new NavNotifyElement(_notifications, queue: _r.queue)]),
+ children = <Element>[
+ navBar(<Element>[new NavNotifyElement(_notifications, queue: _r.queue)]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Memory Dashboard',
new HRElement(),
_graph,
@@ -124,7 +124,9 @@
if (_isolate == null) {
children.add(new DivElement()
..classes = ['content-centered-big']
- ..children = [new HeadingElement.h1()..text = "No isolate selected"]);
+ ..children = <Element>[
+ new HeadingElement.h1()..text = "No isolate selected"
+ ]);
} else {
children.add(new MemoryProfileElement(
_isolate, _editor, _allocations, _snapshots, _objects));
diff --git a/runtime/observatory/lib/src/elements/memory/graph.dart b/runtime/observatory/lib/src/elements/memory/graph.dart
index 537767d..30b18ac 100644
--- a/runtime/observatory/lib/src/elements/memory/graph.dart
+++ b/runtime/observatory/lib/src/elements/memory/graph.dart
@@ -60,7 +60,7 @@
assert(isolates != null);
assert(events != null);
MemoryGraphElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<MemoryGraphElement>(e, queue: queue);
e._vm = vm;
e._vms = vms;
e._isolates = isolates;
@@ -104,7 +104,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
_onGCSubscription.cancel();
_onConnectionClosedSubscription.cancel();
_onResizeSubscription.cancel();
@@ -137,7 +137,7 @@
final legend = new DivElement();
final host = new DivElement();
final theme = new MemoryChartTheme(1);
- children = [theme.style, legend, host];
+ children = <Element>[theme.style, legend, host];
final rect = host.getBoundingClientRect();
final series =
@@ -199,7 +199,7 @@
}
}
- String _formatTimeAxis(num ms) =>
+ String _formatTimeAxis(dynamic ms) =>
Utils.formatDuration(new Duration(microseconds: ms.toInt()),
precision: DurationComponent.Seconds);
@@ -340,13 +340,13 @@
static HtmlElement _formatNativeOvercard(int currentRSS, int heap) =>
new DivElement()
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['hovercard-title']
..text = 'Native',
new DivElement()
..classes = ['hovercard-measure', 'hovercard-multi']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['hovercard-measure-label']
..text = 'Total Memory Usage',
@@ -358,7 +358,7 @@
],
new DivElement()
..classes = ['hovercard-measure', 'hovercard-multi']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['hovercard-measure-label']
..text = 'Native Heap',
@@ -371,13 +371,13 @@
static HtmlElement _formatIsolateOvercard(String name, int free, int used) {
final capacity = free + used;
return new DivElement()
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['hovercard-title']
..text = name,
new DivElement()
..classes = ['hovercard-measure', 'hovercard-multi']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['hovercard-measure-label']
..text = 'Heap Capacity',
@@ -387,7 +387,7 @@
],
new DivElement()
..classes = ['hovercard-measure', 'hovercard-multi']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['hovercard-measure-label']
..text = 'Free Heap',
@@ -397,7 +397,7 @@
],
new DivElement()
..classes = ['hovercard-measure', 'hovercard-multi']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['hovercard-measure-label']
..text = 'Used Heap',
diff --git a/runtime/observatory/lib/src/elements/memory/profile.dart b/runtime/observatory/lib/src/elements/memory/profile.dart
index 4a4f1d8..2c72042 100644
--- a/runtime/observatory/lib/src/elements/memory/profile.dart
+++ b/runtime/observatory/lib/src/elements/memory/profile.dart
@@ -57,7 +57,7 @@
assert(snapshots != null);
assert(objects != null);
MemoryProfileElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<MemoryProfileElement>(e, queue: queue);
e._isolate = isolate;
e._editor = editor;
e._allocations = allocations;
@@ -78,7 +78,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
@@ -103,10 +103,10 @@
final ButtonElement bReload = new ButtonElement();
final ButtonElement bGC = new ButtonElement();
- children = [
+ children = <Element>[
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()
..nodes = [
new Text(_isolate.name),
@@ -134,7 +134,7 @@
}),
new SpanElement()
..classes = ['tab_buttons']
- ..children = [
+ ..children = <Element>[
new ButtonElement()
..text = 'Allocations'
..disabled = _analysis == _Analysis.allocations
diff --git a/runtime/observatory/lib/src/elements/memory/snapshot.dart b/runtime/observatory/lib/src/elements/memory/snapshot.dart
index d6adcf3e..816a772 100644
--- a/runtime/observatory/lib/src/elements/memory/snapshot.dart
+++ b/runtime/observatory/lib/src/elements/memory/snapshot.dart
@@ -43,7 +43,7 @@
assert(snapshots != null);
assert(objects != null);
MemorySnapshotElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<MemorySnapshotElement>(e, queue: queue);
e._isolate = isolate;
e._editor = editor;
e._snapshots = snapshots;
@@ -64,7 +64,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
@@ -72,7 +72,7 @@
children = const [];
return;
}
- List<HtmlElement> content;
+ List<Element> content;
switch (_progress.status) {
case M.HeapSnapshotLoadingStatus.fetching:
content = _createStatusMessage('Fetching snapshot from VM...',
@@ -116,10 +116,10 @@
return [
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['statusBox', 'shadow', 'center']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['statusMessage']
..text = message,
@@ -139,7 +139,7 @@
VirtualTreeElement _tree;
List<Element> _createReport() {
- final List roots = _getChildrenDominator(_snapshot.dominatorTree);
+ final List roots = _getChildrenDominator(_snapshot.dominatorTree).toList();
_tree = new VirtualTreeElement(
_createDominator, _updateDominator, _getChildrenDominator,
items: roots, queue: _r.queue);
@@ -168,7 +168,7 @@
static HtmlElement _createDominator(toggle) {
return new DivElement()
..classes = ['tree-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['size']
..title = 'retained size',
@@ -195,8 +195,8 @@
.take(kMaxChildren);
}
- void _updateDominator(
- HtmlElement element, M.HeapSnapshotDominatorNode node, int depth) {
+ void _updateDominator(HtmlElement element, nodeDynamic, int depth) {
+ M.HeapSnapshotDominatorNode node = nodeDynamic;
element.children[0].text = Utils.formatSize(node.retainedSize);
_updateLines(element.children[1].children, depth);
if (_getChildrenDominator(node).isNotEmpty) {
@@ -213,14 +213,14 @@
if (node.isStack) {
wrapper
..text = ''
- ..children = [
+ ..children = <Element>[
new AnchorElement(href: Uris.debugger(isolate))..text = 'stack frames'
];
} else {
node.object.then((object) {
wrapper
..text = ''
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, object, _objects,
queue: _r.queue, expandable: false)
];
diff --git a/runtime/observatory/lib/src/elements/metric/details.dart b/runtime/observatory/lib/src/elements/metric/details.dart
index 34b7a0f..458d12b 100644
--- a/runtime/observatory/lib/src/elements/metric/details.dart
+++ b/runtime/observatory/lib/src/elements/metric/details.dart
@@ -29,7 +29,7 @@
assert(metric != null);
assert(metrics != null);
MetricDetailsElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<MetricDetailsElement>(e, queue: queue);
e._isolate = isolate;
e._metric = metric;
e._metrics = metrics;
@@ -48,17 +48,17 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'name',
@@ -68,7 +68,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'description',
@@ -78,7 +78,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'refresh rate',
@@ -88,7 +88,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'buffer size',
diff --git a/runtime/observatory/lib/src/elements/metric/graph.dart b/runtime/observatory/lib/src/elements/metric/graph.dart
index c39d29c..608a936 100644
--- a/runtime/observatory/lib/src/elements/metric/graph.dart
+++ b/runtime/observatory/lib/src/elements/metric/graph.dart
@@ -31,7 +31,7 @@
assert(metric != null);
assert(metrics != null);
MetricGraphElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<MetricGraphElement>(e, queue: queue);
e._isolate = isolate;
e._metric = metric;
e._metrics = metrics;
@@ -51,7 +51,7 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
_timer.cancel();
}
@@ -78,10 +78,10 @@
}
final host = new DivElement();
- children = [
+ children = <Element>[
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
..children = min == null
@@ -96,7 +96,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'current',
@@ -119,7 +119,7 @@
],
new DivElement()
..classes = ['graph']
- ..children = [host]
+ ..children = <Element>[host]
];
if (rows.length <= 1) {
return;
diff --git a/runtime/observatory/lib/src/elements/metrics.dart b/runtime/observatory/lib/src/elements/metrics.dart
index f3ac7e9..ce8b91a 100644
--- a/runtime/observatory/lib/src/elements/metrics.dart
+++ b/runtime/observatory/lib/src/elements/metrics.dart
@@ -59,7 +59,7 @@
assert(events != null);
assert(notifications != null);
MetricsPageElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<MetricsPageElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -81,12 +81,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -100,15 +100,15 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Metrics',
new HRElement(),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Metric',
diff --git a/runtime/observatory/lib/src/elements/native_memory_profiler.dart b/runtime/observatory/lib/src/elements/native_memory_profiler.dart
index f517447..b32f2d2 100644
--- a/runtime/observatory/lib/src/elements/native_memory_profiler.dart
+++ b/runtime/observatory/lib/src/elements/native_memory_profiler.dart
@@ -63,7 +63,7 @@
assert(notifications != null);
assert(profiles != null);
NativeMemoryProfileElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NativeMemoryProfileElement>(e, queue: queue);
e._vm = vm;
e._events = events;
e._notifications = notifications;
@@ -84,12 +84,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- var content = [
- navBar([
+ var content = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
navMenu('native memory profile', link: Uris.nativeMemory()),
@@ -133,7 +133,7 @@
_direction = tree.direction = e.element.direction;
}),
new BRElement(),
- tree = new CpuProfileVirtualTreeElement(_vm, _progress.profile,
+ tree = new CpuProfileVirtualTreeElement(null, _progress.profile,
queue: _r.queue, type: M.SampleProfileType.memory)
]);
}
diff --git a/runtime/observatory/lib/src/elements/nav/class_menu.dart b/runtime/observatory/lib/src/elements/nav/class_menu.dart
index d8ef46e..3844443 100644
--- a/runtime/observatory/lib/src/elements/nav/class_menu.dart
+++ b/runtime/observatory/lib/src/elements/nav/class_menu.dart
@@ -35,7 +35,7 @@
assert(isolate != null);
assert(cls != null);
NavClassMenuElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavClassMenuElement>(e, queue: queue);
e._isolate = isolate;
e._cls = cls;
return e;
@@ -52,12 +52,12 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
+ children = <Element>[
navMenu(cls.name,
content: _content, link: Uris.inspect(isolate, object: cls))
];
diff --git a/runtime/observatory/lib/src/elements/nav/isolate_menu.dart b/runtime/observatory/lib/src/elements/nav/isolate_menu.dart
index ff7321f..5a1cfed 100644
--- a/runtime/observatory/lib/src/elements/nav/isolate_menu.dart
+++ b/runtime/observatory/lib/src/elements/nav/isolate_menu.dart
@@ -37,7 +37,7 @@
assert(isolate != null);
assert(events != null);
NavIsolateMenuElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavIsolateMenuElement>(e, queue: queue);
e._isolate = isolate;
e._events = events;
return e;
@@ -60,7 +60,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
assert(_updatesSubscription != null);
_updatesSubscription.cancel();
@@ -68,7 +68,7 @@
}
void render() {
- final content = [
+ final content = <Element>[
new NavMenuItemElement('debugger',
queue: _r.queue, link: Uris.debugger(isolate)),
new NavMenuItemElement('class hierarchy',
@@ -92,7 +92,7 @@
new NavMenuItemElement('logging',
queue: _r.queue, link: Uris.logging(isolate)),
]..addAll(_content);
- children = [
+ children = <Element>[
navMenu(isolate.name, content: content, link: Uris.inspect(isolate))
];
}
diff --git a/runtime/observatory/lib/src/elements/nav/library_menu.dart b/runtime/observatory/lib/src/elements/nav/library_menu.dart
index 5f22f81..8750d5e 100644
--- a/runtime/observatory/lib/src/elements/nav/library_menu.dart
+++ b/runtime/observatory/lib/src/elements/nav/library_menu.dart
@@ -35,7 +35,7 @@
assert(isolate != null);
assert(library != null);
NavLibraryMenuElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavLibraryMenuElement>(e, queue: queue);
e._isolate = isolate;
e._library = library;
return e;
@@ -52,12 +52,12 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
+ children = <Element>[
navMenu(library.name,
content: _content,
link: Uris.inspect(isolate, object: library).toString())
diff --git a/runtime/observatory/lib/src/elements/nav/menu_item.dart b/runtime/observatory/lib/src/elements/nav/menu_item.dart
index b7c3ea3..b196b4f 100644
--- a/runtime/observatory/lib/src/elements/nav/menu_item.dart
+++ b/runtime/observatory/lib/src/elements/nav/menu_item.dart
@@ -16,7 +16,7 @@
String _label;
String _link;
- Iterable<Element> _content = const [];
+ Iterable<Element> _content = const <Element>[];
String get label => _label;
String get link => _link;
@@ -33,7 +33,7 @@
{String link, RenderingQueue queue}) {
assert(label != null);
NavMenuItemElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavMenuItemElement>(e, queue: queue);
e._label = label;
e._link = link;
return e;
@@ -51,14 +51,14 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
new LIElement()
..classes = ['nav-menu-item']
- ..children = [
+ ..children = <Element>[
new AnchorElement(href: link)..text = label,
new UListElement()..children = _content
]
diff --git a/runtime/observatory/lib/src/elements/nav/notify.dart b/runtime/observatory/lib/src/elements/nav/notify.dart
index 5eb9a52..6b22f32 100644
--- a/runtime/observatory/lib/src/elements/nav/notify.dart
+++ b/runtime/observatory/lib/src/elements/nav/notify.dart
@@ -36,7 +36,7 @@
assert(repository != null);
assert(notifyOnPause != null);
NavNotifyElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavNotifyElement>(e, queue: queue);
e._repository = repository;
e._notifyOnPause = notifyOnPause;
return e;
@@ -54,18 +54,21 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
_subscription.cancel();
}
void render() {
- children = [
+ children = <Element>[
new DivElement()
- ..children = [
+ ..children = <Element>[
new DivElement()
- ..children =
- _repository.list().where(_filter).map(_toElement).toList()
+ ..children = _repository
+ .list()
+ .where(_filter)
+ .map<Element>(_toElement)
+ .toList()
]
];
}
@@ -77,7 +80,7 @@
return true;
}
- HtmlElement _toElement(M.Notification notification) {
+ Element _toElement(M.Notification notification) {
if (notification is M.EventNotification) {
return new NavNotifyEventElement(notification.event, queue: _r.queue)
..onDelete.listen((_) => _repository.delete(notification));
diff --git a/runtime/observatory/lib/src/elements/nav/notify_event.dart b/runtime/observatory/lib/src/elements/nav/notify_event.dart
index 44a6d26..a75e723 100644
--- a/runtime/observatory/lib/src/elements/nav/notify_event.dart
+++ b/runtime/observatory/lib/src/elements/nav/notify_event.dart
@@ -32,7 +32,7 @@
factory NavNotifyEventElement(M.Event event, {RenderingQueue queue}) {
assert(event != null);
NavNotifyEventElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavNotifyEventElement>(e, queue: queue);
e._event = event;
return e;
}
@@ -48,12 +48,12 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [];
+ children = <Element>[];
List<Element> content;
if (event is M.PauseStartEvent) {
content = _managePauseStartEvent(event as M.PauseStartEvent);
@@ -76,9 +76,9 @@
} else {
return;
}
- children = [
+ children = <Element>[
new DivElement()
- ..children = []
+ ..children = <Element>[]
..children.addAll(content)
..children.add(new ButtonElement()
..innerHtml = '×'
diff --git a/runtime/observatory/lib/src/elements/nav/notify_exception.dart b/runtime/observatory/lib/src/elements/nav/notify_exception.dart
index 3a76cc4..3c84af7 100644
--- a/runtime/observatory/lib/src/elements/nav/notify_exception.dart
+++ b/runtime/observatory/lib/src/elements/nav/notify_exception.dart
@@ -10,7 +10,7 @@
import 'package:observatory/models.dart' show ConnectionException;
class ExceptionDeleteEvent {
- final Exception exception;
+ final dynamic exception;
final StackTrace stacktrace;
ExceptionDeleteEvent(this.exception, {this.stacktrace});
@@ -28,17 +28,17 @@
new StreamController<ExceptionDeleteEvent>.broadcast();
Stream<ExceptionDeleteEvent> get onDelete => _onDelete.stream;
- Exception _exception;
+ dynamic _exception;
StackTrace _stacktrace;
- Exception get exception => _exception;
+ dynamic get exception => _exception;
StackTrace get stacktrace => _stacktrace;
- factory NavNotifyExceptionElement(Exception exception,
+ factory NavNotifyExceptionElement(dynamic exception,
{StackTrace stacktrace: null, RenderingQueue queue}) {
assert(exception != null);
NavNotifyExceptionElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavNotifyExceptionElement>(e, queue: queue);
e._exception = exception;
e._stacktrace = stacktrace;
return e;
@@ -55,7 +55,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
@@ -68,9 +68,9 @@
}
void renderConnectionException() {
- children = [
+ children = <Element>[
new DivElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()
..text = 'The request cannot be completed because the '
'VM is currently disconnected',
@@ -88,8 +88,8 @@
}
void renderGenericException() {
- List<Node> content;
- content = [
+ List<Element> content;
+ content = <Element>[
new SpanElement()..text = 'Unexpected exception:',
new BRElement(),
new BRElement(),
@@ -97,7 +97,7 @@
new BRElement()
];
if (stacktrace != null) {
- content.addAll([
+ content.addAll(<Element>[
new SpanElement()..text = 'StackTrace:',
new BRElement(),
new BRElement(),
@@ -105,7 +105,7 @@
new BRElement()
]);
}
- content.addAll([
+ content.addAll(<Element>[
new SpanElement()..text = '[',
new AnchorElement(href: Uris.vmConnect())
..text = 'Connect to a different VM',
@@ -114,7 +114,7 @@
..innerHtml = '×'
..onClick.map(_toEvent).listen(_delete)
]);
- children = [new DivElement()..children = content];
+ children = <Element>[new DivElement()..children = content];
}
ExceptionDeleteEvent _toEvent(_) {
diff --git a/runtime/observatory/lib/src/elements/nav/refresh.dart b/runtime/observatory/lib/src/elements/nav/refresh.dart
index 0b515d4..da859a5 100644
--- a/runtime/observatory/lib/src/elements/nav/refresh.dart
+++ b/runtime/observatory/lib/src/elements/nav/refresh.dart
@@ -37,7 +37,7 @@
assert(label != null);
assert(disabled != null);
NavRefreshElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavRefreshElement>(e, queue: queue);
e._label = label;
e._disabled = disabled;
return e;
@@ -54,14 +54,14 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
+ children = <Element>[
new LIElement()
- ..children = [
+ ..children = <Element>[
new ButtonElement()
..text = label
..disabled = disabled
diff --git a/runtime/observatory/lib/src/elements/nav/reload.dart b/runtime/observatory/lib/src/elements/nav/reload.dart
index 5baa8a0..86c8225 100644
--- a/runtime/observatory/lib/src/elements/nav/reload.dart
+++ b/runtime/observatory/lib/src/elements/nav/reload.dart
@@ -39,7 +39,7 @@
assert(isolates == null);
assert(events == null);
NavReloadElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavReloadElement>(e, queue: queue);
e._isolate = isolate;
e._isolates = isolates;
e._events = events;
@@ -58,17 +58,17 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_sub.cancel();
_sub = null;
_r.disable(notify: true);
}
void render() {
- final children = [];
+ final children = <Element>[];
if (_isolates.reloadSourcesServices.isEmpty) {
children.add(new LIElement()
- ..children = [
+ ..children = <Element>[
new ButtonElement()
..text = 'Reload Source'
..disabled = _disabled
@@ -76,7 +76,7 @@
]);
} else if (_isolates.reloadSourcesServices.length == 1) {
children.add(new LIElement()
- ..children = [
+ ..children = <Element>[
new ButtonElement()
..text = 'Reload Source'
..disabled = _disabled
@@ -85,7 +85,7 @@
]);
} else {
final content = _isolates.reloadSourcesServices.map((s) => new LIElement()
- ..children = [
+ ..children = <Element>[
new ButtonElement()
..text = s.alias
..disabled = _disabled
diff --git a/runtime/observatory/lib/src/elements/nav/top_menu.dart b/runtime/observatory/lib/src/elements/nav/top_menu.dart
index 0c4c957..285be91 100644
--- a/runtime/observatory/lib/src/elements/nav/top_menu.dart
+++ b/runtime/observatory/lib/src/elements/nav/top_menu.dart
@@ -18,7 +18,7 @@
Stream<RenderedEvent<NavTopMenuElement>> get onRendered => _r.onRendered;
- Iterable<Element> _content = const [];
+ Iterable<Element> _content = const <Element>[];
Iterable<Element> get content => _content;
@@ -29,7 +29,7 @@
factory NavTopMenuElement({RenderingQueue queue}) {
NavTopMenuElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavTopMenuElement>(e, queue: queue);
return e;
}
@@ -45,13 +45,15 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- final content = ([
+ final content = (<Element>[
new NavMenuItemElement('Connect to a VM', link: Uris.vmConnect()),
]..addAll(_content));
- children = [navMenu('Observatory', link: Uris.vm(), content: content)];
+ children = <Element>[
+ navMenu('Observatory', link: Uris.vm(), content: content)
+ ];
}
}
diff --git a/runtime/observatory/lib/src/elements/nav/vm_menu.dart b/runtime/observatory/lib/src/elements/nav/vm_menu.dart
index c0b6877..af1f8c4 100644
--- a/runtime/observatory/lib/src/elements/nav/vm_menu.dart
+++ b/runtime/observatory/lib/src/elements/nav/vm_menu.dart
@@ -37,7 +37,7 @@
assert(vm != null);
assert(events != null);
NavVMMenuElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<NavVMMenuElement>(e, queue: queue);
e._vm = vm;
e._events = events;
return e;
@@ -58,17 +58,19 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
_updatesSubscription.cancel();
}
void render() {
- final content = (_vm.isolates.map((isolate) {
+ final content = (_vm.isolates.map<Element>((isolate) {
return new NavMenuItemElement(isolate.name,
queue: _r.queue, link: Uris.inspect(isolate));
}).toList()
..addAll(_content));
- children = [navMenu(vm.displayName, link: Uris.vm(), content: content)];
+ children = <Element>[
+ navMenu(vm.displayName, link: Uris.vm(), content: content)
+ ];
}
}
diff --git a/runtime/observatory/lib/src/elements/object_common.dart b/runtime/observatory/lib/src/elements/object_common.dart
index 1fafc22..4df6eba 100644
--- a/runtime/observatory/lib/src/elements/object_common.dart
+++ b/runtime/observatory/lib/src/elements/object_common.dart
@@ -58,7 +58,7 @@
assert(retainingPaths != null);
assert(objects != null);
ObjectCommonElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ObjectCommonElement>(e, queue: queue);
e._isolate = isolate;
e._object = object;
e._retainedSizes = retainedSizes;
@@ -81,7 +81,7 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
RetainingPathElement _path;
@@ -94,19 +94,19 @@
_inbounds = _inbounds ??
new InboundReferencesElement(_isolate, _object, _references, _objects,
queue: _r.queue);
- children = [
+ children = <Element>[
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Class ',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
_object.clazz == null
? (new SpanElement()..text = '...')
: new ClassRefElement(_isolate, _object.clazz,
@@ -116,7 +116,7 @@
new DivElement()
..classes = ['memberItem']
..title = 'Space for this object in memory'
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Shallow size ',
@@ -128,7 +128,7 @@
..classes = ['memberItem']
..title = 'Space reachable from this object, '
'excluding class references'
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Reachable size ',
@@ -140,7 +140,7 @@
..classes = ['memberItem']
..title = 'Space that would be reclaimed if references to this '
'object were replaced with null'
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Retained size ',
@@ -150,24 +150,24 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Retaining path ',
new DivElement()
..classes = ['memberValue']
- ..children = [_path]
+ ..children = <Element>[_path]
],
new DivElement()
..classes = ['memberItem']
..title = 'Objects which directly reference this object'
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Inbound references ',
new DivElement()
..classes = ['memberValue']
- ..children = [_inbounds]
+ ..children = <Element>[_inbounds]
]
]
];
diff --git a/runtime/observatory/lib/src/elements/object_view.dart b/runtime/observatory/lib/src/elements/object_view.dart
index 4c39bb3..d2a7237 100644
--- a/runtime/observatory/lib/src/elements/object_view.dart
+++ b/runtime/observatory/lib/src/elements/object_view.dart
@@ -76,7 +76,7 @@
assert(references != null);
assert(retainingPaths != null);
ObjectViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ObjectViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -102,12 +102,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -122,7 +122,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Object',
new HRElement(),
new ObjectCommonElement(_isolate, _object, _retainedSizes,
diff --git a/runtime/observatory/lib/src/elements/objectpool_ref.dart b/runtime/observatory/lib/src/elements/objectpool_ref.dart
index 489581c..9c77445 100644
--- a/runtime/observatory/lib/src/elements/objectpool_ref.dart
+++ b/runtime/observatory/lib/src/elements/objectpool_ref.dart
@@ -27,7 +27,7 @@
assert(isolate != null);
assert(pool != null);
ObjectPoolRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ObjectPoolRefElement>(e, queue: queue);
e._isolate = isolate;
e._pool = pool;
return e;
@@ -45,13 +45,13 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _pool))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = 'ObjectPool',
diff --git a/runtime/observatory/lib/src/elements/objectpool_view.dart b/runtime/observatory/lib/src/elements/objectpool_view.dart
index a68aade..85b546d 100644
--- a/runtime/observatory/lib/src/elements/objectpool_view.dart
+++ b/runtime/observatory/lib/src/elements/objectpool_view.dart
@@ -82,7 +82,7 @@
assert(retainingPaths != null);
assert(objects != null);
ObjectPoolViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ObjectPoolViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -109,12 +109,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -129,7 +129,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'ObjectPool',
new HRElement(),
new ObjectCommonElement(_isolate, _pool, _retainedSizes,
@@ -140,9 +140,9 @@
new DivElement()
..classes = ['memberList']
..children = _pool.entries
- .map((entry) => new DivElement()
+ .map<Element>((entry) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName', 'hexadecimal']
..text = '[PP+0x${entry.offset.toRadixString(16)}]',
diff --git a/runtime/observatory/lib/src/elements/objectstore_view.dart b/runtime/observatory/lib/src/elements/objectstore_view.dart
index 8e24f05..a7b31c9 100644
--- a/runtime/observatory/lib/src/elements/objectstore_view.dart
+++ b/runtime/observatory/lib/src/elements/objectstore_view.dart
@@ -62,7 +62,7 @@
assert(stores != null);
assert(objects != null);
ObjectStoreViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ObjectStoreViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -85,13 +85,13 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
final fields = _store?.fields?.toList(growable: false);
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -101,7 +101,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()
..text = fields == null
? 'Object Store'
@@ -112,15 +112,15 @@
: (new DivElement()
..classes = ['memberList']
..children = fields
- .map((field) => new DivElement()
+ .map<Element>((field) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = field.name,
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, field.value, _objects,
queue: _r.queue)
]
diff --git a/runtime/observatory/lib/src/elements/pc_descriptors_ref.dart b/runtime/observatory/lib/src/elements/pc_descriptors_ref.dart
index 838f1fa..2629b9f 100644
--- a/runtime/observatory/lib/src/elements/pc_descriptors_ref.dart
+++ b/runtime/observatory/lib/src/elements/pc_descriptors_ref.dart
@@ -29,7 +29,7 @@
assert(isolate != null);
assert(descriptors != null);
PcDescriptorsRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<PcDescriptorsRefElement>(e, queue: queue);
e._isolate = isolate;
e._descriptors = descriptors;
return e;
@@ -47,14 +47,14 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
final text = (_descriptors.name == null || _descriptors.name == '')
? 'PcDescriptors'
: _descriptors.name;
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _descriptors))
..text = text
];
diff --git a/runtime/observatory/lib/src/elements/persistent_handles.dart b/runtime/observatory/lib/src/elements/persistent_handles.dart
index bb4f665..57f6196 100644
--- a/runtime/observatory/lib/src/elements/persistent_handles.dart
+++ b/runtime/observatory/lib/src/elements/persistent_handles.dart
@@ -72,7 +72,8 @@
assert(repository != null);
assert(objects != null);
PersistentHandlesPageElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r =
+ new RenderingScheduler<PersistentHandlesPageElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -95,12 +96,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -128,14 +129,14 @@
return [
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()
..text = items == null ? '$name' : '$name (${items.length})',
new HRElement(),
],
new DivElement()
..classes = ['persistent-handles']
- ..children = [
+ ..children = <Element>[
items == null
? (new HeadingElement.h2()
..classes = ['content-centered-big']
@@ -161,19 +162,25 @@
}
switch (_sortingDirection) {
case _SortingDirection.ascending:
- return (a, b) => getter(a).compareTo(getter(b));
+ int sort(M.WeakPersistentHandle a, M.WeakPersistentHandle b) {
+ return getter(a).compareTo(getter(b));
+ }
+ return sort;
case _SortingDirection.descending:
- return (a, b) => getter(b).compareTo(getter(a));
+ int sort(M.WeakPersistentHandle a, M.WeakPersistentHandle b) {
+ return getter(b).compareTo(getter(a));
+ }
+ return sort;
}
}
- static Element _createLine() => new DivElement()
+ static HtmlElement _createLine() => new DivElement()
..classes = ['collection-item']
..text = 'object';
- static Element _createWeakLine() => new DivElement()
+ static HtmlElement _createWeakLine() => new DivElement()
..classes = ['weak-item']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['external-size']
..text = '0B',
@@ -189,7 +196,7 @@
List<HtmlElement> _createWeakHeader() => [
new DivElement()
..classes = ['weak-item']
- ..children = [
+ ..children = <Element>[
_createHeaderButton(const ['external-size'], 'External Size',
_SortingField.externalSize, _SortingDirection.descending),
_createHeaderButton(const ['peer'], 'Peer', _SortingField.peer,
@@ -230,7 +237,8 @@
_r.dirty();
}
- void _updateWeakLine(Element e, M.WeakPersistentHandle item, index) {
+ void _updateWeakLine(Element e, itemDynamic, index) {
+ M.WeakPersistentHandle item = itemDynamic;
e.children[0].text = Utils.formatSize(_getExternalSize(item));
e.children[1].text = '${_getPeer(item)}';
e.children[2] = anyRef(_isolate, item.object, _objects, queue: _r.queue)
@@ -240,8 +248,9 @@
..title = '${_getFinalizerCallback(item)}';
}
- void _updateLine(Element e, M.PersistentHandle item, index) {
- e.children = [
+ void _updateLine(Element e, itemDynamic, index) {
+ M.PersistentHandle item = itemDynamic;
+ e.children = <Element>[
anyRef(_isolate, item.object, _objects, queue: _r.queue)
..classes = ['object']
];
diff --git a/runtime/observatory/lib/src/elements/ports.dart b/runtime/observatory/lib/src/elements/ports.dart
index ff74673..59d7952 100644
--- a/runtime/observatory/lib/src/elements/ports.dart
+++ b/runtime/observatory/lib/src/elements/ports.dart
@@ -61,7 +61,7 @@
assert(ports != null);
assert(objects != null);
PortsElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<PortsElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -87,13 +87,13 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -104,7 +104,7 @@
]),
new DivElement()
..classes = ['content-centered']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()..text = 'Ports ($portCount)',
new HRElement(),
new BRElement(),
@@ -120,12 +120,12 @@
}
int i = 0;
return _isolatePorts.elements
- .map((port) => new DivElement()
+ .map<Element>((port) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['port-number']
..text = '[ ${++i} ] ',
@@ -133,7 +133,7 @@
],
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, port.handler, _objects, queue: _r.queue)
]
])
diff --git a/runtime/observatory/lib/src/elements/retaining_path.dart b/runtime/observatory/lib/src/elements/retaining_path.dart
index 84df2d8..a72c728 100644
--- a/runtime/observatory/lib/src/elements/retaining_path.dart
+++ b/runtime/observatory/lib/src/elements/retaining_path.dart
@@ -37,7 +37,7 @@
assert(retainingPaths != null);
assert(objects != null);
RetainingPathElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<RetainingPathElement>(e, queue: queue);
e._isolate = isolate;
e._object = object;
e._retainingPaths = retainingPaths;
@@ -56,7 +56,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
@@ -72,7 +72,7 @@
e.control.disabled = false;
}
});
- children = [curlyBlock];
+ children = <Element>[curlyBlock];
_r.waitFor([curlyBlock.onRendered.first]);
}
@@ -87,7 +87,7 @@
return [new SpanElement()..text = 'Loading'];
}
- var elements = new List();
+ var elements = new List<Element>();
bool first = true;
for (var item in _path.elements) {
elements.add(_createItem(item, first));
@@ -104,7 +104,7 @@
// No prefix.
} else if (item.parentField != null) {
content.add(new SpanElement()
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'retained by ',
anyRef(_isolate, item.parentField, _objects, queue: _r.queue),
new SpanElement()..text = ' of ',
diff --git a/runtime/observatory/lib/src/elements/sample_buffer_control.dart b/runtime/observatory/lib/src/elements/sample_buffer_control.dart
index d7bd262..c9b8452 100644
--- a/runtime/observatory/lib/src/elements/sample_buffer_control.dart
+++ b/runtime/observatory/lib/src/elements/sample_buffer_control.dart
@@ -58,7 +58,7 @@
assert(selectedTag != null);
assert(showTag != null);
SampleBufferControlElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<SampleBufferControlElement>(e, queue: queue);
e._vm = vm;
e._progress = progress;
e._progressStream = progressStream;
@@ -107,7 +107,7 @@
content.addAll(_createStatusReport());
break;
}
- children = [
+ children = <Element>[
new DivElement()
..classes = ['content-centered-big']
..children = content
@@ -119,7 +119,7 @@
return [
new DivElement()
..classes = ['statusBox', 'shadow', 'center']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['statusMessage']
..text = message,
@@ -136,9 +136,9 @@
return [
new DivElement()
..classes = ['statusBox' 'shadow' 'center']
- ..children = [
+ ..children = <Element>[
new DivElement()
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()..text = 'Profiling is disabled',
new BRElement(),
new DivElement()
@@ -169,7 +169,7 @@
var content = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Refreshed at',
@@ -179,7 +179,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Profile contains ',
@@ -189,7 +189,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Sampling',
@@ -201,7 +201,7 @@
if (_showTag) {
content.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Tag Order',
diff --git a/runtime/observatory/lib/src/elements/script_inset.dart b/runtime/observatory/lib/src/elements/script_inset.dart
index aedb6a9..28ecc97 100644
--- a/runtime/observatory/lib/src/elements/script_inset.dart
+++ b/runtime/observatory/lib/src/elements/script_inset.dart
@@ -59,7 +59,7 @@
assert(inDebuggerContext != null);
assert(variables != null);
ScriptInsetElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ScriptInsetElement>(e, queue: queue);
e._isolate = isolate;
e._script = script;
e._scripts = scripts;
@@ -106,16 +106,16 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
_subscription.cancel();
}
void render() {
if (noSource) {
- children = [new SpanElement()..text = 'No source'];
+ children = <Element>[new SpanElement()..text = 'No source'];
} else if (_loadedScript == null) {
- children = [new SpanElement()..text = 'Loading...'];
+ children = <Element>[new SpanElement()..text = 'Loading...'];
} else {
final table = linesTable();
var firstBuild = false;
@@ -125,7 +125,7 @@
firstBuild = true;
}
- children = [container];
+ children = <Element>[container];
container.children.clear();
container.children.add(table);
_makeCssClassUncopyable(table, "noCopy");
@@ -150,7 +150,7 @@
int _startLine;
int _endLine;
- Map<int, List<S.ServiceMap>> _rangeMap = {};
+ Map/*<int, List<S.ServiceMap>>*/ _rangeMap = {};
Set _callSites = new Set<S.CallSite>();
Set _possibleBreakpointLines = new Set<int>();
Map<int, ScriptLineProfile> _profileMap = {};
@@ -608,7 +608,7 @@
button.disabled = false;
});
button.title = 'Refresh coverage';
- button.children = [_iconRefresh.clone(true)];
+ button.children = <Element>[_iconRefresh.clone(true)];
return button;
}
@@ -624,7 +624,7 @@
_refresh();
button.disabled = false;
});
- button.children = [_iconWhatsHot.clone(true)];
+ button.children = <Element>[_iconWhatsHot.clone(true)];
return button;
}
@@ -1367,7 +1367,7 @@
final SvgSvgElement _iconRefresh = new SvgSvgElement()
..setAttribute('width', '24')
..setAttribute('height', '24')
- ..children = [
+ ..children = <Element>[
new PathElement()
..setAttribute(
'd',
@@ -1381,7 +1381,7 @@
final SvgSvgElement _iconWhatsHot = new SvgSvgElement()
..setAttribute('width', '24')
..setAttribute('height', '24')
- ..children = [
+ ..children = <Element>[
new PathElement()
..setAttribute(
'd',
diff --git a/runtime/observatory/lib/src/elements/script_ref.dart b/runtime/observatory/lib/src/elements/script_ref.dart
index 78d8fda..eb1cc99 100644
--- a/runtime/observatory/lib/src/elements/script_ref.dart
+++ b/runtime/observatory/lib/src/elements/script_ref.dart
@@ -29,7 +29,7 @@
assert(isolate != null);
assert(script != null);
ScriptRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ScriptRefElement>(e, queue: queue);
e._isolate = isolate;
e._script = script;
return e;
@@ -46,12 +46,12 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(isolate, object: script))
..title = script.uri
..text = script.uri.split('/').last
diff --git a/runtime/observatory/lib/src/elements/script_view.dart b/runtime/observatory/lib/src/elements/script_view.dart
index 297fa49..c797360 100644
--- a/runtime/observatory/lib/src/elements/script_view.dart
+++ b/runtime/observatory/lib/src/elements/script_view.dart
@@ -87,7 +87,7 @@
assert(retainingPaths != null);
assert(objects != null);
ScriptViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ScriptViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -115,12 +115,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -136,7 +136,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Script',
new HRElement(),
new ObjectCommonElement(_isolate, _script, _retainedSizes,
@@ -145,10 +145,10 @@
new BRElement(),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'load time',
diff --git a/runtime/observatory/lib/src/elements/sentinel_value.dart b/runtime/observatory/lib/src/elements/sentinel_value.dart
index 7e1483f..70ea4a3 100644
--- a/runtime/observatory/lib/src/elements/sentinel_value.dart
+++ b/runtime/observatory/lib/src/elements/sentinel_value.dart
@@ -22,7 +22,7 @@
factory SentinelValueElement(M.Sentinel sentinel, {RenderingQueue queue}) {
assert(sentinel != null);
SentinelValueElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<SentinelValueElement>(e, queue: queue);
e._sentinel = sentinel;
return e;
}
diff --git a/runtime/observatory/lib/src/elements/sentinel_view.dart b/runtime/observatory/lib/src/elements/sentinel_view.dart
index c470758..9d9a2ad 100644
--- a/runtime/observatory/lib/src/elements/sentinel_view.dart
+++ b/runtime/observatory/lib/src/elements/sentinel_view.dart
@@ -50,7 +50,7 @@
assert(events != null);
assert(notifications != null);
SentinelViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<SentinelViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._sentinel = sentinel;
@@ -76,8 +76,8 @@
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -86,7 +86,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()
..text = 'Sentinel: #{_sentinel.valueAsString}',
new HRElement(),
diff --git a/runtime/observatory/lib/src/elements/singletargetcache_ref.dart b/runtime/observatory/lib/src/elements/singletargetcache_ref.dart
index 7d090c8..1e2e3dd 100644
--- a/runtime/observatory/lib/src/elements/singletargetcache_ref.dart
+++ b/runtime/observatory/lib/src/elements/singletargetcache_ref.dart
@@ -31,7 +31,7 @@
assert(isolate != null);
assert(singleTargetCache != null);
SingleTargetCacheRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<SingleTargetCacheRefElement>(e, queue: queue);
e._isolate = isolate;
e._singleTargetCache = singleTargetCache;
return e;
@@ -49,14 +49,14 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(
href: Uris.inspect(_isolate, object: _singleTargetCache))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = 'SingleTargetCache',
diff --git a/runtime/observatory/lib/src/elements/singletargetcache_view.dart b/runtime/observatory/lib/src/elements/singletargetcache_view.dart
index 97a1353..651c9ff 100644
--- a/runtime/observatory/lib/src/elements/singletargetcache_view.dart
+++ b/runtime/observatory/lib/src/elements/singletargetcache_view.dart
@@ -80,7 +80,8 @@
assert(retainingPaths != null);
assert(objects != null);
SingleTargetCacheViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r =
+ new RenderingScheduler<SingleTargetCacheViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -107,12 +108,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -128,7 +129,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'SingleTargetCache',
new HRElement(),
new ObjectCommonElement(_isolate, _singleTargetCache, _retainedSizes,
@@ -136,42 +137,42 @@
queue: _r.queue),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'target',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, _singleTargetCache.target, _objects,
queue: _r.queue)
]
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'lowerLimit',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..text = _singleTargetCache.lowerLimit.toString()
]
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'upperLimit',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new SpanElement()
..text = _singleTargetCache.upperLimit.toString()
]
diff --git a/runtime/observatory/lib/src/elements/source_inset.dart b/runtime/observatory/lib/src/elements/source_inset.dart
index f507f72..210ce2e 100644
--- a/runtime/observatory/lib/src/elements/source_inset.dart
+++ b/runtime/observatory/lib/src/elements/source_inset.dart
@@ -48,7 +48,7 @@
assert(inDebuggerContext != null);
assert(variables != null);
SourceInsetElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<SourceInsetElement>(e, queue: queue);
e._isolate = isolate;
e._location = location;
e._scripts = scripts;
@@ -71,12 +71,12 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
+ children = <Element>[
new ScriptInsetElement(
_isolate, _location.script, _scripts, _objects, _events,
startPos: _location.tokenPos,
diff --git a/runtime/observatory/lib/src/elements/source_link.dart b/runtime/observatory/lib/src/elements/source_link.dart
index 5c6b7a0..a08adbd 100644
--- a/runtime/observatory/lib/src/elements/source_link.dart
+++ b/runtime/observatory/lib/src/elements/source_link.dart
@@ -33,7 +33,7 @@
assert(isolate != null);
assert(location != null);
SourceLinkElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<SourceLinkElement>(e, queue: queue);
e._isolate = isolate;
e._location = location;
e._repository = repository;
@@ -55,19 +55,19 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
Future render() async {
if (_script == null) {
- children = [new SpanElement()..text = '<LOADING>'];
+ children = <Element>[new SpanElement()..text = '<LOADING>'];
} else {
String label = _script.uri.split('/').last;
int token = _location.tokenPos;
int line = _script.tokenToLine(token);
int column = _script.tokenToCol(token);
- children = [
+ children = <Element>[
new AnchorElement(
href: Uris.inspect(isolate, object: _script, pos: token))
..title = _script.uri
diff --git a/runtime/observatory/lib/src/elements/stack_trace_tree_config.dart b/runtime/observatory/lib/src/elements/stack_trace_tree_config.dart
index 7597eaf..9aedfc6 100644
--- a/runtime/observatory/lib/src/elements/stack_trace_tree_config.dart
+++ b/runtime/observatory/lib/src/elements/stack_trace_tree_config.dart
@@ -79,7 +79,7 @@
assert(direction != null);
assert(filter != null);
StackTraceTreeConfigElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<StackTraceTreeConfigElement>(e, queue: queue);
e._showMode = showMode;
e._showDirection = showDirection;
e._showFilter = showFilter;
@@ -105,15 +105,15 @@
}
void render() {
- children = [
+ children = <Element>[
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Tree display',
new HRElement(),
new DivElement()
..classes = ['row']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberList']
..children = _createMembers()
@@ -127,7 +127,7 @@
if (_showMode) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Mode',
@@ -139,7 +139,7 @@
if (_showDirection) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Call Tree Direction',
@@ -151,7 +151,7 @@
if (showFilter) {
members.add(new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Call Tree Filter'
diff --git a/runtime/observatory/lib/src/elements/strongly_reachable_instances.dart b/runtime/observatory/lib/src/elements/strongly_reachable_instances.dart
index 6e6f7c53..8319596 100644
--- a/runtime/observatory/lib/src/elements/strongly_reachable_instances.dart
+++ b/runtime/observatory/lib/src/elements/strongly_reachable_instances.dart
@@ -43,7 +43,8 @@
assert(stronglyReachable != null);
assert(objects != null);
StronglyReachableInstancesElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<StronglyReachableInstancesElement>(e,
+ queue: queue);
e._isolate = isolate;
e._cls = cls;
e._stronglyReachableInstances = stronglyReachable;
@@ -62,12 +63,12 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
+ children = <Element>[
new CurlyBlockElement(expanded: _expanded, queue: _r.queue)
..content = _createContent()
..onToggle.listen((e) async {
@@ -90,8 +91,10 @@
return [new SpanElement()..text = 'Loading...'];
}
final content = _result.samples
- .map((sample) => new DivElement()
- ..children = [anyRef(_isolate, sample, _objects, queue: _r.queue)])
+ .map<Element>((sample) => new DivElement()
+ ..children = <Element>[
+ anyRef(_isolate, sample, _objects, queue: _r.queue)
+ ])
.toList();
content.add(new DivElement()
..children = ([]
diff --git a/runtime/observatory/lib/src/elements/subtypetestcache_ref.dart b/runtime/observatory/lib/src/elements/subtypetestcache_ref.dart
index 9dbde53..fb7cf89 100644
--- a/runtime/observatory/lib/src/elements/subtypetestcache_ref.dart
+++ b/runtime/observatory/lib/src/elements/subtypetestcache_ref.dart
@@ -31,7 +31,7 @@
assert(isolate != null);
assert(subtypeTestCache != null);
SubtypeTestCacheRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<SubtypeTestCacheRefElement>(e, queue: queue);
e._isolate = isolate;
e._subtypeTestCache = subtypeTestCache;
return e;
@@ -49,13 +49,13 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _subtypeTestCache))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = 'SubtypeTestCache',
diff --git a/runtime/observatory/lib/src/elements/subtypetestcache_view.dart b/runtime/observatory/lib/src/elements/subtypetestcache_view.dart
index 7afcd0d..80c14fd 100644
--- a/runtime/observatory/lib/src/elements/subtypetestcache_view.dart
+++ b/runtime/observatory/lib/src/elements/subtypetestcache_view.dart
@@ -80,7 +80,7 @@
assert(retainingPaths != null);
assert(objects != null);
SubtypeTestCacheViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<SubtypeTestCacheViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -107,12 +107,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -128,7 +128,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'SubtypeTestCache',
new HRElement(),
new ObjectCommonElement(_isolate, _subtypeTestCache, _retainedSizes,
@@ -136,16 +136,16 @@
queue: _r.queue),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'cache',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, _subtypeTestCache.cache, _objects,
queue: _r.queue)
]
diff --git a/runtime/observatory/lib/src/elements/timeline/dashboard.dart b/runtime/observatory/lib/src/elements/timeline/dashboard.dart
index 0f40c14..dbac222 100644
--- a/runtime/observatory/lib/src/elements/timeline/dashboard.dart
+++ b/runtime/observatory/lib/src/elements/timeline/dashboard.dart
@@ -58,7 +58,7 @@
assert(repository != null);
assert(notifications != null);
TimelineDashboardElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<TimelineDashboardElement>(e, queue: queue);
e._vm = vm;
e._repository = repository;
e._notifications = notifications;
@@ -81,7 +81,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
IFrameElement _frame;
@@ -95,7 +95,7 @@
_content = new DivElement()..classes = ['content-centered-big'];
}
_frame.src = _makeFrameUrl();
- _content.children = [
+ _content.children = <Element>[
new HeadingElement.h2()
..nodes = ([new Text("Timeline View")]
..addAll(_createButtons())
@@ -108,12 +108,13 @@
'(timestamps are preserved)')
];
if (children.isEmpty) {
- children = [
- navBar([new NavNotifyElement(_notifications, queue: _r.queue)]),
+ children = <Element>[
+ navBar(
+ <Element>[new NavNotifyElement(_notifications, queue: _r.queue)]),
_content,
new DivElement()
..classes = ['iframe']
- ..children = [_frame]
+ ..children = <Element>[_frame]
];
}
}
@@ -162,7 +163,7 @@
return [
new SpanElement()
..classes = ['tab_buttons']
- ..children = [
+ ..children = <Element>[
new ButtonElement()
..text = 'Frame View'
..title = 'Logical view of the computation involved in each frame\n'
@@ -206,7 +207,8 @@
Future _refresh() async {
_flags = await _repository.getFlags(vm);
_r.dirty();
- final params = new Map.from(await _repository.getIFrameParams(vm));
+ final params =
+ new Map<String, dynamic>.from(await _repository.getIFrameParams(vm));
return _postMessage('refresh', params);
}
diff --git a/runtime/observatory/lib/src/elements/timeline_page.dart b/runtime/observatory/lib/src/elements/timeline_page.dart
index 608a789..5a51145 100644
--- a/runtime/observatory/lib/src/elements/timeline_page.dart
+++ b/runtime/observatory/lib/src/elements/timeline_page.dart
@@ -51,7 +51,7 @@
assert(events != null);
assert(notifications != null);
TimelinePageElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<TimelinePageElement>(e, queue: queue);
e._vm = vm;
e._repository = repository;
e._events = events;
@@ -72,7 +72,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
IFrameElement _frame;
@@ -88,16 +88,16 @@
if (_content == null) {
_content = new DivElement()..classes = ['content-centered-big'];
}
- _content.children = [
+ _content.children = <Element>[
new HeadingElement.h1()..text = 'Timeline settings',
_recorder == null
? (new DivElement()..text = 'Loading...')
: (new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Recorder:',
@@ -107,7 +107,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Recorded Streams Profile:',
@@ -117,20 +117,21 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'Recorded Streams:',
new DivElement()
..classes = ['memberValue']
- ..children =
- _availableStreams.map(_makeStreamToggle).toList()
+ ..children = _availableStreams
+ .map<Element>(_makeStreamToggle)
+ .toList()
]
])
];
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(vm, _events, queue: _r.queue),
navMenu('timeline', link: Uris.timeline()),
@@ -175,7 +176,7 @@
if (_recorder.name == "Fuchsia") {
return new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new BRElement(),
new SpanElement()
..text =
@@ -191,7 +192,7 @@
if (_recorder.name == "Systrace") {
return new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new BRElement(),
new SpanElement()
..text =
@@ -206,14 +207,14 @@
return new DivElement()
..classes = ['iframe']
- ..children = [_frame];
+ ..children = <Element>[_frame];
}
List<Element> _createProfileSelect() {
return [
new SpanElement()
..children = (_profiles.expand((profile) {
- return [
+ return <Element>[
new ButtonElement()
..text = profile.name
..onClick.listen((_) {
@@ -227,7 +228,8 @@
}
Future _refresh() async {
- final params = new Map.from(await _repository.getIFrameParams(vm));
+ final params =
+ new Map<String, dynamic>.from(await _repository.getIFrameParams(vm));
return _postMessage('refresh', params);
}
diff --git a/runtime/observatory/lib/src/elements/token_stream_ref.dart b/runtime/observatory/lib/src/elements/token_stream_ref.dart
index 7bb2364..042195d 100644
--- a/runtime/observatory/lib/src/elements/token_stream_ref.dart
+++ b/runtime/observatory/lib/src/elements/token_stream_ref.dart
@@ -27,7 +27,7 @@
assert(isolate != null);
assert(token != null);
TokenStreamRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<TokenStreamRefElement>(e, queue: queue);
e._isolate = isolate;
e._token = token;
return e;
@@ -45,14 +45,14 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
final text = (_token.name == null || _token.name == '')
? 'TokenStream'
: _token.name;
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _token))
..text = text
];
diff --git a/runtime/observatory/lib/src/elements/top_retaining_instances.dart b/runtime/observatory/lib/src/elements/top_retaining_instances.dart
index 8c3cf8f..4d63dde 100644
--- a/runtime/observatory/lib/src/elements/top_retaining_instances.dart
+++ b/runtime/observatory/lib/src/elements/top_retaining_instances.dart
@@ -43,7 +43,8 @@
assert(topRetainingInstances != null);
assert(objects != null);
TopRetainingInstancesElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r =
+ new RenderingScheduler<TopRetainingInstancesElement>(e, queue: queue);
e._isolate = isolate;
e._cls = cls;
e._topRetainingInstances = topRetainingInstances;
@@ -62,14 +63,14 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
+ children = <Element>[
new CurlyBlockElement(expanded: _expanded, queue: _r.queue)
- ..content = [
+ ..content = <Element>[
new DivElement()
..classes = ['memberList']
..children = _createContent()
@@ -96,15 +97,15 @@
return [new SpanElement()..text = 'Loading...'];
}
return _topRetaining
- .map((r) => new DivElement()
+ .map<Element>((r) => new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = '${Utils.formatSize(r.retainedSize)} ',
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
anyRef(_isolate, r.object, _objects, queue: _r.queue)
]
])
diff --git a/runtime/observatory/lib/src/elements/type_arguments_ref.dart b/runtime/observatory/lib/src/elements/type_arguments_ref.dart
index 46a254b..f29e560 100644
--- a/runtime/observatory/lib/src/elements/type_arguments_ref.dart
+++ b/runtime/observatory/lib/src/elements/type_arguments_ref.dart
@@ -28,7 +28,7 @@
assert(isolate != null);
assert(args != null);
TypeArgumentsRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<TypeArgumentsRefElement>(e, queue: queue);
e._isolate = isolate;
e._arguments = args;
return e;
@@ -46,14 +46,14 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
final text = (_arguments.name == null || _arguments.name == '')
? 'TypeArguments'
: _arguments.name;
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _arguments))
..text = text
];
diff --git a/runtime/observatory/lib/src/elements/unknown_ref.dart b/runtime/observatory/lib/src/elements/unknown_ref.dart
index d5723c4..ff287c0 100644
--- a/runtime/observatory/lib/src/elements/unknown_ref.dart
+++ b/runtime/observatory/lib/src/elements/unknown_ref.dart
@@ -28,7 +28,7 @@
assert(isolate != null);
assert(obj != null);
UnknownObjectRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<UnknownObjectRefElement>(e, queue: queue);
e._isolate = isolate;
e._obj = obj;
return e;
@@ -46,11 +46,11 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _obj))
..classes = ['emphasize']
..text = _obj.vmType
diff --git a/runtime/observatory/lib/src/elements/unlinkedcall_ref.dart b/runtime/observatory/lib/src/elements/unlinkedcall_ref.dart
index 394feb2..02a4434 100644
--- a/runtime/observatory/lib/src/elements/unlinkedcall_ref.dart
+++ b/runtime/observatory/lib/src/elements/unlinkedcall_ref.dart
@@ -28,7 +28,7 @@
assert(isolate != null);
assert(unlinkedcall != null);
UnlinkedCallRefElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<UnlinkedCallRefElement>(e, queue: queue);
e._isolate = isolate;
e._unlinkedcall = unlinkedcall;
return e;
@@ -46,13 +46,13 @@
void detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement(href: Uris.inspect(_isolate, object: _unlinkedcall))
- ..children = [
+ ..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = 'UnlinkedCall',
diff --git a/runtime/observatory/lib/src/elements/unlinkedcall_view.dart b/runtime/observatory/lib/src/elements/unlinkedcall_view.dart
index 3a5539f..d46f170 100644
--- a/runtime/observatory/lib/src/elements/unlinkedcall_view.dart
+++ b/runtime/observatory/lib/src/elements/unlinkedcall_view.dart
@@ -79,7 +79,7 @@
assert(retainingPaths != null);
assert(objects != null);
UnlinkedCallViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<UnlinkedCallViewElement>(e, queue: queue);
e._vm = vm;
e._isolate = isolate;
e._events = events;
@@ -106,12 +106,12 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
}
void render() {
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
@@ -127,7 +127,7 @@
]),
new DivElement()
..classes = ['content-centered-big']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'UnlinkedCall',
new HRElement(),
new ObjectCommonElement(_isolate, _unlinkedcall, _retainedSizes,
@@ -135,10 +135,10 @@
queue: _r.queue),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'selector',
@@ -148,13 +148,13 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'argumentsDescriptor',
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
_unlinkedcall.argumentsDescriptor == null
? (new SpanElement()..text = '<none>')
: anyRef(_isolate, _unlinkedcall.argumentsDescriptor,
diff --git a/runtime/observatory/lib/src/elements/view_footer.dart b/runtime/observatory/lib/src/elements/view_footer.dart
index cd8cd94..a1a039b 100644
--- a/runtime/observatory/lib/src/elements/view_footer.dart
+++ b/runtime/observatory/lib/src/elements/view_footer.dart
@@ -18,7 +18,7 @@
factory ViewFooterElement({RenderingQueue queue}) {
ViewFooterElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<ViewFooterElement>(e, queue: queue);
return e;
}
@@ -33,12 +33,12 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement()
..href = 'https://dart-lang.github.io/observatory/'
..text = 'View documentation',
diff --git a/runtime/observatory/lib/src/elements/vm_connect.dart b/runtime/observatory/lib/src/elements/vm_connect.dart
index 30dd852..d6036df 100644
--- a/runtime/observatory/lib/src/elements/vm_connect.dart
+++ b/runtime/observatory/lib/src/elements/vm_connect.dart
@@ -46,7 +46,7 @@
assert(notifications != null);
assert(targets != null);
VMConnectElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<VMConnectElement>(e, queue: queue);
e._address = address;
e._loadDump = loadDump;
e._notifications = notifications;
@@ -66,7 +66,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
_targetsSubscription.cancel();
}
@@ -74,30 +74,30 @@
void render() {
final host = window.location.hostname;
final port = window.location.port;
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavNotifyElement(_notifications, queue: _r.queue)
]),
new DivElement()
..classes = ['content-centered']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h1()..text = 'Connect to a Dart VM',
new HRElement(),
new BRElement(),
new DivElement()
..classes = ['flex-row']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['flex-item-40-percent']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'Connect over WebSocket',
new BRElement(),
new UListElement()
- ..children = _targets.list().map((target) {
+ ..children = _targets.list().map<Element>((target) {
final bool current = _targets.isConnectedVMTarget(target);
return new LIElement()
- ..children = [
+ ..children = <Element>[
new VMConnectTargetElement(target,
current: current, queue: _r.queue)
..onConnect.listen(_connect)
@@ -107,7 +107,7 @@
new HRElement(),
new FormElement()
..autocomplete = 'on'
- ..children = [
+ ..children = <Element>[
_createAddressBox(),
new SpanElement()..text = ' ',
new ButtonElement()
@@ -126,7 +126,7 @@
new DivElement()..classes = ['flex-item-20-percent'],
new DivElement()
..classes = ['flex-item-40-percent']
- ..children = [
+ ..children = <Element>[
new HeadingElement.h2()..text = 'View crash dump',
new BRElement(),
_createCrushDumpLoader(),
diff --git a/runtime/observatory/lib/src/elements/vm_connect_target.dart b/runtime/observatory/lib/src/elements/vm_connect_target.dart
index 6cd7b6a..2a2dd81 100644
--- a/runtime/observatory/lib/src/elements/vm_connect_target.dart
+++ b/runtime/observatory/lib/src/elements/vm_connect_target.dart
@@ -39,7 +39,7 @@
assert(target != null);
assert(current != null);
VMConnectTargetElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<VMConnectTargetElement>(e, queue: queue);
e._target = target;
e._current = current;
return e;
@@ -56,7 +56,7 @@
@override
void detached() {
super.detached();
- children = [];
+ children = <Element>[];
_r.disable(notify: true);
}
@@ -69,7 +69,7 @@
}
void render() {
- children = [
+ children = <Element>[
new AnchorElement()
..text = current ? '${target.name} (Connected)' : '${target.name}'
..onClick.where(_filter).map(_toEvent).listen(_connect),
diff --git a/runtime/observatory/lib/src/elements/vm_view.dart b/runtime/observatory/lib/src/elements/vm_view.dart
index c02ef47..4e79116 100644
--- a/runtime/observatory/lib/src/elements/vm_view.dart
+++ b/runtime/observatory/lib/src/elements/vm_view.dart
@@ -61,7 +61,7 @@
assert(isolates != null);
assert(scripts != null);
VMViewElement e = document.createElement(tag.name);
- e._r = new RenderingScheduler(e, queue: queue);
+ e._r = new RenderingScheduler<VMViewElement>(e, queue: queue);
e._vm = vm;
e._vms = vms;
e._events = events;
@@ -89,7 +89,7 @@
detached() {
super.detached();
_r.disable(notify: true);
- children = [];
+ children = <Element>[];
_vmSubscription.cancel();
_startSubscription.cancel();
_exitSubscription.cancel();
@@ -98,8 +98,8 @@
void render() {
final uptime = new DateTime.now().difference(_vm.startTime);
final isolates = _vm.isolates.toList();
- children = [
- navBar([
+ children = <Element>[
+ navBar(<Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavRefreshElement(queue: _r.queue)
@@ -117,10 +117,10 @@
new HRElement(),
new DivElement()
..classes = ['memberList']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'name',
@@ -130,7 +130,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'version',
@@ -140,7 +140,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'embedder',
@@ -150,7 +150,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'started at',
@@ -160,7 +160,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'uptime',
@@ -170,7 +170,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'refreshed at',
@@ -180,7 +180,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'pid',
@@ -190,7 +190,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'peak memory',
@@ -202,7 +202,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'current memory',
@@ -214,7 +214,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'native zone memory',
@@ -225,7 +225,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'native heap memory',
@@ -240,7 +240,7 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
..text = 'native heap allocation count',
@@ -253,16 +253,16 @@
new BRElement(),
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'see ',
new AnchorElement(href: Uris.flags())..text = 'flags'
],
new DivElement()
..classes = ['memberValue']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'view ',
new AnchorElement(href: Uris.timeline())
..text = 'timeline'
@@ -270,10 +270,10 @@
],
new DivElement()
..classes = ['memberItem']
- ..children = [
+ ..children = <Element>[
new DivElement()
..classes = ['memberName']
- ..children = [
+ ..children = <Element>[
new SpanElement()..text = 'view ',
new AnchorElement(href: Uris.nativeMemory())
..text = 'native memory profile'
@@ -286,10 +286,10 @@
new UListElement()
..classes = ['list-group']
..children = isolates
- .expand((i) => [
+ .expand((i) => <Element>[
new LIElement()
..classes = ['list-group-item']
- ..children = [
+ ..children = <Element>[
new IsolateSummaryElement(
i, _isolates, _events, _scripts,
queue: _r.queue)
diff --git a/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart b/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart
index c14bff7b..9b90eaa 100644
--- a/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart
@@ -136,16 +136,16 @@
class HeapSnapshotDominatorNode implements M.HeapSnapshotDominatorNode {
final ObjectVertex v;
final S.Isolate isolate;
- S.HeapObject _preloaded;
+ S.ServiceObject _preloaded;
bool get isStack => v.isStack;
- Future<S.HeapObject> get object {
+ Future<S.ServiceObject> get object {
if (_preloaded != null) {
return new Future.value(_preloaded);
} else {
return isolate.getObjectByAddress(v.address).then((S.ServiceObject obj) {
- return _preloaded = obj as S.HeapObject;
+ return _preloaded = obj;
});
}
}
diff --git a/runtime/observatory/lib/src/models/objects/field.dart b/runtime/observatory/lib/src/models/objects/field.dart
index 8ac61ee..d0d1221 100644
--- a/runtime/observatory/lib/src/models/objects/field.dart
+++ b/runtime/observatory/lib/src/models/objects/field.dart
@@ -32,7 +32,7 @@
abstract class Field extends Object implements FieldRef {
/// [optional] The value of this field, if the field is static.
- InstanceRef get staticValue;
+ ObjectRef get staticValue;
/// [optional] The location of this field in the source code.
SourceLocation get location;
diff --git a/runtime/observatory/lib/src/repositories/event.dart b/runtime/observatory/lib/src/repositories/event.dart
index dc9b397..39313a9 100644
--- a/runtime/observatory/lib/src/repositories/event.dart
+++ b/runtime/observatory/lib/src/repositories/event.dart
@@ -37,23 +37,44 @@
final Stream<M.ServiceRegisteredEvent> onServiceRegistered;
final Stream<M.ServiceUnregisteredEvent> onServiceUnregistered;
- EventRepository() : this._(new StreamController.broadcast());
+ static Stream<T> where<T extends M.Event>(
+ Stream<M.Event> stream, bool predicate(M.Event event)) {
+ var controller = new StreamController<T>.broadcast();
+ stream.listen(
+ (M.Event event) {
+ if (predicate(event)) {
+ controller.add(event as T);
+ }
+ },
+ onError: (error) => controller.addError(error),
+ onDone: () => controller.close(),
+ );
+ return controller.stream;
+ }
- EventRepository._(StreamController controller)
+ EventRepository() : this._(new StreamController<M.Event>.broadcast());
+
+ EventRepository._(StreamController<M.Event> controller)
: this.__(
controller,
- controller.stream.where((e) => e is M.VMEvent),
- controller.stream.where((e) => e is M.IsolateEvent),
- controller.stream.where((e) => e is M.DebugEvent),
- controller.stream.where((e) => e is M.GCEvent),
- controller.stream.where((e) => e is M.LoggingEvent),
- controller.stream.where((e) => e is M.ExtensionEvent),
- controller.stream.where((e) => e is M.TimelineEventsEvent),
- controller.stream.where((e) => e is M.ConnectionClosedEvent),
- controller.stream.where((e) => e is M.ServiceEvent));
+ where<M.VMEvent>(controller.stream, (e) => e is M.VMEvent),
+ where<M.IsolateEvent>(
+ controller.stream, (e) => e is M.IsolateEvent),
+ where<M.DebugEvent>(controller.stream, (e) => e is M.DebugEvent),
+ where<M.GCEvent>(controller.stream, (e) => e is M.GCEvent),
+ where<M.LoggingEvent>(
+ controller.stream, (e) => e is M.LoggingEvent),
+ where<M.ExtensionEvent>(
+ controller.stream, (e) => e is M.ExtensionEvent),
+ where<M.TimelineEventsEvent>(
+ controller.stream, (e) => e is M.TimelineEventsEvent),
+ where<M.ConnectionClosedEvent>(
+ controller.stream, (e) => e is M.ConnectionClosedEvent),
+ where<M.ServiceEvent>(
+ controller.stream, (e) => e is M.ServiceEvent));
EventRepository.__(
- StreamController controller,
+ StreamController<M.Event> controller,
Stream<M.VMEvent> onVMEvent,
Stream<M.IsolateEvent> onIsolateEvent,
Stream<M.DebugEvent> onDebugEvent,
@@ -65,45 +86,52 @@
Stream<M.ServiceEvent> onServiceEvent)
: _onEvent = controller,
onVMEvent = onVMEvent,
- onVMUpdate = onVMEvent.where((e) => e is M.VMUpdateEvent),
+ onVMUpdate =
+ where<M.VMUpdateEvent>(onVMEvent, (e) => e is M.VMUpdateEvent),
onIsolateEvent = onIsolateEvent,
- onIsolateStart = onIsolateEvent.where((e) => e is M.IsolateStartEvent),
- onIsolateRunnable =
- onIsolateEvent.where((e) => e is M.IsolateRunnableEvent),
- onIsolateExit = onIsolateEvent.where((e) => e is M.IsolateExitEvent),
- onIsolateUpdate =
- onIsolateEvent.where((e) => e is M.IsolateUpdateEvent),
- onIsolateReload =
- onIsolateEvent.where((e) => e is M.IsolateReloadEvent),
- onServiceExtensionAdded =
- onIsolateEvent.where((e) => e is M.IsolateReloadEvent),
+ onIsolateStart = where<M.IsolateStartEvent>(
+ onIsolateEvent, (e) => e is M.IsolateStartEvent),
+ onIsolateRunnable = where<M.IsolateRunnableEvent>(
+ onIsolateEvent, (e) => e is M.IsolateRunnableEvent),
+ onIsolateExit = where<M.IsolateExitEvent>(
+ onIsolateEvent, (e) => e is M.IsolateExitEvent),
+ onIsolateUpdate = where<M.IsolateUpdateEvent>(
+ onIsolateEvent, (e) => e is M.IsolateUpdateEvent),
+ onIsolateReload = where<M.IsolateReloadEvent>(
+ onIsolateEvent, (e) => e is M.IsolateReloadEvent),
+ onServiceExtensionAdded = where<M.ServiceExtensionAddedEvent>(
+ onIsolateEvent, (e) => e is M.ServiceExtensionAddedEvent),
onDebugEvent = onDebugEvent,
- onPauseStart = onDebugEvent.where((e) => e is M.PauseStartEvent),
- onPauseExit = onDebugEvent.where((e) => e is M.PauseExitEvent),
- onPauseBreakpoint =
- onDebugEvent.where((e) => e is M.PauseBreakpointEvent),
- onPauseInterrupted =
- onDebugEvent.where((e) => e is M.PauseInterruptedEvent),
- onPauseException =
- onDebugEvent.where((e) => e is M.PauseExceptionEvent),
- onResume = onDebugEvent.where((e) => e is M.ResumeEvent),
- onBreakpointAdded =
- onDebugEvent.where((e) => e is M.BreakpointAddedEvent),
- onBreakpointResolved =
- onDebugEvent.where((e) => e is M.BreakpointResolvedEvent),
- onBreakpointRemoved =
- onDebugEvent.where((e) => e is M.BreakpointRemovedEvent),
- onInspect = onDebugEvent.where((e) => e is M.InspectEvent),
+ onPauseStart = where<M.PauseStartEvent>(
+ onDebugEvent, (e) => e is M.PauseStartEvent),
+ onPauseExit =
+ where<M.PauseExitEvent>(onDebugEvent, (e) => e is M.PauseExitEvent),
+ onPauseBreakpoint = where<M.PauseBreakpointEvent>(
+ onDebugEvent, (e) => e is M.PauseBreakpointEvent),
+ onPauseInterrupted = where<M.PauseInterruptedEvent>(
+ onDebugEvent, (e) => e is M.PauseInterruptedEvent),
+ onPauseException = where<M.PauseExceptionEvent>(
+ onDebugEvent, (e) => e is M.PauseExceptionEvent),
+ onResume =
+ where<M.ResumeEvent>(onDebugEvent, (e) => e is M.ResumeEvent),
+ onBreakpointAdded = where<M.BreakpointAddedEvent>(
+ onDebugEvent, (e) => e is M.BreakpointAddedEvent),
+ onBreakpointResolved = where<M.BreakpointResolvedEvent>(
+ onDebugEvent, (e) => e is M.BreakpointResolvedEvent),
+ onBreakpointRemoved = where<M.BreakpointRemovedEvent>(
+ onDebugEvent, (e) => e is M.BreakpointRemovedEvent),
+ onInspect =
+ where<M.InspectEvent>(onDebugEvent, (e) => e is M.InspectEvent),
onGCEvent = onGCEvent,
onLoggingEvent = onLoggingEvent,
onExtensionEvent = onExtensionEvent,
onTimelineEvents = onTimelineEvents,
onConnectionClosed = onConnectionClosed,
onServiceEvent = onServiceEvent,
- onServiceRegistered =
- onServiceEvent.where((e) => e is M.ServiceRegisteredEvent),
- onServiceUnregistered =
- onServiceEvent.where((e) => e is M.ServiceUnregisteredEvent);
+ onServiceRegistered = where<M.ServiceRegisteredEvent>(
+ onServiceEvent, (e) => e is M.ServiceRegisteredEvent),
+ onServiceUnregistered = where<M.ServiceUnregisteredEvent>(
+ onServiceEvent, (e) => e is M.ServiceUnregisteredEvent);
void add(M.Event e) {
_onEvent.add(e);
diff --git a/runtime/observatory/lib/src/repositories/flag.dart b/runtime/observatory/lib/src/repositories/flag.dart
index 0a080d2..a3db15d 100644
--- a/runtime/observatory/lib/src/repositories/flag.dart
+++ b/runtime/observatory/lib/src/repositories/flag.dart
@@ -22,8 +22,11 @@
FlagsRepository(this.vm);
Future<Iterable<Flag>> list() async {
- List<Map> flags = ((await vm.getFlagList()) as S.ServiceMap)['flags'];
- return flags.map(_toFlag);
+ var result = new List<Flag>();
+ for (var map in ((await vm.getFlagList()) as S.ServiceMap)['flags']) {
+ result.add(_toFlag(map));
+ }
+ return result;
}
static Flag _toFlag(Map map) {
diff --git a/runtime/observatory/lib/src/repositories/target.dart b/runtime/observatory/lib/src/repositories/target.dart
index 56c6246..245542d 100644
--- a/runtime/observatory/lib/src/repositories/target.dart
+++ b/runtime/observatory/lib/src/repositories/target.dart
@@ -51,7 +51,7 @@
_store();
}
- Iterable<SC.WebSocketVMTarget> list() => _list;
+ Iterable<M.Target> list() => _list.toList();
void setCurrent(M.Target t) {
SC.WebSocketVMTarget target = t as SC.WebSocketVMTarget;
@@ -85,7 +85,9 @@
if (loaded == null) {
return;
}
- _list.addAll(loaded.map((i) => new SC.WebSocketVMTarget.fromMap(i)));
+ for (var i in loaded) {
+ _list.add(new SC.WebSocketVMTarget.fromMap(i));
+ }
_list.sort((SC.WebSocketVMTarget a, SC.WebSocketVMTarget b) {
return b.lastConnectionTime.compareTo(a.lastConnectionTime);
});
diff --git a/runtime/observatory/lib/src/sample_profile/sample_profile.dart b/runtime/observatory/lib/src/sample_profile/sample_profile.dart
index a06e5e7..ebc625a 100644
--- a/runtime/observatory/lib/src/sample_profile/sample_profile.dart
+++ b/runtime/observatory/lib/src/sample_profile/sample_profile.dart
@@ -889,13 +889,13 @@
}
tries['exclusiveCodeTrie'] =
- new Uint32List.fromList(profile['exclusiveCodeTrie']);
+ new Uint32List.fromList(profile['exclusiveCodeTrie'].cast<int>());
tries['inclusiveCodeTrie'] =
- new Uint32List.fromList(profile['inclusiveCodeTrie']);
- tries['exclusiveFunctionTrie'] =
- new Uint32List.fromList(profile['exclusiveFunctionTrie']);
- tries['inclusiveFunctionTrie'] =
- new Uint32List.fromList(profile['inclusiveFunctionTrie']);
+ new Uint32List.fromList(profile['inclusiveCodeTrie'].cast<int>());
+ tries['exclusiveFunctionTrie'] = new Uint32List.fromList(
+ profile['exclusiveFunctionTrie'].cast<int>());
+ tries['inclusiveFunctionTrie'] = new Uint32List.fromList(
+ profile['inclusiveFunctionTrie'].cast<int>());
} finally {
progress.close();
}
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index df03ab5..b6f6fe3 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -106,7 +106,7 @@
}
/// A [ServiceObject] represents a persistent object within the vm.
-abstract class ServiceObject {
+abstract class ServiceObject implements M.ObjectRef {
static int LexicalSortName(ServiceObject o1, ServiceObject o2) {
return o1.name.compareTo(o2.name);
}
@@ -1173,17 +1173,18 @@
final Iterable<InboundReference> elements;
InboundReferences(ServiceMap map)
- : this.elements =
- map['references'].map((rmap) => new InboundReference(rmap));
+ : this.elements = map['references']
+ .map<InboundReference>((rmap) => new InboundReference(rmap))
+ .toList();
}
class InboundReference implements M.InboundReference {
- final HeapObject source;
+ final ServiceObject /*HeapObject*/ source;
final Instance parentField;
final int parentListIndex;
final int parentWordOffset;
- InboundReference(ServiceMap map)
+ InboundReference(Map map)
: source = map['source'],
parentField = map['parentField'],
parentListIndex = map['parentListIndex'],
@@ -1194,17 +1195,18 @@
final Iterable<RetainingPathItem> elements;
RetainingPath(ServiceMap map)
- : this.elements =
- map['elements'].map((rmap) => new RetainingPathItem(rmap));
+ : this.elements = map['elements']
+ .map<RetainingPathItem>((rmap) => new RetainingPathItem(rmap))
+ .toList();
}
class RetainingPathItem implements M.RetainingPathItem {
- final HeapObject source;
+ final ServiceObject /*HeapObject*/ source;
final Instance parentField;
final int parentListIndex;
final int parentWordOffset;
- RetainingPathItem(ServiceMap map)
+ RetainingPathItem(Map map)
: source = map['value'],
parentField = map['parentField'],
parentListIndex = map['parentListIndex'],
@@ -1215,7 +1217,8 @@
final Iterable<Port> elements;
Ports(ServiceMap map)
- : this.elements = map['ports'].map((rmap) => new Port(rmap));
+ : this.elements =
+ map['ports'].map<Port>((rmap) => new Port(rmap)).toList();
}
class Port implements M.Port {
@@ -1232,10 +1235,12 @@
final Iterable<WeakPersistentHandle> weakElements;
PersistentHandles(ServiceMap map)
- : this.elements =
- map['persistentHandles'].map((rmap) => new PersistentHandle(rmap)),
+ : this.elements = map['persistentHandles']
+ .map<PersistentHandle>((rmap) => new PersistentHandle(rmap))
+ .toList(),
this.weakElements = map['weakPersistentHandles']
- .map((rmap) => new WeakPersistentHandle(rmap));
+ .map<WeakPersistentHandle>((rmap) => new WeakPersistentHandle(rmap))
+ .toList();
}
class PersistentHandle implements M.PersistentHandle {
@@ -1453,7 +1458,7 @@
// Skip over non-class classes.
if (cls is Class) {
_classesByCid[cls.vmCid] = cls;
- futureClasses.add(cls.load());
+ futureClasses.add(cls.load().then<Class>((_) => cls));
}
}
return Future.wait(futureClasses);
@@ -1982,13 +1987,14 @@
return invokeRpc('_getInstances', params);
}
- Future<HeapObject> getObjectByAddress(String address, [bool ref = true]) {
+ Future<ServiceObject /*HeapObject*/ > getObjectByAddress(String address,
+ [bool ref = true]) {
Map params = {
'address': address,
'ref': ref,
};
return invokeRpc('_getObjectByAddress', params)
- .then((result) => result as HeapObject);
+ .then((result) => result as ServiceObject);
}
final Map<String, ServiceMetric> dartMetrics = <String, ServiceMetric>{};
@@ -2120,21 +2126,22 @@
}
/// A [DartError] is peered to a Dart Error object.
-class DartError extends ServiceObject implements M.Error {
+class DartError extends HeapObject implements M.Error {
DartError._empty(ServiceObject owner) : super._empty(owner);
M.ErrorKind kind;
- final M.ClassRef clazz = null;
- final int size = null;
String message;
Instance exception;
Instance stacktrace;
void _update(Map map, bool mapIsRef) {
+ _upgradeCollection(map, owner);
+ super._update(map, mapIsRef);
+
message = map['message'];
kind = stringToErrorKind(map['kind']);
- exception = new ServiceObject._fromMap(owner, map['exception']);
- stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']);
+ exception = map['exception'];
+ stacktrace = map['stacktrace'];
name = 'DartError($message)';
vmName = name;
}
@@ -2925,8 +2932,9 @@
fields = null;
}
if (map['_nativeFields'] != null) {
- nativeFields =
- map['_nativeFields'].map((f) => new NativeField(f['value'])).toList();
+ nativeFields = map['_nativeFields']
+ .map<NativeField>((f) => new NativeField(f['value']))
+ .toList();
} else {
nativeFields = null;
}
@@ -2944,7 +2952,7 @@
}
if (map['associations'] != null) {
associations = map['associations']
- .map((a) => new MapAssociation(a['key'], a['value']))
+ .map<MapAssociation>((a) => new MapAssociation(a['key'], a['value']))
.toList();
} else {
associations = null;
@@ -3309,7 +3317,7 @@
bool isStatic;
bool isFinal;
bool isConst;
- Instance staticValue;
+ ServiceObject staticValue;
String name;
String vmName;
@@ -3959,7 +3967,9 @@
if (mapIsRef) {
return;
}
- entries = map['_entries'].map((map) => new ObjectPoolEntry(map));
+ entries = map['_entries']
+ .map<ObjectPoolEntry>((map) => new ObjectPoolEntry(map))
+ .toList();
}
}
@@ -3994,7 +4004,8 @@
return M.ObjectPoolEntryKind.object;
case 'Immediate':
return M.ObjectPoolEntryKind.immediate;
- case 'NativeEntry':
+ case 'NativeFunction':
+ case 'NativeFunctionWrapper':
return M.ObjectPoolEntryKind.nativeEntry;
}
throw new Exception('Unknown ObjectPoolEntryKind ($kind)');
@@ -4119,7 +4130,7 @@
return;
}
count = map['totalCount'];
- samples = map['samples'];
+ samples = new List<HeapObject>.from(map['samples']);
}
}
@@ -4302,12 +4313,15 @@
return;
}
// Load the script and then update descriptors.
- script.load().then(_updateDescriptors);
+ script.load().then((_) => _updateDescriptors(script));
});
return;
}
- // Load the script and then update descriptors.
- function.location.script.load().then(_updateDescriptors);
+ {
+ // Load the script and then update descriptors.
+ var script = function.location.script;
+ script.load().then((_) => _updateDescriptors(script));
+ }
}
/// Reload [this]. Returns a future which completes to [this] or an
@@ -4381,8 +4395,8 @@
return null;
}
- void _processInline(List<ServiceFunction> inlinedFunctionsTable,
- List<List<int>> inlinedIntervals) {
+ void _processInline(List/*<ServiceFunction>*/ inlinedFunctionsTable,
+ List/*<List<int>>*/ inlinedIntervals) {
for (var i = 0; i < inlinedIntervals.length; i++) {
var inlinedInterval = inlinedIntervals[i];
var start = inlinedInterval[0] + startAddress;
@@ -4848,7 +4862,8 @@
assert(response['availableStreams'] != null);
final List<TimelineStream> streams = response['availableStreams']
- .map((String name) => new TimelineStream(name, recorded.contains(name)))
+ .map<TimelineStream>((/*String*/ name) =>
+ new TimelineStream(name, recorded.contains(name)))
.toList();
final List<TimelineProfile> profiles = [
diff --git a/runtime/observatory/lib/utils.dart b/runtime/observatory/lib/utils.dart
index 4167fb5..caace77 100644
--- a/runtime/observatory/lib/utils.dart
+++ b/runtime/observatory/lib/utils.dart
@@ -97,7 +97,7 @@
}
static String formatSize(bytesDynamic) {
- int bytes = bytesDynamic;
+ int bytes = bytesDynamic.toInt();
const int digits = 1;
const int bytesPerKB = 1024;
const int bytesPerMB = 1024 * bytesPerKB;
diff --git a/runtime/observatory/pubspec.yaml b/runtime/observatory/pubspec.yaml
new file mode 100644
index 0000000..c1dcd02
--- /dev/null
+++ b/runtime/observatory/pubspec.yaml
@@ -0,0 +1 @@
+name: observatory
diff --git a/runtime/observatory/tests/observatory_ui/curly_block/element_test.dart b/runtime/observatory/tests/observatory_ui/curly_block/element_test.dart
index 69e4063..882f665 100644
--- a/runtime/observatory/tests/observatory_ui/curly_block/element_test.dart
+++ b/runtime/observatory/tests/observatory_ui/curly_block/element_test.dart
@@ -79,7 +79,7 @@
CurlyBlockElement e;
setUp(() async {
e = new CurlyBlockElement();
- e.content = [document.createElement('content')];
+ e.content = <Element>[document.createElement('content')];
document.body.append(e);
await e.onRendered.first;
});
diff --git a/runtime/observatory/tests/observatory_ui/nav/class-menu/element_test.dart b/runtime/observatory/tests/observatory_ui/nav/class-menu/element_test.dart
index c622dbe..263ab43 100644
--- a/runtime/observatory/tests/observatory_ui/nav/class-menu/element_test.dart
+++ b/runtime/observatory/tests/observatory_ui/nav/class-menu/element_test.dart
@@ -20,7 +20,7 @@
});
test('elements created after attachment', () async {
final e = new NavClassMenuElement(i_ref, c_ref);
- e.content = [document.createElement('content')];
+ e.content = <Element>[document.createElement('content')];
document.body.append(e);
await e.onRendered.first;
expect(e.children.length, isNonZero, reason: 'has elements');
diff --git a/runtime/observatory/tests/observatory_ui/nav/menu-item/element_test.dart b/runtime/observatory/tests/observatory_ui/nav/menu-item/element_test.dart
index 689af1b..ccb778f 100644
--- a/runtime/observatory/tests/observatory_ui/nav/menu-item/element_test.dart
+++ b/runtime/observatory/tests/observatory_ui/nav/menu-item/element_test.dart
@@ -27,7 +27,7 @@
test('created', () async {
final label = 'custom-label';
final e = new NavMenuItemElement(label);
- e.content = [document.createElement('content')];
+ e.content = <Element>[document.createElement('content')];
document.body.append(e);
await e.onRendered.first;
expect(e.children.length, isNonZero, reason: 'has elements');
diff --git a/runtime/observatory/tests/observatory_ui/nav/top_menu/element_test.dart b/runtime/observatory/tests/observatory_ui/nav/top_menu/element_test.dart
index a15090d..165bfe5 100644
--- a/runtime/observatory/tests/observatory_ui/nav/top_menu/element_test.dart
+++ b/runtime/observatory/tests/observatory_ui/nav/top_menu/element_test.dart
@@ -16,7 +16,7 @@
group('elements', () {
test('created', () async {
final e = new NavTopMenuElement();
- e.content = [document.createElement('content')];
+ e.content = <Element>[document.createElement('content')];
document.body.append(e);
await e.onRendered.first;
expect(e.children.length, isNonZero, reason: 'has elements');
diff --git a/runtime/observatory/tests/observatory_ui/observatory_ui.status b/runtime/observatory/tests/observatory_ui/observatory_ui.status
index 22bbc6d..002abb6 100644
--- a/runtime/observatory/tests/observatory_ui/observatory_ui.status
+++ b/runtime/observatory/tests/observatory_ui/observatory_ui.status
@@ -9,25 +9,16 @@
cpu_profile/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
cpu_profile_table/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
curly_block/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-error_view/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
flag_list/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-general_error/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
icdata_view/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
inbound_references/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
isolate/counter_chart/element_test: CompileTimeError # observatory is not strong clean (Issue 32503)
isolate/isolate-shared-summary/element_test: CompileTimeError # observatory is not strong clean (Issue 32503)
isolate_reconnect/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
megamorphiccache_view/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-nav/class-menu/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-nav/isolate-menu/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-nav/library-menu/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-nav/menu-item/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-nav/notify/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
nav/notify_event/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-nav/notify_exception/connection_exception_test: RuntimeError # observatory is not strong clean (Issue 32503)
-nav/notify_exception/exception_test: RuntimeError # observatory is not strong clean (Issue 32503)
-nav/refresh/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-nav/top_menu/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
+nav/notify_exception/connection_exception_test: Timeout, RuntimeError # observatory is not strong clean (Issue 32503)
+nav/notify_exception/exception_test: Timeout, RuntimeError # observatory is not strong clean (Issue 32503)
nav/vm_menu/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
object_common/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
objectpool_view/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
@@ -35,9 +26,7 @@
persistent_handles_page/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
ports/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
retaining_path/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-script_ref/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
source_link/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
-view_footer/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
vm_connect/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
vm_connect_target/element_test: RuntimeError # observatory is not strong clean (Issue 32503)
diff --git a/runtime/observatory/tests/service/break_on_activation_test.dart b/runtime/observatory/tests/service/break_on_activation_test.dart
index 904ce63..1b56913 100644
--- a/runtime/observatory/tests/service/break_on_activation_test.dart
+++ b/runtime/observatory/tests/service/break_on_activation_test.dart
@@ -65,7 +65,7 @@
valueOfField(String name) async {
var field = rootLib.variables.singleWhere((v) => v.name == name);
await field.load();
- return field.staticValue;
+ return field.staticValue as Instance;
}
var r1Ref = await valueOfField('r1');
@@ -109,7 +109,7 @@
valueOfField(String name) async {
var field = rootLib.variables.singleWhere((v) => v.name == name);
await field.load();
- return field.staticValue;
+ return field.staticValue as Instance;
}
var r1Ref = await valueOfField('r1_named');
@@ -153,7 +153,7 @@
valueOfField(String name) async {
var field = rootLib.variables.singleWhere((v) => v.name == name);
await field.load();
- return field.staticValue;
+ return field.staticValue as Instance;
}
var r1Ref = await valueOfField('r1');
diff --git a/runtime/observatory/tests/service/service.status b/runtime/observatory/tests/service/service.status
index d961110..ccbe75b 100644
--- a/runtime/observatory/tests/service/service.status
+++ b/runtime/observatory/tests/service/service.status
@@ -69,9 +69,6 @@
[ $builder_tag == optimization_counter_threshold && $compiler != dartk ]
pause_on_unhandled_async_exceptions_test: Pass, RuntimeError # Issue 33365
-[ $compiler == dart2analyzer && $strong ]
-*: Skip # Issue 28649
-
[ $compiler == none && $runtime == vm && $system == fuchsia ]
*: Skip # Not yet triaged.
diff --git a/runtime/observatory/tests/service/typed_data_test.dart b/runtime/observatory/tests/service/typed_data_test.dart
index 7c34f32..13dd5ee 100644
--- a/runtime/observatory/tests/service/typed_data_test.dart
+++ b/runtime/observatory/tests/service/typed_data_test.dart
@@ -90,7 +90,7 @@
expectTypedData(name, expectedValue) {
var variable = lib.variables.singleWhere((v) => v.name == name);
- var actualValue = variable.staticValue.typedElements;
+ var actualValue = (variable.staticValue as Instance).typedElements;
if (expectedValue is Int32x4List) {
expect(actualValue.length, equals(expectedValue.length));
for (var i = 0; i < actualValue.length; i++) {
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 4dd7760..66ef97f 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -38,7 +38,6 @@
[ $compiler == dart2analyzer ]
dart/byte_array_optimized_test: CompileTimeError # int64
dart/byte_array_test: CompileTimeError # int64
-dart/truncating_ints_test: CompileTimeError # int64
[ $compiler == dart2js ]
dart/byte_array_optimized_test: Skip # compilers not aware of byte arrays
@@ -57,7 +56,7 @@
[ $compiler == dartk ]
cc/DartAPI_New: Fail # Issue #33041
dart/appjit_cha_deopt_test: SkipSlow # Issue 33266
-dart/redirection_type_shuffling_test/00: RuntimeError
+dart/redirection_type_shuffling_test/00: RuntimeError, Pass
dart/redirection_type_shuffling_test/none: RuntimeError
[ $compiler != dartk ]
@@ -129,6 +128,14 @@
cc/Profiler_TrivialRecordAllocation: Skip
cc/Profiler_TypedArrayAllocation: Skip
+[ $arch != simarm && $arch != simarm64 && $arch != simdbc64 && $compiler == dartk && $hot_reload ]
+dart/data_uri_import_test/base64: Crash
+dart/data_uri_import_test/nocharset: Crash
+dart/data_uri_import_test/nomime: Crash
+dart/data_uri_import_test/percentencoded: Crash
+dart/data_uri_import_test/utf16: Crash
+dart/data_uri_import_test/wrongmime: Crash
+
[ $arch == x64 && $compiler == dartk && $system == windows && $strong ]
cc/Profiler_BasicSourcePosition: Fail # http://dartbug.com/33224
cc/Profiler_CodeTicks: Fail # dartbug.com/33337
@@ -145,11 +152,10 @@
cc/Dart2JSCompileAll: SkipSlow # Timeout.
[ $compiler == dart2analyzer && $strong ]
-*: Skip # Issue 28649
+dart/redirection_type_shuffling_test/00: CompileTimeError
[ $compiler == dartk && $mode == debug && $runtime == vm ]
cc/PrintJSON: Crash
-cc/Profiler_FunctionInline: Fail
cc/Service_TokenStream: Crash
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
@@ -213,13 +219,8 @@
cc/Service_Address: Fail
cc/Service_Code: Fail
-[ $compiler == dartk && $hot_reload ]
-dart/data_uri_import_test/base64: Crash
-dart/data_uri_import_test/nocharset: Crash
-dart/data_uri_import_test/nomime: Crash
-dart/data_uri_import_test/percentencoded: Crash
-dart/data_uri_import_test/utf16: Crash
-dart/data_uri_import_test/wrongmime: Crash
+[ $compiler == dartk && $checked ]
+dart/redirection_type_shuffling_test/00: Pass # Works in --checked mode but not in --strong mode.
[ $compiler == dartk && $strong ]
cc/DartGeneratedArrayLiteralMessages: Crash # Issue 32190
@@ -358,9 +359,10 @@
dart/redirection_type_shuffling_test: SkipByDesign # Imports dart:mirrors
[ $hot_reload || $hot_reload_rollback ]
-dart/appjit_determinism_test: Skip # Reload affects determinisim
-dart/script_determinism_test: Skip # We can shutdown an isolate before it reloads.
-dart/slow_path_shared_stub_test: Skip # Too slow with --slow-path-triggers-gc flag and not relevant outside precompiled.
+dart/appjit_cha_deopt_test: SkipByDesign # Cannot reload with URI pointing to app snapshot.
+dart/appjit_determinism_test: SkipByDesign # Reload affects determinisim
+dart/script_determinism_test: SkipByDesign # Cannot reload with URI pointing to script snapshot.
+dart/slow_path_shared_stub_test: SkipSlow # Too slow with --slow-path-triggers-gc flag and not relevant outside precompiled.
dart/spawn_infinite_loop_test: Skip # We can shutdown an isolate before it reloads.
dart/spawn_shutdown_test: Skip # We can shutdown an isolate before it reloads.
-dart/stack_overflow_shared_test: Skip # Too slow with --slow-path-triggers-gc flag and not relevant outside precompiled.
+dart/stack_overflow_shared_test: SkipSlow # Too slow with --slow-path-triggers-gc flag and not relevant outside precompiled.
diff --git a/runtime/tools/bin_to_coff.py b/runtime/tools/bin_to_coff.py
new file mode 100644
index 0000000..5d5d9d2
--- /dev/null
+++ b/runtime/tools/bin_to_coff.py
@@ -0,0 +1,238 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+import argparse
+from ctypes import create_string_buffer
+from struct import *
+
+# FILE HEADER FLAGS
+FILE_HEADER_RELFLG = 0x1 # No relocation information
+FILE_HEADER_EXEC = 0x2 # Executable
+FILE_HEADER_LNNO = 0x4 # No line number information
+FILE_HEADER_LSYMS = 0x8 # Local symbols removed / not present
+FILE_HEADER_AR32WR = 0x100 # File is 32-bit little endian
+
+# SECTION HEADER FLAGS
+SECTION_HEADER_TEXT = 0x20 # Contains executable code
+SECTION_HEADER_DATA = 0x40 # Contains only initialized data
+SECTION_HEADER_BSS = 0x80 # Contains uninitialized data
+
+# FILE HEADER FORMAT
+# typedef struct {
+# unsigned short f_magic; /* magic number */
+# unsigned short f_nscns; /* number of sections */
+# unsigned long f_timdat; /* time & date stamp */
+# unsigned long f_symptr; /* file pointer to symtab */
+# unsigned long f_nsyms; /* number of symtab entries */
+# unsigned short f_opthdr; /* sizeof(optional hdr) */
+# unsigned short f_flags; /* flags */
+# } FILHDR;
+FILE_HEADER_FORMAT = 'HHIIIHH'
+FILE_HEADER_SIZE = calcsize(FILE_HEADER_FORMAT)
+FILE_HEADER_MAGIC_X64 = 0x8664
+FILE_HEADER_MAGIC_IA32 = 0x014c
+FILE_HEADER_NUM_SECTIONS = 1
+FILE_HEADER_TIMESTAMP = 0
+FILE_HEADER_SIZE_OF_OPTIONAL = 0
+FILE_HEADER_FLAGS = FILE_HEADER_LNNO
+
+# SECTION HEADER FORMAT
+# typedef struct {
+# char s_name[8]; /* section name */
+# unsigned long s_paddr; /* physical address, aliased s_nlib */
+# unsigned long s_vaddr; /* virtual address */
+# unsigned long s_size; /* section size */
+# unsigned long s_scnptr; /* file ptr to raw data for section */
+# unsigned long s_relptr; /* file ptr to relocation */
+# unsigned long s_lnnoptr; /* file ptr to line numbers */
+# unsigned short s_nreloc; /* number of relocation entries */
+# unsigned short s_nlnno; /* number of line number entries */
+# unsigned long s_flags; /* flags */
+# } SCNHDR;
+SECTION_HEADER_FORMAT = '8sIIIIIIHHI'
+SECTION_HEADER_SIZE = calcsize(SECTION_HEADER_FORMAT)
+SECTION_NAME_RODATA = '.rodata'
+SECTION_NAME_TEXT = '.text'
+SECTION_PADDR = 0x0
+SECTION_VADDR = 0x0
+SECTION_RAW_DATA_PTR = (FILE_HEADER_SIZE + FILE_HEADER_NUM_SECTIONS
+ * SECTION_HEADER_SIZE)
+SECTION_RELOCATION_PTR = 0x0
+SECTION_LINE_NUMS_PTR = 0x0
+SECTION_NUM_RELOCATION = 0
+SECTION_NUM_LINE_NUMS = 0
+
+# SYMBOL TABLE FORMAT
+# typedef struct {
+# union {
+# char e_name[8];
+# struct {
+# unsigned long e_zeroes;
+# unsigned long e_offset;
+# } e;
+# } e;
+# unsigned long e_value;
+# short e_scnum;
+# unsigned short e_type;
+# unsigned char e_sclass;
+# unsigned char e_numaux;
+# } SYMENT;
+SYMBOL_TABLE_ENTRY_SHORT_LEN = 8
+SYMBOL_TABLE_ENTRY_FORMAT_SHORT = '8sIhHBB'
+SYMBOL_TABLE_ENTRY_FORMAT_LONG = 'IIIhHBB'
+SYMBOL_TABLE_ENTRY_SIZE = calcsize(SYMBOL_TABLE_ENTRY_FORMAT_SHORT)
+SYMBOL_TABLE_ENTRY_ZEROS = 0x0
+SYMBOL_TABLE_ENTRY_SECTION = 1
+SYMBOL_TABLE_ENTRY_TYPE = 0
+SYMBOL_TABLE_ENTRY_CLASS = 2 # External (public) symbol.
+SYMBOL_TABLE_ENTRY_NUM_AUX = 0 # Number of auxiliary entries.
+
+
+STRING_TABLE_OFFSET = 0x4 # Starting offset for the string table.
+SIZE_FORMAT = 'I'
+SIZE_LENGTH = calcsize(SIZE_FORMAT)
+
+def main():
+ parser = argparse.ArgumentParser(description='Generate a COFF file for binary data.')
+ parser.add_argument('--input', dest='input', help='Path of the input file.')
+ parser.add_argument('--output', dest='output', help='Name of the output file.')
+ parser.add_argument('--symbol_name', dest='symbol_name', help='Name of the symbol for the binary data')
+ parser.add_argument('--size_symbol_name', dest='size_name', help='Name of the symbol for the size of the binary data')
+ parser.add_argument('--64-bit', dest='use_64_bit', action='store_true', default=False)
+ parser.add_argument('--executable', dest='executable', action='store_true', default=False)
+
+ args = parser.parse_args()
+
+ with open(args.input, 'rb') as f:
+ section_data = f.read()
+
+ # We need to calculate the following to determine the size of our buffer:
+ # 1) Size of the data
+ # 2) Total length of the symbol strings which are over 8 characters
+
+ section_size = len(section_data)
+ includes_size_name = (args.size_name != None)
+
+ # Symbols on x86 are prefixed with '_'
+ symbol_prefix = '' if args.use_64_bit else '_'
+ num_symbols = 2 if includes_size_name else 1
+ symbol_name = symbol_prefix + args.symbol_name
+ size_symbol_name = None
+ if (includes_size_name):
+ size_symbol = args.size_name if args.size_name else args.symbol_name + "Size"
+ size_symbol_name = symbol_prefix + size_symbol
+
+ # The symbol table is directly after the data section
+ symbol_table_ptr = (FILE_HEADER_SIZE + SECTION_HEADER_SIZE + section_size + SIZE_LENGTH)
+ string_table_len = 0
+
+ # Symbols longer than 8 characters have their string representations stored
+ # in the string table.
+ long_symbol_name = False
+ long_size_symbol_name = False
+ if (len(symbol_name) > SYMBOL_TABLE_ENTRY_SHORT_LEN):
+ string_table_len += len(symbol_name) + 1
+ long_symbol_name = True
+
+ if (includes_size_name and (len(size_symbol_name) > SYMBOL_TABLE_ENTRY_SHORT_LEN)):
+ string_table_len += len(size_symbol_name) + 1
+ long_size_symbol_name = True
+
+ # Create the buffer and start building.
+ offset = 0
+ buff = create_string_buffer(FILE_HEADER_SIZE + SECTION_HEADER_SIZE +
+ section_size + num_symbols *
+ SYMBOL_TABLE_ENTRY_SIZE + 2 * SIZE_LENGTH +
+ string_table_len)
+
+ FILE_HEADER_MAGIC = FILE_HEADER_MAGIC_X64 if args.use_64_bit else FILE_HEADER_MAGIC_IA32
+
+ # Populate the file header. Basically constant except for the pointer to the
+ # beginning of the symbol table.
+ pack_into(FILE_HEADER_FORMAT, buff, offset,
+ FILE_HEADER_MAGIC, FILE_HEADER_NUM_SECTIONS,
+ FILE_HEADER_TIMESTAMP, symbol_table_ptr,
+ num_symbols, FILE_HEADER_SIZE_OF_OPTIONAL,
+ FILE_HEADER_FLAGS)
+ offset += FILE_HEADER_SIZE
+
+ section_name = SECTION_NAME_RODATA
+ section_type = SECTION_HEADER_DATA
+ if args.executable:
+ section_name = SECTION_NAME_TEXT
+ section_type = SECTION_HEADER_TEXT
+
+ # Populate the section header for a single section.
+ pack_into(SECTION_HEADER_FORMAT, buff, offset,
+ section_name, SECTION_PADDR, SECTION_VADDR,
+ section_size + SIZE_LENGTH, SECTION_RAW_DATA_PTR, SECTION_RELOCATION_PTR,
+ SECTION_LINE_NUMS_PTR, SECTION_NUM_RELOCATION,
+ SECTION_NUM_LINE_NUMS, section_type)
+ offset += SECTION_HEADER_SIZE
+
+ # Copy the binary data.
+ buff[offset:offset + section_size] = section_data
+ offset += section_size
+
+ # Append the size of the section.
+ pack_into(SIZE_FORMAT, buff, offset, section_size)
+ offset += SIZE_LENGTH
+
+ # Build the symbol table. If a symbol name is 8 characters or less, it's
+ # placed directly in the symbol table. If not, it's entered in the string
+ # table immediately after the symbol table.
+
+ string_table_offset = STRING_TABLE_OFFSET
+ if long_symbol_name:
+ pack_into(SYMBOL_TABLE_ENTRY_FORMAT_LONG, buff, offset,
+ SYMBOL_TABLE_ENTRY_ZEROS, string_table_offset, 0x0,
+ SYMBOL_TABLE_ENTRY_SECTION, SYMBOL_TABLE_ENTRY_TYPE,
+ SYMBOL_TABLE_ENTRY_CLASS, SYMBOL_TABLE_ENTRY_NUM_AUX)
+ string_table_offset += len(symbol_name) + 1
+ else:
+ pack_into(SYMBOL_TABLE_ENTRY_FORMAT_SHORT, buff, offset,
+ symbol_name, 0x0,
+ SYMBOL_TABLE_ENTRY_SECTION, SYMBOL_TABLE_ENTRY_TYPE,
+ SYMBOL_TABLE_ENTRY_CLASS, SYMBOL_TABLE_ENTRY_NUM_AUX)
+ offset += SYMBOL_TABLE_ENTRY_SIZE
+
+ if includes_size_name:
+ # The size symbol table entry actually contains the value for the size.
+ if long_size_symbol_name:
+ pack_into(SYMBOL_TABLE_ENTRY_FORMAT_LONG, buff, offset,
+ SYMBOL_TABLE_ENTRY_ZEROS, string_table_offset, section_size,
+ SYMBOL_TABLE_ENTRY_SECTION, SYMBOL_TABLE_ENTRY_TYPE,
+ SYMBOL_TABLE_ENTRY_CLASS, SYMBOL_TABLE_ENTRY_NUM_AUX)
+ else:
+ pack_into(SYMBOL_TABLE_ENTRY_FORMAT_SHORT, buff, offset,
+ symbol_name, section_size,
+ SYMBOL_TABLE_ENTRY_SECTION, SYMBOL_TABLE_ENTRY_TYPE,
+ SYMBOL_TABLE_ENTRY_CLASS, SYMBOL_TABLE_ENTRY_NUM_AUX)
+ offset += SYMBOL_TABLE_ENTRY_SIZE
+
+ pack_into(SIZE_FORMAT, buff, offset, string_table_len + SIZE_LENGTH)
+ offset += SIZE_LENGTH
+
+ # Populate the string table for any symbols longer than 8 characters.
+ if long_symbol_name:
+ symbol_len = len(symbol_name)
+ buff[offset:offset + symbol_len] = symbol_name
+ offset += symbol_len
+ buff[offset] = '\0'
+ offset += 1
+
+ if includes_size_name and long_size_symbol_name:
+ symbol_len = len(size_symbol_name)
+ buff[offset:offset + symbol_len] = size_symbol_name
+ offset += symbol_len
+ buff[offset] = '\0'
+ offset += 1
+
+ with open(args.output, 'wb') as f:
+ f.write(buff.raw)
+
+if __name__ == '__main__':
+ main()
diff --git a/runtime/tools/dartfuzz/README.md b/runtime/tools/dartfuzz/README.md
index 000f75d..6367411 100644
--- a/runtime/tools/dartfuzz/README.md
+++ b/runtime/tools/dartfuzz/README.md
@@ -40,9 +40,18 @@
--true_divergence : only report true divergences
--mode1 : m1
--mode2 : m2, and values one of
- jit = Dart JIT
- aot = Dart AOT
- js = dart2js + JS
+ jit-ia32 = Dart JIT (ia32)
+ jit-x64 = Dart JIT (x64)
+ jit-arm32 = Dart JIT (simarm)
+ jit-arm64 = Dart JIT (simarm64)
+ aot-x64 = Dart AOT (x64)
+ aot-arm64 = Dart AOT (simarm64)
+ js = dart2js + JS
+
+This fuzzer tool assumes the environment variable 'DART_TOP' points to
+the top of the Dart SDK development tree in which all proper binaries
+have been built already (e.g. testing jit-ia32 will invoke the binary
+${DART_TOP}/out/ReleaseIA32/dart to start the Dart VM).
Background
==========
diff --git a/runtime/tools/dartfuzz/run_dartfuzz_test.py b/runtime/tools/dartfuzz/run_dartfuzz_test.py
index 943622b..38b5496 100755
--- a/runtime/tools/dartfuzz/run_dartfuzz_test.py
+++ b/runtime/tools/dartfuzz/run_dartfuzz_test.py
@@ -118,39 +118,85 @@
class TestRunnerDartJIT(TestRunner):
"""Concrete test runner of Dart JIT."""
+ def __init__(self, mode):
+ self._mode = mode
+ if mode == 'jit-ia32':
+ self.AddPathAndTimeout('ReleaseIA32')
+ elif mode == 'jit-x64':
+ self.AddPathAndTimeout('ReleaseX64')
+ elif mode == 'jit-arm32':
+ self.AddPathAndTimeout('ReleaseSIMARM')
+ elif mode == 'jit-arm64':
+ self.AddPathAndTimeout('ReleaseSIMARM64')
+ else:
+ raise FatalError('Unknown JIT execution mode: ' + mode)
+
@property
def description(self):
- return 'Dart JIT'
+ return 'Dart ' + self._mode
+
+ def AddPathAndTimeout(self, tag, timeout=30):
+ self._env = os.environ.copy()
+ self._env['PATH'] = self._env['DART_TOP'] + '/out/' + tag + ':' + self._env['PATH']
+ self._timeout = timeout
def RunTest(self):
- return RunCommandWithOutput(['dart', 'fuzz.dart'], None, PIPE, STDOUT)
+ return RunCommandWithOutput(
+ ['dart', 'fuzz.dart'], self._env, PIPE, STDOUT, self._timeout)
class TestRunnerDartAOT(TestRunner):
"""Concrete test runner of Dart AOT."""
+ def __init__(self, mode):
+ self._mode = mode
+ if mode == 'aot-x64':
+ self.AddPathConfigAndTimeout('ReleaseX64')
+ elif mode == 'aot-arm64':
+ self.AddPathConfigAndTimeout('ReleaseSIMARM64', 30 * 60)
+ else:
+ raise FatalError('Unknown AOT execution mode: ' + mode)
+
@property
def description(self):
- return 'Dart AOT'
+ return 'Dart ' + self._mode
+
+ def AddPathConfigAndTimeout(self, tag, timeout=30):
+ self._env = os.environ.copy()
+ self._env['PATH'] = self._env['DART_TOP'] + '/pkg/vm/tool:' + self._env['PATH']
+ self._env['DART_CONFIGURATION'] = tag
+ self._timeout = timeout
def RunTest(self):
(out, err, retcode) = RunCommandWithOutput(
- ['precompiler2', 'fuzz.dart', 'snap'], None, PIPE, STDOUT)
+ ['precompiler2', 'fuzz.dart', 'snap'],
+ self._env, PIPE, STDOUT, self._timeout)
if retcode != RetCode.SUCCESS:
return (out, err, retcode)
- return RunCommandWithOutput(['dart_precompiled_runtime2', 'snap'], None, PIPE, STDOUT)
+ return RunCommandWithOutput(
+ ['dart_precompiled_runtime2', 'snap'],
+ self._env, PIPE, STDOUT, self._timeout)
class TestRunnerDart2JS(TestRunner):
"""Concrete test runner of Dart through dart2js and JS."""
+ def __init__(self):
+ self.AddPath()
+
@property
def description(self):
return 'Dart as JS'
+ def AddPath(self):
+ self._env = os.environ.copy()
+ self._env['PATH'] = self._env['DART_TOP'] + '/ReleaseX64/dart-sdk/bin:' + self._env['PATH']
+
def RunTest(self):
- (out, err, retcode) = RunCommandWithOutput(['dart2js', 'fuzz.dart'], None, PIPE, STDOUT)
+ (out, err, retcode) = RunCommandWithOutput(
+ ['dart2js', 'fuzz.dart'], self._env, PIPE, STDOUT)
if retcode != RetCode.SUCCESS:
return (out, err, retcode)
- return RunCommandWithOutput(['nodejs', 'out.js'], None, PIPE, STDOUT)
+ return RunCommandWithOutput(
+ ['nodejs', 'out.js'], self._env, PIPE, STDOUT)
def GetExecutionModeRunner(mode):
"""Returns a runner for the given execution mode.
@@ -162,13 +208,13 @@
Raises:
FatalError: error for unknown execution mode
"""
- if mode == 'jit':
- return TestRunnerDartJIT()
- if mode == 'aot':
- return TestRunnerDartAOT()
+ if mode.startswith('jit'):
+ return TestRunnerDartJIT(mode)
+ if mode.startswith('aot'):
+ return TestRunnerDartAOT(mode)
if mode == 'js':
return TestRunnerDart2JS()
- raise FatalError('Unknown execution mode')
+ raise FatalError('Unknown execution mode: ' + mode)
#
# DartFuzzTester class.
@@ -222,6 +268,7 @@
print('#Tests :', self._repeat)
print('Exec-Mode 1 :', self._runner1.description)
print('Exec-Mode 2 :', self._runner2.description)
+ print('Dart Dev :', os.environ.get('DART_TOP'))
print()
self.ShowStats() # show all zeros on start
for self._test in range(1, self._repeat + 1):
@@ -352,12 +399,16 @@
help='number of tests to run (default: 1000)')
parser.add_argument('--true_divergence', default=False, action='store_true',
help='only report true divergences')
- parser.add_argument('--mode1', default='jit',
- help='execution mode 1 (default: jit)')
- parser.add_argument('--mode2', default='aot',
- help='execution mode 2 (default: aot)')
+ parser.add_argument('--mode1', default='jit-x64',
+ help='execution mode 1 (default: jit-x64)')
+ parser.add_argument('--mode2', default='aot-x64',
+ help='execution mode 2 (default: aot-x64)')
args = parser.parse_args()
+ # Verify DART_TOP.
+ if os.environ.get('DART_TOP') == None:
+ raise FatalError('DART_TOP needs to point to the Dart SDK tree')
+
# Run DartFuzz tester.
with DartFuzzTester(args.repeat,
args.true_divergence,
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index 89d48c3..458ad3e 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -62,7 +62,7 @@
extra_deps = [
# TODO(US-399): Remove time_service specific code when it is no longer
# necessary.
- "//garnet/public/lib/app/cpp",
+ "//garnet/public/lib/component/cpp",
"//garnet/public/fidl/fuchsia.timezone",
# TODO(zra): When the platform-specific timeline code is moved out to
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.cc b/runtime/vm/compiler/backend/flow_graph_compiler.cc
index d180a24..73dc5fb 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler.cc
@@ -1065,9 +1065,6 @@
// Returns 'true' if regular code generation should be skipped.
bool FlowGraphCompiler::TryIntrinsify() {
if (FLAG_intrinsify) {
- const Class& owner = Class::Handle(parsed_function().function().Owner());
- String& name = String::Handle(parsed_function().function().name());
-
// Intrinsification skips arguments checks, therefore disable if in checked
// mode or strong mode.
//
@@ -1075,9 +1072,7 @@
// there are no checks necessary in any case and we can therefore intrinsify
// them even in checked mode and strong mode.
if (parsed_function().function().kind() == RawFunction::kImplicitGetter) {
- // TODO(27590) Store Field object inside RawFunction::data_ if possible.
- name = Field::NameFromGetter(name);
- const Field& field = Field::Handle(owner.LookupFieldAllowPrivate(name));
+ const Field& field = Field::Handle(function().accessor_field());
ASSERT(!field.IsNull());
// Only intrinsify getter if the field cannot contain a mutable double.
@@ -1093,9 +1088,7 @@
} else if (parsed_function().function().kind() ==
RawFunction::kImplicitSetter) {
if (!isolate()->argument_type_checks()) {
- // TODO(27590) Store Field object inside RawFunction::data_ if possible.
- name = Field::NameFromSetter(name);
- const Field& field = Field::Handle(owner.LookupFieldAllowPrivate(name));
+ const Field& field = Field::Handle(function().accessor_field());
ASSERT(!field.IsNull());
if (field.is_instance() &&
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc b/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
index c536e9c..0c3a45e 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
@@ -824,7 +824,6 @@
// SP: address of last argument.
// FP: caller's frame pointer.
// PP: caller's pool pointer.
-// R9: ic-data.
// R4: arguments descriptor array.
void FlowGraphCompiler::CompileGraph() {
InitCompiler();
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc b/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc
index 15e28ee..cf56eec 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc
@@ -807,7 +807,6 @@
// SP: address of last argument.
// FP: caller's frame pointer.
// PP: caller's pool pointer.
-// R5: ic-data.
// R4: arguments descriptor array.
void FlowGraphCompiler::CompileGraph() {
InitCompiler();
diff --git a/runtime/vm/compiler/call_specializer.cc b/runtime/vm/compiler/call_specializer.cc
index 6b3556b..e6b1481 100644
--- a/runtime/vm/compiler/call_specializer.cc
+++ b/runtime/vm/compiler/call_specializer.cc
@@ -916,12 +916,6 @@
const ICData& unary_ic_data) {
ASSERT(!unary_ic_data.NumberOfChecksIs(0) &&
(unary_ic_data.NumArgsTested() == 1));
- if (I->argument_type_checks()) {
- // Checked mode setters are inlined like normal methods by conventional
- // inlining.
- return false;
- }
-
ASSERT(instr->HasICData());
if (unary_ic_data.NumberOfChecksIs(0)) {
// No type feedback collected.
@@ -940,8 +934,11 @@
return false;
}
// Inline implicit instance setter.
- const String& field_name =
- String::Handle(Z, Field::NameFromSetter(instr->function_name()));
+ String& field_name = String::Handle(Z, instr->function_name().raw());
+ if (Function::IsDynamicInvocationForwaderName(field_name)) {
+ field_name = Function::DemangleDynamicInvocationForwarderName(field_name);
+ }
+ field_name = Field::NameFromSetter(field_name);
const Field& field = Field::ZoneHandle(Z, GetField(class_id, field_name));
ASSERT(!field.IsNull());
@@ -974,6 +971,62 @@
}
}
+ // Build an AssertAssignable if necessary.
+ if (I->argument_type_checks()) {
+ const AbstractType& dst_type =
+ AbstractType::ZoneHandle(zone(), field.type());
+
+ // Compute if we need to type check the value. Always type check if
+ // not in strong mode or if at a dynamic invocation.
+ bool needs_check = true;
+ if (I->strong() && !instr->interface_target().IsNull() &&
+ (field.kernel_offset() >= 0)) {
+ bool is_covariant = false;
+ bool is_generic_covariant = false;
+ field.GetCovarianceAttributes(&is_covariant, &is_generic_covariant);
+
+ if (is_covariant) {
+ // Always type check covariant fields.
+ needs_check = true;
+ } else if (is_generic_covariant) {
+ // If field is generic covariant then we don't need to check it
+ // if we know that actual type arguments match static type arguments
+ // e.g. if this is an invocation on this (an instance we are storing
+ // into is also a receiver of a surrounding method).
+ needs_check = !flow_graph_->IsReceiver(instr->ArgumentAt(0));
+ } else {
+ // The rest of the stores are checked statically (we are not at
+ // a dynamic invocation).
+ needs_check = false;
+ }
+ }
+
+ if (needs_check) {
+ Definition* instantiator_type_args = flow_graph_->constant_null();
+ Definition* function_type_args = flow_graph_->constant_null();
+ if (!dst_type.IsInstantiated()) {
+ const Class& owner = Class::Handle(Z, field.Owner());
+ if (owner.NumTypeArguments() > 0) {
+ instantiator_type_args = new (Z) LoadFieldInstr(
+ new (Z) Value(instr->ArgumentAt(0)),
+ NativeFieldDesc::GetTypeArgumentsFieldFor(zone(), owner),
+ instr->token_pos());
+ InsertBefore(instr, instantiator_type_args, instr->env(),
+ FlowGraph::kValue);
+ }
+ }
+
+ InsertBefore(
+ instr,
+ new (Z) AssertAssignableInstr(
+ instr->token_pos(), new (Z) Value(instr->ArgumentAt(1)),
+ new (Z) Value(instantiator_type_args),
+ new (Z) Value(function_type_args), dst_type,
+ String::ZoneHandle(zone(), field.name()), instr->deopt_id()),
+ instr->env(), FlowGraph::kEffect);
+ }
+ }
+
// Field guard was detached.
ASSERT(instr->FirstArgIndex() == 0);
StoreInstanceFieldInstr* store = new (Z)
diff --git a/runtime/vm/compiler/compiler_sources.gni b/runtime/vm/compiler/compiler_sources.gni
index 578dc45..41a61da 100644
--- a/runtime/vm/compiler/compiler_sources.gni
+++ b/runtime/vm/compiler/compiler_sources.gni
@@ -77,10 +77,14 @@
"compiler_pass.h",
"frontend/bytecode_reader.cc",
"frontend/bytecode_reader.h",
+ "frontend/constant_evaluator.cc",
+ "frontend/constant_evaluator.h",
"frontend/flow_graph_builder.cc",
"frontend/flow_graph_builder.h",
"frontend/kernel_binary_flowgraph.cc",
"frontend/kernel_binary_flowgraph.h",
+ "frontend/kernel_fingerprints.cc",
+ "frontend/kernel_fingerprints.h",
"frontend/kernel_to_il.cc",
"frontend/kernel_to_il.h",
"frontend/kernel_translation_helper.cc",
diff --git a/runtime/vm/compiler/frontend/bytecode_reader.h b/runtime/vm/compiler/frontend/bytecode_reader.h
index e32cf14..a257f25 100644
--- a/runtime/vm/compiler/frontend/bytecode_reader.h
+++ b/runtime/vm/compiler/frontend/bytecode_reader.h
@@ -38,6 +38,8 @@
TypeTranslator& type_translator_;
ActiveClass* const active_class_;
+
+ DISALLOW_COPY_AND_ASSIGN(BytecodeMetadataHelper);
};
} // namespace kernel
diff --git a/runtime/vm/compiler/frontend/constant_evaluator.cc b/runtime/vm/compiler/frontend/constant_evaluator.cc
new file mode 100644
index 0000000..b0c1a5a
--- /dev/null
+++ b/runtime/vm/compiler/frontend/constant_evaluator.cc
@@ -0,0 +1,1247 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "vm/compiler/frontend/constant_evaluator.h"
+
+#include "vm/compiler/aot/precompiler.h"
+#include "vm/compiler/frontend/kernel_to_il.h"
+#include "vm/compiler/jit/compiler.h"
+#include "vm/dart_entry.h"
+#include "vm/longjump.h"
+#include "vm/object_store.h"
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
+namespace dart {
+namespace kernel {
+
+#define Z (zone_)
+#define H (translation_helper_)
+#define T (type_translator_)
+#define I Isolate::Current()
+
+ConstantEvaluator::ConstantEvaluator(KernelReaderHelper* helper,
+ TypeTranslator* type_translator,
+ ActiveClass* active_class,
+ FlowGraphBuilder* flow_graph_builder)
+ : helper_(helper),
+ isolate_(Isolate::Current()),
+ zone_(helper->zone_),
+ translation_helper_(helper->translation_helper_),
+ type_translator_(*type_translator),
+ active_class_(active_class),
+ flow_graph_builder_(flow_graph_builder),
+ script_(helper->script()),
+ result_(Instance::Handle(zone_)) {}
+
+bool ConstantEvaluator::IsCached(intptr_t offset) {
+ return GetCachedConstant(offset, &result_);
+}
+
+RawInstance* ConstantEvaluator::EvaluateExpression(intptr_t offset,
+ bool reset_position) {
+ ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
+ if (!GetCachedConstant(offset, &result_)) {
+ ASSERT(IsAllowedToEvaluate());
+ intptr_t original_offset = helper_->ReaderOffset();
+ helper_->SetOffset(offset);
+ uint8_t payload = 0;
+ Tag tag = helper_->ReadTag(&payload); // read tag.
+ switch (tag) {
+ case kVariableGet:
+ EvaluateVariableGet(/* is_specialized = */ false);
+ break;
+ case kSpecializedVariableGet:
+ EvaluateVariableGet(/* is_specialized = */ true);
+ break;
+ case kPropertyGet:
+ EvaluatePropertyGet();
+ break;
+ case kDirectPropertyGet:
+ EvaluateDirectPropertyGet();
+ break;
+ case kStaticGet:
+ EvaluateStaticGet();
+ break;
+ case kMethodInvocation:
+ EvaluateMethodInvocation();
+ break;
+ case kDirectMethodInvocation:
+ EvaluateDirectMethodInvocation();
+ break;
+ case kSuperMethodInvocation:
+ EvaluateSuperMethodInvocation();
+ break;
+ case kStaticInvocation:
+ case kConstStaticInvocation:
+ EvaluateStaticInvocation();
+ break;
+ case kConstConstructorInvocation:
+ EvaluateConstructorInvocationInternal();
+ break;
+ case kNot:
+ EvaluateNot();
+ break;
+ case kLogicalExpression:
+ EvaluateLogicalExpression();
+ break;
+ case kConditionalExpression:
+ EvaluateConditionalExpression();
+ break;
+ case kStringConcatenation:
+ EvaluateStringConcatenation();
+ break;
+ case kSymbolLiteral:
+ EvaluateSymbolLiteral();
+ break;
+ case kTypeLiteral:
+ EvaluateTypeLiteral();
+ break;
+ case kAsExpression:
+ EvaluateAsExpression();
+ break;
+ case kConstListLiteral:
+ EvaluateListLiteralInternal();
+ break;
+ case kConstMapLiteral:
+ EvaluateMapLiteralInternal();
+ break;
+ case kLet:
+ EvaluateLet();
+ break;
+ case kInstantiation:
+ EvaluatePartialTearoffInstantiation();
+ break;
+ case kBigIntLiteral:
+ EvaluateBigIntLiteral();
+ break;
+ case kStringLiteral:
+ EvaluateStringLiteral();
+ break;
+ case kSpecializedIntLiteral:
+ EvaluateIntLiteral(payload);
+ break;
+ case kNegativeIntLiteral:
+ EvaluateIntLiteral(true);
+ break;
+ case kPositiveIntLiteral:
+ EvaluateIntLiteral(false);
+ break;
+ case kDoubleLiteral:
+ EvaluateDoubleLiteral();
+ break;
+ case kTrueLiteral:
+ EvaluateBoolLiteral(true);
+ break;
+ case kFalseLiteral:
+ EvaluateBoolLiteral(false);
+ break;
+ case kNullLiteral:
+ EvaluateNullLiteral();
+ break;
+ case kConstantExpression:
+ EvaluateConstantExpression();
+ break;
+ default:
+ H.ReportError(
+ script_, TokenPosition::kNoSource,
+ "Not a constant expression: unexpected kernel tag %s (%" Pd ")",
+ Reader::TagName(tag), tag);
+ }
+
+ CacheConstantValue(offset, result_);
+ if (reset_position) helper_->SetOffset(original_offset);
+ } else {
+ if (!reset_position) {
+ helper_->SetOffset(offset);
+ helper_->SkipExpression();
+ }
+ }
+ return result_.raw();
+}
+
+Instance& ConstantEvaluator::EvaluateListLiteral(intptr_t offset,
+ bool reset_position) {
+ if (!GetCachedConstant(offset, &result_)) {
+ ASSERT(IsAllowedToEvaluate());
+ intptr_t original_offset = helper_->ReaderOffset();
+ helper_->SetOffset(offset);
+ helper_->ReadTag(); // skip tag.
+ EvaluateListLiteralInternal();
+
+ CacheConstantValue(offset, result_);
+ if (reset_position) helper_->SetOffset(original_offset);
+ }
+ // We return a new `ZoneHandle` here on purpose: The intermediate language
+ // instructions do not make a copy of the handle, so we do it.
+ return Instance::ZoneHandle(Z, result_.raw());
+}
+
+Instance& ConstantEvaluator::EvaluateMapLiteral(intptr_t offset,
+ bool reset_position) {
+ if (!GetCachedConstant(offset, &result_)) {
+ ASSERT(IsAllowedToEvaluate());
+ intptr_t original_offset = helper_->ReaderOffset();
+ helper_->SetOffset(offset);
+ helper_->ReadTag(); // skip tag.
+ EvaluateMapLiteralInternal();
+
+ CacheConstantValue(offset, result_);
+ if (reset_position) helper_->SetOffset(original_offset);
+ }
+ // We return a new `ZoneHandle` here on purpose: The intermediate language
+ // instructions do not make a copy of the handle, so we do it.
+ return Instance::ZoneHandle(Z, result_.raw());
+}
+
+Instance& ConstantEvaluator::EvaluateConstructorInvocation(
+ intptr_t offset,
+ bool reset_position) {
+ if (!GetCachedConstant(offset, &result_)) {
+ ASSERT(IsAllowedToEvaluate());
+ intptr_t original_offset = helper_->ReaderOffset();
+ helper_->SetOffset(offset);
+ helper_->ReadTag(); // skip tag.
+ EvaluateConstructorInvocationInternal();
+
+ CacheConstantValue(offset, result_);
+ if (reset_position) helper_->SetOffset(original_offset);
+ }
+ // We return a new `ZoneHandle` here on purpose: The intermediate language
+ // instructions do not make a copy of the handle, so we do it.
+ return Instance::ZoneHandle(Z, result_.raw());
+}
+
+RawObject* ConstantEvaluator::EvaluateExpressionSafe(intptr_t offset) {
+ LongJumpScope jump;
+ if (setjmp(*jump.Set()) == 0) {
+ return EvaluateExpression(offset);
+ } else {
+ Thread* thread = H.thread();
+ Error& error = Error::Handle(Z);
+ error = thread->sticky_error();
+ thread->clear_sticky_error();
+ return error.raw();
+ }
+}
+
+bool ConstantEvaluator::IsBuildingFlowGraph() const {
+ return flow_graph_builder_ != nullptr;
+}
+
+bool ConstantEvaluator::IsAllowedToEvaluate() const {
+ return FLAG_precompiled_mode || !IsBuildingFlowGraph() ||
+ !flow_graph_builder_->optimizing_;
+}
+
+void ConstantEvaluator::EvaluateVariableGet(bool is_specialized) {
+ ASSERT(IsBuildingFlowGraph());
+ // When we see a [VariableGet] the corresponding [VariableDeclaration] must've
+ // been executed already. It therefore must have a constant object associated
+ // with it.
+ const TokenPosition position = helper_->ReadPosition(); // read position.
+ const intptr_t variable_kernel_position =
+ helper_->ReadUInt(); // read kernel position.
+ if (!is_specialized) {
+ helper_->ReadUInt(); // read relative variable index.
+ helper_->SkipOptionalDartType(); // read promoted type.
+ }
+ LocalVariable* variable =
+ flow_graph_builder_->LookupVariable(variable_kernel_position);
+ if (!variable->IsConst()) {
+ H.ReportError(script_, position, "Not a constant expression.");
+ }
+ result_ = variable->ConstValue()->raw();
+}
+
+void ConstantEvaluator::EvaluateGetStringLength(intptr_t expression_offset,
+ TokenPosition position) {
+ EvaluateExpression(expression_offset);
+ if (result_.IsString()) {
+ const String& str = String::Handle(Z, String::RawCast(result_.raw()));
+ result_ = Integer::New(str.Length(), H.allocation_space());
+ } else {
+ H.ReportError(
+ script_, position,
+ "Constant expressions can only call 'length' on string constants.");
+ }
+}
+
+void ConstantEvaluator::EvaluatePropertyGet() {
+ const TokenPosition position = helper_->ReadPosition(); // read position.
+ intptr_t expression_offset = helper_->ReaderOffset();
+ helper_->SkipExpression(); // read receiver.
+ StringIndex name = helper_->ReadNameAsStringIndex(); // read name.
+ helper_->SkipCanonicalNameReference(); // read interface_target_reference.
+
+ if (H.StringEquals(name, "length")) {
+ EvaluateGetStringLength(expression_offset, position);
+ } else {
+ H.ReportError(
+ script_, position,
+ "Constant expressions can only call 'length' on string constants.");
+ }
+}
+
+void ConstantEvaluator::EvaluateDirectPropertyGet() {
+ TokenPosition position = helper_->ReadPosition(); // read position.
+ intptr_t expression_offset = helper_->ReaderOffset();
+ helper_->SkipExpression(); // read receiver.
+ NameIndex kernel_name =
+ helper_->ReadCanonicalNameReference(); // read target_reference.
+
+ // TODO(vegorov): add check based on the complete canonical name.
+ if (H.IsGetter(kernel_name) &&
+ H.StringEquals(H.CanonicalNameString(kernel_name), "length")) {
+ EvaluateGetStringLength(expression_offset, position);
+ } else {
+ H.ReportError(
+ script_, position,
+ "Constant expressions can only call 'length' on string constants.");
+ }
+}
+
+void ConstantEvaluator::EvaluateStaticGet() {
+ TokenPosition position = helper_->ReadPosition(); // read position.
+ NameIndex target =
+ helper_->ReadCanonicalNameReference(); // read target_reference.
+
+ ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
+
+ if (H.IsField(target)) {
+ const Field& field = Field::Handle(Z, H.LookupFieldByKernelField(target));
+ if (!field.is_const()) {
+ H.ReportError(script_, position, "Not a constant field.");
+ }
+ if (field.StaticValue() == Object::transition_sentinel().raw()) {
+ if (IsBuildingFlowGraph()) {
+ flow_graph_builder_->InlineBailout(
+ "kernel::ConstantEvaluator::EvaluateStaticGet::Cyclic");
+ }
+ H.ReportError(script_, position, "Not a constant expression.");
+ } else if (field.StaticValue() == Object::sentinel().raw()) {
+ field.SetStaticValue(Object::transition_sentinel());
+ const Object& value =
+ Object::Handle(Compiler::EvaluateStaticInitializer(field));
+ if (value.IsError()) {
+ field.SetStaticValue(Object::null_instance());
+ H.ReportError(Error::Cast(value), script_, position,
+ "Not a constant expression.");
+ UNREACHABLE();
+ }
+ Thread* thread = H.thread();
+ const Error& error =
+ Error::Handle(thread->zone(), thread->sticky_error());
+ if (!error.IsNull()) {
+ field.SetStaticValue(Object::null_instance());
+ thread->clear_sticky_error();
+ H.ReportError(error, script_, position, "Not a constant expression.");
+ UNREACHABLE();
+ }
+ ASSERT(value.IsNull() || value.IsInstance());
+ field.SetStaticValue(value.IsNull() ? Instance::null_instance()
+ : Instance::Cast(value));
+
+ result_ = field.StaticValue();
+ result_ = H.Canonicalize(result_);
+ field.SetStaticValue(result_, true);
+ } else {
+ result_ = field.StaticValue();
+ }
+ } else if (H.IsProcedure(target)) {
+ const Function& function =
+ Function::ZoneHandle(Z, H.LookupStaticMethodByKernelProcedure(target));
+
+ if (H.IsMethod(target)) {
+ Function& closure_function =
+ Function::ZoneHandle(Z, function.ImplicitClosureFunction());
+ result_ = closure_function.ImplicitStaticClosure();
+ result_ = H.Canonicalize(result_);
+ } else if (H.IsGetter(target)) {
+ H.ReportError(script_, position, "Not a constant expression.");
+ } else {
+ H.ReportError(script_, position, "Not a constant expression.");
+ }
+ }
+}
+
+void ConstantEvaluator::EvaluateMethodInvocation() {
+ TokenPosition position = helper_->ReadPosition(); // read position.
+ // This method call wasn't cached, so receiver et al. isn't cached either.
+ const Instance& receiver = Instance::Handle(
+ Z, EvaluateExpression(helper_->ReaderOffset(), false)); // read receiver.
+ Class& klass =
+ Class::Handle(Z, isolate_->class_table()->At(receiver.GetClassId()));
+ ASSERT(!klass.IsNull());
+
+ // Search the superclass chain for the selector.
+ const String& method_name = helper_->ReadNameAsMethodName(); // read name.
+ Function& function =
+ Function::Handle(Z, H.LookupDynamicFunction(klass, method_name));
+
+ // The frontend should guarantee that [MethodInvocation]s inside constant
+ // expressions are always valid.
+ ASSERT(!function.IsNull());
+
+ // Read arguments, run the method and canonicalize the result.
+ const Object& result = RunMethodCall(position, function, &receiver);
+ result_ ^= result.raw();
+ result_ = H.Canonicalize(result_);
+
+ helper_->SkipCanonicalNameReference(); // read interface_target_reference.
+}
+
+void ConstantEvaluator::EvaluateDirectMethodInvocation() {
+ TokenPosition position = helper_->ReadPosition(); // read position.
+
+ const Instance& receiver = Instance::Handle(
+ Z, EvaluateExpression(helper_->ReaderOffset(), false)); // read receiver.
+
+ NameIndex kernel_name =
+ helper_->ReadCanonicalNameReference(); // read target_reference.
+
+ const Function& function = Function::ZoneHandle(
+ Z, H.LookupMethodByMember(kernel_name, H.DartProcedureName(kernel_name)));
+
+ // Read arguments, run the method and canonicalize the result.
+ const Object& result = RunMethodCall(position, function, &receiver);
+ result_ ^= result.raw();
+ result_ = H.Canonicalize(result_);
+}
+
+void ConstantEvaluator::EvaluateSuperMethodInvocation() {
+ ASSERT(IsBuildingFlowGraph());
+ TokenPosition position = helper_->ReadPosition(); // read position.
+
+ const LocalVariable* this_variable =
+ flow_graph_builder_->scopes_->this_variable;
+ ASSERT(this_variable->IsConst());
+ const Instance& receiver =
+ Instance::Handle(Z, this_variable->ConstValue()->raw());
+ ASSERT(!receiver.IsNull());
+
+ Class& klass = Class::Handle(Z, active_class_->klass->SuperClass());
+ ASSERT(!klass.IsNull());
+
+ const String& method_name = helper_->ReadNameAsMethodName(); // read name.
+ Function& function =
+ Function::Handle(Z, H.LookupDynamicFunction(klass, method_name));
+
+ // The frontend should guarantee that [MethodInvocation]s inside constant
+ // expressions are always valid.
+ ASSERT(!function.IsNull());
+
+ // Read arguments, run the method and canonicalize the result.
+ const Object& result = RunMethodCall(position, function, &receiver);
+ result_ ^= result.raw();
+ result_ = H.Canonicalize(result_);
+
+ helper_->SkipCanonicalNameReference(); // read interface_target_reference.
+}
+
+void ConstantEvaluator::EvaluateStaticInvocation() {
+ TokenPosition position = helper_->ReadPosition(); // read position.
+ NameIndex procedure_reference =
+ helper_->ReadCanonicalNameReference(); // read procedure reference.
+
+ const Function& function = Function::ZoneHandle(
+ Z, H.LookupStaticMethodByKernelProcedure(procedure_reference));
+ Class& klass = Class::Handle(Z, function.Owner());
+
+ intptr_t argument_count =
+ helper_->ReadUInt(); // read arguments part #1: arguments count.
+
+ // Build the type arguments vector (if necessary).
+ const TypeArguments* type_arguments =
+ TranslateTypeArguments(function, &klass); // read argument types.
+
+ // read positional and named parameters.
+ const Object& result =
+ RunFunction(position, function, argument_count, NULL, type_arguments);
+ result_ ^= result.raw();
+ result_ = H.Canonicalize(result_);
+}
+
+void ConstantEvaluator::EvaluateConstructorInvocationInternal() {
+ TokenPosition position = helper_->ReadPosition(); // read position.
+
+ NameIndex target = helper_->ReadCanonicalNameReference(); // read target.
+ const Function& constructor =
+ Function::Handle(Z, H.LookupConstructorByKernelConstructor(target));
+ Class& klass = Class::Handle(Z, constructor.Owner());
+
+ intptr_t argument_count =
+ helper_->ReadUInt(); // read arguments part #1: arguments count.
+
+ // Build the type arguments vector (if necessary).
+ const TypeArguments* type_arguments =
+ TranslateTypeArguments(constructor, &klass); // read argument types.
+
+ if (klass.NumTypeArguments() > 0 && !klass.IsGeneric()) {
+ Type& type = Type::ZoneHandle(Z, T.ReceiverType(klass).raw());
+ // TODO(27590): Can we move this code into [ReceiverType]?
+ type ^= ClassFinalizer::FinalizeType(*active_class_->klass, type,
+ ClassFinalizer::kFinalize);
+ ASSERT(!type.IsMalformedOrMalbounded());
+
+ TypeArguments& canonicalized_type_arguments =
+ TypeArguments::ZoneHandle(Z, type.arguments());
+ canonicalized_type_arguments = canonicalized_type_arguments.Canonicalize();
+ type_arguments = &canonicalized_type_arguments;
+ }
+
+ // Prepare either the instance or the type argument vector for the constructor
+ // call.
+ Instance* receiver = NULL;
+ const TypeArguments* type_arguments_argument = NULL;
+ if (!constructor.IsFactory()) {
+ receiver = &Instance::Handle(Z, Instance::New(klass, Heap::kOld));
+ if (type_arguments != NULL) {
+ receiver->SetTypeArguments(*type_arguments);
+ }
+ } else {
+ type_arguments_argument = type_arguments;
+ }
+
+ // read positional and named parameters.
+ const Object& result = RunFunction(position, constructor, argument_count,
+ receiver, type_arguments_argument);
+
+ if (constructor.IsFactory()) {
+ // Factories return the new object.
+ result_ ^= result.raw();
+ } else {
+ ASSERT(!receiver->IsNull());
+ result_ ^= (*receiver).raw();
+ }
+ if (I->obfuscate() &&
+ (result_.clazz() == I->object_store()->symbol_class())) {
+ Obfuscator::ObfuscateSymbolInstance(H.thread(), result_);
+ }
+ result_ = H.Canonicalize(result_);
+}
+
+void ConstantEvaluator::EvaluateNot() {
+ result_ ^= Bool::Get(!EvaluateBooleanExpressionHere()).raw();
+}
+
+void ConstantEvaluator::EvaluateLogicalExpression() {
+ bool left = EvaluateBooleanExpressionHere(); // read left.
+ LogicalOperator op = static_cast<LogicalOperator>(helper_->ReadByte());
+ if (op == kAnd) {
+ if (left) {
+ EvaluateBooleanExpressionHere(); // read right.
+ } else {
+ helper_->SkipExpression(); // read right.
+ }
+ } else {
+ ASSERT(op == kOr);
+ if (!left) {
+ EvaluateBooleanExpressionHere(); // read right.
+ } else {
+ helper_->SkipExpression(); // read right.
+ }
+ }
+}
+
+void ConstantEvaluator::EvaluateAsExpression() {
+ TokenPosition position = helper_->ReadPosition();
+ const uint8_t flags = helper_->ReadFlags();
+ const bool is_type_error = (flags & (1 << 0)) != 0;
+
+ // Check that this AsExpression was inserted by the front-end.
+ if (!is_type_error) {
+ H.ReportError(
+ script_, position,
+ "explicit as operator is not permitted in constant expression");
+ }
+
+ EvaluateExpression(helper_->ReaderOffset(), false);
+
+ const AbstractType& type = T.BuildType();
+ if (!type.IsInstantiated() || type.IsMalformed()) {
+ const String& type_str = String::Handle(type.UserVisibleName());
+ H.ReportError(
+ script_, position,
+ "Not a constant expression: right hand side of an implicit "
+ "as-expression is expected to be an instantiated type, got %s",
+ type_str.ToCString());
+ }
+
+ const TypeArguments& instantiator_type_arguments = TypeArguments::Handle();
+ const TypeArguments& function_type_arguments = TypeArguments::Handle();
+ Error& error = Error::Handle();
+ if (!result_.IsInstanceOf(type, instantiator_type_arguments,
+ function_type_arguments, &error)) {
+ const AbstractType& rtype =
+ AbstractType::Handle(result_.GetType(Heap::kNew));
+ const String& result_str = String::Handle(rtype.UserVisibleName());
+ const String& type_str = String::Handle(type.UserVisibleName());
+ H.ReportError(
+ script_, position,
+ "Not a constant expression: Type '%s' is not a subtype of type '%s'",
+ result_str.ToCString(), type_str.ToCString());
+ }
+}
+
+void ConstantEvaluator::EvaluateConditionalExpression() {
+ bool condition = EvaluateBooleanExpressionHere();
+ if (condition) {
+ EvaluateExpression(helper_->ReaderOffset(), false); // read then.
+ helper_->SkipExpression(); // read otherwise.
+ } else {
+ helper_->SkipExpression(); // read then.
+ EvaluateExpression(helper_->ReaderOffset(), false); // read otherwise.
+ }
+ helper_->SkipOptionalDartType(); // read unused static type.
+}
+
+void ConstantEvaluator::EvaluateStringConcatenation() {
+ TokenPosition position = helper_->ReadPosition(); // read position.
+ intptr_t length = helper_->ReadListLength(); // read list length.
+
+ bool all_string = true;
+ const Array& strings =
+ Array::Handle(Z, Array::New(length, H.allocation_space()));
+ for (intptr_t i = 0; i < length; ++i) {
+ EvaluateExpression(helper_->ReaderOffset(),
+ false); // read ith expression.
+ strings.SetAt(i, result_);
+ all_string = all_string && result_.IsString();
+ }
+ if (all_string) {
+ result_ = String::ConcatAll(strings, Heap::kOld);
+ result_ = H.Canonicalize(result_);
+ } else {
+ // Get string interpolation function.
+ const Class& cls =
+ Class::Handle(Z, Library::LookupCoreClass(Symbols::StringBase()));
+ ASSERT(!cls.IsNull());
+ const Function& func = Function::Handle(
+ Z, cls.LookupStaticFunction(
+ Library::PrivateCoreLibName(Symbols::Interpolate())));
+ ASSERT(!func.IsNull());
+
+ // Build argument array to pass to the interpolation function.
+ const Array& interpolate_arg = Array::Handle(Z, Array::New(1, Heap::kOld));
+ interpolate_arg.SetAt(0, strings);
+
+ // Run and canonicalize.
+ const Object& result =
+ RunFunction(position, func, interpolate_arg, Array::null_array());
+ result_ = H.Canonicalize(String::Cast(result));
+ }
+}
+
+void ConstantEvaluator::EvaluateSymbolLiteral() {
+ const Class& owner = *active_class_->klass;
+ const Library& lib = Library::Handle(Z, owner.library());
+ String& symbol_value = H.DartIdentifier(lib, helper_->ReadStringReference());
+ const Class& symbol_class =
+ Class::ZoneHandle(Z, I->object_store()->symbol_class());
+ ASSERT(!symbol_class.IsNull());
+ const Function& symbol_constructor = Function::ZoneHandle(
+ Z, symbol_class.LookupConstructor(Symbols::SymbolCtor()));
+ ASSERT(!symbol_constructor.IsNull());
+ result_ ^= EvaluateConstConstructorCall(
+ symbol_class, TypeArguments::Handle(Z), symbol_constructor, symbol_value);
+}
+
+void ConstantEvaluator::EvaluateTypeLiteral() {
+ const AbstractType& type = T.BuildType();
+ if (type.IsMalformed()) {
+ H.ReportError(script_, TokenPosition::kNoSource,
+ "Malformed type literal in constant expression.");
+ }
+ result_ = type.raw();
+}
+
+void ConstantEvaluator::EvaluateListLiteralInternal() {
+ helper_->ReadPosition(); // read position.
+ const TypeArguments& type_arguments = T.BuildTypeArguments(1); // read type.
+ intptr_t length = helper_->ReadListLength(); // read list length.
+ const Array& const_list =
+ Array::ZoneHandle(Z, Array::New(length, Heap::kOld));
+ const_list.SetTypeArguments(type_arguments);
+ Instance& expression = Instance::Handle(Z);
+ for (intptr_t i = 0; i < length; ++i) {
+ expression = EvaluateExpression(helper_->ReaderOffset(),
+ false); // read ith expression.
+ const_list.SetAt(i, expression);
+ }
+ const_list.MakeImmutable();
+ result_ = H.Canonicalize(const_list);
+}
+
+void ConstantEvaluator::EvaluateMapLiteralInternal() {
+ helper_->ReadPosition(); // read position.
+ const TypeArguments& type_arguments =
+ T.BuildTypeArguments(2); // read key type and value type.
+
+ intptr_t length = helper_->ReadListLength(); // read length of entries.
+
+ // This MapLiteral wasn't cached, so content isn't cached either.
+ Array& const_kv_array = Array::Handle(Z, Array::New(2 * length, Heap::kOld));
+ Instance& temp = Instance::Handle(Z);
+ for (intptr_t i = 0; i < length; ++i) {
+ temp = EvaluateExpression(helper_->ReaderOffset(), false); // read key.
+ const_kv_array.SetAt(2 * i + 0, temp);
+ temp = EvaluateExpression(helper_->ReaderOffset(), false); // read value.
+ const_kv_array.SetAt(2 * i + 1, temp);
+ }
+
+ const_kv_array.MakeImmutable();
+ const_kv_array ^= H.Canonicalize(const_kv_array);
+
+ const Class& map_class =
+ Class::Handle(Z, Library::LookupCoreClass(Symbols::ImmutableMap()));
+ ASSERT(!map_class.IsNull());
+ ASSERT(map_class.NumTypeArguments() == 2);
+
+ const Field& field =
+ Field::Handle(Z, map_class.LookupInstanceFieldAllowPrivate(
+ H.DartSymbolObfuscate("_kvPairs")));
+ ASSERT(!field.IsNull());
+
+ // NOTE: This needs to be kept in sync with `runtime/lib/immutable_map.dart`!
+ result_ = Instance::New(map_class, Heap::kOld);
+ ASSERT(!result_.IsNull());
+ result_.SetTypeArguments(type_arguments);
+ result_.SetField(field, const_kv_array);
+ result_ = H.Canonicalize(result_);
+}
+
+void ConstantEvaluator::EvaluateLet() {
+ ASSERT(IsBuildingFlowGraph());
+ intptr_t kernel_position =
+ helper_->ReaderOffset() + helper_->data_program_offset_;
+
+ LocalVariable* local = flow_graph_builder_->LookupVariable(kernel_position);
+
+ // read variable declaration.
+ VariableDeclarationHelper helper(helper_);
+ helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer);
+ Tag tag = helper_->ReadTag(); // read (first part of) initializer.
+ if (tag == kNothing) {
+ local->SetConstValue(Instance::ZoneHandle(Z, Instance::null()));
+ } else {
+ local->SetConstValue(Instance::ZoneHandle(
+ Z, EvaluateExpression(helper_->ReaderOffset(),
+ false))); // read rest of initializer.
+ }
+
+ EvaluateExpression(helper_->ReaderOffset(), false); // read body
+}
+
+void ConstantEvaluator::EvaluatePartialTearoffInstantiation() {
+ // This method call wasn't cached, so receiver et al. isn't cached either.
+ const Instance& receiver = Instance::Handle(
+ Z, EvaluateExpression(helper_->ReaderOffset(), false)); // read receiver.
+ if (!receiver.IsClosure()) {
+ H.ReportError(script_, TokenPosition::kNoSource, "Expected closure.");
+ }
+ const Closure& old_closure = Closure::Cast(receiver);
+
+ // read type arguments.
+ intptr_t num_type_args = helper_->ReadListLength();
+ const TypeArguments* type_args = &T.BuildTypeArguments(num_type_args);
+
+ // Create new closure with the type arguments inserted, and other things
+ // copied over.
+ Closure& new_closure = Closure::Handle(
+ Z,
+ Closure::New(
+ TypeArguments::Handle(Z, old_closure.instantiator_type_arguments()),
+ TypeArguments::Handle(old_closure.function_type_arguments()),
+ *type_args, Function::Handle(Z, old_closure.function()),
+ Context::Handle(Z, old_closure.context()), Heap::kOld));
+ result_ = H.Canonicalize(new_closure);
+}
+
+void ConstantEvaluator::EvaluateBigIntLiteral() {
+ const String& value =
+ H.DartString(helper_->ReadStringReference()); // read string reference.
+ result_ = Integer::New(value, Heap::kOld);
+ if (result_.IsNull()) {
+ H.ReportError(script_, TokenPosition::kNoSource,
+ "Integer literal %s is out of range", value.ToCString());
+ }
+ result_ = H.Canonicalize(result_);
+}
+
+void ConstantEvaluator::EvaluateStringLiteral() {
+ result_ = H.DartSymbolPlain(helper_->ReadStringReference())
+ .raw(); // read string reference.
+}
+
+void ConstantEvaluator::EvaluateIntLiteral(uint8_t payload) {
+ int64_t value = static_cast<int32_t>(payload) - SpecializedIntLiteralBias;
+ result_ = Integer::New(value, Heap::kOld);
+ result_ = H.Canonicalize(result_);
+}
+
+void ConstantEvaluator::EvaluateIntLiteral(bool is_negative) {
+ int64_t value = is_negative ? -static_cast<int64_t>(helper_->ReadUInt())
+ : helper_->ReadUInt(); // read value.
+ result_ = Integer::New(value, Heap::kOld);
+ result_ = H.Canonicalize(result_);
+}
+
+void ConstantEvaluator::EvaluateDoubleLiteral() {
+ result_ = Double::New(helper_->ReadDouble(), Heap::kOld); // read value.
+ result_ = H.Canonicalize(result_);
+}
+
+void ConstantEvaluator::EvaluateBoolLiteral(bool value) {
+ result_ = Bool::Get(value).raw();
+}
+
+void ConstantEvaluator::EvaluateNullLiteral() {
+ result_ = Instance::null();
+}
+
+void ConstantEvaluator::EvaluateConstantExpression() {
+ KernelConstantsMap constant_map(H.constants().raw());
+ result_ ^= constant_map.GetOrDie(helper_->ReadUInt());
+ ASSERT(constant_map.Release().raw() == H.constants().raw());
+}
+
+// This depends on being about to read the list of positionals on arguments.
+const Object& ConstantEvaluator::RunFunction(TokenPosition position,
+ const Function& function,
+ intptr_t argument_count,
+ const Instance* receiver,
+ const TypeArguments* type_args) {
+ // We use a kernel2kernel constant evaluator in Dart 2.0 AOT compilation, so
+ // we should never end up evaluating constants using the VM's constant
+ // evaluator.
+ if (I->strong() && FLAG_precompiled_mode) {
+ UNREACHABLE();
+ }
+
+ // We do not support generic methods yet.
+ ASSERT((receiver == NULL) || (type_args == NULL));
+ intptr_t extra_arguments =
+ (receiver != NULL ? 1 : 0) + (type_args != NULL ? 1 : 0);
+
+ // Build up arguments.
+ const Array& arguments = Array::Handle(
+ Z, Array::New(extra_arguments + argument_count, H.allocation_space()));
+ intptr_t pos = 0;
+ if (receiver != NULL) {
+ arguments.SetAt(pos++, *receiver);
+ }
+ if (type_args != NULL) {
+ arguments.SetAt(pos++, *type_args);
+ }
+
+ // List of positional.
+ intptr_t list_length = helper_->ReadListLength(); // read list length.
+ for (intptr_t i = 0; i < list_length; ++i) {
+ EvaluateExpression(helper_->ReaderOffset(),
+ false); // read ith expression.
+ arguments.SetAt(pos++, result_);
+ }
+
+ // List of named.
+ list_length = helper_->ReadListLength(); // read list length.
+ const Array& names =
+ Array::Handle(Z, Array::New(list_length, H.allocation_space()));
+ for (intptr_t i = 0; i < list_length; ++i) {
+ String& name = H.DartSymbolObfuscate(
+ helper_->ReadStringReference()); // read ith name index.
+ names.SetAt(i, name);
+ EvaluateExpression(helper_->ReaderOffset(),
+ false); // read ith expression.
+ arguments.SetAt(pos++, result_);
+ }
+
+ return RunFunction(position, function, arguments, names);
+}
+
+const Object& ConstantEvaluator::RunFunction(const TokenPosition position,
+ const Function& function,
+ const Array& arguments,
+ const Array& names) {
+ // We do not support generic methods yet.
+ const int kTypeArgsLen = 0;
+ const Array& args_descriptor = Array::Handle(
+ Z, ArgumentsDescriptor::New(kTypeArgsLen, arguments.Length(), names));
+ const Object& result = Object::Handle(
+ Z, DartEntry::InvokeFunction(function, arguments, args_descriptor));
+ if (result.IsError()) {
+ H.ReportError(Error::Cast(result), script_, position,
+ "error evaluating constant constructor");
+ }
+ return result;
+}
+
+const Object& ConstantEvaluator::RunMethodCall(const TokenPosition position,
+ const Function& function,
+ const Instance* receiver) {
+ intptr_t argument_count = helper_->ReadUInt(); // read arguments count.
+
+ // TODO(28109) Support generic methods in the VM or reify them away.
+ ASSERT(helper_->PeekListLength() == 0);
+ helper_->SkipListOfDartTypes(); // read list of types.
+
+ // Run the method.
+ return RunFunction(position, function, argument_count, receiver, NULL);
+}
+
+RawObject* ConstantEvaluator::EvaluateConstConstructorCall(
+ const Class& type_class,
+ const TypeArguments& type_arguments,
+ const Function& constructor,
+ const Object& argument) {
+ // We use a kernel2kernel constant evaluator in Dart 2.0 AOT compilation, so
+ // we should never end up evaluating constants using the VM's constant
+ // evaluator.
+ if (I->strong() && FLAG_precompiled_mode) {
+ UNREACHABLE();
+ }
+
+ // Factories have one extra argument: the type arguments.
+ // Constructors have 1 extra arguments: receiver.
+ const int kTypeArgsLen = 0;
+ const int kNumArgs = 1;
+ const int kNumExtraArgs = 1;
+ const int argument_count = kNumArgs + kNumExtraArgs;
+ const Array& arg_values =
+ Array::Handle(Z, Array::New(argument_count, Heap::kOld));
+ Instance& instance = Instance::Handle(Z);
+ if (!constructor.IsFactory()) {
+ instance = Instance::New(type_class, Heap::kOld);
+ if (!type_arguments.IsNull()) {
+ ASSERT(type_arguments.IsInstantiated());
+ instance.SetTypeArguments(
+ TypeArguments::Handle(Z, type_arguments.Canonicalize()));
+ }
+ arg_values.SetAt(0, instance);
+ } else {
+ // Prepend type_arguments to list of arguments to factory.
+ ASSERT(type_arguments.IsZoneHandle());
+ arg_values.SetAt(0, type_arguments);
+ }
+ arg_values.SetAt((0 + kNumExtraArgs), argument);
+ const Array& args_descriptor =
+ Array::Handle(Z, ArgumentsDescriptor::New(kTypeArgsLen, argument_count,
+ Object::empty_array()));
+ const Object& result = Object::Handle(
+ Z, DartEntry::InvokeFunction(constructor, arg_values, args_descriptor));
+ ASSERT(!result.IsError());
+ if (constructor.IsFactory()) {
+ // The factory method returns the allocated object.
+ instance ^= result.raw();
+ }
+ if (I->obfuscate() &&
+ (instance.clazz() == I->object_store()->symbol_class())) {
+ Obfuscator::ObfuscateSymbolInstance(H.thread(), instance);
+ }
+ return H.Canonicalize(instance);
+}
+
+const TypeArguments* ConstantEvaluator::TranslateTypeArguments(
+ const Function& target,
+ Class* target_klass) {
+ intptr_t type_count = helper_->ReadListLength(); // read type count.
+
+ const TypeArguments* type_arguments = NULL;
+ if (type_count > 0) {
+ type_arguments = &T.BuildInstantiatedTypeArguments(
+ *target_klass, type_count); // read types.
+
+ if (!(type_arguments->IsNull() || type_arguments->IsInstantiated())) {
+ H.ReportError(script_, TokenPosition::kNoSource,
+ "Type must be constant in const constructor.");
+ }
+ } else if (target.IsFactory() && type_arguments == NULL) {
+ // All factories take a type arguments vector as first argument (independent
+ // of whether the class is generic or not).
+ type_arguments = &TypeArguments::ZoneHandle(Z, TypeArguments::null());
+ }
+ return type_arguments;
+}
+
+bool ConstantEvaluator::EvaluateBooleanExpressionHere() {
+ EvaluateExpression(helper_->ReaderOffset(), false);
+ AssertBool();
+ return result_.raw() == Bool::True().raw();
+}
+
+bool ConstantEvaluator::GetCachedConstant(intptr_t kernel_offset,
+ Instance* value) {
+ if (!IsBuildingFlowGraph()) return false;
+
+ const Function& function = flow_graph_builder_->parsed_function_->function();
+ if (function.kind() == RawFunction::kImplicitStaticFinalGetter) {
+ // Don't cache constants in initializer expressions. They get
+ // evaluated only once.
+ return false;
+ }
+
+ bool is_present = false;
+ ASSERT(!script_.InVMHeap());
+ if (script_.compile_time_constants() == Array::null()) {
+ return false;
+ }
+ KernelConstantsMap constants(script_.compile_time_constants());
+ *value ^= constants.GetOrNull(kernel_offset + helper_->data_program_offset_,
+ &is_present);
+ // Mutator compiler thread may add constants while background compiler
+ // is running, and thus change the value of 'compile_time_constants';
+ // do not assert that 'compile_time_constants' has not changed.
+ constants.Release();
+ if (FLAG_compiler_stats && is_present) {
+ ++H.thread()->compiler_stats()->num_const_cache_hits;
+ }
+ return is_present;
+}
+
+void ConstantEvaluator::CacheConstantValue(intptr_t kernel_offset,
+ const Instance& value) {
+ ASSERT(Thread::Current()->IsMutatorThread());
+
+ if (!IsBuildingFlowGraph()) return;
+
+ const Function& function = flow_graph_builder_->parsed_function_->function();
+ if (function.kind() == RawFunction::kImplicitStaticFinalGetter) {
+ // Don't cache constants in initializer expressions. They get
+ // evaluated only once.
+ return;
+ }
+ const intptr_t kInitialConstMapSize = 16;
+ ASSERT(!script_.InVMHeap());
+ if (script_.compile_time_constants() == Array::null()) {
+ const Array& array = Array::Handle(
+ HashTables::New<KernelConstantsMap>(kInitialConstMapSize, Heap::kNew));
+ script_.set_compile_time_constants(array);
+ }
+ KernelConstantsMap constants(script_.compile_time_constants());
+ constants.InsertNewOrGetValue(kernel_offset + helper_->data_program_offset_,
+ value);
+ script_.set_compile_time_constants(constants.Release());
+}
+
+ConstantHelper::ConstantHelper(Zone* zone,
+ KernelReaderHelper* helper,
+ TypeTranslator* type_translator,
+ ActiveClass* active_class,
+ NameIndex skip_vmservice_library)
+ : zone_(zone),
+ helper_(*helper),
+ type_translator_(*type_translator),
+ active_class_(active_class),
+ const_evaluator_(helper, type_translator, active_class, nullptr),
+ translation_helper_(helper->translation_helper_),
+ skip_vmservice_library_(skip_vmservice_library),
+ temp_type_(AbstractType::Handle(zone)),
+ temp_type_arguments_(TypeArguments::Handle(zone)),
+ temp_type_arguments2_(TypeArguments::Handle(zone)),
+ temp_type_arguments3_(TypeArguments::Handle(zone)),
+ temp_object_(Object::Handle(zone)),
+ temp_array_(Array::Handle(zone)),
+ temp_instance_(Instance::Handle(zone)),
+ temp_field_(Field::Handle(zone)),
+ temp_class_(Class::Handle(zone)),
+ temp_function_(Function::Handle(zone)),
+ temp_closure_(Closure::Handle(zone)),
+ temp_context_(Context::Handle(zone)),
+ temp_integer_(Integer::Handle(zone)) {}
+
+const Array& ConstantHelper::ReadConstantTable() {
+ const intptr_t number_of_constants = helper_.ReadUInt();
+ if (number_of_constants == 0) {
+ return Array::Handle(Z, Array::null());
+ }
+
+ const Library& corelib = Library::Handle(Z, Library::CoreLibrary());
+ const Class& list_class =
+ Class::Handle(Z, corelib.LookupClassAllowPrivate(Symbols::_List()));
+
+ // Eagerly finalize _ImmutableList (instead of doing it on every list
+ // constant).
+ temp_class_ = I->class_table()->At(kImmutableArrayCid);
+ temp_object_ = temp_class_.EnsureIsFinalized(H.thread());
+ ASSERT(temp_object_.IsNull());
+
+ KernelConstantsMap constants(
+ HashTables::New<KernelConstantsMap>(number_of_constants, Heap::kOld));
+
+ const intptr_t start_offset = helper_.ReaderOffset();
+
+ for (intptr_t i = 0; i < number_of_constants; ++i) {
+ const intptr_t offset = helper_.ReaderOffset();
+ const intptr_t constant_tag = helper_.ReadByte();
+ switch (constant_tag) {
+ case kNullConstant:
+ temp_instance_ = Instance::null();
+ break;
+ case kBoolConstant:
+ temp_instance_ = helper_.ReadByte() == 1 ? Object::bool_true().raw()
+ : Object::bool_false().raw();
+ break;
+ case kIntConstant: {
+ temp_instance_ = const_evaluator_.EvaluateExpression(
+ helper_.ReaderOffset(), false /* reset position */);
+ break;
+ }
+ case kDoubleConstant: {
+ temp_instance_ = Double::New(helper_.ReadDouble(), Heap::kOld);
+ temp_instance_ = H.Canonicalize(temp_instance_);
+ break;
+ }
+ case kStringConstant: {
+ temp_instance_ =
+ H.Canonicalize(H.DartString(helper_.ReadStringReference()));
+ break;
+ }
+ case kListConstant: {
+ temp_type_arguments_ = TypeArguments::New(1, Heap::kOld);
+ const AbstractType& type = type_translator_.BuildType();
+ temp_type_arguments_.SetTypeAt(0, type);
+ InstantiateTypeArguments(list_class, &temp_type_arguments_);
+
+ const intptr_t length = helper_.ReadUInt();
+ temp_array_ = ImmutableArray::New(length, Heap::kOld);
+ temp_array_.SetTypeArguments(temp_type_arguments_);
+ for (intptr_t j = 0; j < length; ++j) {
+ const intptr_t entry_offset = helper_.ReadUInt();
+ ASSERT(entry_offset < offset); // We have a DAG!
+ temp_object_ = constants.GetOrDie(entry_offset);
+ temp_array_.SetAt(j, temp_object_);
+ }
+
+ temp_instance_ = H.Canonicalize(temp_array_);
+ break;
+ }
+ case kInstanceConstant: {
+ const NameIndex index = helper_.ReadCanonicalNameReference();
+ if (ShouldSkipConstant(index)) {
+ temp_instance_ = Instance::null();
+ break;
+ }
+
+ temp_class_ = H.LookupClassByKernelClass(index);
+ temp_object_ = temp_class_.EnsureIsFinalized(H.thread());
+ ASSERT(temp_object_.IsNull());
+
+ temp_instance_ = Instance::New(temp_class_, Heap::kOld);
+
+ const intptr_t number_of_type_arguments = helper_.ReadUInt();
+ if (temp_class_.NumTypeArguments() > 0) {
+ temp_type_arguments_ =
+ TypeArguments::New(number_of_type_arguments, Heap::kOld);
+ for (intptr_t j = 0; j < number_of_type_arguments; ++j) {
+ temp_type_arguments_.SetTypeAt(j, type_translator_.BuildType());
+ }
+ InstantiateTypeArguments(temp_class_, &temp_type_arguments_);
+ temp_instance_.SetTypeArguments(temp_type_arguments_);
+ } else {
+ ASSERT(number_of_type_arguments == 0);
+ }
+
+ const intptr_t number_of_fields = helper_.ReadUInt();
+ for (intptr_t j = 0; j < number_of_fields; ++j) {
+ temp_field_ =
+ H.LookupFieldByKernelField(helper_.ReadCanonicalNameReference());
+ const intptr_t entry_offset = helper_.ReadUInt();
+ ASSERT(entry_offset < offset); // We have a DAG!
+ temp_object_ = constants.GetOrDie(entry_offset);
+ temp_instance_.SetField(temp_field_, temp_object_);
+ }
+
+ temp_instance_ = H.Canonicalize(temp_instance_);
+ break;
+ }
+ case kPartialInstantiationConstant: {
+ const intptr_t entry_offset = helper_.ReadUInt();
+ temp_object_ = constants.GetOrDie(entry_offset);
+
+ // Happens if the tearoff was in the vmservice library and we have
+ // [skip_vm_service_library] enabled.
+ if (temp_object_.IsNull()) {
+ temp_instance_ = Instance::null();
+ break;
+ }
+
+ const intptr_t number_of_type_arguments = helper_.ReadUInt();
+ ASSERT(number_of_type_arguments > 0);
+ temp_type_arguments_ =
+ TypeArguments::New(number_of_type_arguments, Heap::kOld);
+ for (intptr_t j = 0; j < number_of_type_arguments; ++j) {
+ temp_type_arguments_.SetTypeAt(j, type_translator_.BuildType());
+ }
+
+ // Make a copy of the old closure, with the delayed type arguments
+ // set to [temp_type_arguments_].
+ temp_closure_ = Closure::RawCast(temp_object_.raw());
+ temp_function_ = temp_closure_.function();
+ temp_type_arguments2_ = temp_closure_.instantiator_type_arguments();
+ temp_type_arguments3_ = temp_closure_.function_type_arguments();
+ temp_context_ = temp_closure_.context();
+ temp_closure_ = Closure::New(
+ temp_type_arguments2_, Object::null_type_arguments(),
+ temp_type_arguments_, temp_function_, temp_context_, Heap::kOld);
+ temp_instance_ = H.Canonicalize(temp_closure_);
+ break;
+ }
+ case kTearOffConstant: {
+ const NameIndex index = helper_.ReadCanonicalNameReference();
+ if (ShouldSkipConstant(index)) {
+ temp_instance_ = Instance::null();
+ break;
+ }
+
+ temp_function_ = H.LookupStaticMethodByKernelProcedure(index);
+ temp_function_ = temp_function_.ImplicitClosureFunction();
+ temp_instance_ = temp_function_.ImplicitStaticClosure();
+ temp_instance_ = H.Canonicalize(temp_instance_);
+ break;
+ }
+ case kTypeLiteralConstant: {
+ temp_instance_ = type_translator_.BuildType().raw();
+ break;
+ }
+ case kMapConstant:
+ // Note: This is already lowered to InstanceConstant/ListConstant.
+ UNREACHABLE();
+ break;
+ default:
+ UNREACHABLE();
+ }
+ constants.InsertNewOrGetValue(offset - start_offset, temp_instance_);
+ }
+ return Array::Handle(Z, constants.Release().raw());
+}
+
+void ConstantHelper::InstantiateTypeArguments(const Class& receiver_class,
+ TypeArguments* type_arguments) {
+ // We make a temporary [Type] object and use `ClassFinalizer::FinalizeType` to
+ // finalize the argument types.
+ // (This can for example make the [type_arguments] vector larger)
+ temp_type_ =
+ Type::New(receiver_class, *type_arguments, TokenPosition::kNoSource);
+ temp_type_ = ClassFinalizer::FinalizeType(*active_class_->klass, temp_type_,
+ ClassFinalizer::kCanonicalize);
+ *type_arguments = temp_type_.arguments();
+}
+
+// If [index] has `dart:vm_service` as a parent and we are skipping the VM
+// service library, this method returns `true`, otherwise `false`.
+bool ConstantHelper::ShouldSkipConstant(NameIndex index) {
+ if (index == NameIndex::kInvalidName) {
+ return false;
+ }
+ while (!H.IsLibrary(index)) {
+ index = H.CanonicalNameParent(index);
+ }
+ ASSERT(H.IsLibrary(index));
+ return index == skip_vmservice_library_;
+}
+
+} // namespace kernel
+} // namespace dart
+
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/compiler/frontend/constant_evaluator.h b/runtime/vm/compiler/frontend/constant_evaluator.h
new file mode 100644
index 0000000..48f6e9e
--- /dev/null
+++ b/runtime/vm/compiler/frontend/constant_evaluator.h
@@ -0,0 +1,188 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef RUNTIME_VM_COMPILER_FRONTEND_CONSTANT_EVALUATOR_H_
+#define RUNTIME_VM_COMPILER_FRONTEND_CONSTANT_EVALUATOR_H_
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
+#include "vm/compiler/frontend/kernel_translation_helper.h"
+#include "vm/object.h"
+
+namespace dart {
+namespace kernel {
+
+class FlowGraphBuilder;
+
+// There are several cases when we are compiling constant expressions:
+//
+// * constant field initializers:
+// const FieldName = <expr>;
+//
+// * constant expressions:
+// const [<expr>, ...]
+// const {<expr> : <expr>, ...}
+// const Constructor(<expr>, ...)
+//
+// * constant default parameters:
+// f(a, [b = <expr>])
+// f(a, {b: <expr>})
+//
+// * constant values to compare in a [SwitchCase]
+// case <expr>:
+//
+// In all cases `<expr>` must be recursively evaluated and canonicalized at
+// compile-time.
+class ConstantEvaluator {
+ public:
+ ConstantEvaluator(KernelReaderHelper* helper,
+ TypeTranslator* type_translator,
+ ActiveClass* active_class,
+ FlowGraphBuilder* flow_graph_builder = nullptr);
+
+ virtual ~ConstantEvaluator() {}
+
+ bool IsCached(intptr_t offset);
+
+ RawInstance* EvaluateExpression(intptr_t offset, bool reset_position = true);
+ Instance& EvaluateListLiteral(intptr_t offset, bool reset_position = true);
+ Instance& EvaluateMapLiteral(intptr_t offset, bool reset_position = true);
+ Instance& EvaluateConstructorInvocation(intptr_t offset,
+ bool reset_position = true);
+ RawObject* EvaluateExpressionSafe(intptr_t offset);
+
+ private:
+ bool IsBuildingFlowGraph() const;
+ bool IsAllowedToEvaluate() const;
+ void EvaluateAsExpression();
+ void EvaluateVariableGet(bool is_specialized);
+ void EvaluatePropertyGet();
+ void EvaluateDirectPropertyGet();
+ void EvaluateStaticGet();
+ void EvaluateMethodInvocation();
+ void EvaluateDirectMethodInvocation();
+ void EvaluateSuperMethodInvocation();
+ void EvaluateStaticInvocation();
+ void EvaluateConstructorInvocationInternal();
+ void EvaluateNot();
+ void EvaluateLogicalExpression();
+ void EvaluateConditionalExpression();
+ void EvaluateStringConcatenation();
+ void EvaluateSymbolLiteral();
+ void EvaluateTypeLiteral();
+ void EvaluateListLiteralInternal();
+ void EvaluateMapLiteralInternal();
+ void EvaluateLet();
+ void EvaluatePartialTearoffInstantiation();
+ void EvaluateBigIntLiteral();
+ void EvaluateStringLiteral();
+ void EvaluateIntLiteral(uint8_t payload);
+ void EvaluateIntLiteral(bool is_negative);
+ void EvaluateDoubleLiteral();
+ void EvaluateBoolLiteral(bool value);
+ void EvaluateNullLiteral();
+ void EvaluateConstantExpression();
+
+ void EvaluateGetStringLength(intptr_t expression_offset,
+ TokenPosition position);
+
+ const Object& RunFunction(const TokenPosition position,
+ const Function& function,
+ intptr_t argument_count,
+ const Instance* receiver,
+ const TypeArguments* type_args);
+
+ const Object& RunFunction(const TokenPosition position,
+ const Function& function,
+ const Array& arguments,
+ const Array& names);
+
+ const Object& RunMethodCall(const TokenPosition position,
+ const Function& function,
+ const Instance* receiver);
+
+ RawObject* EvaluateConstConstructorCall(const Class& type_class,
+ const TypeArguments& type_arguments,
+ const Function& constructor,
+ const Object& argument);
+
+ const TypeArguments* TranslateTypeArguments(const Function& target,
+ Class* target_klass);
+
+ void AssertBool() {
+ if (!result_.IsBool()) {
+ translation_helper_.ReportError("Expected boolean expression.");
+ }
+ }
+
+ bool EvaluateBooleanExpressionHere();
+
+ bool GetCachedConstant(intptr_t kernel_offset, Instance* value);
+ void CacheConstantValue(intptr_t kernel_offset, const Instance& value);
+
+ KernelReaderHelper* helper_;
+ Isolate* isolate_;
+ Zone* zone_;
+ TranslationHelper& translation_helper_;
+ TypeTranslator& type_translator_;
+ ActiveClass* active_class_;
+ FlowGraphBuilder* flow_graph_builder_;
+ const Script& script_;
+ Instance& result_;
+
+ DISALLOW_COPY_AND_ASSIGN(ConstantEvaluator);
+};
+
+// Helper class that reads a kernel Constant from binary.
+class ConstantHelper {
+ public:
+ ConstantHelper(Zone* zone,
+ KernelReaderHelper* helper,
+ TypeTranslator* type_translator,
+ ActiveClass* active_class,
+ NameIndex skip_vmservice_library);
+
+ // Reads the constant table from the binary.
+ //
+ // This method assumes the Reader is positioned already at the constant table
+ // and an active class scope is setup.
+ const Array& ReadConstantTable();
+
+ private:
+ void InstantiateTypeArguments(const Class& receiver_class,
+ TypeArguments* type_arguments);
+
+ // If [index] has `dart:vm_service` as a parent and we are skipping the VM
+ // service library, this method returns `true`, otherwise `false`.
+ bool ShouldSkipConstant(NameIndex index);
+
+ Zone* zone_;
+ KernelReaderHelper& helper_;
+ TypeTranslator& type_translator_;
+ ActiveClass* const active_class_;
+ ConstantEvaluator const_evaluator_;
+ TranslationHelper& translation_helper_;
+ NameIndex skip_vmservice_library_;
+ AbstractType& temp_type_;
+ TypeArguments& temp_type_arguments_;
+ TypeArguments& temp_type_arguments2_;
+ TypeArguments& temp_type_arguments3_;
+ Object& temp_object_;
+ Array& temp_array_;
+ Instance& temp_instance_;
+ Field& temp_field_;
+ Class& temp_class_;
+ Function& temp_function_;
+ Closure& temp_closure_;
+ Context& temp_context_;
+ Integer& temp_integer_;
+
+ DISALLOW_COPY_AND_ASSIGN(ConstantHelper);
+};
+
+} // namespace kernel
+} // namespace dart
+
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+#endif // RUNTIME_VM_COMPILER_FRONTEND_CONSTANT_EVALUATOR_H_
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index 46dba1a..588c85a 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -4,14 +4,10 @@
#include "vm/compiler/frontend/kernel_binary_flowgraph.h"
-#include "vm/compiler/aot/precompiler.h"
#include "vm/compiler/frontend/bytecode_reader.h"
#include "vm/compiler/frontend/prologue_builder.h"
#include "vm/compiler/jit/compiler.h"
-#include "vm/dart_entry.h"
-#include "vm/longjump.h"
#include "vm/object_store.h"
-#include "vm/resolver.h"
#include "vm/stack_frame.h"
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -25,387 +21,6 @@
#define I Isolate::Current()
#define B (flow_graph_builder_)
-StreamingConstantEvaluator::StreamingConstantEvaluator(
- StreamingFlowGraphBuilder* builder)
- : builder_(builder),
- isolate_(Isolate::Current()),
- zone_(builder_->zone_),
- translation_helper_(builder_->translation_helper_),
- type_translator_(builder_->type_translator_),
- script_(builder_->script()),
- result_(Instance::Handle(zone_)) {}
-
-bool StreamingConstantEvaluator::IsCached(intptr_t offset) {
- return GetCachedConstant(offset, &result_);
-}
-
-RawInstance* StreamingConstantEvaluator::EvaluateExpression(
- intptr_t offset,
- bool reset_position) {
- ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
- if (!GetCachedConstant(offset, &result_)) {
- ASSERT(IsAllowedToEvaluate());
- intptr_t original_offset = builder_->ReaderOffset();
- builder_->SetOffset(offset);
- uint8_t payload = 0;
- Tag tag = builder_->ReadTag(&payload); // read tag.
- switch (tag) {
- case kVariableGet:
- EvaluateVariableGet(/* is_specialized = */ false);
- break;
- case kSpecializedVariableGet:
- EvaluateVariableGet(/* is_specialized = */ true);
- break;
- case kPropertyGet:
- EvaluatePropertyGet();
- break;
- case kDirectPropertyGet:
- EvaluateDirectPropertyGet();
- break;
- case kStaticGet:
- EvaluateStaticGet();
- break;
- case kMethodInvocation:
- EvaluateMethodInvocation();
- break;
- case kDirectMethodInvocation:
- EvaluateDirectMethodInvocation();
- break;
- case kSuperMethodInvocation:
- EvaluateSuperMethodInvocation();
- break;
- case kStaticInvocation:
- case kConstStaticInvocation:
- EvaluateStaticInvocation();
- break;
- case kConstConstructorInvocation:
- EvaluateConstructorInvocationInternal();
- break;
- case kNot:
- EvaluateNot();
- break;
- case kLogicalExpression:
- EvaluateLogicalExpression();
- break;
- case kConditionalExpression:
- EvaluateConditionalExpression();
- break;
- case kStringConcatenation:
- EvaluateStringConcatenation();
- break;
- case kSymbolLiteral:
- EvaluateSymbolLiteral();
- break;
- case kTypeLiteral:
- EvaluateTypeLiteral();
- break;
- case kAsExpression:
- EvaluateAsExpression();
- break;
- case kConstListLiteral:
- EvaluateListLiteralInternal();
- break;
- case kConstMapLiteral:
- EvaluateMapLiteralInternal();
- break;
- case kLet:
- EvaluateLet();
- break;
- case kInstantiation:
- EvaluatePartialTearoffInstantiation();
- break;
- case kBigIntLiteral:
- EvaluateBigIntLiteral();
- break;
- case kStringLiteral:
- EvaluateStringLiteral();
- break;
- case kSpecializedIntLiteral:
- EvaluateIntLiteral(payload);
- break;
- case kNegativeIntLiteral:
- EvaluateIntLiteral(true);
- break;
- case kPositiveIntLiteral:
- EvaluateIntLiteral(false);
- break;
- case kDoubleLiteral:
- EvaluateDoubleLiteral();
- break;
- case kTrueLiteral:
- EvaluateBoolLiteral(true);
- break;
- case kFalseLiteral:
- EvaluateBoolLiteral(false);
- break;
- case kNullLiteral:
- EvaluateNullLiteral();
- break;
- case kConstantExpression:
- EvaluateConstantExpression();
- break;
- default:
- H.ReportError(
- script_, TokenPosition::kNoSource,
- "Not a constant expression: unexpected kernel tag %s (%" Pd ")",
- Reader::TagName(tag), tag);
- }
-
- CacheConstantValue(offset, result_);
- if (reset_position) builder_->SetOffset(original_offset);
- } else {
- if (!reset_position) {
- builder_->SetOffset(offset);
- builder_->SkipExpression();
- }
- }
- return result_.raw();
-}
-
-Instance& StreamingConstantEvaluator::EvaluateListLiteral(intptr_t offset,
- bool reset_position) {
- if (!GetCachedConstant(offset, &result_)) {
- ASSERT(IsAllowedToEvaluate());
- intptr_t original_offset = builder_->ReaderOffset();
- builder_->SetOffset(offset);
- builder_->ReadTag(); // skip tag.
- EvaluateListLiteralInternal();
-
- CacheConstantValue(offset, result_);
- if (reset_position) builder_->SetOffset(original_offset);
- }
- // We return a new `ZoneHandle` here on purpose: The intermediate language
- // instructions do not make a copy of the handle, so we do it.
- return Instance::ZoneHandle(Z, result_.raw());
-}
-
-Instance& StreamingConstantEvaluator::EvaluateMapLiteral(intptr_t offset,
- bool reset_position) {
- if (!GetCachedConstant(offset, &result_)) {
- ASSERT(IsAllowedToEvaluate());
- intptr_t original_offset = builder_->ReaderOffset();
- builder_->SetOffset(offset);
- builder_->ReadTag(); // skip tag.
- EvaluateMapLiteralInternal();
-
- CacheConstantValue(offset, result_);
- if (reset_position) builder_->SetOffset(original_offset);
- }
- // We return a new `ZoneHandle` here on purpose: The intermediate language
- // instructions do not make a copy of the handle, so we do it.
- return Instance::ZoneHandle(Z, result_.raw());
-}
-
-Instance& StreamingConstantEvaluator::EvaluateConstructorInvocation(
- intptr_t offset,
- bool reset_position) {
- if (!GetCachedConstant(offset, &result_)) {
- ASSERT(IsAllowedToEvaluate());
- intptr_t original_offset = builder_->ReaderOffset();
- builder_->SetOffset(offset);
- builder_->ReadTag(); // skip tag.
- EvaluateConstructorInvocationInternal();
-
- CacheConstantValue(offset, result_);
- if (reset_position) builder_->SetOffset(original_offset);
- }
- // We return a new `ZoneHandle` here on purpose: The intermediate language
- // instructions do not make a copy of the handle, so we do it.
- return Instance::ZoneHandle(Z, result_.raw());
-}
-
-RawObject* StreamingConstantEvaluator::EvaluateExpressionSafe(intptr_t offset) {
- LongJumpScope jump;
- if (setjmp(*jump.Set()) == 0) {
- return EvaluateExpression(offset);
- } else {
- Thread* thread = H.thread();
- Error& error = Error::Handle(Z);
- error = thread->sticky_error();
- thread->clear_sticky_error();
- return error.raw();
- }
-}
-
-bool StreamingConstantEvaluator::IsAllowedToEvaluate() {
- return FLAG_precompiled_mode || builder_->flow_graph_builder_ == NULL ||
- !builder_->optimizing();
-}
-
-void StreamingConstantEvaluator::EvaluateVariableGet(bool is_specialized) {
- // When we see a [VariableGet] the corresponding [VariableDeclaration] must've
- // been executed already. It therefore must have a constant object associated
- // with it.
- const TokenPosition position = builder_->ReadPosition(); // read position.
- const intptr_t variable_kernel_position =
- builder_->ReadUInt(); // read kernel position.
- if (!is_specialized) {
- builder_->ReadUInt(); // read relative variable index.
- builder_->SkipOptionalDartType(); // read promoted type.
- }
- LocalVariable* variable = builder_->LookupVariable(variable_kernel_position);
- if (!variable->IsConst()) {
- H.ReportError(script_, position, "Not a constant expression.");
- }
- result_ = variable->ConstValue()->raw();
-}
-
-void StreamingConstantEvaluator::EvaluateGetStringLength(
- intptr_t expression_offset,
- TokenPosition position) {
- EvaluateExpression(expression_offset);
- if (result_.IsString()) {
- const String& str = String::Handle(Z, String::RawCast(result_.raw()));
- result_ = Integer::New(str.Length(), H.allocation_space());
- } else {
- H.ReportError(
- script_, position,
- "Constant expressions can only call 'length' on string constants.");
- }
-}
-
-void StreamingConstantEvaluator::EvaluatePropertyGet() {
- const TokenPosition position = builder_->ReadPosition(); // read position.
- intptr_t expression_offset = builder_->ReaderOffset();
- builder_->SkipExpression(); // read receiver.
- StringIndex name = builder_->ReadNameAsStringIndex(); // read name.
- builder_->SkipCanonicalNameReference(); // read interface_target_reference.
-
- if (H.StringEquals(name, "length")) {
- EvaluateGetStringLength(expression_offset, position);
- } else {
- H.ReportError(
- script_, position,
- "Constant expressions can only call 'length' on string constants.");
- }
-}
-
-void StreamingConstantEvaluator::EvaluateDirectPropertyGet() {
- TokenPosition position = builder_->ReadPosition(); // read position.
- intptr_t expression_offset = builder_->ReaderOffset();
- builder_->SkipExpression(); // read receiver.
- NameIndex kernel_name =
- builder_->ReadCanonicalNameReference(); // read target_reference.
-
- // TODO(vegorov): add check based on the complete canonical name.
- if (H.IsGetter(kernel_name) &&
- H.StringEquals(H.CanonicalNameString(kernel_name), "length")) {
- EvaluateGetStringLength(expression_offset, position);
- } else {
- H.ReportError(
- script_, position,
- "Constant expressions can only call 'length' on string constants.");
- }
-}
-
-void StreamingConstantEvaluator::EvaluateStaticGet() {
- TokenPosition position = builder_->ReadPosition(); // read position.
- NameIndex target =
- builder_->ReadCanonicalNameReference(); // read target_reference.
-
- ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
-
- if (H.IsField(target)) {
- const Field& field = Field::Handle(Z, H.LookupFieldByKernelField(target));
- if (!field.is_const()) {
- H.ReportError(script_, position, "Not a constant field.");
- }
- if (field.StaticValue() == Object::transition_sentinel().raw()) {
- builder_->InlineBailout(
- "kernel::StreamingConstantEvaluator::EvaluateStaticGet::Cyclic");
- H.ReportError(script_, position, "Not a constant expression.");
- } else if (field.StaticValue() == Object::sentinel().raw()) {
- field.SetStaticValue(Object::transition_sentinel());
- const Object& value =
- Object::Handle(Compiler::EvaluateStaticInitializer(field));
- if (value.IsError()) {
- field.SetStaticValue(Object::null_instance());
- H.ReportError(Error::Cast(value), script_, position,
- "Not a constant expression.");
- UNREACHABLE();
- }
- Thread* thread = H.thread();
- const Error& error =
- Error::Handle(thread->zone(), thread->sticky_error());
- if (!error.IsNull()) {
- field.SetStaticValue(Object::null_instance());
- thread->clear_sticky_error();
- H.ReportError(error, script_, position, "Not a constant expression.");
- UNREACHABLE();
- }
- ASSERT(value.IsNull() || value.IsInstance());
- field.SetStaticValue(value.IsNull() ? Instance::null_instance()
- : Instance::Cast(value));
-
- result_ = field.StaticValue();
- result_ = H.Canonicalize(result_);
- field.SetStaticValue(result_, true);
- } else {
- result_ = field.StaticValue();
- }
- } else if (H.IsProcedure(target)) {
- const Function& function =
- Function::ZoneHandle(Z, H.LookupStaticMethodByKernelProcedure(target));
-
- if (H.IsMethod(target)) {
- Function& closure_function =
- Function::ZoneHandle(Z, function.ImplicitClosureFunction());
- result_ = closure_function.ImplicitStaticClosure();
- result_ = H.Canonicalize(result_);
- } else if (H.IsGetter(target)) {
- H.ReportError(script_, position, "Not a constant expression.");
- } else {
- H.ReportError(script_, position, "Not a constant expression.");
- }
- }
-}
-
-void StreamingConstantEvaluator::EvaluateMethodInvocation() {
- TokenPosition position = builder_->ReadPosition(); // read position.
- // This method call wasn't cached, so receiver et al. isn't cached either.
- const Instance& receiver = Instance::Handle(
- Z,
- EvaluateExpression(builder_->ReaderOffset(), false)); // read receiver.
- Class& klass =
- Class::Handle(Z, isolate_->class_table()->At(receiver.GetClassId()));
- ASSERT(!klass.IsNull());
-
- // Search the superclass chain for the selector.
- const String& method_name = builder_->ReadNameAsMethodName(); // read name.
- Function& function =
- builder_->FindMatchingFunctionAnyArgs(klass, method_name);
-
- // The frontend should guarantee that [MethodInvocation]s inside constant
- // expressions are always valid.
- ASSERT(!function.IsNull());
-
- // Read arguments, run the method and canonicalize the result.
- const Object& result = RunMethodCall(position, function, &receiver);
- result_ ^= result.raw();
- result_ = H.Canonicalize(result_);
-
- builder_->SkipCanonicalNameReference(); // read interface_target_reference.
-}
-
-void StreamingConstantEvaluator::EvaluateDirectMethodInvocation() {
- TokenPosition position = builder_->ReadPosition(); // read position.
-
- const Instance& receiver = Instance::Handle(
- Z,
- EvaluateExpression(builder_->ReaderOffset(), false)); // read receiver.
-
- NameIndex kernel_name =
- builder_->ReadCanonicalNameReference(); // read target_reference.
-
- const Function& function = Function::ZoneHandle(
- Z, H.LookupMethodByMember(kernel_name, H.DartProcedureName(kernel_name)));
-
- // Read arguments, run the method and canonicalize the result.
- const Object& result = RunMethodCall(position, function, &receiver);
- result_ ^= result.raw();
- result_ = H.Canonicalize(result_);
-}
-
Class& StreamingFlowGraphBuilder::GetSuperOrDie() {
Class& klass = Class::Handle(Z, parsed_function()->function().Owner());
ASSERT(!klass.IsNull());
@@ -414,1301 +29,6 @@
return klass;
}
-void StreamingConstantEvaluator::EvaluateSuperMethodInvocation() {
- TokenPosition position = builder_->ReadPosition(); // read position.
-
- const LocalVariable* this_variable = builder_->scopes()->this_variable;
- ASSERT(this_variable->IsConst());
- const Instance& receiver =
- Instance::Handle(Z, this_variable->ConstValue()->raw());
- ASSERT(!receiver.IsNull());
-
- Class& klass = builder_->GetSuperOrDie();
-
- const String& method_name = builder_->ReadNameAsMethodName(); // read name.
- Function& function =
- builder_->FindMatchingFunctionAnyArgs(klass, method_name);
-
- // The frontend should guarantee that [MethodInvocation]s inside constant
- // expressions are always valid.
- ASSERT(!function.IsNull());
-
- // Read arguments, run the method and canonicalize the result.
- const Object& result = RunMethodCall(position, function, &receiver);
- result_ ^= result.raw();
- result_ = H.Canonicalize(result_);
-
- builder_->SkipCanonicalNameReference(); // read interface_target_reference.
-}
-
-void StreamingConstantEvaluator::EvaluateStaticInvocation() {
- TokenPosition position = builder_->ReadPosition(); // read position.
- NameIndex procedure_reference =
- builder_->ReadCanonicalNameReference(); // read procedure reference.
-
- const Function& function = Function::ZoneHandle(
- Z, H.LookupStaticMethodByKernelProcedure(procedure_reference));
- Class& klass = Class::Handle(Z, function.Owner());
-
- intptr_t argument_count =
- builder_->ReadUInt(); // read arguments part #1: arguments count.
-
- // Build the type arguments vector (if necessary).
- const TypeArguments* type_arguments =
- TranslateTypeArguments(function, &klass); // read argument types.
-
- // read positional and named parameters.
- const Object& result =
- RunFunction(position, function, argument_count, NULL, type_arguments);
- result_ ^= result.raw();
- result_ = H.Canonicalize(result_);
-}
-
-void StreamingConstantEvaluator::EvaluateConstructorInvocationInternal() {
- TokenPosition position = builder_->ReadPosition(); // read position.
-
- NameIndex target = builder_->ReadCanonicalNameReference(); // read target.
- const Function& constructor =
- Function::Handle(Z, H.LookupConstructorByKernelConstructor(target));
- Class& klass = Class::Handle(Z, constructor.Owner());
-
- intptr_t argument_count =
- builder_->ReadUInt(); // read arguments part #1: arguments count.
-
- // Build the type arguments vector (if necessary).
- const TypeArguments* type_arguments =
- TranslateTypeArguments(constructor, &klass); // read argument types.
-
- if (klass.NumTypeArguments() > 0 && !klass.IsGeneric()) {
- Type& type = Type::ZoneHandle(Z, T.ReceiverType(klass).raw());
- // TODO(27590): Can we move this code into [ReceiverType]?
- type ^= ClassFinalizer::FinalizeType(*builder_->active_class()->klass, type,
- ClassFinalizer::kFinalize);
- ASSERT(!type.IsMalformedOrMalbounded());
-
- TypeArguments& canonicalized_type_arguments =
- TypeArguments::ZoneHandle(Z, type.arguments());
- canonicalized_type_arguments = canonicalized_type_arguments.Canonicalize();
- type_arguments = &canonicalized_type_arguments;
- }
-
- // Prepare either the instance or the type argument vector for the constructor
- // call.
- Instance* receiver = NULL;
- const TypeArguments* type_arguments_argument = NULL;
- if (!constructor.IsFactory()) {
- receiver = &Instance::Handle(Z, Instance::New(klass, Heap::kOld));
- if (type_arguments != NULL) {
- receiver->SetTypeArguments(*type_arguments);
- }
- } else {
- type_arguments_argument = type_arguments;
- }
-
- // read positional and named parameters.
- const Object& result = RunFunction(position, constructor, argument_count,
- receiver, type_arguments_argument);
-
- if (constructor.IsFactory()) {
- // Factories return the new object.
- result_ ^= result.raw();
- } else {
- ASSERT(!receiver->IsNull());
- result_ ^= (*receiver).raw();
- }
- if (I->obfuscate() &&
- (result_.clazz() == I->object_store()->symbol_class())) {
- Obfuscator::ObfuscateSymbolInstance(H.thread(), result_);
- }
- result_ = H.Canonicalize(result_);
-}
-
-void StreamingConstantEvaluator::EvaluateNot() {
- result_ ^= Bool::Get(!EvaluateBooleanExpressionHere()).raw();
-}
-
-void StreamingConstantEvaluator::EvaluateLogicalExpression() {
- bool left = EvaluateBooleanExpressionHere(); // read left.
- LogicalOperator op = static_cast<LogicalOperator>(builder_->ReadByte());
- if (op == kAnd) {
- if (left) {
- EvaluateBooleanExpressionHere(); // read right.
- } else {
- builder_->SkipExpression(); // read right.
- }
- } else {
- ASSERT(op == kOr);
- if (!left) {
- EvaluateBooleanExpressionHere(); // read right.
- } else {
- builder_->SkipExpression(); // read right.
- }
- }
-}
-
-void StreamingConstantEvaluator::EvaluateAsExpression() {
- TokenPosition position = builder_->ReadPosition();
- const uint8_t flags = builder_->ReadFlags();
- const bool is_type_error = (flags & (1 << 0)) != 0;
-
- // Check that this AsExpression was inserted by the front-end.
- if (!is_type_error) {
- H.ReportError(
- script_, position,
- "explicit as operator is not permitted in constant expression");
- }
-
- EvaluateExpression(builder_->ReaderOffset(), false);
-
- const AbstractType& type = T.BuildType();
- if (!type.IsInstantiated() || type.IsMalformed()) {
- const String& type_str = String::Handle(type.UserVisibleName());
- H.ReportError(
- script_, position,
- "Not a constant expression: right hand side of an implicit "
- "as-expression is expected to be an instantiated type, got %s",
- type_str.ToCString());
- }
-
- const TypeArguments& instantiator_type_arguments = TypeArguments::Handle();
- const TypeArguments& function_type_arguments = TypeArguments::Handle();
- Error& error = Error::Handle();
- if (!result_.IsInstanceOf(type, instantiator_type_arguments,
- function_type_arguments, &error)) {
- const AbstractType& rtype =
- AbstractType::Handle(result_.GetType(Heap::kNew));
- const String& result_str = String::Handle(rtype.UserVisibleName());
- const String& type_str = String::Handle(type.UserVisibleName());
- H.ReportError(
- script_, position,
- "Not a constant expression: Type '%s' is not a subtype of type '%s'",
- result_str.ToCString(), type_str.ToCString());
- }
-}
-
-void StreamingConstantEvaluator::EvaluateConditionalExpression() {
- bool condition = EvaluateBooleanExpressionHere();
- if (condition) {
- EvaluateExpression(builder_->ReaderOffset(), false); // read then.
- builder_->SkipExpression(); // read otherwise.
- } else {
- builder_->SkipExpression(); // read then.
- EvaluateExpression(builder_->ReaderOffset(), false); // read otherwise.
- }
- builder_->SkipOptionalDartType(); // read unused static type.
-}
-
-void StreamingConstantEvaluator::EvaluateStringConcatenation() {
- TokenPosition position = builder_->ReadPosition(); // read position.
- intptr_t length = builder_->ReadListLength(); // read list length.
-
- bool all_string = true;
- const Array& strings =
- Array::Handle(Z, Array::New(length, H.allocation_space()));
- for (intptr_t i = 0; i < length; ++i) {
- EvaluateExpression(builder_->ReaderOffset(),
- false); // read ith expression.
- strings.SetAt(i, result_);
- all_string = all_string && result_.IsString();
- }
- if (all_string) {
- result_ = String::ConcatAll(strings, Heap::kOld);
- result_ = H.Canonicalize(result_);
- } else {
- // Get string interpolation function.
- const Class& cls =
- Class::Handle(Z, Library::LookupCoreClass(Symbols::StringBase()));
- ASSERT(!cls.IsNull());
- const Function& func = Function::Handle(
- Z, cls.LookupStaticFunction(
- Library::PrivateCoreLibName(Symbols::Interpolate())));
- ASSERT(!func.IsNull());
-
- // Build argument array to pass to the interpolation function.
- const Array& interpolate_arg = Array::Handle(Z, Array::New(1, Heap::kOld));
- interpolate_arg.SetAt(0, strings);
-
- // Run and canonicalize.
- const Object& result =
- RunFunction(position, func, interpolate_arg, Array::null_array());
- result_ = H.Canonicalize(String::Cast(result));
- }
-}
-
-void StreamingConstantEvaluator::EvaluateSymbolLiteral() {
- const Class& owner = *builder_->active_class()->klass;
- const Library& lib = Library::Handle(Z, owner.library());
- String& symbol_value = H.DartIdentifier(lib, builder_->ReadStringReference());
- const Class& symbol_class =
- Class::ZoneHandle(Z, I->object_store()->symbol_class());
- ASSERT(!symbol_class.IsNull());
- const Function& symbol_constructor = Function::ZoneHandle(
- Z, symbol_class.LookupConstructor(Symbols::SymbolCtor()));
- ASSERT(!symbol_constructor.IsNull());
- result_ ^= EvaluateConstConstructorCall(
- symbol_class, TypeArguments::Handle(Z), symbol_constructor, symbol_value);
-}
-
-void StreamingConstantEvaluator::EvaluateTypeLiteral() {
- const AbstractType& type = T.BuildType();
- if (type.IsMalformed()) {
- H.ReportError(script_, TokenPosition::kNoSource,
- "Malformed type literal in constant expression.");
- }
- result_ = type.raw();
-}
-
-void StreamingConstantEvaluator::EvaluateListLiteralInternal() {
- builder_->ReadPosition(); // read position.
- const TypeArguments& type_arguments = T.BuildTypeArguments(1); // read type.
- intptr_t length = builder_->ReadListLength(); // read list length.
- const Array& const_list =
- Array::ZoneHandle(Z, Array::New(length, Heap::kOld));
- const_list.SetTypeArguments(type_arguments);
- Instance& expression = Instance::Handle(Z);
- for (intptr_t i = 0; i < length; ++i) {
- expression = EvaluateExpression(builder_->ReaderOffset(),
- false); // read ith expression.
- const_list.SetAt(i, expression);
- }
- const_list.MakeImmutable();
- result_ = H.Canonicalize(const_list);
-}
-
-void StreamingConstantEvaluator::EvaluateMapLiteralInternal() {
- builder_->ReadPosition(); // read position.
- const TypeArguments& type_arguments =
- T.BuildTypeArguments(2); // read key type and value type.
-
- intptr_t length = builder_->ReadListLength(); // read length of entries.
-
- // This MapLiteral wasn't cached, so content isn't cached either.
- Array& const_kv_array = Array::Handle(Z, Array::New(2 * length, Heap::kOld));
- Instance& temp = Instance::Handle(Z);
- for (intptr_t i = 0; i < length; ++i) {
- temp = EvaluateExpression(builder_->ReaderOffset(), false); // read key.
- const_kv_array.SetAt(2 * i + 0, temp);
- temp = EvaluateExpression(builder_->ReaderOffset(), false); // read value.
- const_kv_array.SetAt(2 * i + 1, temp);
- }
-
- const_kv_array.MakeImmutable();
- const_kv_array ^= H.Canonicalize(const_kv_array);
-
- const Class& map_class =
- Class::Handle(Z, Library::LookupCoreClass(Symbols::ImmutableMap()));
- ASSERT(!map_class.IsNull());
- ASSERT(map_class.NumTypeArguments() == 2);
-
- const Field& field =
- Field::Handle(Z, map_class.LookupInstanceFieldAllowPrivate(
- H.DartSymbolObfuscate("_kvPairs")));
- ASSERT(!field.IsNull());
-
- // NOTE: This needs to be kept in sync with `runtime/lib/immutable_map.dart`!
- result_ = Instance::New(map_class, Heap::kOld);
- ASSERT(!result_.IsNull());
- result_.SetTypeArguments(type_arguments);
- result_.SetField(field, const_kv_array);
- result_ = H.Canonicalize(result_);
-}
-
-void StreamingConstantEvaluator::EvaluateLet() {
- intptr_t kernel_position =
- builder_->ReaderOffset() + builder_->data_program_offset_;
- LocalVariable* local = builder_->LookupVariable(kernel_position);
-
- // read variable declaration.
- VariableDeclarationHelper helper(builder_);
- helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer);
- Tag tag = builder_->ReadTag(); // read (first part of) initializer.
- if (tag == kNothing) {
- local->SetConstValue(Instance::ZoneHandle(Z, Instance::null()));
- } else {
- local->SetConstValue(Instance::ZoneHandle(
- Z, EvaluateExpression(builder_->ReaderOffset(),
- false))); // read rest of initializer.
- }
-
- EvaluateExpression(builder_->ReaderOffset(), false); // read body
-}
-
-void StreamingConstantEvaluator::EvaluatePartialTearoffInstantiation() {
- // This method call wasn't cached, so receiver et al. isn't cached either.
- const Instance& receiver = Instance::Handle(
- Z,
- EvaluateExpression(builder_->ReaderOffset(), false)); // read receiver.
- if (!receiver.IsClosure()) {
- H.ReportError(script_, TokenPosition::kNoSource, "Expected closure.");
- }
- const Closure& old_closure = Closure::Cast(receiver);
-
- // read type arguments.
- intptr_t num_type_args = builder_->ReadListLength();
- const TypeArguments* type_args = &T.BuildTypeArguments(num_type_args);
-
- // Create new closure with the type arguments inserted, and other things
- // copied over.
- Closure& new_closure = Closure::Handle(
- Z,
- Closure::New(
- TypeArguments::Handle(Z, old_closure.instantiator_type_arguments()),
- TypeArguments::Handle(old_closure.function_type_arguments()),
- *type_args, Function::Handle(Z, old_closure.function()),
- Context::Handle(Z, old_closure.context()), Heap::kOld));
- result_ = H.Canonicalize(new_closure);
-}
-
-void StreamingConstantEvaluator::EvaluateBigIntLiteral() {
- const String& value =
- H.DartString(builder_->ReadStringReference()); // read string reference.
- result_ = Integer::New(value, Heap::kOld);
- if (result_.IsNull()) {
- H.ReportError(script_, TokenPosition::kNoSource,
- "Integer literal %s is out of range", value.ToCString());
- }
- result_ = H.Canonicalize(result_);
-}
-
-void StreamingConstantEvaluator::EvaluateStringLiteral() {
- result_ = H.DartSymbolPlain(builder_->ReadStringReference())
- .raw(); // read string reference.
-}
-
-void StreamingConstantEvaluator::EvaluateIntLiteral(uint8_t payload) {
- int64_t value = static_cast<int32_t>(payload) - SpecializedIntLiteralBias;
- result_ = Integer::New(value, Heap::kOld);
- result_ = H.Canonicalize(result_);
-}
-
-void StreamingConstantEvaluator::EvaluateIntLiteral(bool is_negative) {
- int64_t value = is_negative ? -static_cast<int64_t>(builder_->ReadUInt())
- : builder_->ReadUInt(); // read value.
- result_ = Integer::New(value, Heap::kOld);
- result_ = H.Canonicalize(result_);
-}
-
-void StreamingConstantEvaluator::EvaluateDoubleLiteral() {
- result_ = Double::New(builder_->ReadDouble(), Heap::kOld); // read value.
- result_ = H.Canonicalize(result_);
-}
-
-void StreamingConstantEvaluator::EvaluateBoolLiteral(bool value) {
- result_ = Bool::Get(value).raw();
-}
-
-void StreamingConstantEvaluator::EvaluateNullLiteral() {
- result_ = Instance::null();
-}
-
-void StreamingConstantEvaluator::EvaluateConstantExpression() {
- KernelConstantsMap constant_map(H.constants().raw());
- result_ ^= constant_map.GetOrDie(builder_->ReadUInt());
- ASSERT(constant_map.Release().raw() == H.constants().raw());
-}
-
-// This depends on being about to read the list of positionals on arguments.
-const Object& StreamingConstantEvaluator::RunFunction(
- TokenPosition position,
- const Function& function,
- intptr_t argument_count,
- const Instance* receiver,
- const TypeArguments* type_args) {
- // We use a kernel2kernel constant evaluator in Dart 2.0 AOT compilation, so
- // we should never end up evaluating constants using the VM's constant
- // evaluator.
- if (I->strong() && FLAG_precompiled_mode) {
- UNREACHABLE();
- }
-
- // We do not support generic methods yet.
- ASSERT((receiver == NULL) || (type_args == NULL));
- intptr_t extra_arguments =
- (receiver != NULL ? 1 : 0) + (type_args != NULL ? 1 : 0);
-
- // Build up arguments.
- const Array& arguments = Array::Handle(
- Z, Array::New(extra_arguments + argument_count, H.allocation_space()));
- intptr_t pos = 0;
- if (receiver != NULL) {
- arguments.SetAt(pos++, *receiver);
- }
- if (type_args != NULL) {
- arguments.SetAt(pos++, *type_args);
- }
-
- // List of positional.
- intptr_t list_length = builder_->ReadListLength(); // read list length.
- for (intptr_t i = 0; i < list_length; ++i) {
- EvaluateExpression(builder_->ReaderOffset(),
- false); // read ith expression.
- arguments.SetAt(pos++, result_);
- }
-
- // List of named.
- list_length = builder_->ReadListLength(); // read list length.
- const Array& names =
- Array::Handle(Z, Array::New(list_length, H.allocation_space()));
- for (intptr_t i = 0; i < list_length; ++i) {
- String& name = H.DartSymbolObfuscate(
- builder_->ReadStringReference()); // read ith name index.
- names.SetAt(i, name);
- EvaluateExpression(builder_->ReaderOffset(),
- false); // read ith expression.
- arguments.SetAt(pos++, result_);
- }
-
- return RunFunction(position, function, arguments, names);
-}
-
-const Object& StreamingConstantEvaluator::RunFunction(
- const TokenPosition position,
- const Function& function,
- const Array& arguments,
- const Array& names) {
- // We do not support generic methods yet.
- const int kTypeArgsLen = 0;
- const Array& args_descriptor = Array::Handle(
- Z, ArgumentsDescriptor::New(kTypeArgsLen, arguments.Length(), names));
- const Object& result = Object::Handle(
- Z, DartEntry::InvokeFunction(function, arguments, args_descriptor));
- if (result.IsError()) {
- H.ReportError(Error::Cast(result), script_, position,
- "error evaluating constant constructor");
- }
- return result;
-}
-
-const Object& StreamingConstantEvaluator::RunMethodCall(
- const TokenPosition position,
- const Function& function,
- const Instance* receiver) {
- intptr_t argument_count = builder_->ReadUInt(); // read arguments count.
-
- // TODO(28109) Support generic methods in the VM or reify them away.
- ASSERT(builder_->PeekListLength() == 0);
- builder_->SkipListOfDartTypes(); // read list of types.
-
- // Run the method.
- return RunFunction(position, function, argument_count, receiver, NULL);
-}
-
-RawObject* StreamingConstantEvaluator::EvaluateConstConstructorCall(
- const Class& type_class,
- const TypeArguments& type_arguments,
- const Function& constructor,
- const Object& argument) {
- // We use a kernel2kernel constant evaluator in Dart 2.0 AOT compilation, so
- // we should never end up evaluating constants using the VM's constant
- // evaluator.
- if (I->strong() && FLAG_precompiled_mode) {
- UNREACHABLE();
- }
-
- // Factories have one extra argument: the type arguments.
- // Constructors have 1 extra arguments: receiver.
- const int kTypeArgsLen = 0;
- const int kNumArgs = 1;
- const int kNumExtraArgs = 1;
- const int argument_count = kNumArgs + kNumExtraArgs;
- const Array& arg_values =
- Array::Handle(Z, Array::New(argument_count, Heap::kOld));
- Instance& instance = Instance::Handle(Z);
- if (!constructor.IsFactory()) {
- instance = Instance::New(type_class, Heap::kOld);
- if (!type_arguments.IsNull()) {
- ASSERT(type_arguments.IsInstantiated());
- instance.SetTypeArguments(
- TypeArguments::Handle(Z, type_arguments.Canonicalize()));
- }
- arg_values.SetAt(0, instance);
- } else {
- // Prepend type_arguments to list of arguments to factory.
- ASSERT(type_arguments.IsZoneHandle());
- arg_values.SetAt(0, type_arguments);
- }
- arg_values.SetAt((0 + kNumExtraArgs), argument);
- const Array& args_descriptor =
- Array::Handle(Z, ArgumentsDescriptor::New(kTypeArgsLen, argument_count,
- Object::empty_array()));
- const Object& result = Object::Handle(
- Z, DartEntry::InvokeFunction(constructor, arg_values, args_descriptor));
- ASSERT(!result.IsError());
- if (constructor.IsFactory()) {
- // The factory method returns the allocated object.
- instance ^= result.raw();
- }
- if (I->obfuscate() &&
- (instance.clazz() == I->object_store()->symbol_class())) {
- Obfuscator::ObfuscateSymbolInstance(H.thread(), instance);
- }
- return H.Canonicalize(instance);
-}
-
-const TypeArguments* StreamingConstantEvaluator::TranslateTypeArguments(
- const Function& target,
- Class* target_klass) {
- intptr_t type_count = builder_->ReadListLength(); // read type count.
-
- const TypeArguments* type_arguments = NULL;
- if (type_count > 0) {
- type_arguments = &T.BuildInstantiatedTypeArguments(
- *target_klass, type_count); // read types.
-
- if (!(type_arguments->IsNull() || type_arguments->IsInstantiated())) {
- H.ReportError(script_, TokenPosition::kNoSource,
- "Type must be constant in const constructor.");
- }
- } else if (target.IsFactory() && type_arguments == NULL) {
- // All factories take a type arguments vector as first argument (independent
- // of whether the class is generic or not).
- type_arguments = &TypeArguments::ZoneHandle(Z, TypeArguments::null());
- }
- return type_arguments;
-}
-
-bool StreamingConstantEvaluator::EvaluateBooleanExpressionHere() {
- EvaluateExpression(builder_->ReaderOffset(), false);
- AssertBool();
- return result_.raw() == Bool::True().raw();
-}
-
-bool StreamingConstantEvaluator::GetCachedConstant(intptr_t kernel_offset,
- Instance* value) {
- if (builder_ == NULL || builder_->flow_graph_builder_ == NULL) return false;
-
- const Function& function = builder_->parsed_function()->function();
- if (function.kind() == RawFunction::kImplicitStaticFinalGetter) {
- // Don't cache constants in initializer expressions. They get
- // evaluated only once.
- return false;
- }
-
- bool is_present = false;
- ASSERT(!script_.InVMHeap());
- if (script_.compile_time_constants() == Array::null()) {
- return false;
- }
- KernelConstantsMap constants(script_.compile_time_constants());
- *value ^= constants.GetOrNull(kernel_offset + builder_->data_program_offset_,
- &is_present);
- // Mutator compiler thread may add constants while background compiler
- // is running, and thus change the value of 'compile_time_constants';
- // do not assert that 'compile_time_constants' has not changed.
- constants.Release();
- if (FLAG_compiler_stats && is_present) {
- ++H.thread()->compiler_stats()->num_const_cache_hits;
- }
- return is_present;
-}
-
-void StreamingConstantEvaluator::CacheConstantValue(intptr_t kernel_offset,
- const Instance& value) {
- ASSERT(Thread::Current()->IsMutatorThread());
-
- if (builder_ == NULL || builder_->flow_graph_builder_ == NULL) return;
-
- const Function& function = builder_->parsed_function()->function();
- if (function.kind() == RawFunction::kImplicitStaticFinalGetter) {
- // Don't cache constants in initializer expressions. They get
- // evaluated only once.
- return;
- }
- const intptr_t kInitialConstMapSize = 16;
- ASSERT(!script_.InVMHeap());
- if (script_.compile_time_constants() == Array::null()) {
- const Array& array = Array::Handle(
- HashTables::New<KernelConstantsMap>(kInitialConstMapSize, Heap::kNew));
- script_.set_compile_time_constants(array);
- }
- KernelConstantsMap constants(script_.compile_time_constants());
- constants.InsertNewOrGetValue(kernel_offset + builder_->data_program_offset_,
- value);
- script_.set_compile_time_constants(constants.Release());
-}
-
-void KernelFingerprintHelper::BuildHash(uint32_t val) {
- hash_ = CalculateHash(hash_, val);
-}
-
-void KernelFingerprintHelper::CalculateConstructorFingerprint() {
- ConstructorHelper helper(this);
-
- helper.ReadUntilExcluding(ConstructorHelper::kAnnotations);
- CalculateListOfExpressionsFingerprint();
- CalculateFunctionNodeFingerprint();
- intptr_t len = ReadListLength();
- for (intptr_t i = 0; i < len; ++i) {
- CalculateInitializerFingerprint();
- }
- helper.SetJustRead(ConstructorHelper::kInitializers);
- BuildHash(helper.flags_);
- BuildHash(helper.annotation_count_);
-}
-
-void KernelFingerprintHelper::CalculateArgumentsFingerprint() {
- BuildHash(ReadUInt()); // read argument count.
-
- CalculateListOfDartTypesFingerprint(); // read list of types.
- CalculateListOfExpressionsFingerprint(); // read positionals.
-
- // List of named.
- intptr_t list_length = ReadListLength(); // read list length.
- for (intptr_t i = 0; i < list_length; ++i) {
- CalculateStringReferenceFingerprint(); // read ith name index.
- CalculateExpressionFingerprint(); // read ith expression.
- }
-}
-
-void KernelFingerprintHelper::CalculateVariableDeclarationFingerprint() {
- VariableDeclarationHelper helper(this);
-
- helper.ReadUntilExcluding(VariableDeclarationHelper::kAnnotations);
- CalculateListOfExpressionsFingerprint();
- helper.SetJustRead(VariableDeclarationHelper::kAnnotations);
-
- helper.ReadUntilExcluding(VariableDeclarationHelper::kType);
- // We don't need to use the helper after this point.
- CalculateDartTypeFingerprint();
- if (ReadTag() == kSomething) {
- CalculateExpressionFingerprint();
- }
-
- BuildHash(helper.flags_);
-}
-
-void KernelFingerprintHelper::CalculateStatementListFingerprint() {
- intptr_t list_length = ReadListLength(); // read list length.
- for (intptr_t i = 0; i < list_length; ++i) {
- CalculateStatementFingerprint(); // read ith expression.
- }
-}
-
-void KernelFingerprintHelper::CalculateListOfExpressionsFingerprint() {
- intptr_t list_length = ReadListLength(); // read list length.
- for (intptr_t i = 0; i < list_length; ++i) {
- CalculateExpressionFingerprint(); // read ith expression.
- }
-}
-
-void KernelFingerprintHelper::CalculateListOfDartTypesFingerprint() {
- intptr_t list_length = ReadListLength(); // read list length.
- for (intptr_t i = 0; i < list_length; ++i) {
- CalculateDartTypeFingerprint(); // read ith type.
- }
-}
-
-void KernelFingerprintHelper::CalculateStringReferenceFingerprint() {
- BuildHash(
- H.DartString(ReadStringReference()).Hash()); // read ith string index.
-}
-
-void KernelFingerprintHelper::CalculateListOfStringsFingerprint() {
- intptr_t list_length = ReadListLength(); // read list length.
- for (intptr_t i = 0; i < list_length; ++i) {
- CalculateStringReferenceFingerprint(); // read ith string index.
- }
-}
-
-void KernelFingerprintHelper::CalculateListOfVariableDeclarationsFingerprint() {
- intptr_t list_length = ReadListLength(); // read list length.
- for (intptr_t i = 0; i < list_length; ++i) {
- // read ith variable declaration.
- CalculateVariableDeclarationFingerprint();
- }
-}
-
-void KernelFingerprintHelper::CalculateTypeParameterFingerprint() {
- TypeParameterHelper helper(this);
-
- helper.ReadUntilExcluding(TypeParameterHelper::kAnnotations);
- CalculateListOfExpressionsFingerprint();
- helper.SetJustRead(TypeParameterHelper::kAnnotations);
-
- helper.ReadUntilExcluding(TypeParameterHelper::kBound);
- // The helper isn't needed after this point.
- CalculateDartTypeFingerprint();
- if (ReadTag() == kSomething) {
- CalculateDartTypeFingerprint();
- }
- BuildHash(helper.flags_);
-}
-
-void KernelFingerprintHelper::CalculateTypeParametersListFingerprint() {
- intptr_t list_length = ReadListLength(); // read list length.
- for (intptr_t i = 0; i < list_length; ++i) {
- CalculateTypeParameterFingerprint();
- }
-}
-
-void KernelFingerprintHelper::CalculateCanonicalNameFingerprint() {
- const StringIndex i = H.CanonicalNameString(ReadCanonicalNameReference());
- BuildHash(H.DartString(i).Hash());
-}
-
-void KernelFingerprintHelper::CalculateInitializerFingerprint() {
- Tag tag = ReadTag();
- ReadByte(); // read isSynthetic flag.
- switch (tag) {
- case kInvalidInitializer:
- return;
- case kFieldInitializer:
- BuildHash(H.DartFieldName(ReadCanonicalNameReference()).Hash());
- CalculateExpressionFingerprint(); // read value.
- return;
- case kSuperInitializer:
- ReadPosition(); // read position.
- CalculateCanonicalNameFingerprint(); // read target_reference
- CalculateArgumentsFingerprint(); // read arguments.
- return;
- case kRedirectingInitializer:
- ReadPosition(); // read position.
- CalculateCanonicalNameFingerprint(); // read target_reference
- CalculateArgumentsFingerprint(); // read arguments.
- return;
- case kLocalInitializer:
- CalculateVariableDeclarationFingerprint(); // read variable.
- return;
- case kAssertInitializer:
- CalculateStatementFingerprint();
- return;
- default:
- ReportUnexpectedTag("initializer", tag);
- UNREACHABLE();
- }
-}
-
-void KernelFingerprintHelper::CalculateDartTypeFingerprint() {
- Tag tag = ReadTag();
- BuildHash(tag);
- switch (tag) {
- case kInvalidType:
- case kDynamicType:
- case kVoidType:
- case kBottomType:
- // those contain nothing.
- break;
- UNIMPLEMENTED();
- case kInterfaceType:
- CalculateInterfaceTypeFingerprint(false);
- break;
- case kSimpleInterfaceType:
- CalculateInterfaceTypeFingerprint(true);
- break;
- case kFunctionType:
- CalculateFunctionTypeFingerprint(false);
- break;
- case kSimpleFunctionType:
- CalculateFunctionTypeFingerprint(true);
- break;
- case kTypeParameterType:
- ReadUInt(); // read index for parameter.
- CalculateOptionalDartTypeFingerprint(); // read bound bound.
- break;
- default:
- ReportUnexpectedTag("type", tag);
- UNREACHABLE();
- }
-}
-
-void KernelFingerprintHelper::CalculateOptionalDartTypeFingerprint() {
- Tag tag = ReadTag(); // read tag.
- BuildHash(tag);
- if (tag == kNothing) {
- return;
- }
- ASSERT(tag == kSomething);
- CalculateDartTypeFingerprint(); // read type.
-}
-
-void KernelFingerprintHelper::CalculateInterfaceTypeFingerprint(bool simple) {
- BuildHash(ReadUInt()); // read klass_name.
- if (!simple) {
- CalculateListOfDartTypesFingerprint(); // read list of types.
- }
-}
-
-void KernelFingerprintHelper::CalculateFunctionTypeFingerprint(bool simple) {
- if (!simple) {
- CalculateTypeParametersListFingerprint(); // read type_parameters.
- BuildHash(ReadUInt()); // read required parameter count.
- BuildHash(ReadUInt()); // read total parameter count.
- }
-
- CalculateListOfDartTypesFingerprint(); // read positional_parameters types.
-
- if (!simple) {
- const intptr_t named_count =
- ReadListLength(); // read named_parameters list length.
- BuildHash(named_count);
- for (intptr_t i = 0; i < named_count; ++i) {
- // read string reference (i.e. named_parameters[i].name).
- CalculateStringReferenceFingerprint();
- CalculateDartTypeFingerprint(); // read named_parameters[i].type.
- }
- }
-
- CalculateListOfStringsFingerprint(); // read positional parameter names.
-
- if (!simple) {
- // TODO(bkonyi): include in hash.
- SkipCanonicalNameReference(); // read typedef reference.
- }
-
- CalculateDartTypeFingerprint(); // read return type.
-}
-
-void KernelFingerprintHelper::CalculateGetterNameFingerprint() {
- const NameIndex name = ReadCanonicalNameReference();
- if (I->strong() && !H.IsRoot(name) && (H.IsGetter(name) || H.IsField(name))) {
- BuildHash(H.DartGetterName(name).Hash());
- }
-}
-
-void KernelFingerprintHelper::CalculateSetterNameFingerprint() {
- const NameIndex name = ReadCanonicalNameReference();
- if (I->strong() && !H.IsRoot(name)) {
- BuildHash(H.DartSetterName(name).Hash());
- }
-}
-
-void KernelFingerprintHelper::CalculateMethodNameFingerprint() {
- const NameIndex name =
- ReadCanonicalNameReference(); // read interface_target_reference.
- if (I->strong() && !H.IsRoot(name) && !H.IsField(name)) {
- BuildHash(H.DartProcedureName(name).Hash());
- }
-}
-
-void KernelFingerprintHelper::CalculateExpressionFingerprint() {
- uint8_t payload = 0;
- Tag tag = ReadTag(&payload);
- BuildHash(tag);
- switch (tag) {
- case kInvalidExpression:
- ReadPosition();
- CalculateStringReferenceFingerprint();
- return;
- case kVariableGet:
- ReadPosition(); // read position.
- ReadUInt(); // read kernel position.
- ReadUInt(); // read relative variable index.
- CalculateOptionalDartTypeFingerprint(); // read promoted type.
- return;
- case kSpecializedVariableGet:
- ReadPosition(); // read position.
- ReadUInt(); // read kernel position.
- return;
- case kVariableSet:
- ReadPosition(); // read position.
- ReadUInt(); // read kernel position.
- ReadUInt(); // read relative variable index.
- CalculateExpressionFingerprint(); // read expression.
- return;
- case kSpecializedVariableSet:
- ReadPosition(); // read position.
- ReadUInt(); // read kernel position.
- CalculateExpressionFingerprint(); // read expression.
- return;
- case kPropertyGet:
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read receiver.
- BuildHash(ReadNameAsGetterName().Hash()); // read name.
- CalculateGetterNameFingerprint(); // read interface_target_reference.
- return;
- case kPropertySet:
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read receiver.
- BuildHash(ReadNameAsSetterName().Hash()); // read name.
- CalculateExpressionFingerprint(); // read value.
- CalculateSetterNameFingerprint(); // read interface_target_reference.
- return;
- case kSuperPropertyGet:
- ReadPosition(); // read position.
- BuildHash(ReadNameAsGetterName().Hash()); // read name.
- CalculateGetterNameFingerprint(); // read interface_target_reference.
- return;
- case kSuperPropertySet:
- ReadPosition(); // read position.
- BuildHash(ReadNameAsSetterName().Hash()); // read name.
- CalculateExpressionFingerprint(); // read value.
- CalculateSetterNameFingerprint(); // read interface_target_reference.
- return;
- case kDirectPropertyGet:
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read receiver.
- CalculateCanonicalNameFingerprint(); // read target_reference.
- return;
- case kDirectPropertySet:
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read receiver.
- CalculateCanonicalNameFingerprint(); // read target_reference.
- CalculateExpressionFingerprint(); // read value·
- return;
- case kStaticGet:
- ReadPosition(); // read position.
- CalculateCanonicalNameFingerprint(); // read target_reference.
- return;
- case kStaticSet:
- ReadPosition(); // read position.
- CalculateCanonicalNameFingerprint(); // read target_reference.
- CalculateExpressionFingerprint(); // read expression.
- return;
- case kMethodInvocation:
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read receiver.
- BuildHash(ReadNameAsMethodName().Hash()); // read name.
- CalculateArgumentsFingerprint(); // read arguments.
- CalculateMethodNameFingerprint(); // read interface_target_reference.
- return;
- case kSuperMethodInvocation:
- ReadPosition(); // read position.
- BuildHash(ReadNameAsMethodName().Hash()); // read name.
- CalculateArgumentsFingerprint(); // read arguments.
- CalculateCanonicalNameFingerprint(); // read target_reference.
- return;
- case kDirectMethodInvocation:
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read receiver.
- CalculateCanonicalNameFingerprint(); // read target_reference.
- CalculateArgumentsFingerprint(); // read arguments.
- return;
- case kStaticInvocation:
- case kConstStaticInvocation:
- ReadPosition(); // read position.
- CalculateCanonicalNameFingerprint(); // read target_reference.
- CalculateArgumentsFingerprint(); // read arguments.
- return;
- case kConstructorInvocation:
- case kConstConstructorInvocation:
- ReadPosition(); // read position.
- CalculateCanonicalNameFingerprint(); // read target_reference.
- CalculateArgumentsFingerprint(); // read arguments.
- return;
- case kNot:
- CalculateExpressionFingerprint(); // read expression.
- return;
- case kLogicalExpression:
- CalculateExpressionFingerprint(); // read left.
- SkipBytes(1); // read operator.
- CalculateExpressionFingerprint(); // read right.
- return;
- case kConditionalExpression:
- CalculateExpressionFingerprint(); // read condition.
- CalculateExpressionFingerprint(); // read then.
- CalculateExpressionFingerprint(); // read otherwise.
- CalculateOptionalDartTypeFingerprint(); // read unused static type.
- return;
- case kStringConcatenation:
- ReadPosition(); // read position.
- CalculateListOfExpressionsFingerprint(); // read list of expressions.
- return;
- case kIsExpression:
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read operand.
- CalculateDartTypeFingerprint(); // read type.
- return;
- case kAsExpression:
- ReadPosition(); // read position.
- BuildHash(ReadFlags()); // read flags.
- CalculateExpressionFingerprint(); // read operand.
- CalculateDartTypeFingerprint(); // read type.
- return;
- case kSymbolLiteral:
- CalculateStringReferenceFingerprint(); // read index into string table.
- return;
- case kTypeLiteral:
- CalculateDartTypeFingerprint(); // read type.
- return;
- case kThisExpression:
- return;
- case kRethrow:
- ReadPosition(); // read position.
- return;
- case kThrow:
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read expression.
- return;
- case kListLiteral:
- case kConstListLiteral:
- ReadPosition(); // read position.
- CalculateDartTypeFingerprint(); // read type.
- CalculateListOfExpressionsFingerprint(); // read list of expressions.
- return;
- case kMapLiteral:
- case kConstMapLiteral: {
- ReadPosition(); // read position.
- CalculateDartTypeFingerprint(); // read type.
- CalculateDartTypeFingerprint(); // read value type.
- intptr_t list_length = ReadListLength(); // read list length.
- for (intptr_t i = 0; i < list_length; ++i) {
- CalculateExpressionFingerprint(); // read ith key.
- CalculateExpressionFingerprint(); // read ith value.
- }
- return;
- }
- case kFunctionExpression:
- ReadPosition(); // read position.
- CalculateFunctionNodeFingerprint(); // read function node.
- return;
- case kLet:
- CalculateVariableDeclarationFingerprint(); // read variable declaration.
- CalculateExpressionFingerprint(); // read expression.
- return;
- case kInstantiation:
- CalculateExpressionFingerprint(); // read expression.
- CalculateListOfDartTypesFingerprint(); // read type arguments.
- return;
- case kBigIntLiteral:
- CalculateStringReferenceFingerprint(); // read string reference.
- return;
- case kStringLiteral:
- CalculateStringReferenceFingerprint(); // read string reference.
- return;
- case kSpecializedIntLiteral:
- return;
- case kNegativeIntLiteral:
- BuildHash(ReadUInt()); // read value.
- return;
- case kPositiveIntLiteral:
- BuildHash(ReadUInt()); // read value.
- return;
- case kDoubleLiteral: {
- double value = ReadDouble(); // read value.
- uint64_t data = bit_cast<uint64_t>(value);
- BuildHash(static_cast<uint32_t>(data >> 32));
- BuildHash(static_cast<uint32_t>(data));
- return;
- }
- case kTrueLiteral:
- return;
- case kFalseLiteral:
- return;
- case kNullLiteral:
- return;
- case kConstantExpression:
- SkipConstantReference();
- return;
- case kLoadLibrary:
- case kCheckLibraryIsLoaded:
- ReadUInt(); // skip library index
- return;
- default:
- ReportUnexpectedTag("expression", tag);
- UNREACHABLE();
- }
-}
-
-void KernelFingerprintHelper::CalculateStatementFingerprint() {
- Tag tag = ReadTag(); // read tag.
- BuildHash(tag);
- switch (tag) {
- case kExpressionStatement:
- CalculateExpressionFingerprint(); // read expression.
- return;
- case kBlock:
- CalculateStatementListFingerprint();
- return;
- case kEmptyStatement:
- return;
- case kAssertBlock:
- CalculateStatementListFingerprint();
- return;
- case kAssertStatement:
- CalculateExpressionFingerprint(); // Read condition.
- ReadPosition(); // read condition start offset.
- ReadPosition(); // read condition end offset.
- if (ReadTag() == kSomething) {
- CalculateExpressionFingerprint(); // read (rest of) message.
- }
- return;
- case kLabeledStatement:
- CalculateStatementFingerprint(); // read body.
- return;
- case kBreakStatement:
- ReadPosition(); // read position.
- ReadUInt(); // read target_index.
- return;
- case kWhileStatement:
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read condition.
- CalculateStatementFingerprint(); // read body.
- return;
- case kDoStatement:
- ReadPosition(); // read position.
- CalculateStatementFingerprint(); // read body.
- CalculateExpressionFingerprint(); // read condition.
- return;
- case kForStatement: {
- ReadPosition(); // read position.
- CalculateListOfVariableDeclarationsFingerprint(); // read variables.
- Tag tag = ReadTag(); // Read first part of condition.
- if (tag == kSomething) {
- CalculateExpressionFingerprint(); // read rest of condition.
- }
- CalculateListOfExpressionsFingerprint(); // read updates.
- CalculateStatementFingerprint(); // read body.
- return;
- }
- case kForInStatement:
- case kAsyncForInStatement:
- ReadPosition(); // read position.
- ReadPosition(); // read body position.
- CalculateVariableDeclarationFingerprint(); // read variable.
- CalculateExpressionFingerprint(); // read iterable.
- CalculateStatementFingerprint(); // read body.
- return;
- case kSwitchStatement: {
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read condition.
- int case_count = ReadListLength(); // read number of cases.
- for (intptr_t i = 0; i < case_count; ++i) {
- int expression_count = ReadListLength(); // read number of expressions.
- for (intptr_t j = 0; j < expression_count; ++j) {
- ReadPosition(); // read jth position.
- CalculateExpressionFingerprint(); // read jth expression.
- }
- BuildHash(ReadBool()); // read is_default.
- CalculateStatementFingerprint(); // read body.
- }
- return;
- }
- case kContinueSwitchStatement:
- ReadPosition(); // read position.
- ReadUInt(); // read target_index.
- return;
- case kIfStatement:
- ReadPosition(); // read position.
- CalculateExpressionFingerprint(); // read condition.
- CalculateStatementFingerprint(); // read then.
- CalculateStatementFingerprint(); // read otherwise.
- return;
- case kReturnStatement: {
- ReadPosition(); // read position
- Tag tag = ReadTag(); // read (first part of) expression.
- BuildHash(tag);
- if (tag == kSomething) {
- CalculateExpressionFingerprint(); // read (rest of) expression.
- }
- return;
- }
- case kTryCatch: {
- CalculateStatementFingerprint(); // read body.
- BuildHash(ReadByte()); // read flags
- intptr_t catch_count = ReadListLength(); // read number of catches.
- for (intptr_t i = 0; i < catch_count; ++i) {
- ReadPosition(); // read position.
- CalculateDartTypeFingerprint(); // read guard.
- tag = ReadTag(); // read first part of exception.
- BuildHash(tag);
- if (tag == kSomething) {
- CalculateVariableDeclarationFingerprint(); // read exception.
- }
- tag = ReadTag(); // read first part of stack trace.
- BuildHash(tag);
- if (tag == kSomething) {
- CalculateVariableDeclarationFingerprint(); // read stack trace.
- }
- CalculateStatementFingerprint(); // read body.
- }
- return;
- }
- case kTryFinally:
- CalculateStatementFingerprint(); // read body.
- CalculateStatementFingerprint(); // read finalizer.
- return;
- case kYieldStatement: {
- ReadPosition(); // read position.
- BuildHash(ReadByte()); // read flags.
- CalculateExpressionFingerprint(); // read expression.
- return;
- }
- case kVariableDeclaration:
- CalculateVariableDeclarationFingerprint(); // read variable declaration.
- return;
- case kFunctionDeclaration:
- ReadPosition(); // read position.
- CalculateVariableDeclarationFingerprint(); // read variable.
- CalculateFunctionNodeFingerprint(); // read function node.
- return;
- default:
- ReportUnexpectedTag("statement", tag);
- UNREACHABLE();
- }
-}
-
-uint32_t KernelFingerprintHelper::CalculateFieldFingerprint() {
- hash_ = 0;
- FieldHelper field_helper(this);
-
- field_helper.ReadUntilExcluding(FieldHelper::kName);
- const String& name = ReadNameAsFieldName(); // read name.
- field_helper.SetJustRead(FieldHelper::kName);
-
- field_helper.ReadUntilExcluding(FieldHelper::kType);
- CalculateDartTypeFingerprint(); // read type.
- field_helper.SetJustRead(FieldHelper::kType);
-
- if (ReadTag() == kSomething) {
- if (PeekTag() == kFunctionExpression) {
- AlternativeReadingScope alt(&reader_);
- CalculateExpressionFingerprint();
- }
- SkipExpression();
- }
-
- BuildHash(name.Hash());
- BuildHash(field_helper.flags_);
- BuildHash(field_helper.annotation_count_);
- return hash_;
-}
-
-void KernelFingerprintHelper::CalculateFunctionNodeFingerprint() {
- FunctionNodeHelper function_node_helper(this);
-
- function_node_helper.ReadUntilExcluding(FunctionNodeHelper::kTypeParameters);
- CalculateTypeParametersListFingerprint();
- function_node_helper.SetJustRead(FunctionNodeHelper::kTypeParameters);
-
- function_node_helper.ReadUntilExcluding(
- FunctionNodeHelper::kPositionalParameters);
- CalculateListOfVariableDeclarationsFingerprint(); // read positionals
- CalculateListOfVariableDeclarationsFingerprint(); // read named
- CalculateDartTypeFingerprint(); // read return type.
-
- if (ReadTag() == kSomething) {
- CalculateStatementFingerprint(); // Read body.
- }
- BuildHash(function_node_helper.total_parameter_count_);
- BuildHash(function_node_helper.required_parameter_count_);
-}
-
-uint32_t KernelFingerprintHelper::CalculateFunctionFingerprint() {
- hash_ = 0;
- Tag tag = PeekTag();
- if (tag == kField) {
- return CalculateFieldFingerprint();
- } else if (tag == kConstructor) {
- CalculateConstructorFingerprint();
- return hash_;
- }
- ProcedureHelper procedure_helper(this);
- procedure_helper.ReadUntilExcluding(ProcedureHelper::kName);
- const String& name = ReadNameAsMethodName(); // Read name.
- procedure_helper.SetJustRead(ProcedureHelper::kName);
-
- procedure_helper.ReadUntilExcluding(ProcedureHelper::kFunction);
- if (ReadTag() == kSomething) {
- CalculateFunctionNodeFingerprint();
- }
-
- BuildHash(procedure_helper.kind_);
- BuildHash(procedure_helper.flags_);
- BuildHash(procedure_helper.annotation_count_);
- BuildHash(name.Hash());
- return hash_;
-}
-
bool StreamingFlowGraphBuilder::optimizing() {
return flow_graph_builder_->optimizing_;
}
@@ -3739,20 +2059,6 @@
return flow_graph_builder_->MakeTemporary();
}
-Function& StreamingFlowGraphBuilder::FindMatchingFunctionAnyArgs(
- const Class& klass,
- const String& name) {
- // Search the superclass chain for the selector.
- Function& function = Function::Handle(Z);
- Class& iterate_klass = Class::Handle(Z, klass.raw());
- while (!iterate_klass.IsNull()) {
- function = iterate_klass.LookupDynamicFunctionAllowPrivate(name);
- if (!function.IsNull()) break;
- iterate_klass = iterate_klass.SuperClass();
- }
- return function;
-}
-
Function& StreamingFlowGraphBuilder::FindMatchingFunction(
const Class& klass,
const String& name,
@@ -3987,8 +2293,61 @@
// TranslateFinallyFinalizers can move the readers offset.
// Save the current position and restore it afterwards.
AlternativeReadingScope alt(&reader_);
- return flow_graph_builder_->TranslateFinallyFinalizers(outer_finally,
- target_context_depth);
+
+ TryFinallyBlock* const saved_block = B->try_finally_block_;
+ TryCatchBlock* const saved_try_catch_block = B->try_catch_block_;
+ const intptr_t saved_depth = B->context_depth_;
+ const intptr_t saved_try_depth = B->try_depth_;
+
+ Fragment instructions;
+
+ // While translating the body of a finalizer we need to set the try-finally
+ // block which is active when translating the body.
+ while (B->try_finally_block_ != outer_finally) {
+ // Set correct try depth (in case there are nested try statements).
+ B->try_depth_ = B->try_finally_block_->try_depth();
+
+ // Potentially restore the context to what is expected for the finally
+ // block.
+ instructions += B->AdjustContextTo(B->try_finally_block_->context_depth());
+
+ // The to-be-translated finalizer has to have the correct try-index (namely
+ // the one outside the try-finally block).
+ bool changed_try_index = false;
+ intptr_t target_try_index = B->try_finally_block_->try_index();
+ while (B->CurrentTryIndex() != target_try_index) {
+ B->try_catch_block_ = B->try_catch_block_->outer();
+ changed_try_index = true;
+ }
+ if (changed_try_index) {
+ JoinEntryInstr* entry = BuildJoinEntry();
+ instructions += Goto(entry);
+ instructions = Fragment(instructions.entry, entry);
+ }
+
+ intptr_t finalizer_kernel_offset =
+ B->try_finally_block_->finalizer_kernel_offset();
+ B->try_finally_block_ = B->try_finally_block_->outer();
+ instructions += BuildStatementAt(finalizer_kernel_offset);
+
+ // We only need to make sure that if the finalizer ended normally, we
+ // continue towards the next outer try-finally.
+ if (!instructions.is_open()) break;
+ }
+
+ if (instructions.is_open() && target_context_depth != -1) {
+ // A target context depth of -1 indicates that the code after this
+ // will not care about the context chain so we can leave it any way we
+ // want after the last finalizer. That is used when returning.
+ instructions += B->AdjustContextTo(target_context_depth);
+ }
+
+ B->try_finally_block_ = saved_block;
+ B->try_catch_block_ = saved_try_catch_block;
+ B->context_depth_ = saved_depth;
+ B->try_depth_ = saved_try_depth;
+
+ return instructions;
}
Fragment StreamingFlowGraphBuilder::BranchIfTrue(
@@ -4535,7 +2894,8 @@
const String& setter_name = ReadNameAsSetterName(); // read name.
- Function& function = FindMatchingFunctionAnyArgs(klass, setter_name);
+ Function& function =
+ Function::Handle(Z, H.LookupDynamicFunction(klass, setter_name));
Fragment instructions(MakeTemp());
LocalVariable* value = MakeTemporary(); // this holds RHS value
@@ -7449,197 +5809,6 @@
return line_starts_data.raw();
}
-const Array& ConstantHelper::ReadConstantTable() {
- const intptr_t number_of_constants = builder_.ReadUInt();
- if (number_of_constants == 0) {
- return Array::Handle(Z, Array::null());
- }
-
- const Library& corelib = Library::Handle(Z, Library::CoreLibrary());
- const Class& list_class =
- Class::Handle(Z, corelib.LookupClassAllowPrivate(Symbols::_List()));
-
- // Eagerly finalize _ImmutableList (instead of doing it on every list
- // constant).
- temp_class_ = I->class_table()->At(kImmutableArrayCid);
- temp_object_ = temp_class_.EnsureIsFinalized(H.thread());
- ASSERT(temp_object_.IsNull());
-
- KernelConstantsMap constants(
- HashTables::New<KernelConstantsMap>(number_of_constants, Heap::kOld));
-
- const intptr_t start_offset = builder_.ReaderOffset();
-
- for (intptr_t i = 0; i < number_of_constants; ++i) {
- const intptr_t offset = builder_.ReaderOffset();
- const intptr_t constant_tag = builder_.ReadByte();
- switch (constant_tag) {
- case kNullConstant:
- temp_instance_ = Instance::null();
- break;
- case kBoolConstant:
- temp_instance_ = builder_.ReadByte() == 1 ? Object::bool_true().raw()
- : Object::bool_false().raw();
- break;
- case kIntConstant: {
- temp_instance_ = const_evaluator_.EvaluateExpression(
- builder_.ReaderOffset(), false /* reset position */);
- break;
- }
- case kDoubleConstant: {
- temp_instance_ = Double::New(builder_.ReadDouble(), Heap::kOld);
- temp_instance_ = H.Canonicalize(temp_instance_);
- break;
- }
- case kStringConstant: {
- temp_instance_ =
- H.Canonicalize(H.DartString(builder_.ReadStringReference()));
- break;
- }
- case kListConstant: {
- temp_type_arguments_ = TypeArguments::New(1, Heap::kOld);
- const AbstractType& type = type_translator_.BuildType();
- temp_type_arguments_.SetTypeAt(0, type);
- InstantiateTypeArguments(list_class, &temp_type_arguments_);
-
- const intptr_t length = builder_.ReadUInt();
- temp_array_ = ImmutableArray::New(length, Heap::kOld);
- temp_array_.SetTypeArguments(temp_type_arguments_);
- for (intptr_t j = 0; j < length; ++j) {
- const intptr_t entry_offset = builder_.ReadUInt();
- ASSERT(entry_offset < offset); // We have a DAG!
- temp_object_ = constants.GetOrDie(entry_offset);
- temp_array_.SetAt(j, temp_object_);
- }
-
- temp_instance_ = H.Canonicalize(temp_array_);
- break;
- }
- case kInstanceConstant: {
- const NameIndex index = builder_.ReadCanonicalNameReference();
- if (ShouldSkipConstant(index)) {
- temp_instance_ = Instance::null();
- break;
- }
-
- temp_class_ = H.LookupClassByKernelClass(index);
- temp_object_ = temp_class_.EnsureIsFinalized(H.thread());
- ASSERT(temp_object_.IsNull());
-
- temp_instance_ = Instance::New(temp_class_, Heap::kOld);
-
- const intptr_t number_of_type_arguments = builder_.ReadUInt();
- if (temp_class_.NumTypeArguments() > 0) {
- temp_type_arguments_ =
- TypeArguments::New(number_of_type_arguments, Heap::kOld);
- for (intptr_t j = 0; j < number_of_type_arguments; ++j) {
- temp_type_arguments_.SetTypeAt(j, type_translator_.BuildType());
- }
- InstantiateTypeArguments(temp_class_, &temp_type_arguments_);
- temp_instance_.SetTypeArguments(temp_type_arguments_);
- } else {
- ASSERT(number_of_type_arguments == 0);
- }
-
- const intptr_t number_of_fields = builder_.ReadUInt();
- for (intptr_t j = 0; j < number_of_fields; ++j) {
- temp_field_ =
- H.LookupFieldByKernelField(builder_.ReadCanonicalNameReference());
- const intptr_t entry_offset = builder_.ReadUInt();
- ASSERT(entry_offset < offset); // We have a DAG!
- temp_object_ = constants.GetOrDie(entry_offset);
- temp_instance_.SetField(temp_field_, temp_object_);
- }
-
- temp_instance_ = H.Canonicalize(temp_instance_);
- break;
- }
- case kPartialInstantiationConstant: {
- const intptr_t entry_offset = builder_.ReadUInt();
- temp_object_ = constants.GetOrDie(entry_offset);
-
- // Happens if the tearoff was in the vmservice library and we have
- // [skip_vm_service_library] enabled.
- if (temp_object_.IsNull()) {
- temp_instance_ = Instance::null();
- break;
- }
-
- const intptr_t number_of_type_arguments = builder_.ReadUInt();
- ASSERT(number_of_type_arguments > 0);
- temp_type_arguments_ =
- TypeArguments::New(number_of_type_arguments, Heap::kOld);
- for (intptr_t j = 0; j < number_of_type_arguments; ++j) {
- temp_type_arguments_.SetTypeAt(j, type_translator_.BuildType());
- }
-
- // Make a copy of the old closure, with the delayed type arguments
- // set to [temp_type_arguments_].
- temp_closure_ = Closure::RawCast(temp_object_.raw());
- temp_function_ = temp_closure_.function();
- temp_type_arguments2_ = temp_closure_.instantiator_type_arguments();
- temp_type_arguments3_ = temp_closure_.function_type_arguments();
- temp_context_ = temp_closure_.context();
- temp_closure_ = Closure::New(
- temp_type_arguments2_, Object::null_type_arguments(),
- temp_type_arguments_, temp_function_, temp_context_, Heap::kOld);
- temp_instance_ = H.Canonicalize(temp_closure_);
- break;
- }
- case kTearOffConstant: {
- const NameIndex index = builder_.ReadCanonicalNameReference();
- if (ShouldSkipConstant(index)) {
- temp_instance_ = Instance::null();
- break;
- }
-
- temp_function_ = H.LookupStaticMethodByKernelProcedure(index);
- temp_function_ = temp_function_.ImplicitClosureFunction();
- temp_instance_ = temp_function_.ImplicitStaticClosure();
- temp_instance_ = H.Canonicalize(temp_instance_);
- break;
- }
- case kTypeLiteralConstant: {
- temp_instance_ = type_translator_.BuildType().raw();
- break;
- }
- case kMapConstant:
- // Note: This is already lowered to InstanceConstant/ListConstant.
- UNREACHABLE();
- break;
- default:
- UNREACHABLE();
- }
- constants.InsertNewOrGetValue(offset - start_offset, temp_instance_);
- }
- return Array::Handle(Z, constants.Release().raw());
-}
-
-void ConstantHelper::InstantiateTypeArguments(const Class& receiver_class,
- TypeArguments* type_arguments) {
- // We make a temporary [Type] object and use `ClassFinalizer::FinalizeType` to
- // finalize the argument types.
- // (This can for example make the [type_arguments] vector larger)
- temp_type_ =
- Type::New(receiver_class, *type_arguments, TokenPosition::kNoSource);
- temp_type_ = ClassFinalizer::FinalizeType(*active_class_->klass, temp_type_,
- ClassFinalizer::kCanonicalize);
- *type_arguments = temp_type_.arguments();
-}
-
-// If [index] has `dart:vm_service` as a parent and we are skipping the VM
-// service library, this method returns `true`, otherwise `false`.
-bool ConstantHelper::ShouldSkipConstant(NameIndex index) {
- if (index == NameIndex::kInvalidName) {
- return false;
- }
- while (!H.IsLibrary(index)) {
- index = H.CanonicalNameParent(index);
- }
- ASSERT(H.IsLibrary(index));
- return index == skip_vmservice_library_;
-}
-
} // namespace kernel
} // namespace dart
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
index c9babb5..8dbbcaa 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
@@ -8,6 +8,7 @@
#if !defined(DART_PRECOMPILED_RUNTIME)
#include "vm/compiler/frontend/bytecode_reader.h"
+#include "vm/compiler/frontend/constant_evaluator.h"
#include "vm/compiler/frontend/kernel_to_il.h"
#include "vm/compiler/frontend/kernel_translation_helper.h"
#include "vm/compiler/frontend/scope_builder.h"
@@ -18,169 +19,6 @@
namespace dart {
namespace kernel {
-// There are several cases when we are compiling constant expressions:
-//
-// * constant field initializers:
-// const FieldName = <expr>;
-//
-// * constant expressions:
-// const [<expr>, ...]
-// const {<expr> : <expr>, ...}
-// const Constructor(<expr>, ...)
-//
-// * constant default parameters:
-// f(a, [b = <expr>])
-// f(a, {b: <expr>})
-//
-// * constant values to compare in a [SwitchCase]
-// case <expr>:
-//
-// In all cases `<expr>` must be recursively evaluated and canonicalized at
-// compile-time.
-class StreamingConstantEvaluator {
- public:
- explicit StreamingConstantEvaluator(StreamingFlowGraphBuilder* builder);
-
- virtual ~StreamingConstantEvaluator() {}
-
- bool IsCached(intptr_t offset);
-
- RawInstance* EvaluateExpression(intptr_t offset, bool reset_position = true);
- Instance& EvaluateListLiteral(intptr_t offset, bool reset_position = true);
- Instance& EvaluateMapLiteral(intptr_t offset, bool reset_position = true);
- Instance& EvaluateConstructorInvocation(intptr_t offset,
- bool reset_position = true);
- RawObject* EvaluateExpressionSafe(intptr_t offset);
-
- private:
- bool IsAllowedToEvaluate();
- void EvaluateAsExpression();
- void EvaluateVariableGet(bool is_specialized);
- void EvaluatePropertyGet();
- void EvaluateDirectPropertyGet();
- void EvaluateStaticGet();
- void EvaluateMethodInvocation();
- void EvaluateDirectMethodInvocation();
- void EvaluateSuperMethodInvocation();
- void EvaluateStaticInvocation();
- void EvaluateConstructorInvocationInternal();
- void EvaluateNot();
- void EvaluateLogicalExpression();
- void EvaluateConditionalExpression();
- void EvaluateStringConcatenation();
- void EvaluateSymbolLiteral();
- void EvaluateTypeLiteral();
- void EvaluateListLiteralInternal();
- void EvaluateMapLiteralInternal();
- void EvaluateLet();
- void EvaluatePartialTearoffInstantiation();
- void EvaluateBigIntLiteral();
- void EvaluateStringLiteral();
- void EvaluateIntLiteral(uint8_t payload);
- void EvaluateIntLiteral(bool is_negative);
- void EvaluateDoubleLiteral();
- void EvaluateBoolLiteral(bool value);
- void EvaluateNullLiteral();
- void EvaluateConstantExpression();
-
- void EvaluateGetStringLength(intptr_t expression_offset,
- TokenPosition position);
-
- const Object& RunFunction(const TokenPosition position,
- const Function& function,
- intptr_t argument_count,
- const Instance* receiver,
- const TypeArguments* type_args);
-
- const Object& RunFunction(const TokenPosition position,
- const Function& function,
- const Array& arguments,
- const Array& names);
-
- const Object& RunMethodCall(const TokenPosition position,
- const Function& function,
- const Instance* receiver);
-
- RawObject* EvaluateConstConstructorCall(const Class& type_class,
- const TypeArguments& type_arguments,
- const Function& constructor,
- const Object& argument);
-
- const TypeArguments* TranslateTypeArguments(const Function& target,
- Class* target_klass);
-
- void AssertBool() {
- if (!result_.IsBool()) {
- translation_helper_.ReportError("Expected boolean expression.");
- }
- }
-
- bool EvaluateBooleanExpressionHere();
-
- bool GetCachedConstant(intptr_t kernel_offset, Instance* value);
- void CacheConstantValue(intptr_t kernel_offset, const Instance& value);
-
- StreamingFlowGraphBuilder* builder_;
- Isolate* isolate_;
- Zone* zone_;
- TranslationHelper& translation_helper_;
- TypeTranslator& type_translator_;
-
- const Script& script_;
- Instance& result_;
-};
-
-class KernelFingerprintHelper : public KernelReaderHelper {
- public:
- KernelFingerprintHelper(Zone* zone,
- TranslationHelper* translation_helper,
- const Script& script,
- const ExternalTypedData& data,
- intptr_t data_program_offset)
- : KernelReaderHelper(zone,
- translation_helper,
- script,
- data,
- data_program_offset),
- hash_(0) {}
-
- virtual ~KernelFingerprintHelper() {}
- uint32_t CalculateFieldFingerprint();
- uint32_t CalculateFunctionFingerprint();
-
- static uint32_t CalculateHash(uint32_t current, uint32_t val) {
- return current * 31 + val;
- }
-
- private:
- void BuildHash(uint32_t val);
- void CalculateConstructorFingerprint();
- void CalculateArgumentsFingerprint();
- void CalculateVariableDeclarationFingerprint();
- void CalculateStatementListFingerprint();
- void CalculateListOfExpressionsFingerprint();
- void CalculateListOfDartTypesFingerprint();
- void CalculateListOfVariableDeclarationsFingerprint();
- void CalculateStringReferenceFingerprint();
- void CalculateListOfStringsFingerprint();
- void CalculateTypeParameterFingerprint();
- void CalculateTypeParametersListFingerprint();
- void CalculateCanonicalNameFingerprint();
- void CalculateInitializerFingerprint();
- void CalculateDartTypeFingerprint();
- void CalculateOptionalDartTypeFingerprint();
- void CalculateInterfaceTypeFingerprint(bool simple);
- void CalculateFunctionTypeFingerprint(bool simple);
- void CalculateGetterNameFingerprint();
- void CalculateSetterNameFingerprint();
- void CalculateMethodNameFingerprint();
- void CalculateExpressionFingerprint();
- void CalculateStatementFingerprint();
- void CalculateFunctionNodeFingerprint();
-
- uint32_t hash_;
-};
-
class StreamingFlowGraphBuilder : public KernelReaderHelper {
public:
StreamingFlowGraphBuilder(FlowGraphBuilder* flow_graph_builder,
@@ -196,8 +34,11 @@
data_program_offset),
flow_graph_builder_(flow_graph_builder),
active_class_(&flow_graph_builder->active_class_),
- constant_evaluator_(this),
type_translator_(this, active_class_, /* finalize= */ true),
+ constant_evaluator_(this,
+ &type_translator_,
+ active_class_,
+ flow_graph_builder),
current_script_id_(-1),
record_for_script_id_(-1),
record_token_positions_into_(NULL),
@@ -223,8 +64,8 @@
data_program_offset),
flow_graph_builder_(NULL),
active_class_(active_class),
- constant_evaluator_(this),
type_translator_(this, active_class_, /* finalize= */ true),
+ constant_evaluator_(this, &type_translator_, active_class_, nullptr),
current_script_id_(-1),
record_for_script_id_(-1),
record_token_positions_into_(NULL),
@@ -250,8 +91,8 @@
data_program_offset),
flow_graph_builder_(NULL),
active_class_(active_class),
- constant_evaluator_(this),
type_translator_(this, active_class_, /* finalize= */ true),
+ constant_evaluator_(this, &type_translator_, active_class_, nullptr),
current_script_id_(-1),
record_for_script_id_(-1),
record_token_positions_into_(NULL),
@@ -344,7 +185,6 @@
LocalVariable* MakeTemporary();
LocalVariable* LookupVariable(intptr_t kernel_offset);
- Function& FindMatchingFunctionAnyArgs(const Class& klass, const String& name);
Function& FindMatchingFunction(const Class& klass,
const String& name,
int type_args_len,
@@ -576,8 +416,8 @@
FlowGraphBuilder* flow_graph_builder_;
ActiveClass* const active_class_;
- StreamingConstantEvaluator constant_evaluator_;
TypeTranslator type_translator_;
+ ConstantEvaluator constant_evaluator_;
intptr_t current_script_id_;
intptr_t record_for_script_id_;
GrowableArray<intptr_t>* record_token_positions_into_;
@@ -589,76 +429,9 @@
InferredTypeMetadataHelper inferred_type_metadata_helper_;
ProcedureAttributesMetadataHelper procedure_attributes_metadata_helper_;
- friend class ConstantHelper;
friend class KernelLoader;
- friend class SimpleExpressionConverter;
- friend class StreamingConstantEvaluator;
-};
-// Helper class that reads a kernel Constant from binary.
-class ConstantHelper {
- public:
- ConstantHelper(ActiveClass* active_class,
- StreamingFlowGraphBuilder* builder,
- TypeTranslator* type_translator,
- TranslationHelper* translation_helper,
- Zone* zone,
- NameIndex skip_vmservice_library)
- : skip_vmservice_library_(skip_vmservice_library),
- active_class_(active_class),
- builder_(*builder),
- type_translator_(*type_translator),
- const_evaluator_(&builder_),
- translation_helper_(*translation_helper),
- zone_(zone),
- temp_type_(AbstractType::Handle(zone)),
- temp_type_arguments_(TypeArguments::Handle(zone)),
- temp_type_arguments2_(TypeArguments::Handle(zone)),
- temp_type_arguments3_(TypeArguments::Handle(zone)),
- temp_object_(Object::Handle(zone)),
- temp_array_(Array::Handle(zone)),
- temp_instance_(Instance::Handle(zone)),
- temp_field_(Field::Handle(zone)),
- temp_class_(Class::Handle(zone)),
- temp_function_(Function::Handle(zone)),
- temp_closure_(Closure::Handle(zone)),
- temp_context_(Context::Handle(zone)),
- temp_integer_(Integer::Handle(zone)) {}
-
- // Reads the constant table from the binary.
- //
- // This method assumes the Reader is positioned already at the constant table
- // and an active class scope is setup.
- const Array& ReadConstantTable();
-
- private:
- void InstantiateTypeArguments(const Class& receiver_class,
- TypeArguments* type_arguments);
-
- // If [index] has `dart:vm_service` as a parent and we are skipping the VM
- // service library, this method returns `true`, otherwise `false`.
- bool ShouldSkipConstant(NameIndex index);
-
- NameIndex skip_vmservice_library_;
- ActiveClass* const active_class_;
- StreamingFlowGraphBuilder& builder_;
- TypeTranslator& type_translator_;
- StreamingConstantEvaluator const_evaluator_;
- TranslationHelper translation_helper_;
- Zone* zone_;
- AbstractType& temp_type_;
- TypeArguments& temp_type_arguments_;
- TypeArguments& temp_type_arguments2_;
- TypeArguments& temp_type_arguments3_;
- Object& temp_object_;
- Array& temp_array_;
- Instance& temp_instance_;
- Field& temp_field_;
- Class& temp_class_;
- Function& temp_function_;
- Closure& temp_closure_;
- Context& temp_context_;
- Integer& temp_integer_;
+ DISALLOW_COPY_AND_ASSIGN(StreamingFlowGraphBuilder);
};
} // namespace kernel
diff --git a/runtime/vm/compiler/frontend/kernel_fingerprints.cc b/runtime/vm/compiler/frontend/kernel_fingerprints.cc
new file mode 100644
index 0000000..71dad90
--- /dev/null
+++ b/runtime/vm/compiler/frontend/kernel_fingerprints.cc
@@ -0,0 +1,845 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "vm/compiler/frontend/kernel_fingerprints.h"
+#include "vm/compiler/frontend/kernel_translation_helper.h"
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
+#define H (translation_helper_)
+#define I Isolate::Current()
+
+namespace dart {
+namespace kernel {
+
+class KernelFingerprintHelper : public KernelReaderHelper {
+ public:
+ KernelFingerprintHelper(Zone* zone,
+ TranslationHelper* translation_helper,
+ const Script& script,
+ const ExternalTypedData& data,
+ intptr_t data_program_offset)
+ : KernelReaderHelper(zone,
+ translation_helper,
+ script,
+ data,
+ data_program_offset),
+ hash_(0) {}
+
+ virtual ~KernelFingerprintHelper() {}
+ uint32_t CalculateFieldFingerprint();
+ uint32_t CalculateFunctionFingerprint();
+
+ static uint32_t CalculateHash(uint32_t current, uint32_t val) {
+ return current * 31 + val;
+ }
+
+ private:
+ void BuildHash(uint32_t val);
+ void CalculateConstructorFingerprint();
+ void CalculateArgumentsFingerprint();
+ void CalculateVariableDeclarationFingerprint();
+ void CalculateStatementListFingerprint();
+ void CalculateListOfExpressionsFingerprint();
+ void CalculateListOfDartTypesFingerprint();
+ void CalculateListOfVariableDeclarationsFingerprint();
+ void CalculateStringReferenceFingerprint();
+ void CalculateListOfStringsFingerprint();
+ void CalculateTypeParameterFingerprint();
+ void CalculateTypeParametersListFingerprint();
+ void CalculateCanonicalNameFingerprint();
+ void CalculateInitializerFingerprint();
+ void CalculateDartTypeFingerprint();
+ void CalculateOptionalDartTypeFingerprint();
+ void CalculateInterfaceTypeFingerprint(bool simple);
+ void CalculateFunctionTypeFingerprint(bool simple);
+ void CalculateGetterNameFingerprint();
+ void CalculateSetterNameFingerprint();
+ void CalculateMethodNameFingerprint();
+ void CalculateExpressionFingerprint();
+ void CalculateStatementFingerprint();
+ void CalculateFunctionNodeFingerprint();
+
+ uint32_t hash_;
+
+ DISALLOW_COPY_AND_ASSIGN(KernelFingerprintHelper);
+};
+
+void KernelFingerprintHelper::BuildHash(uint32_t val) {
+ hash_ = CalculateHash(hash_, val);
+}
+
+void KernelFingerprintHelper::CalculateConstructorFingerprint() {
+ ConstructorHelper helper(this);
+
+ helper.ReadUntilExcluding(ConstructorHelper::kAnnotations);
+ CalculateListOfExpressionsFingerprint();
+ CalculateFunctionNodeFingerprint();
+ intptr_t len = ReadListLength();
+ for (intptr_t i = 0; i < len; ++i) {
+ CalculateInitializerFingerprint();
+ }
+ helper.SetJustRead(ConstructorHelper::kInitializers);
+ BuildHash(helper.flags_);
+ BuildHash(helper.annotation_count_);
+}
+
+void KernelFingerprintHelper::CalculateArgumentsFingerprint() {
+ BuildHash(ReadUInt()); // read argument count.
+
+ CalculateListOfDartTypesFingerprint(); // read list of types.
+ CalculateListOfExpressionsFingerprint(); // read positionals.
+
+ // List of named.
+ intptr_t list_length = ReadListLength(); // read list length.
+ for (intptr_t i = 0; i < list_length; ++i) {
+ CalculateStringReferenceFingerprint(); // read ith name index.
+ CalculateExpressionFingerprint(); // read ith expression.
+ }
+}
+
+void KernelFingerprintHelper::CalculateVariableDeclarationFingerprint() {
+ VariableDeclarationHelper helper(this);
+
+ helper.ReadUntilExcluding(VariableDeclarationHelper::kAnnotations);
+ CalculateListOfExpressionsFingerprint();
+ helper.SetJustRead(VariableDeclarationHelper::kAnnotations);
+
+ helper.ReadUntilExcluding(VariableDeclarationHelper::kType);
+ // We don't need to use the helper after this point.
+ CalculateDartTypeFingerprint();
+ if (ReadTag() == kSomething) {
+ CalculateExpressionFingerprint();
+ }
+
+ BuildHash(helper.flags_);
+}
+
+void KernelFingerprintHelper::CalculateStatementListFingerprint() {
+ intptr_t list_length = ReadListLength(); // read list length.
+ for (intptr_t i = 0; i < list_length; ++i) {
+ CalculateStatementFingerprint(); // read ith expression.
+ }
+}
+
+void KernelFingerprintHelper::CalculateListOfExpressionsFingerprint() {
+ intptr_t list_length = ReadListLength(); // read list length.
+ for (intptr_t i = 0; i < list_length; ++i) {
+ CalculateExpressionFingerprint(); // read ith expression.
+ }
+}
+
+void KernelFingerprintHelper::CalculateListOfDartTypesFingerprint() {
+ intptr_t list_length = ReadListLength(); // read list length.
+ for (intptr_t i = 0; i < list_length; ++i) {
+ CalculateDartTypeFingerprint(); // read ith type.
+ }
+}
+
+void KernelFingerprintHelper::CalculateStringReferenceFingerprint() {
+ BuildHash(
+ H.DartString(ReadStringReference()).Hash()); // read ith string index.
+}
+
+void KernelFingerprintHelper::CalculateListOfStringsFingerprint() {
+ intptr_t list_length = ReadListLength(); // read list length.
+ for (intptr_t i = 0; i < list_length; ++i) {
+ CalculateStringReferenceFingerprint(); // read ith string index.
+ }
+}
+
+void KernelFingerprintHelper::CalculateListOfVariableDeclarationsFingerprint() {
+ intptr_t list_length = ReadListLength(); // read list length.
+ for (intptr_t i = 0; i < list_length; ++i) {
+ // read ith variable declaration.
+ CalculateVariableDeclarationFingerprint();
+ }
+}
+
+void KernelFingerprintHelper::CalculateTypeParameterFingerprint() {
+ TypeParameterHelper helper(this);
+
+ helper.ReadUntilExcluding(TypeParameterHelper::kAnnotations);
+ CalculateListOfExpressionsFingerprint();
+ helper.SetJustRead(TypeParameterHelper::kAnnotations);
+
+ helper.ReadUntilExcluding(TypeParameterHelper::kBound);
+ // The helper isn't needed after this point.
+ CalculateDartTypeFingerprint();
+ if (ReadTag() == kSomething) {
+ CalculateDartTypeFingerprint();
+ }
+ BuildHash(helper.flags_);
+}
+
+void KernelFingerprintHelper::CalculateTypeParametersListFingerprint() {
+ intptr_t list_length = ReadListLength(); // read list length.
+ for (intptr_t i = 0; i < list_length; ++i) {
+ CalculateTypeParameterFingerprint();
+ }
+}
+
+void KernelFingerprintHelper::CalculateCanonicalNameFingerprint() {
+ const StringIndex i = H.CanonicalNameString(ReadCanonicalNameReference());
+ BuildHash(H.DartString(i).Hash());
+}
+
+void KernelFingerprintHelper::CalculateInitializerFingerprint() {
+ Tag tag = ReadTag();
+ ReadByte(); // read isSynthetic flag.
+ switch (tag) {
+ case kInvalidInitializer:
+ return;
+ case kFieldInitializer:
+ BuildHash(H.DartFieldName(ReadCanonicalNameReference()).Hash());
+ CalculateExpressionFingerprint(); // read value.
+ return;
+ case kSuperInitializer:
+ ReadPosition(); // read position.
+ CalculateCanonicalNameFingerprint(); // read target_reference
+ CalculateArgumentsFingerprint(); // read arguments.
+ return;
+ case kRedirectingInitializer:
+ ReadPosition(); // read position.
+ CalculateCanonicalNameFingerprint(); // read target_reference
+ CalculateArgumentsFingerprint(); // read arguments.
+ return;
+ case kLocalInitializer:
+ CalculateVariableDeclarationFingerprint(); // read variable.
+ return;
+ case kAssertInitializer:
+ CalculateStatementFingerprint();
+ return;
+ default:
+ ReportUnexpectedTag("initializer", tag);
+ UNREACHABLE();
+ }
+}
+
+void KernelFingerprintHelper::CalculateDartTypeFingerprint() {
+ Tag tag = ReadTag();
+ BuildHash(tag);
+ switch (tag) {
+ case kInvalidType:
+ case kDynamicType:
+ case kVoidType:
+ case kBottomType:
+ // those contain nothing.
+ break;
+ UNIMPLEMENTED();
+ case kInterfaceType:
+ CalculateInterfaceTypeFingerprint(false);
+ break;
+ case kSimpleInterfaceType:
+ CalculateInterfaceTypeFingerprint(true);
+ break;
+ case kFunctionType:
+ CalculateFunctionTypeFingerprint(false);
+ break;
+ case kSimpleFunctionType:
+ CalculateFunctionTypeFingerprint(true);
+ break;
+ case kTypeParameterType:
+ ReadUInt(); // read index for parameter.
+ CalculateOptionalDartTypeFingerprint(); // read bound bound.
+ break;
+ default:
+ ReportUnexpectedTag("type", tag);
+ UNREACHABLE();
+ }
+}
+
+void KernelFingerprintHelper::CalculateOptionalDartTypeFingerprint() {
+ Tag tag = ReadTag(); // read tag.
+ BuildHash(tag);
+ if (tag == kNothing) {
+ return;
+ }
+ ASSERT(tag == kSomething);
+ CalculateDartTypeFingerprint(); // read type.
+}
+
+void KernelFingerprintHelper::CalculateInterfaceTypeFingerprint(bool simple) {
+ BuildHash(ReadUInt()); // read klass_name.
+ if (!simple) {
+ CalculateListOfDartTypesFingerprint(); // read list of types.
+ }
+}
+
+void KernelFingerprintHelper::CalculateFunctionTypeFingerprint(bool simple) {
+ if (!simple) {
+ CalculateTypeParametersListFingerprint(); // read type_parameters.
+ BuildHash(ReadUInt()); // read required parameter count.
+ BuildHash(ReadUInt()); // read total parameter count.
+ }
+
+ CalculateListOfDartTypesFingerprint(); // read positional_parameters types.
+
+ if (!simple) {
+ const intptr_t named_count =
+ ReadListLength(); // read named_parameters list length.
+ BuildHash(named_count);
+ for (intptr_t i = 0; i < named_count; ++i) {
+ // read string reference (i.e. named_parameters[i].name).
+ CalculateStringReferenceFingerprint();
+ CalculateDartTypeFingerprint(); // read named_parameters[i].type.
+ }
+ }
+
+ CalculateListOfStringsFingerprint(); // read positional parameter names.
+
+ if (!simple) {
+ // TODO(bkonyi): include in hash.
+ SkipCanonicalNameReference(); // read typedef reference.
+ }
+
+ CalculateDartTypeFingerprint(); // read return type.
+}
+
+void KernelFingerprintHelper::CalculateGetterNameFingerprint() {
+ const NameIndex name = ReadCanonicalNameReference();
+ if (I->strong() && !H.IsRoot(name) && (H.IsGetter(name) || H.IsField(name))) {
+ BuildHash(H.DartGetterName(name).Hash());
+ }
+}
+
+void KernelFingerprintHelper::CalculateSetterNameFingerprint() {
+ const NameIndex name = ReadCanonicalNameReference();
+ if (I->strong() && !H.IsRoot(name)) {
+ BuildHash(H.DartSetterName(name).Hash());
+ }
+}
+
+void KernelFingerprintHelper::CalculateMethodNameFingerprint() {
+ const NameIndex name =
+ ReadCanonicalNameReference(); // read interface_target_reference.
+ if (I->strong() && !H.IsRoot(name) && !H.IsField(name)) {
+ BuildHash(H.DartProcedureName(name).Hash());
+ }
+}
+
+void KernelFingerprintHelper::CalculateExpressionFingerprint() {
+ uint8_t payload = 0;
+ Tag tag = ReadTag(&payload);
+ BuildHash(tag);
+ switch (tag) {
+ case kInvalidExpression:
+ ReadPosition();
+ CalculateStringReferenceFingerprint();
+ return;
+ case kVariableGet:
+ ReadPosition(); // read position.
+ ReadUInt(); // read kernel position.
+ ReadUInt(); // read relative variable index.
+ CalculateOptionalDartTypeFingerprint(); // read promoted type.
+ return;
+ case kSpecializedVariableGet:
+ ReadPosition(); // read position.
+ ReadUInt(); // read kernel position.
+ return;
+ case kVariableSet:
+ ReadPosition(); // read position.
+ ReadUInt(); // read kernel position.
+ ReadUInt(); // read relative variable index.
+ CalculateExpressionFingerprint(); // read expression.
+ return;
+ case kSpecializedVariableSet:
+ ReadPosition(); // read position.
+ ReadUInt(); // read kernel position.
+ CalculateExpressionFingerprint(); // read expression.
+ return;
+ case kPropertyGet:
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read receiver.
+ BuildHash(ReadNameAsGetterName().Hash()); // read name.
+ CalculateGetterNameFingerprint(); // read interface_target_reference.
+ return;
+ case kPropertySet:
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read receiver.
+ BuildHash(ReadNameAsSetterName().Hash()); // read name.
+ CalculateExpressionFingerprint(); // read value.
+ CalculateSetterNameFingerprint(); // read interface_target_reference.
+ return;
+ case kSuperPropertyGet:
+ ReadPosition(); // read position.
+ BuildHash(ReadNameAsGetterName().Hash()); // read name.
+ CalculateGetterNameFingerprint(); // read interface_target_reference.
+ return;
+ case kSuperPropertySet:
+ ReadPosition(); // read position.
+ BuildHash(ReadNameAsSetterName().Hash()); // read name.
+ CalculateExpressionFingerprint(); // read value.
+ CalculateSetterNameFingerprint(); // read interface_target_reference.
+ return;
+ case kDirectPropertyGet:
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read receiver.
+ CalculateCanonicalNameFingerprint(); // read target_reference.
+ return;
+ case kDirectPropertySet:
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read receiver.
+ CalculateCanonicalNameFingerprint(); // read target_reference.
+ CalculateExpressionFingerprint(); // read value·
+ return;
+ case kStaticGet:
+ ReadPosition(); // read position.
+ CalculateCanonicalNameFingerprint(); // read target_reference.
+ return;
+ case kStaticSet:
+ ReadPosition(); // read position.
+ CalculateCanonicalNameFingerprint(); // read target_reference.
+ CalculateExpressionFingerprint(); // read expression.
+ return;
+ case kMethodInvocation:
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read receiver.
+ BuildHash(ReadNameAsMethodName().Hash()); // read name.
+ CalculateArgumentsFingerprint(); // read arguments.
+ CalculateMethodNameFingerprint(); // read interface_target_reference.
+ return;
+ case kSuperMethodInvocation:
+ ReadPosition(); // read position.
+ BuildHash(ReadNameAsMethodName().Hash()); // read name.
+ CalculateArgumentsFingerprint(); // read arguments.
+ CalculateCanonicalNameFingerprint(); // read target_reference.
+ return;
+ case kDirectMethodInvocation:
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read receiver.
+ CalculateCanonicalNameFingerprint(); // read target_reference.
+ CalculateArgumentsFingerprint(); // read arguments.
+ return;
+ case kStaticInvocation:
+ case kConstStaticInvocation:
+ ReadPosition(); // read position.
+ CalculateCanonicalNameFingerprint(); // read target_reference.
+ CalculateArgumentsFingerprint(); // read arguments.
+ return;
+ case kConstructorInvocation:
+ case kConstConstructorInvocation:
+ ReadPosition(); // read position.
+ CalculateCanonicalNameFingerprint(); // read target_reference.
+ CalculateArgumentsFingerprint(); // read arguments.
+ return;
+ case kNot:
+ CalculateExpressionFingerprint(); // read expression.
+ return;
+ case kLogicalExpression:
+ CalculateExpressionFingerprint(); // read left.
+ SkipBytes(1); // read operator.
+ CalculateExpressionFingerprint(); // read right.
+ return;
+ case kConditionalExpression:
+ CalculateExpressionFingerprint(); // read condition.
+ CalculateExpressionFingerprint(); // read then.
+ CalculateExpressionFingerprint(); // read otherwise.
+ CalculateOptionalDartTypeFingerprint(); // read unused static type.
+ return;
+ case kStringConcatenation:
+ ReadPosition(); // read position.
+ CalculateListOfExpressionsFingerprint(); // read list of expressions.
+ return;
+ case kIsExpression:
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read operand.
+ CalculateDartTypeFingerprint(); // read type.
+ return;
+ case kAsExpression:
+ ReadPosition(); // read position.
+ BuildHash(ReadFlags()); // read flags.
+ CalculateExpressionFingerprint(); // read operand.
+ CalculateDartTypeFingerprint(); // read type.
+ return;
+ case kSymbolLiteral:
+ CalculateStringReferenceFingerprint(); // read index into string table.
+ return;
+ case kTypeLiteral:
+ CalculateDartTypeFingerprint(); // read type.
+ return;
+ case kThisExpression:
+ return;
+ case kRethrow:
+ ReadPosition(); // read position.
+ return;
+ case kThrow:
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read expression.
+ return;
+ case kListLiteral:
+ case kConstListLiteral:
+ ReadPosition(); // read position.
+ CalculateDartTypeFingerprint(); // read type.
+ CalculateListOfExpressionsFingerprint(); // read list of expressions.
+ return;
+ case kMapLiteral:
+ case kConstMapLiteral: {
+ ReadPosition(); // read position.
+ CalculateDartTypeFingerprint(); // read type.
+ CalculateDartTypeFingerprint(); // read value type.
+ intptr_t list_length = ReadListLength(); // read list length.
+ for (intptr_t i = 0; i < list_length; ++i) {
+ CalculateExpressionFingerprint(); // read ith key.
+ CalculateExpressionFingerprint(); // read ith value.
+ }
+ return;
+ }
+ case kFunctionExpression:
+ ReadPosition(); // read position.
+ CalculateFunctionNodeFingerprint(); // read function node.
+ return;
+ case kLet:
+ CalculateVariableDeclarationFingerprint(); // read variable declaration.
+ CalculateExpressionFingerprint(); // read expression.
+ return;
+ case kInstantiation:
+ CalculateExpressionFingerprint(); // read expression.
+ CalculateListOfDartTypesFingerprint(); // read type arguments.
+ return;
+ case kBigIntLiteral:
+ CalculateStringReferenceFingerprint(); // read string reference.
+ return;
+ case kStringLiteral:
+ CalculateStringReferenceFingerprint(); // read string reference.
+ return;
+ case kSpecializedIntLiteral:
+ return;
+ case kNegativeIntLiteral:
+ BuildHash(ReadUInt()); // read value.
+ return;
+ case kPositiveIntLiteral:
+ BuildHash(ReadUInt()); // read value.
+ return;
+ case kDoubleLiteral: {
+ double value = ReadDouble(); // read value.
+ uint64_t data = bit_cast<uint64_t>(value);
+ BuildHash(static_cast<uint32_t>(data >> 32));
+ BuildHash(static_cast<uint32_t>(data));
+ return;
+ }
+ case kTrueLiteral:
+ return;
+ case kFalseLiteral:
+ return;
+ case kNullLiteral:
+ return;
+ case kConstantExpression:
+ SkipConstantReference();
+ return;
+ case kLoadLibrary:
+ case kCheckLibraryIsLoaded:
+ ReadUInt(); // skip library index
+ return;
+ default:
+ ReportUnexpectedTag("expression", tag);
+ UNREACHABLE();
+ }
+}
+
+void KernelFingerprintHelper::CalculateStatementFingerprint() {
+ Tag tag = ReadTag(); // read tag.
+ BuildHash(tag);
+ switch (tag) {
+ case kExpressionStatement:
+ CalculateExpressionFingerprint(); // read expression.
+ return;
+ case kBlock:
+ CalculateStatementListFingerprint();
+ return;
+ case kEmptyStatement:
+ return;
+ case kAssertBlock:
+ CalculateStatementListFingerprint();
+ return;
+ case kAssertStatement:
+ CalculateExpressionFingerprint(); // Read condition.
+ ReadPosition(); // read condition start offset.
+ ReadPosition(); // read condition end offset.
+ if (ReadTag() == kSomething) {
+ CalculateExpressionFingerprint(); // read (rest of) message.
+ }
+ return;
+ case kLabeledStatement:
+ CalculateStatementFingerprint(); // read body.
+ return;
+ case kBreakStatement:
+ ReadPosition(); // read position.
+ ReadUInt(); // read target_index.
+ return;
+ case kWhileStatement:
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read condition.
+ CalculateStatementFingerprint(); // read body.
+ return;
+ case kDoStatement:
+ ReadPosition(); // read position.
+ CalculateStatementFingerprint(); // read body.
+ CalculateExpressionFingerprint(); // read condition.
+ return;
+ case kForStatement: {
+ ReadPosition(); // read position.
+ CalculateListOfVariableDeclarationsFingerprint(); // read variables.
+ Tag tag = ReadTag(); // Read first part of condition.
+ if (tag == kSomething) {
+ CalculateExpressionFingerprint(); // read rest of condition.
+ }
+ CalculateListOfExpressionsFingerprint(); // read updates.
+ CalculateStatementFingerprint(); // read body.
+ return;
+ }
+ case kForInStatement:
+ case kAsyncForInStatement:
+ ReadPosition(); // read position.
+ ReadPosition(); // read body position.
+ CalculateVariableDeclarationFingerprint(); // read variable.
+ CalculateExpressionFingerprint(); // read iterable.
+ CalculateStatementFingerprint(); // read body.
+ return;
+ case kSwitchStatement: {
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read condition.
+ int case_count = ReadListLength(); // read number of cases.
+ for (intptr_t i = 0; i < case_count; ++i) {
+ int expression_count = ReadListLength(); // read number of expressions.
+ for (intptr_t j = 0; j < expression_count; ++j) {
+ ReadPosition(); // read jth position.
+ CalculateExpressionFingerprint(); // read jth expression.
+ }
+ BuildHash(ReadBool()); // read is_default.
+ CalculateStatementFingerprint(); // read body.
+ }
+ return;
+ }
+ case kContinueSwitchStatement:
+ ReadPosition(); // read position.
+ ReadUInt(); // read target_index.
+ return;
+ case kIfStatement:
+ ReadPosition(); // read position.
+ CalculateExpressionFingerprint(); // read condition.
+ CalculateStatementFingerprint(); // read then.
+ CalculateStatementFingerprint(); // read otherwise.
+ return;
+ case kReturnStatement: {
+ ReadPosition(); // read position
+ Tag tag = ReadTag(); // read (first part of) expression.
+ BuildHash(tag);
+ if (tag == kSomething) {
+ CalculateExpressionFingerprint(); // read (rest of) expression.
+ }
+ return;
+ }
+ case kTryCatch: {
+ CalculateStatementFingerprint(); // read body.
+ BuildHash(ReadByte()); // read flags
+ intptr_t catch_count = ReadListLength(); // read number of catches.
+ for (intptr_t i = 0; i < catch_count; ++i) {
+ ReadPosition(); // read position.
+ CalculateDartTypeFingerprint(); // read guard.
+ tag = ReadTag(); // read first part of exception.
+ BuildHash(tag);
+ if (tag == kSomething) {
+ CalculateVariableDeclarationFingerprint(); // read exception.
+ }
+ tag = ReadTag(); // read first part of stack trace.
+ BuildHash(tag);
+ if (tag == kSomething) {
+ CalculateVariableDeclarationFingerprint(); // read stack trace.
+ }
+ CalculateStatementFingerprint(); // read body.
+ }
+ return;
+ }
+ case kTryFinally:
+ CalculateStatementFingerprint(); // read body.
+ CalculateStatementFingerprint(); // read finalizer.
+ return;
+ case kYieldStatement: {
+ ReadPosition(); // read position.
+ BuildHash(ReadByte()); // read flags.
+ CalculateExpressionFingerprint(); // read expression.
+ return;
+ }
+ case kVariableDeclaration:
+ CalculateVariableDeclarationFingerprint(); // read variable declaration.
+ return;
+ case kFunctionDeclaration:
+ ReadPosition(); // read position.
+ CalculateVariableDeclarationFingerprint(); // read variable.
+ CalculateFunctionNodeFingerprint(); // read function node.
+ return;
+ default:
+ ReportUnexpectedTag("statement", tag);
+ UNREACHABLE();
+ }
+}
+
+uint32_t KernelFingerprintHelper::CalculateFieldFingerprint() {
+ hash_ = 0;
+ FieldHelper field_helper(this);
+
+ field_helper.ReadUntilExcluding(FieldHelper::kName);
+ const String& name = ReadNameAsFieldName(); // read name.
+ field_helper.SetJustRead(FieldHelper::kName);
+
+ field_helper.ReadUntilExcluding(FieldHelper::kType);
+ CalculateDartTypeFingerprint(); // read type.
+ field_helper.SetJustRead(FieldHelper::kType);
+
+ if (ReadTag() == kSomething) {
+ if (PeekTag() == kFunctionExpression) {
+ AlternativeReadingScope alt(&reader_);
+ CalculateExpressionFingerprint();
+ }
+ SkipExpression();
+ }
+
+ BuildHash(name.Hash());
+ BuildHash(field_helper.flags_);
+ BuildHash(field_helper.annotation_count_);
+ return hash_;
+}
+
+void KernelFingerprintHelper::CalculateFunctionNodeFingerprint() {
+ FunctionNodeHelper function_node_helper(this);
+
+ function_node_helper.ReadUntilExcluding(FunctionNodeHelper::kTypeParameters);
+ CalculateTypeParametersListFingerprint();
+ function_node_helper.SetJustRead(FunctionNodeHelper::kTypeParameters);
+
+ function_node_helper.ReadUntilExcluding(
+ FunctionNodeHelper::kPositionalParameters);
+ CalculateListOfVariableDeclarationsFingerprint(); // read positionals
+ CalculateListOfVariableDeclarationsFingerprint(); // read named
+ CalculateDartTypeFingerprint(); // read return type.
+
+ if (ReadTag() == kSomething) {
+ CalculateStatementFingerprint(); // Read body.
+ }
+ BuildHash(function_node_helper.total_parameter_count_);
+ BuildHash(function_node_helper.required_parameter_count_);
+}
+
+uint32_t KernelFingerprintHelper::CalculateFunctionFingerprint() {
+ hash_ = 0;
+ Tag tag = PeekTag();
+ if (tag == kField) {
+ return CalculateFieldFingerprint();
+ } else if (tag == kConstructor) {
+ CalculateConstructorFingerprint();
+ return hash_;
+ }
+ ProcedureHelper procedure_helper(this);
+ procedure_helper.ReadUntilExcluding(ProcedureHelper::kName);
+ const String& name = ReadNameAsMethodName(); // Read name.
+ procedure_helper.SetJustRead(ProcedureHelper::kName);
+
+ procedure_helper.ReadUntilExcluding(ProcedureHelper::kFunction);
+ if (ReadTag() == kSomething) {
+ CalculateFunctionNodeFingerprint();
+ }
+
+ BuildHash(procedure_helper.kind_);
+ BuildHash(procedure_helper.flags_);
+ BuildHash(procedure_helper.annotation_count_);
+ BuildHash(name.Hash());
+ return hash_;
+}
+
+uint32_t KernelSourceFingerprintHelper::CalculateClassFingerprint(
+ const Class& klass) {
+ Zone* zone = Thread::Current()->zone();
+
+ // Handle typedefs.
+ if (klass.IsTypedefClass()) {
+ const Function& func = Function::Handle(zone, klass.signature_function());
+ return CalculateFunctionFingerprint(func);
+ }
+
+ String& name = String::Handle(zone, klass.Name());
+ const Array& fields = Array::Handle(zone, klass.fields());
+ const Array& functions = Array::Handle(zone, klass.functions());
+ const Array& interfaces = Array::Handle(zone, klass.interfaces());
+ AbstractType& type = AbstractType::Handle(zone);
+
+ uint32_t hash = 0;
+ hash = KernelFingerprintHelper::CalculateHash(hash, name.Hash());
+
+ type ^= klass.super_type();
+ if (!type.IsNull()) {
+ name ^= type.Name();
+ hash = KernelFingerprintHelper::CalculateHash(hash, name.Hash());
+ }
+
+ type ^= klass.mixin();
+ if (!type.IsNull()) {
+ name ^= type.Name();
+ hash = KernelFingerprintHelper::CalculateHash(hash, name.Hash());
+ }
+
+ Field& field = Field::Handle(zone);
+ // Calculate fingerprint for the class fields.
+ for (intptr_t i = 0; i < fields.Length(); ++i) {
+ field ^= fields.At(i);
+ uint32_t fingerprint = CalculateFieldFingerprint(field);
+ hash = KernelFingerprintHelper::CalculateHash(hash, fingerprint);
+ }
+
+ // Calculate fingerprint for the class functions.
+ Function& func = Function::Handle(zone);
+ for (intptr_t i = 0; i < functions.Length(); ++i) {
+ func ^= functions.At(i);
+ uint32_t fingerprint = CalculateFunctionFingerprint(func);
+ hash = KernelFingerprintHelper::CalculateHash(hash, fingerprint);
+ }
+
+ // Calculate fingerprint for the interfaces.
+ for (intptr_t i = 0; i < interfaces.Length(); ++i) {
+ type ^= interfaces.At(i);
+ name ^= type.Name();
+ hash = KernelFingerprintHelper::CalculateHash(hash, name.Hash());
+ }
+
+ return hash;
+}
+
+uint32_t KernelSourceFingerprintHelper::CalculateFieldFingerprint(
+ const Field& field) {
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
+ const Script& script = Script::Handle(zone, field.Script());
+
+ TranslationHelper translation_helper(thread);
+ translation_helper.InitFromScript(script);
+
+ KernelFingerprintHelper helper(
+ zone, &translation_helper, script,
+ ExternalTypedData::Handle(zone, field.KernelData()),
+ field.KernelDataProgramOffset());
+ helper.SetOffset(field.kernel_offset());
+ return helper.CalculateFieldFingerprint();
+}
+
+uint32_t KernelSourceFingerprintHelper::CalculateFunctionFingerprint(
+ const Function& func) {
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
+ const Script& script = Script::Handle(zone, func.script());
+
+ TranslationHelper translation_helper(thread);
+ translation_helper.InitFromScript(script);
+
+ KernelFingerprintHelper helper(
+ zone, &translation_helper, script,
+ ExternalTypedData::Handle(zone, func.KernelData()),
+ func.KernelDataProgramOffset());
+ helper.SetOffset(func.kernel_offset());
+ return helper.CalculateFunctionFingerprint();
+}
+
+} // namespace kernel
+} // namespace dart
+
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/compiler/frontend/kernel_fingerprints.h b/runtime/vm/compiler/frontend/kernel_fingerprints.h
new file mode 100644
index 0000000..601a488a
--- /dev/null
+++ b/runtime/vm/compiler/frontend/kernel_fingerprints.h
@@ -0,0 +1,27 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef RUNTIME_VM_COMPILER_FRONTEND_KERNEL_FINGERPRINTS_H_
+#define RUNTIME_VM_COMPILER_FRONTEND_KERNEL_FINGERPRINTS_H_
+
+#include "platform/allocation.h"
+#include "vm/object.h"
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
+namespace dart {
+namespace kernel {
+
+class KernelSourceFingerprintHelper : public AllStatic {
+ public:
+ static uint32_t CalculateClassFingerprint(const Class& klass);
+ static uint32_t CalculateFieldFingerprint(const Field& field);
+ static uint32_t CalculateFunctionFingerprint(const Function& func);
+};
+
+} // namespace kernel
+} // namespace dart
+
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+#endif // RUNTIME_VM_COMPILER_FRONTEND_KERNEL_FINGERPRINTS_H_
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index d22bad5..73d7c38 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -104,8 +104,7 @@
breakable_block_(NULL),
switch_block_(NULL),
try_finally_block_(NULL),
- catch_block_(NULL),
- streaming_flow_graph_builder_(NULL) {
+ catch_block_(NULL) {
const Script& script =
Script::Handle(Z, parsed_function->function().script());
H.InitFromScript(script);
@@ -113,66 +112,6 @@
FlowGraphBuilder::~FlowGraphBuilder() {}
-Fragment FlowGraphBuilder::TranslateFinallyFinalizers(
- TryFinallyBlock* outer_finally,
- intptr_t target_context_depth) {
- TryFinallyBlock* const saved_block = try_finally_block_;
- TryCatchBlock* const saved_try_catch_block = try_catch_block_;
- const intptr_t saved_depth = context_depth_;
- const intptr_t saved_try_depth = try_depth_;
-
- Fragment instructions;
-
- // While translating the body of a finalizer we need to set the try-finally
- // block which is active when translating the body.
- while (try_finally_block_ != outer_finally) {
- // Set correct try depth (in case there are nested try statements).
- try_depth_ = try_finally_block_->try_depth();
-
- // Potentially restore the context to what is expected for the finally
- // block.
- instructions += AdjustContextTo(try_finally_block_->context_depth());
-
- // The to-be-translated finalizer has to have the correct try-index (namely
- // the one outside the try-finally block).
- bool changed_try_index = false;
- intptr_t target_try_index = try_finally_block_->try_index();
- while (CurrentTryIndex() != target_try_index) {
- try_catch_block_ = try_catch_block_->outer();
- changed_try_index = true;
- }
- if (changed_try_index) {
- JoinEntryInstr* entry = BuildJoinEntry();
- instructions += Goto(entry);
- instructions = Fragment(instructions.entry, entry);
- }
-
- intptr_t finalizer_kernel_offset =
- try_finally_block_->finalizer_kernel_offset();
- try_finally_block_ = try_finally_block_->outer();
- instructions += streaming_flow_graph_builder_->BuildStatementAt(
- finalizer_kernel_offset);
-
- // We only need to make sure that if the finalizer ended normally, we
- // continue towards the next outer try-finally.
- if (!instructions.is_open()) break;
- }
-
- if (instructions.is_open() && target_context_depth != -1) {
- // A target context depth of -1 indicates that the code after this
- // will not care about the context chain so we can leave it any way we
- // want after the last finalizer. That is used when returning.
- instructions += AdjustContextTo(target_context_depth);
- }
-
- try_finally_block_ = saved_block;
- try_catch_block_ = saved_try_catch_block;
- context_depth_ = saved_depth;
- try_depth_ = saved_try_depth;
-
- return instructions;
-}
-
Fragment FlowGraphBuilder::EnterScope(intptr_t kernel_offset,
intptr_t* num_context_variables) {
Fragment instructions;
@@ -1333,10 +1272,7 @@
StreamingFlowGraphBuilder streaming_flow_graph_builder(
this, ExternalTypedData::Handle(Z, function.KernelData()),
function.KernelDataProgramOffset());
- streaming_flow_graph_builder_ = &streaming_flow_graph_builder;
- FlowGraph* result = streaming_flow_graph_builder_->BuildGraph();
- streaming_flow_graph_builder_ = NULL;
- return result;
+ return streaming_flow_graph_builder.BuildGraph();
}
Fragment FlowGraphBuilder::NativeFunctionBody(intptr_t first_positional_offset,
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.h b/runtime/vm/compiler/frontend/kernel_to_il.h
index 53d60ec..cca1409 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.h
+++ b/runtime/vm/compiler/frontend/kernel_to_il.h
@@ -7,7 +7,6 @@
#if !defined(DART_PRECOMPILED_RUNTIME)
-#include <functional>
#include <initializer_list>
#include "vm/growable_array.h"
@@ -15,7 +14,7 @@
#include "vm/compiler/backend/flow_graph.h"
#include "vm/compiler/backend/il.h"
-#include "vm/compiler/frontend/flow_graph_builder.h"
+#include "vm/compiler/frontend/flow_graph_builder.h" // For InlineExitCollector.
#include "vm/compiler/frontend/kernel_translation_helper.h"
#include "vm/compiler/frontend/scope_builder.h"
@@ -253,6 +252,8 @@
friend class StreamingFlowGraphBuilder;
friend class FlowGraphBuilder;
friend class PrologueBuilder;
+
+ DISALLOW_COPY_AND_ASSIGN(BaseFlowGraphBuilder);
};
class FlowGraphBuilder : public BaseFlowGraphBuilder {
@@ -285,9 +286,6 @@
Fragment NativeFunctionBody(intptr_t first_positional_offset,
const Function& function);
- Fragment TranslateFinallyFinalizers(TryFinallyBlock* outer_finally,
- intptr_t target_context_depth);
-
Fragment EnterScope(intptr_t kernel_offset,
intptr_t* num_context_variables = NULL);
Fragment ExitScope(intptr_t kernel_offset);
@@ -468,14 +466,15 @@
ActiveClass active_class_;
- StreamingFlowGraphBuilder* streaming_flow_graph_builder_;
-
friend class BreakableBlock;
friend class CatchBlock;
+ friend class ConstantEvaluator;
friend class StreamingFlowGraphBuilder;
friend class SwitchBlock;
friend class TryCatchBlock;
friend class TryFinallyBlock;
+
+ DISALLOW_COPY_AND_ASSIGN(FlowGraphBuilder);
};
class SwitchBlock {
@@ -557,6 +556,8 @@
intptr_t depth_;
intptr_t context_depth_;
intptr_t try_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(SwitchBlock);
};
class TryCatchBlock {
@@ -578,6 +579,8 @@
BaseFlowGraphBuilder* builder_;
TryCatchBlock* outer_;
intptr_t try_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(TryCatchBlock);
};
class TryFinallyBlock {
@@ -609,6 +612,8 @@
const intptr_t context_depth_;
const intptr_t try_depth_;
const intptr_t try_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(TryFinallyBlock);
};
class BreakableBlock {
@@ -661,6 +666,8 @@
TryFinallyBlock* outer_finally_;
intptr_t context_depth_;
intptr_t try_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(BreakableBlock);
};
class CatchBlock {
@@ -688,6 +695,8 @@
LocalVariable* exception_var_;
LocalVariable* stack_trace_var_;
intptr_t catch_try_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(CatchBlock);
};
RawObject* EvaluateMetadata(const Field& metadata_field,
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index 8e6e3b39..5872d07 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -585,6 +585,21 @@
return function;
}
+RawFunction* TranslationHelper::LookupDynamicFunction(const Class& klass,
+ const String& name) {
+ // Search the superclass chain for the selector.
+ Class& iterate_klass = Class::Handle(Z, klass.raw());
+ while (!iterate_klass.IsNull()) {
+ RawFunction* function =
+ iterate_klass.LookupDynamicFunctionAllowPrivate(name);
+ if (function != Object::null()) {
+ return function;
+ }
+ iterate_klass = iterate_klass.SuperClass();
+ }
+ return Function::null();
+}
+
Type& TranslationHelper::GetCanonicalType(const Class& klass) {
ASSERT(!klass.IsNull());
// Note that if cls is _Closure, the returned type will be _Closure,
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.h b/runtime/vm/compiler/frontend/kernel_translation_helper.h
index f18a9bb..5175bfb 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.h
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.h
@@ -146,6 +146,7 @@
StringIndex constructor_name);
RawFunction* LookupMethodByMember(NameIndex target,
const String& method_name);
+ RawFunction* LookupDynamicFunction(const Class& klass, const String& name);
Type& GetCanonicalType(const Class& klass);
@@ -186,6 +187,8 @@
ExternalTypedData& metadata_payloads_;
ExternalTypedData& metadata_mappings_;
Array& constants_;
+
+ DISALLOW_COPY_AND_ASSIGN(TranslationHelper);
};
// Helper class that reads a kernel FunctionNode from binary.
@@ -245,6 +248,8 @@
private:
KernelReaderHelper* helper_;
intptr_t next_read_;
+
+ DISALLOW_COPY_AND_ASSIGN(FunctionNodeHelper);
};
class TypeParameterHelper {
@@ -295,6 +300,8 @@
private:
KernelReaderHelper* helper_;
intptr_t next_read_;
+
+ DISALLOW_COPY_AND_ASSIGN(TypeParameterHelper);
};
// Helper class that reads a kernel VariableDeclaration from binary.
@@ -353,6 +360,8 @@
private:
KernelReaderHelper* helper_;
intptr_t next_read_;
+
+ DISALLOW_COPY_AND_ASSIGN(VariableDeclarationHelper);
};
// Helper class that reads a kernel Field from binary.
@@ -434,6 +443,8 @@
bool has_function_literal_initializer_;
TokenPosition function_literal_start_;
TokenPosition function_literal_end_;
+
+ DISALLOW_COPY_AND_ASSIGN(FieldHelper);
};
// Helper class that reads a kernel Procedure from binary.
@@ -518,6 +529,8 @@
private:
KernelReaderHelper* helper_;
intptr_t next_read_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProcedureHelper);
};
// Helper class that reads a kernel Constructor from binary.
@@ -577,6 +590,8 @@
private:
KernelReaderHelper* helper_;
intptr_t next_read_;
+
+ DISALLOW_COPY_AND_ASSIGN(ConstructorHelper);
};
// Helper class that reads a kernel Class from binary.
@@ -649,6 +664,8 @@
private:
KernelReaderHelper* helper_;
intptr_t next_read_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClassHelper);
};
// Helper class that reads a kernel Library from binary.
@@ -705,6 +722,8 @@
private:
KernelReaderHelper* helper_;
intptr_t next_read_;
+
+ DISALLOW_COPY_AND_ASSIGN(LibraryHelper);
};
class LibraryDependencyHelper {
@@ -745,6 +764,8 @@
private:
KernelReaderHelper* helper_;
intptr_t next_read_;
+
+ DISALLOW_COPY_AND_ASSIGN(LibraryDependencyHelper);
};
// Base class for helpers accessing metadata of a certain kind.
@@ -778,6 +799,8 @@
intptr_t mappings_num_;
intptr_t last_node_offset_;
intptr_t last_mapping_index_;
+
+ DISALLOW_COPY_AND_ASSIGN(MetadataHelper);
};
struct DirectCallMetadata {
@@ -803,6 +826,8 @@
bool ReadMetadata(intptr_t node_offset,
NameIndex* target_name,
bool* check_receiver_for_null);
+
+ DISALLOW_COPY_AND_ASSIGN(DirectCallMetadataHelper);
};
struct InferredTypeMetadata {
@@ -823,6 +848,9 @@
explicit InferredTypeMetadataHelper(KernelReaderHelper* helper);
InferredTypeMetadata GetInferredType(intptr_t node_offset);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(InferredTypeMetadataHelper);
};
struct ProcedureAttributesMetadata {
@@ -849,6 +877,8 @@
private:
bool ReadMetadata(intptr_t node_offset,
ProcedureAttributesMetadata* metadata);
+
+ DISALLOW_COPY_AND_ASSIGN(ProcedureAttributesMetadataHelper);
};
class KernelReaderHelper {
@@ -961,6 +991,7 @@
intptr_t data_program_offset_;
friend class ClassHelper;
+ friend class ConstantEvaluator;
friend class ConstantHelper;
friend class ConstructorHelper;
friend class DirectCallMetadataHelper;
@@ -974,7 +1005,6 @@
friend class ProcedureAttributesMetadataHelper;
friend class ProcedureHelper;
friend class SimpleExpressionConverter;
- friend class StreamingConstantEvaluator;
friend class ScopeBuilder;
friend class TypeParameterHelper;
friend class TypeTranslator;
@@ -983,6 +1013,9 @@
#if defined(DART_USE_INTERPRETER)
friend class BytecodeMetadataHelper;
#endif // defined(DART_USE_INTERPRETER)
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(KernelReaderHelper);
};
class ActiveClass {
@@ -1046,6 +1079,8 @@
private:
ActiveClass* active_class_;
ActiveClass saved_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActiveClassScope);
};
class ActiveMemberScope {
@@ -1061,6 +1096,8 @@
private:
ActiveClass* active_class_;
ActiveClass saved_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActiveMemberScope);
};
class ActiveTypeParametersScope {
@@ -1087,6 +1124,8 @@
private:
ActiveClass* active_class_;
ActiveClass saved_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActiveTypeParametersScope);
};
class TypeTranslator {
@@ -1162,6 +1201,8 @@
friend class ScopeBuilder;
friend class KernelLoader;
+
+ DISALLOW_COPY_AND_ASSIGN(TypeTranslator);
};
} // namespace kernel
diff --git a/runtime/vm/compiler/frontend/prologue_builder.cc b/runtime/vm/compiler/frontend/prologue_builder.cc
index 117f76c..a60d6fb 100644
--- a/runtime/vm/compiler/frontend/prologue_builder.cc
+++ b/runtime/vm/compiler/frontend/prologue_builder.cc
@@ -6,7 +6,7 @@
#include "vm/compiler/backend/il.h"
#include "vm/compiler/backend/il_printer.h"
-#include "vm/compiler/frontend/kernel_binary_flowgraph.h"
+#include "vm/compiler/frontend/kernel_to_il.h"
#include "vm/compiler/jit/compiler.h"
#include "vm/kernel_loader.h"
#include "vm/longjump.h"
diff --git a/runtime/vm/compiler/frontend/scope_builder.h b/runtime/vm/compiler/frontend/scope_builder.h
index 4d63d92..210c51b 100644
--- a/runtime/vm/compiler/frontend/scope_builder.h
+++ b/runtime/vm/compiler/frontend/scope_builder.h
@@ -159,6 +159,8 @@
InferredTypeMetadataHelper inferred_type_metadata_helper_;
ProcedureAttributesMetadataHelper procedure_attributes_metadata_helper_;
TypeTranslator type_translator_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopeBuilder);
};
struct FunctionScope {
@@ -221,6 +223,9 @@
// For-in iterators, one per for-in nesting level.
GrowableArray<LocalVariable*> iterator_variables;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopeBuildingResult);
};
bool IsFieldInitializer(const Function& function, Zone* zone);
diff --git a/runtime/vm/constants_arm.h b/runtime/vm/constants_arm.h
index 8be187e..7eb81e2 100644
--- a/runtime/vm/constants_arm.h
+++ b/runtime/vm/constants_arm.h
@@ -268,7 +268,6 @@
const Register SPREG = SP; // Stack pointer register.
const Register FPREG = FP; // Frame pointer register.
const Register LRREG = LR; // Link register.
-const Register ICREG = R9; // IC data register.
const Register ARGS_DESC_REG = R4;
const Register CODE_REG = R6;
const Register THR = R10; // Caches current thread in generated code.
diff --git a/runtime/vm/constants_arm64.h b/runtime/vm/constants_arm64.h
index 9294a1b..bde068a 100644
--- a/runtime/vm/constants_arm64.h
+++ b/runtime/vm/constants_arm64.h
@@ -112,7 +112,6 @@
const Register FPREG = FP; // Frame pointer register.
const Register SPREG = R15; // Stack pointer register.
const Register LRREG = LR; // Link register.
-const Register ICREG = R5; // IC data register.
const Register ARGS_DESC_REG = R4; // Arguments descriptor register.
const Register THR = R26; // Caches current thread in generated code.
const Register CALLEE_SAVED_TEMP = R19;
diff --git a/runtime/vm/constants_dbc.h b/runtime/vm/constants_dbc.h
index 2c94483..c211898 100644
--- a/runtime/vm/constants_dbc.h
+++ b/runtime/vm/constants_dbc.h
@@ -596,9 +596,11 @@
// arguments SP[-2] using SubtypeTestCache PP[D].
// If A is 1, then the instance may be a Smi.
//
+// Instance remains on stack. Other arguments are consumed.
+//
// - AssertSubtype
//
-// Assers that one type is a subtype of another. Throws a TypeError
+// Assert that one type is a subtype of another. Throws a TypeError
// otherwise. The stack has the following arguments on it:
//
// SP[-4] instantiator type args
diff --git a/runtime/vm/constants_ia32.h b/runtime/vm/constants_ia32.h
index 1f4e449..239d4ab 100644
--- a/runtime/vm/constants_ia32.h
+++ b/runtime/vm/constants_ia32.h
@@ -60,7 +60,6 @@
const Register PP = kNoRegister; // No object pool pointer.
const Register SPREG = ESP; // Stack pointer register.
const Register FPREG = EBP; // Frame pointer register.
-const Register ICREG = ECX; // IC data register.
const Register ARGS_DESC_REG = EDX; // Arguments descriptor register.
const Register THR = ESI; // Caches current thread in generated code.
const Register CALLEE_SAVED_TEMP = EBX;
diff --git a/runtime/vm/constants_kbc.h b/runtime/vm/constants_kbc.h
index e6250b5..6874731 100644
--- a/runtime/vm/constants_kbc.h
+++ b/runtime/vm/constants_kbc.h
@@ -624,9 +624,11 @@
// arguments SP[-2] using SubtypeTestCache PP[D].
// If A is 1, then the instance may be a Smi.
//
+// Instance remains on stack. Other arguments are consumed.
+//
// - AssertSubtype
//
-// Assers that one type is a subtype of another. Throws a TypeError
+// Assert that one type is a subtype of another. Throws a TypeError
// otherwise. The stack has the following arguments on it:
//
// SP[-4] instantiator type args
diff --git a/runtime/vm/constants_x64.h b/runtime/vm/constants_x64.h
index 0038c40..163821d 100644
--- a/runtime/vm/constants_x64.h
+++ b/runtime/vm/constants_x64.h
@@ -103,7 +103,6 @@
const Register PP = R15;
const Register SPREG = RSP; // Stack pointer register.
const Register FPREG = RBP; // Frame pointer register.
-const Register ICREG = RBX; // IC data register.
const Register ARGS_DESC_REG = R10; // Arguments descriptor register.
const Register CODE_REG = R12;
const Register THR = R14; // Caches current thread in generated code.
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index ddce593..b3bc990 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -324,21 +324,21 @@
return NULL;
}
-// This waits until only the VM isolate and the service isolate remains in the
-// list, i.e. list length == 2.
+bool Dart::HasApplicationIsolateLocked() {
+ for (Isolate* isolate = Isolate::isolates_list_head_; isolate != NULL;
+ isolate = isolate->next_) {
+ if (!Isolate::IsVMInternalIsolate(isolate)) return true;
+ }
+ return false;
+}
+
+// This waits until only the VM, service and kernel isolates are in the list.
void Dart::WaitForApplicationIsolateShutdown() {
ASSERT(!Isolate::creation_enabled_);
MonitorLocker ml(Isolate::isolates_list_monitor_);
- while ((Isolate::isolates_list_head_ != NULL) &&
- (Isolate::isolates_list_head_->next_ != NULL) &&
- (Isolate::isolates_list_head_->next_->next_ != NULL)) {
+ while (HasApplicationIsolateLocked()) {
ml.Wait();
}
- ASSERT(
- ((Isolate::isolates_list_head_ == Dart::vm_isolate()) &&
- ServiceIsolate::IsServiceIsolate(Isolate::isolates_list_head_->next_)) ||
- ((Isolate::isolates_list_head_->next_ == Dart::vm_isolate()) &&
- ServiceIsolate::IsServiceIsolate(Isolate::isolates_list_head_)));
}
// This waits until only the VM isolate remains in the list.
@@ -402,7 +402,7 @@
// Wait for all isolates, but the service and the vm isolate to shut down.
// Only do that if there is a service isolate running.
- if (ServiceIsolate::IsRunning()) {
+ if (ServiceIsolate::IsRunning() || KernelIsolate::IsRunning()) {
if (FLAG_trace_shutdown) {
OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down app isolates\n",
UptimeMillis());
@@ -410,6 +410,13 @@
WaitForApplicationIsolateShutdown();
}
+ // Shutdown the kernel isolate.
+ if (FLAG_trace_shutdown) {
+ OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down kernel isolate\n",
+ UptimeMillis());
+ }
+ KernelIsolate::Shutdown();
+
// Shutdown the service isolate.
if (FLAG_trace_shutdown) {
OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down service isolate\n",
diff --git a/runtime/vm/dart.h b/runtime/vm/dart.h
index 76243b3..fe4f566 100644
--- a/runtime/vm/dart.h
+++ b/runtime/vm/dart.h
@@ -120,6 +120,7 @@
private:
static void WaitForIsolateShutdown();
static void WaitForApplicationIsolateShutdown();
+ static bool HasApplicationIsolateLocked();
static Isolate* vm_isolate_;
static int64_t start_time_micros_;
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 2ccdeca..864e7bf 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -6057,11 +6057,13 @@
platform_kernel_size, 0, NULL,
incremental_compile, package_config);
if (result.status == Dart_KernelCompilationStatus_Ok) {
- if (KernelIsolate::AcceptCompilation().status !=
- Dart_KernelCompilationStatus_Ok) {
- FATAL(
+ Dart_KernelCompilationResult accept_result =
+ KernelIsolate::AcceptCompilation();
+ if (accept_result.status != Dart_KernelCompilationStatus_Ok) {
+ FATAL1(
"An error occurred in the CFE while accepting the most recent"
- " compilation results.");
+ " compilation results: %s",
+ accept_result.error);
}
}
#endif
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index ef393a7..e81dd2f 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -581,7 +581,7 @@
EXPECT(Dart_IsError(result));
if (FLAG_use_dart_frontend) {
- EXPECT_SUBSTRING("Expected ';' before this.", Dart_GetError(result));
+ EXPECT_SUBSTRING("Expected ';' after this.", Dart_GetError(result));
} else {
EXPECT_SUBSTRING("semicolon expected", Dart_GetError(result));
}
@@ -593,7 +593,7 @@
result = Dart_Invoke(lib, NewString("Func1"), 0, NULL);
EXPECT(Dart_IsError(result));
if (FLAG_use_dart_frontend) {
- EXPECT_SUBSTRING("Expected ';' before this.", Dart_GetError(result));
+ EXPECT_SUBSTRING("Expected ';' after this.", Dart_GetError(result));
} else {
EXPECT_SUBSTRING("semicolon expected", Dart_GetError(result));
}
@@ -605,7 +605,7 @@
result = Dart_Invoke(lib, NewString("Func1"), 0, NULL);
EXPECT(Dart_IsError(result));
if (FLAG_use_dart_frontend) {
- EXPECT_SUBSTRING("Expected ';' before this.", Dart_GetError(result));
+ EXPECT_SUBSTRING("Expected ';' after this.", Dart_GetError(result));
} else {
EXPECT_SUBSTRING("semicolon expected", Dart_GetError(result));
}
@@ -6853,7 +6853,7 @@
"foo1:///main.dart",
/* multiroot_filepaths= */ "/bar,/baz",
/* multiroot_scheme= */ "foo");
- EXPECT_ERROR(lib, "Compilation failed foo1");
+ EXPECT_ERROR(lib, "Compilation failed FileSystemException(uri=foo1:");
}
void NewNativePort_send123(Dart_Port dest_port_id, Dart_CObject* message) {
diff --git a/runtime/vm/dart_api_message.cc b/runtime/vm/dart_api_message.cc
index 790ff67..689d488 100644
--- a/runtime/vm/dart_api_message.cc
+++ b/runtime/vm/dart_api_message.cc
@@ -1178,6 +1178,9 @@
void* peer = object->value.as_external_typed_data.peer;
Dart_WeakPersistentHandleFinalizer callback =
object->value.as_external_typed_data.callback;
+ if (callback == NULL) {
+ return false;
+ }
WriteSmi(length);
finalizable_data_->Put(length, reinterpret_cast<void*>(data), peer,
callback);
diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc
index 5c97ead..8fca526 100644
--- a/runtime/vm/dart_entry.cc
+++ b/runtime/vm/dart_entry.cc
@@ -138,12 +138,10 @@
}
}
if (!function.HasCode() && function.HasBytecode()) {
- const Code& bytecode = Code::Handle(zone, function.Bytecode());
- ASSERT(!bytecode.IsNull());
ASSERT(thread->no_callback_scope_depth() == 0);
SuspendLongJumpScope suspend_long_jump_scope(thread);
TransitionToGenerated transition(thread);
- return Interpreter::Current()->Call(bytecode, arguments_descriptor,
+ return Interpreter::Current()->Call(function, arguments_descriptor,
arguments, thread);
}
#else
diff --git a/runtime/vm/interpreter.cc b/runtime/vm/interpreter.cc
index 12b87ef..11fc088 100644
--- a/runtime/vm/interpreter.cc
+++ b/runtime/vm/interpreter.cc
@@ -13,7 +13,6 @@
#include "vm/compiler/assembler/assembler.h"
#include "vm/compiler/assembler/disassembler_kbc.h"
#include "vm/compiler/jit/compiler.h"
-#include "vm/constants_kbc.h"
#include "vm/cpu.h"
#include "vm/dart_entry.h"
#include "vm/debugger.h"
@@ -599,14 +598,6 @@
}
#endif // defined(DEBUG)
-bool Interpreter::IsTracing() const {
-#if defined(DEBUG)
- return IsTracingExecution();
-#else
- return false;
-#endif
-}
-
// Calls into the Dart runtime are based on this interface.
typedef void (*InterpreterRuntimeCall)(NativeArguments arguments);
@@ -972,16 +963,46 @@
}
case RawFunction::kImplicitSetter: {
// Field object is cached in function's data_.
- // TODO(regis): We currently ignore field.guarded_cid() and the type
- // test of the setter value. Either execute these tests here or fall
- // back to compiling the setter when required.
+ // TODO(regis): We currently ignore field.guarded_cid().
RawInstance* instance = reinterpret_cast<RawInstance*>(*call_base);
RawField* field = reinterpret_cast<RawField*>(function->ptr()->data_);
intptr_t offset_in_words = Smi::Value(field->ptr()->value_.offset_);
- reinterpret_cast<RawObject**>(instance->ptr())[offset_in_words] =
- *(call_base + 1);
+ RawAbstractType* field_type = field->ptr()->type_;
+ const classid_t cid =
+ field_type->GetClassId() == kTypeCid
+ ? Smi::Value(reinterpret_cast<RawSmi*>(
+ Type::RawCast(field_type)->ptr()->type_class_id_))
+ : kIllegalCid; // Not really illegal, but not a Type to skip.
+ // Perform type test of value if field type is not one of dynamic, object,
+ // or void, and if the value is not null.
+ RawObject* null_value = Object::null();
+ RawObject* value = *(call_base + 1);
+ if (cid != kDynamicCid && cid != kInstanceCid && cid != kVoidCid &&
+ value != null_value) {
+ // Push arguments of type test.
+ // Type checked value is at call_base + 1.
+ // Provide type arguments of instance as instantiator.
+ RawClass* instance_class = thread->isolate()->class_table()->At(
+ InterpreterHelpers::GetClassId(instance));
+ call_base[2] =
+ instance_class->ptr()->num_type_arguments_ > 0
+ ? reinterpret_cast<RawObject**>(
+ instance
+ ->ptr())[instance_class->ptr()
+ ->type_arguments_field_offset_in_words_]
+ : null_value;
+ call_base[3] = null_value; // Implicit setters cannot be generic.
+ call_base[4] = field_type;
+ call_base[5] = field->ptr()->name_;
+ if (!AssertAssignable(thread, *pc, *FP, call_base + 5, call_base + 1,
+ SubtypeTestCache::RawCast(null_value))) {
+ *invoked = true;
+ return false;
+ }
+ }
+ reinterpret_cast<RawObject**>(instance->ptr())[offset_in_words] = value;
*SP = call_base;
- **SP = Object::null();
+ **SP = null_value;
*invoked = true;
return true;
}
@@ -1469,10 +1490,94 @@
return true;
}
-RawObject* Interpreter::Call(const Code& code,
+bool Interpreter::AssertAssignable(Thread* thread,
+ uint32_t* pc,
+ RawObject** FP,
+ RawObject** call_top,
+ RawObject** args,
+ RawSubtypeTestCache* cache) {
+ RawObject* null_value = Object::null();
+ if (cache != null_value) {
+ RawInstance* instance = static_cast<RawInstance*>(args[0]);
+ RawTypeArguments* instantiator_type_arguments =
+ static_cast<RawTypeArguments*>(args[1]);
+ RawTypeArguments* function_type_arguments =
+ static_cast<RawTypeArguments*>(args[2]);
+
+ const intptr_t cid = InterpreterHelpers::GetClassId(instance);
+
+ RawTypeArguments* instance_type_arguments =
+ static_cast<RawTypeArguments*>(null_value);
+ RawObject* instance_cid_or_function;
+ if (cid == kClosureCid) {
+ RawClosure* closure = static_cast<RawClosure*>(instance);
+ if (closure->ptr()->function_type_arguments_ != TypeArguments::null()) {
+ // Cache cannot be used for generic closures.
+ goto AssertAssignableCallRuntime;
+ }
+ instance_type_arguments = closure->ptr()->instantiator_type_arguments_;
+ instance_cid_or_function = closure->ptr()->function_;
+ } else {
+ instance_cid_or_function = Smi::New(cid);
+
+ RawClass* instance_class = thread->isolate()->class_table()->At(cid);
+ if (instance_class->ptr()->num_type_arguments_ < 0) {
+ goto AssertAssignableCallRuntime;
+ } else if (instance_class->ptr()->num_type_arguments_ > 0) {
+ instance_type_arguments = reinterpret_cast<RawTypeArguments**>(
+ instance->ptr())[instance_class->ptr()
+ ->type_arguments_field_offset_in_words_];
+ }
+ }
+
+ for (RawObject** entries = cache->ptr()->cache_->ptr()->data();
+ entries[0] != null_value;
+ entries += SubtypeTestCache::kTestEntryLength) {
+ if ((entries[SubtypeTestCache::kInstanceClassIdOrFunction] ==
+ instance_cid_or_function) &&
+ (entries[SubtypeTestCache::kInstanceTypeArguments] ==
+ instance_type_arguments) &&
+ (entries[SubtypeTestCache::kInstantiatorTypeArguments] ==
+ instantiator_type_arguments) &&
+ (entries[SubtypeTestCache::kFunctionTypeArguments] ==
+ function_type_arguments)) {
+ if (Bool::True().raw() == entries[SubtypeTestCache::kTestResult]) {
+ return true;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+
+AssertAssignableCallRuntime:
+ // TODO(regis): Modify AssertAssignable bytecode to expect arguments in same
+ // order as the TypeCheck runtime call, so this copying can be avoided.
+ call_top[1] = args[0]; // instance
+ call_top[2] = args[3]; // type
+ call_top[3] = args[1]; // instantiator type args
+ call_top[4] = args[2]; // function type args
+ call_top[5] = args[4]; // name
+ call_top[6] = cache;
+ call_top[7] = Smi::New(kTypeCheckFromInline);
+ Exit(thread, FP, call_top + 8, pc);
+ NativeArguments native_args(thread, 7, call_top + 1, call_top + 1);
+ return InvokeRuntime(thread, this, DRT_TypeCheck, native_args);
+}
+
+RawObject* Interpreter::Call(const Function& function,
const Array& arguments_descriptor,
const Array& arguments,
Thread* thread) {
+ return Call(function.raw(), arguments_descriptor.raw(), arguments.Length(),
+ arguments.raw_ptr()->data(), thread);
+}
+
+RawObject* Interpreter::Call(RawFunction* function,
+ RawArray* argdesc,
+ intptr_t argc,
+ RawObject* const* argv,
+ Thread* thread) {
// Dispatch used to interpret bytecode. Contains addresses of
// labels of bytecode handlers. Handlers themselves are defined below.
static const void* dispatch[] = {
@@ -1500,7 +1605,7 @@
reentering ? "Re-entering" : "Entering",
reinterpret_cast<uword>(this), reinterpret_cast<uword>(fp_),
thread->top_exit_frame_info(),
- Function::Handle(code.function()).ToCString());
+ Function::Handle(function).ToCString());
}
#endif
@@ -1532,7 +1637,9 @@
// |
// v
//
- FP = fp_ + 1 + arguments.Length() + kKBCDartFrameFixedSize;
+ // A negative argc indicates reverse memory order of arguments.
+ const intptr_t arg_count = argc < 0 ? -argc : argc;
+ FP = fp_ + 1 + arg_count + kKBCDartFrameFixedSize;
SP = FP - 1;
// Save outer top_exit_frame_info.
@@ -1540,25 +1647,25 @@
thread->set_top_exit_frame_info(0);
// Copy arguments and setup the Dart frame.
- const intptr_t argc = arguments.Length();
- for (intptr_t i = 0; i < argc; i++) {
- fp_[1 + i] = arguments.At(i);
+ for (intptr_t i = 0; i < arg_count; i++) {
+ fp_[1 + i] = argv[argc < 0 ? -i : i];
}
- FP[kKBCFunctionSlotFromFp] = code.function();
- FP[kKBCPcMarkerSlotFromFp] = code.raw();
+ RawCode* bytecode = function->ptr()->bytecode_;
+ FP[kKBCFunctionSlotFromFp] = function;
+ FP[kKBCPcMarkerSlotFromFp] = bytecode;
FP[kKBCSavedCallerPcSlotFromFp] =
- reinterpret_cast<RawObject*>((argc << 2) | 2);
+ reinterpret_cast<RawObject*>((arg_count << 2) | 2);
FP[kKBCSavedCallerFpSlotFromFp] = reinterpret_cast<RawObject*>(fp_);
// Load argument descriptor.
- argdesc_ = arguments_descriptor.raw();
+ argdesc_ = argdesc;
// Ready to start executing bytecode. Load entry point and corresponding
// object pool.
- pc = reinterpret_cast<uint32_t*>(code.raw()->ptr()->entry_point_);
+ pc = reinterpret_cast<uint32_t*>(bytecode->ptr()->entry_point_);
pc_ = reinterpret_cast<uword>(pc); // For the profiler.
- pp_ = code.object_pool();
+ pp_ = bytecode->ptr()->object_pool_;
// Cache some frequently used values in the frame.
RawBool* true_value = Bool::True().raw();
@@ -3189,6 +3296,9 @@
ASSERT(reinterpret_cast<uword>(fp_) < stack_limit());
const intptr_t argc = reinterpret_cast<uword>(pc) >> 2;
ASSERT(fp_ == FrameArguments(FP, argc + 1));
+ // Exception propagation should have been done.
+ ASSERT(!result->IsHeapObject() ||
+ result->GetClassId() != kUnhandledExceptionCid);
#endif
return result;
}
@@ -3578,76 +3688,11 @@
if (!smi_ok && (args[0] != null_value)) {
RawSubtypeTestCache* cache =
static_cast<RawSubtypeTestCache*>(LOAD_CONSTANT(rD));
- if (cache != null_value) {
- RawInstance* instance = static_cast<RawInstance*>(args[0]);
- RawTypeArguments* instantiator_type_arguments =
- static_cast<RawTypeArguments*>(args[1]);
- RawTypeArguments* function_type_arguments =
- static_cast<RawTypeArguments*>(args[2]);
- const intptr_t cid = InterpreterHelpers::GetClassId(instance);
-
- RawTypeArguments* instance_type_arguments =
- static_cast<RawTypeArguments*>(null_value);
- RawObject* instance_cid_or_function;
- if (cid == kClosureCid) {
- RawClosure* closure = static_cast<RawClosure*>(instance);
- if (closure->ptr()->function_type_arguments_ !=
- TypeArguments::null()) {
- // Cache cannot be used for generic closures.
- goto AssertAssignableCallRuntime;
- }
- instance_type_arguments =
- closure->ptr()->instantiator_type_arguments_;
- instance_cid_or_function = closure->ptr()->function_;
- } else {
- instance_cid_or_function = Smi::New(cid);
-
- RawClass* instance_class = thread->isolate()->class_table()->At(cid);
- if (instance_class->ptr()->num_type_arguments_ < 0) {
- goto AssertAssignableCallRuntime;
- } else if (instance_class->ptr()->num_type_arguments_ > 0) {
- instance_type_arguments = reinterpret_cast<RawTypeArguments**>(
- instance->ptr())[instance_class->ptr()
- ->type_arguments_field_offset_in_words_];
- }
- }
-
- for (RawObject** entries = cache->ptr()->cache_->ptr()->data();
- entries[0] != null_value;
- entries += SubtypeTestCache::kTestEntryLength) {
- if ((entries[SubtypeTestCache::kInstanceClassIdOrFunction] ==
- instance_cid_or_function) &&
- (entries[SubtypeTestCache::kInstanceTypeArguments] ==
- instance_type_arguments) &&
- (entries[SubtypeTestCache::kInstantiatorTypeArguments] ==
- instantiator_type_arguments) &&
- (entries[SubtypeTestCache::kFunctionTypeArguments] ==
- function_type_arguments)) {
- if (true_value == entries[SubtypeTestCache::kTestResult]) {
- goto AssertAssignableOk;
- } else {
- break;
- }
- }
- }
- }
-
- AssertAssignableCallRuntime:
- SP[1] = args[0]; // instance
- SP[2] = args[3]; // type
- SP[3] = args[1]; // instantiator type args
- SP[4] = args[2]; // function type args
- SP[5] = args[4]; // name
- SP[6] = cache;
- SP[7] = Smi::New(kTypeCheckFromInline);
- Exit(thread, FP, SP + 8, pc);
- NativeArguments native_args(thread, 7, SP + 1, SP - 4);
- INVOKE_RUNTIME(DRT_TypeCheck, native_args);
+ AssertAssignable(thread, pc, FP, SP, args, cache);
}
- AssertAssignableOk:
- SP -= 4;
+ SP -= 4; // Instance remains on stack.
DISPATCH();
}
diff --git a/runtime/vm/interpreter.h b/runtime/vm/interpreter.h
index 04b3caa..80621a4 100644
--- a/runtime/vm/interpreter.h
+++ b/runtime/vm/interpreter.h
@@ -24,6 +24,7 @@
class RawArray;
class RawObjectPool;
class RawFunction;
+class RawSubtypeTestCache;
class ObjectPointerVisitor;
// Interpreter intrinsic handler. It is invoked on entry to the intrinsified
@@ -62,11 +63,17 @@
// Call on program start.
static void InitOnce();
- RawObject* Call(const Code& code,
+ RawObject* Call(const Function& function,
const Array& arguments_descriptor,
const Array& arguments,
Thread* thread);
+ RawObject* Call(RawFunction* function,
+ RawArray* argdesc,
+ intptr_t argc,
+ RawObject* const* argv,
+ Thread* thread);
+
void JumpToFrame(uword pc, uword sp, uword fp, Thread* thread);
uword get_sp() const { return reinterpret_cast<uword>(fp_); } // Yes, fp_.
@@ -93,8 +100,6 @@
void VisitObjectPointers(ObjectPointerVisitor* visitor);
- bool IsTracing() const;
-
private:
uintptr_t* stack_;
uword stack_base_;
@@ -191,6 +196,13 @@
RawObject*** SP,
uint32_t** pc);
+ bool AssertAssignable(Thread* thread,
+ uint32_t* pc,
+ RawObject** FP,
+ RawObject** call_top,
+ RawObject** args,
+ RawSubtypeTestCache* cache);
+
#if defined(DEBUG)
// Returns true if tracing of executed instructions is enabled.
bool IsTracingExecution() const;
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 21ab5e0..7d73781 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -2606,8 +2606,9 @@
}
bool Isolate::IsVMInternalIsolate(Isolate* isolate) {
- return ((isolate == Dart::vm_isolate()) ||
- ServiceIsolate::IsServiceIsolateDescendant(isolate));
+ return (isolate == Dart::vm_isolate()) ||
+ ServiceIsolate::IsServiceIsolateDescendant(isolate) ||
+ KernelIsolate::IsKernelIsolate(isolate);
}
void Isolate::KillLocked(LibMsgId msg_id) {
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index ff73002..33d0316 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -527,11 +527,12 @@
static void AcceptCompilation(Thread* thread) {
TransitionVMToNative transition(thread);
- if (KernelIsolate::AcceptCompilation().status !=
- Dart_KernelCompilationStatus_Ok) {
- FATAL(
+ Dart_KernelCompilationResult result = KernelIsolate::AcceptCompilation();
+ if (result.status != Dart_KernelCompilationStatus_Ok) {
+ FATAL1(
"An error occurred in the CFE while accepting the most recent"
- " compilation results.");
+ " compilation results: %s",
+ result.error);
}
}
@@ -694,6 +695,12 @@
if (!tmp.IsError()) {
Library& lib = Library::Handle(thread->zone());
lib ^= tmp.raw();
+ // If main method disappeared or were not there to begin with then
+ // KernelLoader will return null. In this case lookup library by
+ // URL.
+ if (lib.IsNull()) {
+ lib = Library::LookupLibrary(thread, root_lib_url);
+ }
isolate()->object_store()->set_root_library(lib);
FinalizeLoading();
result = Object::null();
diff --git a/runtime/vm/isolate_reload_test.cc b/runtime/vm/isolate_reload_test.cc
index 71fbf0e..ce3536a 100644
--- a/runtime/vm/isolate_reload_test.cc
+++ b/runtime/vm/isolate_reload_test.cc
@@ -309,7 +309,7 @@
Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
if (TestCase::UsingDartFrontend()) {
- EXPECT_ERROR(result, "Expected ';' before this");
+ EXPECT_ERROR(result, "Expected ';' after this");
} else {
EXPECT_ERROR(result, "unexpected token");
}
@@ -2470,7 +2470,7 @@
lib = TestCase::ReloadTestScript(kReloadScript);
if (TestCase::UsingDartFrontend()) {
- EXPECT_ERROR(lib, "Expected ';' before this");
+ EXPECT_ERROR(lib, "Expected ';' after this");
} else {
EXPECT_ERROR(lib, "unexpected token");
}
diff --git a/runtime/vm/kernel.cc b/runtime/vm/kernel.cc
index 4fe6d44..bc5ad9c 100644
--- a/runtime/vm/kernel.cc
+++ b/runtime/vm/kernel.cc
@@ -3,11 +3,11 @@
// BSD-style license that can be found in the LICENSE file.
#include "vm/kernel.h"
-#include "vm/compiler/frontend/kernel_binary_flowgraph.h"
+#include "vm/compiler/frontend/kernel_translation_helper.h"
#if !defined(DART_PRECOMPILED_RUNTIME)
-namespace dart {
+namespace dart {
namespace kernel {
bool FieldHasFunctionLiteralInitializer(const Field& field,
@@ -19,106 +19,14 @@
TranslationHelper translation_helper(Thread::Current());
translation_helper.InitFromScript(script);
- StreamingFlowGraphBuilder builder(
- &translation_helper, Script::Handle(zone, field.Script()), zone,
- ExternalTypedData::Handle(zone, field.KernelData()),
- field.KernelDataProgramOffset(),
- /* active_class = */ NULL);
- builder.SetOffset(field.kernel_offset());
- kernel::FieldHelper field_helper(&builder);
- field_helper.ReadUntilExcluding(kernel::FieldHelper::kEnd, true);
- return field_helper.FieldHasFunctionLiteralInitializer(start, end);
-}
-
-uint32_t KernelSourceFingerprintHelper::CalculateClassFingerprint(
- const Class& klass) {
- Zone* zone = Thread::Current()->zone();
-
- // Handle typedefs.
- if (klass.IsTypedefClass()) {
- const Function& func = Function::Handle(zone, klass.signature_function());
- return CalculateFunctionFingerprint(func);
- }
-
- String& name = String::Handle(zone, klass.Name());
- const Array& fields = Array::Handle(zone, klass.fields());
- const Array& functions = Array::Handle(zone, klass.functions());
- const Array& interfaces = Array::Handle(zone, klass.interfaces());
- AbstractType& type = AbstractType::Handle(zone);
-
- uint32_t hash = 0;
- hash = KernelFingerprintHelper::CalculateHash(hash, name.Hash());
-
- type ^= klass.super_type();
- if (!type.IsNull()) {
- name ^= type.Name();
- hash = KernelFingerprintHelper::CalculateHash(hash, name.Hash());
- }
-
- type ^= klass.mixin();
- if (!type.IsNull()) {
- name ^= type.Name();
- hash = KernelFingerprintHelper::CalculateHash(hash, name.Hash());
- }
-
- Field& field = Field::Handle(zone);
- // Calculate fingerprint for the class fields.
- for (intptr_t i = 0; i < fields.Length(); ++i) {
- field ^= fields.At(i);
- uint32_t fingerprint = CalculateFieldFingerprint(field);
- hash = KernelFingerprintHelper::CalculateHash(hash, fingerprint);
- }
-
- // Calculate fingerprint for the class functions.
- Function& func = Function::Handle(zone);
- for (intptr_t i = 0; i < functions.Length(); ++i) {
- func ^= functions.At(i);
- uint32_t fingerprint = CalculateFunctionFingerprint(func);
- hash = KernelFingerprintHelper::CalculateHash(hash, fingerprint);
- }
-
- // Calculate fingerprint for the interfaces.
- for (intptr_t i = 0; i < interfaces.Length(); ++i) {
- type ^= interfaces.At(i);
- name ^= type.Name();
- hash = KernelFingerprintHelper::CalculateHash(hash, name.Hash());
- }
-
- return hash;
-}
-
-uint32_t KernelSourceFingerprintHelper::CalculateFieldFingerprint(
- const Field& field) {
- Thread* thread = Thread::Current();
- Zone* zone = thread->zone();
- const Script& script = Script::Handle(zone, field.Script());
-
- TranslationHelper translation_helper(thread);
- translation_helper.InitFromScript(script);
-
- KernelFingerprintHelper helper(
- zone, &translation_helper, script,
+ KernelReaderHelper kernel_reader_helper(
+ zone, &translation_helper, Script::Handle(zone, field.Script()),
ExternalTypedData::Handle(zone, field.KernelData()),
field.KernelDataProgramOffset());
- helper.SetOffset(field.kernel_offset());
- return helper.CalculateFieldFingerprint();
-}
-
-uint32_t KernelSourceFingerprintHelper::CalculateFunctionFingerprint(
- const Function& func) {
- Thread* thread = Thread::Current();
- Zone* zone = thread->zone();
- const Script& script = Script::Handle(zone, func.script());
-
- TranslationHelper translation_helper(thread);
- translation_helper.InitFromScript(script);
-
- KernelFingerprintHelper helper(
- zone, &translation_helper, script,
- ExternalTypedData::Handle(zone, func.KernelData()),
- func.KernelDataProgramOffset());
- helper.SetOffset(func.kernel_offset());
- return helper.CalculateFunctionFingerprint();
+ kernel_reader_helper.SetOffset(field.kernel_offset());
+ kernel::FieldHelper field_helper(&kernel_reader_helper);
+ field_helper.ReadUntilExcluding(kernel::FieldHelper::kEnd, true);
+ return field_helper.FieldHasFunctionLiteralInitializer(start, end);
}
KernelLineStartsReader::KernelLineStartsReader(
diff --git a/runtime/vm/kernel.h b/runtime/vm/kernel.h
index 5bcf919..29fb267 100644
--- a/runtime/vm/kernel.h
+++ b/runtime/vm/kernel.h
@@ -114,13 +114,6 @@
DISALLOW_COPY_AND_ASSIGN(Program);
};
-class KernelSourceFingerprintHelper {
- public:
- static uint32_t CalculateClassFingerprint(const Class& klass);
- static uint32_t CalculateFieldFingerprint(const Field& field);
- static uint32_t CalculateFunctionFingerprint(const Function& func);
-};
-
class KernelLineStartsReader {
public:
KernelLineStartsReader(const dart::TypedData& line_starts_data,
diff --git a/runtime/vm/kernel_binary.cc b/runtime/vm/kernel_binary.cc
index 17128ce..0f6769d 100644
--- a/runtime/vm/kernel_binary.cc
+++ b/runtime/vm/kernel_binary.cc
@@ -124,11 +124,11 @@
}
kernel::Program* kernel_program = NULL;
{
+ const String& uri = String::Handle(String::New(script_uri));
TransitionVMToNative transition(thread);
Api::Scope api_scope(thread);
Dart_Handle retval = (thread->isolate()->library_tag_handler())(
- Dart_kKernelTag, Api::Null(),
- Api::NewHandle(thread, String::New(script_uri)));
+ Dart_kKernelTag, Api::Null(), Api::NewHandle(thread, uri.raw()));
if (!Dart_IsError(retval)) {
Dart_TypedData_Type data_type;
uint8_t* data;
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index 58ae9ca..ace2340 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -417,6 +417,8 @@
const uint8_t* saved_raw_buffer_;
const ExternalTypedData* saved_typed_data_;
intptr_t saved_offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(AlternativeReadingScope);
};
// A helper class that resets the readers min and max positions both upon
@@ -446,6 +448,8 @@
Reader* reader_;
TokenPosition min_;
TokenPosition max_;
+
+ DISALLOW_COPY_AND_ASSIGN(PositionScope);
};
} // namespace kernel
diff --git a/runtime/vm/kernel_isolate.cc b/runtime/vm/kernel_isolate.cc
index a841629..bbfeb3d 100644
--- a/runtime/vm/kernel_isolate.cc
+++ b/runtime/vm/kernel_isolate.cc
@@ -25,16 +25,10 @@
namespace dart {
-#if !defined(DART_PRECOMPILED_RUNTIME)
-
#define Z (T->zone())
DEFINE_FLAG(bool, trace_kernel, false, "Trace Kernel service requests.");
DEFINE_FLAG(bool,
- show_kernel_isolate,
- false,
- "Show Kernel service isolate as normal isolate.");
-DEFINE_FLAG(bool,
suppress_fe_warnings,
false,
"Suppress warnings from the FE.");
@@ -237,6 +231,16 @@
Dart::thread_pool()->Run(new RunKernelTask());
}
+void KernelIsolate::Shutdown() {
+ Isolate::KillIfExists(isolate_, Isolate::kInternalKillMsg);
+ {
+ MonitorLocker ml(monitor_);
+ while (isolate_ != NULL) {
+ ml.Wait();
+ }
+ }
+}
+
void KernelIsolate::InitCallback(Isolate* I) {
Thread* T = Thread::Current();
ASSERT(I == T->isolate());
@@ -279,11 +283,13 @@
isolate->set_is_kernel_isolate(true);
}
isolate_ = isolate;
+ ml.NotifyAll();
}
void KernelIsolate::SetLoadPort(Dart_Port port) {
MonitorLocker ml(monitor_);
kernel_port_ = port;
+ ml.NotifyAll();
}
void KernelIsolate::FinishedInitializing() {
@@ -864,6 +870,4 @@
Dart_PostCObject(kernel_port, &message);
}
-#endif // DART_PRECOMPILED_RUNTIME
-
} // namespace dart
diff --git a/runtime/vm/kernel_isolate.h b/runtime/vm/kernel_isolate.h
index 3de2d9a..aaadeaf 100644
--- a/runtime/vm/kernel_isolate.h
+++ b/runtime/vm/kernel_isolate.h
@@ -5,8 +5,6 @@
#ifndef RUNTIME_VM_KERNEL_ISOLATE_H_
#define RUNTIME_VM_KERNEL_ISOLATE_H_
-#if !defined(DART_PRECOMPILED_RUNTIME)
-
#include "include/dart_api.h"
#include "include/dart_native_api.h"
@@ -30,6 +28,7 @@
static const int kNotifyIsolateShutdown;
static void Run();
+ static void Shutdown();
static bool NameEquals(const char* name);
static bool Exists();
@@ -89,6 +88,4 @@
} // namespace dart
-#endif // DART_PRECOMPILED_RUNTIME
-
#endif // RUNTIME_VM_KERNEL_ISOLATE_H_
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index 31148a0..60905db 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -32,21 +32,21 @@
class SimpleExpressionConverter {
public:
- SimpleExpressionConverter(TranslationHelper* helper,
- StreamingFlowGraphBuilder* builder)
- : translation_helper_(*helper),
+ SimpleExpressionConverter(TranslationHelper* translation_helper,
+ KernelReaderHelper* reader_helper)
+ : translation_helper_(*translation_helper),
zone_(translation_helper_.zone()),
simple_value_(NULL),
- builder_(builder) {}
+ helper_(reader_helper) {}
bool IsSimple(intptr_t kernel_offset) {
- AlternativeReadingScope alt(&builder_->reader_, kernel_offset);
+ AlternativeReadingScope alt(&helper_->reader_, kernel_offset);
uint8_t payload = 0;
- Tag tag = builder_->ReadTag(&payload); // read tag.
+ Tag tag = helper_->ReadTag(&payload); // read tag.
switch (tag) {
case kBigIntLiteral: {
const String& literal_str =
- H.DartString(builder_->ReadStringReference(),
+ H.DartString(helper_->ReadStringReference(),
Heap::kOld); // read index into string table.
simple_value_ = &Integer::ZoneHandle(Z, Integer::New(literal_str));
if (simple_value_->IsNull()) {
@@ -59,7 +59,7 @@
}
case kStringLiteral:
simple_value_ = &H.DartSymbolPlain(
- builder_->ReadStringReference()); // read index into string table.
+ helper_->ReadStringReference()); // read index into string table.
return true;
case kSpecializedIntLiteral:
simple_value_ =
@@ -70,19 +70,19 @@
return true;
case kNegativeIntLiteral:
simple_value_ = &Integer::ZoneHandle(
- Z, Integer::New(-static_cast<int64_t>(builder_->ReadUInt()),
+ Z, Integer::New(-static_cast<int64_t>(helper_->ReadUInt()),
Heap::kOld)); // read value.
*simple_value_ = H.Canonicalize(*simple_value_);
return true;
case kPositiveIntLiteral:
simple_value_ = &Integer::ZoneHandle(
- Z, Integer::New(static_cast<int64_t>(builder_->ReadUInt()),
+ Z, Integer::New(static_cast<int64_t>(helper_->ReadUInt()),
Heap::kOld)); // read value.
*simple_value_ = H.Canonicalize(*simple_value_);
return true;
case kDoubleLiteral:
simple_value_ = &Double::ZoneHandle(
- Z, Double::New(builder_->ReadDouble(), Heap::kOld)); // read value.
+ Z, Double::New(helper_->ReadDouble(), Heap::kOld)); // read value.
*simple_value_ = H.Canonicalize(*simple_value_);
return true;
case kTrueLiteral:
@@ -106,7 +106,9 @@
TranslationHelper& translation_helper_;
Zone* zone_;
Instance* simple_value_;
- StreamingFlowGraphBuilder* builder_;
+ KernelReaderHelper* helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(SimpleExpressionConverter);
};
RawArray* KernelLoader::MakeFunctionsArray() {
@@ -368,8 +370,8 @@
true /* finalize */);
ASSERT(type_translator_.active_class_ == &active_class_);
- ConstantHelper helper(&active_class_, &builder_, &type_translator_,
- &translation_helper_, Z, skip_vmservice_library_);
+ ConstantHelper helper(Z, &builder_, &type_translator_, &active_class_,
+ skip_vmservice_library_);
return helper.ReadConstantTable();
}
diff --git a/runtime/vm/kernel_loader.h b/runtime/vm/kernel_loader.h
index bc41510..329fc72 100644
--- a/runtime/vm/kernel_loader.h
+++ b/runtime/vm/kernel_loader.h
@@ -29,6 +29,8 @@
private:
KernelLoader* loader_;
+
+ DISALLOW_COPY_AND_ASSIGN(BuildingTranslationHelper);
};
template <typename VmType>
@@ -318,6 +320,8 @@
GrowableArray<const Function*> functions_;
GrowableArray<const Field*> fields_;
+
+ DISALLOW_COPY_AND_ASSIGN(KernelLoader);
};
} // namespace kernel
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index cfdfcbc..057eff5 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -13,8 +13,9 @@
#include "vm/compiler/aot/precompiler.h"
#include "vm/compiler/assembler/assembler.h"
#include "vm/compiler/assembler/disassembler.h"
-#include "vm/compiler/frontend/kernel_binary_flowgraph.h"
+#include "vm/compiler/frontend/kernel_fingerprints.h"
#include "vm/compiler/frontend/kernel_to_il.h"
+#include "vm/compiler/frontend/kernel_translation_helper.h"
#include "vm/compiler/intrinsifier.h"
#include "vm/compiler/jit/compiler.h"
#include "vm/compiler_stats.h"
@@ -3809,12 +3810,13 @@
ASSERT(library_kernel_offset > 0);
const intptr_t class_offset = kernel_offset();
- kernel::TranslationHelper helper(thread);
- helper.InitFromScript(scr);
- kernel::StreamingFlowGraphBuilder builder_(&helper, scr, zone, kernel_data,
- 0, /* active_class = */ NULL);
- builder_.SetOffset(class_offset);
- kernel::ClassHelper class_helper(&builder_);
+ kernel::TranslationHelper translation_helper(thread);
+ translation_helper.InitFromScript(scr);
+
+ kernel::KernelReaderHelper kernel_reader_helper(zone, &translation_helper,
+ scr, kernel_data, 0);
+ kernel_reader_helper.SetOffset(class_offset);
+ kernel::ClassHelper class_helper(&kernel_reader_helper);
class_helper.ReadUntilIncluding(kernel::ClassHelper::kEndPosition);
if (class_helper.end_position_.IsReal()) return class_helper.end_position_;
@@ -7423,27 +7425,27 @@
if (thread->isolate()->strong() && !is_static() && kernel_offset() > 0) {
const Script& function_script = Script::Handle(zone, script());
kernel::TranslationHelper translation_helper(thread);
- kernel::StreamingFlowGraphBuilder builder(
- &translation_helper, function_script, zone,
- ExternalTypedData::Handle(zone, KernelData()),
- KernelDataProgramOffset(),
- /* active_class = */ NULL);
translation_helper.InitFromScript(function_script);
- builder.SetOffset(kernel_offset());
- builder.ReadUntilFunctionNode();
+ kernel::KernelReaderHelper kernel_reader_helper(
+ zone, &translation_helper, function_script,
+ ExternalTypedData::Handle(zone, KernelData()),
+ KernelDataProgramOffset());
- kernel::FunctionNodeHelper fn_helper(&builder);
+ kernel_reader_helper.SetOffset(kernel_offset());
+ kernel_reader_helper.ReadUntilFunctionNode();
+
+ kernel::FunctionNodeHelper fn_helper(&kernel_reader_helper);
// Check the positional parameters, including the optional positional ones.
fn_helper.ReadUntilExcluding(
kernel::FunctionNodeHelper::kPositionalParameters);
- intptr_t num_pos_params = builder.ReadListLength();
+ intptr_t num_pos_params = kernel_reader_helper.ReadListLength();
ASSERT(num_pos_params ==
num_fixed_params - 1 + (has_opt_pos_params ? num_opt_params : 0));
const Type& object_type = Type::Handle(zone, Type::ObjectType());
for (intptr_t i = 0; i < num_pos_params; ++i) {
- kernel::VariableDeclarationHelper var_helper(&builder);
+ kernel::VariableDeclarationHelper var_helper(&kernel_reader_helper);
var_helper.ReadUntilExcluding(kernel::VariableDeclarationHelper::kEnd);
if (var_helper.IsCovariant() || var_helper.IsGenericCovariantImpl()) {
closure_function.SetParameterTypeAt(i + 1, object_type);
@@ -7453,10 +7455,10 @@
// Check the optional named parameters.
fn_helper.ReadUntilExcluding(kernel::FunctionNodeHelper::kNamedParameters);
- intptr_t num_named_params = builder.ReadListLength();
+ intptr_t num_named_params = kernel_reader_helper.ReadListLength();
ASSERT(num_named_params == (has_opt_pos_params ? 0 : num_opt_params));
for (intptr_t i = 0; i < num_named_params; ++i) {
- kernel::VariableDeclarationHelper var_helper(&builder);
+ kernel::VariableDeclarationHelper var_helper(&kernel_reader_helper);
var_helper.ReadUntilExcluding(kernel::VariableDeclarationHelper::kEnd);
if (var_helper.IsCovariant() || var_helper.IsGenericCovariantImpl()) {
closure_function.SetParameterTypeAt(num_pos_params + 1 + i,
@@ -8314,7 +8316,11 @@
RawExternalTypedData* Field::KernelData() const {
const Object& obj = Object::Handle(this->raw_ptr()->owner_);
- if (obj.IsClass()) {
+ // During background JIT compilation field objects are copied
+ // and copy points to the original field via the owner field.
+ if (obj.IsField()) {
+ return Field::Cast(obj).KernelData();
+ } else if (obj.IsClass()) {
Library& library = Library::Handle(Class::Cast(obj).library());
return library.kernel_data();
}
@@ -8324,7 +8330,11 @@
intptr_t Field::KernelDataProgramOffset() const {
const Object& obj = Object::Handle(raw_ptr()->owner_);
- if (obj.IsClass()) {
+ // During background JIT compilation field objects are copied
+ // and copy points to the original field via the owner field.
+ if (obj.IsField()) {
+ return Field::Cast(obj).KernelDataProgramOffset();
+ } else if (obj.IsClass()) {
Library& lib = Library::Handle(Class::Cast(obj).library());
return lib.kernel_offset();
}
@@ -8332,6 +8342,27 @@
return PatchClass::Cast(obj).library_kernel_offset();
}
+#if !defined(DART_PRECOMPILED_RUNTIME)
+void Field::GetCovarianceAttributes(bool* is_covariant,
+ bool* is_generic_covariant) const {
+ Thread* thread = Thread::Current();
+ Zone* zone = Thread::Current()->zone();
+ auto& script = Script::Handle(zone, Script());
+
+ kernel::TranslationHelper translation_helper(thread);
+ translation_helper.InitFromScript(script);
+
+ kernel::KernelReaderHelper kernel_reader_helper(
+ zone, &translation_helper, script,
+ ExternalTypedData::Handle(zone, KernelData()), KernelDataProgramOffset());
+ kernel_reader_helper.SetOffset(kernel_offset());
+ kernel::FieldHelper field_helper(&kernel_reader_helper);
+ field_helper.ReadUntilIncluding(kernel::FieldHelper::kFlags);
+ *is_covariant = field_helper.IsCovariant();
+ *is_generic_covariant = field_helper.IsGenericCovariantImpl();
+}
+#endif
+
// Called at finalization time
void Field::SetFieldType(const AbstractType& value) const {
ASSERT(Thread::Current()->IsMutatorThread());
@@ -15025,8 +15056,6 @@
code.SetPrologueOffset(bytecode_size); // TODO(regis): Correct?
INC_STAT(Thread::Current(), total_code_size,
code.comments().comments_.Length());
- // TODO(regis): Until we support exception handling.
- code.set_exception_handlers(Object::empty_exception_handlers());
return code.raw();
}
#endif // defined(DART_USE_INTERPRETER)
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index ff768b4..3a1b5cb 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -3177,6 +3177,11 @@
intptr_t KernelDataProgramOffset() const;
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ void GetCovarianceAttributes(bool* is_covariant,
+ bool* is_generic_covariant) const;
+#endif
+
inline intptr_t Offset() const;
// Called during class finalization.
inline void SetOffset(intptr_t offset_in_bytes) const;
@@ -7988,6 +7993,7 @@
FINAL_HEAP_OBJECT_IMPLEMENTATION(Array, Instance);
friend class Class;
friend class ImmutableArray;
+ friend class Interpreter;
friend class Object;
friend class String;
};
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
index e97f30c..24a67c7 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -16,7 +16,7 @@
#include <fuchsia/timezone/cpp/fidl.h>
-#include "lib/app/cpp/environment_services.h"
+#include "lib/component/cpp/environment_services.h"
#include "platform/assert.h"
#include "vm/zone.h"
@@ -43,13 +43,13 @@
static zx_status_t GetLocalAndDstOffsetInSeconds(int64_t seconds_since_epoch,
int32_t* local_offset,
int32_t* dst_offset) {
- fuchsia::timezone::TimezoneSync2Ptr tz;
- fuchsia::sys::ConnectToEnvironmentService(tz.NewRequest());
+ fuchsia::timezone::TimezoneSyncPtr tz;
+ component::ConnectToEnvironmentService(tz.NewRequest());
zx_status_t status = tz->GetTimezoneOffsetMinutes(seconds_since_epoch * 1000,
- local_offset,
- dst_offset).statvs;
- if (status != ZX_OK)
+ local_offset, dst_offset);
+ if (status != ZX_OK) {
return status;
+ }
*local_offset *= 60;
*dst_offset *= 60;
return ZX_OK;
@@ -59,7 +59,7 @@
// TODO(abarth): Handle time zone changes.
static const auto* tz_name = new std::string([] {
fuchsia::timezone::TimezoneSyncPtr tz;
- fuchsia::sys::ConnectToEnvironmentService(tz.NewRequest());
+ component::ConnectToEnvironmentService(tz.NewRequest());
fidl::StringPtr result;
tz->GetTimezoneId(&result);
return *result;
diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc
index 5b62d16..125dabf 100644
--- a/runtime/vm/os_thread.cc
+++ b/runtime/vm/os_thread.cc
@@ -19,6 +19,10 @@
Mutex* OSThread::thread_list_lock_ = NULL;
bool OSThread::creation_enabled_ = false;
+#if defined(HAS_C11_THREAD_LOCAL)
+thread_local Thread* OSThread::current_vm_thread_ = NULL;
+#endif
+
OSThread::OSThread()
: BaseThread(true),
id_(OSThread::GetCurrentThreadId()),
@@ -269,8 +273,18 @@
}
}
-void OSThread::SetCurrent(OSThread* current) {
- OSThread::SetThreadLocal(thread_key_, reinterpret_cast<uword>(current));
+void OSThread::SetCurrentTLS(BaseThread* value) {
+ // Provides thread-local destructors.
+ SetThreadLocal(thread_key_, reinterpret_cast<uword>(value));
+
+#if defined(HAS_C11_THREAD_LOCAL)
+ // Allows the C compiler more freedom to optimize.
+ if ((value != NULL) && !value->is_os_thread()) {
+ current_vm_thread_ = static_cast<Thread*>(value);
+ } else {
+ current_vm_thread_ = NULL;
+ }
+#endif
}
OSThreadIterator::OSThreadIterator() {
diff --git a/runtime/vm/os_thread.h b/runtime/vm/os_thread.h
index cdf3985..baad4af 100644
--- a/runtime/vm/os_thread.h
+++ b/runtime/vm/os_thread.h
@@ -11,6 +11,10 @@
#include "vm/allocation.h"
#include "vm/globals.h"
+#if !HOST_OS_IOS
+#define HAS_C11_THREAD_LOCAL 1
+#endif
+
// Declare the OS-specific types ahead of defining the generic classes.
#if defined(HOST_OS_ANDROID)
#include "vm/os_thread_android.h"
@@ -154,7 +158,11 @@
}
return os_thread;
}
- static void SetCurrent(OSThread* current);
+ static void SetCurrent(OSThread* current) { SetCurrentTLS(current); }
+
+#if defined(HAS_C11_THREAD_LOCAL)
+ static Thread* CurrentVMThread() { return current_vm_thread_; }
+#endif
// TODO(5411455): Use flag to override default value and Validate the
// stack size by querying OS.
@@ -166,7 +174,7 @@
static BaseThread* GetCurrentTLS() {
return reinterpret_cast<BaseThread*>(OSThread::GetThreadLocal(thread_key_));
}
- static void SetCurrentTLS(uword value) { SetThreadLocal(thread_key_, value); }
+ static void SetCurrentTLS(BaseThread* value);
typedef void (*ThreadStartFunction)(uword parameter);
typedef void (*ThreadDestructor)(void* parameter);
@@ -265,6 +273,10 @@
static OSThread* thread_list_head_;
static bool creation_enabled_;
+#if defined(HAS_C11_THREAD_LOCAL)
+ static thread_local Thread* current_vm_thread_;
+#endif
+
friend class Isolate; // to access set_thread(Thread*).
friend class OSThreadIterator;
friend class ThreadInterrupterWin;
diff --git a/runtime/vm/os_thread_win.cc b/runtime/vm/os_thread_win.cc
index 82198e2..6fef2cd 100644
--- a/runtime/vm/os_thread_win.cc
+++ b/runtime/vm/os_thread_win.cc
@@ -604,7 +604,12 @@
// This function is executed on the thread that is exiting. It is invoked
// by |OnDartThreadExit| (see below for notes on TLS destructors on Windows).
void ThreadLocalData::RunDestructors() {
- ASSERT(thread_locals_ != NULL);
+ // If an OS thread is created but ThreadLocalData::InitOnce has not yet been
+ // called, this method still runs. If this happens, there's nothing to clean
+ // up here. See issue 33826.
+ if (thread_locals_ == NULL) {
+ return;
+ }
ASSERT(mutex_ != NULL);
MutexLocker ml(mutex_, false);
for (intptr_t i = 0; i < thread_locals_->length(); i++) {
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 3e0d919..9632e50 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -14,7 +14,7 @@
#include "vm/class_finalizer.h"
#include "vm/compiler/aot/precompiler.h"
#include "vm/compiler/backend/il_printer.h"
-#include "vm/compiler/frontend/kernel_binary_flowgraph.h"
+#include "vm/compiler/frontend/scope_builder.h"
#include "vm/compiler/jit/compiler.h"
#include "vm/compiler_stats.h"
#include "vm/dart_api_impl.h"
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index b298c05..0ebea7e 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -794,6 +794,15 @@
if (should_update_cache) {
if (cache.IsNull()) {
+#if defined(DART_USE_INTERPRETER)
+ // TODO(regis): Remove this workaround once the interpreter can provide a
+ // non-null cache for the type test in an implicit setter.
+ if (mode == kTypeCheckFromInline) {
+ arguments.SetReturn(src_instance);
+ return;
+ }
+#endif // defined(DART_USE_INTERPRETER)
+
#if !defined(TARGET_ARCH_DBC) && !defined(TARGET_ARCH_IA32)
ASSERT(mode == kTypeCheckFromSlowStub);
// We lazily create [SubtypeTestCache] for those call sites which actually
@@ -1737,57 +1746,6 @@
arguments.SetReturn(result);
}
-// Interpret a function call. Should be called only for uncompiled functions.
-// Arg0: function object
-// Arg1: ICData or MegamorphicCache
-// Arg2: arguments descriptor array
-// Arg3: arguments array
-DEFINE_RUNTIME_ENTRY(InterpretCall, 4) {
-#if defined(DART_USE_INTERPRETER)
- const Function& function = Function::CheckedHandle(zone, arguments.ArgAt(0));
- // TODO(regis): Use icdata.
- // const Object& ic_data_or_cache = Object::Handle(zone, arguments.ArgAt(1));
- const Array& orig_arguments_desc =
- Array::CheckedHandle(zone, arguments.ArgAt(2));
- const Array& orig_arguments = Array::CheckedHandle(zone, arguments.ArgAt(3));
- ASSERT(!function.HasCode());
- ASSERT(function.HasBytecode());
- const Code& bytecode = Code::Handle(zone, function.Bytecode());
- Object& result = Object::Handle(zone);
- Interpreter* interpreter = Interpreter::Current();
-#if defined(DEBUG)
- uword exit_fp = thread->top_exit_frame_info();
- ASSERT(exit_fp != 0);
- if (interpreter->IsTracing()) {
- THR_Print("Interpreting call to %s exit 0x%" Px "\n", function.ToCString(),
- exit_fp);
- }
-#endif
- ASSERT(interpreter != NULL);
- {
- TransitionToGenerated transition(thread);
- result = interpreter->Call(bytecode, orig_arguments_desc, orig_arguments,
- thread);
- }
-#if defined(DEBUG)
- ASSERT(thread->top_exit_frame_info() == exit_fp);
- if (interpreter->IsTracing()) {
- THR_Print("Returning from interpreted function %s\n", function.ToCString());
- }
-#endif
- if (result.IsError()) {
- if (result.IsLanguageError()) {
- Exceptions::ThrowCompileTimeError(LanguageError::Cast(result));
- UNREACHABLE();
- }
- Exceptions::PropagateError(Error::Cast(result));
- }
- arguments.SetReturn(result);
-#else
- UNREACHABLE();
-#endif // defined(DART_USE_INTERPRETER)
-}
-
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
// The following code is used to stress test
// - deoptimization
@@ -1863,8 +1821,37 @@
JSONStream js;
// Maybe adjust the rate of future reloads.
isolate->MaybeIncreaseReloadEveryNStackOverflowChecks();
+
+ const char* script_uri;
+ {
+ NoReloadScope no_reload(isolate, thread);
+ const Library& lib =
+ Library::Handle(isolate->object_store()->_internal_library());
+ const Class& cls = Class::Handle(
+ lib.LookupClass(String::Handle(String::New("VMLibraryHooks"))));
+ const Function& func = Function::Handle(cls.LookupFunction(
+ String::Handle(String::New("get:platformScript"))));
+ Object& result = Object::Handle(
+ DartEntry::InvokeFunction(func, Object::empty_array()));
+ if (result.IsUnwindError()) {
+ Exceptions::PropagateError(Error::Cast(result));
+ }
+ if (!result.IsInstance()) {
+ FATAL1("Bad script uri hook: %s", result.ToCString());
+ }
+ result = DartLibraryCalls::ToString(Instance::Cast(result));
+ if (result.IsUnwindError()) {
+ Exceptions::PropagateError(Error::Cast(result));
+ }
+ if (!result.IsString()) {
+ FATAL1("Bad script uri hook: %s", result.ToCString());
+ }
+ script_uri = result.ToCString(); // Zone allocated.
+ }
+
// Issue a reload.
- bool success = isolate->ReloadSources(&js, true /* force_reload */);
+ bool success =
+ isolate->ReloadSources(&js, true /* force_reload */, script_uri);
if (!success) {
FATAL1("*** Isolate reload failed:\n%s\n", js.ToCString());
}
@@ -2610,4 +2597,36 @@
true /* is_float */,
reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&atan)));
+uword RuntimeEntry::InterpretCallEntry() {
+ return reinterpret_cast<uword>(RuntimeEntry::InterpretCall);
+}
+
+// Interpret a function call. Should be called only for uncompiled functions.
+// argc indicates the number of arguments, including the type arguments.
+// argv points to the first argument.
+// If argc < 0, arguments are passed at decreasing memory addresses from argv.
+RawObject* RuntimeEntry::InterpretCall(RawFunction* function,
+ RawArray* argdesc,
+ intptr_t argc,
+ RawObject** argv,
+ Thread* thread) {
+#if defined(DART_USE_INTERPRETER)
+ RawObject* result;
+ Interpreter* interpreter = Interpreter::Current();
+#if defined(DEBUG)
+ uword exit_fp = thread->top_exit_frame_info();
+ ASSERT(exit_fp != 0);
+ ASSERT(thread == Thread::Current());
+ ASSERT(!Function::HasCode(function));
+ ASSERT(Function::HasBytecode(function));
+ ASSERT(interpreter != NULL);
+#endif
+ result = interpreter->Call(function, argdesc, argc, argv, thread);
+ DEBUG_ASSERT(thread->top_exit_frame_info() == exit_fp);
+ return result;
+#else
+ UNREACHABLE();
+#endif // defined(DART_USE_INTERPRETER)
+}
+
} // namespace dart
diff --git a/runtime/vm/runtime_entry.h b/runtime/vm/runtime_entry.h
index 4dd4935..b337cea 100644
--- a/runtime/vm/runtime_entry.h
+++ b/runtime/vm/runtime_entry.h
@@ -67,6 +67,13 @@
static inline uword AddressFromId(RuntimeFunctionId id);
static inline RuntimeFunctionId RuntimeFunctionIdFromAddress(uword address);
+ static uword InterpretCallEntry();
+ static RawObject* InterpretCall(RawFunction* function,
+ RawArray* argdesc,
+ intptr_t argc,
+ RawObject** argv,
+ Thread* thread);
+
private:
const char* name_;
const RuntimeFunction function_;
diff --git a/runtime/vm/runtime_entry_list.h b/runtime/vm/runtime_entry_list.h
index 65c2c0a..3234c88 100644
--- a/runtime/vm/runtime_entry_list.h
+++ b/runtime/vm/runtime_entry_list.h
@@ -46,7 +46,6 @@
V(UpdateFieldCid) \
V(InitStaticField) \
V(CompileFunction) \
- V(InterpretCall) \
V(MonomorphicMiss) \
V(SingleTargetMiss) \
V(UnlinkedCall)
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index fc90307..85d37ee 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -63,8 +63,6 @@
"Print a message when an isolate is paused but there is no "
"debugger attached.");
-DECLARE_FLAG(bool, show_kernel_isolate);
-
#ifndef PRODUCT
// The name of this of this vm as reported by the VM service protocol.
static char* vm_name = NULL;
@@ -4305,12 +4303,7 @@
virtual ~ServiceIsolateVisitor() {}
void VisitIsolate(Isolate* isolate) {
- bool is_kernel_isolate = false;
-#ifndef DART_PRECOMPILED_RUNTIME
- is_kernel_isolate =
- KernelIsolate::IsKernelIsolate(isolate) && !FLAG_show_kernel_isolate;
-#endif
- if (!IsVMInternalIsolate(isolate) && !is_kernel_isolate) {
+ if (!IsVMInternalIsolate(isolate)) {
jsarr_->AddValue(isolate);
}
}
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index 555fb3a..e221091 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -1762,17 +1762,13 @@
}
// Stub for compiling a function and jumping to the compiled code.
-// R9: IC-Data (for methods).
// R4: Arguments descriptor.
// R0: Function.
void StubCode::GenerateLazyCompileStub(Assembler* assembler) {
- // Preserve arg desc. and IC data object.
__ EnterStubFrame();
- __ PushList((1 << R4) | (1 << R9));
- __ Push(R0); // Pass function.
+ __ PushList((1 << R0) | (1 << R4)); // Preserve arg desc, pass function.
__ CallRuntime(kCompileFunctionRuntimeEntry, 1);
- __ Pop(R0); // Restore argument.
- __ PopList((1 << R4) | (1 << R9)); // Restore arg desc. and IC data.
+ __ PopList((1 << R0) | (1 << R4));
__ LeaveStubFrame();
// When using the interpreter, the function's code may now point to the
diff --git a/runtime/vm/stub_code_arm64.cc b/runtime/vm/stub_code_arm64.cc
index fceea40..dcd5ee1 100644
--- a/runtime/vm/stub_code_arm64.cc
+++ b/runtime/vm/stub_code_arm64.cc
@@ -1930,19 +1930,16 @@
}
// Stub for compiling a function and jumping to the compiled code.
-// R5: IC-Data (for methods).
// R4: Arguments descriptor.
// R0: Function.
void StubCode::GenerateLazyCompileStub(Assembler* assembler) {
- // Preserve arg desc. and IC data object.
+ // Preserve arg desc.
__ EnterStubFrame();
- __ Push(R5); // Save IC Data.
__ Push(R4); // Save arg. desc.
__ Push(R0); // Pass function.
__ CallRuntime(kCompileFunctionRuntimeEntry, 1);
__ Pop(R0); // Restore argument.
__ Pop(R4); // Restore arg desc.
- __ Pop(R5); // Restore IC Data.
__ LeaveStubFrame();
// When using the interpreter, the function's code may now point to the
@@ -1953,15 +1950,10 @@
}
// Stub for interpreting a function call.
-// R5: IC-Data (for methods).
// R4: Arguments descriptor.
// R0: Function.
void StubCode::GenerateInterpretCallStub(Assembler* assembler) {
#if defined(DART_USE_INTERPRETER)
- const intptr_t thread_offset = NativeArguments::thread_offset();
- const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
- const intptr_t argv_offset = NativeArguments::argv_offset();
- const intptr_t retval_offset = NativeArguments::retval_offset();
__ SetPrologueOffset();
__ EnterStubFrame();
@@ -1978,60 +1970,37 @@
}
#endif
- // Setup space on stack for result of the interpreted function call.
- __ Push(ZR);
+ // Adjust arguments count for type arguments vector.
+ __ LoadFieldFromOffset(R2, R4, ArgumentsDescriptor::count_offset());
+ __ SmiUntag(R2);
+ __ LoadFieldFromOffset(R1, R4, ArgumentsDescriptor::type_args_len_offset());
+ __ cmp(R1, Operand(0));
+ __ csinc(R2, R2, R2, EQ); // R2 <- (R1 == 0) ? R2 : R2 + 1.
- // Set callee-saved R23 to point to return value slot.
- __ mov(R23, SP);
+ // Compute argv.
+ __ add(R3, ZR, Operand(R2, LSL, 3));
+ __ add(R3, FP, Operand(R3));
+ __ AddImmediate(R3, kParamEndSlotFromFp * kWordSize);
- // Push first 3 arguments of the interpreted function call.
- __ Push(R0); // Function.
- __ Push(R5); // ICData/MegamorphicCache.
- __ Push(R4); // Arguments descriptor array.
+ // Indicate decreasing memory addresses of arguments with negative argc.
+ __ neg(R2, R2);
- // Adjust arguments count.
- __ LoadFieldFromOffset(R3, R4, ArgumentsDescriptor::type_args_len_offset());
- __ AddImmediate(TMP, R2, 1); // Include the type arguments.
- __ cmp(R3, Operand(0));
- __ csinc(R2, R2, TMP, EQ); // R2 <- (R3 == 0) ? R2 : TMP + 1 (R2 : R2 + 2).
+ // Align frame before entering C++ world. No shadow stack space required.
+ __ ReserveAlignedFrameSpace(0 * kWordSize);
- // Push 4th Dart argument of the interpreted function call.
- // R2: Smi-tagged arguments array length.
- PushArrayOfArguments(assembler); // May call into the runtime.
- const intptr_t kNumArgs = 4;
-
- // Reserve space for arguments and align frame before entering C++ world.
- // NativeArguments are passed in registers.
- ASSERT(sizeof(NativeArguments) == 4 * kWordSize);
- __ ReserveAlignedFrameSpace(sizeof(NativeArguments));
-
- // Pass NativeArguments structure by value and call runtime.
- // Registers R0, R1, R2, and R3 are used.
-
- ASSERT(thread_offset == 0 * kWordSize);
- __ mov(R0, THR); // Set thread in NativeArgs.
-
- ASSERT(argc_tag_offset == 1 * kWordSize);
- __ LoadImmediate(R1, kNumArgs); // Set argc in NativeArguments.
-
- ASSERT(argv_offset == 2 * kWordSize);
- __ AddImmediate(R2, R23, -kWordSize); // Set argv in NativeArguments.
-
- ASSERT(retval_offset == 3 * kWordSize);
- __ mov(R3, R23); // Set retval in NativeArguments.
-
- __ StoreToOffset(R0, SP, thread_offset);
- __ StoreToOffset(R1, SP, argc_tag_offset);
- __ StoreToOffset(R2, SP, argv_offset);
- __ StoreToOffset(R3, SP, retval_offset);
- __ mov(R0, SP); // Pass the pointer to the NativeArguments.
+ // Pass arguments in registers.
+ // R0: Function.
+ __ mov(R1, R4); // Arguments descriptor.
+ // R2: Negative argc.
+ // R3: Argv.
+ __ mov(R4, THR); // Thread.
// Save exit frame information to enable stack walking as we are about
// to transition to Dart VM C++ code.
__ StoreToOffset(FP, THR, Thread::top_exit_frame_info_offset());
// Mark that the thread is executing VM code.
- __ LoadImmediate(R5, kInterpretCallRuntimeEntry.GetEntryPoint());
+ __ LoadFromOffset(R5, THR, Thread::interpret_call_entry_point_offset());
__ StoreToOffset(R5, THR, Thread::vm_tag_offset());
// We are entering runtime code, so the C stack pointer must be restored from
@@ -2053,9 +2022,6 @@
// Reset exit frame information in Isolate structure.
__ StoreToOffset(ZR, THR, Thread::top_exit_frame_info_offset());
- // Load result of interpreted function call into R0.
- __ LoadFromOffset(R0, R23, 0);
-
__ LeaveStubFrame();
__ ret();
#else
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 6b91241..1b23e2d 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -1616,17 +1616,14 @@
}
// Stub for compiling a function and jumping to the compiled code.
-// ECX: IC-Data (for methods).
// EDX: Arguments descriptor.
// EAX: Function.
void StubCode::GenerateLazyCompileStub(Assembler* assembler) {
__ EnterStubFrame();
__ pushl(EDX); // Preserve arguments descriptor array.
- __ pushl(ECX); // Preserve IC data object.
__ pushl(EAX); // Pass function.
__ CallRuntime(kCompileFunctionRuntimeEntry, 1);
__ popl(EAX); // Restore function.
- __ popl(ECX); // Restore IC data array.
__ popl(EDX); // Restore arguments descriptor array.
__ LeaveFrame();
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index a16794a..5685994 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -1872,17 +1872,14 @@
}
// Stub for compiling a function and jumping to the compiled code.
-// RBX: IC-Data (for methods).
// R10: Arguments descriptor.
// RAX: Function.
void StubCode::GenerateLazyCompileStub(Assembler* assembler) {
__ EnterStubFrame();
__ pushq(R10); // Preserve arguments descriptor array.
- __ pushq(RBX); // Preserve IC data object.
__ pushq(RAX); // Pass function.
__ CallRuntime(kCompileFunctionRuntimeEntry, 1);
__ popq(RAX); // Restore function.
- __ popq(RBX); // Restore IC data array.
__ popq(R10); // Restore arguments descriptor array.
__ LeaveStubFrame();
@@ -1894,16 +1891,10 @@
}
// Stub for interpreting a function call.
-// RBX: IC-Data (for methods).
// R10: Arguments descriptor.
// RAX: Function.
void StubCode::GenerateInterpretCallStub(Assembler* assembler) {
#if defined(DART_USE_INTERPRETER)
- const intptr_t thread_offset = NativeArguments::thread_offset();
- const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
- const intptr_t argv_offset = NativeArguments::argv_offset();
- const intptr_t retval_offset = NativeArguments::retval_offset();
-
__ EnterStubFrame();
#if defined(DEBUG)
@@ -1918,56 +1909,47 @@
}
#endif
- // Push result and first 3 arguments of the interpreted function call.
- __ pushq(Immediate(0)); // Setup space on stack for result.
- __ pushq(RAX); // Function.
- __ pushq(RBX); // ICData/MegamorphicCache.
- __ pushq(R10); // Arguments descriptor array.
-
- // Adjust arguments count.
- __ movq(RDI, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
+ // Adjust arguments count for type arguments vector.
+ __ movq(R11, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
+ __ SmiUntag(R11);
__ cmpq(FieldAddress(R10, ArgumentsDescriptor::type_args_len_offset()),
Immediate(0));
- __ movq(R10, RDI);
Label args_count_ok;
__ j(EQUAL, &args_count_ok, Assembler::kNearJump);
- __ addq(R10, Immediate(Smi::RawValue(1))); // Include the type arguments.
+ __ incq(R11);
__ Bind(&args_count_ok);
- // Push 4th Dart argument of the interpreted function call.
- // R10: Smi-tagged arguments array length.
- PushArrayOfArguments(assembler); // May call into the runtime.
- const intptr_t kNumArgs = 4;
+ // Compute argv.
+ __ leaq(R12, Address(RBP, R11, TIMES_8, kParamEndSlotFromFp * kWordSize));
- // Set callee-saved RBX to point to first one of the 4 Dart arguments.
- __ leaq(RBX, Address(RSP, (kNumArgs - 1) * kWordSize));
+ // Indicate decreasing memory addresses of arguments with negative argc.
+ __ negq(R11);
- // Reserve space for native args and align frame before entering C++ world.
- __ subq(RSP, Immediate(sizeof(NativeArguments)));
+ // Reserve shadow space for args and align frame before entering C++ world.
+ __ subq(RSP, Immediate(5 * kWordSize));
if (OS::ActivationFrameAlignment() > 1) {
__ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
}
- // Pass NativeArguments structure by value and call runtime.
- __ movq(Address(RSP, thread_offset), THR); // Set thread in NativeArgs.
- __ movq(Address(RSP, argc_tag_offset), Immediate(kNumArgs)); // Set argc.
- // Compute argv.
- __ movq(Address(RSP, argv_offset), RBX); // Set argv in NativeArguments.
- __ addq(RBX, Immediate(1 * kWordSize)); // Retval is next to 1st argument.
- __ movq(Address(RSP, retval_offset), RBX); // Set retval in NativeArguments.
+ __ movq(CallingConventions::kArg1Reg, RAX); // Function.
+ __ movq(CallingConventions::kArg2Reg, R10); // Arguments descriptor.
+ __ movq(CallingConventions::kArg3Reg, R11); // Negative argc.
+ __ movq(CallingConventions::kArg4Reg, R12); // Argv.
+
#if defined(_WIN64)
- ASSERT(sizeof(NativeArguments) > CallingConventions::kRegisterTransferLimit);
- __ movq(CallingConventions::kArg1Reg, RSP);
+ __ movq(Address(RSP, 0 * kWordSize), THR); // Thread.
+#else
+ __ movq(CallingConventions::kArg5Reg, THR); // Thread.
#endif
// Save exit frame information to enable stack walking as we are about
// to transition to Dart VM C++ code.
__ movq(Address(THR, Thread::top_exit_frame_info_offset()), RBP);
// Mark that the thread is executing VM code.
- __ movq(RCX, Immediate(kInterpretCallRuntimeEntry.GetEntryPoint()));
- __ movq(Assembler::VMTagAddress(), RCX);
+ __ movq(RAX, Address(THR, Thread::interpret_call_entry_point_offset()));
+ __ movq(Assembler::VMTagAddress(), RAX);
- __ CallCFunction(RCX);
+ __ call(RAX);
// Mark that the thread is executing Dart code.
__ movq(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId));
@@ -1975,9 +1957,6 @@
// Reset exit frame information in Isolate structure.
__ movq(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0));
- // Load result of interpreted function call into RAX.
- __ movq(RAX, Address(RBX, 0));
-
__ LeaveStubFrame();
__ ret();
#else
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index 8864071..ddedbb0 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -163,6 +163,7 @@
NativeEntry::NoScopeNativeCallWrapperEntry(), 0) \
V(uword, auto_scope_native_wrapper_entry_point_, \
NativeEntry::AutoScopeNativeCallWrapperEntry(), 0) \
+ V(uword, interpret_call_entry_point_, RuntimeEntry::InterpretCallEntry(), 0) \
V(RawString**, predefined_symbols_address_, Symbols::PredefinedAddress(), \
NULL) \
V(uword, double_nan_address_, reinterpret_cast<uword>(&double_nan_constant), \
@@ -212,11 +213,15 @@
// The currently executing thread, or NULL if not yet initialized.
static Thread* Current() {
+#if defined(HAS_C11_THREAD_LOCAL)
+ return OSThread::CurrentVMThread();
+#else
BaseThread* thread = OSThread::GetCurrentTLS();
if (thread == NULL || thread->is_os_thread()) {
return NULL;
}
return reinterpret_cast<Thread*>(thread);
+#endif
}
// Makes the current thread enter 'isolate'.
@@ -902,9 +907,7 @@
void ExitSafepointUsingLock();
void BlockForSafepoint();
- static void SetCurrent(Thread* current) {
- OSThread::SetCurrentTLS(reinterpret_cast<uword>(current));
- }
+ static void SetCurrent(Thread* current) { OSThread::SetCurrentTLS(current); }
void DeferOOBMessageInterrupts();
void RestoreOOBMessageInterrupts();
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
index c065f34..89c1883 100644
--- a/runtime/vm/unit_test.cc
+++ b/runtime/vm/unit_test.cc
@@ -213,7 +213,7 @@
const int kNumArgs = 1;
Dart_Handle dart_args[kNumArgs];
dart_args[0] = DartUtils::NewString(uri_chars);
- return Dart_Invoke(DartUtils::BuiltinLib(),
+ return Dart_Invoke(DartUtils::LookupBuiltinLib(),
DartUtils::NewString("_filePathFromUri"), kNumArgs,
dart_args);
}
diff --git a/samples/build_dart/bin/test.dart b/samples/build_dart/bin/test.dart
deleted file mode 100644
index bc7ce1b..0000000
--- a/samples/build_dart/bin/test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test_build_dart;
-
-import "dart:io";
-
-/**
- * In order to generate test.foobar, make an edit to test.foo.
- */
-void main() {
- printContents("test.foo");
- print("");
- printContents("test.foobar");
-}
-
-void printContents(String file) {
- print("the contents of ${file} are:");
-
- var f = new File(file);
-
- if (f.existsSync()) {
- String contents = new File(file).readAsStringSync();
-
- print("[${contents}]");
- } else {
- print("[]");
- }
-}
diff --git a/samples/build_dart/build.dart b/samples/build_dart/build.dart
deleted file mode 100644
index 7058e70..0000000
--- a/samples/build_dart/build.dart
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library build_dart;
-
-import "dart:io";
-import "package:args/args.dart";
-
-bool cleanBuild;
-bool fullBuild;
-bool useMachineInterface;
-
-List<String> changedFiles;
-List<String> removedFiles;
-
-/**
- * If the file is named 'build.dart' and is placed in the root directory of a
- * project or in a directory containing a pubspec.yaml file, then the Editor
- * will automatically invoke that file whenever a file in that project changes.
- * See the source code of [processArgs] for information about the legal command
- * line options.
- */
-void main(List<String> arguments) {
- processArgs(arguments);
-
- if (cleanBuild) {
- handleCleanCommand();
- } else if (fullBuild) {
- handleFullBuild();
- } else {
- handleChangedFiles(changedFiles);
- handleRemovedFiles(removedFiles);
- }
-
- // Return a non-zero code to indicate a build failure.
- //exit(1);
-}
-
-/**
- * Handle --changed, --removed, --clean, --full, and --help command-line args.
- */
-void processArgs(List<String> arguments) {
- var parser = new ArgParser();
- parser.addOption("changed",
- help: "the file has changed since the last build", allowMultiple: true);
- parser.addOption("removed",
- help: "the file was removed since the last build", allowMultiple: true);
- parser.addFlag("clean", negatable: false, help: "remove any build artifacts");
- parser.addFlag("full", negatable: false, help: "perform a full build");
- parser.addFlag("machine",
- negatable: false, help: "produce warnings in a machine parseable format");
- parser.addFlag("help", negatable: false, help: "display this help and exit");
-
- var args = parser.parse(arguments);
-
- if (args["help"]) {
- print(parser.getUsage());
- exit(0);
- }
-
- changedFiles = args["changed"];
- removedFiles = args["removed"];
-
- useMachineInterface = args["machine"];
-
- cleanBuild = args["clean"];
- fullBuild = args["full"];
-}
-
-/**
- * Delete all generated files.
- */
-void handleCleanCommand() {
- Directory current = Directory.current;
- current.list(recursive: true).listen((FileSystemEntity entity) {
- if (entity is File) _maybeClean(entity);
- });
-}
-
-/**
- * Recursively scan the current directory looking for .foo files to process.
- */
-void handleFullBuild() {
- var files = <String>[];
-
- Directory.current.list(recursive: true).listen((entity) {
- if (entity is File) {
- files.add((entity as File).resolveSymbolicLinksSync());
- }
- }, onDone: () => handleChangedFiles(files));
-}
-
-/**
- * Process the given list of changed files.
- */
-void handleChangedFiles(List<String> files) {
- files.forEach(_processFile);
-}
-
-/**
- * Process the given list of removed files.
- */
-void handleRemovedFiles(List<String> files) {}
-
-/**
- * Convert a .foo file to a .foobar file.
- */
-void _processFile(String arg) {
- if (arg.endsWith(".foo")) {
- print("processing: ${arg}");
-
- File file = new File(arg);
-
- String contents = file.readAsStringSync();
-
- File outFile = new File("${arg}bar");
-
- IOSink out = outFile.openWrite();
- out.writeln("// processed from ${file.path}:");
- if (contents != null) {
- out.write(contents);
- }
- out.close();
-
- _findErrors(arg);
-
- print("wrote: ${outFile.path}");
- }
-}
-
-void _findErrors(String arg) {
- File file = new File(arg);
-
- List lines = file.readAsLinesSync();
-
- for (int i = 0; i < lines.length; i++) {
- if (lines[i].contains("woot") && !lines[i].startsWith("//")) {
- if (useMachineInterface) {
- // Ideally, we should emit the charStart and charEnd params as well.
- print('[{"method":"error","params":{"file":"$arg","line":${i+1},'
- '"message":"woot not supported"}}]');
- }
- }
- }
-}
-
-/**
- * If this file is a generated file (based on the extension), delete it.
- */
-void _maybeClean(File file) {
- if (file.path.endsWith(".foobar")) {
- file.delete();
- }
-}
diff --git a/samples/build_dart/pubspec.yaml b/samples/build_dart/pubspec.yaml
deleted file mode 100644
index 8af67a1..0000000
--- a/samples/build_dart/pubspec.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-name: buildhook2
-description: A demo of the buildhook build.dart script.
-dependencies:
- args: ">=0.9.0 <0.10.0"
-environment:
- sdk: ">=0.8.10+6 <2.0.0"
diff --git a/samples/build_dart/test.foo b/samples/build_dart/test.foo
deleted file mode 100644
index 3c1e3c0..0000000
--- a/samples/build_dart/test.foo
+++ /dev/null
@@ -1,4 +0,0 @@
-I'm from foo.
-I'm from foo.
-I'm from woot.
-//I'm from woot.
diff --git a/samples/build_dart/test/build_dart_test.dart b/samples/build_dart/test/build_dart_test.dart
deleted file mode 100644
index e146d6b..0000000
--- a/samples/build_dart/test/build_dart_test.dart
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library build_dart_test;
-
-import '../build.dart' as build_dart;
-import '../bin/test.dart' as test2;
-
-/**
- * This test exists to ensure that the build_dart sample compiles without
- * errors.
- */
-void main() {}
diff --git a/samples/build_dart_simple/build.dart b/samples/build_dart_simple/build.dart
deleted file mode 100644
index 0345f74..0000000
--- a/samples/build_dart_simple/build.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library build_dart_simple;
-
-import "dart:io";
-
-/**
- * This minimal build script copies the contents of .foo files to .foobar files.
- * In order to be invoked automatically by the Editor, this script must be named
- * 'build.dart' and placed in the root of a project.
- */
-void main(List<String> arguments) {
- for (String arg in arguments) {
- if (arg.startsWith("--changed=")) {
- String file = arg.substring("--changed=".length);
-
- if (file.endsWith(".foo")) {
- _processFile(file);
- }
- }
- }
-}
-
-void _processFile(String file) {
- String contents = new File(file).readAsStringSync();
-
- if (contents != null) {
- IOSink out = new File("${file}bar").openWrite();
- out.write("// processed from ${file}:\n${contents}");
- out.close();
- }
-}
diff --git a/samples/build_dart_simple/test.dart b/samples/build_dart_simple/test.dart
deleted file mode 100644
index 6ed759b..0000000
--- a/samples/build_dart_simple/test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test_build_dart_simple;
-
-import "dart:io";
-
-/**
- * In order to generate test.foobar, make an edit to test.foo.
- */
-void main() {
- printContents("test.foo");
- print("");
- printContents("test.foobar");
-}
-
-void printContents(String file) {
- print("the contents of ${file} are:");
-
- var f = new File(file);
-
- if (f.existsSync()) {
- String contents = new File(file).readAsStringSync();
-
- print("[${contents}]");
- } else {
- print("[]");
- }
-}
diff --git a/samples/build_dart_simple/test.foo b/samples/build_dart_simple/test.foo
deleted file mode 100644
index c6d13c9..0000000
--- a/samples/build_dart_simple/test.foo
+++ /dev/null
@@ -1 +0,0 @@
-I'm from foo.
\ No newline at end of file
diff --git a/samples/build_dart_simple/test/build_dart_simple_test.dart b/samples/build_dart_simple/test/build_dart_simple_test.dart
deleted file mode 100644
index 8a8c4c3..0000000
--- a/samples/build_dart_simple/test/build_dart_simple_test.dart
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library build_dart_simple_test;
-
-import '../build.dart' as build_dart_simple;
-import '../test.dart' as test1;
-
-/**
- * This test exists to ensure that the build_dart_simple sample compiles
- * without errors.
- */
-void main() {}
diff --git a/samples/samples.status b/samples/samples.status
index aeefd6e..12d8f0d 100644
--- a/samples/samples.status
+++ b/samples/samples.status
@@ -11,15 +11,9 @@
[ $compiler == app_jit ]
sample_extension/test/sample_extension_app_snapshot_test: RuntimeError
-[ $compiler == dart2analyzer ]
-build_dart: Skip
-
[ $compiler == precompiler ]
sample_extension/test/*: Skip # These tests attempt to spawn another script using the precompiled runtime.
-[ $compiler == dart2analyzer && $strong ]
-*: Skip # Issue 28649
-
[ $compiler == dart2js && $runtime == none ]
*: Fail, Pass # TODO(ahe): Triage these tests.
@@ -36,9 +30,8 @@
# Skip tests that use dart:io
[ $runtime == d8 || $browser ]
-build_dart/*: Skip
-build_dart_simple/*: Skip
sample_extension/*: Skip
[ $hot_reload || $hot_reload_rollback ]
-sample_extension/test/sample_extension_script_snapshot_test: SkipByDesign # This test makes a script snapshot, which implies not exercising Dart code.
+sample_extension/test/sample_extension_app_snapshot_test: SkipByDesign # Cannot reload with URI pointing to app snapshot.
+sample_extension/test/sample_extension_script_snapshot_test: SkipByDesign # Cannot reload with URI pointing to script snapshot.
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index a0f23ed..1c3bdc2 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -13,7 +13,7 @@
# or ":copy_libraries" may delete/overwrite your addition, and the build will
# fail.
-import("copy_tree.gni")
+import("../build/dart/copy_tree.gni")
declare_args() {
# Build a SDK with less stuff. It excludes dart2js, ddc, and web libraries.
@@ -38,6 +38,7 @@
# ......pub
# ......snapshots/
# ........analysis_server.dart.snapshot
+# ........analysis_server_dart1.dart.snapshot (this is temporary; #33877)
# ........dart2js.dart.snapshot
# ........dartanalyzer.dart.snapshot
# ........dartdoc.dart.snapshot
@@ -118,6 +119,10 @@
"../utils/analysis_server",
],
[
+ "analysis_server_dart1",
+ "../utils/analysis_server_dart1",
+ ],
+ [
"dartanalyzer",
"../utils/dartanalyzer:generate_dartanalyzer_snapshot",
],
@@ -145,6 +150,10 @@
"../utils/analysis_server",
],
[
+ "analysis_server_dart1",
+ "../utils/analysis_server_dart1",
+ ],
+ [
"dart2js",
"../utils/compiler:dart2js",
],
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index 3af2658..494f471 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -148,10 +148,12 @@
*/
abstract class Future<T> {
/// A `Future<Null>` completed with `null`.
- static final _Future<Null> _nullFuture = new _Future<Null>.value(null);
+ static final _Future<Null> _nullFuture =
+ new _Future<Null>.zoneValue(null, Zone.root);
/// A `Future<bool>` completed with `false`.
- static final _Future<bool> _falseFuture = new _Future<bool>.value(false);
+ static final _Future<bool> _falseFuture =
+ new _Future<bool>.zoneValue(false, Zone.root);
/**
* Creates a future containing the result of calling [computation]
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index 077ccf6..b85e6ab 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -186,7 +186,7 @@
* Until the future is completed, the field may hold the zone that
* listener callbacks used to create this future should be run in.
*/
- final Zone _zone = Zone.current;
+ final Zone _zone;
/**
* Either the result, a list of listeners or another future.
@@ -206,20 +206,24 @@
var _resultOrListeners;
// This constructor is used by async/await.
- _Future();
+ _Future() : _zone = Zone.current;
- _Future.immediate(FutureOr<T> result) {
+ _Future.immediate(FutureOr<T> result) : _zone = Zone.current {
_asyncComplete(result);
}
- _Future.immediateError(var error, [StackTrace stackTrace]) {
+ /** Creates a future with the value and the specified zone. */
+ _Future.zoneValue(T value, this._zone) {
+ _setValue(value);
+ }
+
+ _Future.immediateError(var error, [StackTrace stackTrace])
+ : _zone = Zone.current {
_asyncCompleteError(error, stackTrace);
}
/** Creates a future that is already completed with the value. */
- _Future.value(T value) {
- _setValue(value);
- }
+ _Future.value(T value) : this.zoneValue(value, Zone.current);
bool get _mayComplete => _state == _stateIncomplete;
bool get _isPendingComplete => _state == _statePendingComplete;
@@ -475,7 +479,7 @@
void _completeWithValue(T value) {
assert(!_isComplete);
- assert(value is! Future);
+ assert(value is! Future<T>);
_FutureListener listeners = _removeListeners();
_setValue(value);
diff --git a/sdk/lib/collection/iterable.dart b/sdk/lib/collection/iterable.dart
index fcad61f..79d6188 100644
--- a/sdk/lib/collection/iterable.dart
+++ b/sdk/lib/collection/iterable.dart
@@ -20,11 +20,7 @@
Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f);
- // TODO(leafp): Restore this functionality once generic methods are enabled
- // in the VM and dart2js.
- // https://github.com/dart-lang/sdk/issues/32463
- Iterable<T> whereType<T>() =>
- throw new UnimplementedError("whereType is not yet supported");
+ Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
Iterable<T> expand<T>(Iterable<T> f(E element)) =>
new ExpandIterable<E, T>(this, f);
diff --git a/sdk/lib/collection/list.dart b/sdk/lib/collection/list.dart
index 644d4b7..a719679 100644
--- a/sdk/lib/collection/list.dart
+++ b/sdk/lib/collection/list.dart
@@ -191,11 +191,7 @@
Iterable<E> where(bool test(E element)) => new WhereIterable<E>(this, test);
- // TODO(leafp): Restore this functionality once generic methods are enabled
- // in the VM and dart2js.
- // https://github.com/dart-lang/sdk/issues/32463
- Iterable<T> whereType<T>() =>
- throw new UnimplementedError("whereType is not yet supported");
+ Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
Iterable<T> map<T>(T f(E element)) => new MappedListIterable<E, T>(this, f);
diff --git a/sdk/lib/collection/set.dart b/sdk/lib/collection/set.dart
index 6481a56..80ec9d3 100644
--- a/sdk/lib/collection/set.dart
+++ b/sdk/lib/collection/set.dart
@@ -51,11 +51,7 @@
Iterable<E> followedBy(Iterable<E> other) =>
new FollowedByIterable<E>.firstEfficient(this, other);
- // TODO(leafp): Restore this functionality once generic methods are enabled
- // in the VM and dart2js.
- // https://github.com/dart-lang/sdk/issues/32463
- Iterable<T> whereType<T>() =>
- throw new UnimplementedError("whereType is not yet supported");
+ Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
void clear() {
removeAll(toList());
diff --git a/sdk/lib/developer/timeline.dart b/sdk/lib/developer/timeline.dart
index f1ceda4..e838a1f 100644
--- a/sdk/lib/developer/timeline.dart
+++ b/sdk/lib/developer/timeline.dart
@@ -79,7 +79,7 @@
/// [Timeline]'s methods add synchronous events to the timeline. When
/// generating a timeline in Chrome's tracing format, using [Timeline] generates
/// "Complete" events. [Timeline]'s [startSync] and [finishSync] can be used
-/// explicitly, or implicitly by wrapping a closure in [timeSync]. For exmaple:
+/// explicitly, or implicitly by wrapping a closure in [timeSync]. For example:
///
/// ```dart
/// Timeline.startSync("Doing Something");
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 6c2d46f..6d0e31a 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -4514,6 +4514,7 @@
LayoutTests/fast/events/event-listener-sharing_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/event-on-created-document_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/event-on-xhr-document_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/events/event-trace_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/fire-scroll-event_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/form-onchange_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/init-message-event_t01: RuntimeError # Please triage this failure
diff --git a/tests/co19/co19-kernel.status b/tests/co19/co19-kernel.status
index c28c644..a716a8e 100644
--- a/tests/co19/co19-kernel.status
+++ b/tests/co19/co19-kernel.status
@@ -3,9 +3,13 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == fasta ]
+Language/Classes/Getters/override_t02: CompileTimeError
+Language/Classes/Getters/override_t03: CompileTimeError
+Language/Classes/Setters/override_t02: CompileTimeError
Language/Classes/definition_t24: MissingCompileTimeError
Language/Functions/Formal_Parameters/Optional_Formals/default_value_t01: MissingCompileTimeError
Language/Functions/Formal_Parameters/Optional_Formals/default_value_t02: MissingCompileTimeError
+Language/Mixins/Mixin_Application/syntax_t21: CompileTimeError
Language/Types/Type_Void/syntax_t08: MissingCompileTimeError
Language/Types/Type_Void/syntax_t09: MissingCompileTimeError
LayoutTests/*: Skip # TODO(ahe): Make dart:html available.
@@ -58,8 +62,13 @@
Language/Classes/Constructors/Constant_Constructors/initializer_not_a_constant_t02: MissingCompileTimeError
Language/Classes/Constructors/Constant_Constructors/invalid_constant_initializer_t02: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/static_type_t01: CompileTimeError
+Language/Classes/Constructors/name_t01: MissingCompileTimeError
+Language/Classes/Constructors/name_t02: MissingCompileTimeError
+Language/Classes/Constructors/name_t03: MissingCompileTimeError
Language/Classes/Getters/static_getter_t01: CompileTimeError
+Language/Classes/Instance_Methods/same_name_setter_t01: CompileTimeError
Language/Classes/Instance_Methods/same_name_setter_t02: CompileTimeError # Issue 14736
+Language/Classes/Setters/name_t02: CompileTimeError
Language/Classes/Setters/name_t03: CompileTimeError
Language/Classes/Setters/name_t04: CompileTimeError
Language/Classes/Setters/name_t06: CompileTimeError
@@ -89,6 +98,9 @@
Language/Classes/Constructors/Constant_Constructors/invalid_constant_initializer_t02: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/execution_of_an_initializer_t02: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/initializing_formals_execution_t02: MissingCompileTimeError
+Language/Classes/Constructors/name_t01: MissingCompileTimeError
+Language/Classes/Constructors/name_t02: MissingCompileTimeError
+Language/Classes/Constructors/name_t03: MissingCompileTimeError
Language/Classes/Getters/same_name_method_t03: MissingCompileTimeError
Language/Classes/Getters/same_name_method_t04: MissingCompileTimeError
Language/Classes/Getters/same_name_method_t05: MissingCompileTimeError
diff --git a/tests/co19_2/co19_2-analyzer.status b/tests/co19_2/co19_2-analyzer.status
index 6824a1a..e8976f4 100644
--- a/tests/co19_2/co19_2-analyzer.status
+++ b/tests/co19_2/co19_2-analyzer.status
@@ -42,6 +42,7 @@
Language/Generics/syntax_t02: CompileTimeError # Please triage this failure
Language/Generics/syntax_t03: Crash # Issue 29388
Language/Libraries_and_Scripts/Parts/compilation_t01: MissingCompileTimeError, Pass # Please triage this failure
+Language/Libraries_and_Scripts/Parts/compilation_t04: Pass, CompileTimeError, MissingCompileTimeError # Please triage this failure
Language/Libraries_and_Scripts/Parts/compilation_t15: CompileTimeError, Pass # Please triage this failure
Language/Mixins/Mixin_Application/static_warning_t02: CompileTimeError # Issue 26409
Language/Mixins/Mixin_Application/superinterfaces_t07: CompileTimeError # Issue 26409
diff --git a/tests/co19_2/co19_2-kernel.status b/tests/co19_2/co19_2-kernel.status
index 956726a..ab8f393 100644
--- a/tests/co19_2/co19_2-kernel.status
+++ b/tests/co19_2/co19_2-kernel.status
@@ -31,19 +31,19 @@
Language/Classes/Constructors/Generative_Constructors/execution_t07: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/execution_t12: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/initializers_t15: CompileTimeError
+Language/Classes/Constructors/name_t01: MissingCompileTimeError # Legal, see #33235
+Language/Classes/Constructors/name_t02: MissingCompileTimeError # Legal, see #33235
+Language/Classes/Constructors/name_t03: MissingCompileTimeError # Legal, see #33235
Language/Classes/Getters/instance_getter_t01: MissingCompileTimeError
Language/Classes/Getters/instance_getter_t02: MissingCompileTimeError
Language/Classes/Getters/instance_getter_t03: MissingCompileTimeError
Language/Classes/Getters/instance_getter_t04: MissingCompileTimeError
Language/Classes/Getters/instance_getter_t05: MissingCompileTimeError
Language/Classes/Getters/instance_getter_t06: MissingCompileTimeError
-Language/Classes/Getters/override_t02: MissingCompileTimeError
-Language/Classes/Getters/override_t03: MissingCompileTimeError
Language/Classes/Getters/type_object_t01: CompileTimeError
Language/Classes/Getters/type_object_t02: CompileTimeError
Language/Classes/Instance_Methods/override_different_default_values_t01: MissingCompileTimeError
Language/Classes/Instance_Methods/override_different_default_values_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/same_name_setter_t01: MissingCompileTimeError
Language/Classes/Instance_Methods/same_name_static_member_in_superclass_t01: MissingCompileTimeError
Language/Classes/Instance_Methods/same_name_static_member_in_superclass_t02: MissingCompileTimeError
Language/Classes/Instance_Methods/same_name_static_member_in_superclass_t04: MissingCompileTimeError
@@ -58,10 +58,8 @@
Language/Classes/Setters/instance_setter_t04: MissingCompileTimeError
Language/Classes/Setters/instance_setter_t05: MissingCompileTimeError
Language/Classes/Setters/instance_setter_t06: MissingCompileTimeError
-Language/Classes/Setters/name_t02: MissingCompileTimeError
Language/Classes/Setters/name_t06: CompileTimeError
Language/Classes/Setters/name_t07: CompileTimeError
-Language/Classes/Setters/override_t02: MissingCompileTimeError
Language/Classes/Static_Methods/same_name_method_and_setter_t01: CompileTimeError
Language/Classes/Superclasses/wrong_superclass_t08: MissingCompileTimeError
Language/Classes/Superinterfaces/more_than_once_t01: MissingCompileTimeError
@@ -159,6 +157,7 @@
Language/Metadata/compilation_t03: MissingCompileTimeError
Language/Mixins/Mixin_Application/deferred_t01: MissingCompileTimeError
Language/Mixins/Mixin_Application/static_warning_t01: MissingCompileTimeError
+Language/Mixins/Mixin_Application/syntax_t21: CompileTimeError # The test even says in the comment it should be a compile time error
Language/Mixins/declaring_constructor_t05: MissingCompileTimeError
Language/Mixins/declaring_constructor_t06: MissingCompileTimeError
Language/Overview/Privacy/private_and_public_t11: CompileTimeError
diff --git a/tests/compiler/dart2js/dill_loader_test.dart b/tests/compiler/dart2js/dill_loader_test.dart
index e1fd6b1..05b9a43 100644
--- a/tests/compiler/dart2js/dill_loader_test.dart
+++ b/tests/compiler/dart2js/dill_loader_test.dart
@@ -4,17 +4,18 @@
import 'memory_compiler.dart';
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/apiimpl.dart' show CompilerImpl;
import 'package:compiler/src/common_elements.dart';
import 'package:compiler/src/elements/entities.dart'
show LibraryEntity, ClassEntity;
-import 'package:compiler/src/apiimpl.dart' show CompilerImpl;
-import "package:expect/expect.dart";
-import 'package:front_end/src/api_prototype/front_end.dart';
-import 'package:front_end/src/fasta/kernel/utils.dart' show serializeComponent;
import 'package:compiler/src/kernel/dart2js_target.dart';
-import 'package:kernel/target/targets.dart' show TargetFlags;
+import 'package:compiler/src/library_loader.dart';
+import 'package:expect/expect.dart';
+import 'package:front_end/src/api_prototype/front_end.dart';
import 'package:front_end/src/compute_platform_binaries_location.dart'
show computePlatformBinariesLocation;
+import 'package:front_end/src/fasta/kernel/utils.dart' show serializeComponent;
+import 'package:kernel/target/targets.dart' show TargetFlags;
/// Test that the compiler can successfully read in .dill kernel files rather
/// than just string source files.
@@ -43,7 +44,9 @@
diagnosticHandler: diagnostics,
outputProvider: output);
await compiler.setupSdk();
- await compiler.libraryLoader.loadLibrary(entryPoint);
+ LoadedLibraries loadedLibraries =
+ await compiler.libraryLoader.loadLibraries(entryPoint);
+ compiler.frontendStrategy.registerLoadedLibraries(loadedLibraries);
Expect.equals(0, diagnostics.errors.length);
Expect.equals(0, diagnostics.warnings.length);
diff --git a/tests/compiler/dart2js/in_user_code_test.dart b/tests/compiler/dart2js/in_user_code_test.dart
index 82c080f..580fdf6 100644
--- a/tests/compiler/dart2js/in_user_code_test.dart
+++ b/tests/compiler/dart2js/in_user_code_test.dart
@@ -53,7 +53,8 @@
packageConfig: Uri.parse('memory:.packages'));
Compiler compiler = result.compiler;
expectedResults.forEach((String uri, bool expectedResult) {
- dynamic element = compiler.libraryLoader.lookupLibrary(Uri.parse(uri));
+ dynamic element = compiler.frontendStrategy.elementEnvironment
+ .lookupLibrary(Uri.parse(uri));
Expect.isNotNull(element, "Unknown library '$uri'.");
Expect.equals(
expectedResult,
diff --git a/tests/compiler/dart2js/memory_compiler.dart b/tests/compiler/dart2js/memory_compiler.dart
index 70b8757..c85cf11 100644
--- a/tests/compiler/dart2js/memory_compiler.dart
+++ b/tests/compiler/dart2js/memory_compiler.dart
@@ -15,12 +15,7 @@
Diagnostic,
PackagesDiscoveryProvider;
import 'package:compiler/src/diagnostics/messages.dart' show Message;
-import 'package:compiler/src/elements/entities.dart'
- show LibraryEntity, MemberEntity;
-import 'package:compiler/src/enqueue.dart' show ResolutionEnqueuer;
import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput;
-import 'package:compiler/src/library_loader.dart'
- show LoadedLibraries, KernelLibraryLoaderTask;
import 'package:compiler/src/options.dart' show CompilerOptions;
import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
@@ -68,9 +63,6 @@
return handler;
}
-Expando<MemorySourceFileProvider> expando =
- new Expando<MemorySourceFileProvider>();
-
// Cached kernel state for non-strong mode.
fe.InitializedCompilerState kernelInitializedCompilerState;
@@ -86,7 +78,6 @@
CompilerDiagnostics diagnosticHandler,
CompilerOutput outputProvider,
List<String> options: const <String>[],
- CompilerImpl cachedCompiler,
bool showDiagnostics: true,
Uri packageRoot,
Uri packageConfig,
@@ -101,7 +92,6 @@
diagnosticHandler: diagnosticHandler,
outputProvider: outputProvider,
options: options,
- cachedCompiler: cachedCompiler,
showDiagnostics: showDiagnostics,
packageRoot: packageRoot,
packageConfig: packageConfig,
@@ -111,15 +101,12 @@
}
fe.InitializedCompilerState compilerState;
bool isSuccess = await compiler.run(entryPoint);
- if (compiler.libraryLoader is KernelLibraryLoaderTask) {
- KernelLibraryLoaderTask loader = compiler.libraryLoader;
- if (compiler.options.strongMode) {
- compilerState = strongKernelInitializedCompilerState =
- loader.initializedCompilerState;
- } else {
- compilerState =
- kernelInitializedCompilerState = loader.initializedCompilerState;
- }
+ if (compiler.options.strongMode) {
+ compilerState = strongKernelInitializedCompilerState =
+ compiler.libraryLoader.initializedCompilerState;
+ } else {
+ compilerState = kernelInitializedCompilerState =
+ compiler.libraryLoader.initializedCompilerState;
}
return new CompilationResult(compiler,
isSuccess: isSuccess, kernelInitializedCompilerState: compilerState);
@@ -131,7 +118,6 @@
CompilerDiagnostics diagnosticHandler,
CompilerOutput outputProvider,
List<String> options: const <String>[],
- CompilerImpl cachedCompiler,
bool showDiagnostics: true,
Uri packageRoot,
Uri packageConfig,
@@ -154,17 +140,7 @@
}
MemorySourceFileProvider provider;
- if (cachedCompiler == null) {
- provider = new MemorySourceFileProvider(memorySourceFiles);
- // Saving the provider in case we need it later for a cached compiler.
- expando[provider] = provider;
- } else {
- // When using a cached compiler, it has read a number of files from disk
- // already (and will not attempt to read them again due to caching). These
- // files must be available to the new diagnostic handler.
- provider = expando[cachedCompiler.provider];
- provider.memorySourceFiles = memorySourceFiles;
- }
+ provider = new MemorySourceFileProvider(memorySourceFiles);
diagnosticHandler = createCompilerDiagnostics(diagnosticHandler, provider,
showDiagnostics: showDiagnostics,
verbose: options.contains('-v') || options.contains('--verbose'));
@@ -190,67 +166,9 @@
CompilerImpl compiler = new CompilerImpl(
provider, outputProvider, diagnosticHandler, compilerOptions);
- if (cachedCompiler != null) {
- Map copiedLibraries = {};
- cachedCompiler.libraryLoader.libraries.forEach((dynamic library) {
- if (library.isPlatformLibrary) {
- dynamic libraryLoader = compiler.libraryLoader;
- libraryLoader.mapLibrary(library);
- copiedLibraries[library.canonicalUri] = library;
- }
- });
- compiler.processLoadedLibraries(new MemoryLoadedLibraries(copiedLibraries));
- ResolutionEnqueuer resolutionEnqueuer = compiler.startResolution();
-
- Iterable<MemberEntity> cachedTreeElements =
- cachedCompiler.enqueuer.resolution.processedEntities;
- cachedTreeElements.forEach((MemberEntity element) {
- if (element.library.canonicalUri.scheme == 'dart') {
- resolutionEnqueuer.registerProcessedElementInternal(element);
- }
- });
-
- dynamic frontendStrategy = compiler.frontendStrategy;
- frontendStrategy.nativeBasicDataBuilder.reopenForTesting();
-
- // One potential problem that can occur when reusing elements is that there
- // is a stale reference to an old compiler object. By nulling out the old
- // compiler's fields, such stale references are easier to identify.
- cachedCompiler.libraryLoader = null;
- cachedCompiler.globalInference = null;
- cachedCompiler.backend = null;
- // Don't null out the enqueuer as it prevents us from using cachedCompiler
- // more than once.
- cachedCompiler.deferredLoadTask = null;
- cachedCompiler.dumpInfoTask = null;
- }
return compiler;
}
-class MemoryLoadedLibraries implements LoadedLibraries {
- final Map copiedLibraries;
-
- MemoryLoadedLibraries(this.copiedLibraries);
-
- @override
- bool containsLibrary(Uri uri) => copiedLibraries.containsKey(uri);
-
- @override
- void forEachImportChain(f, {callback}) {
- throw new UnimplementedError();
- }
-
- @override
- void forEachLibrary(void f(LibraryEntity l)) =>
- copiedLibraries.values.forEach((l) => f(l));
-
- @override
- getLibrary(Uri uri) => copiedLibraries[uri];
-
- @override
- LibraryEntity get rootLibrary => copiedLibraries.values.first;
-}
-
DiagnosticHandler createDiagnosticHandler(DiagnosticHandler diagnosticHandler,
SourceFileProvider provider, bool showDiagnostics) {
var handler = diagnosticHandler;
diff --git a/tests/compiler/dart2js/rti/emission/event_callback.dart b/tests/compiler/dart2js/rti/emission/event_callback.dart
index a0c84dd..bb6068f 100644
--- a/tests/compiler/dart2js/rti/emission/event_callback.dart
+++ b/tests/compiler/dart2js/rti/emission/event_callback.dart
@@ -7,8 +7,13 @@
/*kernel.class: global#Event:checkedTypeArgument,checks=[$isEvent],instance,typeArgument*/
/*strong.class: global#Event:checkedInstance,checkedTypeArgument,checks=[$isEvent],instance,typeArgument*/
-/*class: global#MouseEvent:checks=[],instance*/
-/*class: global#KeyboardEvent:checks=[],instance*/
+/*kernel.class: global#MouseEvent:checks=[$isMouseEvent],instance,typeArgument*/
+/*strong.class: global#MouseEvent:checks=[$isMouseEvent],instance,typeArgument*/
+/*omit.class: global#MouseEvent:instance*/
+
+/*kernel.class: global#KeyboardEvent:checks=[$isKeyboardEvent],instance,typeArgument*/
+/*strong.class: global#KeyboardEvent:checks=[$isKeyboardEvent],instance,typeArgument*/
+/*omit.class: global#KeyboardEvent:instance*/
void main() {
print('InputElement');
diff --git a/tests/compiler/dart2js/rti/emission/map_literal.dart b/tests/compiler/dart2js/rti/emission/map_literal.dart
index 2dbeda8..f9eb53b 100644
--- a/tests/compiler/dart2js/rti/emission/map_literal.dart
+++ b/tests/compiler/dart2js/rti/emission/map_literal.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/*kernel.class: global#Map:instance*/
-/*strong.class: global#Map:checkedInstance,checks=[],instance*/
+/*strong.class: global#Map:checkedInstance,instance*/
/*class: global#LinkedHashMap:*/
/*class: global#JsLinkedHashMap:checks=[],instance*/
diff --git a/tests/compiler/dart2js/rti/emission/map_literal_checked.dart b/tests/compiler/dart2js/rti/emission/map_literal_checked.dart
index 2f51833..a54e67f 100644
--- a/tests/compiler/dart2js/rti/emission/map_literal_checked.dart
+++ b/tests/compiler/dart2js/rti/emission/map_literal_checked.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*class: global#Map:checkedInstance,checks=[],instance*/
+/*class: global#Map:checkedInstance,instance*/
/*class: global#LinkedHashMap:checkedInstance*/
/*class: global#JsLinkedHashMap:checkedInstance,checks=[$isLinkedHashMap],instance*/
/*class: global#double:checkedInstance,checks=[],instance,typeArgument*/
diff --git a/tests/compiler/dart2js/rti/emission/replaced_type_variable.dart b/tests/compiler/dart2js/rti/emission/replaced_type_variable.dart
new file mode 100644
index 0000000..5b22b5f
--- /dev/null
+++ b/tests/compiler/dart2js/rti/emission/replaced_type_variable.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+// This class is inlined away.
+/*class: Class:*/
+class Class<T> {
+ const Class();
+
+ Type get type => T;
+}
+
+/*class: A:checks=[],typeArgument*/
+class A {}
+
+@NoInline()
+test(o) => Expect.notEquals('dynamic', '$o');
+
+main() {
+ test(const Class<A>().type);
+}
diff --git a/tests/compiler/dart2js/rti/rti_emission_test.dart b/tests/compiler/dart2js/rti/rti_emission_test.dart
index 36fefb6..d7f6b65 100644
--- a/tests/compiler/dart2js/rti/rti_emission_test.dart
+++ b/tests/compiler/dart2js/rti/rti_emission_test.dart
@@ -38,8 +38,6 @@
'map_literal_checked.dart',
// TODO(johnniwinther): Optimize local function type signature need.
'subtype_named_args.dart',
- // TODO(33690):
- 'native.dart',
],
);
});
diff --git a/tests/compiler/dart2js_extra/replaced_type_variable_test.dart b/tests/compiler/dart2js_extra/replaced_type_variable_test.dart
new file mode 100644
index 0000000..f530000
--- /dev/null
+++ b/tests/compiler/dart2js_extra/replaced_type_variable_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+// This class is inlined away.
+class Class<T> {
+ const Class();
+
+ Type get type => T;
+}
+
+class A {}
+
+@NoInline()
+test(o) => Expect.notEquals('dynamic', '$o');
+
+main() {
+ test(const Class<A>().type);
+}
diff --git a/tests/compiler/dart2js_native/dart2js_native.status b/tests/compiler/dart2js_native/dart2js_native.status
index 8ad400d..6273aa3 100644
--- a/tests/compiler/dart2js_native/dart2js_native.status
+++ b/tests/compiler/dart2js_native/dart2js_native.status
@@ -10,7 +10,6 @@
*: Skip
[ $compiler == dart2js && $checked && !$strong ]
-error_safeToString_test: RuntimeError # Fix for Issue 33627 disabled native class sharing
native_method_inlining_test: RuntimeError
[ $compiler == dart2js && $fasta ]
@@ -24,5 +23,4 @@
optimization_hints_test: RuntimeError, OK # Test relies on unminified names.
[ $compiler == dart2js && $strong ]
-error_safeToString_test: RuntimeError # Fix for Issue 33627 disabled native class sharing
native_checked_fields_frog_test: RuntimeError
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index 65d9def..0afd48c 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -1,7 +1,6 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
-iterable_where_type_test: RuntimeError # Disabled. Issue 32463
maps_test: Skip # Maps class no longer exists
[ $compiler == app_jitk ]
@@ -13,55 +12,22 @@
unicode_test: RuntimeError
[ $compiler == dart2analyzer ]
-bigint_from_test: CompileTimeError # Issue 32585
-compare_to2_test: CompileTimeError # invalid test
int_parse_radix_bad_handler_test: MissingCompileTimeError
-int_try_parse_test: CompileTimeError # Issue 32585
iterable_element_at_test/static: Pass
num_sign_test: Crash, Pass # Issue 31768
[ $compiler == dart2js ]
bigint_from_test: RuntimeError # Issue 32589
date_time11_test: RuntimeError, Pass # Fails when US is on winter time, issue 31285.
-iterable_where_type_test: RuntimeError # issue 31718
list_unmodifiable_test: Pass, RuntimeError # Issue 28712
[ $compiler != dartdevc ]
error_stack_trace_test/static: MissingCompileTimeError
[ $compiler == dartdevk ]
-bigint_from_test: RuntimeError # Issue 32589
-bigint_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-bit_twiddling_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
bool_from_environment2_test/03: Crash
-compare_to2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-date_time_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-double_ceil_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-double_floor_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-double_round_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-double_truncate_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-growable_list_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_ceil_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_ceil_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_floor_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_floor_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_from_environment_int64_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
int_modulo_arith_test/modPow: RuntimeError
int_modulo_arith_test/none: RuntimeError
-int_parse_radix_int64_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_parse_radix_int64_test/02: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_parse_radix_int64_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_round_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_round_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_to_int_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_truncate_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-int_truncate_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-integer_arith_vm_test/modPow: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-integer_arith_vm_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-integer_to_string_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-num_parse_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-num_parse_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-num_sign_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
string_from_environment3_test/03: Crash
[ $compiler == precompiler ]
@@ -122,6 +88,7 @@
[ !$strong ]
cast_test: SkipByDesign # Uses generic method parameters.
+iterable_where_type_test: SkipByDesign
regress_33166_test: SkipByDesign # Not a Dart 1 test
[ $arch == simarmv5te && ($runtime == dart_precompiled || $runtime == vm) ]
@@ -303,9 +270,7 @@
string_from_environment3_test/03: MissingCompileTimeError
[ $compiler == dartdevc && $runtime != none ]
-bigint_from_test: CompileTimeError # Issue 32585
compare_to2_test: CompileTimeError # invalid test
-int_try_parse_test: CompileTimeError # Issue 32585
symbol_operator_test: RuntimeError # Issue 29921
[ $compiler != dartdevc && $compiler != dartdevk && $checked && !$strong ]
@@ -417,74 +382,6 @@
regress_r21715_test: RuntimeError # Requires fixed-size int64 support.
typed_data_with_limited_ints_test: Skip # Requires fixed-size int64 support.
-[ $runtime != none && ($compiler == dartdevc || $compiler == dartdevk) ]
-bigint_test: Pass, Slow, Timeout
-compare_to2_test: RuntimeError # Issue 30170
-date_time10_test: RuntimeError # Issue 29921
-error_stack_trace_test/nullThrown: RuntimeError # .stackTrace not present for exception caught from 'throw null;'
-hash_set_test/01: RuntimeError # Issue 29921
-int_modulo_arith_test/none: RuntimeError # Issue 29921
-int_parse_radix_int64_test/02: RuntimeError
-int_parse_radix_test/01: RuntimeError # Issue 29921
-int_parse_with_limited_ints_test: Skip # Requires fixed-size int64 support.
-integer_arith_vm_test/modPow: RuntimeError # Issue 30170
-integer_parsed_arith_vm_test: RuntimeError # Issue 29921
-integer_to_radix_string_test: RuntimeError # Issue 29921
-integer_to_string_test/01: RuntimeError # Issue 29921
-iterable_return_type_test/02: RuntimeError # Issue 29921
-list_concurrent_modify_test: RuntimeError # DDC uses ES6 array iterators so it does not issue this
-list_removeat_test: RuntimeError # Issue 29921
-main_test: RuntimeError # Issue 29921
-nan_infinity_test/01: RuntimeError # Issue 29921
-regexp/alternative-length-miscalculation_test: RuntimeError # Issue 29921
-regexp/ascii-regexp-subject_test: RuntimeError # Issue 29921
-regexp/bol-with-multiline_test: RuntimeError # Issue 29921
-regexp/capture-3_test: RuntimeError # Issue 29921
-regexp/char-insensitive_test: RuntimeError # Issue 29921
-regexp/character-match-out-of-order_test: RuntimeError # Issue 29921
-regexp/compile-crash_test: RuntimeError # Issue 29921
-regexp/default_arguments_test: RuntimeError # Issue 29921
-regexp/early-acid3-86_test: RuntimeError # Issue 29921
-regexp/ecma-regex-examples_test: RuntimeError # Issue 29921
-regexp/extended-characters-match_test: RuntimeError # Issue 29921
-regexp/extended-characters-more_test: RuntimeError # Issue 29921
-regexp/find-first-asserted_test: RuntimeError # Issue 29921
-regexp/invalid-range-in-class_test: RuntimeError # Issue 29921
-regexp/look-ahead_test: RuntimeError # Issue 29921
-regexp/loop-capture_test: RuntimeError # Issue 29921
-regexp/malformed-escapes_test: RuntimeError # Issue 29921
-regexp/many-brackets_test: RuntimeError # Issue 29921
-regexp/negative-special-characters_test: RuntimeError # Issue 29921
-regexp/no-extensions_test: RuntimeError # Issue 29921
-regexp/non-bmp_test: RuntimeError # Issue 29921
-regexp/non-capturing-backtracking_test: RuntimeError # Issue 29921
-regexp/non-capturing-groups_test: RuntimeError # Issue 29921
-regexp/non-character_test: RuntimeError # Issue 29921
-regexp/non-greedy-parentheses_test: RuntimeError # Issue 29921
-regexp/pcre-test-4_test: RuntimeError # Issue 29921
-regexp/quantified-assertions_test: RuntimeError # Issue 29921
-regexp/range-bound-ffff_test: RuntimeError # Issue 29921
-regexp/range-out-of-order_test: RuntimeError # Issue 29921
-regexp/ranges-and-escaped-hyphens_test: RuntimeError # Issue 29921
-regexp/regress-6-9-regexp_test: RuntimeError # Issue 29921
-regexp/regress-regexp-codeflush_test: RuntimeError # Issue 29921
-regexp/regress-regexp-construct-result_test: RuntimeError # Issue 29921
-regexp/repeat-match-waldemar_test: RuntimeError # Issue 29921
-regexp/results-cache_test: RuntimeError # Issue 29921
-regexp/stack-overflow2_test: RuntimeError # Issue 29921
-regexp/stack-overflow_test: RuntimeError # Issue 29921
-regexp/unicode-handling_test: RuntimeError # Issue 29921
-regexp/zero-length-alternatives_test: RuntimeError # Issue 29921
-regress_r21715_test: RuntimeError # Issue 29921
-string_operations_with_null_test: RuntimeError # Issue 29921
-symbol_operator_test/03: RuntimeError # Issue 29921
-symbol_reserved_word_test/06: RuntimeError # Issue 29921
-symbol_reserved_word_test/09: RuntimeError # Issue 29921
-symbol_reserved_word_test/12: RuntimeError # Issue 29921
-symbol_test/none: RuntimeError # Issue 29921
-typed_data_with_limited_ints_test: Skip # Requires fixed-size int64 support.
-uri_parse_test: Pass, Slow
-
[ $runtime == vm && !$strong ]
collection_of_test: RuntimeError
@@ -603,6 +500,102 @@
from_environment_const_type_undefined_test/16: MissingCompileTimeError
iterable_to_set_test: RuntimeError # is-checks do not implement strong mode type system
+[ $compiler == dartdevc || $compiler == dartdevk ]
+bigint_from_test: RuntimeError # Issue 32589
+bigint_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+bit_twiddling_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+compare_to2_test: RuntimeError # Issue 30170
+compare_to2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+date_time10_test: RuntimeError # Issue 29921
+date_time_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_ceil_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_floor_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_round_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_truncate_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+error_stack_trace_test/nullThrown: RuntimeError # .stackTrace not present for exception caught from 'throw null;'
+growable_list_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+hash_set_test/01: RuntimeError # Issue 29921
+int_ceil_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_ceil_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_floor_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_floor_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_from_environment_int64_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_modulo_arith_test/none: RuntimeError # Issue 29921
+int_parse_radix_int64_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_parse_radix_int64_test/02: RuntimeError
+int_parse_radix_int64_test/02: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_parse_radix_int64_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_parse_radix_test/01: RuntimeError # Issue 29921
+int_parse_with_limited_ints_test: Skip # Requires fixed-size int64 support.
+int_round_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_round_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_to_int_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_truncate_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_truncate_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+integer_arith_vm_test/modPow: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+integer_arith_vm_test/modPow: RuntimeError # Issue 30170
+integer_arith_vm_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+integer_parsed_arith_vm_test: RuntimeError # Issue 29921
+integer_to_radix_string_test: RuntimeError # Issue 29921
+integer_to_string_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+integer_to_string_test/01: RuntimeError # Issue 29921
+iterable_return_type_test/02: RuntimeError # Issue 29921
+list_concurrent_modify_test: RuntimeError # DDC uses ES6 array iterators so it does not issue this
+list_removeat_test: RuntimeError # Issue 29921
+main_test: RuntimeError # Issue 29921
+nan_infinity_test/01: RuntimeError # Issue 29921
+num_parse_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+num_parse_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+num_sign_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+regexp/alternative-length-miscalculation_test: RuntimeError # Issue 29921
+regexp/ascii-regexp-subject_test: RuntimeError # Issue 29921
+regexp/bol-with-multiline_test: RuntimeError # Issue 29921
+regexp/capture-3_test: RuntimeError # Issue 29921
+regexp/char-insensitive_test: RuntimeError # Issue 29921
+regexp/character-match-out-of-order_test: RuntimeError # Issue 29921
+regexp/compile-crash_test: RuntimeError # Issue 29921
+regexp/default_arguments_test: RuntimeError # Issue 29921
+regexp/early-acid3-86_test: RuntimeError # Issue 29921
+regexp/ecma-regex-examples_test: RuntimeError # Issue 29921
+regexp/extended-characters-match_test: RuntimeError # Issue 29921
+regexp/extended-characters-more_test: RuntimeError # Issue 29921
+regexp/find-first-asserted_test: RuntimeError # Issue 29921
+regexp/invalid-range-in-class_test: RuntimeError # Issue 29921
+regexp/look-ahead_test: RuntimeError # Issue 29921
+regexp/loop-capture_test: RuntimeError # Issue 29921
+regexp/malformed-escapes_test: RuntimeError # Issue 29921
+regexp/many-brackets_test: RuntimeError # Issue 29921
+regexp/negative-special-characters_test: RuntimeError # Issue 29921
+regexp/no-extensions_test: RuntimeError # Issue 29921
+regexp/non-bmp_test: RuntimeError # Issue 29921
+regexp/non-capturing-backtracking_test: RuntimeError # Issue 29921
+regexp/non-capturing-groups_test: RuntimeError # Issue 29921
+regexp/non-character_test: RuntimeError # Issue 29921
+regexp/non-greedy-parentheses_test: RuntimeError # Issue 29921
+regexp/pcre-test-4_test: RuntimeError # Issue 29921
+regexp/quantified-assertions_test: RuntimeError # Issue 29921
+regexp/range-bound-ffff_test: RuntimeError # Issue 29921
+regexp/range-out-of-order_test: RuntimeError # Issue 29921
+regexp/ranges-and-escaped-hyphens_test: RuntimeError # Issue 29921
+regexp/regress-6-9-regexp_test: RuntimeError # Issue 29921
+regexp/regress-regexp-codeflush_test: RuntimeError # Issue 29921
+regexp/regress-regexp-construct-result_test: RuntimeError # Issue 29921
+regexp/repeat-match-waldemar_test: RuntimeError # Issue 29921
+regexp/results-cache_test: RuntimeError # Issue 29921
+regexp/stack-overflow2_test: RuntimeError # Issue 29921
+regexp/stack-overflow_test: RuntimeError # Issue 29921
+regexp/unicode-handling_test: RuntimeError # Issue 29921
+regexp/zero-length-alternatives_test: RuntimeError # Issue 29921
+regress_r21715_test: RuntimeError # Issue 29921
+string_operations_with_null_test: RuntimeError # Issue 29921
+symbol_operator_test/03: RuntimeError # Issue 29921
+symbol_reserved_word_test/06: RuntimeError # Issue 29921
+symbol_reserved_word_test/09: RuntimeError # Issue 29921
+symbol_reserved_word_test/12: RuntimeError # Issue 29921
+symbol_test/none: RuntimeError # Issue 29921
+typed_data_with_limited_ints_test: Skip # Requires fixed-size int64 support.
+uri_parse_test: Pass, Slow
+
[ $compiler == precompiler || $runtime == vm && !$checked && !$strong ]
int_parse_radix_test/badTypes: RuntimeError # wrong exception returned
diff --git a/tests/html/html.status b/tests/html/html.status
index 0003482..3e1f490 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -159,9 +159,6 @@
[ $strong ]
*: SkipByDesign
-[ $compiler == dart2analyzer && $strong ]
-*: Skip # Issue 28649
-
[ $compiler == dart2js && $runtime == chrome ]
element_animate_test/timing_dict: RuntimeError # Issue 26730
element_classes_test: RuntimeError # Issue 30291
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index 1c23b98..5b370c1 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -42,9 +42,6 @@
[ $strong ]
*: SkipByDesign
-[ $compiler == dart2analyzer && $strong ]
-*: Skip # Issue 28649
-
[ $compiler == none && $runtime == vm && $system == fuchsia ]
*: Skip # Not yet triaged.
diff --git a/tests/kernel/kernel.status b/tests/kernel/kernel.status
index dea875e..f5cd37f 100644
--- a/tests/kernel/kernel.status
+++ b/tests/kernel/kernel.status
@@ -18,7 +18,8 @@
unsorted/super_mixin_test: CompileTimeError
[ $compiler == dart2analyzer && $strong ]
-*: Skip # Issue 28649
+unsorted/klass_field_initializer_test: CompileTimeError
+unsorted/super_initializer_test: CompileTimeError
[ $compiler == dart2js && $fasta ]
unsorted/super_mixin_test: RuntimeError
diff --git a/tests/language/language_kernel.status b/tests/language/language_kernel.status
index ca82ca7..1dfe445 100644
--- a/tests/language/language_kernel.status
+++ b/tests/language/language_kernel.status
@@ -3,6 +3,8 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == fasta ]
+bad_constructor_test/04: MissingCompileTimeError
+bad_constructor_test/06: MissingCompileTimeError
function_type_parameter2_negative_test: Fail
function_type_parameter_negative_test: Fail
prefix5_negative_test: Fail
diff --git a/tests/language_2/bad_constructor_test.dart b/tests/language_2/bad_constructor_test.dart
index 429da88..4ae6751 100644
--- a/tests/language_2/bad_constructor_test.dart
+++ b/tests/language_2/bad_constructor_test.dart
@@ -14,24 +14,6 @@
factory B() { return null; }
}
-// A named constructor can't have the same name as a field.
-class C {
- var field;
- C
- .field //# 04: compile-time error
- ();
- C.good();
-}
-
-// A named constructor can't have the same name as a method.
-class D {
- method() {}
- D
- .method //# 06: compile-time error
- ();
- D.good();
-}
-
// A named constructor can have the same name as a setter.
class E {
set setter(value) {} //# 05: ok
@@ -47,8 +29,6 @@
main() {
new A();
new B();
- new C.good();
- new D.good();
new E.setter();
new F();
}
diff --git a/tests/language_2/check_member_static_test.dart b/tests/language_2/check_member_static_test.dart
index 7f662eb..90aba31 100644
--- a/tests/language_2/check_member_static_test.dart
+++ b/tests/language_2/check_member_static_test.dart
@@ -10,7 +10,7 @@
class B extends A {}
class C extends B {
- var a; //# 01: compile-time error
+ var a; //# 01: ok
static var b; //# 02: compile-time error
}
diff --git a/tests/language_2/language_2.status b/tests/language_2/language_2.status
index fdece1b..0572c2e 100644
--- a/tests/language_2/language_2.status
+++ b/tests/language_2/language_2.status
@@ -354,5 +354,6 @@
regress_23408_test: Crash # Requires deferred libraries
regress_28278_test: Crash # Requires deferred libraries
static_closure_identical_test: Pass, Fail # Closure identity
+symbol_conflict_test: Pass, Timeout
vm/optimized_stacktrace_test: Pass, Slow
vm/regress_27201_test: Pass, Crash # Requires deferred libraries
diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status
index 8c33ba2..42452d8 100644
--- a/tests/language_2/language_2_analyzer.status
+++ b/tests/language_2/language_2_analyzer.status
@@ -57,6 +57,12 @@
void_type_function_types_test/08: MissingCompileTimeError
void_type_function_types_test/none: Pass
+[ $compiler == dart2analyzer && $fasta ]
+compile_time_constant_static5_test/11: CompileTimeError # Issue 31537
+compile_time_constant_static5_test/16: CompileTimeError # Issue 31537
+compile_time_constant_static5_test/21: CompileTimeError # Issue 31537
+compile_time_constant_static5_test/23: CompileTimeError # Issue 31402
+
[ $compiler == dart2analyzer && !$fasta ]
abstract_override_adds_optional_args_concrete_subclass_test: MissingCompileTimeError # Issue #30568
abstract_override_adds_optional_args_concrete_test: MissingCompileTimeError # Issue #30568
@@ -64,6 +70,7 @@
bad_initializer2_negative_test: Fail # Issue 14880
built_in_identifier_prefix_test: CompileTimeError
built_in_identifier_type_annotation_test/dynamic-gen: MissingCompileTimeError # Issue 28813
+check_member_static_test/01: CompileTimeError
config_import_corelib_test: StaticWarning, OK
conflicting_type_variable_and_setter_test: CompileTimeError # Issue 25525
const_cast2_test/01: CompileTimeError
@@ -90,7 +97,6 @@
final_syntax_test/04: Fail # Issue 11124
function_type_parameter2_negative_test: CompileTimeError
function_type_parameter_negative_test: CompileTimeError
-generic_function_type_as_type_argument_test/02: MissingCompileTimeError # Issue 30929
generic_local_functions_test: CompileTimeError # Issue 28515
generic_methods_generic_function_parameter_test: CompileTimeError # Issue 28515
generic_no_such_method_dispatcher_simple_test: Skip # This test is just for kernel.
@@ -168,6 +174,18 @@
regress_29349_test: CompileTimeError # Issue 29744
regress_29405_test: CompileTimeError # Issue 29421
regress_29784_test/02: MissingCompileTimeError # Issue 29784
+regress_33235_03_test/01: MissingCompileTimeError
+regress_33235_07_test/03: MissingCompileTimeError
+regress_33235_10_test/01: MissingCompileTimeError
+regress_33235_10_test/02: MissingCompileTimeError
+regress_33235_10_test/03: MissingCompileTimeError
+regress_33235_11_test/01: MissingCompileTimeError
+regress_33235_12_test/03: MissingCompileTimeError
+regress_33235_13_test/03: MissingCompileTimeError
+regress_33235_16_test/02: MissingCompileTimeError
+regress_33235_16_test/03: MissingCompileTimeError
+regress_33235_19_test: CompileTimeError
+regress_33235_20_test: CompileTimeError
script1_negative_test: CompileTimeError
script2_negative_test: CompileTimeError
setter_declaration2_negative_test: CompileTimeError
@@ -201,16 +219,12 @@
vm/regress_33469_test/01: Crash # http://dartbug.com/33481
vm/regress_33469_test/02: Crash # http://dartbug.com/33481
vm/regress_33469_test/03: MissingCompileTimeError # http://dartbug.com/33481
-void_type_override_test/00: MissingCompileTimeError
-void_type_override_test/00b: MissingCompileTimeError
-void_type_override_test/01: MissingCompileTimeError
void_type_override_test/02: MissingCompileTimeError
void_type_override_test/03: MissingCompileTimeError
void_type_usage_test/call_conditional: MissingCompileTimeError
void_type_usage_test/call_literal_list_init: MissingCompileTimeError
void_type_usage_test/call_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/call_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/call_return: MissingCompileTimeError
void_type_usage_test/call_void_init: MissingCompileTimeError
void_type_usage_test/conditional2_conditional: MissingCompileTimeError
void_type_usage_test/conditional2_for: MissingCompileTimeError
@@ -247,51 +261,41 @@
void_type_usage_test/final_local_literal_list_init: MissingCompileTimeError
void_type_usage_test/final_local_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/final_local_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/final_local_return: MissingCompileTimeError
void_type_usage_test/final_local_void_init: MissingCompileTimeError
void_type_usage_test/global_conditional: MissingCompileTimeError
void_type_usage_test/global_literal_list_init: MissingCompileTimeError
void_type_usage_test/global_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/global_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/global_return: MissingCompileTimeError
void_type_usage_test/global_void_init: MissingCompileTimeError
void_type_usage_test/instance2_conditional: MissingCompileTimeError
-void_type_usage_test/instance2_for_in2: MissingCompileTimeError
void_type_usage_test/instance2_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance2_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/instance2_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance2_return: MissingCompileTimeError
void_type_usage_test/instance2_void_init: MissingCompileTimeError
void_type_usage_test/instance3_conditional: MissingCompileTimeError
-void_type_usage_test/instance3_for_in2: MissingCompileTimeError
void_type_usage_test/instance3_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance3_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/instance3_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance3_return: MissingCompileTimeError
void_type_usage_test/instance3_void_init: MissingCompileTimeError
void_type_usage_test/instance_conditional: MissingCompileTimeError
void_type_usage_test/instance_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/instance_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance_return: MissingCompileTimeError
void_type_usage_test/instance_void_init: MissingCompileTimeError
void_type_usage_test/local_conditional: MissingCompileTimeError
void_type_usage_test/local_literal_list_init: MissingCompileTimeError
void_type_usage_test/local_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/local_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/local_return: MissingCompileTimeError
void_type_usage_test/local_void_init: MissingCompileTimeError
void_type_usage_test/param_conditional: MissingCompileTimeError
void_type_usage_test/param_literal_list_init: MissingCompileTimeError
void_type_usage_test/param_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/param_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/param_return: MissingCompileTimeError
void_type_usage_test/param_void_init: MissingCompileTimeError
void_type_usage_test/paren_conditional: MissingCompileTimeError
void_type_usage_test/paren_literal_list_init: MissingCompileTimeError
void_type_usage_test/paren_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/paren_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/paren_return: MissingCompileTimeError
void_type_usage_test/paren_void_init: MissingCompileTimeError
web_int_literals_test/01: MissingCompileTimeError
web_int_literals_test/02: MissingCompileTimeError
@@ -399,10 +403,6 @@
override_inheritance_field_test/26: CompileTimeError
override_inheritance_field_test/29: CompileTimeError
override_inheritance_field_test/42: CompileTimeError
-override_inheritance_field_test/43: CompileTimeError
-override_inheritance_field_test/45: CompileTimeError
-override_inheritance_field_test/49: CompileTimeError
-override_inheritance_field_test/50: CompileTimeError
override_inheritance_generic_test/02: CompileTimeError
override_inheritance_method_test/28: CompileTimeError
override_inheritance_method_test/29: CompileTimeError
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index 4a641cd..329ec9c 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -48,9 +48,6 @@
field_type_check2_test/01: MissingRuntimeError
round_test: Pass, Fail, OK # Fixed in ff 35. Common JavaScript engine Math.round bug.
-[ $compiler == dart2js && $runtime == ff && $strong ]
-call_function_test: RuntimeError
-
[ $compiler == dart2js && $runtime == jsshell ]
async_call_test: RuntimeError # Timer interface not supported: Issue 7728.
async_star_await_pauses_test: RuntimeError # Need triage
@@ -149,6 +146,7 @@
round_test: Fail, OK # Common JavaScript engine Math.round bug.
[ $compiler == dart2js && $runtime == safari && $strong ]
+async_throw_in_catch_test/none: Pass, RuntimeError
stacktrace_test: RuntimeError
[ $compiler == dart2js && $system == windows ]
@@ -571,7 +569,6 @@
await_not_started_immediately_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
-check_member_static_test/01: MissingCompileTimeError
class_literal_static_test/01: MissingCompileTimeError
class_literal_static_test/03: MissingCompileTimeError
class_literal_static_test/07: MissingCompileTimeError
@@ -592,10 +589,7 @@
f_bounded_quantification_test/02: MissingCompileTimeError
factory4_test/00: MissingCompileTimeError
field3_test/01: MissingCompileTimeError
-field_override_test/00: MissingCompileTimeError
-field_override_test/01: MissingCompileTimeError
generic_methods_bounds_test/01: MissingCompileTimeError
-generic_methods_overriding_test/01: MissingCompileTimeError
generic_methods_recursive_bound_test/02: MissingCompileTimeError
generic_methods_unused_parameter_test: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
identical_const_test/01: MissingCompileTimeError
@@ -604,8 +598,6 @@
identical_const_test/04: MissingCompileTimeError
issue18628_2_test/01: MissingCompileTimeError
issue23244_test: Crash # 'file:*/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart': Failed assertion: line 208 pos 18: '!(_useKernel && _strongMode && !_disableRtiOptimization) ||
-issue31596_override_test/07: MissingCompileTimeError
-issue31596_override_test/08: MissingCompileTimeError
library_env_test/has_no_html_support: RuntimeError
library_env_test/has_no_io_support: RuntimeError
malbounded_instantiation_test/01: MissingCompileTimeError
@@ -657,11 +649,6 @@
named_constructor_test/01: MissingCompileTimeError
override_field_test/02: MissingCompileTimeError
override_field_test/03: MissingCompileTimeError
-override_inheritance_field_test/44: MissingCompileTimeError
-override_inheritance_field_test/47: MissingCompileTimeError
-override_inheritance_field_test/48: MissingCompileTimeError
-override_inheritance_field_test/53: MissingCompileTimeError
-override_inheritance_field_test/54: MissingCompileTimeError
partial_tearoff_instantiation_test/05: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
partial_tearoff_instantiation_test/06: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
partial_tearoff_instantiation_test/07: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
@@ -670,7 +657,6 @@
redirecting_factory_malbounded_test/01: MissingCompileTimeError
regress_13462_1_test: RuntimeError
regress_18535_test: RuntimeError
-setter4_test: MissingCompileTimeError
sync_generator2_test/41: Crash # 'file:*/pkg/compiler/lib/src/kernel/element_map_impl.dart': Failed assertion: line 939 pos 18: 'asyncMarker == AsyncMarker.SYNC': is not true.
sync_generator2_test/52: Crash # 'file:*/pkg/compiler/lib/src/kernel/element_map_impl.dart': Failed assertion: line 939 pos 18: 'asyncMarker == AsyncMarker.SYNC': is not true.
type_literal_prefix_call_test/00: MissingCompileTimeError
@@ -774,7 +760,6 @@
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
call_with_no_such_method_test: RuntimeError
-check_member_static_test/01: MissingCompileTimeError
class_literal_static_test/01: MissingCompileTimeError
class_literal_static_test/03: MissingCompileTimeError
class_literal_static_test/07: MissingCompileTimeError
@@ -794,10 +779,7 @@
f_bounded_quantification_test/02: MissingCompileTimeError
factory4_test/00: MissingCompileTimeError
field3_test/01: MissingCompileTimeError
-field_override_test/00: MissingCompileTimeError
-field_override_test/01: MissingCompileTimeError
generic_methods_bounds_test/01: MissingCompileTimeError
-generic_methods_overriding_test/01: MissingCompileTimeError
generic_methods_recursive_bound_test/02: MissingCompileTimeError
identical_const_test/01: MissingCompileTimeError
identical_const_test/02: MissingCompileTimeError
@@ -807,8 +789,6 @@
invocation_mirror_test: RuntimeError
issue18628_2_test/01: MissingCompileTimeError
issue23244_test: Crash # Interpolated value #1 is not an Expression or List of Expressions: [VariableUse(f), Instance of 'LiteralNull', null]
-issue31596_override_test/07: MissingCompileTimeError
-issue31596_override_test/08: MissingCompileTimeError
library_env_test/has_no_html_support: RuntimeError
library_env_test/has_no_io_support: RuntimeError
malbounded_instantiation_test/01: MissingCompileTimeError
@@ -866,18 +846,12 @@
overridden_no_such_method_test: RuntimeError
override_field_test/02: MissingCompileTimeError
override_field_test/03: MissingCompileTimeError
-override_inheritance_field_test/44: MissingCompileTimeError
-override_inheritance_field_test/47: MissingCompileTimeError
-override_inheritance_field_test/48: MissingCompileTimeError
-override_inheritance_field_test/53: MissingCompileTimeError
-override_inheritance_field_test/54: MissingCompileTimeError
recursive_generic_test: RuntimeError
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
redirecting_factory_malbounded_test/01: MissingCompileTimeError
regress_13462_1_test: RuntimeError
regress_18535_test: RuntimeError
regress_21795_test: RuntimeError # Issue 12605
-setter4_test: MissingCompileTimeError
stack_trace_test: RuntimeError, OK # Stack trace not preserved in minified code.
symbol_conflict_test: RuntimeError # Issue 23857
type_literal_prefix_call_test/00: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index 015334b..1285c54 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -28,6 +28,7 @@
built_in_identifier_type_annotation_test/dynamic-list: RuntimeError # Issue 28816
cascaded_forwarding_stubs_generic_test: RuntimeError
cascaded_forwarding_stubs_test: CompileTimeError
+check_member_static_test/01: CompileTimeError
conflicting_generic_interfaces_hierarchy_loop_infinite_test: Skip # Crashes or times out
conflicting_generic_interfaces_simple_test: MissingCompileTimeError
conflicting_type_variable_and_setter_test: CompileTimeError
@@ -133,10 +134,6 @@
override_inheritance_field_test/26: CompileTimeError
override_inheritance_field_test/29: CompileTimeError
override_inheritance_field_test/42: CompileTimeError
-override_inheritance_field_test/43: CompileTimeError
-override_inheritance_field_test/45: CompileTimeError
-override_inheritance_field_test/49: CompileTimeError
-override_inheritance_field_test/50: CompileTimeError
override_inheritance_generic_test/02: CompileTimeError
override_inheritance_method_test/28: CompileTimeError
override_inheritance_method_test/29: CompileTimeError
@@ -149,10 +146,22 @@
regress_29025_test: CompileTimeError # Issue 29081
regress_29349_test: CompileTimeError # Issue 31093
regress_29405_test: CompileTimeError # Issue 29421
-regress_29784_test/02: Crash # assert initializers not implemented
regress_29784_test/02: MissingCompileTimeError
+regress_29784_test/02: Crash # assert initializers not implemented
regress_30121_test: CompileTimeError # Issue 31087
regress_30339_test: CompileTimeError # As expected. Should we make this a multi test?
+regress_33235_03_test/01: MissingCompileTimeError
+regress_33235_07_test/03: MissingCompileTimeError
+regress_33235_10_test/01: MissingCompileTimeError
+regress_33235_10_test/02: MissingCompileTimeError
+regress_33235_10_test/03: MissingCompileTimeError
+regress_33235_11_test/01: MissingCompileTimeError
+regress_33235_12_test/03: MissingCompileTimeError
+regress_33235_13_test/03: MissingCompileTimeError
+regress_33235_16_test/02: MissingCompileTimeError
+regress_33235_16_test/03: MissingCompileTimeError
+regress_33235_19_test: CompileTimeError
+regress_33235_20_test: CompileTimeError
setter_override2_test/02: MissingCompileTimeError # Issue 14736
stacktrace_test: RuntimeError # Issue 29920
static_setter_conflicts_test/02: MissingCompileTimeError
@@ -192,16 +201,12 @@
void_type_callbacks_test/00: MissingCompileTimeError # Issue 30514
void_type_callbacks_test/01: MissingCompileTimeError
void_type_function_types_test/none: CompileTimeError # Issue 30514
-void_type_override_test/00: MissingCompileTimeError
-void_type_override_test/00b: MissingCompileTimeError
-void_type_override_test/01: MissingCompileTimeError
void_type_override_test/02: MissingCompileTimeError
void_type_override_test/03: MissingCompileTimeError
void_type_usage_test/call_conditional: MissingCompileTimeError
void_type_usage_test/call_literal_list_init: MissingCompileTimeError
void_type_usage_test/call_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/call_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/call_return: MissingCompileTimeError
void_type_usage_test/call_void_init: MissingCompileTimeError
void_type_usage_test/conditional2_conditional: MissingCompileTimeError
void_type_usage_test/conditional2_for: MissingCompileTimeError
@@ -238,89 +243,51 @@
void_type_usage_test/final_local_literal_list_init: MissingCompileTimeError
void_type_usage_test/final_local_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/final_local_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/final_local_return: MissingCompileTimeError
void_type_usage_test/final_local_void_init: MissingCompileTimeError
void_type_usage_test/global_conditional: MissingCompileTimeError
void_type_usage_test/global_literal_list_init: MissingCompileTimeError
void_type_usage_test/global_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/global_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/global_return: MissingCompileTimeError
void_type_usage_test/global_void_init: MissingCompileTimeError
void_type_usage_test/instance2_conditional: MissingCompileTimeError
-void_type_usage_test/instance2_for_in2: MissingCompileTimeError
void_type_usage_test/instance2_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance2_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/instance2_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance2_return: MissingCompileTimeError
void_type_usage_test/instance2_void_init: MissingCompileTimeError
void_type_usage_test/instance3_conditional: MissingCompileTimeError
-void_type_usage_test/instance3_for_in2: MissingCompileTimeError
void_type_usage_test/instance3_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance3_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/instance3_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance3_return: MissingCompileTimeError
void_type_usage_test/instance3_void_init: MissingCompileTimeError
void_type_usage_test/instance_conditional: MissingCompileTimeError
void_type_usage_test/instance_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/instance_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance_return: MissingCompileTimeError
void_type_usage_test/instance_void_init: MissingCompileTimeError
void_type_usage_test/local_conditional: MissingCompileTimeError
void_type_usage_test/local_literal_list_init: MissingCompileTimeError
void_type_usage_test/local_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/local_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/local_return: MissingCompileTimeError
void_type_usage_test/local_void_init: MissingCompileTimeError
void_type_usage_test/param_conditional: MissingCompileTimeError
void_type_usage_test/param_literal_list_init: MissingCompileTimeError
void_type_usage_test/param_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/param_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/param_return: MissingCompileTimeError
void_type_usage_test/param_void_init: MissingCompileTimeError
void_type_usage_test/paren_conditional: MissingCompileTimeError
void_type_usage_test/paren_literal_list_init: MissingCompileTimeError
void_type_usage_test/paren_literal_map_key_init: MissingCompileTimeError
void_type_usage_test/paren_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/paren_return: MissingCompileTimeError
void_type_usage_test/paren_void_init: MissingCompileTimeError
-web_int_literals_test/01: MissingCompileTimeError
-web_int_literals_test/02: MissingCompileTimeError
-web_int_literals_test/03: MissingCompileTimeError
-web_int_literals_test/10: MissingCompileTimeError
-web_int_literals_test/11: MissingCompileTimeError
-web_int_literals_test/12: MissingCompileTimeError
-web_int_literals_test/13: MissingCompileTimeError
-web_int_literals_test/14: MissingCompileTimeError
-web_int_literals_test/20: MissingCompileTimeError
-web_int_literals_test/21: MissingCompileTimeError
-web_int_literals_test/22: MissingCompileTimeError
-web_int_literals_test/23: MissingCompileTimeError
-web_int_literals_test/24: MissingCompileTimeError
-web_int_literals_test/25: MissingCompileTimeError
-web_int_literals_test/26: MissingCompileTimeError
-web_int_literals_test/27: MissingCompileTimeError
-web_int_literals_test/28: MissingCompileTimeError
-web_int_literals_test/29: MissingCompileTimeError
-web_int_literals_test/61: MissingCompileTimeError
-web_int_literals_test/62: MissingCompileTimeError
-web_int_literals_test/63: MissingCompileTimeError
-web_int_literals_test/64: MissingCompileTimeError
-web_int_literals_test/65: MissingCompileTimeError
-web_int_literals_test/70: MissingCompileTimeError
[ $compiler == dartdevk ]
additional_interface_adds_optional_args_concrete_subclass_test: MissingCompileTimeError
additional_interface_adds_optional_args_concrete_test: MissingCompileTimeError
-arithmetic_int64_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
async_or_generator_return_type_stacktrace_test/01: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError
async_return_types_test/nestedFuture: MissingCompileTimeError
async_return_types_test/wrongReturnType: MissingCompileTimeError
-bit_operations_test/03: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-bit_operations_test/04: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-bit_operations_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
built_in_identifier_type_annotation_test/dynamic-funarg: RuntimeError # Issue 30450, test name contains hyphen
built_in_identifier_type_annotation_test/dynamic-funret: RuntimeError # Issue 30450, test name contains hyphen
built_in_identifier_type_annotation_test/dynamic-list: RuntimeError # Issue 30450, test name contains hyphen
@@ -331,7 +298,6 @@
call_method_must_not_be_getter_test/06: RuntimeError # Kernel does not distinguish `d()` from `d.call()`
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
-check_member_static_test/01: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
class_cycle_test/03: MissingCompileTimeError
compile_time_constant_c_test/02: MissingCompileTimeError
@@ -376,8 +342,6 @@
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
deferred_inheritance_constraints_test/redirecting_constructor: MissingCompileTimeError
deferred_load_library_wrong_args_test/01: CompileTimeError
-deopt_inlined_function_lazy_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-deopt_smi_op_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
double_identical_test: RuntimeError # Negative and positive zero are distinct, but not in ddk
duplicate_implements_test/01: MissingCompileTimeError
duplicate_implements_test/02: MissingCompileTimeError
@@ -391,21 +355,17 @@
f_bounded_quantification_test/02: MissingCompileTimeError
factory4_test/00: MissingCompileTimeError
field_initialization_order_test/01: MissingCompileTimeError
-field_override_test/00: MissingCompileTimeError
-field_override_test/01: MissingCompileTimeError
function_propagation_test: RuntimeError
function_type_parameter2_negative_test: Fail
function_type_parameter_negative_test: Fail
generic_function_bounds_test: RuntimeError
generic_function_type_as_type_argument_test/01: MissingCompileTimeError # Issue 29920
+generic_function_type_as_type_argument_test/02: MissingCompileTimeError # Issue 29920
generic_methods_generic_function_result_test/01: MissingCompileTimeError
-generic_methods_overriding_test/01: MissingCompileTimeError # Issue 29920
generic_methods_recursive_bound_test/02: MissingCompileTimeError
generic_no_such_method_dispatcher_simple_test: CompileTimeError # Warning: Superclass has no method named 'foo'.
generic_no_such_method_dispatcher_test: CompileTimeError # Issue 31533
generic_test/01: MissingCompileTimeError # front end does not validate `extends`
-guess_cid_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-identical_closure2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
identical_const_test/01: MissingCompileTimeError
identical_const_test/02: MissingCompileTimeError
identical_const_test/03: MissingCompileTimeError
@@ -422,16 +382,12 @@
implicit_creation/implicit_const_not_default_values_test/e6: Pass
implicit_creation/implicit_const_not_default_values_test/e9: Pass
instantiate_tearoff_of_call_test: CompileTimeError
-int2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
issue18628_2_test/01: MissingCompileTimeError
-issue31596_override_test/07: MissingCompileTimeError
-issue31596_override_test/08: MissingCompileTimeError
issue31596_super_test/01: CompileTimeError
issue31596_super_test/02: MissingCompileTimeError
issue31596_super_test/03: CompileTimeError
issue31596_super_test/04: MissingCompileTimeError
issue31596_super_test/05: RuntimeError
-list_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
malbounded_instantiation_test/01: MissingCompileTimeError
malbounded_instantiation_test/02: MissingCompileTimeError
malbounded_instantiation_test/03: MissingCompileTimeError
@@ -452,9 +408,6 @@
map_literal3_test/02: MissingCompileTimeError
map_literal3_test/03: MissingCompileTimeError
method_override_test: CompileTimeError # Issue 31616
-mint_arithmetic_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-mint_compares_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-mint_identical_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
mixin_forwarding_constructor4_test/01: MissingCompileTimeError
mixin_forwarding_constructor4_test/02: MissingCompileTimeError
mixin_forwarding_constructor4_test/03: MissingCompileTimeError
@@ -535,17 +488,11 @@
named_parameters_default_eq_test/02: MissingCompileTimeError
no_such_method_mock_test: RuntimeError # Issue 31426 - Kernel does not introduce nSM for implemented fields.
null_no_such_method_test: CompileTimeError # Issue 31533
-number_identity_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
override_field_test/02: MissingCompileTimeError
override_inheritance_field_test/04: CompileTimeError # Issue 31616
override_inheritance_field_test/06: CompileTimeError # Issue 31616
override_inheritance_field_test/26: CompileTimeError # Issue 31616
override_inheritance_field_test/29: CompileTimeError # Issue 31616
-override_inheritance_field_test/44: MissingCompileTimeError
-override_inheritance_field_test/47: MissingCompileTimeError
-override_inheritance_field_test/48: MissingCompileTimeError
-override_inheritance_field_test/53: MissingCompileTimeError
-override_inheritance_field_test/54: MissingCompileTimeError
override_inheritance_generic_test/02: CompileTimeError # Issue 31616
override_inheritance_method_test/28: CompileTimeError # Issue 31616
override_inheritance_method_test/29: CompileTimeError # Issue 31616
@@ -562,7 +509,6 @@
regress_29784_test/02: MissingCompileTimeError
regress_30339_test: RuntimeError # Uncaught Expect.isTrue(false) fails.
regress_30339_test: CompileTimeError
-setter4_test: MissingCompileTimeError
setter_no_getter_test/01: CompileTimeError
string_split_test: CompileTimeError # Issue 31616
string_supertype_checked_test: CompileTimeError # Issue 31616
@@ -616,6 +562,7 @@
[ $compiler == dartdevc || $compiler == dartdevk ]
abstract_override_adds_optional_args_concrete_subclass_test: MissingCompileTimeError # Issue #30568
abstract_override_adds_optional_args_concrete_test: MissingCompileTimeError # Issue #30568
+arithmetic_int64_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
async_covariant_type_test: RuntimeError # Check too late
async_star_cancel_while_paused_test: RuntimeError # Issue 29920; Uncaught Expect.listEquals(list length, expected: <4>, actual: <3>) fails: Next element <*3>
async_star_pause_test: RuntimeError # Uncaught Expect.listEquals(at index 2, expected: <0+>, actual: <0!>) fails
@@ -625,6 +572,9 @@
bit_operations_test: RuntimeError # No bigints on web.; Expect.equals(expected: <-25>, actual: <4294967271>) fails.
bit_operations_test/01: MissingCompileTimeError
bit_operations_test/02: MissingCompileTimeError
+bit_operations_test/03: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+bit_operations_test/04: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+bit_operations_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
branch_canonicalization_test: RuntimeError # Issue 29920; Expect.equals(expected: <0>, actual: <1>) fails.
built_in_identifier_prefix_test: CompileTimeError
canonical_const2_test: RuntimeError # Ints and doubles are unified.; Expect.isFalse(true) fails.
@@ -652,6 +602,8 @@
deferred_not_loaded_check_test: RuntimeError # Issue 27777; Expect.throws fails: Did not throw
deferred_redirecting_factory_test: RuntimeError # Issue 27777; Uncaught Expect.throws fails: Did not throw
deferred_static_seperate_test: RuntimeError # Issue 27777; Expect.throws fails: Did not throw
+deopt_inlined_function_lazy_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+deopt_smi_op_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
double_int_to_string_test: RuntimeError # Issue 29920; Expect.equals(expected: <0.0>, actual: <0>) fails.
double_to_string_as_fixed2_test/none: RuntimeError # Issue 29920; Expect.throws(ArgumentError) fails: Did not throw
example_constructor_test: RuntimeError # Expect.equals(expected: <0 1 2 3 4 5 6 >, actual: <0 3 4 1 2 5 6 >) fails.
@@ -667,14 +619,16 @@
flatten_test/12: MissingRuntimeError # Issue 29920
for_variable_capture_test: RuntimeError # Issue 29920; Expect.equals(expected: <1>, actual: <0>) fails.
function_subtype_inline2_test: RuntimeError # Expect.fail('Missing type error: 'new C.c1(m2)'.')
-generic_function_type_as_type_argument_test/02: MissingCompileTimeError # Issue 29920
generic_instanceof2_test: RuntimeError # Issue 29920; ReferenceError: FooOfK$String is not defined
generic_is_check_test: RuntimeError # Issue 29920; Expect.isTrue(false) fails.
generic_tearoff_test: CompileTimeError
+guess_cid_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+identical_closure2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
identical_closure2_test: RuntimeError # Issue 29920; Expect.isFalse(true) fails.
infinite_switch_label_test: RuntimeError # Issue 29920; NoSuchMethodError: method not found: '<Unexpected Null Value>'
infinity_test: RuntimeError # Issue 29920; Expect.isFalse(true) fails.
instance_creation_in_function_annotation_test: RuntimeError # Issue 29920; UnimplementedError: JsClosureMirror.function unimplemented
+int2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
int64_literal_test/*: Skip # This is testing Dart 2.0 int64 semantics.
integer_division_by_zero_test: RuntimeError # Issue 29920; Expect.throws: Unexpected 'Unsupported operation: Infinity'
internal_library_test/02: Crash
@@ -687,10 +641,14 @@
library_env_test/has_io_support: RuntimeError, OK # Intended to fail, bool.fromEnvironment("dart.library.async") is false
library_env_test/has_mirror_support: RuntimeError, OK # Intended to fail, bool.fromEnvironment("dart.library.async") is false
library_env_test/has_no_html_support: RuntimeError, OK # Intended to fail, bool.fromEnvironment("dart.library.async") is false
+list_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
local_function2_test/none: RuntimeError # ReferenceError: TToNull is not defined
local_function3_test/none: RuntimeError # Expect.equals(expected: <true>, actual: <false>) fails.
local_function_test/none: RuntimeError # Expect.equals(expected: <true>, actual: <false>) fails.
+mint_arithmetic_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
mint_arithmetic_test: RuntimeError # Issue 29920; Expect.equals(expected: <4294967297>, actual: <1>) fails.
+mint_compares_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+mint_identical_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
modulo_test: RuntimeError # Ints and doubles are unified.; Expect.throws fails: Did not throw
multiline_newline_test/04: MissingCompileTimeError
multiline_newline_test/04r: MissingCompileTimeError
@@ -701,6 +659,7 @@
nested_switch_label_test: RuntimeError # Issue 29920; UnimplementedError: node <ShadowContinueSwitchStatement> see https://github.com/dart-lang/sdk/issues/29352 `continue #L1;
null_test/mirrors: RuntimeError # Uses mirrors.; ReferenceError: GenericOfT is not defined
number_identity2_test: RuntimeError # Issue 29920; Expect.isTrue(false) fails.
+number_identity_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
numbers_test: RuntimeError # Issue 29920; Expect.equals(expected: <false>, actual: <true>) fails.
override_field_test/03: MissingCompileTimeError
parser_quirks_test: CompileTimeError
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 9bf1bcbc..cdaf95b 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -228,7 +228,6 @@
async_return_types_test/wrongReturnType: MissingCompileTimeError # Issue 33068
call_non_method_field_test/01: MissingCompileTimeError # Issue 32975
call_non_method_field_test/02: MissingCompileTimeError # Issue 32975
-check_member_static_test/01: MissingCompileTimeError # Issue 32613
const_cast2_test/01: CompileTimeError # Issue 32517
const_cast2_test/none: CompileTimeError # Issue 32517
const_instance_field_test/01: MissingCompileTimeError # Fasta bug: Const instance field. Issue 32326.
@@ -254,13 +253,8 @@
factory4_test/00: MissingCompileTimeError # Issue 32988
field3_test/01: MissingCompileTimeError # Issue 33022
field3_test/02: MissingCompileTimeError # Issue 33022
-field_override_test/00: MissingCompileTimeError # Issue 32613
-field_override_test/01: MissingCompileTimeError # Issue 32613
generic_methods_bounds_test/01: MissingCompileTimeError # Issue 33018
-generic_methods_overriding_test/01: MissingCompileTimeError # Issue 32613
generic_methods_recursive_bound_test/02: MissingCompileTimeError # Issue 33018
-issue31596_override_test/07: MissingCompileTimeError
-issue31596_override_test/08: MissingCompileTimeError
issue31596_super_test/02: MissingCompileTimeError
issue31596_super_test/04: MissingCompileTimeError
malbounded_instantiation_test/01: MissingCompileTimeError # Issue 33018
@@ -315,11 +309,6 @@
named_parameters_default_eq_test/02: MissingCompileTimeError # Fasta bug: Default values are not allowed on redirecting factory constructors.
override_field_test/02: MissingCompileTimeError
override_field_test/03: MissingCompileTimeError
-override_inheritance_field_test/44: MissingCompileTimeError
-override_inheritance_field_test/47: MissingCompileTimeError
-override_inheritance_field_test/48: MissingCompileTimeError
-override_inheritance_field_test/53: MissingCompileTimeError
-override_inheritance_field_test/54: MissingCompileTimeError
partial_tearoff_instantiation_test/05: MissingCompileTimeError
partial_tearoff_instantiation_test/06: MissingCompileTimeError
partial_tearoff_instantiation_test/07: MissingCompileTimeError
@@ -330,7 +319,6 @@
regress_27617_test/1: MissingCompileTimeError # Fasta bug: Bad constructor redirection.
regress_29784_test/01: MissingCompileTimeError
regress_29784_test/02: MissingCompileTimeError
-setter4_test: MissingCompileTimeError # Issue 14736
switch_bad_case_test/01: MissingCompileTimeError # KernelVM bug: Constant evaluation.
switch_bad_case_test/02: MissingCompileTimeError # KernelVM bug: Constant evaluation.
switch_case_test/00: MissingCompileTimeError # KernelVM bug: Constant evaluation.
@@ -363,10 +351,6 @@
void_type_function_types_test/04: MissingCompileTimeError # Issue 32804
void_type_function_types_test/06: MissingCompileTimeError # Issue 32804
void_type_function_types_test/08: MissingCompileTimeError # Issue 32804
-void_type_override_test/00: MissingCompileTimeError # Issue 32804
-void_type_override_test/00b: MissingCompileTimeError # Issue 32804
-void_type_override_test/00c: MissingCompileTimeError # Issue 32804
-void_type_override_test/01: MissingCompileTimeError # Issue 32804
void_type_override_test/03: MissingCompileTimeError # Issue 32804
void_type_usage_test/call_argument: MissingCompileTimeError # Issue 32804
void_type_usage_test/call_cascade: MissingCompileTimeError # Issue 32804
@@ -476,7 +460,6 @@
void_type_usage_test/instance2_do_while: MissingCompileTimeError # Issue 32804
void_type_usage_test/instance2_dynamic_init: MissingCompileTimeError # Issue 32804
void_type_usage_test/instance2_for_in: MissingCompileTimeError # Issue 32804
-void_type_usage_test/instance2_for_in2: MissingCompileTimeError # Issue 32804
void_type_usage_test/instance2_is: MissingCompileTimeError # Issue 32804
void_type_usage_test/instance2_literal_list_init: MissingCompileTimeError # Issue 32804
void_type_usage_test/instance2_literal_map_key_init: MissingCompileTimeError # Issue 32804
@@ -496,7 +479,6 @@
void_type_usage_test/instance3_do_while: MissingCompileTimeError # Issue 32804
void_type_usage_test/instance3_dynamic_init: MissingCompileTimeError # Issue 32804
void_type_usage_test/instance3_for_in: MissingCompileTimeError # Issue 32804
-void_type_usage_test/instance3_for_in2: MissingCompileTimeError # Issue 32804
void_type_usage_test/instance3_is: MissingCompileTimeError # Issue 32804
void_type_usage_test/instance3_literal_list_init: MissingCompileTimeError # Issue 32804
void_type_usage_test/instance3_literal_map_key_init: MissingCompileTimeError # Issue 32804
@@ -663,15 +645,8 @@
assert_initializer_test/47: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/48: MissingCompileTimeError # KernelVM bug: Constant evaluation.
assert_initializer_test/none: RuntimeError # KernelVM bug: Constant evaluation.
-async_await_test/02: RuntimeError
-async_await_test/03: RuntimeError
-async_await_test/none: RuntimeError
async_return_types_test/nestedFuture: Fail
compile_time_constant_checked_test/02: MissingCompileTimeError
-covariance_type_parameter_test/01: RuntimeError
-covariance_type_parameter_test/02: RuntimeError
-covariance_type_parameter_test/03: RuntimeError
-covariance_type_parameter_test/none: RuntimeError
default_factory2_test/01: Fail
malbounded_redirecting_factory_test/03: Fail
malbounded_redirecting_factory_test/04: Fail
@@ -682,15 +657,23 @@
mixin_invalid_bound2_test/10: Fail
mixin_invalid_bound_test/06: Fail
mixin_invalid_bound_test/07: Fail
-recursive_inheritance_test: RuntimeError
redirecting_factory_infinite_steps_test/01: Fail
redirecting_factory_malbounded_test/01: Fail
-regress_22728_test: Fail # Dartk Issue 28498
-regress_22728_test: RuntimeError
regress_30339_test: RuntimeError
type_variable_bounds4_test/01: RuntimeError
[ $compiler == dartk && $runtime == vm && !$checked && $strong ]
+assertion_initializer_const_error2_test/cc01: MissingCompileTimeError # Not reporting failed assert() at compile time.
+assertion_initializer_const_error2_test/cc02: MissingCompileTimeError # Not reporting failed assert() at compile time.
+assertion_initializer_const_error2_test/cc03: MissingCompileTimeError # Not reporting failed assert() at compile time.
+assertion_initializer_const_error2_test/cc04: MissingCompileTimeError # Not reporting failed assert() at compile time.
+assertion_initializer_const_error2_test/cc05: MissingCompileTimeError # Not reporting failed assert() at compile time.
+assertion_initializer_const_error2_test/cc06: MissingCompileTimeError # Not reporting failed assert() at compile time.
+assertion_initializer_const_error2_test/cc07: MissingCompileTimeError # Not reporting failed assert() at compile time.
+assertion_initializer_const_error2_test/cc08: MissingCompileTimeError # Not reporting failed assert() at compile time.
+assertion_initializer_const_error2_test/cc09: MissingCompileTimeError # Not reporting failed assert() at compile time.
+assertion_initializer_const_error2_test/cc10: MissingCompileTimeError # Not reporting failed assert() at compile time.
+assertion_initializer_const_error2_test/cc11: MissingCompileTimeError # Not reporting failed assert() at compile time.
conditional_rewrite_test: RuntimeError # Issue 31402 (Not)
type_error_test: RuntimeError # Issue 31402 (Variable declaration)
@@ -844,18 +827,22 @@
[ $compiler == dartk && $system == windows && $strong ]
ct_const2_test: Fail
+[ $compiler == dartk && $checked ]
+assertion_initializer_const_error2_test/cc01: Pass # Works in --checked mode but not in --strong mode.
+assertion_initializer_const_error2_test/cc02: Pass # Works in --checked mode but not in --strong mode.
+assertion_initializer_const_error2_test/cc03: Pass # Works in --checked mode but not in --strong mode.
+assertion_initializer_const_error2_test/cc04: Pass # Works in --checked mode but not in --strong mode.
+assertion_initializer_const_error2_test/cc05: Pass # Works in --checked mode but not in --strong mode.
+assertion_initializer_const_error2_test/cc06: Pass # Works in --checked mode but not in --strong mode.
+assertion_initializer_const_error2_test/cc07: Pass # Works in --checked mode but not in --strong mode.
+assertion_initializer_const_error2_test/cc08: Pass # Works in --checked mode but not in --strong mode.
+assertion_initializer_const_error2_test/cc09: Pass # Works in --checked mode but not in --strong mode.
+assertion_initializer_const_error2_test/cc10: Pass # Works in --checked mode but not in --strong mode.
+
+[ $compiler == dartk && $hot_reload_rollback ]
+symbol_conflict_test: Pass, Slow
+
[ $compiler == dartk && $strong ]
-assertion_initializer_const_error2_test/cc01: MissingCompileTimeError # Not reporting failed assert() at compile time.
-assertion_initializer_const_error2_test/cc02: MissingCompileTimeError # Not reporting failed assert() at compile time.
-assertion_initializer_const_error2_test/cc03: MissingCompileTimeError # Not reporting failed assert() at compile time.
-assertion_initializer_const_error2_test/cc04: MissingCompileTimeError # Not reporting failed assert() at compile time.
-assertion_initializer_const_error2_test/cc05: MissingCompileTimeError # Not reporting failed assert() at compile time.
-assertion_initializer_const_error2_test/cc06: MissingCompileTimeError # Not reporting failed assert() at compile time.
-assertion_initializer_const_error2_test/cc07: MissingCompileTimeError # Not reporting failed assert() at compile time.
-assertion_initializer_const_error2_test/cc08: MissingCompileTimeError # Not reporting failed assert() at compile time.
-assertion_initializer_const_error2_test/cc09: MissingCompileTimeError # Not reporting failed assert() at compile time.
-assertion_initializer_const_error2_test/cc10: MissingCompileTimeError # Not reporting failed assert() at compile time.
-assertion_initializer_const_error2_test/cc11: MissingCompileTimeError # Not reporting failed assert() at compile time.
covariant_subtyping_test: RuntimeError
redirecting_factory_reflection_test: RuntimeError
@@ -1394,6 +1381,34 @@
prefix_transitive_import_test/01: MissingCompileTimeError
prefix_transitive_import_test/02: MissingCompileTimeError
regress_23089_test: MissingCompileTimeError
+regress_33235_05_test/02: MissingCompileTimeError
+regress_33235_05_test/03: MissingCompileTimeError
+regress_33235_06_test/02: MissingCompileTimeError
+regress_33235_06_test/03: MissingCompileTimeError
+regress_33235_07_test/01: MissingCompileTimeError
+regress_33235_07_test/02: MissingCompileTimeError
+regress_33235_07_test/03: MissingCompileTimeError
+regress_33235_08_test/02: MissingCompileTimeError
+regress_33235_08_test/03: MissingCompileTimeError
+regress_33235_09_test/02: MissingCompileTimeError
+regress_33235_09_test/03: MissingCompileTimeError
+regress_33235_10_test/01: MissingCompileTimeError
+regress_33235_10_test/02: MissingCompileTimeError
+regress_33235_10_test/03: MissingCompileTimeError
+regress_33235_12_test/01: MissingCompileTimeError
+regress_33235_12_test/02: MissingCompileTimeError
+regress_33235_12_test/03: MissingCompileTimeError
+regress_33235_13_test/01: MissingCompileTimeError
+regress_33235_13_test/02: MissingCompileTimeError
+regress_33235_13_test/03: MissingCompileTimeError
+regress_33235_14_test/02: MissingCompileTimeError
+regress_33235_14_test/03: MissingCompileTimeError
+regress_33235_15_test/02: MissingCompileTimeError
+regress_33235_15_test/03: MissingCompileTimeError
+regress_33235_16_test/01: MissingCompileTimeError
+regress_33235_16_test/02: MissingCompileTimeError
+regress_33235_16_test/03: MissingCompileTimeError
+setter4_test: MissingCompileTimeError
setter_override2_test/02: MissingCompileTimeError
super_no_such_method4_test/01: MissingCompileTimeError # Requires Dart 2 semantics. See http://dartbug.com/33380.
super_no_such_method5_test/01: MissingCompileTimeError # Requires Dart 2 semantics. See http://dartbug.com/33380.
diff --git a/tests/language_2/override_inheritance_field_test.dart b/tests/language_2/override_inheritance_field_test.dart
index d2c6872..bd04da0 100644
--- a/tests/language_2/override_inheritance_field_test.dart
+++ b/tests/language_2/override_inheritance_field_test.dart
@@ -28,18 +28,19 @@
@virtual int field1; //# 41: ok
num field2; //# 42: ok
- int field3; //# 43: ok
+ int field3; //# 43: compile-time error
int field4; //# 44: compile-time error
- int field5; //# 45: ok
+ int field5; //# 45: compile-time error
@virtual num field6; //# 46: ok
num field7; //# 47: compile-time error
num get field8 => null; //# 48: compile-time error
- num field9; //# 49: ok
- num field10; //# 50: ok
+ num field9; //# 49: compile-time error
+ num field10; //# 50: compile-time error
set field11(int _) {} //# 51: ok
void set field12(int _) {} //# 52: ok
num field13; //# 53: compile-time error
set field14(num _) {} //# 54: compile-time error
+ num field15; //# 55: ok
}
class B extends A {
@@ -110,6 +111,7 @@
num field12; //# 52: continued
set field13(String _) {} //# 53: continued
String field14; //# 54: continued
+ set field15(covariant int _) {} //# 55: continued
}
class SubClass extends Class {
diff --git a/tests/language_2/override_inheritance_method2_test.dart b/tests/language_2/override_inheritance_method2_test.dart
new file mode 100644
index 0000000..e22571f
--- /dev/null
+++ b/tests/language_2/override_inheritance_method2_test.dart
@@ -0,0 +1,1112 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+main() {
+ new C();
+}
+
+class A {
+ method1(covariant dynamic a) => null; //# 001: ok
+ method2(covariant dynamic a) => null; //# 002: ok
+ method3(covariant dynamic a) => null; //# 003: ok
+ method4(covariant dynamic a) => null; //# 004: ok
+ method5(covariant dynamic a) => null; //# 005: ok
+ method6(covariant dynamic a) => null; //# 006: ok
+ method7(covariant dynamic a) => null; //# 007: ok
+ method8(covariant dynamic a) => null; //# 008: ok
+ method9(covariant dynamic a) => null; //# 009: ok
+ method10(covariant dynamic a) => null; //# 010: ok
+ method11(covariant dynamic a) => null; //# 011: ok
+ method12(covariant dynamic a) => null; //# 012: compile-time error
+ method13(covariant dynamic a) => null; //# 013: ok
+ method14(covariant dynamic a) => null; //# 014: ok
+ method15(covariant dynamic a) => null; //# 015: ok
+ method16(covariant dynamic a) => null; //# 016: compile-time error
+ method17(covariant dynamic a) => null; //# 017: ok
+ method18(covariant dynamic a) => null; //# 018: ok
+ method19(covariant dynamic a) => null; //# 019: ok
+ method20(covariant dynamic a) => null; //# 020: compile-time error
+ method21(covariant dynamic a) => null; //# 021: ok
+ method22(covariant dynamic a) => null; //# 022: ok
+ method23(covariant dynamic a) => null; //# 023: ok
+ method24(covariant dynamic a) => null; //# 024: compile-time error
+ method25(covariant dynamic a) => null; //# 025: ok
+ method26(covariant dynamic a) => null; //# 026: compile-time error
+ method27(covariant dynamic a) => null; //# 027: compile-time error
+ method28(covariant dynamic a) => null; //# 028: ok
+ method29(covariant dynamic a) => null; //# 029: ok
+ method30(covariant dynamic a) => null; //# 030: compile-time error
+ method31(covariant dynamic a) => null; //# 031: compile-time error
+ method32(covariant dynamic a) => null; //# 032: ok
+ method33(covariant dynamic a) => null; //# 033: ok
+ method34(covariant dynamic a) => null; //# 034: ok
+ method35(covariant dynamic a) => null; //# 035: ok
+ method36(covariant dynamic a) => null; //# 036: ok
+ method37(covariant dynamic a) => null; //# 037: ok
+ method38(covariant dynamic a) => null; //# 038: ok
+ method39(covariant dynamic a) => null; //# 039: ok
+ method40(covariant dynamic a) => null; //# 040: ok
+ method41(covariant dynamic a) => null; //# 041: ok
+ method42(covariant dynamic a) => null; //# 042: ok
+ method43(covariant dynamic a) => null; //# 043: ok
+ method44(covariant dynamic a) => null; //# 044: compile-time error
+ method45(covariant dynamic a) => null; //# 045: ok
+ method46(covariant dynamic a) => null; //# 046: ok
+ method47(covariant dynamic a) => null; //# 047: ok
+ method48(covariant dynamic a) => null; //# 048: compile-time error
+ method49(covariant dynamic a) => null; //# 049: ok
+ method50(covariant dynamic a) => null; //# 050: ok
+ method51(covariant dynamic a) => null; //# 051: ok
+ method52(covariant dynamic a) => null; //# 052: compile-time error
+ method53(covariant dynamic a) => null; //# 053: ok
+ method54(covariant dynamic a) => null; //# 054: ok
+ method55(covariant dynamic a) => null; //# 055: ok
+ method56(covariant dynamic a) => null; //# 056: compile-time error
+ method57(covariant dynamic a) => null; //# 057: ok
+ method58(covariant dynamic a) => null; //# 058: compile-time error
+ method59(covariant dynamic a) => null; //# 059: compile-time error
+ method60(covariant dynamic a) => null; //# 060: ok
+ method61(covariant dynamic a) => null; //# 061: ok
+ method62(covariant dynamic a) => null; //# 062: compile-time error
+ method63(covariant dynamic a) => null; //# 063: compile-time error
+ method64(covariant dynamic a) => null; //# 064: ok
+ method65(covariant num a) => null; //# 065: ok
+ method66(covariant num a) => null; //# 066: ok
+ method67(covariant num a) => null; //# 067: ok
+ method68(covariant num a) => null; //# 068: compile-time error
+ method69(covariant num a) => null; //# 069: ok
+ method70(covariant num a) => null; //# 070: ok
+ method71(covariant num a) => null; //# 071: ok
+ method72(covariant num a) => null; //# 072: compile-time error
+ method73(covariant num a) => null; //# 073: ok
+ method74(covariant num a) => null; //# 074: ok
+ method75(covariant num a) => null; //# 075: ok
+ method76(covariant num a) => null; //# 076: compile-time error
+ method77(covariant num a) => null; //# 077: ok
+ method78(covariant num a) => null; //# 078: ok
+ method79(covariant num a) => null; //# 079: ok
+ method80(covariant num a) => null; //# 080: compile-time error
+ method81(covariant num a) => null; //# 081: ok
+ method82(covariant num a) => null; //# 082: ok
+ method83(covariant num a) => null; //# 083: ok
+ method84(covariant num a) => null; //# 084: compile-time error
+ method85(covariant num a) => null; //# 085: ok
+ method86(covariant num a) => null; //# 086: ok
+ method87(covariant num a) => null; //# 087: ok
+ method88(covariant num a) => null; //# 088: compile-time error
+ method89(covariant num a) => null; //# 089: compile-time error
+ method90(covariant num a) => null; //# 090: ok
+ method91(covariant num a) => null; //# 091: ok
+ method92(covariant num a) => null; //# 092: ok
+ method93(covariant num a) => null; //# 093: compile-time error
+ method94(covariant num a) => null; //# 094: ok
+ method95(covariant num a) => null; //# 095: ok
+ method96(covariant num a) => null; //# 096: ok
+ method97(covariant num a) => null; //# 097: compile-time error
+ method98(covariant num a) => null; //# 098: ok
+ method99(covariant num a) => null; //# 099: ok
+ method100(covariant num a) => null; //# 100: ok
+ method101(covariant num a) => null; //# 101: compile-time error
+ method102(covariant num a) => null; //# 102: ok
+ method103(covariant num a) => null; //# 103: ok
+ method104(covariant num a) => null; //# 104: ok
+ method105(covariant num a) => null; //# 105: compile-time error
+ method106(covariant num a) => null; //# 106: ok
+ method107(covariant num a) => null; //# 107: ok
+ method108(covariant num a) => null; //# 108: ok
+ method109(covariant num a) => null; //# 109: compile-time error
+ method110(covariant num a) => null; //# 110: ok
+ method111(covariant num a) => null; //# 111: ok
+ method112(covariant num a) => null; //# 112: ok
+ method113(covariant num a) => null; //# 113: compile-time error
+ method114(covariant num a) => null; //# 114: compile-time error
+ method115(covariant int a) => null; //# 115: ok
+ method116(covariant int a) => null; //# 116: ok
+ method117(covariant int a) => null; //# 117: ok
+ method118(covariant int a) => null; //# 118: compile-time error
+ method119(covariant int a) => null; //# 119: ok
+ method120(covariant int a) => null; //# 120: ok
+ method121(covariant int a) => null; //# 121: ok
+ method122(covariant int a) => null; //# 122: compile-time error
+ method123(covariant int a) => null; //# 123: ok
+ method124(covariant int a) => null; //# 124: ok
+ method125(covariant int a) => null; //# 125: ok
+ method126(covariant int a) => null; //# 126: compile-time error
+ method127(covariant int a) => null; //# 127: ok
+ method128(covariant int a) => null; //# 128: ok
+ method129(covariant int a) => null; //# 129: ok
+ method130(covariant int a) => null; //# 130: compile-time error
+ method131(covariant int a) => null; //# 131: ok
+ method132(covariant int a) => null; //# 132: ok
+ method133(covariant int a) => null; //# 133: ok
+ method134(covariant int a) => null; //# 134: compile-time error
+ method135(covariant int a) => null; //# 135: ok
+ method136(covariant int a) => null; //# 136: ok
+ method137(covariant int a) => null; //# 137: ok
+ method138(covariant int a) => null; //# 138: compile-time error
+ method139(covariant int a) => null; //# 139: compile-time error
+ method140(covariant int a) => null; //# 140: ok
+ method141(covariant int a) => null; //# 141: ok
+ method142(covariant int a) => null; //# 142: ok
+ method143(covariant int a) => null; //# 143: compile-time error
+ method144(covariant int a) => null; //# 144: ok
+ method145(covariant int a) => null; //# 145: ok
+ method146(covariant int a) => null; //# 146: ok
+ method147(covariant int a) => null; //# 147: compile-time error
+ method148(covariant int a) => null; //# 148: ok
+ method149(covariant int a) => null; //# 149: ok
+ method150(covariant int a) => null; //# 150: ok
+ method151(covariant int a) => null; //# 151: compile-time error
+ method152(covariant int a) => null; //# 152: ok
+ method153(covariant int a) => null; //# 153: ok
+ method154(covariant int a) => null; //# 154: ok
+ method155(covariant int a) => null; //# 155: compile-time error
+ method156(covariant int a) => null; //# 156: ok
+ method157(covariant int a) => null; //# 157: ok
+ method158(covariant int a) => null; //# 158: ok
+ method159(covariant int a) => null; //# 159: compile-time error
+ method160(covariant int a) => null; //# 160: ok
+ method161(covariant int a) => null; //# 161: ok
+ method162(covariant int a) => null; //# 162: ok
+ method163(covariant int a) => null; //# 163: compile-time error
+ method164(covariant int a) => null; //# 164: compile-time error
+ method165(covariant String a) => null; //# 165: ok
+ method166(covariant String a) => null; //# 166: compile-time error
+ method167(covariant String a) => null; //# 167: compile-time error
+ method168(covariant String a) => null; //# 168: ok
+ method169(covariant String a) => null; //# 169: ok
+ method170(covariant String a) => null; //# 170: compile-time error
+ method171(covariant String a) => null; //# 171: compile-time error
+ method172(covariant String a) => null; //# 172: ok
+ method173(covariant String a) => null; //# 173: compile-time error
+ method174(covariant String a) => null; //# 174: compile-time error
+ method175(covariant String a) => null; //# 175: ok
+ method176(covariant String a) => null; //# 176: compile-time error
+ method177(covariant String a) => null; //# 177: compile-time error
+ method178(covariant String a) => null; //# 178: ok
+ method179(covariant String a) => null; //# 179: ok
+ method180(covariant String a) => null; //# 180: compile-time error
+ method181(covariant String a) => null; //# 181: compile-time error
+ method182(covariant String a) => null; //# 182: ok
+ method183(covariant String a) => null; //# 183: ok
+ method184(covariant String a) => null; //# 184: compile-time error
+ method185(covariant String a) => null; //# 185: compile-time error
+ method186(covariant String a) => null; //# 186: ok
+ method187(covariant String a) => null; //# 187: ok
+ method188(covariant String a) => null; //# 188: compile-time error
+ method189(covariant String a) => null; //# 189: compile-time error
+ method190(covariant String a) => null; //# 190: ok
+ method191(covariant String a) => null; //# 191: compile-time error
+ method192(covariant String a) => null; //# 192: compile-time error
+ method193(covariant String a) => null; //# 193: ok
+ method194(covariant String a) => null; //# 194: compile-time error
+ method195(covariant String a) => null; //# 195: compile-time error
+ method196(covariant String a) => null; //# 196: ok
+ method197(covariant String a) => null; //# 197: ok
+ method198(covariant String a) => null; //# 198: compile-time error
+ method199(covariant String a) => null; //# 199: compile-time error
+ method200(covariant String a) => null; //# 200: ok
+ method201(dynamic a) => null; //# 201: ok
+ method202(dynamic a) => null; //# 202: ok
+ method203(dynamic a) => null; //# 203: ok
+ method204(dynamic a) => null; //# 204: ok
+ method205(dynamic a) => null; //# 205: ok
+ method206(dynamic a) => null; //# 206: ok
+ method207(dynamic a) => null; //# 207: ok
+ method208(dynamic a) => null; //# 208: ok
+ method209(dynamic a) => null; //# 209: ok
+ method210(dynamic a) => null; //# 210: ok
+ method211(dynamic a) => null; //# 211: ok
+ method212(dynamic a) => null; //# 212: compile-time error
+ method213(dynamic a) => null; //# 213: ok
+ method214(dynamic a) => null; //# 214: ok
+ method215(dynamic a) => null; //# 215: ok
+ method216(dynamic a) => null; //# 216: compile-time error
+ method217(dynamic a) => null; //# 217: ok
+ method218(dynamic a) => null; //# 218: ok
+ method219(dynamic a) => null; //# 219: ok
+ method220(dynamic a) => null; //# 220: compile-time error
+ method221(dynamic a) => null; //# 221: ok
+ method222(dynamic a) => null; //# 222: ok
+ method223(dynamic a) => null; //# 223: ok
+ method224(dynamic a) => null; //# 224: compile-time error
+ method225(dynamic a) => null; //# 225: ok
+ method226(dynamic a) => null; //# 226: compile-time error
+ method227(dynamic a) => null; //# 227: compile-time error
+ method228(dynamic a) => null; //# 228: ok
+ method229(dynamic a) => null; //# 229: ok
+ method230(dynamic a) => null; //# 230: compile-time error
+ method231(dynamic a) => null; //# 231: compile-time error
+ method232(dynamic a) => null; //# 232: ok
+ method233(dynamic a) => null; //# 233: ok
+ method234(dynamic a) => null; //# 234: ok
+ method235(dynamic a) => null; //# 235: ok
+ method236(dynamic a) => null; //# 236: ok
+ method237(dynamic a) => null; //# 237: ok
+ method238(dynamic a) => null; //# 238: compile-time error
+ method239(dynamic a) => null; //# 239: compile-time error
+ method240(dynamic a) => null; //# 240: compile-time error
+ method241(dynamic a) => null; //# 241: compile-time error
+ method242(dynamic a) => null; //# 242: compile-time error
+ method243(dynamic a) => null; //# 243: compile-time error
+ method244(num a) => null; //# 244: ok
+ method245(num a) => null; //# 245: ok
+ method246(num a) => null; //# 246: ok
+ method247(num a) => null; //# 247: compile-time error
+ method248(num a) => null; //# 248: ok
+ method249(num a) => null; //# 249: ok
+ method250(num a) => null; //# 250: ok
+ method251(num a) => null; //# 251: compile-time error
+ method252(num a) => null; //# 252: ok
+ method253(num a) => null; //# 253: ok
+ method254(num a) => null; //# 254: ok
+ method255(num a) => null; //# 255: compile-time error
+ method256(num a) => null; //# 256: ok
+ method257(num a) => null; //# 257: ok
+ method258(num a) => null; //# 258: ok
+ method259(num a) => null; //# 259: compile-time error
+ method260(num a) => null; //# 260: ok
+ method261(num a) => null; //# 261: ok
+ method262(num a) => null; //# 262: ok
+ method263(num a) => null; //# 263: compile-time error
+ method264(num a) => null; //# 264: ok
+ method265(num a) => null; //# 265: ok
+ method266(num a) => null; //# 266: ok
+ method267(num a) => null; //# 267: compile-time error
+ method268(num a) => null; //# 268: compile-time error
+ method269(num a) => null; //# 269: ok
+ method270(num a) => null; //# 270: ok
+ method271(num a) => null; //# 271: ok
+ method272(num a) => null; //# 272: compile-time error
+ method273(num a) => null; //# 273: ok
+ method274(num a) => null; //# 274: compile-time error
+ method275(num a) => null; //# 275: compile-time error
+ method276(num a) => null; //# 276: compile-time error
+ method277(num a) => null; //# 277: ok
+ method278(num a) => null; //# 278: ok
+ method279(num a) => null; //# 279: ok
+ method280(num a) => null; //# 280: compile-time error
+ method281(num a) => null; //# 281: ok
+ method282(num a) => null; //# 282: ok
+ method283(num a) => null; //# 283: compile-time error
+ method284(num a) => null; //# 284: compile-time error
+ method285(num a) => null; //# 285: compile-time error
+ method286(num a) => null; //# 286: compile-time error
+ method287(int a) => null; //# 287: ok
+ method288(int a) => null; //# 288: ok
+ method289(int a) => null; //# 289: ok
+ method290(int a) => null; //# 290: compile-time error
+ method291(int a) => null; //# 291: ok
+ method292(int a) => null; //# 292: ok
+ method293(int a) => null; //# 293: ok
+ method294(int a) => null; //# 294: compile-time error
+ method295(int a) => null; //# 295: ok
+ method296(int a) => null; //# 296: ok
+ method297(int a) => null; //# 297: ok
+ method298(int a) => null; //# 298: compile-time error
+ method299(int a) => null; //# 299: ok
+ method300(int a) => null; //# 300: ok
+ method301(int a) => null; //# 301: ok
+ method302(int a) => null; //# 302: compile-time error
+ method303(int a) => null; //# 303: ok
+ method304(int a) => null; //# 304: ok
+ method305(int a) => null; //# 305: ok
+ method306(int a) => null; //# 306: compile-time error
+ method307(int a) => null; //# 307: ok
+ method308(int a) => null; //# 308: ok
+ method309(int a) => null; //# 309: ok
+ method310(int a) => null; //# 310: compile-time error
+ method311(int a) => null; //# 311: compile-time error
+ method312(int a) => null; //# 312: ok
+ method313(int a) => null; //# 313: ok
+ method314(int a) => null; //# 314: ok
+ method315(int a) => null; //# 315: compile-time error
+ method316(int a) => null; //# 316: ok
+ method317(int a) => null; //# 317: compile-time error
+ method318(int a) => null; //# 318: compile-time error
+ method319(int a) => null; //# 319: compile-time error
+ method320(int a) => null; //# 320: ok
+ method321(int a) => null; //# 321: ok
+ method322(int a) => null; //# 322: ok
+ method323(int a) => null; //# 323: compile-time error
+ method324(int a) => null; //# 324: ok
+ method325(int a) => null; //# 325: ok
+ method326(int a) => null; //# 326: compile-time error
+ method327(int a) => null; //# 327: compile-time error
+ method328(int a) => null; //# 328: ok
+ method329(int a) => null; //# 329: ok
+ method330(int a) => null; //# 330: ok
+ method331(int a) => null; //# 331: compile-time error
+ method332(int a) => null; //# 332: ok
+ method333(int a) => null; //# 333: ok
+ method334(int a) => null; //# 334: ok
+ method335(int a) => null; //# 335: compile-time error
+ method336(int a) => null; //# 336: compile-time error
+ method337(String a) => null; //# 337: ok
+ method338(String a) => null; //# 338: compile-time error
+ method339(String a) => null; //# 339: compile-time error
+ method340(String a) => null; //# 340: ok
+ method341(String a) => null; //# 341: ok
+ method342(String a) => null; //# 342: compile-time error
+ method343(String a) => null; //# 343: compile-time error
+ method344(String a) => null; //# 344: ok
+ method345(String a) => null; //# 345: compile-time error
+ method346(String a) => null; //# 346: compile-time error
+ method347(String a) => null; //# 347: ok
+ method348(String a) => null; //# 348: compile-time error
+ method349(String a) => null; //# 349: compile-time error
+ method350(String a) => null; //# 350: ok
+ method351(String a) => null; //# 351: ok
+ method352(String a) => null; //# 352: compile-time error
+ method353(String a) => null; //# 353: compile-time error
+ method354(String a) => null; //# 354: ok
+ method355(String a) => null; //# 355: ok
+ method356(String a) => null; //# 356: compile-time error
+ method357(String a) => null; //# 357: compile-time error
+ method358(String a) => null; //# 358: ok
+ method359(String a) => null; //# 359: ok
+ method360(String a) => null; //# 360: compile-time error
+ method361(String a) => null; //# 361: compile-time error
+ method362(String a) => null; //# 362: compile-time error
+ method363(String a) => null; //# 363: compile-time error
+ method364(String a) => null; //# 364: compile-time error
+ method365(String a) => null; //# 365: ok
+ method366(String a) => null; //# 366: compile-time error
+ method367(String a) => null; //# 367: compile-time error
+ method368(String a) => null; //# 368: ok
+ method369(String a) => null; //# 369: ok
+ method370(String a) => null; //# 370: compile-time error
+ method371(String a) => null; //# 371: compile-time error
+ method372(String a) => null; //# 372: ok
+}
+
+class B extends A {
+ method1(covariant dynamic a) => null; //# 001: continued
+ method2(covariant dynamic a) => null; //# 002: continued
+ method3(covariant dynamic a) => null; //# 003: continued
+ method4(covariant dynamic a) => null; //# 004: continued
+ method5(covariant dynamic a) => null; //# 005: continued
+ method6(covariant dynamic a) => null; //# 006: continued
+ method7(covariant dynamic a) => null; //# 007: continued
+ method8(covariant dynamic a) => null; //# 008: continued
+ method9(covariant num a) => null; //# 009: continued
+ method10(covariant num a) => null; //# 010: continued
+ method11(covariant num a) => null; //# 011: continued
+ method12(covariant num a) => null; //# 012: continued
+ method13(covariant num a) => null; //# 013: continued
+ method14(covariant num a) => null; //# 014: continued
+ method15(covariant num a) => null; //# 015: continued
+ method16(covariant num a) => null; //# 016: continued
+ method17(covariant int a) => null; //# 017: continued
+ method18(covariant int a) => null; //# 018: continued
+ method19(covariant int a) => null; //# 019: continued
+ method20(covariant int a) => null; //# 020: continued
+ method21(covariant int a) => null; //# 021: continued
+ method22(covariant int a) => null; //# 022: continued
+ method23(covariant int a) => null; //# 023: continued
+ method24(covariant int a) => null; //# 024: continued
+ method25(covariant String a) => null; //# 025: continued
+ method26(covariant String a) => null; //# 026: continued
+ method27(covariant String a) => null; //# 027: continued
+ method28(covariant String a) => null; //# 028: continued
+ method29(covariant String a) => null; //# 029: continued
+ method30(covariant String a) => null; //# 030: continued
+ method31(covariant String a) => null; //# 031: continued
+ method32(covariant String a) => null; //# 032: continued
+ method33(dynamic a) => null; //# 033: continued
+ method34(dynamic a) => null; //# 034: continued
+ method35(dynamic a) => null; //# 035: continued
+ method36(dynamic a) => null; //# 036: continued
+ method37(dynamic a) => null; //# 037: continued
+ method38(dynamic a) => null; //# 038: continued
+ method39(dynamic a) => null; //# 039: continued
+ method40(dynamic a) => null; //# 040: continued
+ method41(num a) => null; //# 041: continued
+ method42(num a) => null; //# 042: continued
+ method43(num a) => null; //# 043: continued
+ method44(num a) => null; //# 044: continued
+ method45(num a) => null; //# 045: continued
+ method46(num a) => null; //# 046: continued
+ method47(num a) => null; //# 047: continued
+ method48(num a) => null; //# 048: continued
+ method49(int a) => null; //# 049: continued
+ method50(int a) => null; //# 050: continued
+ method51(int a) => null; //# 051: continued
+ method52(int a) => null; //# 052: continued
+ method53(int a) => null; //# 053: continued
+ method54(int a) => null; //# 054: continued
+ method55(int a) => null; //# 055: continued
+ method56(int a) => null; //# 056: continued
+ method57(String a) => null; //# 057: continued
+ method58(String a) => null; //# 058: continued
+ method59(String a) => null; //# 059: continued
+ method60(String a) => null; //# 060: continued
+ method61(String a) => null; //# 061: continued
+ method62(String a) => null; //# 062: continued
+ method63(String a) => null; //# 063: continued
+ method64(String a) => null; //# 064: continued
+ method65(covariant dynamic a) => null; //# 065: continued
+ method66(covariant dynamic a) => null; //# 066: continued
+ method67(covariant dynamic a) => null; //# 067: continued
+ method68(covariant dynamic a) => null; //# 068: continued
+ method69(covariant dynamic a) => null; //# 069: continued
+ method70(covariant dynamic a) => null; //# 070: continued
+ method71(covariant dynamic a) => null; //# 071: continued
+ method72(covariant dynamic a) => null; //# 072: continued
+ method73(covariant num a) => null; //# 073: continued
+ method74(covariant num a) => null; //# 074: continued
+ method75(covariant num a) => null; //# 075: continued
+ method76(covariant num a) => null; //# 076: continued
+ method77(covariant num a) => null; //# 077: continued
+ method78(covariant num a) => null; //# 078: continued
+ method79(covariant num a) => null; //# 079: continued
+ method80(covariant num a) => null; //# 080: continued
+ method81(covariant int a) => null; //# 081: continued
+ method82(covariant int a) => null; //# 082: continued
+ method83(covariant int a) => null; //# 083: continued
+ method84(covariant int a) => null; //# 084: continued
+ method85(covariant int a) => null; //# 085: continued
+ method86(covariant int a) => null; //# 086: continued
+ method87(covariant int a) => null; //# 087: continued
+ method88(covariant int a) => null; //# 088: continued
+ method89(covariant String a) => null; //# 089: continued
+ method90(dynamic a) => null; //# 090: continued
+ method91(dynamic a) => null; //# 091: continued
+ method92(dynamic a) => null; //# 092: continued
+ method93(dynamic a) => null; //# 093: continued
+ method94(dynamic a) => null; //# 094: continued
+ method95(dynamic a) => null; //# 095: continued
+ method96(dynamic a) => null; //# 096: continued
+ method97(dynamic a) => null; //# 097: continued
+ method98(num a) => null; //# 098: continued
+ method99(num a) => null; //# 099: continued
+ method100(num a) => null; //# 100: continued
+ method101(num a) => null; //# 101: continued
+ method102(num a) => null; //# 102: continued
+ method103(num a) => null; //# 103: continued
+ method104(num a) => null; //# 104: continued
+ method105(num a) => null; //# 105: continued
+ method106(int a) => null; //# 106: continued
+ method107(int a) => null; //# 107: continued
+ method108(int a) => null; //# 108: continued
+ method109(int a) => null; //# 109: continued
+ method110(int a) => null; //# 110: continued
+ method111(int a) => null; //# 111: continued
+ method112(int a) => null; //# 112: continued
+ method113(int a) => null; //# 113: continued
+ method114(String a) => null; //# 114: continued
+ method115(covariant dynamic a) => null; //# 115: continued
+ method116(covariant dynamic a) => null; //# 116: continued
+ method117(covariant dynamic a) => null; //# 117: continued
+ method118(covariant dynamic a) => null; //# 118: continued
+ method119(covariant dynamic a) => null; //# 119: continued
+ method120(covariant dynamic a) => null; //# 120: continued
+ method121(covariant dynamic a) => null; //# 121: continued
+ method122(covariant dynamic a) => null; //# 122: continued
+ method123(covariant num a) => null; //# 123: continued
+ method124(covariant num a) => null; //# 124: continued
+ method125(covariant num a) => null; //# 125: continued
+ method126(covariant num a) => null; //# 126: continued
+ method127(covariant num a) => null; //# 127: continued
+ method128(covariant num a) => null; //# 128: continued
+ method129(covariant num a) => null; //# 129: continued
+ method130(covariant num a) => null; //# 130: continued
+ method131(covariant int a) => null; //# 131: continued
+ method132(covariant int a) => null; //# 132: continued
+ method133(covariant int a) => null; //# 133: continued
+ method134(covariant int a) => null; //# 134: continued
+ method135(covariant int a) => null; //# 135: continued
+ method136(covariant int a) => null; //# 136: continued
+ method137(covariant int a) => null; //# 137: continued
+ method138(covariant int a) => null; //# 138: continued
+ method139(covariant String a) => null; //# 139: continued
+ method140(dynamic a) => null; //# 140: continued
+ method141(dynamic a) => null; //# 141: continued
+ method142(dynamic a) => null; //# 142: continued
+ method143(dynamic a) => null; //# 143: continued
+ method144(dynamic a) => null; //# 144: continued
+ method145(dynamic a) => null; //# 145: continued
+ method146(dynamic a) => null; //# 146: continued
+ method147(dynamic a) => null; //# 147: continued
+ method148(num a) => null; //# 148: continued
+ method149(num a) => null; //# 149: continued
+ method150(num a) => null; //# 150: continued
+ method151(num a) => null; //# 151: continued
+ method152(num a) => null; //# 152: continued
+ method153(num a) => null; //# 153: continued
+ method154(num a) => null; //# 154: continued
+ method155(num a) => null; //# 155: continued
+ method156(int a) => null; //# 156: continued
+ method157(int a) => null; //# 157: continued
+ method158(int a) => null; //# 158: continued
+ method159(int a) => null; //# 159: continued
+ method160(int a) => null; //# 160: continued
+ method161(int a) => null; //# 161: continued
+ method162(int a) => null; //# 162: continued
+ method163(int a) => null; //# 163: continued
+ method164(String a) => null; //# 164: continued
+ method165(covariant dynamic a) => null; //# 165: continued
+ method166(covariant dynamic a) => null; //# 166: continued
+ method167(covariant dynamic a) => null; //# 167: continued
+ method168(covariant dynamic a) => null; //# 168: continued
+ method169(covariant dynamic a) => null; //# 169: continued
+ method170(covariant dynamic a) => null; //# 170: continued
+ method171(covariant dynamic a) => null; //# 171: continued
+ method172(covariant dynamic a) => null; //# 172: continued
+ method173(covariant num a) => null; //# 173: continued
+ method174(covariant int a) => null; //# 174: continued
+ method175(covariant String a) => null; //# 175: continued
+ method176(covariant String a) => null; //# 176: continued
+ method177(covariant String a) => null; //# 177: continued
+ method178(covariant String a) => null; //# 178: continued
+ method179(covariant String a) => null; //# 179: continued
+ method180(covariant String a) => null; //# 180: continued
+ method181(covariant String a) => null; //# 181: continued
+ method182(covariant String a) => null; //# 182: continued
+ method183(dynamic a) => null; //# 183: continued
+ method184(dynamic a) => null; //# 184: continued
+ method185(dynamic a) => null; //# 185: continued
+ method186(dynamic a) => null; //# 186: continued
+ method187(dynamic a) => null; //# 187: continued
+ method188(dynamic a) => null; //# 188: continued
+ method189(dynamic a) => null; //# 189: continued
+ method190(dynamic a) => null; //# 190: continued
+ method191(num a) => null; //# 191: continued
+ method192(int a) => null; //# 192: continued
+ method193(String a) => null; //# 193: continued
+ method194(String a) => null; //# 194: continued
+ method195(String a) => null; //# 195: continued
+ method196(String a) => null; //# 196: continued
+ method197(String a) => null; //# 197: continued
+ method198(String a) => null; //# 198: continued
+ method199(String a) => null; //# 199: continued
+ method200(String a) => null; //# 200: continued
+ method201(covariant dynamic a) => null; //# 201: continued
+ method202(covariant dynamic a) => null; //# 202: continued
+ method203(covariant dynamic a) => null; //# 203: continued
+ method204(covariant dynamic a) => null; //# 204: continued
+ method205(covariant dynamic a) => null; //# 205: continued
+ method206(covariant dynamic a) => null; //# 206: continued
+ method207(covariant dynamic a) => null; //# 207: continued
+ method208(covariant dynamic a) => null; //# 208: continued
+ method209(covariant num a) => null; //# 209: continued
+ method210(covariant num a) => null; //# 210: continued
+ method211(covariant num a) => null; //# 211: continued
+ method212(covariant num a) => null; //# 212: continued
+ method213(covariant num a) => null; //# 213: continued
+ method214(covariant num a) => null; //# 214: continued
+ method215(covariant num a) => null; //# 215: continued
+ method216(covariant num a) => null; //# 216: continued
+ method217(covariant int a) => null; //# 217: continued
+ method218(covariant int a) => null; //# 218: continued
+ method219(covariant int a) => null; //# 219: continued
+ method220(covariant int a) => null; //# 220: continued
+ method221(covariant int a) => null; //# 221: continued
+ method222(covariant int a) => null; //# 222: continued
+ method223(covariant int a) => null; //# 223: continued
+ method224(covariant int a) => null; //# 224: continued
+ method225(covariant String a) => null; //# 225: continued
+ method226(covariant String a) => null; //# 226: continued
+ method227(covariant String a) => null; //# 227: continued
+ method228(covariant String a) => null; //# 228: continued
+ method229(covariant String a) => null; //# 229: continued
+ method230(covariant String a) => null; //# 230: continued
+ method231(covariant String a) => null; //# 231: continued
+ method232(covariant String a) => null; //# 232: continued
+ method233(dynamic a) => null; //# 233: continued
+ method234(dynamic a) => null; //# 234: continued
+ method235(dynamic a) => null; //# 235: continued
+ method236(dynamic a) => null; //# 236: continued
+ method237(dynamic a) => null; //# 237: continued
+ method238(dynamic a) => null; //# 238: continued
+ method239(dynamic a) => null; //# 239: continued
+ method240(dynamic a) => null; //# 240: continued
+ method241(num a) => null; //# 241: continued
+ method242(int a) => null; //# 242: continued
+ method243(String a) => null; //# 243: continued
+ method244(covariant dynamic a) => null; //# 244: continued
+ method245(covariant dynamic a) => null; //# 245: continued
+ method246(covariant dynamic a) => null; //# 246: continued
+ method247(covariant dynamic a) => null; //# 247: continued
+ method248(covariant dynamic a) => null; //# 248: continued
+ method249(covariant dynamic a) => null; //# 249: continued
+ method250(covariant dynamic a) => null; //# 250: continued
+ method251(covariant dynamic a) => null; //# 251: continued
+ method252(covariant num a) => null; //# 252: continued
+ method253(covariant num a) => null; //# 253: continued
+ method254(covariant num a) => null; //# 254: continued
+ method255(covariant num a) => null; //# 255: continued
+ method256(covariant num a) => null; //# 256: continued
+ method257(covariant num a) => null; //# 257: continued
+ method258(covariant num a) => null; //# 258: continued
+ method259(covariant num a) => null; //# 259: continued
+ method260(covariant int a) => null; //# 260: continued
+ method261(covariant int a) => null; //# 261: continued
+ method262(covariant int a) => null; //# 262: continued
+ method263(covariant int a) => null; //# 263: continued
+ method264(covariant int a) => null; //# 264: continued
+ method265(covariant int a) => null; //# 265: continued
+ method266(covariant int a) => null; //# 266: continued
+ method267(covariant int a) => null; //# 267: continued
+ method268(covariant String a) => null; //# 268: continued
+ method269(dynamic a) => null; //# 269: continued
+ method270(dynamic a) => null; //# 270: continued
+ method271(dynamic a) => null; //# 271: continued
+ method272(dynamic a) => null; //# 272: continued
+ method273(dynamic a) => null; //# 273: continued
+ method274(dynamic a) => null; //# 274: continued
+ method275(dynamic a) => null; //# 275: continued
+ method276(dynamic a) => null; //# 276: continued
+ method277(num a) => null; //# 277: continued
+ method278(num a) => null; //# 278: continued
+ method279(num a) => null; //# 279: continued
+ method280(num a) => null; //# 280: continued
+ method281(num a) => null; //# 281: continued
+ method282(num a) => null; //# 282: continued
+ method283(num a) => null; //# 283: continued
+ method284(num a) => null; //# 284: continued
+ method285(int a) => null; //# 285: continued
+ method286(String a) => null; //# 286: continued
+ method287(covariant dynamic a) => null; //# 287: continued
+ method288(covariant dynamic a) => null; //# 288: continued
+ method289(covariant dynamic a) => null; //# 289: continued
+ method290(covariant dynamic a) => null; //# 290: continued
+ method291(covariant dynamic a) => null; //# 291: continued
+ method292(covariant dynamic a) => null; //# 292: continued
+ method293(covariant dynamic a) => null; //# 293: continued
+ method294(covariant dynamic a) => null; //# 294: continued
+ method295(covariant num a) => null; //# 295: continued
+ method296(covariant num a) => null; //# 296: continued
+ method297(covariant num a) => null; //# 297: continued
+ method298(covariant num a) => null; //# 298: continued
+ method299(covariant num a) => null; //# 299: continued
+ method300(covariant num a) => null; //# 300: continued
+ method301(covariant num a) => null; //# 301: continued
+ method302(covariant num a) => null; //# 302: continued
+ method303(covariant int a) => null; //# 303: continued
+ method304(covariant int a) => null; //# 304: continued
+ method305(covariant int a) => null; //# 305: continued
+ method306(covariant int a) => null; //# 306: continued
+ method307(covariant int a) => null; //# 307: continued
+ method308(covariant int a) => null; //# 308: continued
+ method309(covariant int a) => null; //# 309: continued
+ method310(covariant int a) => null; //# 310: continued
+ method311(covariant String a) => null; //# 311: continued
+ method312(dynamic a) => null; //# 312: continued
+ method313(dynamic a) => null; //# 313: continued
+ method314(dynamic a) => null; //# 314: continued
+ method315(dynamic a) => null; //# 315: continued
+ method316(dynamic a) => null; //# 316: continued
+ method317(dynamic a) => null; //# 317: continued
+ method318(dynamic a) => null; //# 318: continued
+ method319(dynamic a) => null; //# 319: continued
+ method320(num a) => null; //# 320: continued
+ method321(num a) => null; //# 321: continued
+ method322(num a) => null; //# 322: continued
+ method323(num a) => null; //# 323: continued
+ method324(num a) => null; //# 324: continued
+ method325(num a) => null; //# 325: continued
+ method326(num a) => null; //# 326: continued
+ method327(num a) => null; //# 327: continued
+ method328(int a) => null; //# 328: continued
+ method329(int a) => null; //# 329: continued
+ method330(int a) => null; //# 330: continued
+ method331(int a) => null; //# 331: continued
+ method332(int a) => null; //# 332: continued
+ method333(int a) => null; //# 333: continued
+ method334(int a) => null; //# 334: continued
+ method335(int a) => null; //# 335: continued
+ method336(String a) => null; //# 336: continued
+ method337(covariant dynamic a) => null; //# 337: continued
+ method338(covariant dynamic a) => null; //# 338: continued
+ method339(covariant dynamic a) => null; //# 339: continued
+ method340(covariant dynamic a) => null; //# 340: continued
+ method341(covariant dynamic a) => null; //# 341: continued
+ method342(covariant dynamic a) => null; //# 342: continued
+ method343(covariant dynamic a) => null; //# 343: continued
+ method344(covariant dynamic a) => null; //# 344: continued
+ method345(covariant num a) => null; //# 345: continued
+ method346(covariant int a) => null; //# 346: continued
+ method347(covariant String a) => null; //# 347: continued
+ method348(covariant String a) => null; //# 348: continued
+ method349(covariant String a) => null; //# 349: continued
+ method350(covariant String a) => null; //# 350: continued
+ method351(covariant String a) => null; //# 351: continued
+ method352(covariant String a) => null; //# 352: continued
+ method353(covariant String a) => null; //# 353: continued
+ method354(covariant String a) => null; //# 354: continued
+ method355(dynamic a) => null; //# 355: continued
+ method356(dynamic a) => null; //# 356: continued
+ method357(dynamic a) => null; //# 357: continued
+ method358(dynamic a) => null; //# 358: continued
+ method359(dynamic a) => null; //# 359: continued
+ method360(dynamic a) => null; //# 360: continued
+ method361(dynamic a) => null; //# 361: continued
+ method362(dynamic a) => null; //# 362: continued
+ method363(num a) => null; //# 363: continued
+ method364(int a) => null; //# 364: continued
+ method365(String a) => null; //# 365: continued
+ method366(String a) => null; //# 366: continued
+ method367(String a) => null; //# 367: continued
+ method368(String a) => null; //# 368: continued
+ method369(String a) => null; //# 369: continued
+ method370(String a) => null; //# 370: continued
+ method371(String a) => null; //# 371: continued
+ method372(String a) => null; //# 372: continued
+}
+
+class C extends B {
+ method1(covariant dynamic a) => null; //# 001: continued
+ method2(covariant num a) => null; //# 002: continued
+ method3(covariant int a) => null; //# 003: continued
+ method4(covariant String a) => null; //# 004: continued
+ method5(dynamic a) => null; //# 005: continued
+ method6(num a) => null; //# 006: continued
+ method7(int a) => null; //# 007: continued
+ method8(String a) => null; //# 008: continued
+ method9(covariant dynamic a) => null; //# 009: continued
+ method10(covariant num a) => null; //# 010: continued
+ method11(covariant int a) => null; //# 011: continued
+ method12(covariant String a) => null; //# 012: continued
+ method13(dynamic a) => null; //# 013: continued
+ method14(num a) => null; //# 014: continued
+ method15(int a) => null; //# 015: continued
+ method16(String a) => null; //# 016: continued
+ method17(covariant dynamic a) => null; //# 017: continued
+ method18(covariant num a) => null; //# 018: continued
+ method19(covariant int a) => null; //# 019: continued
+ method20(covariant String a) => null; //# 020: continued
+ method21(dynamic a) => null; //# 021: continued
+ method22(num a) => null; //# 022: continued
+ method23(int a) => null; //# 023: continued
+ method24(String a) => null; //# 024: continued
+ method25(covariant dynamic a) => null; //# 025: continued
+ method26(covariant num a) => null; //# 026: continued
+ method27(covariant int a) => null; //# 027: continued
+ method28(covariant String a) => null; //# 028: continued
+ method29(dynamic a) => null; //# 029: continued
+ method30(num a) => null; //# 030: continued
+ method31(int a) => null; //# 031: continued
+ method32(String a) => null; //# 032: continued
+ method33(covariant dynamic a) => null; //# 033: continued
+ method34(covariant num a) => null; //# 034: continued
+ method35(covariant int a) => null; //# 035: continued
+ method36(covariant String a) => null; //# 036: continued
+ method37(dynamic a) => null; //# 037: continued
+ method38(num a) => null; //# 038: continued
+ method39(int a) => null; //# 039: continued
+ method40(String a) => null; //# 040: continued
+ method41(covariant dynamic a) => null; //# 041: continued
+ method42(covariant num a) => null; //# 042: continued
+ method43(covariant int a) => null; //# 043: continued
+ method44(covariant String a) => null; //# 044: continued
+ method45(dynamic a) => null; //# 045: continued
+ method46(num a) => null; //# 046: continued
+ method47(int a) => null; //# 047: continued
+ method48(String a) => null; //# 048: continued
+ method49(covariant dynamic a) => null; //# 049: continued
+ method50(covariant num a) => null; //# 050: continued
+ method51(covariant int a) => null; //# 051: continued
+ method52(covariant String a) => null; //# 052: continued
+ method53(dynamic a) => null; //# 053: continued
+ method54(num a) => null; //# 054: continued
+ method55(int a) => null; //# 055: continued
+ method56(String a) => null; //# 056: continued
+ method57(covariant dynamic a) => null; //# 057: continued
+ method58(covariant num a) => null; //# 058: continued
+ method59(covariant int a) => null; //# 059: continued
+ method60(covariant String a) => null; //# 060: continued
+ method61(dynamic a) => null; //# 061: continued
+ method62(num a) => null; //# 062: continued
+ method63(int a) => null; //# 063: continued
+ method64(String a) => null; //# 064: continued
+ method65(covariant dynamic a) => null; //# 065: continued
+ method66(covariant num a) => null; //# 066: continued
+ method67(covariant int a) => null; //# 067: continued
+ method68(covariant String a) => null; //# 068: continued
+ method69(dynamic a) => null; //# 069: continued
+ method70(num a) => null; //# 070: continued
+ method71(int a) => null; //# 071: continued
+ method72(String a) => null; //# 072: continued
+ method73(covariant dynamic a) => null; //# 073: continued
+ method74(covariant num a) => null; //# 074: continued
+ method75(covariant int a) => null; //# 075: continued
+ method76(covariant String a) => null; //# 076: continued
+ method77(dynamic a) => null; //# 077: continued
+ method78(num a) => null; //# 078: continued
+ method79(int a) => null; //# 079: continued
+ method80(String a) => null; //# 080: continued
+ method81(covariant dynamic a) => null; //# 081: continued
+ method82(covariant num a) => null; //# 082: continued
+ method83(covariant int a) => null; //# 083: continued
+ method84(covariant String a) => null; //# 084: continued
+ method85(dynamic a) => null; //# 085: continued
+ method86(num a) => null; //# 086: continued
+ method87(int a) => null; //# 087: continued
+ method88(String a) => null; //# 088: continued
+ method90(covariant dynamic a) => null; //# 090: continued
+ method91(covariant num a) => null; //# 091: continued
+ method92(covariant int a) => null; //# 092: continued
+ method93(covariant String a) => null; //# 093: continued
+ method94(dynamic a) => null; //# 094: continued
+ method95(num a) => null; //# 095: continued
+ method96(int a) => null; //# 096: continued
+ method97(String a) => null; //# 097: continued
+ method98(covariant dynamic a) => null; //# 098: continued
+ method99(covariant num a) => null; //# 099: continued
+ method100(covariant int a) => null; //# 100: continued
+ method101(covariant String a) => null; //# 101: continued
+ method102(dynamic a) => null; //# 102: continued
+ method103(num a) => null; //# 103: continued
+ method104(int a) => null; //# 104: continued
+ method105(String a) => null; //# 105: continued
+ method106(covariant dynamic a) => null; //# 106: continued
+ method107(covariant num a) => null; //# 107: continued
+ method108(covariant int a) => null; //# 108: continued
+ method109(covariant String a) => null; //# 109: continued
+ method110(dynamic a) => null; //# 110: continued
+ method111(num a) => null; //# 111: continued
+ method112(int a) => null; //# 112: continued
+ method113(String a) => null; //# 113: continued
+ method115(covariant dynamic a) => null; //# 115: continued
+ method116(covariant num a) => null; //# 116: continued
+ method117(covariant int a) => null; //# 117: continued
+ method118(covariant String a) => null; //# 118: continued
+ method119(dynamic a) => null; //# 119: continued
+ method120(num a) => null; //# 120: continued
+ method121(int a) => null; //# 121: continued
+ method122(String a) => null; //# 122: continued
+ method123(covariant dynamic a) => null; //# 123: continued
+ method124(covariant num a) => null; //# 124: continued
+ method125(covariant int a) => null; //# 125: continued
+ method126(covariant String a) => null; //# 126: continued
+ method127(dynamic a) => null; //# 127: continued
+ method128(num a) => null; //# 128: continued
+ method129(int a) => null; //# 129: continued
+ method130(String a) => null; //# 130: continued
+ method131(covariant dynamic a) => null; //# 131: continued
+ method132(covariant num a) => null; //# 132: continued
+ method133(covariant int a) => null; //# 133: continued
+ method134(covariant String a) => null; //# 134: continued
+ method135(dynamic a) => null; //# 135: continued
+ method136(num a) => null; //# 136: continued
+ method137(int a) => null; //# 137: continued
+ method138(String a) => null; //# 138: continued
+ method140(covariant dynamic a) => null; //# 140: continued
+ method141(covariant num a) => null; //# 141: continued
+ method142(covariant int a) => null; //# 142: continued
+ method143(covariant String a) => null; //# 143: continued
+ method144(dynamic a) => null; //# 144: continued
+ method145(num a) => null; //# 145: continued
+ method146(int a) => null; //# 146: continued
+ method147(String a) => null; //# 147: continued
+ method148(covariant dynamic a) => null; //# 148: continued
+ method149(covariant num a) => null; //# 149: continued
+ method150(covariant int a) => null; //# 150: continued
+ method151(covariant String a) => null; //# 151: continued
+ method152(dynamic a) => null; //# 152: continued
+ method153(num a) => null; //# 153: continued
+ method154(int a) => null; //# 154: continued
+ method155(String a) => null; //# 155: continued
+ method156(covariant dynamic a) => null; //# 156: continued
+ method157(covariant num a) => null; //# 157: continued
+ method158(covariant int a) => null; //# 158: continued
+ method159(covariant String a) => null; //# 159: continued
+ method160(dynamic a) => null; //# 160: continued
+ method161(num a) => null; //# 161: continued
+ method162(int a) => null; //# 162: continued
+ method163(String a) => null; //# 163: continued
+ method165(covariant dynamic a) => null; //# 165: continued
+ method166(covariant num a) => null; //# 166: continued
+ method167(covariant int a) => null; //# 167: continued
+ method168(covariant String a) => null; //# 168: continued
+ method169(dynamic a) => null; //# 169: continued
+ method170(num a) => null; //# 170: continued
+ method171(int a) => null; //# 171: continued
+ method172(String a) => null; //# 172: continued
+ method175(covariant dynamic a) => null; //# 175: continued
+ method176(covariant num a) => null; //# 176: continued
+ method177(covariant int a) => null; //# 177: continued
+ method178(covariant String a) => null; //# 178: continued
+ method179(dynamic a) => null; //# 179: continued
+ method180(num a) => null; //# 180: continued
+ method181(int a) => null; //# 181: continued
+ method182(String a) => null; //# 182: continued
+ method183(covariant dynamic a) => null; //# 183: continued
+ method184(covariant num a) => null; //# 184: continued
+ method185(covariant int a) => null; //# 185: continued
+ method186(covariant String a) => null; //# 186: continued
+ method187(dynamic a) => null; //# 187: continued
+ method188(num a) => null; //# 188: continued
+ method189(int a) => null; //# 189: continued
+ method190(String a) => null; //# 190: continued
+ method193(covariant dynamic a) => null; //# 193: continued
+ method194(covariant num a) => null; //# 194: continued
+ method195(covariant int a) => null; //# 195: continued
+ method196(covariant String a) => null; //# 196: continued
+ method197(dynamic a) => null; //# 197: continued
+ method198(num a) => null; //# 198: continued
+ method199(int a) => null; //# 199: continued
+ method200(String a) => null; //# 200: continued
+ method201(covariant dynamic a) => null; //# 201: continued
+ method202(covariant num a) => null; //# 202: continued
+ method203(covariant int a) => null; //# 203: continued
+ method204(covariant String a) => null; //# 204: continued
+ method205(dynamic a) => null; //# 205: continued
+ method206(num a) => null; //# 206: continued
+ method207(int a) => null; //# 207: continued
+ method208(String a) => null; //# 208: continued
+ method209(covariant dynamic a) => null; //# 209: continued
+ method210(covariant num a) => null; //# 210: continued
+ method211(covariant int a) => null; //# 211: continued
+ method212(covariant String a) => null; //# 212: continued
+ method213(dynamic a) => null; //# 213: continued
+ method214(num a) => null; //# 214: continued
+ method215(int a) => null; //# 215: continued
+ method216(String a) => null; //# 216: continued
+ method217(covariant dynamic a) => null; //# 217: continued
+ method218(covariant num a) => null; //# 218: continued
+ method219(covariant int a) => null; //# 219: continued
+ method220(covariant String a) => null; //# 220: continued
+ method221(dynamic a) => null; //# 221: continued
+ method222(num a) => null; //# 222: continued
+ method223(int a) => null; //# 223: continued
+ method224(String a) => null; //# 224: continued
+ method225(covariant dynamic a) => null; //# 225: continued
+ method226(covariant num a) => null; //# 226: continued
+ method227(covariant int a) => null; //# 227: continued
+ method228(covariant String a) => null; //# 228: continued
+ method229(dynamic a) => null; //# 229: continued
+ method230(num a) => null; //# 230: continued
+ method231(int a) => null; //# 231: continued
+ method232(String a) => null; //# 232: continued
+ method233(covariant dynamic a) => null; //# 233: continued
+ method234(covariant num a) => null; //# 234: continued
+ method235(covariant int a) => null; //# 235: continued
+ method236(covariant String a) => null; //# 236: continued
+ method237(dynamic a) => null; //# 237: continued
+ method238(num a) => null; //# 238: continued
+ method239(int a) => null; //# 239: continued
+ method240(String a) => null; //# 240: continued
+ method244(covariant dynamic a) => null; //# 244: continued
+ method245(covariant num a) => null; //# 245: continued
+ method246(covariant int a) => null; //# 246: continued
+ method247(covariant String a) => null; //# 247: continued
+ method248(dynamic a) => null; //# 248: continued
+ method249(num a) => null; //# 249: continued
+ method250(int a) => null; //# 250: continued
+ method251(String a) => null; //# 251: continued
+ method252(covariant dynamic a) => null; //# 252: continued
+ method253(covariant num a) => null; //# 253: continued
+ method254(covariant int a) => null; //# 254: continued
+ method255(covariant String a) => null; //# 255: continued
+ method256(dynamic a) => null; //# 256: continued
+ method257(num a) => null; //# 257: continued
+ method258(int a) => null; //# 258: continued
+ method259(String a) => null; //# 259: continued
+ method260(covariant dynamic a) => null; //# 260: continued
+ method261(covariant num a) => null; //# 261: continued
+ method262(covariant int a) => null; //# 262: continued
+ method263(covariant String a) => null; //# 263: continued
+ method264(dynamic a) => null; //# 264: continued
+ method265(num a) => null; //# 265: continued
+ method266(int a) => null; //# 266: continued
+ method267(String a) => null; //# 267: continued
+ method269(covariant dynamic a) => null; //# 269: continued
+ method270(covariant num a) => null; //# 270: continued
+ method271(covariant int a) => null; //# 271: continued
+ method272(covariant String a) => null; //# 272: continued
+ method273(dynamic a) => null; //# 273: continued
+ method274(num a) => null; //# 274: continued
+ method275(int a) => null; //# 275: continued
+ method276(String a) => null; //# 276: continued
+ method277(covariant dynamic a) => null; //# 277: continued
+ method278(covariant num a) => null; //# 278: continued
+ method279(covariant int a) => null; //# 279: continued
+ method280(covariant String a) => null; //# 280: continued
+ method281(dynamic a) => null; //# 281: continued
+ method282(num a) => null; //# 282: continued
+ method283(int a) => null; //# 283: continued
+ method284(String a) => null; //# 284: continued
+ method287(covariant dynamic a) => null; //# 287: continued
+ method288(covariant num a) => null; //# 288: continued
+ method289(covariant int a) => null; //# 289: continued
+ method290(covariant String a) => null; //# 290: continued
+ method291(dynamic a) => null; //# 291: continued
+ method292(num a) => null; //# 292: continued
+ method293(int a) => null; //# 293: continued
+ method294(String a) => null; //# 294: continued
+ method295(covariant dynamic a) => null; //# 295: continued
+ method296(covariant num a) => null; //# 296: continued
+ method297(covariant int a) => null; //# 297: continued
+ method298(covariant String a) => null; //# 298: continued
+ method299(dynamic a) => null; //# 299: continued
+ method300(num a) => null; //# 300: continued
+ method301(int a) => null; //# 301: continued
+ method302(String a) => null; //# 302: continued
+ method303(covariant dynamic a) => null; //# 303: continued
+ method304(covariant num a) => null; //# 304: continued
+ method305(covariant int a) => null; //# 305: continued
+ method306(covariant String a) => null; //# 306: continued
+ method307(dynamic a) => null; //# 307: continued
+ method308(num a) => null; //# 308: continued
+ method309(int a) => null; //# 309: continued
+ method310(String a) => null; //# 310: continued
+ method312(covariant dynamic a) => null; //# 312: continued
+ method313(covariant num a) => null; //# 313: continued
+ method314(covariant int a) => null; //# 314: continued
+ method315(covariant String a) => null; //# 315: continued
+ method316(dynamic a) => null; //# 316: continued
+ method317(num a) => null; //# 317: continued
+ method318(int a) => null; //# 318: continued
+ method319(String a) => null; //# 319: continued
+ method320(covariant dynamic a) => null; //# 320: continued
+ method321(covariant num a) => null; //# 321: continued
+ method322(covariant int a) => null; //# 322: continued
+ method323(covariant String a) => null; //# 323: continued
+ method324(dynamic a) => null; //# 324: continued
+ method325(num a) => null; //# 325: continued
+ method326(int a) => null; //# 326: continued
+ method327(String a) => null; //# 327: continued
+ method328(covariant dynamic a) => null; //# 328: continued
+ method329(covariant num a) => null; //# 329: continued
+ method330(covariant int a) => null; //# 330: continued
+ method331(covariant String a) => null; //# 331: continued
+ method332(dynamic a) => null; //# 332: continued
+ method333(num a) => null; //# 333: continued
+ method334(int a) => null; //# 334: continued
+ method335(String a) => null; //# 335: continued
+ method337(covariant dynamic a) => null; //# 337: continued
+ method338(covariant num a) => null; //# 338: continued
+ method339(covariant int a) => null; //# 339: continued
+ method340(covariant String a) => null; //# 340: continued
+ method341(dynamic a) => null; //# 341: continued
+ method342(num a) => null; //# 342: continued
+ method343(int a) => null; //# 343: continued
+ method344(String a) => null; //# 344: continued
+ method347(covariant dynamic a) => null; //# 347: continued
+ method348(covariant num a) => null; //# 348: continued
+ method349(covariant int a) => null; //# 349: continued
+ method350(covariant String a) => null; //# 350: continued
+ method351(dynamic a) => null; //# 351: continued
+ method352(num a) => null; //# 352: continued
+ method353(int a) => null; //# 353: continued
+ method354(String a) => null; //# 354: continued
+ method355(covariant dynamic a) => null; //# 355: continued
+ method356(covariant num a) => null; //# 356: continued
+ method357(covariant int a) => null; //# 357: continued
+ method358(covariant String a) => null; //# 358: continued
+ method359(dynamic a) => null; //# 359: continued
+ method360(num a) => null; //# 360: continued
+ method361(int a) => null; //# 361: continued
+ method362(String a) => null; //# 362: continued
+ method365(covariant dynamic a) => null; //# 365: continued
+ method366(covariant num a) => null; //# 366: continued
+ method367(covariant int a) => null; //# 367: continued
+ method368(covariant String a) => null; //# 368: continued
+ method369(dynamic a) => null; //# 369: continued
+ method370(num a) => null; //# 370: continued
+ method371(int a) => null; //# 371: continued
+ method372(String a) => null; //# 372: continued
+}
diff --git a/tests/language_2/override_inheritance_setter_test.dart b/tests/language_2/override_inheritance_setter_test.dart
new file mode 100644
index 0000000..f709c75
--- /dev/null
+++ b/tests/language_2/override_inheritance_setter_test.dart
@@ -0,0 +1,32 @@
+main() {
+ new C();
+}
+
+class A {
+ void set setter1(num x) {} //# 001: compile-time error
+ void set setter2(num x) {} //# 002: compile-time error
+ void set setter3(num x) {} //# 003: ok
+ void set setter4(num x) {} //# 004: compile-time error
+ void set setter5(num x) {} //# 005: ok
+ void set setter6(num x) {} //# 006: compile-time error
+ void set setter7(num x) {} //# 007: ok
+}
+
+class B extends A {
+ void set setter1(covariant dynamic x) {} //# 001: continued
+ void set setter2(int x) {} //# 002: continued
+ void set setter3(covariant dynamic x) {} //# 003: continued
+ void set setter4(dynamic x) {} //# 004: continued
+ void set setter5(covariant dynamic x) {} //# 005: continued
+ covariant dynamic setter6; //# 006: continued
+ covariant dynamic setter7; //# 007: continued
+}
+
+class C extends B {
+ void set setter1(String x) {} //# 001: continued
+ void set setter3(num x) {} //# 003: continued
+ void set setter4(int x) {} //# 004: continued
+ void set setter5(int x) {} //# 005: continued
+ void set setter6(String x) {} //# 006: continued
+ void set setter7(int x) {} //# 007: continued
+}
diff --git a/tests/language_2/regress_33235_01_test.dart b/tests/language_2/regress_33235_01_test.dart
new file mode 100644
index 0000000..e4b252d
--- /dev/null
+++ b/tests/language_2/regress_33235_01_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class C {
+ C.n() {} // //# 01: compile-time error
+
+ static int get n {
+ return 42;
+ }
+}
+
+main() {
+ print(C);
+}
diff --git a/tests/language_2/regress_33235_02_test.dart b/tests/language_2/regress_33235_02_test.dart
new file mode 100644
index 0000000..6cc51d2
--- /dev/null
+++ b/tests/language_2/regress_33235_02_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class C {
+ C.n() {} // //# 01: compile-time error
+
+ static int n() {
+ return 42;
+ }
+}
+
+main() {
+ print(C);
+}
diff --git a/tests/language_2/regress_33235_03_test.dart b/tests/language_2/regress_33235_03_test.dart
new file mode 100644
index 0000000..f1e762b
--- /dev/null
+++ b/tests/language_2/regress_33235_03_test.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class C {
+ C.n() {} // //# 01: compile-time error
+
+ static set n(int x) {}
+}
+
+main() {
+ print(C);
+}
diff --git a/tests/language_2/regress_33235_04_test.dart b/tests/language_2/regress_33235_04_test.dart
new file mode 100644
index 0000000..db46401
--- /dev/null
+++ b/tests/language_2/regress_33235_04_test.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class C {
+ static int get n => 42; // //# 01: compile-time error
+
+ static int n() => 42;
+}
+
+main() {
+ print(C);
+}
diff --git a/tests/language_2/regress_33235_05_test.dart b/tests/language_2/regress_33235_05_test.dart
new file mode 100644
index 0000000..179a4f3
--- /dev/null
+++ b/tests/language_2/regress_33235_05_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ int get n => 43;
+}
+
+class B extends A {
+ static int get n => 42; // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ static int get n => 42; // //# 03: compile-time error
+}
+
+class C {
+ static int get n => 42; // //# 01: compile-time error
+
+ int get n => 43;
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_06_test.dart b/tests/language_2/regress_33235_06_test.dart
new file mode 100644
index 0000000..bd9bcc2
--- /dev/null
+++ b/tests/language_2/regress_33235_06_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ int n() => 43;
+}
+
+class B extends A {
+ static int get n => 42; // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ static int get n => 42; // //# 03: compile-time error
+}
+
+class C {
+ static int get n => 42; // //# 01: compile-time error
+
+ int n() => 43;
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_07_test.dart b/tests/language_2/regress_33235_07_test.dart
new file mode 100644
index 0000000..da33ad7
--- /dev/null
+++ b/tests/language_2/regress_33235_07_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ void set n(int i) {}
+}
+
+class B extends A {
+ static int get n => 42; // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ static int get n => 42; // //# 03: compile-time error
+}
+
+class C {
+ static int get n => 42; // //# 01: compile-time error
+
+ void set n(int i) {}
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_08_test.dart b/tests/language_2/regress_33235_08_test.dart
new file mode 100644
index 0000000..82369f5
--- /dev/null
+++ b/tests/language_2/regress_33235_08_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ int get n => 43;
+}
+
+class B extends A {
+ static int n() => 42; // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ static int n() => 42; // //# 03: compile-time error
+}
+
+class C {
+ static int n() => 42; // //# 01: compile-time error
+
+ int get n => 43;
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_09_test.dart b/tests/language_2/regress_33235_09_test.dart
new file mode 100644
index 0000000..b9cff42
--- /dev/null
+++ b/tests/language_2/regress_33235_09_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ int n() => 43;
+}
+
+class B extends A {
+ static int n() => 42; // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ static int n() => 42; // //# 03: compile-time error
+}
+
+class C {
+ static int n() => 42; // //# 01: compile-time error
+
+ int n() => 43;
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_10_test.dart b/tests/language_2/regress_33235_10_test.dart
new file mode 100644
index 0000000..0aa1514
--- /dev/null
+++ b/tests/language_2/regress_33235_10_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ void set n(int i) {}
+}
+
+class B extends A {
+ static int n() => 42; // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ static int n() => 42; // //# 03: compile-time error
+}
+
+class C {
+ static int n() => 42; // //# 01: compile-time error
+
+ void set n(int i) {}
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_11_test.dart b/tests/language_2/regress_33235_11_test.dart
new file mode 100644
index 0000000..08d4e49
--- /dev/null
+++ b/tests/language_2/regress_33235_11_test.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class C {
+ static void set n(int i) {} // //# 01: compile-time error
+
+ static int n() => 42;
+}
+
+main() {
+ print(C);
+}
diff --git a/tests/language_2/regress_33235_12_test.dart b/tests/language_2/regress_33235_12_test.dart
new file mode 100644
index 0000000..b8e2ec3
--- /dev/null
+++ b/tests/language_2/regress_33235_12_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ int get n => 42;
+}
+
+class B extends A {
+ static void set n(int i) {} // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ static void set n(int i) {} // //# 03: compile-time error
+}
+
+class C {
+ static void set n(int i) {} // //# 01: compile-time error
+
+ int get n => 42;
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_13_test.dart b/tests/language_2/regress_33235_13_test.dart
new file mode 100644
index 0000000..13a0c35
--- /dev/null
+++ b/tests/language_2/regress_33235_13_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ int n() => 42;
+}
+
+class B extends A {
+ static void set n(int i) {} // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ static void set n(int i) {} // //# 03: compile-time error
+}
+
+class C {
+ static void set n(int i) {} // //# 01: compile-time error
+
+ int n() => 42;
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_14_test.dart b/tests/language_2/regress_33235_14_test.dart
new file mode 100644
index 0000000..0ba2cba
--- /dev/null
+++ b/tests/language_2/regress_33235_14_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+class A {
+ void set n(int x) {}
+}
+
+class B extends A {
+ static void set n(int i) {} // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ static void set n(int i) {} // //# 03: compile-time error
+}
+
+class C {
+ static void set n(int i) {} // //# 01: compile-time error
+
+ void set n(int x) {}
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_15_test.dart b/tests/language_2/regress_33235_15_test.dart
new file mode 100644
index 0000000..6264201
--- /dev/null
+++ b/tests/language_2/regress_33235_15_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ int n() => 43;
+}
+
+class B extends A {
+ int get n => 42; // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ int get n => 42; // //# 03: compile-time error
+}
+
+class C {
+ int get n => 42; // //# 01: compile-time error
+
+ int n() => 43;
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_16_test.dart b/tests/language_2/regress_33235_16_test.dart
new file mode 100644
index 0000000..d3d5c05
--- /dev/null
+++ b/tests/language_2/regress_33235_16_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ int n() => 43;
+}
+
+class B extends A {
+ void set n(int i) {} // //# 02: compile-time error
+}
+
+abstract class B2 implements A {
+ void set n(int i) {} // //# 03: compile-time error
+}
+
+class C {
+ void set n(int i) {} // //# 01: compile-time error
+
+ int n() => 43;
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_17_test.dart b/tests/language_2/regress_33235_17_test.dart
new file mode 100644
index 0000000..95ae7d7
--- /dev/null
+++ b/tests/language_2/regress_33235_17_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class C {
+ static void set n(int i) {}
+
+ static int get n {
+ return 43;
+ }
+}
+
+main() {
+ print(C);
+}
diff --git a/tests/language_2/regress_33235_18_test.dart b/tests/language_2/regress_33235_18_test.dart
new file mode 100644
index 0000000..ec72cb1
--- /dev/null
+++ b/tests/language_2/regress_33235_18_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ void set n(int i) {}
+}
+
+class B extends A {
+ int get n {
+ return 42;
+ }
+}
+
+abstract class B2 implements A {
+ int get n {
+ return 42;
+ }
+}
+
+class C {
+ int get n {
+ return 42;
+ }
+
+ void set n(int i) {}
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_19_test.dart b/tests/language_2/regress_33235_19_test.dart
new file mode 100644
index 0000000..999d661
--- /dev/null
+++ b/tests/language_2/regress_33235_19_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ int n() {
+ return 42;
+ }
+}
+
+class B extends A {
+ B.n() {}
+}
+
+abstract class B2 implements A {
+ B2.n() {}
+}
+
+class C {
+ C.n() {}
+
+ int n() {
+ return 42;
+ }
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_20_test.dart b/tests/language_2/regress_33235_20_test.dart
new file mode 100644
index 0000000..d312026
--- /dev/null
+++ b/tests/language_2/regress_33235_20_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ int get n {
+ return 42;
+ }
+}
+
+class B extends A {
+ B.n() {}
+}
+
+abstract class B2 implements A {
+ B2.n() {}
+}
+
+class C {
+ C.n() {}
+
+ int get n {
+ return 42;
+ }
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/regress_33235_21_test.dart b/tests/language_2/regress_33235_21_test.dart
new file mode 100644
index 0000000..b013bce
--- /dev/null
+++ b/tests/language_2/regress_33235_21_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test for complience with tables at
+// https://github.com/dart-lang/sdk/issues/33235#issue-326617285
+// Files 01 to 16 should be compile time errors, files 17 to 21 should not.
+
+class A {
+ void set n(int i) {}
+}
+
+class B extends A {
+ B.n() {}
+}
+
+abstract class B2 implements A {
+ B2.n() {}
+}
+
+class C {
+ C.n() {}
+
+ void set n(int i) {}
+}
+
+main() {
+ print(C);
+ print(B);
+ print(B2);
+}
diff --git a/tests/language_2/tearoff_dynamic_test.dart b/tests/language_2/tearoff_dynamic_test.dart
index 09446e7..c47edf7 100644
--- a/tests/language_2/tearoff_dynamic_test.dart
+++ b/tests/language_2/tearoff_dynamic_test.dart
@@ -110,7 +110,7 @@
testType([1, 2, 3]);
testType({'a': 'b'});
testType((x) => x + 1);
- testType(testType);
+ testType(testType as dynamic); // illegal inferred type for T otherwise
}
class N {
@@ -159,7 +159,7 @@
testType([1, 2, 3]);
testType({'a': 'b'});
testType((x) => x + 1);
- testType(testType);
+ testType(testType as dynamic); // illegal inferred type for T otherwise
}
main() {
diff --git a/tests/language_2/void_type_function_types_test.dart b/tests/language_2/void_type_function_types_test.dart
index d436c85..6146c43 100644
--- a/tests/language_2/void_type_function_types_test.dart
+++ b/tests/language_2/void_type_function_types_test.dart
@@ -67,21 +67,21 @@
Expect.isTrue(g is F);
Expect.isTrue(g is G);
Expect.isFalse(g is H);
- expectsF(g); //# 04: compile-time error
+ expectsF(g);
expectsG(g);
expectsH(g); //# 05: compile-time error
Expect.isTrue(g2 is F2);
Expect.isTrue(g2 is G2);
Expect.isFalse(g2 is H2);
- expectsF2(g2); //# 06: compile-time error
+ expectsF2(g2);
expectsG2(g2);
expectsH2(g2); //# 07: compile-time error
Expect.isTrue(g3 is F3);
Expect.isTrue(g3 is G3);
Expect.isFalse(g3 is H3);
- expectsF3(g3); //# 08: compile-time error
+ expectsF3(g3);
expectsG3(g3);
expectsH3(g3); //# 09: compile-time error
diff --git a/tests/language_2/void_type_override_test.dart b/tests/language_2/void_type_override_test.dart
index eb2a740..4b13843 100644
--- a/tests/language_2/void_type_override_test.dart
+++ b/tests/language_2/void_type_override_test.dart
@@ -23,13 +23,13 @@
}
class B implements A<Object> {
- void //# 00: compile-time error
+ void //# 00: ok
/* //# 00: continued
var
*/ //# 00: continued
x;
- void //# 00b: compile-time error
+ void //# 00b: ok
/* //# 00b: continued
var
*/ //# 00b: continued
@@ -41,9 +41,8 @@
*/ //# 00c: continued
z;
- // Overriding an Object function with a void function is an error.
- void //# 01: compile-time error
- foo() => null;
+ void //# 01: ok
+ foo() {}
int bar() => 499;
void gee(void x) {}
diff --git a/tests/language_2/void_type_usage_test.dart b/tests/language_2/void_type_usage_test.dart
index 135e8bd..5ba0547 100644
--- a/tests/language_2/void_type_usage_test.dart
+++ b/tests/language_2/void_type_usage_test.dart
@@ -6,7 +6,7 @@
void use(dynamic x) { }
-testVoidParam(void x) {
+Object testVoidParam(void x) {
x; //# param_stmt: ok
true ? x : x; //# param_conditional: compile-time error
for (x; false; x) {} //# param_for: ok
@@ -34,7 +34,11 @@
x..toString(); //# param_cascade: compile-time error
}
-testVoidCall(void f()) {
+dynamic testVoidParamDynamic(void x) {
+ return x; //# param_return_dynamic: ok
+}
+
+Object testVoidCall(void f()) {
f(); //# call_stmt: ok
true ? f() : f(); //# call_conditional: compile-time error
for (f(); false; f()) {} //# call_for: ok
@@ -60,7 +64,11 @@
f()..toString(); //# call_cascade: compile-time error
}
-testVoidLocal() {
+dynamic testVoidCallDynamic(void f()) {
+ return f(); //# call_return: ok
+}
+
+Object testVoidLocal() {
void x;
x = 42; //# local_assign: ok
x; //# local_stmt: ok
@@ -90,7 +98,12 @@
x..toString(); //# local_cascade: compile-time error
}
-testVoidFinalLocal() {
+dynamic testVoidLocalDynamic() {
+ void x;
+ return x; //# local_return_dynamic: ok
+}
+
+Object testVoidFinalLocal() {
final void x = null;
x = 42; //# final_local_assign: compile-time error
x; //# final_local_stmt: ok
@@ -120,8 +133,13 @@
x..toString(); //# final_local_cascade: compile-time error
}
+dynamic testVoidFinalLocalDynamic() {
+ final void x = null;
+ return x; //# final_local_return_dynamic: ok
+}
+
void global;
-testVoidGlobal() {
+Object testVoidGlobal() {
global; //# global_stmt: ok
true ? global : global; //# global_conditional: compile-time error
for (global; false; global) {} //# global_for: ok
@@ -149,6 +167,10 @@
global..toString(); //# global_cascade: compile-time error
}
+dynamic testVoidGlobalDynamic() {
+ return global; //# global_return_dynamic: ok
+}
+
testVoidConditional() {
void x;
(true ? x : x); //# conditional_parens: compile-time error
@@ -215,7 +237,7 @@
int foo() => 499;
void forInTest() {
- for (x in <void>[]) {} //# instance2_for_in2: compile-time error
+ for (x in <void>[]) {} //# instance2_for_in2: ok
for (x in [1, 2]) {} //# instance2_for_in3: ok
}
}
@@ -227,12 +249,12 @@
void foo() {}
void forInTest() {
- for (x in <void>[]) {} //# instance3_for_in2: compile-time error
+ for (x in <void>[]) {} //# instance3_for_in2: ok
for (x in [1, 2]) {} //# instance3_for_in3: ok
}
}
-testInstanceField() {
+Object testInstanceField() {
A<void> a = new A<void>();
a.x = 499; //# field_assign: ok
a.x; //# instance_stmt: ok
@@ -317,7 +339,18 @@
c.x..toString(); //# instance3_cascade: compile-time error
}
-testParenthesized() {
+dynamic testInstanceFieldDynamic() {
+ A<void> a = new A<void>();
+ return a.x; //# instance_return_dynamic: ok
+
+ B b = new B();
+ return b.x; //# instance2_return_dynamic: ok
+
+ C c = new C();
+ return c.x; //# instance3_return_dynamic: ok
+}
+
+Object testParenthesized() {
void x;
(x); //# paren_stmt: ok
true ? (x) : (x); //# paren_conditional: compile-time error
@@ -344,6 +377,11 @@
(x)..toString(); //# paren_cascade: compile-time error
}
+dynamic testParenthesizedDynamic() {
+ void x;
+ return (x); //# paren_return_dynamic: ok
+}
+
void testReturnToVoid(void x, void f()) {
void y;
final void z = null;
diff --git a/tests/lib_2/async/future_test.dart b/tests/lib_2/async/future_test.dart
index 5a075e9..515adca 100644
--- a/tests/lib_2/async/future_test.dart
+++ b/tests/lib_2/async/future_test.dart
@@ -636,7 +636,6 @@
Expect.equals("ERROR-tcwfe2", e);
asyncEnd();
});
-
}
void testCompleteErrorWithFuture() {
@@ -688,7 +687,8 @@
completer.completeError(future);
completer.future.then((_) {
Expect.fail("Shouldn't happen");
- }, onError: (Future f) {
+ }, onError: (e) {
+ Future f = e;
f.then((v) {
Expect.equals(42, v);
asyncEnd();
@@ -888,7 +888,8 @@
Expect.equals(e, 1);
asyncEnd();
});
- }, onError: (int index, s) {
+ }, onError: (e, s) {
+ int index = e;
Expect.isTrue(index == 0 || index == 2, "$index");
Expect.isFalse(uncaughts[index]);
uncaughts[index] = true;
@@ -977,7 +978,7 @@
void testTypes() {
// Test that future is a Future<int> and not something less precise.
testType(name, future, [depth = 2]) {
- var desc = "$name${".whenComplete"*(2-depth)}";
+ var desc = "$name${".whenComplete" * (2 - depth)}";
Expect.isTrue(future is Future<int>, "$desc is Future<int>");
Expect.isFalse(future is Future<String>, "$desc is! Future<String>");
var stream = future.asStream();
@@ -995,12 +996,9 @@
new Future<int>.delayed(Duration.zero, () => value));
testType(
"Future.microtask($value)", new Future<int>.microtask(() => value));
- testType( //# 01: ok
- "Future.sync($value)", new Future<int>.sync(() => value)); //# 01: continued
- testType( //# 01: continued
- "Future.sync(future($value))", //# 01: continued
- new Future<int>.sync(//# 01: continued
- () => new Future<int>.value(value))); //# 01: continued
+ testType("Future.sync($value)", new Future<int>.sync(() => value));
+ testType("Future.sync(future($value))",
+ new Future<int>.sync(() => new Future<int>.value(value)));
testType("Future.value($value)", new Future<int>.value(value));
}
testType("Completer.future", new Completer<int>().future);
@@ -1100,6 +1098,33 @@
}();
}
+void testFutureOfFuture() async {
+ // Plain Future.
+ asyncStart();
+ var future = Future<Future<int>>.value(Future<int>.value(42));
+ Expect.type<Future<Future<int>>>(future);
+ future.then((innerFuture) {
+ Expect.type<Future<int>>(innerFuture);
+ innerFuture.then((number) {
+ Expect.equals(42, number);
+ asyncEnd();
+ });
+ });
+
+ // With completer.
+ asyncStart();
+ var completer = Completer<Future<int>>();
+ Expect.type<Future<Future<int>>>(completer.future);
+ completer.future.then((innerFuture) {
+ Expect.type<Future<int>>(innerFuture);
+ innerFuture.then((number) {
+ Expect.equals(42, number);
+ asyncEnd();
+ });
+ });
+ completer.complete(Future<int>.value(42));
+}
+
main() {
asyncStart();
@@ -1173,6 +1198,8 @@
testFutureResult();
+ testFutureOfFuture();
+
asyncEnd();
}
diff --git a/tests/lib_2/async/null_future_zone_test.dart b/tests/lib_2/async/null_future_zone_test.dart
new file mode 100644
index 0000000..802c399
--- /dev/null
+++ b/tests/lib_2/async/null_future_zone_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+import 'dart:async';
+
+main() {
+ asyncStart(2);
+ () async {
+ var it = new StreamIterator(new Stream.fromIterable([]));
+ Expect.isFalse(await it.moveNext());
+
+ Future nullFuture;
+ Future falseFuture;
+
+ runZoned(() {
+ nullFuture = (new StreamController()..stream.listen(null).cancel()).done;
+ falseFuture = it.moveNext();
+ }, zoneSpecification: new ZoneSpecification(scheduleMicrotask:
+ (Zone self, ZoneDelegate parent, Zone zone, void f()) {
+ Expect.fail("Should not be called");
+ }));
+
+ nullFuture.then((value) {
+ Expect.isNull(value);
+ asyncEnd();
+ });
+
+ falseFuture.then((value) {
+ Expect.isFalse(value);
+ asyncEnd();
+ });
+ }();
+}
diff --git a/tests/lib_2/lib_2.status b/tests/lib_2/lib_2.status
index 29d88bc..249a438 100644
--- a/tests/lib_2/lib_2.status
+++ b/tests/lib_2/lib_2.status
@@ -119,6 +119,7 @@
isolate/spawn_uri_multi_test/none: RuntimeError # Issue 13544
[ !$strong ]
+async/future_test: SkipByDesign # Uses Dart 2 syntax.
async/stream_first_where_test/badType: MissingCompileTimeError
async/stream_last_where_test/badType: MissingCompileTimeError
mirrors/redirecting_factory_different_type_test/02: MissingCompileTimeError
@@ -245,6 +246,8 @@
[ $hot_reload || $hot_reload_rollback ]
async/stream_transformer_test: Pass, Fail # Closure identity
+convert/chunked_conversion_utf88_test: SkipSlow
+convert/utf85_test: SkipSlow
isolate/deferred_in_isolate2_test: Crash # Requires deferred libraries
isolate/deferred_in_isolate_test: Crash # Requires deferred libraries
isolate/function_send_test: Pass, Fail # Closure identity
diff --git a/tests/lib_2/lib_2_dart2js.status b/tests/lib_2/lib_2_dart2js.status
index 0ddba1c..9e3bf1c 100644
--- a/tests/lib_2/lib_2_dart2js.status
+++ b/tests/lib_2/lib_2_dart2js.status
@@ -471,18 +471,17 @@
html/element_types_shadow_test: RuntimeError # Issue 29922
html/file_sample_test: Skip # FileSystem not supported on Safari.
html/fileapi_supported_throws_test: Skip # FileSystem not supported on Safari
-html/js_mock_test: RuntimeError # Issue 32286
html/storage_promise_test: RuntimeError # Not supported on Safari
html/xhr_test: RuntimeError
[ $compiler == dart2js && $runtime == safari && $strong ]
+html/audiobuffersourcenode_test: Pass, RuntimeError
html/canvasrenderingcontext2d_test/arc: Pass, RuntimeError
html/canvasrenderingcontext2d_test/drawImage_canvas_element: Pass, RuntimeError
html/canvasrenderingcontext2d_test/drawImage_image_element: Pass, RuntimeError
html/canvasrenderingcontext2d_test/fillText: Pass, RuntimeError
-html/form_data_test/functional: RuntimeError
+html/interactive_media_test: SkipSlow
html/notification_test: Pass, RuntimeError # Safari doesn't let us access the fields of the Notification to verify them.
-html/xhr_cross_origin_test/functional: RuntimeError
[ $compiler == dart2js && $runtime == safari && !$strong ]
convert/json_test: Fail # https://bugs.webkit.org/show_bug.cgi?id=134920
@@ -513,7 +512,6 @@
[ $compiler == dart2js && $browser && $strong ]
html/element_classes_svg_test: RuntimeError
html/js_array_test: RuntimeError
-html/js_mock_test: RuntimeError
html/typed_arrays_range_checks_test: RuntimeError
[ $compiler == dart2js && $checked ]
@@ -823,8 +821,6 @@
[ $compiler == dart2js && $strong ]
async/future_or_type_test: RuntimeError
-async/future_test/01: RuntimeError
-async/future_test/none: RuntimeError
async/slow_consumer2_test: RuntimeError
async/stream_controller_async_test: RuntimeError
async/stream_distinct_test: RuntimeError
diff --git a/tests/lib_2/lib_2_dartdevc.status b/tests/lib_2/lib_2_dartdevc.status
index 5a926e1..b4b3d70 100644
--- a/tests/lib_2/lib_2_dartdevc.status
+++ b/tests/lib_2/lib_2_dartdevc.status
@@ -14,10 +14,6 @@
convert/chunked_conversion_utf87_test: RuntimeError
convert/utf82_test: RuntimeError
html/debugger_test: CompileTimeError
-math/double_pow_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-typed_data/int32x4_arithmetic_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-typed_data/int32x4_arithmetic_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
-typed_data/int64_list_load_store_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
[ $runtime == chrome && ($compiler == dartdevc || $compiler == dartdevk) ]
html/element_animate_test/timing_dict: RuntimeError # Issue 29922
@@ -102,6 +98,7 @@
isolate/*: SkipByDesign # No support for dart:isolate in dart4web (http://dartbug.com/30538)
js/null_test: RuntimeError # Issue 30652
math/double_pow_test: RuntimeError # Issue 29922
+math/double_pow_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
math/low_test: RuntimeError # Issue 29922
math/random_big_test: RuntimeError # Issue 29922
mirrors/*: SkipByDesign # Mirrors not supported on web in Dart 2.0.
@@ -115,6 +112,9 @@
mirrors/regress_14304_test: RuntimeError # Issue 29922
profiler/metrics_num_test: Skip # Because of an int / double type test.
typed_data/int32x4_arithmetic_test/int64: RuntimeError # Issue 29922
+typed_data/int32x4_arithmetic_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+typed_data/int32x4_arithmetic_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
typed_data/int64_list_load_store_test: RuntimeError # Issue 29922
+typed_data/int64_list_load_store_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
typed_data/typed_data_hierarchy_int64_test: RuntimeError # Issue 29922
typed_data/unmodifiable_typed_data_test: RuntimeError # Issue 10275
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index 4257d48..29fd51d 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -11,8 +11,6 @@
# to add them.
[ $compiler == app_jitk ]
-async/future_test/01: RuntimeError
-async/future_test/none: RuntimeError
async/slow_consumer2_test: RuntimeError
async/stream_controller_async_test: RuntimeError
async/stream_distinct_test: RuntimeError
@@ -196,17 +194,11 @@
[ $compiler == dartk && $system == windows ]
isolate/ping_pause_test: Skip # Issues 32137 and 32138
-[ $compiler == dartk && $hot_reload ]
-isolate/message4_test: Pass, Timeout
-
[ $compiler == dartk && $hot_reload_rollback ]
isolate/illegal_msg_function_test: Skip # Timeout
-isolate/message4_test: Pass, Timeout
isolate/pause_test: Skip # Timeout
[ $compiler == dartk && $strong ]
-async/future_test/01: RuntimeError
-async/future_test/none: RuntimeError
async/slow_consumer2_test: RuntimeError # Issue 31402 (Invocation arguments)
async/stream_controller_async_test: RuntimeError
async/stream_distinct_test: RuntimeError
@@ -289,6 +281,7 @@
isolate/issue_21398_parent_isolate1_test: Skip # Timeout
isolate/mandel_isolate_test: Skip # Timeout
isolate/message2_test: Skip # Timeout
+isolate/message4_test: Pass, Timeout, Crash # Timeout and sporadic crash (issue 33824)
isolate/nested_spawn2_test: Skip # Timeout
isolate/nested_spawn_test: Skip # Timeout
isolate/raw_port_test: Skip # Timeout
@@ -307,8 +300,6 @@
# ===== dartkp + dart_precompiled status lines =====
[ $compiler == dartkp && $runtime == dart_precompiled && $strong ]
-async/future_test/01: RuntimeError
-async/future_test/none: RuntimeError
async/slow_consumer2_test: RuntimeError # Issue 31402 (Invocation arguments)
async/stream_controller_async_test: RuntimeError
async/stream_distinct_test: RuntimeError
diff --git a/tests/lib_2/mirrors/dynamic_load_test.dart b/tests/lib_2/mirrors/dynamic_load_test.dart
index 2605b8b..dddb1ac 100644
--- a/tests/lib_2/mirrors/dynamic_load_test.dart
+++ b/tests/lib_2/mirrors/dynamic_load_test.dart
@@ -43,6 +43,7 @@
}
print(error);
Expect.isTrue(error.toString().contains("Cannot open file") ||
+ error.toString().contains("file not found") ||
error.toString().contains("No such file or directory") ||
error.toString().contains("The system cannot find the file specified"));
Expect.isTrue(error.toString().contains("DOES_NOT_EXIST"));
diff --git a/tests/standalone_2/standalone_2.status b/tests/standalone_2/standalone_2.status
index a80c78b..965c602 100644
--- a/tests/standalone_2/standalone_2.status
+++ b/tests/standalone_2/standalone_2.status
@@ -94,12 +94,6 @@
[ $runtime == none && !$strong ]
io/process_exit_negative_test: Fail, OK # Must be run to exit with non-zero exit code.
-# These tests spawn a process that imports using a http URL, since
-# spawned processes now run in Dart2 mode the tests fail as http URL imports
-# is not supported by the front end.
-[ $runtime == vm && ($compiler == app_jit || $compiler == none) ]
-http_launch_test: RuntimeError # Issue 33388
-
[ $system == linux && ($runtime == flutter || $runtime == vm) ]
io/http_basic_test: Pass, Slow, Timeout # Issue 28046, These tests might be slow on an opt counter threshold bot. They also time out on the bot occasionally => flaky test issue 28046
io/http_launch_test: Pass, Slow, Timeout # Issue 28046, These tests might be slow on an opt counter threshold bot. They also time out on the bot occasionally => flaky test issue 28046
@@ -179,7 +173,10 @@
deferred_transitive_import_error_test: Crash
fragmentation_test: Pass, Crash # Issue 31421
io/addlatexhash_test: Pass, Crash # Issue 31252
+io/many_directory_operations_test: SkipSlow
+io/many_file_operations_test: SkipSlow
io/raw_datagram_read_all_test: Pass, Fail # Timing dependent.
-io/skipping_dart2js_compilations_test: Pass, Slow # Slow.
-io/test_runner_test: Pass, Slow # Slow.
+io/skipping_dart2js_compilations_test: SkipSlow
+io/test_runner_test: SkipSlow
package/*: SkipByDesign # Launches VMs in interesting ways.
+typed_data_isolate_test: SkipSlow
diff --git a/tests/standalone_2/standalone_2_kernel.status b/tests/standalone_2/standalone_2_kernel.status
index 2dbeff7..201fe64 100644
--- a/tests/standalone_2/standalone_2_kernel.status
+++ b/tests/standalone_2/standalone_2_kernel.status
@@ -11,7 +11,6 @@
# to add them.
[ $compiler == app_jitk ]
-http_launch_test: RuntimeError # Issue 33388
io/directory_test: RuntimeError
io/file_error_test: RuntimeError
io/file_test: RuntimeError
@@ -24,6 +23,7 @@
io/http_redirect_test: RuntimeError
io/http_reuse_server_port_test: RuntimeError
io/http_server_response_test: RuntimeError
+io/named_pipe_script_test: RuntimeError # Issue 33842
io/platform_test: RuntimeError
io/regress_10026_test: RuntimeError
io/secure_socket_argument_test: CompileTimeError
@@ -46,6 +46,9 @@
package/scenarios/invalid/invalid_utf8_test: CompileTimeError # Issue 32085
package/scenarios/invalid/non_existent_packages_file_test: CompileTimeError # Issue 32085
+[ $arch == simarm64 && $compiler == dartk && $strong ]
+io/http_bind_test: Pass, Slow
+
[ $builder_tag == optimization_counter_threshold && $compiler == dartk ]
map_insert_remove_oom_test: Skip # Heap limit too low.
@@ -62,11 +65,9 @@
io/socket_port_test: Pass, Crash
[ $compiler == dartk && $mode == debug && $hot_reload ]
-io/http_basic_test: Crash
io/web_socket_ping_test: Crash, Pass
[ $compiler == dartk && $runtime == vm && $strong ]
-http_launch_test: RuntimeError # Issue 33388
io/http_client_request_test: Pass, Timeout
io/http_compression_test: RuntimeError
io/platform_resolved_executable_test/03: Pass, RuntimeError
@@ -93,6 +94,7 @@
[ $compiler == dartk && $hot_reload_rollback ]
io/directory_chdir_test: Skip # Timeout
+io/echo_server_stream_test: Pass, Slow
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
@@ -103,8 +105,6 @@
io/directory_list_sync_test: Timeout, Pass # Please triage.
io/file_blocking_lock_test: Pass, Crash # Please triage.
io/file_lock_test: Slow, Pass
-io/platform_resolved_executable_test/01: Pass, RuntimeError # Issue 32134
-io/platform_resolved_executable_test/05: Pass, RuntimeError # Issue 32134
io/platform_test: RuntimeError # Please triage.
io/process_sync_test: Timeout, Pass
io/test_extension_fail_test: RuntimeError # Please traige.
@@ -123,6 +123,7 @@
io/http_advanced_test: Skip # Timeout
io/http_auth_digest_test: Crash
io/http_auth_test: Skip # Timeout
+io/http_basic_test: Pass, Crash # Sporadic crash, issue 33824
io/http_proxy_advanced_test: Skip # Timeout
io/http_read_test: Skip # Timeout
io/non_utf8_directory_test: Pass, Timeout
@@ -195,6 +196,9 @@
io/secure_socket_argument_test: CompileTimeError
io/web_socket_protocol_processor_test: CompileTimeError
+[ $system != windows && $strong && ($compiler == dartk || $compiler == dartkp) ]
+io/named_pipe_script_test: RuntimeError # Issue 33842
+
[ $fasta && $strong ]
package/package_isolate_test: CompileTimeError
diff --git a/tests/standalone_2/standalone_2_vm.status b/tests/standalone_2/standalone_2_vm.status
index 729da33..cd92c8e 100644
--- a/tests/standalone_2/standalone_2_vm.status
+++ b/tests/standalone_2/standalone_2_vm.status
@@ -92,7 +92,6 @@
io/file_input_stream_test: Skip # Issue 26109
io/file_stream_test: Skip # Issue 26109
io/file_typed_data_test: Skip # Issue 26109
-io/http_client_stays_alive_test: RuntimeError
io/process_sync_test: Timeout, Pass
[ $runtime == vm && ($arch == simarm || $arch == simarm64) ]
diff --git a/third_party/pkg/unittest.tar.gz.sha1 b/third_party/pkg/unittest.tar.gz.sha1
deleted file mode 100644
index 08c01a5..0000000
--- a/third_party/pkg/unittest.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-f59bbc8788aa01618a5b7f143ef7c82068c86b0f
\ No newline at end of file
diff --git a/tools/3xhead_flutter_hooks.sh b/tools/3xhead_flutter_hooks.sh
new file mode 100644
index 0000000..a075705
--- /dev/null
+++ b/tools/3xhead_flutter_hooks.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+#
+# After you have checked out a flutter engine with the latest framework and the
+# latest dart sdk, run this script to apply workarounds to the source code. It
+# may patch up the source code so the three HEADs work together correctly.
+#
+# Usage: src/third_party/dart/tools/3xhead_flutter_hooks.sh
+# (run inside the root of a flutter engine checkout)
+
+set -e
+if [ ! -e src/third_party/dart ]; then
+ echo "$0: error: "\
+ "This script must be run from the root of a flutter engine checkout" >&2
+ exit 1
+fi
+
+# Apply patches to the Flutter Engine if needed.
+src/third_party/dart/tools/patches/flutter-engine/apply.sh
diff --git a/tools/FAKE_COMMITS b/tools/FAKE_COMMITS
index 4632769..fbe07a6 100644
--- a/tools/FAKE_COMMITS
+++ b/tools/FAKE_COMMITS
@@ -23,3 +23,4 @@
Trigger mirroring of github repository
Trigger mirroring of github repository
Force build after DEPS format revert
+Force build while trybots are broken, to check builders for brokenness.
diff --git a/tools/VERSION b/tools/VERSION
index 2af778a..aa8aef1 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 68
+PRERELEASE 69
PRERELEASE_PATCH 0
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 71334db..ab78eda 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -312,8 +312,7 @@
"name": "fasta sdk tests",
"arguments": [
"--compiler=fasta",
- "--runtime=none",
- "--strong"
+ "--runtime=none"
]
},
{
@@ -323,14 +322,6 @@
"--runtime=none",
"co19_2"
]
- },
- {
- "name": "fasta legacy mode sdk tests",
- "arguments": [
- "--compiler=fasta",
- "--no-preview-dart-2",
- "--runtime=none"
- ]
}
]
},
@@ -693,7 +684,6 @@
"arguments": [
"-cdartdevc",
"--checked",
- "--strong",
"--use-sdk",
"language_2",
"corelib_2",
@@ -705,7 +695,6 @@
"arguments": [
"-cdartdevk",
"--checked",
- "--strong",
"--use-sdk",
"language_2",
"corelib_2",
@@ -764,7 +753,6 @@
"arguments": [
"-cdartdevc",
"--checked",
- "--strong",
"--use-sdk",
"language_2",
"corelib_2",
@@ -776,7 +764,6 @@
"arguments": [
"-cdartdevk",
"--checked",
- "--strong",
"--use-sdk",
"language_2",
"corelib_2",
@@ -922,7 +909,6 @@
"arguments": [
"--builder-tag=optimization_counter_threshold",
"--compiler=dartk",
- "--strong",
"--vm-options=--optimization-counter-threshold=5"
],
"fileset": "vm-kernel",
@@ -974,7 +960,7 @@
},
{
"name": "vm tests",
- "arguments": ["--compiler=dartk", "--hot-reload", "--strong"]
+ "arguments": ["--compiler=dartk", "--hot-reload"]
}
]
},
@@ -1022,7 +1008,7 @@
},
{
"name": "vm tests",
- "arguments": ["--compiler=dartk", "--hot-reload-rollback", "--strong"]
+ "arguments": ["--compiler=dartk", "--hot-reload-rollback"]
}
]
},
@@ -1943,30 +1929,145 @@
"script": "tools/build.py",
"arguments": ["create_sdk"]
},
+
{
- "name": "Analyze pkg/analysis_server",
+ "name": "analyze pkg/analysis_server",
"script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
- "arguments": ["--no-hints","pkg/analysis_server"]
+ "arguments": ["pkg/analysis_server"]
},
{
- "name": "Analyze pkg/analyzer",
+ "name": "analyze pkg/analysis_server_client",
"script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
- "arguments": ["--no-hints","pkg/analyzer"]
+ "arguments": ["pkg/analysis_server_client"]
},
{
- "name": "analyze tests",
- "arguments": [
- "--compiler=dart2analyzer",
- "--use-sdk"
- ]
+ "name": "analyze pkg/analyzer",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/analyzer"]
},
{
- "name": "analyze pkg tests",
- "arguments": [
- "--compiler=dart2analyzer",
- "--use-sdk",
- "pkg"
- ]
+ "name": "analyze pkg/analyzer_cli",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/analyzer_cli"]
+ },
+ {
+ "name": "analyze pkg/analyzer_plugin",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/analyzer_plugin"]
+ },
+ {
+ "name": "analyze pkg/async_helper",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/async_helper"]
+ },
+ {
+ "name": "analyze pkg/build_integration",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/build_integration"]
+ },
+ {
+ "name": "analyze pkg/compiler",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/compiler"]
+ },
+ {
+ "name": "analyze pkg/dart_internal",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/dart_internal"]
+ },
+ {
+ "name": "analyze pkg/dart_messages",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/dart_messages"]
+ },
+ {
+ "name": "analyze pkg/dev_compiler",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/dev_compiler"]
+ },
+ {
+ "name": "analyze pkg/expect",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/expect"]
+ },
+ {
+ "name": "analyze pkg/front_end",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/front_end"]
+ },
+ {
+ "name": "analyze pkg/js",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/js"]
+ },
+ {
+ "name": "analyze pkg/js_ast",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/js_ast"]
+ },
+ {
+ "name": "analyze pkg/kernel",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/kernel"]
+ },
+ {
+ "name": "analyze pkg/meta",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/meta"]
+ },
+ {
+ "name": "analyze pkg/microlytics",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/microlytics"]
+ },
+ {
+ "name": "analyze pkg/smith",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/smith"]
+ },
+ {
+ "name": "analyze pkg/sourcemap_testing",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/sourcemap_testing"]
+ },
+ {
+ "name": "analyze pkg/status_file",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/status_file"]
+ },
+ {
+ "name": "analyze pkg/telemetry",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/telemetry"]
+ },
+ {
+ "name": "analyze pkg/testing",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/testing"]
+ },
+ {
+ "name": "analyze pkg/vm",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["pkg/vm"]
+ },
+ {
+ "name": "analyze tools/gardening",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["tools/gardening"]
+ },
+ {
+ "name": "analyze tools/testing/dart",
+ "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+ "arguments": ["tools/testing/dart"]
+ },
+
+ {
+ "name": "dartanalyzer --batch tests",
+ "arguments": [ "--compiler=dart2analyzer", "--use-sdk" ]
+ },
+ {
+ "name": "dartanalyzer --batch pkg tests",
+ "arguments": [ "--compiler=dart2analyzer", "--use-sdk", "pkg" ]
}
]
},
@@ -1985,7 +2086,6 @@
"name": "analyze pkg/analysis_server",
"script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
"arguments": [
- "--no-hints",
"--use-fasta-parser",
"pkg/analysis_server"
]
@@ -1994,18 +2094,16 @@
"name": "analyze pkg/analyzer",
"script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
"arguments": [
- "--no-hints",
"--use-fasta-parser",
"pkg/analyzer"
]
},
{
- "name": "analyze pkg/analyzer_cli/lib",
+ "name": "analyze pkg/analyzer_cli",
"script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
"arguments": [
- "--no-hints",
"--use-fasta-parser",
- "pkg/analyzer_cli/lib"
+ "pkg/analyzer_cli"
]
},
{
diff --git a/tools/infra/config/cq.cfg b/tools/infra/config/cq.cfg
index 74b7c37..f6d7009 100644
--- a/tools/infra/config/cq.cfg
+++ b/tools/infra/config/cq.cfg
@@ -28,7 +28,7 @@
builders { name: "dart2js-unit-linux-x64-release-try" }
builders { name: "ddc-linux-release-chrome-try" }
builders { name: "front-end-linux-release-x64-try" }
- builders { name: "pkg-linux-release-try" }
+ builders { name: "pkg-linux-release-try" experiment_percentage: 100}
builders { name: "vm-canary-linux-debug-try" }
builders { name: "vm-kernel-linux-release-simdbc64-try" }
builders { name: "vm-kernel-linux-release-x64-try" }
diff --git a/tools/observatory_tool.py b/tools/observatory_tool.py
deleted file mode 100755
index 6d9c9e5..0000000
--- a/tools/observatory_tool.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-"""Helper for building and deploying Observatory"""
-
-import os
-import shutil
-import sys
-
-IGNORE_PATTERNS = shutil.ignore_patterns(
- '$sdk',
- '*.concat.js',
- '*.dart',
- '*.log',
- '*.map',
- '*.precompiled.js',
- '*.scriptUrls',
- '*_buildLogs*',
- '*~',
- 'CustomElements.*',
- 'HTMLImports.*',
- 'MutationObserver.*',
- 'ShadowDOM.*',
- 'bower.json',
- 'dart_support.*',
- 'interop_support.*',
- 'package.json',
- 'unittest*',
- 'webcomponents-lite.js',
- 'webcomponents.*')
-
-# - Copy over the filtered web directory
-# - Merge in the .js file
-# - Copy over the filtered dependency lib directories
-# - Copy over the filtered observatory package
-def Deploy(output_dir, web_dir, observatory_lib, js_file, pub_packages_dir):
- shutil.rmtree(output_dir)
- os.makedirs(output_dir)
-
- output_web_dir = os.path.join(output_dir, 'web')
- shutil.copytree(web_dir, output_web_dir, ignore=IGNORE_PATTERNS)
- os.utime(os.path.join(output_web_dir, 'index.html'), None)
-
- shutil.copy(js_file, output_web_dir)
-
- packages_dir = os.path.join(output_web_dir, 'packages')
- os.makedirs(packages_dir)
- for subdir in os.listdir(pub_packages_dir):
- libdir = os.path.join(pub_packages_dir, subdir, 'lib')
- if os.path.isdir(libdir):
- shutil.copytree(libdir, os.path.join(packages_dir, subdir),
- ignore=IGNORE_PATTERNS)
- shutil.copytree(observatory_lib, os.path.join(packages_dir, 'observatory'),
- ignore=IGNORE_PATTERNS)
-
-
-def Main():
- args = sys.argv[1:]
- return Deploy(args[0], args[1], args[2], args[3], args[4])
-
-
-if __name__ == '__main__':
- sys.exit(Main());
diff --git a/tools/patches/flutter-engine/apply.sh b/tools/patches/flutter-engine/apply.sh
new file mode 100755
index 0000000..984576a
--- /dev/null
+++ b/tools/patches/flutter-engine/apply.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+#
+# When in a Flutter Engine checkout, this script checks what version of the Dart
+# SDK the engine is pinned to, and patches the engine if there is a known patch
+# that needs to be applied on the next Dart SDK roll in the engine.
+#
+# This script is meant to be used by 3xHEAD CI infrastructure, allowing
+# incompatible changes to be made to the Dart SDK requiring a matching change
+# to the Flutter Engine, without breaking the CI. The patch is associated with
+# the Dart SDK version the engine is pinned so. When the engine rolls its SDK,
+# then it stops applying patches atomically as there isn't a patch available yet
+# for the new roll.
+#
+# Usage: src/third_party/dart/tools/patches/flutter-engine/apply.sh
+# (run inside the root of a flutter engine checkout)
+
+set -e
+if [ ! -e src/third_party/dart ]; then
+ echo "$0: error: "\
+ "This script must be run from the root of a flutter engine checkout" >&2
+ exit 1
+fi
+pinned_dart_sdk=$(grep -E "'dart_revision':.*" src/flutter/DEPS |
+ sed -E "s/.*'([^']*)',/\1/")
+patch=src/third_party/dart/tools/patches/flutter-engine/${pinned_dart_sdk}.patch
+if [ -e "$patch" ]; then
+ (cd src/flutter && git apply ../../$patch)
+ gclient runhooks
+fi
diff --git a/tools/patches/flutter-engine/create.sh b/tools/patches/flutter-engine/create.sh
new file mode 100755
index 0000000..d9bc6fd
--- /dev/null
+++ b/tools/patches/flutter-engine/create.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+#
+# This script produces a patch to the Flutter Engine from the local uncommitted
+# changes in the current engine checkout. It is named after the Dart SDK
+# revision the engine is currently pinned to. It's meant to be consumed by the
+# apply.sh script next to this script. Any existing patches are removed, as they
+# are assumed to not be relevant anymore. If there are no uncommited changes in
+# the local engine checkout, then no patch is produced.
+#
+# Usage: src/third_party/dart/tools/patches/flutter-engine/create.sh
+# (run inside the root of a flutter engine checkout)
+
+set -e
+if [ ! -e src/third_party/dart ]; then
+ echo "$0: error: "\
+ "This script must be run from the root of a flutter engine checkout" >&2
+ exit 1
+fi
+pinned_dart_sdk=$(grep -E "'dart_revision':.*" src/flutter/DEPS |
+ sed -E "s/.*'([^']*)',/\1/")
+patch=src/third_party/dart/tools/patches/flutter-engine/$pinned_dart_sdk.patch
+rm -f src/third_party/dart/tools/patches/flutter-engine/*.patch
+(cd src/flutter && git diff) > $patch
+if [ ! -s $patch ]; then
+ rm $patch
+fi
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index 439f46c..f3635c7 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -492,6 +492,15 @@
.absolute
.toNativePath();
+ // If we're testing a built SDK use the SDK path. This will test that we can
+ // find the summary file from that. For local development we don't have a
+ // built SDK yet, so point directly at the built summary file.
+ //
+ // TODO(jmesserly): ideally we'd test the `dartdevc` script/.bat file.
+ // That's the closest to what users/tools use. That script has its own way
+ // of computing `--dart-sdk` and passing it to DDC. For simplicitly that
+ // script should be passing `--dart-sdk-summary`, that way DDC doesn't need
+ // two options for the same thing.
var args = _useSdk
? ["--dart-sdk", "${_configuration.buildDirectory}/dart-sdk"]
: ["--dart-sdk-summary", sdkSummary];
diff --git a/utils/analysis_server/.gitignore b/utils/analysis_server/.gitignore
deleted file mode 100644
index 010faca..0000000
--- a/utils/analysis_server/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/analysis_server.Makefile
-/analysis_server.target.mk
-
diff --git a/utils/analysis_server_dart1/BUILD.gn b/utils/analysis_server_dart1/BUILD.gn
new file mode 100644
index 0000000..dee8bbd
--- /dev/null
+++ b/utils/analysis_server_dart1/BUILD.gn
@@ -0,0 +1,11 @@
+# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+import("../application_snapshot.gni")
+
+application_snapshot("analysis_server_dart1") {
+ dart_version = 1
+ main_dart = "../../pkg/analysis_server/bin/server.dart"
+ training_args = [ "--help" ]
+}