Version 2.8.0-dev.11.0
Merge commit '860dca93ea422ba12a9390de2a83c2a45968e083' into dev
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
new file mode 100644
index 0000000..20db2ee
--- /dev/null
+++ b/.dart_tool/package_config.json
@@ -0,0 +1,793 @@
+{
+ "copyright": [
+ "Copyright (c) 2020, 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."
+ ],
+ "comment": [
+ "Package configuration for all packages in /pkg, and checked out by DEPS",
+ "into /third_party/pkg and /third_party/pkg_tested.",
+ "If you add a package to DEPS or /pkg or change a package's SDK",
+ "constraint, update this by running tools/generate_package_config.dart."
+ ],
+ "configVersion": 2,
+ "generated": "2020-02-27T09:12:42.886102",
+ "generator": "tools/generate_package_config.dart",
+ "packages": [
+ {
+ "name": "_fe_analyzer_shared",
+ "rootUri": "../pkg/_fe_analyzer_shared",
+ "packageUri": "lib/",
+ "languageVersion": "2.2"
+ },
+ {
+ "name": "_js_interop_checks",
+ "rootUri": "../pkg/_js_interop_checks",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "analysis_server",
+ "rootUri": "../pkg/analysis_server",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "analysis_server_client",
+ "rootUri": "../pkg/analysis_server_client",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "analysis_tool",
+ "rootUri": "../pkg/analysis_tool",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "analyzer",
+ "rootUri": "../pkg/analyzer",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "analyzer_cli",
+ "rootUri": "../pkg/analyzer_cli",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "analyzer_fe_comparison",
+ "rootUri": "../pkg/analyzer_fe_comparison",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "analyzer_plugin",
+ "rootUri": "../pkg/analyzer_plugin",
+ "packageUri": "lib/",
+ "languageVersion": "2.3"
+ },
+ {
+ "name": "args",
+ "rootUri": "../third_party/pkg/args",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "async",
+ "rootUri": "../third_party/pkg/async",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "async_helper",
+ "rootUri": "../pkg/async_helper",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "bazel_worker",
+ "rootUri": "../third_party/pkg/bazel_worker",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "benchmark_harness",
+ "rootUri": "../third_party/pkg/benchmark_harness",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "boolean_selector",
+ "rootUri": "../third_party/pkg/boolean_selector",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "build_integration",
+ "rootUri": "../pkg/build_integration",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "charcode",
+ "rootUri": "../third_party/pkg/charcode",
+ "packageUri": "lib/",
+ "languageVersion": "1.0"
+ },
+ {
+ "name": "cli_util",
+ "rootUri": "../third_party/pkg/cli_util",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "code_transformers",
+ "rootUri": "../third_party/pkg/code_transformers",
+ "packageUri": "lib/",
+ "languageVersion": "1.0"
+ },
+ {
+ "name": "collection",
+ "rootUri": "../third_party/pkg/collection",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "compiler",
+ "rootUri": "../pkg/compiler",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "convert",
+ "rootUri": "../third_party/pkg/convert",
+ "packageUri": "lib/",
+ "languageVersion": "1.17"
+ },
+ {
+ "name": "crypto",
+ "rootUri": "../third_party/pkg/crypto",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "csslib",
+ "rootUri": "../third_party/pkg/csslib",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "dart2js_info",
+ "rootUri": "../third_party/pkg/dart2js_info",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "dart2js_tools",
+ "rootUri": "../pkg/dart2js_tools",
+ "packageUri": "lib/",
+ "languageVersion": "2.3"
+ },
+ {
+ "name": "dart2native",
+ "rootUri": "../pkg/dart2native",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "dart_internal",
+ "rootUri": "../pkg/dart_internal",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "dart_style",
+ "rootUri": "../third_party/pkg_tested/dart_style",
+ "packageUri": "lib/",
+ "languageVersion": "2.3"
+ },
+ {
+ "name": "dartdev",
+ "rootUri": "../pkg/dartdev",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "dartdoc",
+ "rootUri": "../third_party/pkg/dartdoc",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "dartfix",
+ "rootUri": "../pkg/dartfix",
+ "packageUri": "lib/",
+ "languageVersion": "2.3"
+ },
+ {
+ "name": "dev_compiler",
+ "rootUri": "../pkg/dev_compiler",
+ "packageUri": "lib/",
+ "languageVersion": "2.3"
+ },
+ {
+ "name": "diagnostic",
+ "rootUri": "../pkg/diagnostic",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "expect",
+ "rootUri": "../pkg/expect",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "ffi",
+ "rootUri": "../third_party/pkg/ffi",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "fixnum",
+ "rootUri": "../third_party/pkg/fixnum",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "front_end",
+ "rootUri": "../pkg/front_end",
+ "packageUri": "lib/",
+ "languageVersion": "2.2"
+ },
+ {
+ "name": "front_end_agnostic",
+ "rootUri": "../pkg/front_end/testcases/agnostic",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "front_end_general_nnbd_opt_out",
+ "rootUri": "../pkg/front_end/testcases/general_nnbd_opt_out",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "front_end_late_lowering",
+ "rootUri": "../pkg/front_end/testcases/late_lowering",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "front_end_nnbd",
+ "rootUri": "../pkg/front_end/testcases/nnbd",
+ "packageUri": ".nonexisting/"
+ },
+ {
+ "name": "frontend_server",
+ "rootUri": "../pkg/frontend_server",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "func",
+ "rootUri": "../third_party/pkg/func",
+ "packageUri": "lib/",
+ "languageVersion": "1.9"
+ },
+ {
+ "name": "gardening",
+ "rootUri": "../tools/gardening",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "glob",
+ "rootUri": "../third_party/pkg/glob",
+ "packageUri": "lib/",
+ "languageVersion": "1.23"
+ },
+ {
+ "name": "html",
+ "rootUri": "../third_party/pkg/html",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "http",
+ "rootUri": "../third_party/pkg/http",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "http_io",
+ "rootUri": "../third_party/pkg_tested/http_io",
+ "packageUri": "lib/",
+ "languageVersion": "2.5"
+ },
+ {
+ "name": "http_multi_server",
+ "rootUri": "../third_party/pkg/http_multi_server",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "http_parser",
+ "rootUri": "../third_party/pkg/http_parser",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "http_retry",
+ "rootUri": "../third_party/pkg/http_retry",
+ "packageUri": "lib/",
+ "languageVersion": "1.24"
+ },
+ {
+ "name": "http_throttle",
+ "rootUri": "../third_party/pkg/http_throttle",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "initialize",
+ "rootUri": "../third_party/pkg/initialize",
+ "packageUri": "lib/",
+ "languageVersion": "1.9"
+ },
+ {
+ "name": "intl",
+ "rootUri": "../third_party/pkg/intl",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "js",
+ "rootUri": "../pkg/js",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "js_ast",
+ "rootUri": "../pkg/js_ast",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "js_runtime",
+ "rootUri": "../sdk/lib/_internal/js_runtime",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "json_rpc_2",
+ "rootUri": "../third_party/pkg/json_rpc_2",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "kernel",
+ "rootUri": "../pkg/kernel",
+ "packageUri": "lib/",
+ "languageVersion": "2.2"
+ },
+ {
+ "name": "linter",
+ "rootUri": "../third_party/pkg/linter",
+ "packageUri": "lib/",
+ "languageVersion": "2.2"
+ },
+ {
+ "name": "logging",
+ "rootUri": "../third_party/pkg/logging",
+ "packageUri": "lib/",
+ "languageVersion": "1.5"
+ },
+ {
+ "name": "markdown",
+ "rootUri": "../third_party/pkg/markdown",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "matcher",
+ "rootUri": "../third_party/pkg/matcher",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "meta",
+ "rootUri": "../pkg/meta",
+ "packageUri": "lib/",
+ "languageVersion": "1.12"
+ },
+ {
+ "name": "metatest",
+ "rootUri": "../third_party/pkg/metatest",
+ "packageUri": "lib/",
+ "languageVersion": "1.8"
+ },
+ {
+ "name": "mime",
+ "rootUri": "../third_party/pkg/mime",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "mockito",
+ "rootUri": "../third_party/pkg/mockito",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "modular_test",
+ "rootUri": "../pkg/modular_test",
+ "packageUri": "lib/",
+ "languageVersion": "2.2"
+ },
+ {
+ "name": "mustache",
+ "rootUri": "../third_party/pkg/mustache",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "native_stack_traces",
+ "rootUri": "../pkg/native_stack_traces",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "nnbd_migration",
+ "rootUri": "../pkg/nnbd_migration",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "oauth2",
+ "rootUri": "../third_party/pkg/oauth2",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "observable",
+ "rootUri": "../third_party/pkg/observable",
+ "packageUri": "lib/",
+ "languageVersion": "1.19"
+ },
+ {
+ "name": "observatory",
+ "rootUri": "../runtime/observatory",
+ "packageUri": "lib/",
+ "languageVersion": "2.2"
+ },
+ {
+ "name": "observatory_test_package",
+ "rootUri": "../runtime/observatory/tests/service/observatory_test_package",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "observe",
+ "rootUri": "../third_party/pkg/observe",
+ "packageUri": "lib/",
+ "languageVersion": "1.9"
+ },
+ {
+ "name": "package_config",
+ "rootUri": "../third_party/pkg_tested/package_config",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "package_resolver",
+ "rootUri": "../third_party/pkg_tested/package_resolver",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "path",
+ "rootUri": "../third_party/pkg/path",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "pedantic",
+ "rootUri": "../third_party/pkg/pedantic",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "platform",
+ "rootUri": "../third_party/pkg/platform",
+ "packageUri": "lib/",
+ "languageVersion": "1.24"
+ },
+ {
+ "name": "plugin",
+ "rootUri": "../third_party/pkg/plugin",
+ "packageUri": "lib/",
+ "languageVersion": "1.0"
+ },
+ {
+ "name": "pool",
+ "rootUri": "../third_party/pkg/pool",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "process",
+ "rootUri": "../third_party/pkg/process",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "protobuf",
+ "rootUri": "../third_party/pkg/protobuf/protobuf",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "pub",
+ "rootUri": "../third_party/pkg/pub",
+ "packageUri": "lib/",
+ "languageVersion": "2.3"
+ },
+ {
+ "name": "pub_semver",
+ "rootUri": "../third_party/pkg/pub_semver",
+ "packageUri": "lib/",
+ "languageVersion": "1.0"
+ },
+ {
+ "name": "quiver",
+ "rootUri": "../third_party/pkg/quiver",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "resource",
+ "rootUri": "../third_party/pkg/resource",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "scheduled_test",
+ "rootUri": "../third_party/pkg/scheduled_test",
+ "packageUri": "lib/",
+ "languageVersion": "1.22"
+ },
+ {
+ "name": "sdk_library_metadata",
+ "rootUri": "../sdk/lib/_internal/sdk_library_metadata",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "shelf",
+ "rootUri": "../third_party/pkg/shelf",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "shelf_packages_handler",
+ "rootUri": "../third_party/pkg/shelf_packages_handler",
+ "packageUri": "lib/",
+ "languageVersion": "1.22"
+ },
+ {
+ "name": "shelf_static",
+ "rootUri": "../third_party/pkg/shelf_static",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "shelf_web_socket",
+ "rootUri": "../third_party/pkg/shelf_web_socket",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "smith",
+ "rootUri": "../pkg/smith",
+ "packageUri": "lib/",
+ "languageVersion": "2.3"
+ },
+ {
+ "name": "smoke",
+ "rootUri": "../third_party/pkg/smoke",
+ "packageUri": "lib/",
+ "languageVersion": "1.12"
+ },
+ {
+ "name": "source_map_stack_trace",
+ "rootUri": "../third_party/pkg/source_map_stack_trace",
+ "packageUri": "lib/",
+ "languageVersion": "1.8"
+ },
+ {
+ "name": "source_maps",
+ "rootUri": "../third_party/pkg/source_maps",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "source_span",
+ "rootUri": "../third_party/pkg/source_span",
+ "packageUri": "lib/",
+ "languageVersion": "1.8"
+ },
+ {
+ "name": "sourcemap_testing",
+ "rootUri": "../pkg/sourcemap_testing",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "stack_trace",
+ "rootUri": "../third_party/pkg/stack_trace",
+ "packageUri": "lib/",
+ "languageVersion": "1.23"
+ },
+ {
+ "name": "stagehand",
+ "rootUri": "../third_party/pkg/stagehand",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "status_file",
+ "rootUri": "../pkg/status_file",
+ "packageUri": "lib/",
+ "languageVersion": "2.3"
+ },
+ {
+ "name": "stream_channel",
+ "rootUri": "../third_party/pkg/stream_channel",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "string_scanner",
+ "rootUri": "../third_party/pkg/string_scanner",
+ "packageUri": "lib/",
+ "languageVersion": "1.8"
+ },
+ {
+ "name": "telemetry",
+ "rootUri": "../pkg/telemetry",
+ "packageUri": "lib/",
+ "languageVersion": "1.0"
+ },
+ {
+ "name": "term_glyph",
+ "rootUri": "../third_party/pkg/term_glyph",
+ "packageUri": "lib/",
+ "languageVersion": "1.8"
+ },
+ {
+ "name": "test",
+ "rootUri": "../third_party/pkg/test/pkgs/test",
+ "packageUri": "lib/",
+ "languageVersion": "2.2"
+ },
+ {
+ "name": "test_api",
+ "rootUri": "../third_party/pkg/test/pkgs/test_api",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "test_core",
+ "rootUri": "../third_party/pkg/test/pkgs/test_core",
+ "packageUri": "lib/",
+ "languageVersion": "2.1"
+ },
+ {
+ "name": "test_descriptor",
+ "rootUri": "../third_party/pkg/test_descriptor",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "test_process",
+ "rootUri": "../third_party/pkg/test_process",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "test_reflective_loader",
+ "rootUri": "../third_party/pkg/test_reflective_loader",
+ "packageUri": "lib/",
+ "languageVersion": "1.8"
+ },
+ {
+ "name": "test_runner",
+ "rootUri": "../pkg/test_runner",
+ "packageUri": "lib/",
+ "languageVersion": "2.3"
+ },
+ {
+ "name": "testing",
+ "rootUri": "../pkg/testing",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "tflite_native",
+ "rootUri": "../third_party/pkg/tflite_native",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "tuple",
+ "rootUri": "../third_party/pkg/tuple",
+ "packageUri": "lib/",
+ "languageVersion": "1.6"
+ },
+ {
+ "name": "typed_data",
+ "rootUri": "../third_party/pkg/typed_data",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "unittest",
+ "rootUri": "../third_party/pkg/unittest",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "unittest-orig",
+ "rootUri": "../third_party/pkg/unittest-orig",
+ "packageUri": "lib/",
+ "languageVersion": "1.0"
+ },
+ {
+ "name": "usage",
+ "rootUri": "../third_party/pkg/usage",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "utf",
+ "rootUri": "../third_party/pkg/utf",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "vm",
+ "rootUri": "../pkg/vm",
+ "packageUri": "lib/",
+ "languageVersion": "2.7"
+ },
+ {
+ "name": "vm_service",
+ "rootUri": "../pkg/vm_service",
+ "packageUri": "lib/",
+ "languageVersion": "2.6"
+ },
+ {
+ "name": "watcher",
+ "rootUri": "../third_party/pkg/watcher",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "web_components",
+ "rootUri": "../third_party/pkg/web_components",
+ "packageUri": "lib/",
+ "languageVersion": "1.9"
+ },
+ {
+ "name": "web_socket_channel",
+ "rootUri": "../third_party/pkg/web_socket_channel",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ },
+ {
+ "name": "yaml",
+ "rootUri": "../third_party/pkg/yaml",
+ "packageUri": "lib/",
+ "languageVersion": "2.0"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index becbebb..8fcdcd5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,14 @@
### Core libraries
+#### `dart:core`
+
+* The class `TypeError` no longer extends `AssertionError`.
+ This also means that it no longer inherits the spurious `message` getter
+ which was added to `AssertionError` when the second operand to `assert`
+ was allowed. The value of that getter on a `TypeError` was the same
+ string as returned by `toString`, so it is still available.
+
#### `dart:html`
* **Breaking Change**: Changed the return type of several html native methods
@@ -22,20 +30,36 @@
#### `dart:io`
* Class `HttpParser` will no longer throw an exception when a HTTP response
- status code is within [0, 999]. Customized status codes in this range are now valid.
+ status code is within [0, 999]. Customized status codes in this range are now
+ valid.
+
* **Breaking change** [#33501](https://github.com/dart-lang/sdk/issues/33501):
+ This is breaking only for classes extending or implementing `HttpHeaders` and
+ having their own `add` or `set` methods without the `bool preserveHeaderCase`
+ named parameter. The signature of `add` and `set` has been changed to
-An named parameter is added to `add` and `set` for class `HttpHeaders`.
-The signature of has been changed from `void add(String name, Object value)` to
-`void add(String name, Object value, {bool preserveHeaderCase: false})`.
-Same change is applied to `set`. `preserveHeaderCase` will preserve the
-case of `name` instead of converting them to lowercase.
-`HttpHeader.forEach()` provides the current case of each header.
+ ```dart
+ void add(String name, Object value, {bool preserveHeaderCase: false})
+ void set(String name, Object value, {bool preserveHeaderCase: false})
+ ```
-* The `Socket` class will now throw a `SocketException` if the socket has been
- destroyed or upgraded to a secure socket upon setting or getting socket
- options. Previously setting a socket options would be ignored and getting a
- socket option would return `null`.
+ Setting `preserveHeaderCase` to `true` will preserve the case of the `name`
+ parameter instead of converting it to lowercase. The `HttpHeader.forEach()`
+ method provides the current case of each header.
+
+* **Breaking change** [#40702](https://github.com/dart-lang/sdk/issues/40702):
+ The `Socket` class will now throw a `SocketException` if the socket has been
+ explicitly destroyed or upgraded to a secure socket upon setting or getting
+ socket options. Previously setting a socket option would be ignored and
+ getting a socket option would return `null`.
+
+* **Breaking change** [#40483](https://github.com/dart-lang/sdk/issues/40483):
+ The `Process` class will now throw a `StateError` if the process is detached
+ (`ProcessStartMode.detached` and `ProcessStartMode.detachedWithStdio`) upon
+ accessing the `exitCode` getter. It now also throws when not connected to the
+ child process's stdio (`ProcessStartMode.detached` and
+ `ProcessStartMode.inheritStdio`) upon accessing the `stdin`, `stdout`, and
+ `stderr` getters. Previously these getters would all return `null`.
#### `dart:mirrors`
@@ -108,14 +132,13 @@
#### Linter
-The Linter was updated to `0.1.110`, which includes:
+The Linter was updated to `0.1.112`, which includes:
-* fixed flutter web plugin detection in `avoid_web_libraries_in_flutter`
-* new lint: `unnecessary_string_interpolations`
-* new lint: `missing_whitespace_between_adjacent_strings`
-* `avoid_unused_constructor_parameters` updated to ignore deprecated parameters
-* new lint: `no_runtimeType_toString`
-* miscellaneous doc fixes
+* new lint: `use_raw_strings`
+* new lint: `unnecessary_raw_strings`
+* new lint: `avoid_escaping_inner_quotes`
+* new lint: `unnecessary_string_escapes`
+* incompatible rule documentation improvements
#### Pub
@@ -761,7 +784,7 @@
* `pub publish` will no longer warn about missing dependencies for import
statements in `example/`.
-* OAuth2 authentication will explicitely ask for the `openid` scope.
+* OAuth2 authentication will explicitly ask for the `openid` scope.
## 2.3.2 - 2019-06-11
@@ -2155,7 +2178,7 @@
#### `dart:developer`
* `Flow` class added.
-* `Timeline.startSync` and `Timeline.timeSync` now accept an optional
+* `Timeline.startSync` and `Timeline.timeSync` now accepts an optional
parameter `flow` of type `Flow`. The `flow` parameter is used to generate
flow timeline events that are enclosed by the slice described by
`Timeline.{start,finish}Sync` and `Timeline.timeSync`.
@@ -2644,7 +2667,7 @@
#### Strong Mode
* Removed ad hoc `Future.then` inference in favor of using `FutureOr`. Prior to
- adding `FutureOr` to the language, the analyzer implented an ad hoc type
+ adding `FutureOr` to the language, the analyzer implemented an ad hoc type
inference for `Future.then` (and overrides) treating it as if the onValue
callback was typed to return `FutureOr` for the purposes of inference.
This ad hoc inference has been removed now that `FutureOr` has been added.
diff --git a/DEPS b/DEPS
index bea2e40..b0780a6 100644
--- a/DEPS
+++ b/DEPS
@@ -47,8 +47,8 @@
# The list of revisions for these tools comes from Fuchsia, here:
# https://fuchsia.googlesource.com/buildtools/+/master/fuchsia.ensure
# If there are problems with the toolchain, contact fuchsia-toolchain@.
- "clang_revision": "de39621f0f03f20633bdfa50bde97a3908bf6e98",
- "gn_revision": "bdb0fd02324b120cacde634a9235405061c8ea06",
+ "clang_revision": "b25fc4123c77097c05ea221e023fa5c6a16e0f41",
+ "gn_revision": "239533d2d91a04b3317ca9101cf7189f4e651e4d",
# Scripts that make 'git cl format' work.
"clang_format_scripts_rev": "c09c8deeac31f05bd801995c475e7c8070f9ecda",
@@ -56,7 +56,7 @@
"gperftools_revision": "e9ab4c53041ac62feefbbb076d326e9a77dd1567",
# Revisions of /third_party/* dependencies.
- "args_tag": "1.5.2",
+ "args_tag": "1.5.3",
"async_tag": "2.0.8",
"bazel_worker_tag": "v0.1.22",
"benchmark_harness_tag": "81641290dea44c34138a109a37e215482f405f81",
@@ -102,7 +102,7 @@
"intl_tag": "0.15.7",
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
"json_rpc_2_tag": "2.0.9",
- "linter_tag": "0.1.110",
+ "linter_tag": "0.1.112",
"logging_tag": "0.11.3+2",
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
"markdown_tag": "2.1.1",
@@ -112,7 +112,7 @@
"mustache_tag" : "5e81b12215566dbe2473b2afd01a8a8aedd56ad9",
"oauth2_tag": "1.2.1",
"observatory_pub_packages_rev": "0894122173b0f98eb08863a7712e78407d4477bc",
- "package_config_tag": "3401e2897b3cf46e64966e2ba19ed7032501cf41", # should be 1.9.0
+ "package_config_tag": "87a8b5184020ebcc13b34ee95dde58f851b68ca3", # should be 1.9.0
"package_resolver_tag": "1.0.10",
"path_tag": "1.6.2",
"pedantic_tag": "v1.8.0",
@@ -134,7 +134,7 @@
"source_maps_tag": "8af7cc1a1c3a193c1fba5993ce22a546a319c40e",
"source_span_tag": "1.5.5",
"stack_trace_tag": "1.9.3",
- "stagehand_tag": "v3.3.6",
+ "stagehand_tag": "v3.3.7",
"stream_channel_tag": "2.0.0",
"string_scanner_tag": "1.0.3",
"test_descriptor_tag": "1.1.1",
@@ -426,7 +426,7 @@
Var("dart_root") + "/buildtools/" + Var("host_os") + "-" + Var("host_cpu") + "/clang": {
"packages": [
{
- "package": "fuchsia/clang/${{platform}}",
+ "package": "fuchsia/third_party/clang/${{platform}}",
"version": "git_revision:" + Var("clang_revision"),
},
],
diff --git a/README.md b/README.md
index aac57f6..a88db95 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@
* **Dart Web**: For programs targeting the web, Dart Web includes both a development time
compiler (dartdevc) and a production time compiler (dart2js).
-![Dart platforms illustration](https://dart.dev/assets/platforms-7f4d540acf9fe801b456ad74f9f855230a385014d05d9f5997c878b889a67a0f.svg)
+![Dart platforms illustration](docs/assets/Dart-platforms.svg)
## License & patents
diff --git a/WATCHLISTS b/WATCHLISTS
index c4d820c..e88ada2 100644
--- a/WATCHLISTS
+++ b/WATCHLISTS
@@ -69,7 +69,8 @@
'WATCHLISTS': {
'build': [ 'keertip@google.com' ],
'dart2js': [ 'johnniwinther@google.com', 'sigmund@google.com',
- 'sra@google.com', 'fishythefish@google.com' ],
+ 'sra@google.com', 'fishythefish@google.com',
+ 'joshualitt@google.com' ],
'front_end': [ 'dart-fe-team+reviews@google.com' ],
'kernel': [ 'jensj@google.com', 'alexmarkov@google.com' ],
'messages_review': [ 'dart-uxr+reviews@google.com' ],
diff --git a/build/config/clang/clang.gni b/build/config/clang/clang.gni
new file mode 100644
index 0000000..50bdb34
--- /dev/null
+++ b/build/config/clang/clang.gni
@@ -0,0 +1,10 @@
+# Copyright (c) 2020 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+default_clang_prefix =
+ rebase_path("//buildtools/${host_os}-${host_cpu}/clang/bin", root_build_dir)
+
+declare_args() {
+ clang_prefix = default_clang_prefix
+}
diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn
index 9e23651..06aabec 100644
--- a/build/config/linux/BUILD.gn
+++ b/build/config/linux/BUILD.gn
@@ -8,19 +8,9 @@
ldflags = []
cflags = []
- if (is_asan || is_lsan || is_msan || is_tsan || is_ubsan) {
- ldflags += [ "-lrt" ]
- } else if (is_clang) {
+ if (is_clang) {
# Don't allow visible symbols from libc++ to be re-exported.
- ldflags = [
- "-nodefaultlibs",
- "-lc++",
- "-lc",
- "-lm",
- "-lpthread",
- "-lclang_rt.builtins",
- "-Wl,--exclude-libs=libc++.a",
- ]
+ ldflags += [ "-Wl,--exclude-libs=libc++.a" ]
}
if (sysroot != "") {
@@ -47,7 +37,7 @@
}
if (is_qemu) {
- cflags += ["-DDART_RUN_IN_QEMU_ARMv7"]
+ cflags += [ "-DDART_RUN_IN_QEMU_ARMv7" ]
}
}
diff --git a/build/config/mac/BUILD.gn b/build/config/mac/BUILD.gn
index 02aae66..e013558 100644
--- a/build/config/mac/BUILD.gn
+++ b/build/config/mac/BUILD.gn
@@ -3,12 +3,16 @@
# found in the LICENSE file.
import("//build/config/sysroot.gni")
+import("../clang/clang.gni")
config("sdk") {
common_flags = [ "-stdlib=libc++" ]
cflags = common_flags
- ldflags = common_flags
+ ldflags = common_flags + [
+ "-nostdlib++",
+ "${clang_prefix}/../lib/libc++.a",
+ ]
}
# On Mac, this is used for everything except static libraries.
diff --git a/docs/assets/Dart-platforms.svg b/docs/assets/Dart-platforms.svg
new file mode 100644
index 0000000..e35cb87
--- /dev/null
+++ b/docs/assets/Dart-platforms.svg
@@ -0,0 +1 @@
+<svg version="1.1" viewBox="0.0 0.0 960.0 540.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="g6d68e641dc_0_1.0"><path d="m0 0l960.0 0l0 540.0l-960.0 0l0 -540.0z" clip-rule="nonzero"/></clipPath><g clip-path="url(#g6d68e641dc_0_1.0)"><path fill="#ffffff" d="m0 0l960.0 0l0 540.0l-960.0 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m750.38715 323.95078l72.0 0l0 72.0l-72.0 0z" fill-rule="evenodd"/><g transform="matrix(0.375 0.0 0.0 0.375 750.3871391076116 323.95079002624675)"><clipPath id="g6d68e641dc_0_1.1"><path d="m0 1.1368684E-13l192.0 0l0 192.0l-192.0 0z" clip-rule="evenodd"/></clipPath><image clip-path="url(#g6d68e641dc_0_1.1)" fill="#000" width="192.0" height="192.0" x="0.0" y="0.0" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAACnUlEQVR42u3dTU5TURiA4W+kGGEFJia1nZnIMlwBBDfjkFgS5yVlHy6hCRPAkRtQQ8D/Arb+4F0A2vaec3uw93m/BUC+h96e0wSIkCRJkiRJkiRJkiRJkiRJkiRJ7WwjnsUwDuM8pnHd8pnGWbWJYexUW1lKvTiIy9av/aa5qDbTa3b5a9H3Mz/j9bBXbamhOnFsxXPMSXSbWP/jeGe5c85pbOZe/8N4a7ELEWR9Fdyp3uctddEHUcb3gucWWmP6udb/IK6ss9aJKNNj6KVl1pxhnuf/uVXWnHGspwM8tciE2U4HeGGNCTNIB3hljQkzSgd4Y41JF7LkfACRMpN0AGegtEnugyUCAGAAtBbgoyUCAGAAADBlAD5ZIgAABgAAUwbgsyUCAGAAADBlAL5YIgAABgCApr7Aksv9/TcO8BUAAAAAALQW4BsAAAAAAAAAoAzAGAAAAAAAAABQBuACAAAAAAAAAFAG4BIAAAAAAAAAUAbgCgAAAAAAtBbgOwAAAADcXoC2/wIFgFUHmAAAAAAAAAAAygBMAdxuABcxAAAAAFhdgB8AAAAAAAAAgDIAPwEAAAAAQGsBfgEAAAAAAAAAygD8BgAAAAAAAACUAbgGAAAAAAAAAAAAAAAAAADL3c+q/4JGszNJBzizxoQ5TQc4tMaEGaUDDK0xYQbpADvWmDBb6QAbM/92rvnbjON+joPbgVXWnP08J+eeo2jNI+ijXJeXPeusMbv5bo/34rWFLjhHcTfnBb5bXSksdf55H53cn6FsIlhg/U+a+BirGyeWO9fDpxMNtRZ9J6IZJ5/dvM/+m14Hw5n/W6yt1679fAfPf7ce2zGIUfWuMPEzX21hVG1jK8+tV5IkSZIkSZIkSZIkSZIkSZIk/X/9AQVB8byLag0gAAAAAElFTkSuQmCC"/></g><path fill="#000000" fill-opacity="0.0" d="m153.50787 323.95078l72.0 0l0 71.997406l-72.0 0z" fill-rule="evenodd"/><g transform="matrix(0.375 0.0 0.0 0.3749863517060367 153.50787401574803 323.95079002624675)"><clipPath id="g6d68e641dc_0_1.2"><path d="m5.684342E-14 1.1368684E-13l192.0 0l0 192.0l-192.0 0z" clip-rule="evenodd"/></clipPath><image clip-path="url(#g6d68e641dc_0_1.2)" fill="#000" width="192.0" height="192.0" x="0.0" y="0.0" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAAChElEQVR42u3az04TURTA4bOiRPAVoDSuDL4NBJ6HEMIT8PeBmkwC8SEM0nQJJLQbHY0miO2VRe8dZ+b7nb2h58PhXoYISZIkSZIkSZIkSZIkSfrR+ziM66hiGvP41vGZ15+yiqs4iM3/Y/kf6tU/dX7ti+YxLmPU7PLX47QH3/OpmcVJDJpa/yg+93r5v+c2hk2s/1N8tfxfcxe75b/77y3+D4Jh2We/h8/ruSn5s+DUwhfMcbmD59y6F56IdsoAXFv2krkoc+t9suol8xAb+QEOLTox+x5AnX8IVdacmHF+gKk1J2aSH8ARNH0Uzd6/voSu1/jnBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFoAsOpXIKv+93N//QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACA9gN4IQMAAAAAAAAAAAAAQHkAf5gFAAAAAAAAAAAAAICLmBcyAAAAAAAAAAAAAAB04CLS8IIAAAAAAAAAAAAAAADgIuaFDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANA/AC9kAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgPbX+hcyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwBuar/yVSpdmlh9gas2JmeQHqKw5MeP8AFfWnJjz/AAH1pyYvfwAm/Fo0UvmId6VOIhdWvWSOStzEh7Vhy3L/nueY7vUZeTEuhfMUbnb4CBuLfzVVLFW8kI+jDtLfzFfYqv070R2EbxY/8cmfi01jBvL//nw2YqGGsRxz09Ez/WP3rVotJ24qC8g/bx2nZU7eKbbiP2aYRyTHvx/mNWfchznsVfm1itJkiRJkiRJkiRJkiSp/X0HRZsvITTTpHoAAAAASUVORK5CYII="/></g><path fill="#000000" fill-opacity="0.0" d="m569.04724 323.95078l72.0 0l0 72.0l-72.0 0z" fill-rule="evenodd"/><g transform="matrix(0.375 0.0 0.0 0.375 569.0472440944882 323.95079002624675)"><clipPath id="g6d68e641dc_0_1.3"><path d="m2.2737368E-13 1.1368684E-13l192.0 0l0 192.0l-192.0 0z" clip-rule="evenodd"/></clipPath><image clip-path="url(#g6d68e641dc_0_1.3)" fill="#000" width="192.0" height="192.0" x="0.0" y="0.0" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAACpUlEQVR42u3dTWoTYRjA8QcEaUvrzo24EFJ1WbyBh5DSHsQDKLho6d7ClJ7BO7gIZlfxArrRNPGzSTWpX7NxV0wy70xeyvz+zwECzy+ZvDNZJEKSJEmSJEmSJEmSJEmSJEmSJLWzjdiNInoxjGn8aflMY1BuooidcitL6V4cx3nr137ZjOMoNptd/mocxIVV//fzsB8rTa3/bryx4jnmJDpNrP9BnFrunNOPrfrf/da/GEGtn4I1F58KF6IavwsOLLTC7NV38HTyqXYiqukydGyZFaeoY/033HZVnlGspwPsWmTCbKcDFNaYMIfpAD1rTJhuOsDQGpNuyJLzwDllJukAs16i7TW+HwAAAACoup/fAAAAAJAP4BcAAAAAAGgtwE8AAAAAyAdwAQAAAAD5AKYAAAAAAKC1AH6UBwAAQEaAHwAAAACQD+A7AAAAAABoLcA5AAAAAOQDGAMAAABAPoARAAAAAABoLcAZAAAAAOQD+AYAAAAA+QC+AgAAAACA1gJ8AQAAAIB8AJ8BAAAAIB/AJwAAAAAA0FqAjwAAAACQD2AIAAAAAPkABgAAAAAAoLUApwAAAACQD6APAAAAAPkAPgAAAADAlQbwh84p8zYdYGCNCXOSDtCzxoR5kQ5QWGPCPEkH2LHGhHmYDrARY4usOO/jWh0HrSOrrDjP6jnpbjqKVpqzuFnXzca+dVaYx/Xd7a3GawtdcF7Wc/3/Vyf6lrrQHfCtup95bCGYe97F/SYeO3XKG2vLnT2v4nZTT/5WYs+JaMZ/xjyN680+fu1EESOrvvTY+TzuLOcZ+Hpsx2F0y2+FSevXPim30C238SjWmvnBxTQ7VgAAgAEAwAAAYAAAMAAAGAAADAAAZhkAkiRJkiRJkiRJkiRJkiRJkiTpqvcXJ/L3x3SkrnYAAAAASUVORK5CYII="/></g><path fill="#000000" fill-opacity="0.0" d="m329.84033 323.95078l72.0 0l0 72.0l-72.0 0z" fill-rule="evenodd"/><g transform="matrix(0.375 0.0 0.0 0.375 329.84033254593174 323.95079002624675)"><clipPath id="g6d68e641dc_0_1.4"><path d="m0 1.1368684E-13l192.0 0l0 192.0l-192.0 0z" clip-rule="evenodd"/></clipPath><image clip-path="url(#g6d68e641dc_0_1.4)" fill="#000" width="192.0" height="192.0" x="0.0" y="0.0" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAADFElEQVR42u3ZXUpVYRgF4AXZAIxK7C7K0UjQTZF3gRAJRhBSY4jInIzgCArF6F6cgQj504Vmns4huop+iML9vjzrm8Ba36Pbs4+JiIiIiIjI/89MFrKWjexmP6cZXfA5HbfYHbdZy4Nc7371V/IkWxd+5b86m1ket2yZG3mTT4O+/O/nOK8z2+vyL+fFeNao0DnKSqa6XP9cPpS6/O/nfW51uP67OSx5/ZNzkDvVr/9RvpS9/sk5y2Lt6x81OIt1Hz5nLQDOaj6I5go/+3/8W1Duz/Hlop98fna2q30ofd7q+ifnWa233uN2AIeZqQPwpt31T86rOl+5fWoJcJTpGgBPWl7/5CzVANhqC/Cuxr9bRm3Pea4NH2ChMcAo94cPsNYaYHX4AButAdaHD7DbGmBn+AD7rQH2hg9w2hrgZPgAv6pfJaU3AFAeAADlAQBQHgAA5QEAUB4AAOUBAFAeAADlAQBQHoANygOwQXkANigPwAblAdigPAAblAdgAwAANgAAYAMAADYAAGADAAA2AABgAwAANgAAYAMA5W0AoLwNAJS3AYDyNgBQ3gYAytsAQHkbAChvAwDlAQBQHgAA5QEAUB4AAOUBAFAeAADlAQBQHgAA5QEAUB6ADcoDsEF5ADYoD8AG5QHYoDwAG5QHYAMAADYAAGADAAA2AABgAwAANgAAYAMAADYAKA/Q4QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAktOBDf63bU6GD7DfGmBv+AC7rQF2hg+w0RpgffgAa60BVocP8KA1wL3hA8w0BjjP1RTIZluAtymR5bYvYY9rAFzJccvrP8p0iuR1S4CXKZPZ8U9Lt+s/yPUUyko7gKcplam8b3X9W7mUYrk9/qXtcv0fczMFcydnLa7/c+ZTNIstAB6mcBaL/xZ8rn393x5EB4Wf/fNpkFvZLvrJ52aaZCrPcljstetpvQ+ev/ua+lWR9+OjvKz11vvnmc5S3uV8sFd/nrd5XOcrt7/NtdzPatazk72cXPiln4xb7IzbrOZejX+3iIiIiIhI9XwF9HsrYIKAArIAAAAASUVORK5CYII="/></g><path fill="#000000" fill-opacity="0.0" d="m397.72223 323.95078l72.0 0l0 72.0l-72.0 0z" fill-rule="evenodd"/><g transform="matrix(0.375 0.0 0.0 0.375 397.7222223097113 323.95079002624675)"><clipPath id="g6d68e641dc_0_1.5"><path d="m0 1.1368684E-13l192.0 0l0 192.0l-192.0 0z" clip-rule="evenodd"/></clipPath><image clip-path="url(#g6d68e641dc_0_1.5)" fill="#000" width="192.0" height="192.0" x="0.0" y="0.0" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAADtElEQVR42u3Zy0pbURiG4c/EKh4KRduBqb0LRS9A7AW0jeKNeBgbjbQUKlrRoSgIoiCV9j5CpvVYBxIzN5mkaw8KharJhrWM/+r7rYmz//DEnb13JEIIIYQQQggJl4zGtaBDlVVVXY02n7rroqwDzWvMdRZ93qioq7Yv/b5zqWW9jnf5L7X5BD7xzU5NGxqMcf0z7l+9YeTcaCqu5T/Tlpnl/zlf1RnL+nv13dz6k3Osnjg+/T9Mrj8532L4L9gyu/7krNv/6m0YP3nL639l6M7nvlPRgF2ATfPrT86a3afeehQAt8rZBChGsf7kFGy+cruKBuBCHfYAxqNZf3JG7QEsRAUwZw/gMCqAfXsA5agASvYAqlEBVOwB1KMCqNkDaER2AAAAAAAA8AdAvwwEAP0yEAD0y0AA0C8DAUC/AABAvwAAQL8AAEC/AABAvwAAQL8AAEC/AABAvwAAQL8AAEC/AABAvwAAQL8AAAAAAAAAAAAAAAAAAAAAAAAAAAwEAAAMBAAADAQAAAwEAAAMBAAADAQAAAwEAAAMBAAADAQAAAwEAAAMBAAADAQA/TIQAPTLQADQLwMBQL8MBAD9AgAA/QIAAP0CAAD9AgAA/QIAAP0CAAD9AgAA/QIAAP0CAAD9AgAA/QIAAP0CAAAAAAAAAAAAAAAAAAAAwEAAAMBAAADAQAAAwEAANB/I2gEAAAAAAAAAAAAAAAAA2g3wUwVNaEhd7uTcX0s6BeCxAE70Xpl/6mWU1xkA4QG21XtvzT7tABAWoNi07icAwgFst1R5F4AwACcPXHz+Tr/OAQgB8KHl2tMAKMCNZ6bl2pkA90P/PUAhVfUiAL4XMJGq+iQAvhcwlKr6MAC+F9CVqno3APWoAGr2AKqeV5Br6yWoYg+g3NYv4beeq5fsARx4XsFSquornqvv2wOY97yC0xQPYlnvLyNm7QGMeb8Pybdce8Z77RF7ABn98ryEM/W1VPm5Lj1XPleHDGbZ++dwp6W6e97rLspkht3ds+9VfGxa9bP3mrcpn8KfUDYCvBbeVf8DF5+9ABVXZTaDugmwkHNN33FHlHVfvRcBql3rhQxnKtAvtGcqatJd5LrdGXaPXStBfgVLzjsZz0agxTzOWZX5dOrY7PqP3IUtgvQYJThynUeSTq0bvPhkFVXyqphZ/rX9r967MqA191Dz1Jd/qy+2bzwfTk5LQe7WfT1hLNp96k3zmm5Uc9pXyV2Uam1fes11UXLdzGrE5is3QgghhBBCiNX8Bl8/v/b3kBTFAAAAAElFTkSuQmCC"/></g><path fill="#000000" fill-opacity="0.0" d="m153.50916 390.18634l72.0 0l0 35.24411l-72.0 0z" fill-rule="evenodd"/><path fill="#000000" d="m165.1771 403.74698l1.78125 0l5.078125 13.359375l-1.734375 0l-1.34375 -3.671875l-5.78125 0l-1.34375 3.671875l-1.734375 0l5.078125 -13.359375zm3.234375 8.1875l-1.78125 -4.8125l-0.53125 -1.4375l-0.0625 0l-0.53125 1.4375l-1.78125 4.8125l4.6875 0zm5.405945 -8.1875l4.5 0q1.109375 0 2.0625 0.515625q0.953125 0.5 1.515625 1.40625q0.578125 0.890625 0.578125 2.03125q0 0.9375 -0.421875 1.75q-0.421875 0.796875 -1.171875 1.34375q-0.734375 0.53125 -1.625 0.71875l-0.03125 0.046875l3.765625 5.46875l0 0.078125l-1.859375 0l-3.640625 -5.453125l-2.09375 0l0 5.453125l-1.578125 0l0 -13.359375zm4.40625 6.4375q0.703125 0 1.296875 -0.3125q0.609375 -0.328125 0.96875 -0.890625q0.375 -0.5625 0.375 -1.28125q0 -0.609375 -0.328125 -1.171875q-0.3125 -0.5625 -0.890625 -0.90625q-0.5625 -0.359375 -1.296875 -0.359375l-2.953125 0l0 4.921875l2.828125 0zm6.5263214 -6.4375l2.28125 0l4.265625 10.953125l0.0625 0l4.265625 -10.953125l2.28125 0l0 13.359375l-1.5625 0l0 -8.484375l0.078125 -2.546875l-0.078125 0l-4.359375 11.03125l-1.3125 0l-4.359375 -11.03125l-0.078125 0l0.078125 2.546875l0 8.484375l-1.5625 0l0 -13.359375zm19.531311 13.65625q-0.8125 0 -1.65625 -0.328125q-0.828125 -0.34375 -1.515625 -1.0625q-0.671875 -0.71875 -0.96875 -1.796875l1.4375 -0.59375q0.296875 1.078125 1.015625 1.671875q0.71875 0.59375 1.6875 0.59375q0.703125 0 1.3125 -0.296875q0.625 -0.3125 0.984375 -0.859375q0.359375 -0.546875 0.359375 -1.21875q0 -0.65625 -0.359375 -1.1875q-0.359375 -0.546875 -0.984375 -0.859375q-0.625 -0.3125 -1.375 -0.3125l-1.09375 0l0 -1.46875l0.984375 0q1.03125 0 1.71875 -0.578125q0.6875 -0.59375 0.6875 -1.578125q0 -0.890625 -0.671875 -1.421875q-0.671875 -0.546875 -1.65625 -0.546875q-0.96875 0 -1.53125 0.5q-0.546875 0.5 -0.78125 1.234375l-1.46875 -0.609375q0.34375 -1.015625 1.296875 -1.828125q0.96875 -0.8125 2.484375 -0.8125q1.109375 0 2.0 0.453125q0.90625 0.453125 1.421875 1.25q0.515625 0.796875 0.515625 1.78125q0 1.0 -0.515625 1.6875q-0.5 0.6875 -1.25 1.078125l0 0.078125q0.953125 0.390625 1.5625 1.203125q0.625 0.8125 0.625 1.90625q0 1.125 -0.578125 2.03125q-0.5625 0.890625 -1.546875 1.390625q-0.96875 0.5 -2.140625 0.5zm5.9498444 -1.875q3.65625 -3.6875 4.671875 -4.796875q0.953125 -1.03125 1.28125 -1.609375q0.34375 -0.578125 0.34375 -1.40625q0 -0.53125 -0.28125 -1.03125q-0.28125 -0.515625 -0.828125 -0.8125q-0.546875 -0.3125 -1.3125 -0.3125q-1.0 0 -1.625 0.59375q-0.609375 0.578125 -0.796875 1.265625l-1.4375 -0.578125q0.171875 -0.59375 0.65625 -1.234375q0.484375 -0.640625 1.296875 -1.09375q0.828125 -0.46875 1.9375 -0.46875q1.1875 0 2.09375 0.515625q0.90625 0.5 1.40625 1.34375q0.5 0.828125 0.5 1.796875q0 1.96875 -2.046875 4.046875l-3.828125 3.84375l6.03125 0l0 1.515625l-8.0625 0l0 -1.578125z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m353.2301 390.1857l93.102356 0l0 35.24408l-93.102356 0z" fill-rule="evenodd"/><path fill="#000000" d="m374.61902 403.7463l1.78125 0l5.078125 13.359375l-1.734375 0l-1.34375 -3.671875l-5.78125 0l-1.34375 3.671875l-1.734375 0l5.078125 -13.359375zm3.234375 8.1875l-1.78125 -4.8125l-0.53125 -1.4375l-0.0625 0l-0.53125 1.4375l-1.78125 4.8125l4.6875 0zm5.405945 -8.1875l4.5 0q1.109375 0 2.0625 0.515625q0.953125 0.5 1.515625 1.40625q0.578125 0.890625 0.578125 2.03125q0 0.9375 -0.421875 1.75q-0.421875 0.796875 -1.171875 1.34375q-0.734375 0.53125 -1.625 0.71875l-0.03125 0.046875l3.765625 5.46875l0 0.078125l-1.859375 0l-3.640625 -5.453125l-2.09375 0l0 5.453125l-1.578125 0l0 -13.359375zm4.40625 6.4375q0.703125 0 1.296875 -0.3125q0.609375 -0.328125 0.96875 -0.890625q0.375 -0.5625 0.375 -1.28125q0 -0.609375 -0.328125 -1.171875q-0.3125 -0.5625 -0.890625 -0.90625q-0.5625 -0.359375 -1.296875 -0.359375l-2.953125 0l0 4.921875l2.828125 0zm6.526306 -6.4375l2.28125 0l4.265625 10.953125l0.0625 0l4.265625 -10.953125l2.28125 0l0 13.359375l-1.5625 0l0 -8.484375l0.078125 -2.546875l-0.078125 0l-4.359375 11.03125l-1.3125 0l-4.359375 -11.03125l-0.078125 0l0.078125 2.546875l0 8.484375l-1.5625 0l0 -13.359375zm19.859436 13.65625q-1.265625 0 -2.265625 -0.609375q-1.0 -0.625 -1.546875 -1.59375q-0.546875 -0.984375 -0.546875 -2.0625q0 -1.03125 0.40625 -1.96875q0.421875 -0.953125 1.21875 -2.109375l3.328125 -5.015625l1.28125 0.875l-3.21875 4.5l0.046875 0.03125q0.640625 -0.4375 1.640625 -0.4375q0.96875 0 1.890625 0.546875q0.9375 0.53125 1.515625 1.484375q0.59375 0.9375 0.59375 2.09375q0 1.109375 -0.59375 2.09375q-0.59375 0.984375 -1.59375 1.578125q-1.0 0.59375 -2.15625 0.59375zm0 -1.515625q0.75 0 1.375 -0.359375q0.640625 -0.359375 1.015625 -0.984375q0.375 -0.625 0.375 -1.390625q0 -0.75 -0.375 -1.375q-0.375 -0.625 -1.015625 -0.984375q-0.625 -0.359375 -1.375 -0.359375q-0.75 0 -1.390625 0.359375q-0.640625 0.359375 -1.015625 0.984375q-0.375 0.625 -0.375 1.375q0 0.765625 0.375 1.390625q0.375 0.625 1.015625 0.984375q0.640625 0.359375 1.390625 0.359375zm12.141541 -1.53125l-6.109375 0l0 -1.1875l5.96875 -8.828125l1.71875 0l0 8.53125l1.640625 0l0 1.484375l-1.640625 0l0 2.75l-1.578125 0l0 -2.75zm0 -1.484375l0 -6.21875l-0.0625 0l-4.234375 6.21875l4.296875 0z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m569.04987 390.18634l72.0 0l0 35.24411l-72.0 0z" fill-rule="evenodd"/><path fill="#000000" d="m578.5977 412.27823l-3.28125 -4.6875l1.796875 0l2.4375 3.53125l2.375 -3.53125l1.859375 0l-3.328125 4.6875l3.390625 4.828125l-1.84375 0l-2.46875 -3.65625l-2.4375 3.65625l-1.84375 0l3.34375 -4.828125zm10.648071 5.125q-1.21875 0 -2.21875 -0.5q-0.984375 -0.5 -1.546875 -1.359375q-0.546875 -0.875 -0.546875 -1.9375q0 -1.09375 0.578125 -1.90625q0.59375 -0.8125 1.546875 -1.265625l0 -0.078125q-0.75 -0.453125 -1.234375 -1.1875q-0.46875 -0.734375 -0.46875 -1.546875q0 -1.0 0.484375 -1.8125q0.5 -0.828125 1.390625 -1.296875q0.890625 -0.46875 2.015625 -0.46875q1.09375 0 1.96875 0.46875q0.890625 0.46875 1.390625 1.296875q0.5 0.8125 0.5 1.8125q0 0.8125 -0.484375 1.546875q-0.46875 0.734375 -1.203125 1.1875l0 0.078125q0.953125 0.453125 1.53125 1.265625q0.59375 0.8125 0.59375 1.90625q0 1.0625 -0.5625 1.9375q-0.5625 0.859375 -1.5625 1.359375q-0.984375 0.5 -2.171875 0.5zm0 -7.71875q0.984375 0 1.609375 -0.578125q0.640625 -0.578125 0.640625 -1.515625q0 -0.9375 -0.640625 -1.484375q-0.640625 -0.546875 -1.609375 -0.546875q-1.0 0 -1.640625 0.546875q-0.640625 0.546875 -0.640625 1.484375q0 0.9375 0.640625 1.515625q0.640625 0.578125 1.640625 0.578125zm0 6.203125q1.125 0 1.890625 -0.65625q0.78125 -0.65625 0.78125 -1.71875q0 -1.03125 -0.78125 -1.6875q-0.765625 -0.671875 -1.890625 -0.671875q-1.140625 0 -1.9375 0.671875q-0.78125 0.65625 -0.78125 1.6875q0 1.0625 0.78125 1.71875q0.796875 0.65625 1.9375 0.65625zm10.326477 1.515625q-1.265625 0 -2.265625 -0.609375q-1.0 -0.625 -1.546875 -1.59375q-0.546875 -0.984375 -0.546875 -2.0625q0 -1.03125 0.40625 -1.96875q0.421875 -0.953125 1.21875 -2.109375l3.328125 -5.015625l1.28125 0.875l-3.21875 4.5l0.046875 0.03125q0.640625 -0.4375 1.640625 -0.4375q0.96875 0 1.890625 0.546875q0.9375 0.53125 1.515625 1.484375q0.59375 0.9375 0.59375 2.09375q0 1.109375 -0.59375 2.09375q-0.59375 0.984375 -1.59375 1.578125q-1.0 0.59375 -2.15625 0.59375zm0 -1.515625q0.75 0 1.375 -0.359375q0.640625 -0.359375 1.015625 -0.984375q0.375 -0.625 0.375 -1.390625q0 -0.75 -0.375 -1.375q-0.375 -0.625 -1.015625 -0.984375q-0.625 -0.359375 -1.375 -0.359375q-0.75 0 -1.390625 0.359375q-0.640625 0.359375 -1.015625 0.984375q-0.375 0.625 -0.375 1.375q0 0.765625 0.375 1.390625q0.375 0.625 1.015625 0.984375q0.640625 0.359375 1.390625 0.359375zm5.1884155 3.9375l8.875 0l0 1.3125l-8.875 0l0 -1.3125zm14.083496 -2.421875q-1.265625 0 -2.265625 -0.609375q-1.0 -0.625 -1.546875 -1.59375q-0.546875 -0.984375 -0.546875 -2.0625q0 -1.03125 0.40625 -1.96875q0.421875 -0.953125 1.21875 -2.109375l3.328125 -5.015625l1.28125 0.875l-3.21875 4.5l0.046875 0.03125q0.640625 -0.4375 1.640625 -0.4375q0.96875 0 1.890625 0.546875q0.9375 0.53125 1.515625 1.484375q0.59375 0.9375 0.59375 2.09375q0 1.109375 -0.59375 2.09375q-0.59375 0.984375 -1.59375 1.578125q-1.0 0.59375 -2.15625 0.59375zm0 -1.515625q0.75 0 1.375 -0.359375q0.640625 -0.359375 1.015625 -0.984375q0.375 -0.625 0.375 -1.390625q0 -0.75 -0.375 -1.375q-0.375 -0.625 -1.015625 -0.984375q-0.625 -0.359375 -1.375 -0.359375q-0.75 0 -1.390625 0.359375q-0.640625 0.359375 -1.015625 0.984375q-0.375 0.625 -0.375 1.375q0 0.765625 0.375 1.390625q0.375 0.625 1.015625 0.984375q0.640625 0.359375 1.390625 0.359375zm12.141541 -1.53125l-6.109375 0l0 -1.1875l5.96875 -8.828125l1.71875 0l0 8.53125l1.640625 0l0 1.484375l-1.640625 0l0 2.75l-1.578125 0l0 -2.75zm0 -1.484375l0 -6.21875l-0.0625 0l-4.234375 6.21875l4.296875 0z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m728.2769 390.1857l116.22046 0l0 35.24408l-116.22046 0z" fill-rule="evenodd"/><path fill="#000000" d="m746.8374 417.40256q-1.46875 0 -2.578125 -0.8125q-1.09375 -0.8125 -1.546875 -2.28125l1.5 -0.625q0.671875 2.203125 2.625 2.203125q1.09375 0 1.75 -0.765625q0.671875 -0.765625 0.671875 -2.015625l0 -9.359375l1.59375 0l0 9.234375q0 1.40625 -0.515625 2.40625q-0.515625 0.984375 -1.421875 1.5q-0.90625 0.515625 -2.078125 0.515625zm9.497192 0q-1.046875 0 -1.875 -0.40625q-0.8125 -0.40625 -1.265625 -1.125q-0.4375 -0.71875 -0.4375 -1.640625q0 -1.515625 1.125 -2.359375q1.140625 -0.84375 2.875 -0.84375q0.859375 0 1.59375 0.1875q0.75 0.1875 1.140625 0.421875l0 -0.578125q0 -1.0625 -0.75 -1.703125q-0.75 -0.640625 -1.890625 -0.640625q-0.78125 0 -1.46875 0.34375q-0.671875 0.34375 -1.0625 0.953125l-1.203125 -0.890625q0.5625 -0.859375 1.546875 -1.34375q1.0 -0.484375 2.1875 -0.484375q1.9375 0 3.03125 1.015625q1.109375 1.015625 1.109375 2.765625l0 6.03125l-1.5 0l0 -1.359375l-0.078125 0q-0.40625 0.6875 -1.234375 1.171875q-0.8125 0.484375 -1.84375 0.484375zm0.140625 -1.390625q0.8125 0 1.5 -0.40625q0.6875 -0.421875 1.09375 -1.109375q0.421875 -0.6875 0.421875 -1.515625q-0.453125 -0.296875 -1.109375 -0.484375q-0.65625 -0.1875 -1.375 -0.1875q-1.3125 0 -1.984375 0.546875q-0.65625 0.53125 -0.65625 1.390625q0 0.78125 0.59375 1.28125q0.609375 0.484375 1.515625 0.484375zm5.4854126 -8.421875l1.703125 0l2.953125 7.65625l0.03125 0l2.984375 -7.65625l1.65625 0l-3.875 9.515625l-1.609375 0l-3.84375 -9.515625zm13.496399 9.8125q-1.046875 0 -1.875 -0.40625q-0.8125 -0.40625 -1.265625 -1.125q-0.4375 -0.71875 -0.4375 -1.640625q0 -1.515625 1.125 -2.359375q1.140625 -0.84375 2.875 -0.84375q0.859375 0 1.59375 0.1875q0.75 0.1875 1.140625 0.421875l0 -0.578125q0 -1.0625 -0.75 -1.703125q-0.75 -0.640625 -1.890625 -0.640625q-0.78125 0 -1.46875 0.34375q-0.671875 0.34375 -1.0625 0.953125l-1.203125 -0.890625q0.5625 -0.859375 1.546875 -1.34375q1.0 -0.484375 2.1875 -0.484375q1.9375 0 3.03125 1.015625q1.109375 1.015625 1.109375 2.765625l0 6.03125l-1.5 0l0 -1.359375l-0.078125 0q-0.40625 0.6875 -1.234375 1.171875q-0.8125 0.484375 -1.84375 0.484375zm0.140625 -1.390625q0.8125 0 1.5 -0.40625q0.6875 -0.421875 1.09375 -1.109375q0.421875 -0.6875 0.421875 -1.515625q-0.453125 -0.296875 -1.109375 -0.484375q-0.65625 -0.1875 -1.375 -0.1875q-1.3125 0 -1.984375 0.546875q-0.65625 0.53125 -0.65625 1.390625q0 0.78125 0.59375 1.28125q0.609375 0.484375 1.515625 0.484375zm10.765869 1.390625q-1.0 0 -1.953125 -0.421875q-0.9375 -0.421875 -1.671875 -1.234375q-0.71875 -0.8125 -1.03125 -1.96875l1.515625 -0.609375q0.3125 1.1875 1.171875 1.953125q0.859375 0.765625 2.015625 0.765625q1.15625 0 1.953125 -0.625q0.796875 -0.625 0.796875 -1.703125q0 -0.9375 -0.6875 -1.53125q-0.671875 -0.609375 -2.21875 -1.140625l-0.84375 -0.296875q-1.40625 -0.5 -2.3125 -1.3125q-0.890625 -0.828125 -0.890625 -2.28125q0 -0.953125 0.515625 -1.765625q0.53125 -0.8125 1.453125 -1.296875q0.9375 -0.484375 2.09375 -0.484375q1.15625 0 2.015625 0.4375q0.859375 0.421875 1.375 1.046875q0.515625 0.609375 0.71875 1.203125l-1.46875 0.640625q-0.203125 -0.703125 -0.875 -1.25q-0.65625 -0.5625 -1.734375 -0.5625q-1.03125 0 -1.765625 0.578125q-0.71875 0.578125 -0.71875 1.453125q0 0.78125 0.609375 1.28125q0.625 0.484375 1.875 0.921875l0.875 0.296875q1.6875 0.609375 2.640625 1.53125q0.953125 0.921875 0.953125 2.515625q0 1.28125 -0.671875 2.171875q-0.65625 0.875 -1.671875 1.28125q-1.0 0.40625 -2.0625 0.40625zm10.750427 0q-1.375 0 -2.484375 -0.65625q-1.09375 -0.671875 -1.71875 -1.8125q-0.609375 -1.15625 -0.609375 -2.578125q0 -1.4375 0.609375 -2.59375q0.625 -1.15625 1.71875 -1.8125q1.109375 -0.65625 2.484375 -0.65625q1.546875 0 2.59375 0.71875q1.0625 0.71875 1.515625 1.90625l-1.4375 0.609375q-0.359375 -0.890625 -1.0625 -1.34375q-0.6875 -0.453125 -1.6875 -0.453125q-0.828125 0 -1.5625 0.453125q-0.734375 0.453125 -1.171875 1.28125q-0.4375 0.8125 -0.4375 1.890625q0 1.0625 0.4375 1.890625q0.4375 0.8125 1.171875 1.265625q0.734375 0.453125 1.5625 0.453125q1.015625 0 1.734375 -0.46875q0.734375 -0.46875 1.09375 -1.3125l1.40625 0.59375q-0.484375 1.171875 -1.5625 1.90625q-1.0625 0.71875 -2.59375 0.71875zm5.7804565 -9.8125l1.515625 0l0 1.53125l0.078125 0q0.28125 -0.78125 1.078125 -1.296875q0.796875 -0.515625 1.671875 -0.515625q0.65625 0 1.125 0.1875l0 1.71875q-0.59375 -0.296875 -1.34375 -0.296875q-0.6875 0 -1.265625 0.390625q-0.578125 0.390625 -0.921875 1.0625q-0.34375 0.65625 -0.34375 1.421875l0 5.3125l-1.59375 0l0 -9.515625zm7.9335938 -1.75q-0.46875 0 -0.8125 -0.328125q-0.328125 -0.34375 -0.328125 -0.8125q0 -0.484375 0.328125 -0.8125q0.34375 -0.328125 0.8125 -0.328125q0.484375 0 0.8125 0.328125q0.328125 0.328125 0.328125 0.8125q0 0.46875 -0.328125 0.8125q-0.328125 0.328125 -0.8125 0.328125zm-0.78125 1.75l1.578125 0l0 9.515625l-1.578125 0l0 -9.515625zm3.9819336 0l1.515625 0l0 1.421875l0.078125 0q0.421875 -0.734375 1.28125 -1.21875q0.875 -0.5 1.96875 -0.5q1.28125 0 2.3125 0.65625q1.046875 0.65625 1.640625 1.8125q0.59375 1.15625 0.59375 2.59375q0 1.453125 -0.59375 2.609375q-0.59375 1.140625 -1.640625 1.796875q-1.03125 0.640625 -2.3125 0.640625q-1.09375 0 -1.96875 -0.484375q-0.859375 -0.5 -1.28125 -1.21875l-0.078125 0l0.078125 1.3125l0 4.125l-1.59375 0l0 -13.546875zm4.671875 8.375q0.8125 0 1.546875 -0.4375q0.734375 -0.453125 1.15625 -1.265625q0.4375 -0.828125 0.4375 -1.90625q0 -1.09375 -0.4375 -1.90625q-0.421875 -0.828125 -1.15625 -1.265625q-0.734375 -0.453125 -1.546875 -0.453125q-0.84375 0 -1.5625 0.453125q-0.71875 0.4375 -1.15625 1.265625q-0.4375 0.8125 -0.4375 1.90625q0 1.078125 0.4375 1.90625q0.4375 0.8125 1.15625 1.265625q0.71875 0.4375 1.5625 0.4375zm9.845642 1.296875q-0.578125 0 -1.078125 -0.1875q-0.484375 -0.1875 -0.828125 -0.515625q-0.734375 -0.703125 -0.734375 -1.953125l0 -5.578125l-1.671875 0l0 -1.4375l1.671875 0l0 -2.6875l1.578125 0l0 2.6875l2.328125 0l0 1.4375l-2.328125 0l0 5.1875q0 0.78125 0.296875 1.15625q0.359375 0.40625 1.03125 0.40625q0.578125 0 1.046875 -0.3125l0 1.546875q-0.28125 0.125 -0.578125 0.1875q-0.28125 0.0625 -0.734375 0.0625z" fill-rule="nonzero"/><path fill="#02589b" d="m138.76247 141.17389l346.07874 0l0 86.708664l-346.07874 0z" fill-rule="evenodd"/><path fill="#ffffff" d="m221.27809 159.08884l4.265625 0q2.078125 0 3.609375 0.84375q1.546875 0.84375 2.375 2.359375q0.828125 1.515625 0.828125 3.484375q0 1.953125 -0.828125 3.484375q-0.828125 1.515625 -2.375 2.359375q-1.53125 0.828125 -3.609375 0.828125l-4.265625 0l0 -13.359375zm4.21875 11.421875q2.265625 0 3.515625 -1.25q1.265625 -1.265625 1.265625 -3.484375q0 -2.234375 -1.265625 -3.484375q-1.25 -1.265625 -3.515625 -1.265625l-2.171875 0l0 9.484375l2.171875 0zm12.933762 2.234375q-1.375 0 -2.484375 -0.640625q-1.109375 -0.65625 -1.734375 -1.796875q-0.625 -1.15625 -0.625 -2.59375q0 -1.359375 0.609375 -2.53125q0.609375 -1.171875 1.6875 -1.859375q1.078125 -0.6875 2.4375 -0.6875q1.4375 0 2.484375 0.625q1.046875 0.625 1.59375 1.734375q0.546875 1.09375 0.546875 2.484375q0 0.375 -0.03125 0.640625l-7.34375 0q0.125 1.359375 0.953125 2.09375q0.84375 0.734375 1.96875 0.734375q0.921875 0 1.5625 -0.40625q0.65625 -0.421875 1.046875 -1.109375l1.65625 0.796875q-0.640625 1.171875 -1.734375 1.84375q-1.078125 0.671875 -2.59375 0.671875zm2.53125 -6.140625q-0.046875 -0.515625 -0.34375 -1.03125q-0.296875 -0.53125 -0.875 -0.875q-0.5625 -0.34375 -1.40625 -0.34375q-1.0 0 -1.703125 0.625q-0.703125 0.609375 -0.953125 1.625l5.28125 0zm2.618805 -3.671875l2.25 0l2.65625 6.921875l0.09375 0l2.734375 -6.921875l2.203125 0l-3.984375 9.515625l-2.015625 0l-3.9375 -9.515625zm15.296936 9.8125q-1.375 0 -2.484375 -0.640625q-1.109375 -0.65625 -1.734375 -1.796875q-0.625 -1.15625 -0.625 -2.59375q0 -1.359375 0.609375 -2.53125q0.609375 -1.171875 1.6875 -1.859375q1.078125 -0.6875 2.4375 -0.6875q1.4375 0 2.484375 0.625q1.046875 0.625 1.59375 1.734375q0.546875 1.09375 0.546875 2.484375q0 0.375 -0.03125 0.640625l-7.34375 0q0.125 1.359375 0.953125 2.09375q0.84375 0.734375 1.96875 0.734375q0.921875 0 1.5625 -0.40625q0.65625 -0.421875 1.046875 -1.109375l1.65625 0.796875q-0.640625 1.171875 -1.734375 1.84375q-1.078125 0.671875 -2.59375 0.671875zm2.53125 -6.140625q-0.046875 -0.515625 -0.34375 -1.03125q-0.296875 -0.53125 -0.875 -0.875q-0.5625 -0.34375 -1.40625 -0.34375q-1.0 0 -1.703125 0.625q-0.703125 0.609375 -0.953125 1.625l5.28125 0zm3.852356 -7.515625l2.015625 0l0 13.359375l-2.015625 0l0 -13.359375zm8.775238 13.65625q-1.4375 0 -2.578125 -0.65625q-1.140625 -0.671875 -1.78125 -1.828125q-0.625 -1.15625 -0.625 -2.5625q0 -1.421875 0.625 -2.578125q0.640625 -1.15625 1.78125 -1.8125q1.140625 -0.671875 2.578125 -0.671875q1.421875 0 2.546875 0.671875q1.140625 0.671875 1.765625 1.828125q0.640625 1.15625 0.640625 2.5625q0 1.40625 -0.640625 2.5625q-0.625 1.15625 -1.75 1.828125q-1.125 0.65625 -2.5625 0.65625zm0 -1.84375q0.796875 0 1.46875 -0.390625q0.671875 -0.390625 1.078125 -1.109375q0.421875 -0.734375 0.421875 -1.703125q0 -0.984375 -0.421875 -1.703125q-0.40625 -0.734375 -1.078125 -1.125q-0.671875 -0.390625 -1.46875 -0.390625q-0.8125 0 -1.5 0.390625q-0.671875 0.390625 -1.078125 1.125q-0.40625 0.71875 -0.40625 1.703125q0 0.96875 0.40625 1.703125q0.40625 0.71875 1.078125 1.109375q0.6875 0.390625 1.5 0.390625zm6.631195 -7.96875l1.90625 0l0 1.28125l0.109375 0q0.421875 -0.671875 1.234375 -1.125q0.8125 -0.453125 1.828125 -0.453125q1.296875 0 2.328125 0.65625q1.046875 0.65625 1.640625 1.796875q0.609375 1.140625 0.609375 2.609375q0 1.453125 -0.609375 2.609375q-0.59375 1.15625 -1.640625 1.796875q-1.03125 0.640625 -2.328125 0.640625q-1.015625 0 -1.828125 -0.453125q-0.8125 -0.453125 -1.234375 -1.109375l-0.109375 0l0.109375 1.328125l0 3.96875l-2.015625 0l0 -13.546875zm4.78125 7.96875q0.765625 0 1.421875 -0.390625q0.671875 -0.40625 1.0625 -1.140625q0.390625 -0.734375 0.390625 -1.671875q0 -0.953125 -0.390625 -1.671875q-0.390625 -0.734375 -1.0625 -1.140625q-0.65625 -0.40625 -1.421875 -0.40625q-0.75 0 -1.40625 0.40625q-0.65625 0.40625 -1.0625 1.140625q-0.40625 0.71875 -0.40625 1.671875q0 0.9375 0.40625 1.671875q0.40625 0.734375 1.0625 1.140625q0.65625 0.390625 1.40625 0.390625zm6.6211853 -7.96875l1.90625 0l0 1.3125l0.109375 0q0.4375 -0.71875 1.21875 -1.15625q0.78125 -0.453125 1.71875 -0.453125q1.015625 0 1.765625 0.484375q0.765625 0.484375 1.109375 1.28125q0.5 -0.796875 1.3125 -1.28125q0.8125 -0.484375 1.90625 -0.484375q1.640625 0 2.484375 1.0q0.84375 1.0 0.84375 2.71875l0 6.09375l-2.0 0l0 -5.765625q0 -2.203125 -1.875 -2.203125q-1.015625 0 -1.671875 0.828125q-0.640625 0.8125 -0.640625 2.046875l0 5.09375l-1.984375 0l0 -5.765625q0 -2.203125 -1.921875 -2.203125q-1.0 0 -1.640625 0.828125q-0.625 0.828125 -0.625 2.0625l0 5.078125l-2.015625 0l0 -9.515625zm21.003784 9.8125q-1.375 0 -2.484375 -0.640625q-1.109375 -0.65625 -1.734375 -1.796875q-0.625 -1.15625 -0.625 -2.59375q0 -1.359375 0.609375 -2.53125q0.609375 -1.171875 1.6875 -1.859375q1.078125 -0.6875 2.4375 -0.6875q1.4375 0 2.484375 0.625q1.046875 0.625 1.59375 1.734375q0.546875 1.09375 0.546875 2.484375q0 0.375 -0.03125 0.640625l-7.34375 0q0.125 1.359375 0.953125 2.09375q0.84375 0.734375 1.96875 0.734375q0.921875 0 1.5625 -0.40625q0.65625 -0.421875 1.046875 -1.109375l1.65625 0.796875q-0.640625 1.171875 -1.734375 1.84375q-1.078125 0.671875 -2.59375 0.671875zm2.53125 -6.140625q-0.046875 -0.515625 -0.34375 -1.03125q-0.296875 -0.53125 -0.875 -0.875q-0.5625 -0.34375 -1.40625 -0.34375q-1.0 0 -1.703125 0.625q-0.703125 0.609375 -0.953125 1.625l5.28125 0zm3.8523254 -3.671875l1.90625 0l0 1.3125l0.109375 0q0.40625 -0.71875 1.234375 -1.15625q0.828125 -0.453125 1.765625 -0.453125q1.71875 0 2.609375 1.015625q0.90625 1.015625 0.90625 2.796875l0 6.0l-2.0 0l0 -5.75q0 -1.109375 -0.5625 -1.65625q-0.5625 -0.5625 -1.53125 -0.5625q-0.703125 0 -1.25 0.390625q-0.546875 0.390625 -0.859375 1.046875q-0.3125 0.65625 -0.3125 1.421875l0 5.109375l-2.015625 0l0 -9.515625zm14.260223 9.671875q-0.640625 0 -1.1875 -0.203125q-0.546875 -0.203125 -0.90625 -0.546875q-0.796875 -0.765625 -0.796875 -2.171875l0 -5.0l-1.671875 0l0 -1.75l1.671875 0l0 -2.6875l2.015625 0l0 2.6875l2.328125 0l0 1.75l-2.328125 0l0 4.578125q0 0.78125 0.296875 1.09375q0.3125 0.359375 0.96875 0.359375q0.328125 0 0.5625 -0.078125q0.25 -0.09375 0.546875 -0.28125l0 1.96875q-0.625 0.28125 -1.5 0.28125zm2.235138 -0.15625l0 0zm9.425018 0.15625q-0.640625 0 -1.1875 -0.203125q-0.546875 -0.203125 -0.90625 -0.546875q-0.796875 -0.765625 -0.796875 -2.171875l0 -5.0l-1.671875 0l0 -1.75l1.671875 0l0 -2.6875l2.015625 0l0 2.6875l2.328125 0l0 1.75l-2.328125 0l0 4.578125q0 0.78125 0.296875 1.09375q0.3125 0.359375 0.96875 0.359375q0.328125 0 0.5625 -0.078125q0.25 -0.09375 0.546875 -0.28125l0 1.96875q-0.625 0.28125 -1.5 0.28125zm7.518036 0.140625q-1.4375 0 -2.578125 -0.65625q-1.140625 -0.671875 -1.78125 -1.828125q-0.625 -1.15625 -0.625 -2.5625q0 -1.421875 0.625 -2.578125q0.640625 -1.15625 1.78125 -1.8125q1.140625 -0.671875 2.578125 -0.671875q1.421875 0 2.546875 0.671875q1.140625 0.671875 1.765625 1.828125q0.640625 1.15625 0.640625 2.5625q0 1.40625 -0.640625 2.5625q-0.625 1.15625 -1.75 1.828125q-1.125 0.65625 -2.5625 0.65625zm0 -1.84375q0.796875 0 1.46875 -0.390625q0.671875 -0.390625 1.078125 -1.109375q0.421875 -0.734375 0.421875 -1.703125q0 -0.984375 -0.421875 -1.703125q-0.40625 -0.734375 -1.078125 -1.125q-0.671875 -0.390625 -1.46875 -0.390625q-0.8125 0 -1.5 0.390625q-0.671875 0.390625 -1.078125 1.125q-0.40625 0.71875 -0.40625 1.703125q0 0.96875 0.40625 1.703125q0.40625 0.71875 1.078125 1.109375q0.6875 0.390625 1.5 0.390625zm11.287048 1.84375q-1.4375 0 -2.578125 -0.65625q-1.140625 -0.671875 -1.78125 -1.828125q-0.625 -1.15625 -0.625 -2.5625q0 -1.421875 0.625 -2.578125q0.640625 -1.15625 1.78125 -1.8125q1.140625 -0.671875 2.578125 -0.671875q1.421875 0 2.546875 0.671875q1.140625 0.671875 1.765625 1.828125q0.640625 1.15625 0.640625 2.5625q0 1.40625 -0.640625 2.5625q-0.625 1.15625 -1.75 1.828125q-1.125 0.65625 -2.5625 0.65625zm0 -1.84375q0.796875 0 1.46875 -0.390625q0.671875 -0.390625 1.078125 -1.109375q0.421875 -0.734375 0.421875 -1.703125q0 -0.984375 -0.421875 -1.703125q-0.40625 -0.734375 -1.078125 -1.125q-0.671875 -0.390625 -1.46875 -0.390625q-0.8125 0 -1.5 0.390625q-0.671875 0.390625 -1.078125 1.125q-0.40625 0.71875 -0.40625 1.703125q0 0.96875 0.40625 1.703125q0.40625 0.71875 1.078125 1.109375q0.6875 0.390625 1.5 0.390625zm6.70932 -11.8125l2.015625 0l0 13.359375l-2.015625 0l0 -13.359375zm8.697113 13.65625q-1.421875 0 -2.546875 -0.640625q-1.109375 -0.65625 -1.734375 -1.796875q-0.625 -1.15625 -0.625 -2.609375q0 -1.46875 0.625 -2.609375q0.625 -1.140625 1.734375 -1.796875q1.125 -0.65625 2.546875 -0.65625q1.5625 0 2.65625 0.703125q1.09375 0.703125 1.578125 1.921875l-1.828125 0.75q-0.671875 -1.53125 -2.4375 -1.53125q-0.796875 0 -1.453125 0.40625q-0.65625 0.40625 -1.046875 1.140625q-0.375 0.71875 -0.375 1.671875q0 0.9375 0.375 1.671875q0.390625 0.734375 1.046875 1.140625q0.65625 0.390625 1.453125 0.390625q0.890625 0 1.53125 -0.390625q0.640625 -0.40625 1.0 -1.171875l1.8125 0.78125q-0.5625 1.203125 -1.671875 1.921875q-1.09375 0.703125 -2.640625 0.703125zm6.0226135 -13.65625l2.015625 0l0 3.65625l-0.109375 1.5l0.109375 0q0.40625 -0.71875 1.21875 -1.15625q0.8125 -0.453125 1.78125 -0.453125q1.734375 0 2.640625 1.03125q0.921875 1.03125 0.921875 2.78125l0 6.0l-1.984375 0l0 -5.75q0 -1.09375 -0.59375 -1.65625q-0.59375 -0.5625 -1.5 -0.5625q-0.6875 0 -1.265625 0.40625q-0.5625 0.40625 -0.890625 1.078125q-0.328125 0.65625 -0.328125 1.40625l0 5.078125l-2.015625 0l0 -13.359375zm13.767639 13.65625q-1.015625 0 -1.828125 -0.390625q-0.796875 -0.40625 -1.25 -1.125q-0.4375 -0.734375 -0.4375 -1.671875q0 -0.984375 0.515625 -1.703125q0.515625 -0.71875 1.40625 -1.09375q0.90625 -0.390625 2.015625 -0.390625q0.828125 0 1.5 0.15625q0.6875 0.15625 1.109375 0.359375l0 -0.5q0 -0.921875 -0.671875 -1.484375q-0.671875 -0.5625 -1.734375 -0.5625q-0.734375 0 -1.390625 0.328125q-0.640625 0.3125 -1.046875 0.875l-1.375 -1.0625q0.609375 -0.875 1.625 -1.359375q1.03125 -0.484375 2.234375 -0.484375q2.0625 0 3.1875 1.015625q1.125 1.015625 1.125 2.84375l0 5.953125l-1.953125 0l0 -1.171875l-0.109375 0q-0.421875 0.625 -1.1875 1.046875q-0.765625 0.421875 -1.734375 0.421875zm0.359375 -1.640625q0.75 0 1.359375 -0.359375q0.625 -0.375 0.96875 -0.984375q0.34375 -0.609375 0.34375 -1.328125q-0.453125 -0.25 -1.03125 -0.40625q-0.578125 -0.15625 -1.21875 -0.15625q-1.171875 0 -1.71875 0.46875q-0.546875 0.46875 -0.546875 1.234375q0 0.671875 0.5 1.109375q0.5 0.421875 1.34375 0.421875zm7.99881 -9.5625q-0.5625 0 -0.96875 -0.40625q-0.390625 -0.40625 -0.390625 -0.96875q0 -0.546875 0.390625 -0.9375q0.40625 -0.40625 0.96875 -0.40625q0.5625 0 0.953125 0.40625q0.40625 0.390625 0.40625 0.9375q0 0.5625 -0.40625 0.96875q-0.390625 0.40625 -0.953125 0.40625zm-1.0 1.390625l2.015625 0l0 9.515625l-2.015625 0l0 -9.515625zm4.5078125 0l1.90625 0l0 1.3125l0.109375 0q0.40625 -0.71875 1.234375 -1.15625q0.828125 -0.453125 1.765625 -0.453125q1.71875 0 2.609375 1.015625q0.90625 1.015625 0.90625 2.796875l0 6.0l-2.0 0l0 -5.75q0 -1.109375 -0.5625 -1.65625q-0.5625 -0.5625 -1.53125 -0.5625q-0.703125 0 -1.25 0.390625q-0.546875 0.390625 -0.859375 1.046875q-0.3125 0.65625 -0.3125 1.421875l0 5.109375l-2.015625 0l0 -9.515625z" fill-rule="nonzero"/><path fill="#eeeeee" d="m221.04372 180.43509l6.625 0l0 1.296875l-5.265625 0l0 3.921875l4.75 0l0 1.28125l-4.75 0l0 4.953125l-1.359375 0l0 -11.453125zm10.504135 11.703125q-0.890625 0 -1.59375 -0.34375q-0.703125 -0.359375 -1.09375 -0.96875q-0.375 -0.625 -0.375 -1.40625q0 -1.296875 0.96875 -2.015625q0.984375 -0.734375 2.46875 -0.734375q0.734375 0 1.359375 0.171875q0.640625 0.15625 0.96875 0.359375l0 -0.5q0 -0.90625 -0.640625 -1.453125q-0.625 -0.5625 -1.609375 -0.5625q-0.671875 0 -1.265625 0.296875q-0.578125 0.296875 -0.90625 0.828125l-1.03125 -0.765625q0.484375 -0.734375 1.328125 -1.15625q0.859375 -0.421875 1.875 -0.421875q1.671875 0 2.609375 0.875q0.9375 0.875 0.9375 2.375l0 5.171875l-1.296875 0l0 -1.171875l-0.0625 0q-0.34375 0.59375 -1.046875 1.015625q-0.703125 0.40625 -1.59375 0.40625zm0.140625 -1.1875q0.6875 0 1.265625 -0.34375q0.59375 -0.359375 0.9375 -0.953125q0.359375 -0.59375 0.359375 -1.296875q-0.375 -0.265625 -0.9375 -0.421875q-0.5625 -0.15625 -1.1875 -0.15625q-1.109375 0 -1.6875 0.46875q-0.5625 0.453125 -0.5625 1.1875q0 0.671875 0.5 1.09375q0.515625 0.421875 1.3125 0.421875zm8.525391 1.1875q-1.3125 0 -2.203125 -0.609375q-0.875 -0.609375 -1.234375 -1.578125l1.203125 -0.546875q0.3125 0.734375 0.90625 1.140625q0.609375 0.40625 1.328125 0.40625q0.765625 0 1.3125 -0.3125q0.546875 -0.3125 0.546875 -0.890625q0 -0.515625 -0.4375 -0.828125q-0.4375 -0.3125 -1.359375 -0.53125l-1.0 -0.265625q-0.96875 -0.234375 -1.59375 -0.8125q-0.625 -0.578125 -0.625 -1.484375q0 -0.703125 0.421875 -1.234375q0.421875 -0.546875 1.125 -0.828125q0.703125 -0.296875 1.53125 -0.296875q1.0625 0 1.90625 0.46875q0.84375 0.46875 1.1875 1.296875l-1.171875 0.546875q-0.546875 -1.09375 -1.9375 -1.09375q-0.671875 0 -1.1875 0.3125q-0.5 0.3125 -0.5 0.796875q0 0.453125 0.34375 0.734375q0.359375 0.265625 1.0625 0.453125l1.1875 0.296875q1.203125 0.3125 1.8125 0.90625q0.609375 0.59375 0.609375 1.46875q0 0.75 -0.4375 1.3125q-0.4375 0.5625 -1.171875 0.875q-0.734375 0.296875 -1.625 0.296875zm7.7692566 -0.125q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm1.7153931 -0.125l0 0zm5.5245056 -9.65625q-0.40625 0 -0.703125 -0.28125q-0.28125 -0.296875 -0.28125 -0.703125q0 -0.421875 0.28125 -0.6875q0.296875 -0.28125 0.703125 -0.28125q0.40625 0 0.6875 0.28125q0.28125 0.265625 0.28125 0.6875q0 0.40625 -0.28125 0.703125q-0.28125 0.28125 -0.6875 0.28125zm-0.671875 1.5l1.359375 0l0 8.15625l-1.359375 0l0 -8.15625zm3.4910278 0l1.28125 0l0 1.203125l0.078125 0q0.328125 -0.609375 1.0625 -1.03125q0.734375 -0.4375 1.578125 -0.4375q1.46875 0 2.234375 0.859375q0.78125 0.859375 0.78125 2.328125l0 5.234375l-1.359375 0l0 -5.03125q0 -1.125 -0.546875 -1.640625q-0.546875 -0.515625 -1.484375 -0.515625q-0.65625 0 -1.1875 0.375q-0.515625 0.359375 -0.796875 0.96875q-0.28125 0.59375 -0.28125 1.25l0 4.59375l-1.359375 0l0 -8.15625zm12.663513 8.40625q-1.1875 0 -2.140625 -0.5625q-0.9375 -0.5625 -1.46875 -1.546875q-0.515625 -0.984375 -0.515625 -2.21875q0 -1.234375 0.515625 -2.21875q0.53125 -1.0 1.46875 -1.5625q0.953125 -0.5625 2.140625 -0.5625q1.328125 0 2.234375 0.625q0.90625 0.609375 1.28125 1.640625l-1.234375 0.515625q-0.296875 -0.765625 -0.90625 -1.15625q-0.59375 -0.390625 -1.4375 -0.390625q-0.71875 0 -1.34375 0.390625q-0.625 0.390625 -1.0 1.109375q-0.375 0.703125 -0.375 1.609375q0 0.90625 0.375 1.609375q0.375 0.703125 1.0 1.109375q0.625 0.390625 1.34375 0.390625q0.859375 0 1.484375 -0.40625q0.625 -0.40625 0.9375 -1.140625l1.203125 0.515625q-0.40625 1.015625 -1.328125 1.640625q-0.921875 0.609375 -2.234375 0.609375zm4.968506 -8.40625l1.28125 0l0 1.3125l0.078125 0q0.234375 -0.671875 0.921875 -1.109375q0.6875 -0.453125 1.4375 -0.453125q0.5625 0 0.96875 0.171875l0 1.46875q-0.515625 -0.265625 -1.15625 -0.265625q-0.59375 0 -1.09375 0.34375q-0.5 0.328125 -0.796875 0.90625q-0.28125 0.5625 -0.28125 1.21875l0 4.5625l-1.359375 0l0 -8.15625zm9.14502 8.40625q-1.171875 0 -2.109375 -0.546875q-0.921875 -0.5625 -1.4375 -1.546875q-0.515625 -0.984375 -0.515625 -2.21875q0 -1.171875 0.484375 -2.171875q0.484375 -1.0 1.390625 -1.59375q0.90625 -0.59375 2.078125 -0.59375q1.203125 0 2.078125 0.546875q0.875 0.53125 1.34375 1.484375q0.484375 0.9375 0.484375 2.15625q0 0.1875 -0.03125 0.40625l-6.46875 0q0.046875 0.9375 0.4375 1.578125q0.40625 0.640625 1.015625 0.96875q0.625 0.3125 1.296875 0.3125q1.59375 0 2.421875 -1.484375l1.140625 0.5625q-0.5 0.984375 -1.421875 1.5625q-0.90625 0.578125 -2.1875 0.578125zm2.34375 -5.1875q-0.03125 -0.515625 -0.28125 -1.03125q-0.25 -0.515625 -0.796875 -0.859375q-0.546875 -0.359375 -1.375 -0.359375q-0.96875 0 -1.640625 0.625q-0.671875 0.609375 -0.875 1.625l4.96875 0zm3.0392761 -3.21875l1.28125 0l0 1.203125l0.078125 0q0.34375 -0.625 1.046875 -1.046875q0.703125 -0.421875 1.484375 -0.421875q0.90625 0 1.5625 0.4375q0.671875 0.4375 0.953125 1.15625q0.4375 -0.71875 1.140625 -1.15625q0.71875 -0.4375 1.65625 -0.4375q1.40625 0 2.125 0.859375q0.71875 0.859375 0.71875 2.328125l0 5.234375l-1.34375 0l0 -5.03125q0 -1.125 -0.46875 -1.640625q-0.46875 -0.515625 -1.375 -0.515625q-0.609375 0 -1.109375 0.359375q-0.5 0.34375 -0.78125 0.9375q-0.265625 0.59375 -0.265625 1.28125l0 4.609375l-1.359375 0l0 -5.015625q0 -1.140625 -0.46875 -1.65625q-0.46875 -0.515625 -1.359375 -0.515625q-0.609375 0 -1.109375 0.359375q-0.5 0.359375 -0.78125 0.96875q-0.265625 0.59375 -0.265625 1.28125l0 4.578125l-1.359375 0l0 -8.15625zm17.641022 8.40625q-1.171875 0 -2.109375 -0.546875q-0.921875 -0.5625 -1.4375 -1.546875q-0.515625 -0.984375 -0.515625 -2.21875q0 -1.171875 0.484375 -2.171875q0.484375 -1.0 1.390625 -1.59375q0.90625 -0.59375 2.078125 -0.59375q1.203125 0 2.078125 0.546875q0.875 0.53125 1.34375 1.484375q0.484375 0.9375 0.484375 2.15625q0 0.1875 -0.03125 0.40625l-6.46875 0q0.046875 0.9375 0.4375 1.578125q0.40625 0.640625 1.015625 0.96875q0.625 0.3125 1.296875 0.3125q1.59375 0 2.421875 -1.484375l1.140625 0.5625q-0.5 0.984375 -1.421875 1.5625q-0.90625 0.578125 -2.1875 0.578125zm2.34375 -5.1875q-0.03125 -0.515625 -0.28125 -1.03125q-0.25 -0.515625 -0.796875 -0.859375q-0.546875 -0.359375 -1.375 -0.359375q-0.96875 0 -1.640625 0.625q-0.671875 0.609375 -0.875 1.625l4.96875 0zm3.0392456 -3.21875l1.28125 0l0 1.203125l0.078125 0q0.328125 -0.609375 1.0625 -1.03125q0.734375 -0.4375 1.578125 -0.4375q1.46875 0 2.234375 0.859375q0.78125 0.859375 0.78125 2.328125l0 5.234375l-1.359375 0l0 -5.03125q0 -1.125 -0.546875 -1.640625q-0.546875 -0.515625 -1.484375 -0.515625q-0.65625 0 -1.1875 0.375q-0.515625 0.359375 -0.796875 0.96875q-0.28125 0.59375 -0.28125 1.25l0 4.59375l-1.359375 0l0 -8.15625zm11.701019 8.28125q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm5.1647644 0.125q-0.890625 0 -1.59375 -0.34375q-0.703125 -0.359375 -1.09375 -0.96875q-0.375 -0.625 -0.375 -1.40625q0 -1.296875 0.96875 -2.015625q0.984375 -0.734375 2.46875 -0.734375q0.734375 0 1.359375 0.171875q0.640625 0.15625 0.96875 0.359375l0 -0.5q0 -0.90625 -0.640625 -1.453125q-0.625 -0.5625 -1.609375 -0.5625q-0.671875 0 -1.265625 0.296875q-0.578125 0.296875 -0.90625 0.828125l-1.03125 -0.765625q0.484375 -0.734375 1.328125 -1.15625q0.859375 -0.421875 1.875 -0.421875q1.671875 0 2.609375 0.875q0.9375 0.875 0.9375 2.375l0 5.171875l-1.296875 0l0 -1.171875l-0.0625 0q-0.34375 0.59375 -1.046875 1.015625q-0.703125 0.40625 -1.59375 0.40625zm0.140625 -1.1875q0.6875 0 1.265625 -0.34375q0.59375 -0.359375 0.9375 -0.953125q0.359375 -0.59375 0.359375 -1.296875q-0.375 -0.265625 -0.9375 -0.421875q-0.5625 -0.15625 -1.1875 -0.15625q-1.109375 0 -1.6875 0.46875q-0.5625 0.453125 -0.5625 1.1875q0 0.671875 0.5 1.09375q0.515625 0.421875 1.3125 0.421875zm5.7616577 -10.515625l1.359375 0l0 11.453125l-1.359375 0l0 -11.453125zm2.360382 11.453125l0 0zm8.415131 0.25q-1.1875 0 -2.140625 -0.5625q-0.9375 -0.5625 -1.46875 -1.546875q-0.515625 -0.984375 -0.515625 -2.21875q0 -1.234375 0.515625 -2.21875q0.53125 -1.0 1.46875 -1.5625q0.953125 -0.5625 2.140625 -0.5625q1.328125 0 2.234375 0.625q0.90625 0.609375 1.28125 1.640625l-1.234375 0.515625q-0.296875 -0.765625 -0.90625 -1.15625q-0.59375 -0.390625 -1.4375 -0.390625q-0.71875 0 -1.34375 0.390625q-0.625 0.390625 -1.0 1.109375q-0.375 0.703125 -0.375 1.609375q0 0.90625 0.375 1.609375q0.375 0.703125 1.0 1.109375q0.625 0.390625 1.34375 0.390625q0.859375 0 1.484375 -0.40625q0.625 -0.40625 0.9375 -1.140625l1.203125 0.515625q-0.40625 1.015625 -1.328125 1.640625q-0.921875 0.609375 -2.234375 0.609375zm8.718506 0q-1.203125 0 -2.171875 -0.5625q-0.953125 -0.578125 -1.484375 -1.5625q-0.53125 -1.0 -0.53125 -2.203125q0 -1.203125 0.53125 -2.1875q0.53125 -1.0 1.484375 -1.578125q0.96875 -0.578125 2.171875 -0.578125q1.203125 0 2.15625 0.578125q0.96875 0.578125 1.5 1.578125q0.53125 0.984375 0.53125 2.1875q0 1.203125 -0.53125 2.203125q-0.53125 0.984375 -1.5 1.5625q-0.953125 0.5625 -2.15625 0.5625zm0 -1.21875q0.75 0 1.390625 -0.375q0.65625 -0.390625 1.046875 -1.09375q0.390625 -0.703125 0.390625 -1.640625q0 -0.953125 -0.390625 -1.65625q-0.390625 -0.703125 -1.046875 -1.078125q-0.640625 -0.375 -1.390625 -0.375q-0.75 0 -1.40625 0.375q-0.65625 0.375 -1.046875 1.078125q-0.390625 0.703125 -0.390625 1.65625q0 0.9375 0.390625 1.640625q0.390625 0.703125 1.046875 1.09375q0.65625 0.375 1.40625 0.375zm5.6260376 -7.1875l1.28125 0l0 1.203125l0.078125 0q0.34375 -0.625 1.046875 -1.046875q0.703125 -0.421875 1.484375 -0.421875q0.90625 0 1.5625 0.4375q0.671875 0.4375 0.953125 1.15625q0.4375 -0.71875 1.140625 -1.15625q0.71875 -0.4375 1.65625 -0.4375q1.40625 0 2.125 0.859375q0.71875 0.859375 0.71875 2.328125l0 5.234375l-1.34375 0l0 -5.03125q0 -1.125 -0.46875 -1.640625q-0.46875 -0.515625 -1.375 -0.515625q-0.609375 0 -1.109375 0.359375q-0.5 0.34375 -0.78125 0.9375q-0.265625 0.59375 -0.265625 1.28125l0 4.609375l-1.359375 0l0 -5.015625q0 -1.140625 -0.46875 -1.65625q-0.46875 -0.515625 -1.359375 -0.515625q-0.609375 0 -1.109375 0.359375q-0.5 0.359375 -0.78125 0.96875q-0.265625 0.59375 -0.265625 1.28125l0 4.578125l-1.359375 0l0 -8.15625zm13.937897 0l1.296875 0l0 1.21875l0.0625 0q0.375 -0.625 1.109375 -1.046875q0.75 -0.4375 1.6875 -0.4375q1.09375 0 1.984375 0.5625q0.890625 0.5625 1.390625 1.5625q0.515625 0.984375 0.515625 2.21875q0 1.25 -0.515625 2.234375q-0.5 0.984375 -1.390625 1.546875q-0.890625 0.546875 -1.984375 0.546875q-0.9375 0 -1.6875 -0.421875q-0.734375 -0.421875 -1.109375 -1.03125l-0.0625 0l0.0625 1.125l0 3.53125l-1.359375 0l0 -11.609375zm4.0 7.1875q0.703125 0 1.328125 -0.390625q0.625 -0.390625 0.984375 -1.09375q0.375 -0.703125 0.375 -1.625q0 -0.9375 -0.375 -1.640625q-0.359375 -0.703125 -0.984375 -1.078125q-0.625 -0.390625 -1.328125 -0.390625q-0.71875 0 -1.34375 0.390625q-0.609375 0.375 -0.984375 1.078125q-0.375 0.703125 -0.375 1.640625q0 0.921875 0.375 1.625q0.375 0.703125 0.984375 1.09375q0.625 0.390625 1.34375 0.390625zm6.3630066 -8.6875q-0.40625 0 -0.703125 -0.28125q-0.28125 -0.296875 -0.28125 -0.703125q0 -0.421875 0.28125 -0.6875q0.296875 -0.28125 0.703125 -0.28125q0.40625 0 0.6875 0.28125q0.28125 0.265625 0.28125 0.6875q0 0.40625 -0.28125 0.703125q-0.28125 0.28125 -0.6875 0.28125zm-0.671875 1.5l1.359375 0l0 8.15625l-1.359375 0l0 -8.15625zm3.4910278 -3.296875l1.359375 0l0 11.453125l-1.359375 0l0 -11.453125zm5.88974 11.703125q-0.890625 0 -1.59375 -0.34375q-0.703125 -0.359375 -1.09375 -0.96875q-0.375 -0.625 -0.375 -1.40625q0 -1.296875 0.96875 -2.015625q0.984375 -0.734375 2.46875 -0.734375q0.734375 0 1.359375 0.171875q0.640625 0.15625 0.96875 0.359375l0 -0.5q0 -0.90625 -0.640625 -1.453125q-0.625 -0.5625 -1.609375 -0.5625q-0.671875 0 -1.265625 0.296875q-0.578125 0.296875 -0.90625 0.828125l-1.03125 -0.765625q0.484375 -0.734375 1.328125 -1.15625q0.859375 -0.421875 1.875 -0.421875q1.671875 0 2.609375 0.875q0.9375 0.875 0.9375 2.375l0 5.171875l-1.296875 0l0 -1.171875l-0.0625 0q-0.34375 0.59375 -1.046875 1.015625q-0.703125 0.40625 -1.59375 0.40625zm0.140625 -1.1875q0.6875 0 1.265625 -0.34375q0.59375 -0.359375 0.9375 -0.953125q0.359375 -0.59375 0.359375 -1.296875q-0.375 -0.265625 -0.9375 -0.421875q-0.5625 -0.15625 -1.1875 -0.15625q-1.109375 0 -1.6875 0.46875q-0.5625 0.453125 -0.5625 1.1875q0 0.671875 0.5 1.09375q0.515625 0.421875 1.3125 0.421875zm8.726654 1.0625q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm3.6078796 -9.78125q-0.40625 0 -0.703125 -0.28125q-0.28125 -0.296875 -0.28125 -0.703125q0 -0.421875 0.28125 -0.6875q0.296875 -0.28125 0.703125 -0.28125q0.40625 0 0.6875 0.28125q0.28125 0.265625 0.28125 0.6875q0 0.40625 -0.28125 0.703125q-0.28125 0.28125 -0.6875 0.28125zm-0.671875 1.5l1.359375 0l0 8.15625l-1.359375 0l0 -8.15625zm7.1610107 8.40625q-1.203125 0 -2.171875 -0.5625q-0.953125 -0.578125 -1.484375 -1.5625q-0.53125 -1.0 -0.53125 -2.203125q0 -1.203125 0.53125 -2.1875q0.53125 -1.0 1.484375 -1.578125q0.96875 -0.578125 2.171875 -0.578125q1.203125 0 2.15625 0.578125q0.96875 0.578125 1.5 1.578125q0.53125 0.984375 0.53125 2.1875q0 1.203125 -0.53125 2.203125q-0.53125 0.984375 -1.5 1.5625q-0.953125 0.5625 -2.15625 0.5625zm0 -1.21875q0.75 0 1.390625 -0.375q0.65625 -0.390625 1.046875 -1.09375q0.390625 -0.703125 0.390625 -1.640625q0 -0.953125 -0.390625 -1.65625q-0.390625 -0.703125 -1.046875 -1.078125q-0.640625 -0.375 -1.390625 -0.375q-0.75 0 -1.40625 0.375q-0.65625 0.375 -1.046875 1.078125q-0.390625 0.703125 -0.390625 1.65625q0 0.9375 0.390625 1.640625q0.390625 0.703125 1.046875 1.09375q0.65625 0.375 1.40625 0.375zm5.6260376 -7.1875l1.28125 0l0 1.203125l0.078125 0q0.328125 -0.609375 1.0625 -1.03125q0.734375 -0.4375 1.578125 -0.4375q1.46875 0 2.234375 0.859375q0.78125 0.859375 0.78125 2.328125l0 5.234375l-1.359375 0l0 -5.03125q0 -1.125 -0.546875 -1.640625q-0.546875 -0.515625 -1.484375 -0.515625q-0.65625 0 -1.1875 0.375q-0.515625 0.359375 -0.796875 0.96875q-0.28125 0.59375 -0.28125 1.25l0 4.59375l-1.359375 0l0 -8.15625z" fill-rule="nonzero"/><path fill="#eeeeee" d="m224.24684 211.13821q-0.875 0 -1.6875 -0.359375q-0.796875 -0.359375 -1.421875 -1.046875q-0.625 -0.703125 -0.890625 -1.6875l1.296875 -0.53125q0.265625 1.015625 1.0 1.671875q0.734375 0.65625 1.734375 0.65625q0.984375 0 1.671875 -0.53125q0.6875 -0.53125 0.6875 -1.46875q0 -0.796875 -0.578125 -1.3125q-0.578125 -0.515625 -1.90625 -0.96875l-0.734375 -0.25q-1.203125 -0.4375 -1.984375 -1.140625q-0.765625 -0.703125 -0.765625 -1.953125q0 -0.8125 0.453125 -1.5q0.453125 -0.703125 1.25 -1.125q0.796875 -0.421875 1.796875 -0.421875q0.984375 0 1.71875 0.375q0.734375 0.375 1.171875 0.90625q0.453125 0.515625 0.625 1.03125l-1.265625 0.546875q-0.171875 -0.59375 -0.75 -1.078125q-0.5625 -0.484375 -1.484375 -0.484375q-0.890625 0 -1.515625 0.5q-0.625 0.5 -0.625 1.25q0 0.671875 0.53125 1.09375q0.53125 0.421875 1.609375 0.796875l0.75 0.25q1.453125 0.53125 2.265625 1.328125q0.8125 0.78125 0.8125 2.140625q0 1.109375 -0.5625 1.859375q-0.5625 0.75 -1.4375 1.109375q-0.859375 0.34375 -1.765625 0.34375zm8.248276 -0.125q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm5.1647644 0.125q-0.890625 0 -1.59375 -0.34375q-0.703125 -0.359375 -1.09375 -0.96875q-0.375 -0.625 -0.375 -1.40625q0 -1.296875 0.96875 -2.015625q0.984375 -0.734375 2.46875 -0.734375q0.734375 0 1.359375 0.171875q0.640625 0.15625 0.96875 0.359375l0 -0.5q0 -0.90625 -0.640625 -1.453125q-0.625 -0.5625 -1.609375 -0.5625q-0.671875 0 -1.265625 0.296875q-0.578125 0.296875 -0.90625 0.828125l-1.03125 -0.765625q0.484375 -0.734375 1.328125 -1.15625q0.859375 -0.421875 1.875 -0.421875q1.671875 0 2.609375 0.875q0.9375 0.875 0.9375 2.375l0 5.171875l-1.296875 0l0 -1.171875l-0.0625 0q-0.34375 0.59375 -1.046875 1.015625q-0.703125 0.40625 -1.59375 0.40625zm0.140625 -1.1875q0.6875 0 1.265625 -0.34375q0.59375 -0.359375 0.9375 -0.953125q0.359375 -0.59375 0.359375 -1.296875q-0.375 -0.265625 -0.9375 -0.421875q-0.5625 -0.15625 -1.1875 -0.15625q-1.109375 0 -1.6875 0.46875q-0.5625 0.453125 -0.5625 1.1875q0 0.671875 0.5 1.09375q0.515625 0.421875 1.3125 0.421875zm8.726639 1.0625q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm6.004013 0.125q-1.171875 0 -2.109375 -0.546875q-0.921875 -0.5625 -1.4375 -1.546875q-0.515625 -0.984375 -0.515625 -2.21875q0 -1.171875 0.484375 -2.171875q0.484375 -1.0 1.390625 -1.59375q0.90625 -0.59375 2.078125 -0.59375q1.203125 0 2.078125 0.546875q0.875 0.53125 1.34375 1.484375q0.484375 0.9375 0.484375 2.15625q0 0.1875 -0.03125 0.40625l-6.46875 0q0.046875 0.9375 0.4375 1.578125q0.40625 0.640625 1.015625 0.96875q0.625 0.3125 1.296875 0.3125q1.59375 0 2.421875 -1.484375l1.140625 0.5625q-0.5 0.984375 -1.421875 1.5625q-0.90625 0.578125 -2.1875 0.578125zm2.34375 -5.1875q-0.03125 -0.515625 -0.28125 -1.03125q-0.25 -0.515625 -0.796875 -0.859375q-0.546875 -0.359375 -1.375 -0.359375q-0.96875 0 -1.640625 0.625q-0.671875 0.609375 -0.875 1.625l4.96875 0zm3.8167725 -1.984375l-1.5 0l0 -1.234375l1.5 0l0 -0.890625q0 -0.765625 0.34375 -1.328125q0.359375 -0.578125 0.953125 -0.890625q0.59375 -0.3125 1.3125 -0.3125q0.6875 0 1.203125 0.1875l0 1.328125q-0.296875 -0.109375 -0.5625 -0.171875q-0.25 -0.078125 -0.59375 -0.078125q-0.53125 0 -0.921875 0.375q-0.375 0.375 -0.375 1.046875l0 0.734375l2.09375 0l0 1.234375l-2.09375 0l0 6.921875l-1.359375 0l0 -6.921875zm7.9196167 7.171875q-1.46875 0 -2.25 -0.859375q-0.78125 -0.859375 -0.78125 -2.421875l0 -5.125l1.359375 0l0 4.921875q0 1.171875 0.53125 1.71875q0.53125 0.546875 1.421875 0.546875q0.6875 0 1.21875 -0.375q0.546875 -0.375 0.84375 -0.953125q0.296875 -0.59375 0.296875 -1.25l0 -4.609375l1.359375 0l0 8.15625l-1.296875 0l0 -1.1875l-0.0625 0q-0.34375 0.609375 -1.078125 1.03125q-0.734375 0.40625 -1.5625 0.40625zm6.022888 -11.703125l1.359375 0l0 11.453125l-1.359375 0l0 -11.453125zm2.360382 11.453125l0 0zm4.7276306 -11.453125l1.359375 0l0 3.375l-0.078125 1.125l0.078125 0q0.328125 -0.625 1.046875 -1.046875q0.734375 -0.421875 1.609375 -0.421875q1.484375 0 2.265625 0.875q0.78125 0.875 0.78125 2.3125l0 5.234375l-1.359375 0l0 -5.03125q0 -1.09375 -0.5625 -1.625q-0.5625 -0.53125 -1.453125 -0.53125q-0.640625 0 -1.1875 0.390625q-0.53125 0.375 -0.84375 0.984375q-0.296875 0.609375 -0.296875 1.265625l0 4.546875l-1.359375 0l0 -11.453125zm12.774017 11.703125q-1.203125 0 -2.171875 -0.5625q-0.953125 -0.578125 -1.484375 -1.5625q-0.53125 -1.0 -0.53125 -2.203125q0 -1.203125 0.53125 -2.1875q0.53125 -1.0 1.484375 -1.578125q0.96875 -0.578125 2.171875 -0.578125q1.203125 0 2.15625 0.578125q0.96875 0.578125 1.5 1.578125q0.53125 0.984375 0.53125 2.1875q0 1.203125 -0.53125 2.203125q-0.53125 0.984375 -1.5 1.5625q-0.953125 0.5625 -2.15625 0.5625zm0 -1.21875q0.75 0 1.390625 -0.375q0.65625 -0.390625 1.046875 -1.09375q0.390625 -0.703125 0.390625 -1.640625q0 -0.953125 -0.390625 -1.65625q-0.390625 -0.703125 -1.046875 -1.078125q-0.640625 -0.375 -1.390625 -0.375q-0.75 0 -1.40625 0.375q-0.65625 0.375 -1.046875 1.078125q-0.390625 0.703125 -0.390625 1.65625q0 0.9375 0.390625 1.640625q0.390625 0.703125 1.046875 1.09375q0.65625 0.375 1.40625 0.375zm8.6710205 1.09375q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm1.7153931 -0.125l0 0zm4.7276306 -8.15625l1.28125 0l0 1.3125l0.078125 0q0.234375 -0.671875 0.921875 -1.109375q0.6875 -0.453125 1.4375 -0.453125q0.5625 0 0.96875 0.171875l0 1.46875q-0.515625 -0.265625 -1.15625 -0.265625q-0.59375 0 -1.09375 0.34375q-0.5 0.328125 -0.796875 0.90625q-0.28125 0.5625 -0.28125 1.21875l0 4.5625l-1.359375 0l0 -8.15625zm9.14502 8.40625q-1.171875 0 -2.109375 -0.546875q-0.921875 -0.5625 -1.4375 -1.546875q-0.515625 -0.984375 -0.515625 -2.21875q0 -1.171875 0.484375 -2.171875q0.484375 -1.0 1.390625 -1.59375q0.90625 -0.59375 2.078125 -0.59375q1.203125 0 2.078125 0.546875q0.875 0.53125 1.34375 1.484375q0.484375 0.9375 0.484375 2.15625q0 0.1875 -0.03125 0.40625l-6.46875 0q0.046875 0.9375 0.4375 1.578125q0.40625 0.640625 1.015625 0.96875q0.625 0.3125 1.296875 0.3125q1.59375 0 2.421875 -1.484375l1.140625 0.5625q-0.5 0.984375 -1.421875 1.5625q-0.90625 0.578125 -2.1875 0.578125zm2.34375 -5.1875q-0.03125 -0.515625 -0.28125 -1.03125q-0.25 -0.515625 -0.796875 -0.859375q-0.546875 -0.359375 -1.375 -0.359375q-0.96875 0 -1.640625 0.625q-0.671875 0.609375 -0.875 1.625l4.96875 0zm3.0392761 -6.515625l1.359375 0l0 11.453125l-1.359375 0l0 -11.453125zm7.04599 11.703125q-1.203125 0 -2.171875 -0.5625q-0.953125 -0.578125 -1.484375 -1.5625q-0.53125 -1.0 -0.53125 -2.203125q0 -1.203125 0.53125 -2.1875q0.53125 -1.0 1.484375 -1.578125q0.96875 -0.578125 2.171875 -0.578125q1.203125 0 2.15625 0.578125q0.96875 0.578125 1.5 1.578125q0.53125 0.984375 0.53125 2.1875q0 1.203125 -0.53125 2.203125q-0.53125 0.984375 -1.5 1.5625q-0.953125 0.5625 -2.15625 0.5625zm0 -1.21875q0.75 0 1.390625 -0.375q0.65625 -0.390625 1.046875 -1.09375q0.390625 -0.703125 0.390625 -1.640625q0 -0.953125 -0.390625 -1.65625q-0.390625 -0.703125 -1.046875 -1.078125q-0.640625 -0.375 -1.390625 -0.375q-0.75 0 -1.40625 0.375q-0.65625 0.375 -1.046875 1.078125q-0.390625 0.703125 -0.390625 1.65625q0 0.9375 0.390625 1.640625q0.390625 0.703125 1.046875 1.09375q0.65625 0.375 1.40625 0.375zm8.379791 1.21875q-0.890625 0 -1.59375 -0.34375q-0.703125 -0.359375 -1.09375 -0.96875q-0.375 -0.625 -0.375 -1.40625q0 -1.296875 0.96875 -2.015625q0.984375 -0.734375 2.46875 -0.734375q0.734375 0 1.359375 0.171875q0.640625 0.15625 0.96875 0.359375l0 -0.5q0 -0.90625 -0.640625 -1.453125q-0.625 -0.5625 -1.609375 -0.5625q-0.671875 0 -1.265625 0.296875q-0.578125 0.296875 -0.90625 0.828125l-1.03125 -0.765625q0.484375 -0.734375 1.328125 -1.15625q0.859375 -0.421875 1.875 -0.421875q1.671875 0 2.609375 0.875q0.9375 0.875 0.9375 2.375l0 5.171875l-1.296875 0l0 -1.171875l-0.0625 0q-0.34375 0.59375 -1.046875 1.015625q-0.703125 0.40625 -1.59375 0.40625zm0.140625 -1.1875q0.6875 0 1.265625 -0.34375q0.59375 -0.359375 0.9375 -0.953125q0.359375 -0.59375 0.359375 -1.296875q-0.375 -0.265625 -0.9375 -0.421875q-0.5625 -0.15625 -1.1875 -0.15625q-1.109375 0 -1.6875 0.46875q-0.5625 0.453125 -0.5625 1.1875q0 0.671875 0.5 1.09375q0.515625 0.421875 1.3125 0.421875zm9.150391 1.1875q-1.109375 0 -2.0 -0.546875q-0.890625 -0.5625 -1.40625 -1.546875q-0.5 -0.984375 -0.5 -2.234375q0 -1.234375 0.5 -2.21875q0.515625 -1.0 1.40625 -1.5625q0.890625 -0.5625 2.0 -0.5625q0.921875 0 1.65625 0.4375q0.734375 0.421875 1.125 1.046875l0.0625 0l-0.0625 -1.140625l0 -3.375l1.359375 0l0 11.453125l-1.296875 0l0 -1.203125l-0.0625 0q-0.390625 0.609375 -1.125 1.03125q-0.734375 0.421875 -1.65625 0.421875zm0.140625 -1.21875q0.71875 0 1.328125 -0.390625q0.625 -0.390625 1.0 -1.09375q0.375 -0.703125 0.375 -1.625q0 -0.9375 -0.375 -1.640625q-0.375 -0.703125 -1.0 -1.078125q-0.609375 -0.390625 -1.328125 -0.390625q-0.703125 0 -1.328125 0.390625q-0.625 0.375 -1.0 1.09375q-0.375 0.71875 -0.375 1.625q0 0.90625 0.375 1.625q0.375 0.703125 1.0 1.09375q0.625 0.390625 1.328125 0.390625z" fill-rule="nonzero"/><path fill="#2bb7f6" d="m484.84122 141.17389l346.0787 0l0 86.708664l-346.0787 0z" fill-rule="evenodd"/><path fill="#000000" d="m567.37244 159.08884l4.703125 0q1.265625 0 2.3125 0.53125q1.046875 0.53125 1.640625 1.5q0.59375 0.953125 0.59375 2.1875q0 1.234375 -0.59375 2.203125q-0.59375 0.96875 -1.640625 1.5q-1.046875 0.53125 -2.3125 0.53125l-2.1875 0l0 4.90625l-2.515625 0l0 -13.359375zm4.78125 6.0625q0.921875 0 1.453125 -0.53125q0.53125 -0.546875 0.53125 -1.3125q0 -0.765625 -0.53125 -1.296875q-0.53125 -0.53125 -1.453125 -0.53125l-2.265625 0l0 3.671875l2.265625 0zm6.25531 -2.21875l2.296875 0l0 1.265625l0.15625 0q0.359375 -0.671875 1.09375 -1.109375q0.75 -0.4375 1.640625 -0.4375q0.65625 0 1.203125 0.203125l0 2.453125q-0.5 -0.1875 -0.859375 -0.265625q-0.34375 -0.09375 -0.734375 -0.09375q-1.078125 0 -1.71875 0.78125q-0.625 0.78125 -0.625 1.984375l0 4.734375l-2.453125 0l0 -9.515625zm11.96875 9.8125q-1.484375 0 -2.640625 -0.65625q-1.15625 -0.671875 -1.796875 -1.8125q-0.640625 -1.15625 -0.640625 -2.578125q0 -1.421875 0.640625 -2.578125q0.640625 -1.15625 1.796875 -1.8125q1.15625 -0.671875 2.640625 -0.671875q1.453125 0 2.609375 0.671875q1.15625 0.65625 1.796875 1.8125q0.640625 1.15625 0.640625 2.578125q0 1.421875 -0.640625 2.578125q-0.640625 1.140625 -1.796875 1.8125q-1.15625 0.65625 -2.609375 0.65625zm0 -2.25q0.703125 0 1.296875 -0.328125q0.609375 -0.34375 0.953125 -0.984375q0.359375 -0.640625 0.359375 -1.484375q0 -0.84375 -0.359375 -1.46875q-0.34375 -0.640625 -0.953125 -0.96875q-0.59375 -0.34375 -1.296875 -0.34375q-0.71875 0 -1.3125 0.34375q-0.59375 0.328125 -0.96875 0.96875q-0.359375 0.625 -0.359375 1.46875q0 0.828125 0.359375 1.484375q0.375 0.640625 0.96875 0.984375q0.59375 0.328125 1.3125 0.328125zm11.004822 2.25q-1.28125 0 -2.34375 -0.640625q-1.046875 -0.640625 -1.65625 -1.78125q-0.609375 -1.15625 -0.609375 -2.625q0 -1.46875 0.609375 -2.625q0.609375 -1.15625 1.65625 -1.796875q1.0625 -0.640625 2.34375 -0.640625q0.96875 0 1.71875 0.421875q0.75 0.421875 1.140625 1.03125l0.140625 0l-0.140625 -1.34375l0 -3.65625l2.421875 0l0 13.359375l-2.28125 0l0 -1.140625l-0.140625 0q-0.375 0.625 -1.140625 1.03125q-0.75 0.40625 -1.71875 0.40625zm0.40625 -2.25q0.6875 0 1.28125 -0.359375q0.609375 -0.359375 0.953125 -0.984375q0.359375 -0.640625 0.359375 -1.453125q0 -0.828125 -0.359375 -1.453125q-0.34375 -0.640625 -0.953125 -0.984375q-0.59375 -0.34375 -1.28125 -0.34375q-0.671875 0 -1.265625 0.34375q-0.59375 0.34375 -0.953125 0.984375q-0.359375 0.625 -0.359375 1.453125q0 0.8125 0.359375 1.453125q0.359375 0.625 0.953125 0.984375q0.59375 0.359375 1.265625 0.359375zm10.709595 2.25q-1.71875 0 -2.609375 -1.0625q-0.890625 -1.0625 -0.890625 -2.96875l0 -5.78125l2.4375 0l0 5.484375q0 0.96875 0.46875 1.53125q0.46875 0.546875 1.234375 0.546875q1.046875 0 1.65625 -0.765625q0.609375 -0.765625 0.609375 -1.953125l0 -4.84375l2.453125 0l0 9.515625l-2.296875 0l0 -1.1875l-0.15625 0q-0.421875 0.6875 -1.203125 1.09375q-0.765625 0.390625 -1.703125 0.390625zm12.128662 0q-1.4375 0 -2.578125 -0.640625q-1.140625 -0.640625 -1.78125 -1.796875q-0.640625 -1.15625 -0.640625 -2.609375q0 -1.46875 0.640625 -2.609375q0.640625 -1.140625 1.78125 -1.796875q1.140625 -0.65625 2.578125 -0.65625q1.578125 0 2.71875 0.6875q1.140625 0.671875 1.640625 1.921875l-2.234375 0.9375q-0.59375 -1.265625 -2.125 -1.265625q-1.125 0 -1.84375 0.765625q-0.71875 0.765625 -0.71875 2.015625q0 1.265625 0.71875 2.03125q0.71875 0.765625 1.84375 0.765625q1.546875 0 2.234375 -1.34375l2.21875 0.96875q-0.609375 1.25 -1.75 1.9375q-1.140625 0.6875 -2.703125 0.6875zm10.25293 -0.140625q-0.703125 0 -1.296875 -0.21875q-0.59375 -0.21875 -0.96875 -0.59375q-0.875 -0.84375 -0.875 -2.390625l0 -4.375l-1.671875 0l0 -2.09375l1.671875 0l0 -2.6875l2.4375 0l0 2.6875l2.328125 0l0 2.09375l-2.328125 0l0 3.9375q0 0.71875 0.3125 1.046875q0.265625 0.296875 0.90625 0.296875q0.34375 0 0.578125 -0.09375q0.234375 -0.09375 0.609375 -0.328125l0 2.390625q-0.796875 0.328125 -1.703125 0.328125zm5.1416626 -10.71875q-0.65625 0 -1.125 -0.46875q-0.46875 -0.46875 -0.46875 -1.109375q0 -0.65625 0.46875 -1.109375q0.46875 -0.46875 1.125 -0.46875q0.65625 0 1.109375 0.46875q0.453125 0.453125 0.453125 1.109375q0 0.640625 -0.453125 1.109375q-0.453125 0.46875 -1.109375 0.46875zm-1.234375 1.046875l2.4375 0l0 9.515625l-2.4375 0l0 -9.515625zm9.443359 9.8125q-1.484375 0 -2.640625 -0.65625q-1.15625 -0.671875 -1.796875 -1.8125q-0.640625 -1.15625 -0.640625 -2.578125q0 -1.421875 0.640625 -2.578125q0.640625 -1.15625 1.796875 -1.8125q1.15625 -0.671875 2.640625 -0.671875q1.453125 0 2.609375 0.671875q1.15625 0.65625 1.796875 1.8125q0.640625 1.15625 0.640625 2.578125q0 1.421875 -0.640625 2.578125q-0.640625 1.140625 -1.796875 1.8125q-1.15625 0.65625 -2.609375 0.65625zm0 -2.25q0.703125 0 1.296875 -0.328125q0.609375 -0.34375 0.953125 -0.984375q0.359375 -0.640625 0.359375 -1.484375q0 -0.84375 -0.359375 -1.46875q-0.34375 -0.640625 -0.953125 -0.96875q-0.59375 -0.34375 -1.296875 -0.34375q-0.71875 0 -1.3125 0.34375q-0.59375 0.328125 -0.96875 0.96875q-0.359375 0.625 -0.359375 1.46875q0 0.828125 0.359375 1.484375q0.375 0.640625 0.96875 0.984375q0.59375 0.328125 1.3125 0.328125zm6.7244263 -7.5625l2.296875 0l0 1.1875l0.15625 0q0.421875 -0.6875 1.203125 -1.078125q0.796875 -0.40625 1.703125 -0.40625q1.71875 0 2.609375 1.046875q0.90625 1.046875 0.90625 2.859375l0 5.90625l-2.453125 0l0 -5.609375q0 -0.921875 -0.46875 -1.421875q-0.46875 -0.5 -1.296875 -0.5q-1.0 0 -1.609375 0.765625q-0.59375 0.765625 -0.59375 1.921875l0 4.84375l-2.453125 0l0 -9.515625zm9.98761 9.515625l0 0zm9.693726 0.15625q-0.703125 0 -1.296875 -0.21875q-0.59375 -0.21875 -0.96875 -0.59375q-0.875 -0.84375 -0.875 -2.390625l0 -4.375l-1.671875 0l0 -2.09375l1.671875 0l0 -2.6875l2.4375 0l0 2.6875l2.328125 0l0 2.09375l-2.328125 0l0 3.9375q0 0.71875 0.3125 1.046875q0.265625 0.296875 0.90625 0.296875q0.34375 0 0.578125 -0.09375q0.234375 -0.09375 0.609375 -0.328125l0 2.390625q-0.796875 0.328125 -1.703125 0.328125zm7.8841553 0.140625q-1.484375 0 -2.640625 -0.65625q-1.15625 -0.671875 -1.796875 -1.8125q-0.640625 -1.15625 -0.640625 -2.578125q0 -1.421875 0.640625 -2.578125q0.640625 -1.15625 1.796875 -1.8125q1.15625 -0.671875 2.640625 -0.671875q1.453125 0 2.609375 0.671875q1.15625 0.65625 1.796875 1.8125q0.640625 1.15625 0.640625 2.578125q0 1.421875 -0.640625 2.578125q-0.640625 1.140625 -1.796875 1.8125q-1.15625 0.65625 -2.609375 0.65625zm0 -2.25q0.703125 0 1.296875 -0.328125q0.609375 -0.34375 0.953125 -0.984375q0.359375 -0.640625 0.359375 -1.484375q0 -0.84375 -0.359375 -1.46875q-0.34375 -0.640625 -0.953125 -0.96875q-0.59375 -0.34375 -1.296875 -0.34375q-0.71875 0 -1.3125 0.34375q-0.59375 0.328125 -0.96875 0.96875q-0.359375 0.625 -0.359375 1.46875q0 0.828125 0.359375 1.484375q0.375 0.640625 0.96875 0.984375q0.59375 0.328125 1.3125 0.328125zm11.473633 2.25q-1.484375 0 -2.640625 -0.65625q-1.15625 -0.671875 -1.796875 -1.8125q-0.640625 -1.15625 -0.640625 -2.578125q0 -1.421875 0.640625 -2.578125q0.640625 -1.15625 1.796875 -1.8125q1.15625 -0.671875 2.640625 -0.671875q1.453125 0 2.609375 0.671875q1.15625 0.65625 1.796875 1.8125q0.640625 1.15625 0.640625 2.578125q0 1.421875 -0.640625 2.578125q-0.640625 1.140625 -1.796875 1.8125q-1.15625 0.65625 -2.609375 0.65625zm0 -2.25q0.703125 0 1.296875 -0.328125q0.609375 -0.34375 0.953125 -0.984375q0.359375 -0.640625 0.359375 -1.484375q0 -0.84375 -0.359375 -1.46875q-0.34375 -0.640625 -0.953125 -0.96875q-0.59375 -0.34375 -1.296875 -0.34375q-0.71875 0 -1.3125 0.34375q-0.59375 0.328125 -0.96875 0.96875q-0.359375 0.625 -0.359375 1.46875q0 0.828125 0.359375 1.484375q0.375 0.640625 0.96875 0.984375q0.59375 0.328125 1.3125 0.328125zm6.817749 -11.40625l2.453125 0l0 13.359375l-2.453125 0l0 -13.359375zm9.241638 13.65625q-1.4375 0 -2.578125 -0.640625q-1.140625 -0.640625 -1.78125 -1.796875q-0.640625 -1.15625 -0.640625 -2.609375q0 -1.46875 0.640625 -2.609375q0.640625 -1.140625 1.78125 -1.796875q1.140625 -0.65625 2.578125 -0.65625q1.578125 0 2.71875 0.6875q1.140625 0.671875 1.640625 1.921875l-2.234375 0.9375q-0.59375 -1.265625 -2.125 -1.265625q-1.125 0 -1.84375 0.765625q-0.71875 0.765625 -0.71875 2.015625q0 1.265625 0.71875 2.03125q0.71875 0.765625 1.84375 0.765625q1.546875 0 2.234375 -1.34375l2.21875 0.96875q-0.609375 1.25 -1.75 1.9375q-1.140625 0.6875 -2.703125 0.6875zm6.2056885 -13.65625l2.453125 0l0 3.375l-0.15625 1.65625l0.15625 0q0.40625 -0.671875 1.1875 -1.078125q0.78125 -0.40625 1.703125 -0.40625q1.734375 0 2.65625 1.03125q0.921875 1.03125 0.921875 2.875l0 5.90625l-2.4375 0l0 -5.609375q0 -0.921875 -0.5 -1.421875q-0.5 -0.5 -1.3125 -0.5q-0.96875 0 -1.59375 0.78125q-0.625 0.78125 -0.625 1.921875l0 4.828125l-2.453125 0l0 -13.359375zm14.05957 13.65625q-1.515625 0 -2.484375 -0.875q-0.96875 -0.890625 -0.96875 -2.328125q0 -0.953125 0.5 -1.671875q0.5 -0.734375 1.375 -1.125q0.890625 -0.390625 1.953125 -0.390625q1.46875 0 2.515625 0.421875l0 -0.40625q0 -0.78125 -0.59375 -1.265625q-0.578125 -0.484375 -1.578125 -0.484375q-0.671875 0 -1.296875 0.3125q-0.625 0.296875 -1.03125 0.796875l-1.5625 -1.234375q0.6875 -0.890625 1.734375 -1.375q1.046875 -0.484375 2.265625 -0.484375q2.1875 0 3.328125 1.015625q1.140625 1.0 1.140625 2.9375l0 5.859375l-2.40625 0l0 -0.96875l-0.15625 0q-0.421875 0.5625 -1.125 0.921875q-0.703125 0.34375 -1.609375 0.34375zm0.578125 -1.90625q1.0625 0 1.6875 -0.671875q0.625 -0.6875 0.625 -1.59375q-0.953125 -0.453125 -2.0 -0.453125q-1.90625 0 -1.90625 1.421875q0 0.578125 0.40625 0.9375q0.421875 0.359375 1.1875 0.359375zm8.356812 -8.953125q-0.65625 0 -1.125 -0.46875q-0.46875 -0.46875 -0.46875 -1.109375q0 -0.65625 0.46875 -1.109375q0.46875 -0.46875 1.125 -0.46875q0.65625 0 1.109375 0.46875q0.453125 0.453125 0.453125 1.109375q0 0.640625 -0.453125 1.109375q-0.453125 0.46875 -1.109375 0.46875zm-1.234375 1.046875l2.4375 0l0 9.515625l-2.4375 0l0 -9.515625zm4.974182 0l2.296875 0l0 1.1875l0.15625 0q0.421875 -0.6875 1.203125 -1.078125q0.796875 -0.40625 1.703125 -0.40625q1.71875 0 2.609375 1.046875q0.90625 1.046875 0.90625 2.859375l0 5.90625l-2.453125 0l0 -5.609375q0 -0.921875 -0.46875 -1.421875q-0.46875 -0.5 -1.296875 -0.5q-1.0 0 -1.609375 0.765625q-0.59375 0.765625 -0.59375 1.921875l0 4.84375l-2.453125 0l0 -9.515625z" fill-rule="nonzero"/><path fill="#222222" d="m567.12244 180.43509l6.625 0l0 1.296875l-5.265625 0l0 3.921875l4.75 0l0 1.28125l-4.75 0l0 4.953125l-1.359375 0l0 -11.453125zm10.50415 11.703125q-0.890625 0 -1.59375 -0.34375q-0.703125 -0.359375 -1.09375 -0.96875q-0.375 -0.625 -0.375 -1.40625q0 -1.296875 0.96875 -2.015625q0.984375 -0.734375 2.46875 -0.734375q0.734375 0 1.359375 0.171875q0.640625 0.15625 0.96875 0.359375l0 -0.5q0 -0.90625 -0.640625 -1.453125q-0.625 -0.5625 -1.609375 -0.5625q-0.671875 0 -1.265625 0.296875q-0.578125 0.296875 -0.90625 0.828125l-1.03125 -0.765625q0.484375 -0.734375 1.328125 -1.15625q0.859375 -0.421875 1.875 -0.421875q1.671875 0 2.609375 0.875q0.9375 0.875 0.9375 2.375l0 5.171875l-1.296875 0l0 -1.171875l-0.0625 0q-0.34375 0.59375 -1.046875 1.015625q-0.703125 0.40625 -1.59375 0.40625zm0.140625 -1.1875q0.6875 0 1.265625 -0.34375q0.59375 -0.359375 0.9375 -0.953125q0.359375 -0.59375 0.359375 -1.296875q-0.375 -0.265625 -0.9375 -0.421875q-0.5625 -0.15625 -1.1875 -0.15625q-1.109375 0 -1.6875 0.46875q-0.5625 0.453125 -0.5625 1.1875q0 0.671875 0.5 1.09375q0.515625 0.421875 1.3125 0.421875zm8.525391 1.1875q-1.3125 0 -2.203125 -0.609375q-0.875 -0.609375 -1.234375 -1.578125l1.203125 -0.546875q0.3125 0.734375 0.90625 1.140625q0.609375 0.40625 1.328125 0.40625q0.765625 0 1.3125 -0.3125q0.546875 -0.3125 0.546875 -0.890625q0 -0.515625 -0.4375 -0.828125q-0.4375 -0.3125 -1.359375 -0.53125l-1.0 -0.265625q-0.96875 -0.234375 -1.59375 -0.8125q-0.625 -0.578125 -0.625 -1.484375q0 -0.703125 0.421875 -1.234375q0.421875 -0.546875 1.125 -0.828125q0.703125 -0.296875 1.53125 -0.296875q1.0625 0 1.90625 0.46875q0.84375 0.46875 1.1875 1.296875l-1.171875 0.546875q-0.546875 -1.09375 -1.9375 -1.09375q-0.671875 0 -1.1875 0.3125q-0.5 0.3125 -0.5 0.796875q0 0.453125 0.34375 0.734375q0.359375 0.265625 1.0625 0.453125l1.1875 0.296875q1.203125 0.3125 1.8125 0.90625q0.609375 0.59375 0.609375 1.46875q0 0.75 -0.4375 1.3125q-0.4375 0.5625 -1.171875 0.875q-0.734375 0.296875 -1.625 0.296875zm7.769287 -0.125q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm6.0039673 0.125q-1.171875 0 -2.109375 -0.546875q-0.921875 -0.5625 -1.4375 -1.546875q-0.515625 -0.984375 -0.515625 -2.21875q0 -1.171875 0.484375 -2.171875q0.484375 -1.0 1.390625 -1.59375q0.90625 -0.59375 2.078125 -0.59375q1.203125 0 2.078125 0.546875q0.875 0.53125 1.34375 1.484375q0.484375 0.9375 0.484375 2.15625q0 0.1875 -0.03125 0.40625l-6.46875 0q0.046875 0.9375 0.4375 1.578125q0.40625 0.640625 1.015625 0.96875q0.625 0.3125 1.296875 0.3125q1.59375 0 2.421875 -1.484375l1.140625 0.5625q-0.5 0.984375 -1.421875 1.5625q-0.90625 0.578125 -2.1875 0.578125zm2.34375 -5.1875q-0.03125 -0.515625 -0.28125 -1.03125q-0.25 -0.515625 -0.796875 -0.859375q-0.546875 -0.359375 -1.375 -0.359375q-0.96875 0 -1.640625 0.625q-0.671875 0.609375 -0.875 1.625l4.96875 0zm5.9630127 5.1875q-1.3125 0 -2.203125 -0.609375q-0.875 -0.609375 -1.234375 -1.578125l1.203125 -0.546875q0.3125 0.734375 0.90625 1.140625q0.609375 0.40625 1.328125 0.40625q0.765625 0 1.3125 -0.3125q0.546875 -0.3125 0.546875 -0.890625q0 -0.515625 -0.4375 -0.828125q-0.4375 -0.3125 -1.359375 -0.53125l-1.0 -0.265625q-0.96875 -0.234375 -1.59375 -0.8125q-0.625 -0.578125 -0.625 -1.484375q0 -0.703125 0.421875 -1.234375q0.421875 -0.546875 1.125 -0.828125q0.703125 -0.296875 1.53125 -0.296875q1.0625 0 1.90625 0.46875q0.84375 0.46875 1.1875 1.296875l-1.171875 0.546875q-0.546875 -1.09375 -1.9375 -1.09375q-0.671875 0 -1.1875 0.3125q-0.5 0.3125 -0.5 0.796875q0 0.453125 0.34375 0.734375q0.359375 0.265625 1.0625 0.453125l1.1875 0.296875q1.203125 0.3125 1.8125 0.90625q0.609375 0.59375 0.609375 1.46875q0 0.75 -0.4375 1.3125q-0.4375 0.5625 -1.171875 0.875q-0.734375 0.296875 -1.625 0.296875zm7.769287 -0.125q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm1.7153931 -0.125l0 0zm4.7276 -8.15625l1.28125 0l0 1.203125l0.078125 0q0.328125 -0.609375 1.0625 -1.03125q0.734375 -0.4375 1.578125 -0.4375q1.46875 0 2.234375 0.859375q0.78125 0.859375 0.78125 2.328125l0 5.234375l-1.359375 0l0 -5.03125q0 -1.125 -0.546875 -1.640625q-0.546875 -0.515625 -1.484375 -0.515625q-0.65625 0 -1.1875 0.375q-0.515625 0.359375 -0.796875 0.96875q-0.28125 0.59375 -0.28125 1.25l0 4.59375l-1.359375 0l0 -8.15625zm11.489807 8.40625q-0.890625 0 -1.59375 -0.34375q-0.703125 -0.359375 -1.09375 -0.96875q-0.375 -0.625 -0.375 -1.40625q0 -1.296875 0.96875 -2.015625q0.984375 -0.734375 2.46875 -0.734375q0.734375 0 1.359375 0.171875q0.640625 0.15625 0.96875 0.359375l0 -0.5q0 -0.90625 -0.640625 -1.453125q-0.625 -0.5625 -1.609375 -0.5625q-0.671875 0 -1.265625 0.296875q-0.578125 0.296875 -0.90625 0.828125l-1.03125 -0.765625q0.484375 -0.734375 1.328125 -1.15625q0.859375 -0.421875 1.875 -0.421875q1.671875 0 2.609375 0.875q0.9375 0.875 0.9375 2.375l0 5.171875l-1.296875 0l0 -1.171875l-0.0625 0q-0.34375 0.59375 -1.046875 1.015625q-0.703125 0.40625 -1.59375 0.40625zm0.140625 -1.1875q0.6875 0 1.265625 -0.34375q0.59375 -0.359375 0.9375 -0.953125q0.359375 -0.59375 0.359375 -1.296875q-0.375 -0.265625 -0.9375 -0.421875q-0.5625 -0.15625 -1.1875 -0.15625q-1.109375 0 -1.6875 0.46875q-0.5625 0.453125 -0.5625 1.1875q0 0.671875 0.5 1.09375q0.515625 0.421875 1.3125 0.421875zm8.726624 1.0625q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm3.6079102 -9.78125q-0.40625 0 -0.703125 -0.28125q-0.28125 -0.296875 -0.28125 -0.703125q0 -0.421875 0.28125 -0.6875q0.296875 -0.28125 0.703125 -0.28125q0.40625 0 0.6875 0.28125q0.28125 0.265625 0.28125 0.6875q0 0.40625 -0.28125 0.703125q-0.28125 0.28125 -0.6875 0.28125zm-0.671875 1.5l1.359375 0l0 8.15625l-1.359375 0l0 -8.15625zm2.5847168 0l1.453125 0l2.53125 6.5625l0.03125 0l2.5625 -6.5625l1.421875 0l-3.328125 8.15625l-1.375 0l-3.296875 -8.15625zm12.515259 8.40625q-1.171875 0 -2.109375 -0.546875q-0.921875 -0.5625 -1.4375 -1.546875q-0.515625 -0.984375 -0.515625 -2.21875q0 -1.171875 0.484375 -2.171875q0.484375 -1.0 1.390625 -1.59375q0.90625 -0.59375 2.078125 -0.59375q1.203125 0 2.078125 0.546875q0.875 0.53125 1.34375 1.484375q0.484375 0.9375 0.484375 2.15625q0 0.1875 -0.03125 0.40625l-6.46875 0q0.046875 0.9375 0.4375 1.578125q0.40625 0.640625 1.015625 0.96875q0.625 0.3125 1.296875 0.3125q1.59375 0 2.421875 -1.484375l1.140625 0.5625q-0.5 0.984375 -1.421875 1.5625q-0.90625 0.578125 -2.1875 0.578125zm2.34375 -5.1875q-0.03125 -0.515625 -0.28125 -1.03125q-0.25 -0.515625 -0.796875 -0.859375q-0.546875 -0.359375 -1.375 -0.359375q-0.96875 0 -1.640625 0.625q-0.671875 0.609375 -0.875 1.625l4.96875 0zm2.0236816 4.9375l0 0zm8.4776 0.25q-1.203125 0 -2.171875 -0.5625q-0.953125 -0.578125 -1.484375 -1.5625q-0.53125 -1.0 -0.53125 -2.203125q0 -1.203125 0.53125 -2.1875q0.53125 -1.0 1.484375 -1.578125q0.96875 -0.578125 2.171875 -0.578125q1.203125 0 2.15625 0.578125q0.96875 0.578125 1.5 1.578125q0.53125 0.984375 0.53125 2.1875q0 1.203125 -0.53125 2.203125q-0.53125 0.984375 -1.5 1.5625q-0.953125 0.5625 -2.15625 0.5625zm0 -1.21875q0.75 0 1.390625 -0.375q0.65625 -0.390625 1.046875 -1.09375q0.390625 -0.703125 0.390625 -1.640625q0 -0.953125 -0.390625 -1.65625q-0.390625 -0.703125 -1.046875 -1.078125q-0.640625 -0.375 -1.390625 -0.375q-0.75 0 -1.40625 0.375q-0.65625 0.375 -1.046875 1.078125q-0.390625 0.703125 -0.390625 1.65625q0 0.9375 0.390625 1.640625q0.390625 0.703125 1.046875 1.09375q0.65625 0.375 1.40625 0.375zm8.65918 1.21875q-1.46875 0 -2.25 -0.859375q-0.78125 -0.859375 -0.78125 -2.421875l0 -5.125l1.359375 0l0 4.921875q0 1.171875 0.53125 1.71875q0.53125 0.546875 1.421875 0.546875q0.6875 0 1.21875 -0.375q0.546875 -0.375 0.84375 -0.953125q0.296875 -0.59375 0.296875 -1.25l0 -4.609375l1.359375 0l0 8.15625l-1.296875 0l0 -1.1875l-0.0625 0q-0.34375 0.609375 -1.078125 1.03125q-0.734375 0.40625 -1.5625 0.40625zm9.227844 -0.125q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm2.7329102 -8.28125l1.296875 0l0 1.21875l0.0625 0q0.375 -0.625 1.109375 -1.046875q0.75 -0.4375 1.6875 -0.4375q1.09375 0 1.984375 0.5625q0.890625 0.5625 1.390625 1.5625q0.515625 0.984375 0.515625 2.21875q0 1.25 -0.515625 2.234375q-0.5 0.984375 -1.390625 1.546875q-0.890625 0.546875 -1.984375 0.546875q-0.9375 0 -1.6875 -0.421875q-0.734375 -0.421875 -1.109375 -1.03125l-0.0625 0l0.0625 1.125l0 3.53125l-1.359375 0l0 -11.609375zm4.0 7.1875q0.703125 0 1.328125 -0.390625q0.625 -0.390625 0.984375 -1.09375q0.375 -0.703125 0.375 -1.625q0 -0.9375 -0.375 -1.640625q-0.359375 -0.703125 -0.984375 -1.078125q-0.625 -0.390625 -1.328125 -0.390625q-0.71875 0 -1.34375 0.390625q-0.609375 0.375 -0.984375 1.078125q-0.375 0.703125 -0.375 1.640625q0 0.921875 0.375 1.625q0.375 0.703125 0.984375 1.09375q0.625 0.390625 1.34375 0.390625zm8.519287 1.21875q-1.46875 0 -2.25 -0.859375q-0.78125 -0.859375 -0.78125 -2.421875l0 -5.125l1.359375 0l0 4.921875q0 1.171875 0.53125 1.71875q0.53125 0.546875 1.421875 0.546875q0.6875 0 1.21875 -0.375q0.546875 -0.375 0.84375 -0.953125q0.296875 -0.59375 0.296875 -1.25l0 -4.609375l1.359375 0l0 8.15625l-1.296875 0l0 -1.1875l-0.0625 0q-0.34375 0.609375 -1.078125 1.03125q-0.734375 0.40625 -1.5625 0.40625zm9.227905 -0.125q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875z" fill-rule="nonzero"/><path fill="#222222" d="m570.32556 211.13821q-0.875 0 -1.6875 -0.359375q-0.796875 -0.359375 -1.421875 -1.046875q-0.625 -0.703125 -0.890625 -1.6875l1.296875 -0.53125q0.265625 1.015625 1.0 1.671875q0.734375 0.65625 1.734375 0.65625q0.984375 0 1.671875 -0.53125q0.6875 -0.53125 0.6875 -1.46875q0 -0.796875 -0.578125 -1.3125q-0.578125 -0.515625 -1.90625 -0.96875l-0.734375 -0.25q-1.203125 -0.4375 -1.984375 -1.140625q-0.765625 -0.703125 -0.765625 -1.953125q0 -0.8125 0.453125 -1.5q0.453125 -0.703125 1.25 -1.125q0.796875 -0.421875 1.796875 -0.421875q0.984375 0 1.71875 0.375q0.734375 0.375 1.171875 0.90625q0.453125 0.515625 0.625 1.03125l-1.265625 0.546875q-0.171875 -0.59375 -0.75 -1.078125q-0.5625 -0.484375 -1.484375 -0.484375q-0.890625 0 -1.515625 0.5q-0.625 0.5 -0.625 1.25q0 0.671875 0.53125 1.09375q0.53125 0.421875 1.609375 0.796875l0.75 0.25q1.453125 0.53125 2.265625 1.328125q0.8125 0.78125 0.8125 2.140625q0 1.109375 -0.5625 1.859375q-0.5625 0.75 -1.4375 1.109375q-0.859375 0.34375 -1.765625 0.34375zm5.5233154 -8.40625l1.28125 0l0 1.203125l0.078125 0q0.34375 -0.625 1.046875 -1.046875q0.703125 -0.421875 1.484375 -0.421875q0.90625 0 1.5625 0.4375q0.671875 0.4375 0.953125 1.15625q0.4375 -0.71875 1.140625 -1.15625q0.71875 -0.4375 1.65625 -0.4375q1.40625 0 2.125 0.859375q0.71875 0.859375 0.71875 2.328125l0 5.234375l-1.34375 0l0 -5.03125q0 -1.125 -0.46875 -1.640625q-0.46875 -0.515625 -1.375 -0.515625q-0.609375 0 -1.109375 0.359375q-0.5 0.34375 -0.78125 0.9375q-0.265625 0.59375 -0.265625 1.28125l0 4.609375l-1.359375 0l0 -5.015625q0 -1.140625 -0.46875 -1.65625q-0.46875 -0.515625 -1.359375 -0.515625q-0.609375 0 -1.109375 0.359375q-0.5 0.359375 -0.78125 0.96875q-0.265625 0.59375 -0.265625 1.28125l0 4.578125l-1.359375 0l0 -8.15625zm16.529724 8.40625q-0.890625 0 -1.59375 -0.34375q-0.703125 -0.359375 -1.09375 -0.96875q-0.375 -0.625 -0.375 -1.40625q0 -1.296875 0.96875 -2.015625q0.984375 -0.734375 2.46875 -0.734375q0.734375 0 1.359375 0.171875q0.640625 0.15625 0.96875 0.359375l0 -0.5q0 -0.90625 -0.640625 -1.453125q-0.625 -0.5625 -1.609375 -0.5625q-0.671875 0 -1.265625 0.296875q-0.578125 0.296875 -0.90625 0.828125l-1.03125 -0.765625q0.484375 -0.734375 1.328125 -1.15625q0.859375 -0.421875 1.875 -0.421875q1.671875 0 2.609375 0.875q0.9375 0.875 0.9375 2.375l0 5.171875l-1.296875 0l0 -1.171875l-0.0625 0q-0.34375 0.59375 -1.046875 1.015625q-0.703125 0.40625 -1.59375 0.40625zm0.140625 -1.1875q0.6875 0 1.265625 -0.34375q0.59375 -0.359375 0.9375 -0.953125q0.359375 -0.59375 0.359375 -1.296875q-0.375 -0.265625 -0.9375 -0.421875q-0.5625 -0.15625 -1.1875 -0.15625q-1.109375 0 -1.6875 0.46875q-0.5625 0.453125 -0.5625 1.1875q0 0.671875 0.5 1.09375q0.515625 0.421875 1.3125 0.421875zm5.7616577 -10.515625l1.359375 0l0 11.453125l-1.359375 0l0 -11.453125zm3.3760376 0l1.359375 0l0 11.453125l-1.359375 0l0 -11.453125zm6.9209595 11.703125q-1.171875 0 -2.109375 -0.546875q-0.921875 -0.5625 -1.4375 -1.546875q-0.515625 -0.984375 -0.515625 -2.21875q0 -1.171875 0.484375 -2.171875q0.484375 -1.0 1.390625 -1.59375q0.90625 -0.59375 2.078125 -0.59375q1.203125 0 2.078125 0.546875q0.875 0.53125 1.34375 1.484375q0.484375 0.9375 0.484375 2.15625q0 0.1875 -0.03125 0.40625l-6.46875 0q0.046875 0.9375 0.4375 1.578125q0.40625 0.640625 1.015625 0.96875q0.625 0.3125 1.296875 0.3125q1.59375 0 2.421875 -1.484375l1.140625 0.5625q-0.5 0.984375 -1.421875 1.5625q-0.90625 0.578125 -2.1875 0.578125zm2.34375 -5.1875q-0.03125 -0.515625 -0.28125 -1.03125q-0.25 -0.515625 -0.796875 -0.859375q-0.546875 -0.359375 -1.375 -0.359375q-0.96875 0 -1.640625 0.625q-0.671875 0.609375 -0.875 1.625l4.96875 0zm5.9630127 5.1875q-1.3125 0 -2.203125 -0.609375q-0.875 -0.609375 -1.234375 -1.578125l1.203125 -0.546875q0.3125 0.734375 0.90625 1.140625q0.609375 0.40625 1.328125 0.40625q0.765625 0 1.3125 -0.3125q0.546875 -0.3125 0.546875 -0.890625q0 -0.515625 -0.4375 -0.828125q-0.4375 -0.3125 -1.359375 -0.53125l-1.0 -0.265625q-0.96875 -0.234375 -1.59375 -0.8125q-0.625 -0.578125 -0.625 -1.484375q0 -0.703125 0.421875 -1.234375q0.421875 -0.546875 1.125 -0.828125q0.703125 -0.296875 1.53125 -0.296875q1.0625 0 1.90625 0.46875q0.84375 0.46875 1.1875 1.296875l-1.171875 0.546875q-0.546875 -1.09375 -1.9375 -1.09375q-0.671875 0 -1.1875 0.3125q-0.5 0.3125 -0.5 0.796875q0 0.453125 0.34375 0.734375q0.359375 0.265625 1.0625 0.453125l1.1875 0.296875q1.203125 0.3125 1.8125 0.90625q0.609375 0.59375 0.609375 1.46875q0 0.75 -0.4375 1.3125q-0.4375 0.5625 -1.171875 0.875q-0.734375 0.296875 -1.625 0.296875zm7.769287 -0.125q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm1.7153931 -0.125l0 0zm4.7276 -8.15625l1.28125 0l0 1.3125l0.078125 0q0.234375 -0.671875 0.921875 -1.109375q0.6875 -0.453125 1.4375 -0.453125q0.5625 0 0.96875 0.171875l0 1.46875q-0.515625 -0.265625 -1.15625 -0.265625q-0.59375 0 -1.09375 0.34375q-0.5 0.328125 -0.796875 0.90625q-0.28125 0.5625 -0.28125 1.21875l0 4.5625l-1.359375 0l0 -8.15625zm8.953186 8.40625q-1.46875 0 -2.25 -0.859375q-0.78125 -0.859375 -0.78125 -2.421875l0 -5.125l1.359375 0l0 4.921875q0 1.171875 0.53125 1.71875q0.53125 0.546875 1.421875 0.546875q0.6875 0 1.21875 -0.375q0.546875 -0.375 0.84375 -0.953125q0.296875 -0.59375 0.296875 -1.25l0 -4.609375l1.359375 0l0 8.15625l-1.296875 0l0 -1.1875l-0.0625 0q-0.34375 0.609375 -1.078125 1.03125q-0.734375 0.40625 -1.5625 0.40625zm6.022888 -8.40625l1.28125 0l0 1.203125l0.078125 0q0.328125 -0.609375 1.0625 -1.03125q0.734375 -0.4375 1.578125 -0.4375q1.46875 0 2.234375 0.859375q0.78125 0.859375 0.78125 2.328125l0 5.234375l-1.359375 0l0 -5.03125q0 -1.125 -0.546875 -1.640625q-0.546875 -0.515625 -1.484375 -0.515625q-0.65625 0 -1.1875 0.375q-0.515625 0.359375 -0.796875 0.96875q-0.28125 0.59375 -0.28125 1.25l0 4.59375l-1.359375 0l0 -8.15625zm11.700989 8.28125q-0.5 0 -0.921875 -0.15625q-0.421875 -0.15625 -0.703125 -0.4375q-0.640625 -0.609375 -0.640625 -1.671875l0 -4.78125l-1.421875 0l0 -1.234375l1.421875 0l0 -2.3125l1.359375 0l0 2.3125l2.0 0l0 1.234375l-2.0 0l0 4.4375q0 0.671875 0.25 1.0q0.3125 0.34375 0.890625 0.34375q0.484375 0 0.890625 -0.265625l0 1.328125q-0.234375 0.109375 -0.484375 0.15625q-0.25 0.046875 -0.640625 0.046875zm3.6079102 -9.78125q-0.40625 0 -0.703125 -0.28125q-0.28125 -0.296875 -0.28125 -0.703125q0 -0.421875 0.28125 -0.6875q0.296875 -0.28125 0.703125 -0.28125q0.40625 0 0.6875 0.28125q0.28125 0.265625 0.28125 0.6875q0 0.40625 -0.28125 0.703125q-0.28125 0.28125 -0.6875 0.28125zm-0.671875 1.5l1.359375 0l0 8.15625l-1.359375 0l0 -8.15625zm3.4910278 0l1.28125 0l0 1.203125l0.078125 0q0.34375 -0.625 1.046875 -1.046875q0.703125 -0.421875 1.484375 -0.421875q0.90625 0 1.5625 0.4375q0.671875 0.4375 0.953125 1.15625q0.4375 -0.71875 1.140625 -1.15625q0.71875 -0.4375 1.65625 -0.4375q1.40625 0 2.125 0.859375q0.71875 0.859375 0.71875 2.328125l0 5.234375l-1.34375 0l0 -5.03125q0 -1.125 -0.46875 -1.640625q-0.46875 -0.515625 -1.375 -0.515625q-0.609375 0 -1.109375 0.359375q-0.5 0.34375 -0.78125 0.9375q-0.265625 0.59375 -0.265625 1.28125l0 4.609375l-1.359375 0l0 -5.015625q0 -1.140625 -0.46875 -1.65625q-0.46875 -0.515625 -1.359375 -0.515625q-0.609375 0 -1.109375 0.359375q-0.5 0.359375 -0.78125 0.96875q-0.265625 0.59375 -0.265625 1.28125l0 4.578125l-1.359375 0l0 -8.15625zm17.640991 8.40625q-1.171875 0 -2.109375 -0.546875q-0.921875 -0.5625 -1.4375 -1.546875q-0.515625 -0.984375 -0.515625 -2.21875q0 -1.171875 0.484375 -2.171875q0.484375 -1.0 1.390625 -1.59375q0.90625 -0.59375 2.078125 -0.59375q1.203125 0 2.078125 0.546875q0.875 0.53125 1.34375 1.484375q0.484375 0.9375 0.484375 2.15625q0 0.1875 -0.03125 0.40625l-6.46875 0q0.046875 0.9375 0.4375 1.578125q0.40625 0.640625 1.015625 0.96875q0.625 0.3125 1.296875 0.3125q1.59375 0 2.421875 -1.484375l1.140625 0.5625q-0.5 0.984375 -1.421875 1.5625q-0.90625 0.578125 -2.1875 0.578125zm2.34375 -5.1875q-0.03125 -0.515625 -0.28125 -1.03125q-0.25 -0.515625 -0.796875 -0.859375q-0.546875 -0.359375 -1.375 -0.359375q-0.96875 0 -1.640625 0.625q-0.671875 0.609375 -0.875 1.625l4.96875 0z" fill-rule="nonzero"/><path fill="#02589b" d="m375.6601 300.09384l8.637817 0l0 -54.72441l17.275574 0l0 54.72441l8.637787 0l-17.275574 17.275574z" fill-rule="evenodd"/><path fill="#2bb7f6" d="m389.35303 300.09384l8.637787 0l0 -54.72441l17.275604 0l0 54.72441l8.637787 0l-17.275604 17.275574z" fill-rule="evenodd"/><path fill="#02589b" d="m580.9252 300.09384l8.637817 0l0 -54.72441l17.275574 0l0 54.72441l8.637817 0l-17.275574 17.275574z" fill-rule="evenodd"/><path fill="#2bb7f6" d="m594.6181 300.09384l8.637817 0l0 -54.72441l17.275574 0l0 54.72441l8.637817 0l-17.275635 17.275574z" fill-rule="evenodd"/><path fill="#02589b" d="m762.2638 300.109l8.637756 0l0 -51.974l17.275635 0l0 51.974l8.637756 0l-17.275574 17.275604z" fill-rule="evenodd"/><path fill="#2bb7f6" d="m775.95667 300.109l8.637817 0l0 -51.974l17.275574 0l0 51.974l8.637817 0l-17.275574 17.275604z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m155.68706 160.40747l48.24411 0l0 48.24411l-48.24411 0z" fill-rule="evenodd"/><g transform="matrix(0.25127139107611546 0.0 0.0 0.25127139107611546 155.68705643044618 160.40747375328084)"><clipPath id="g6d68e641dc_0_1.6"><path d="m0 0l192.0 0l0 192.0l-192.0 0z" clip-rule="evenodd"/></clipPath><image clip-path="url(#g6d68e641dc_0_1.6)" fill="#000" width="192.0" height="192.0" x="0.0" y="0.0" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAAFLUlEQVR42u3dzWtUZxiG8Wj82LiwHxGkkILQiqZzKoIrW9xqcaEIKq2I0JSs3AmCEgkEXAgiZGUM7oILdSVI40okGhEijMFCUj8ISCAkad0ITaPt1akNpU1NZubMmdznmd7Pf/BeP+bjzHnfM01NHo/H4/F4PB6Px1OHoZmtHOIkPVznHo8YY5wJnjHCEAP00clRdrLOpbIO/yEHuchDfqGS+Y1RrnCczS5Xe/o2uinyO+lmnF720OyOadJv5DSPyWImucB2F60m/g76mSPbGeIAK922kvytTFOfeUoHq1y4PEGhbgSUPqD3ubCWAAZJ3FhLMEcXq11ZSUDpQm6bK2sJZvnWlbUE0Mdad9YSPKDFnbUEo7S681IESd0JXrDFnbUE0ybQvwr8RiQmGGODO2sJ7rPGnbUEva6sJmh3ZS3BLG2urCUY9m2b8gQzdSU448ZagjlflqkJBlxYTbDXhbUEY97SpSb4ujEStYYleMyK+Pl3MEUhLMH++AD9pWXEJbgdPf/G+T2e9Sf4vE4En8QGOP33QqISnIsN8M8N5jEJJgPvqeazBYuJSfBFXIDu/ywmIsH5uADFdywnHsHzqPlbFjnbNR2OYFNMgINL7MGJRXAsJsDFJbdBFQIBXI4J8LDMTrRCmLeg0Yj5m5ktuxmwECI/vAm4hZ2tFe3HLATI/+fEO1PGoQq3xBYC5IfD8QBOVrwruZD7/HAqHkBPFRvDk5znh554ANer2puf5Do/XI0HcK/K4xFJjvPDnXgAj6o+oZLkNj8MxwMYS3FIKMlpfhiJBzCe6pxWksv8Ea+FmUh5VC7JYX54Eg/gWerTiknu8kMxHsBIDQdGk5zlh7vxAIZqWG4FBMuaH27FAxioacEzSxMsc37ojwfQV+OSlyBY9vxwNh5AZ82LXoRAkB864gEczWDZ7yCQ5Ifd8QB2ZrLwBQSi/PBRPIB1qR84vCiBLP9UU8RhNKPlzxPI8kf8Evo22JXMApQIhPmhOybA8QwTzAjzw66YAJtpjHkV9hE2qX6Szt/cbIo69DYEQNzH17CnAfL/yntxAZqZDA9woynycCE8wKXYANsb4E2oKzbBkAm0AAca4ptQXAJW8tQEWoKOBrkijkrAqsx+FzVBSoJ9YAItwaAJtABJ5n9NaIIqCbrABEqA1VWfGDBBxgTbyp4cNkGdCdrBBFqCPhNoAdbywARagpaGuS4OS9DKCxNoCbbU/X9gTFCWwK8CMcHH/GgCLcEG7ptAS7CGSyZQI3znHyjUBG0Mm0B90/KM7xfov5gOmECNsDfFQ25MkClBM9/wgwm0CCvYz20TqBk+5Vwmm9vnuCG72ohN8HZb45ec53nK5b/iJu1/Ha+QbQmITjAPsYljXGaUNxUteopbdLPr30frTJDN/bSEw5yih6vcKV2+jZRQnlDkbil5P2fpYPfiDxUwgR7QBCYwgQlMYAITmMAEJjCBCUxgAhOYwAQmMIEJTGACE5jABCYwgQlMYAITmMAEJjCBCUxgAhOYwAQmMIEJTGACE5jABCYwgQlMYAITmMAEJvjfEnS6vZrgiNtrCX5ivdtrCU64vJZg0N21BC9dXUvw2s21BBMuriW45t5agq9cW0nwvUsrCYq87846giIfuLGOwPmlBM4vJXB+KYHzSwmcX0rg/FIC55cSOL+UwPmlBM4vJXB+KYHzSwmcX0rg/FIC55cSOL+UwPmXiaDT+dUER/h54a123+tdXoL1nGCQl7xmgmveaOLxeDwej8fj8XiqnT8AnPz04cgGlTEAAAAASUVORK5CYII="/></g><path fill="#000000" fill-opacity="0.0" d="m498.46494 160.40675l48.24411 0l0 48.244812l-48.24411 0z" fill-rule="evenodd"/><g transform="matrix(0.25127139107611546 0.0 0.0 0.2512750656167979 498.4649322834646 160.406756167979)"><clipPath id="g6d68e641dc_0_1.7"><path d="m2.2737368E-13 1.1368684E-13l192.0 0l0 192.0l-192.0 0z" clip-rule="evenodd"/></clipPath><image clip-path="url(#g6d68e641dc_0_1.7)" fill="#000" width="192.0" height="192.0" x="0.0" y="0.0" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAAGVElEQVR42u3de5BOdRzH8be1uZWdcklTVFMUqRRdDOlitpVmtDKSHU2NS0wTuhmbLkOktKnJoFKRbkINLcWIUq0uRptGyBQiJXJr07ru7unsZEfYZ/dcfufZ5/fs5/Wd8ec+j+/nec5zzu98zzkgIiIiIiIiIiIiIiIiIiIiIiIiIiJiQhqZtFUb4i+VjoziSw7jsJfOakj8tGQIuRS4jT9aB+iuxkStMVlM49djGn+0irhTLYpKA3JYSUmM1pdVCUPVqmjUYEUlzS+rUWpWNDp6DMBhghuXROBdzxFMp6baZV4zCj1HMJfaaph5Iz0H4PAJp6hhptWNuQtaXi13953EsN4+AnBYzZlqmWl5viLYyHlqmVltKfYVwVYuUdPMmuorAIfdtFfTTGrC3z4j+Id0tc2k4T4DcDhID7XNnFr87DuCIvqqceZk+g6gdK30ATXOnI8DROAwRo0zpbW7UQkSwUStlZoyKVAADm+RquaZ0IBdASPIpY7aZ8LggAE4LKW+2hdeKqsDR7CChmpgeOmBA3BYy1lqYHi5ISL4heZqYFjNORgigj+4VC0MKydEAA576KAWhlOfbaEiKCRDTQynf6gAStdKe6qJYaSQHzKCIjdECeGakAGU1jC1MYyZBiIYqzYG14x9BiJ4UWulwT1hIACHd7RWGlQ9X3NzsetD6qqZwWQZCcDhc9LUzGCWGYogn0ZqZhDtKr2MyWv96P6sSwDTDAXgsJkWcXvXadzCeBa637x8998cuti7K3CG77m52LWdyyJ+t6nuIWTZtc7Hz7Q+RC07I8g2FoDDX26DotGKocyr5MOy1s7F8lqsNxhBIV2Nvrsm9GE6vyX3VGt3gwE4HKKXkaOUm3iOVb53EgrdHQsLLTYaQTEDA7+TFK7iEZaGOG+3gZPtC+DigHNzsSvb93s4n0G8z24Drz3axu/AZMMBOIzz+MoNuI1X2Gh0V8DCKz6Dz83FrpfdDUpstenM03zr8xIqb9XHxu/AkAgaMZOTTnidGrRhGIuMLIfHqjdtDCCVNRG0YsH/1kqb0pcZ7uGaE3mtsvOQLCOSZuTRjEwmsi4OjS+rHbYuTMyPY5OirD22BtAi1Nxc4tRGe1dHn02KABbYG0BaXH4ko65sLDbA+vaX2H3HixS+szyAD2w/S9bJ6vYfoKX9JypnWRxAJLfibME9DI/jrfXOjnShIMp6wWwjGnE7r7HpyB9fHMfhj9EWNr+IEab++3W4kWfcH8OSEyYPoj/fU59uTIjrwoGZWs7VZhpwqvtJ3x/zZfbTL7LFuI6MZFk5EweJXlvdrcR1JltR2ej4FMMDGK0Ywrzj7q5uQ+3lI+6ntfnPYuWj49/Q1MDr/DdxsMXCbf3XjOHacs41GFP56Ph2bggxcdA10MRB1ddPTOZWdyMdOS+j40W+LxKq6f5MPcpnFq547nA3y/05J56HQt5Gx2d5PP1cehwxhz3WNX6/u0MynMur5jocb6Pja7jA83GETctp+YwjvWpvk3OFx210QTlPg4l1HJH4tYlX6ZUoVxu87vnzMvbIAEiKe6CWzZIKjiMS9yTiHHczmWA3A/EzOr6Igcxmp3WNP+juFDzm7hwk6CMksq1rqPf6gee5OdHnOGsbHR1PjPqdN7jD/XZbonvSNH4v87mPi+w7ObLE8sYf5iv3yL5TlAsH0TI/Oh6vWsckMpPhGuLJljX+T2bQL5kuW21o5LKF6GufuzM8jDbJeAOPoQnd+GJW8BSdk/lZZNGMjoevDUyhZ/V4/FVGQjV+F+8xqLo9cSkRRscP8CkjuLLCS4+SVlWOjpfwPePpQj2qtfFV0PotTCOL0xHiOzpeQC6DuVBNP9aAOCwc5DGSDroTXPmiHB1fywS66UENlTE/Or6Nt7lLzwbwztToeCELeVCP7vQv7Oh4Mct5kuttvb9UIgh6y9X1vEQPTlMDw/J7y9WdzOZuzlXjzMnyuHCwhIdpVz0XDqKWV+HCwUpyyNAthaNU/qPKNzOV3jRWe+Jh6jH3iJrLvRVOiYpxTSjgEF/wOO0Tda4s2bWy8d5oIiIiIiIiIiIiIiIiIiIiIiIiVctR+SoFoAAUgAJQAApAASgABaAAFIACUAAKQAEoAAWgABSAAlAACsDGAERERERERERERERERERERERExBb/Arh3RgeJOOlVAAAAAElFTkSuQmCC"/></g><path fill="#02589b" d="m306.5433 227.8819l10.519684 0l0 19.685028l-10.519684 0z" fill-rule="evenodd"/><path stroke="#02589b" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m306.5433 227.8819l10.519684 0l0 19.685028l-10.519684 0z" fill-rule="evenodd"/><path fill="#02589b" d="m165.38583 300.09384l8.637787 0l0 -54.72441l17.275589 0l0 54.72441l8.637802 0l-17.275589 17.275574z" fill-rule="evenodd"/><path fill="#2bb7f6" d="m179.07874 300.09384l8.637802 0l0 -54.72441l17.275589 0l0 54.72441l8.637802 0l-17.275604 17.275574z" fill-rule="evenodd"/><path fill="#02589b" d="m174.66405 243.4252l610.01575 0l0 8.535431l-610.01575 0z" fill-rule="evenodd"/><path stroke="#02589b" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m174.66405 243.4252l610.01575 0l0 8.535431l-610.01575 0z" fill-rule="evenodd"/><path fill="#2bb7f6" d="m652.6221 227.8819l10.519653 0l0 22.015747l-10.519653 0z" fill-rule="evenodd"/><path stroke="#2bb7f6" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m652.6221 227.8819l10.519653 0l0 22.015747l-10.519653 0z" fill-rule="evenodd"/><path fill="#2bb7f6" d="m188.39629 248.6693l611.5275 0l0 8.535416l-611.5275 0z" fill-rule="evenodd"/><path stroke="#2bb7f6" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m188.39629 248.6693l611.5275 0l0 8.535416l-611.5275 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m153.9029 446.72867l485.3543 0l0 35.24411l-485.3543 0z" fill-rule="evenodd"/><path fill="#000000" d="m155.43414 460.2893l4.515625 0q2.09375 0 3.640625 0.84375q1.546875 0.84375 2.375 2.359375q0.84375 1.5 0.84375 3.484375q0 1.96875 -0.84375 3.484375q-0.828125 1.515625 -2.375 2.359375q-1.546875 0.828125 -3.640625 0.828125l-4.515625 0l0 -13.359375zm4.40625 10.96875q2.15625 0 3.296875 -1.140625q1.140625 -1.15625 1.140625 -3.140625q0 -2.0 -1.140625 -3.140625q-1.140625 -1.15625 -3.296875 -1.15625l-1.890625 0l0 8.578125l1.890625 0zm11.940186 2.6875q-1.515625 0 -2.484375 -0.875q-0.96875 -0.890625 -0.96875 -2.328125q0 -0.953125 0.5 -1.671875q0.5 -0.734375 1.375 -1.125q0.890625 -0.390625 1.953125 -0.390625q1.46875 0 2.515625 0.421875l0 -0.40625q0 -0.78125 -0.59375 -1.265625q-0.578125 -0.484375 -1.578125 -0.484375q-0.671875 0 -1.296875 0.3125q-0.625 0.296875 -1.03125 0.796875l-1.5625 -1.234375q0.6875 -0.890625 1.734375 -1.375q1.046875 -0.484375 2.265625 -0.484375q2.1875 0 3.328125 1.015625q1.140625 1.0 1.140625 2.9375l0 5.859375l-2.40625 0l0 -0.96875l-0.15625 0q-0.421875 0.5625 -1.125 0.921875q-0.703125 0.34375 -1.609375 0.34375zm0.578125 -1.90625q1.0625 0 1.6875 -0.671875q0.625 -0.6875 0.625 -1.59375q-0.953125 -0.453125 -2.0 -0.453125q-1.90625 0 -1.90625 1.421875q0 0.578125 0.40625 0.9375q0.421875 0.359375 1.1875 0.359375zm19.169281 1.765625q-0.703125 0 -1.296875 -0.21875q-0.59375 -0.21875 -0.96875 -0.59375q-0.875 -0.84375 -0.875 -2.390625l0 -4.375l-1.671875 0l0 -2.09375l1.671875 0l0 -2.6875l2.4375 0l0 2.6875l2.328125 0l0 2.09375l-2.328125 0l0 3.9375q0 0.71875 0.3125 1.046875q0.265625 0.296875 0.90625 0.296875q0.34375 0 0.578125 -0.09375q0.234375 -0.09375 0.609375 -0.328125l0 2.390625q-0.796875 0.328125 -1.703125 0.328125zm-12.203125 -9.671875l2.296875 0l0 1.265625l0.15625 0q0.375 -0.6875 1.140625 -1.109375q0.765625 -0.421875 1.640625 -0.421875q0.625 0 0.890625 0.125l0 2.375q-0.46875 -0.1875 -1.15625 -0.1875q-1.15625 0 -1.84375 0.75q-0.671875 0.75 -0.671875 2.03125l0 4.6875l-2.453125 0l0 -9.515625zm14.670319 9.515625l0 0zm5.89682 -13.359375l2.921875 0l5.375 8.953125l0.15625 0l-0.15625 -2.578125l0 -6.375l2.5 0l0 13.359375l-2.640625 0l-5.671875 -9.453125l-0.15625 0l0.15625 2.5625l0 6.890625l-2.484375 0l0 -13.359375zm16.159729 13.65625q-1.515625 0 -2.484375 -0.875q-0.96875 -0.890625 -0.96875 -2.328125q0 -0.953125 0.5 -1.671875q0.5 -0.734375 1.375 -1.125q0.890625 -0.390625 1.953125 -0.390625q1.46875 0 2.515625 0.421875l0 -0.40625q0 -0.78125 -0.59375 -1.265625q-0.578125 -0.484375 -1.578125 -0.484375q-0.671875 0 -1.296875 0.3125q-0.625 0.296875 -1.03125 0.796875l-1.5625 -1.234375q0.6875 -0.890625 1.734375 -1.375q1.046875 -0.484375 2.265625 -0.484375q2.1875 0 3.328125 1.015625q1.140625 1.0 1.140625 2.9375l0 5.859375l-2.40625 0l0 -0.96875l-0.15625 0q-0.421875 0.5625 -1.125 0.921875q-0.703125 0.34375 -1.609375 0.34375zm0.578125 -1.90625q1.0625 0 1.6875 -0.671875q0.625 -0.6875 0.625 -1.59375q-0.953125 -0.453125 -2.0 -0.453125q-1.90625 0 -1.90625 1.421875q0 0.578125 0.40625 0.9375q0.421875 0.359375 1.1875 0.359375zm10.92012 1.765625q-0.703125 0 -1.296875 -0.21875q-0.59375 -0.21875 -0.96875 -0.59375q-0.875 -0.84375 -0.875 -2.390625l0 -4.375l-1.671875 0l0 -2.09375l1.671875 0l0 -2.6875l2.4375 0l0 2.6875l2.328125 0l0 2.09375l-2.328125 0l0 3.9375q0 0.71875 0.3125 1.046875q0.265625 0.296875 0.90625 0.296875q0.34375 0 0.578125 -0.09375q0.234375 -0.09375 0.609375 -0.328125l0 2.390625q-0.796875 0.328125 -1.703125 0.328125zm5.1416473 -10.71875q-0.65625 0 -1.125 -0.46875q-0.46875 -0.46875 -0.46875 -1.109375q0 -0.65625 0.46875 -1.109375q0.46875 -0.46875 1.125 -0.46875q0.65625 0 1.109375 0.46875q0.453125 0.453125 0.453125 1.109375q0 0.640625 -0.453125 1.109375q-0.453125 0.46875 -1.109375 0.46875zm-1.234375 1.046875l2.4375 0l0 9.515625l-2.4375 0l0 -9.515625zm3.9117126 0l2.78125 0l2.40625 6.1875l0.15625 0l2.4375 -6.1875l2.75 0l-4.078125 9.515625l-2.421875 0l-4.03125 -9.515625zm16.034561 9.8125q-1.421875 0 -2.5625 -0.640625q-1.140625 -0.65625 -1.78125 -1.796875q-0.640625 -1.15625 -0.640625 -2.59375q0 -1.359375 0.625 -2.53125q0.640625 -1.171875 1.75 -1.859375q1.125 -0.6875 2.515625 -0.6875q1.46875 0 2.53125 0.640625q1.0625 0.625 1.609375 1.734375q0.56248474 1.09375 0.56248474 2.4375q0 0.421875 -0.06248474 0.828125l-7.140625 0q0.1875 1.125 0.90625 1.71875q0.71875 0.59375 1.71875 0.59375q0.84375 0 1.453125 -0.359375q0.609375 -0.375 0.953125 -0.984375l1.984375 0.96875q-1.453125 2.53125 -4.421875 2.53125zm2.25 -6.203125q-0.03125 -0.453125 -0.328125 -0.890625q-0.28125 -0.4375 -0.796875 -0.71875q-0.515625 -0.296875 -1.203125 -0.296875q-0.875 0 -1.5 0.515625q-0.625 0.5 -0.90625 1.390625l4.734375 0z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m153.50919 446.72867l486.14175 0" fill-rule="evenodd"/><path stroke="#02589b" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="butt" d="m153.50919 446.72867l486.14175 0" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m742.3884 443.74442l93.102356 0l0 35.24411l-93.102356 0z" fill-rule="evenodd"/><path fill="#000000" d="m743.9197 457.30505l4.515625 0q2.09375 0 3.640625 0.84375q1.546875 0.84375 2.375 2.359375q0.84375 1.5 0.84375 3.484375q0 1.96875 -0.84375 3.484375q-0.828125 1.515625 -2.375 2.359375q-1.546875 0.828125 -3.640625 0.828125l-4.515625 0l0 -13.359375zm4.40625 10.96875q2.15625 0 3.296875 -1.140625q1.140625 -1.15625 1.140625 -3.140625q0 -2.0 -1.140625 -3.140625q-1.140625 -1.15625 -3.296875 -1.15625l-1.890625 0l0 8.578125l1.890625 0zm11.940186 2.6875q-1.515625 0 -2.484375 -0.875q-0.96875 -0.890625 -0.96875 -2.328125q0 -0.953125 0.5 -1.671875q0.5 -0.734375 1.375 -1.125q0.890625 -0.390625 1.953125 -0.390625q1.46875 0 2.515625 0.421875l0 -0.40625q0 -0.78125 -0.59375 -1.265625q-0.578125 -0.484375 -1.578125 -0.484375q-0.671875 0 -1.296875 0.3125q-0.625 0.296875 -1.03125 0.796875l-1.5625 -1.234375q0.6875 -0.890625 1.734375 -1.375q1.046875 -0.484375 2.265625 -0.484375q2.1875 0 3.328125 1.015625q1.140625 1.0 1.140625 2.9375l0 5.859375l-2.40625 0l0 -0.96875l-0.15625 0q-0.421875 0.5625 -1.125 0.921875q-0.703125 0.34375 -1.609375 0.34375zm0.578125 -1.90625q1.0625 0 1.6875 -0.671875q0.625 -0.6875 0.625 -1.59375q-0.953125 -0.453125 -2.0 -0.453125q-1.90625 0 -1.90625 1.421875q0 0.578125 0.40625 0.9375q0.421875 0.359375 1.1875 0.359375zm19.169312 1.765625q-0.703125 0 -1.296875 -0.21875q-0.59375 -0.21875 -0.96875 -0.59375q-0.875 -0.84375 -0.875 -2.390625l0 -4.375l-1.671875 0l0 -2.09375l1.671875 0l0 -2.6875l2.4375 0l0 2.6875l2.328125 0l0 2.09375l-2.328125 0l0 3.9375q0 0.71875 0.3125 1.046875q0.265625 0.296875 0.90625 0.296875q0.34375 0 0.578125 -0.09375q0.234375 -0.09375 0.609375 -0.328125l0 2.390625q-0.796875 0.328125 -1.703125 0.328125zm-12.203125 -9.671875l2.296875 0l0 1.265625l0.15625 0q0.375 -0.6875 1.140625 -1.109375q0.765625 -0.421875 1.640625 -0.421875q0.625 0 0.890625 0.125l0 2.375q-0.46875 -0.1875 -1.15625 -0.1875q-1.15625 0 -1.84375 0.75q-0.671875 0.75 -0.671875 2.03125l0 4.6875l-2.453125 0l0 -9.515625zm14.670288 9.515625l0 0zm3.9313965 -13.359375l2.796875 0l1.828125 7.5l0.234375 1.40625l0.140625 0l0.296875 -1.40625l2.359375 -7.5l2.484375 0l2.296875 7.5l0.296875 1.359375l0.140625 0l0.21875 -1.359375l1.8125 -7.5l2.796875 0l-3.4375 13.359375l-2.71875 0l-2.265625 -8.0625l-0.296875 -1.4375l-0.15625 0l-0.296875 1.4375l-2.390625 8.0625l-2.59375 0l-3.546875 -13.359375zm22.60022 13.65625q-1.421875 0 -2.5625 -0.640625q-1.140625 -0.65625 -1.78125 -1.796875q-0.640625 -1.15625 -0.640625 -2.59375q0 -1.359375 0.625 -2.53125q0.640625 -1.171875 1.75 -1.859375q1.125 -0.6875 2.515625 -0.6875q1.46875 0 2.53125 0.640625q1.0625 0.625 1.609375 1.734375q0.5625 1.09375 0.5625 2.4375q0 0.421875 -0.0625 0.828125l-7.140625 0q0.1875 1.125 0.90625 1.71875q0.71875 0.59375 1.71875 0.59375q0.84375 0 1.453125 -0.359375q0.609375 -0.375 0.953125 -0.984375l1.984375 0.96875q-1.453125 2.53125 -4.421875 2.53125zm2.25 -6.203125q-0.03125 -0.453125 -0.328125 -0.890625q-0.28125 -0.4375 -0.796875 -0.71875q-0.515625 -0.296875 -1.203125 -0.296875q-0.875 0 -1.5 0.515625q-0.625 0.5 -0.90625 1.390625l4.734375 0zm9.544922 6.203125q-0.984375 0 -1.734375 -0.40625q-0.75 -0.40625 -1.125 -1.03125l-0.15625 0l0 1.140625l-2.296875 0l0 -13.359375l2.453125 0l0 3.65625l-0.15625 1.34375l0.15625 0q0.390625 -0.609375 1.125 -1.03125q0.75 -0.421875 1.734375 -0.421875q1.28125 0 2.328125 0.640625q1.0625 0.640625 1.65625 1.796875q0.59375 1.15625 0.59375 2.625q0 1.46875 -0.59375 2.625q-0.59375 1.140625 -1.65625 1.78125q-1.046875 0.640625 -2.328125 0.640625zm-0.4375 -2.25q0.6875 0 1.28125 -0.359375q0.609375 -0.359375 0.953125 -0.984375q0.359375 -0.640625 0.359375 -1.453125q0 -0.828125 -0.359375 -1.453125q-0.34375 -0.640625 -0.953125 -0.984375q-0.59375 -0.34375 -1.28125 -0.34375q-0.671875 0 -1.265625 0.34375q-0.59375 0.34375 -0.953125 0.984375q-0.359375 0.625 -0.359375 1.453125q0 0.8125 0.359375 1.453125q0.359375 0.625 0.953125 0.984375q0.59375 0.359375 1.265625 0.359375z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m742.38715 443.7454l92.12598 0" fill-rule="evenodd"/><path stroke="#02589b" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="butt" d="m742.38715 443.7454l92.12598 0" fill-rule="evenodd"/></g></svg>
\ No newline at end of file
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index a9314a9..6fc210a 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -6032,6 +6032,14 @@
message: r"""'Object' has no unnamed constructor.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeNonAgnosticConstant = messageNonAgnosticConstant;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageNonAgnosticConstant = const MessageCode(
+ "NonAgnosticConstant",
+ message: r"""Constant value is not strong/weak mode agnostic.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
String character,
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
index 6d630fe..9eb5c38 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
@@ -1214,8 +1214,9 @@
@override
void handleIndexedExpression(
- Token openSquareBracket, Token closeSquareBracket) {
- listener?.handleIndexedExpression(openSquareBracket, closeSquareBracket);
+ Token question, Token openSquareBracket, Token closeSquareBracket) {
+ listener?.handleIndexedExpression(
+ question, openSquareBracket, closeSquareBracket);
}
@override
@@ -1571,3 +1572,13 @@
listener?.reportVarianceModifierNotEnabled(variance);
}
}
+
+class NullListener extends ForwardingListener {
+ bool hasErrors = false;
+
+ @override
+ void handleRecoverableError(
+ Message message, Token startToken, Token endToken) {
+ hasErrors = true;
+ }
+}
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
index 8708450..8b90baa 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
@@ -1349,7 +1349,7 @@
}
void handleIndexedExpression(
- Token openSquareBracket, Token closeSquareBracket) {
+ Token question, Token openSquareBracket, Token closeSquareBracket) {
logEvent("IndexedExpression");
}
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
index 486131a..6711c82 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
@@ -65,7 +65,7 @@
isMandatoryFormalParameterKind,
isOptionalPositionalFormalParameterKind;
-import 'forwarding_listener.dart' show ForwardingListener;
+import 'forwarding_listener.dart' show ForwardingListener, NullListener;
import 'identifier_context.dart'
show IdentifierContext, looksLikeExpressionStart;
@@ -91,7 +91,11 @@
ImportRecoveryListener,
MixinHeaderRecoveryListener;
-import 'token_stream_rewriter.dart' show TokenStreamRewriter;
+import 'token_stream_rewriter.dart'
+ show
+ TokenStreamRewriter,
+ TokenStreamRewriterImpl,
+ UndoableTokenStreamRewriter;
import 'type_info.dart'
show
@@ -289,7 +293,7 @@
TokenStreamRewriter cachedRewriter;
TokenStreamRewriter get rewriter {
- cachedRewriter ??= new TokenStreamRewriter();
+ cachedRewriter ??= new TokenStreamRewriterImpl();
return cachedRewriter;
}
@@ -4199,6 +4203,50 @@
: parsePrecedenceExpression(token, ASSIGNMENT_PRECEDENCE, false);
}
+ bool canParseAsConditional(Token question) {
+ // We want to check if we can parse, not send events and permanently change
+ // the token stream. Set it up so we can do that.
+ Listener originalListener = listener;
+ TokenStreamRewriter originalRewriter = cachedRewriter;
+ NullListener nullListener = listener = new NullListener();
+ UndoableTokenStreamRewriter undoableTokenStreamRewriter =
+ new UndoableTokenStreamRewriter();
+ cachedRewriter = undoableTokenStreamRewriter;
+
+ bool isConditional = false;
+
+ Token afterExpression1 = parseExpressionWithoutCascade(question);
+ if (!nullListener.hasErrors && optional(':', afterExpression1.next)) {
+ parseExpressionWithoutCascade(afterExpression1.next);
+ if (!nullListener.hasErrors) {
+ // Now we know it's a conditional expression.
+ isConditional = true;
+ }
+ }
+
+ // Undo all changes and reset.
+ undoableTokenStreamRewriter.undo();
+ listener = originalListener;
+ cachedRewriter = originalRewriter;
+
+ return isConditional;
+ }
+
+ Token parseNullAwareBracketOrConditionalExpressionRest(
+ Token token, TypeParamOrArgInfo typeArg) {
+ Token question = token.next;
+ assert(optional('?', question));
+ Token bracket = question.next;
+ assert(optional('[', bracket));
+
+ bool isConditional = canParseAsConditional(question);
+ if (isConditional) {
+ return parseConditionalExpressionRest(token);
+ }
+ // It wasn't a conditional expression. Must be a null aware bracket then.
+ return parseArgumentOrIndexStar(token, typeArg, true);
+ }
+
Token parseConditionalExpressionRest(Token token) {
Token question = token = token.next;
assert(optional('?', question));
@@ -4270,7 +4318,7 @@
} else if (identical(type, TokenType.OPEN_PAREN) ||
identical(type, TokenType.OPEN_SQUARE_BRACKET) ||
identical(type, TokenType.QUESTION_PERIOD_OPEN_SQUARE_BRACKET)) {
- token = parseArgumentOrIndexStar(token, typeArg);
+ token = parseArgumentOrIndexStar(token, typeArg, false);
} else if (identical(type, TokenType.INDEX)) {
BeginToken replacement = link(
new BeginToken(TokenType.OPEN_SQUARE_BRACKET, next.charOffset,
@@ -4278,7 +4326,7 @@
new Token(TokenType.CLOSE_SQUARE_BRACKET, next.charOffset + 1));
rewriter.replaceTokenFollowing(token, replacement);
replacement.endToken = replacement.next;
- token = parseArgumentOrIndexStar(token, noTypeParamOrArg);
+ token = parseArgumentOrIndexStar(token, noTypeParamOrArg, false);
} else if (identical(type, TokenType.BANG)) {
listener.handleNonNullAssertExpression(token.next);
token = next;
@@ -4293,7 +4341,12 @@
} else if (identical(type, TokenType.AS)) {
token = parseAsOperatorRest(token);
} else if (identical(type, TokenType.QUESTION)) {
- token = parseConditionalExpressionRest(token);
+ if (optional('[', next.next)) {
+ token = parseNullAwareBracketOrConditionalExpressionRest(
+ token, typeArg);
+ } else {
+ token = parseConditionalExpressionRest(token);
+ }
} else {
if (level == EQUALITY_PRECEDENCE || level == RELATIONAL_PRECEDENCE) {
// We don't allow (a == b == c) or (a < b < c).
@@ -4344,7 +4397,7 @@
assert(optional('..', cascadeOperator) || optional('?..', cascadeOperator));
listener.beginCascade(cascadeOperator);
if (optional('[', token.next)) {
- token = parseArgumentOrIndexStar(token, noTypeParamOrArg);
+ token = parseArgumentOrIndexStar(token, noTypeParamOrArg, false);
} else {
token = parseSend(token, IdentifierContext.expressionContinuation);
listener.endBinaryExpression(cascadeOperator);
@@ -4370,7 +4423,7 @@
next = token.next;
assert(optional('(', next));
}
- token = parseArgumentOrIndexStar(token, typeArg);
+ token = parseArgumentOrIndexStar(token, typeArg, false);
next = token.next;
} while (!identical(mark, token));
@@ -4444,13 +4497,31 @@
return parsePrimary(token, IdentifierContext.expression);
}
- Token parseArgumentOrIndexStar(Token token, TypeParamOrArgInfo typeArg) {
+ Token parseArgumentOrIndexStar(
+ Token token, TypeParamOrArgInfo typeArg, bool checkedNullAware) {
Token next = token.next;
- Token beginToken = next;
+ final Token beginToken = next;
while (true) {
- if (optional('[', next) || optional('?.[', next)) {
+ bool potentialNullAware =
+ (optional('?', next) && optional('[', next.next));
+ if (potentialNullAware && !checkedNullAware) {
+ // While it's a potential null aware index it hasn't been checked.
+ // It might be a conditional expression.
+ assert(optional('?', next));
+ bool isConditional = canParseAsConditional(next);
+ if (isConditional) potentialNullAware = false;
+ }
+
+ if (optional('[', next) || optional('?.[', next) || potentialNullAware) {
assert(typeArg == noTypeParamOrArg);
Token openSquareBracket = next;
+ Token question;
+ if (optional('?', next)) {
+ question = next;
+ next = next.next;
+ openSquareBracket = next;
+ assert(optional('[', openSquareBracket));
+ }
bool old = mayParseFunctionExpressions;
mayParseFunctionExpressions = true;
token = parseExpression(next);
@@ -4470,7 +4541,7 @@
next = endGroup;
}
}
- listener.handleIndexedExpression(openSquareBracket, next);
+ listener.handleIndexedExpression(question, openSquareBracket, next);
token = next;
typeArg = computeMethodTypeArguments(token);
if (typeArg != noTypeParamOrArg) {
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/token_stream_rewriter.dart b/pkg/_fe_analyzer_shared/lib/src/parser/token_stream_rewriter.dart
index 1641885..d2b8ed3 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/token_stream_rewriter.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/token_stream_rewriter.dart
@@ -7,6 +7,7 @@
import '../scanner/token.dart'
show
BeginToken,
+ CommentToken,
Keyword,
SimpleToken,
SyntheticBeginToken,
@@ -16,10 +17,111 @@
Token,
TokenType;
+abstract class TokenStreamRewriter with _TokenStreamMixin {
+ /// Insert a synthetic open and close parenthesis and return the new synthetic
+ /// open parenthesis. If [insertIdentifier] is true, then a synthetic
+ /// identifier is included between the open and close parenthesis.
+ Token insertParens(Token token, bool includeIdentifier) {
+ Token next = token.next;
+ int offset = next.charOffset;
+ BeginToken leftParen =
+ next = new SyntheticBeginToken(TokenType.OPEN_PAREN, offset);
+ if (includeIdentifier) {
+ next = _setNext(
+ next, new SyntheticStringToken(TokenType.IDENTIFIER, '', offset, 0));
+ }
+ next = _setNext(next, new SyntheticToken(TokenType.CLOSE_PAREN, offset));
+ _setEndGroup(leftParen, next);
+ _setNext(next, token.next);
+
+ // A no-op rewriter could skip this step.
+ _setNext(token, leftParen);
+
+ return leftParen;
+ }
+
+ /// Insert [newToken] after [token] and return [newToken].
+ Token insertToken(Token token, Token newToken) {
+ _setNext(newToken, token.next);
+
+ // A no-op rewriter could skip this step.
+ _setNext(token, newToken);
+
+ return newToken;
+ }
+
+ /// Move [endGroup] (a synthetic `)`, `]`, or `}` token) and associated
+ /// error token after [token] in the token stream and return [endGroup].
+ Token moveSynthetic(Token token, Token endGroup) {
+ assert(endGroup.beforeSynthetic != null);
+ if (token == endGroup) return endGroup;
+ Token errorToken;
+ if (endGroup.next is UnmatchedToken) {
+ errorToken = endGroup.next;
+ }
+
+ // Remove endGroup from its current location
+ _setNext(endGroup.beforeSynthetic, (errorToken ?? endGroup).next);
+
+ // Insert endGroup into its new location
+ Token next = token.next;
+ _setNext(token, endGroup);
+ _setNext(errorToken ?? endGroup, next);
+ _setOffset(endGroup, next.offset);
+ if (errorToken != null) {
+ _setOffset(errorToken, next.offset);
+ }
+
+ return endGroup;
+ }
+
+ /// Replace the single token immediately following the [previousToken] with
+ /// the chain of tokens starting at the [replacementToken]. Return the
+ /// [replacementToken].
+ Token replaceTokenFollowing(Token previousToken, Token replacementToken) {
+ Token replacedToken = previousToken.next;
+ _setNext(previousToken, replacementToken);
+
+ _setPrecedingComments(
+ replacementToken as SimpleToken, replacedToken.precedingComments);
+
+ _setNext(_lastTokenInChain(replacementToken), replacedToken.next);
+
+ return replacementToken;
+ }
+
+ /// Given the [firstToken] in a chain of tokens to be inserted, return the
+ /// last token in the chain.
+ ///
+ /// As a side-effect, this method also ensures that the tokens in the chain
+ /// have their `previous` pointers set correctly.
+ Token _lastTokenInChain(Token firstToken) {
+ Token previous;
+ Token current = firstToken;
+ while (current.next != null && current.next.type != TokenType.EOF) {
+ if (previous != null) {
+ _setPrevious(current, previous);
+ }
+ previous = current;
+ current = current.next;
+ }
+ if (previous != null) {
+ _setPrevious(current, previous);
+ }
+ return current;
+ }
+
+ Token _setNext(Token setOn, Token nextToken);
+ void _setEndGroup(BeginToken setOn, Token endGroup);
+ void _setOffset(Token setOn, int offset);
+ void _setPrecedingComments(SimpleToken setOn, CommentToken comment);
+ void _setPrevious(Token setOn, Token previous);
+}
+
/// Provides the capability of inserting tokens into a token stream. This
/// implementation does this by rewriting the previous token to point to the
/// inserted token.
-class TokenStreamRewriter with _TokenStreamMixin {
+class TokenStreamRewriterImpl extends TokenStreamRewriter {
// TODO(brianwilkerson):
//
// When we get to the point of removing `token.previous`, the plan is to
@@ -39,97 +141,24 @@
// }
//
- /// Insert a synthetic open and close parenthesis and return the new synthetic
- /// open parenthesis. If [insertIdentifier] is true, then a synthetic
- /// identifier is included between the open and close parenthesis.
- Token insertParens(Token token, bool includeIdentifier) {
- Token next = token.next;
- int offset = next.charOffset;
- BeginToken leftParen =
- next = new SyntheticBeginToken(TokenType.OPEN_PAREN, offset);
- if (includeIdentifier) {
- next = next.setNext(
- new SyntheticStringToken(TokenType.IDENTIFIER, '', offset, 0));
- }
- 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;
+ Token _setNext(Token setOn, Token nextToken) {
+ return setOn.setNext(nextToken);
}
- /// Insert [newToken] after [token] and return [newToken].
- Token insertToken(Token token, Token newToken) {
- newToken.setNext(token.next);
-
- // A no-op rewriter could skip this step.
- token.setNext(newToken);
-
- return newToken;
+ void _setEndGroup(BeginToken setOn, Token endGroup) {
+ setOn.endGroup = endGroup;
}
- /// Move [endGroup] (a synthetic `)`, `]`, or `}` token) and associated
- /// error token after [token] in the token stream and return [endGroup].
- Token moveSynthetic(Token token, Token endGroup) {
- assert(endGroup.beforeSynthetic != null);
- if (token == endGroup) return endGroup;
- Token errorToken;
- if (endGroup.next is UnmatchedToken) {
- errorToken = endGroup.next;
- }
-
- // Remove endGroup from its current location
- endGroup.beforeSynthetic.setNext((errorToken ?? endGroup).next);
-
- // Insert endGroup into its new location
- Token next = token.next;
- token.setNext(endGroup);
- (errorToken ?? endGroup).setNext(next);
- endGroup.offset = next.offset;
- if (errorToken != null) {
- errorToken.offset = next.offset;
- }
-
- return endGroup;
+ void _setOffset(Token setOn, int offset) {
+ setOn.offset = offset;
}
- /// Replace the single token immediately following the [previousToken] with
- /// the chain of tokens starting at the [replacementToken]. Return the
- /// [replacementToken].
- Token replaceTokenFollowing(Token previousToken, Token replacementToken) {
- Token replacedToken = previousToken.next;
- previousToken.setNext(replacementToken);
-
- (replacementToken as SimpleToken).precedingComments =
- replacedToken.precedingComments;
-
- _lastTokenInChain(replacementToken).setNext(replacedToken.next);
-
- return replacementToken;
+ void _setPrecedingComments(SimpleToken setOn, CommentToken comment) {
+ setOn.precedingComments = comment;
}
- /// Given the [firstToken] in a chain of tokens to be inserted, return the
- /// last token in the chain.
- ///
- /// As a side-effect, this method also ensures that the tokens in the chain
- /// have their `previous` pointers set correctly.
- Token _lastTokenInChain(Token firstToken) {
- Token previous;
- Token current = firstToken;
- while (current.next != null && current.next.type != TokenType.EOF) {
- if (previous != null) {
- current.previous = previous;
- }
- previous = current;
- current = current.next;
- }
- if (previous != null) {
- current.previous = previous;
- }
- return current;
+ void _setPrevious(Token setOn, Token previous) {
+ setOn.previous = previous;
}
}
@@ -192,6 +221,31 @@
}
return current;
}
+
+ @override
+ void _setEndGroup(BeginToken setOn, Token endGroup) {
+ throw UnimplementedError("_setEndGroup");
+ }
+
+ @override
+ Token _setNext(Token setOn, Token nextToken) {
+ throw UnimplementedError("_setNext");
+ }
+
+ @override
+ void _setOffset(Token setOn, int offset) {
+ throw UnimplementedError("_setOffset");
+ }
+
+ @override
+ void _setPrecedingComments(SimpleToken setOn, CommentToken comment) {
+ throw UnimplementedError("_setPrecedingComments");
+ }
+
+ @override
+ void _setPrevious(Token setOn, Token previous) {
+ throw UnimplementedError("_setPrevious");
+ }
}
mixin _TokenStreamMixin {
@@ -218,3 +272,165 @@
/// Insert [newToken] after [token] and return [newToken].
Token insertToken(Token token, Token newToken);
}
+
+abstract class TokenStreamChange {
+ void undo();
+}
+
+class NextTokenStreamChange implements TokenStreamChange {
+ Token setOn;
+ Token setOnNext;
+ Token nextToken;
+ Token nextTokenPrevious;
+ Token nextTokenBeforeSynthetic;
+
+ NextTokenStreamChange(UndoableTokenStreamRewriter rewriter) {
+ rewriter._changes.add(this);
+ }
+
+ Token setNext(Token setOn, Token nextToken) {
+ this.setOn = setOn;
+ this.setOnNext = setOn.next;
+ this.nextToken = nextToken;
+ this.nextTokenPrevious = nextToken.previous;
+ this.nextTokenBeforeSynthetic = nextToken.beforeSynthetic;
+
+ setOn.next = nextToken;
+ nextToken.previous = setOn;
+ nextToken.beforeSynthetic = setOn;
+
+ return nextToken;
+ }
+
+ @override
+ void undo() {
+ nextToken.beforeSynthetic = nextTokenBeforeSynthetic;
+ nextToken.previous = nextTokenPrevious;
+ setOn.next = setOnNext;
+ }
+}
+
+class EndGroupTokenStreamChange implements TokenStreamChange {
+ BeginToken setOn;
+ Token endGroup;
+
+ EndGroupTokenStreamChange(UndoableTokenStreamRewriter rewriter) {
+ rewriter._changes.add(this);
+ }
+
+ void setEndGroup(BeginToken setOn, Token endGroup) {
+ this.setOn = setOn;
+ this.endGroup = setOn.endGroup;
+
+ setOn.endGroup = endGroup;
+ }
+
+ @override
+ void undo() {
+ setOn.endGroup = endGroup;
+ }
+}
+
+class OffsetTokenStreamChange implements TokenStreamChange {
+ Token setOn;
+ int offset;
+
+ OffsetTokenStreamChange(UndoableTokenStreamRewriter rewriter) {
+ rewriter._changes.add(this);
+ }
+
+ void setOffset(Token setOn, int offset) {
+ this.setOn = setOn;
+ this.offset = setOn.offset;
+
+ setOn.offset = offset;
+ }
+
+ @override
+ void undo() {
+ setOn.offset = offset;
+ }
+}
+
+class PrecedingCommentsTokenStreamChange implements TokenStreamChange {
+ SimpleToken setOn;
+ CommentToken comment;
+
+ PrecedingCommentsTokenStreamChange(UndoableTokenStreamRewriter rewriter) {
+ rewriter._changes.add(this);
+ }
+
+ void setPrecedingComments(SimpleToken setOn, CommentToken comment) {
+ this.setOn = setOn;
+ this.comment = setOn.precedingComments;
+
+ setOn.precedingComments = comment;
+ }
+
+ @override
+ void undo() {
+ setOn.precedingComments = comment;
+ }
+}
+
+class PreviousTokenStreamChange implements TokenStreamChange {
+ Token setOn;
+ Token previous;
+
+ PreviousTokenStreamChange(UndoableTokenStreamRewriter rewriter) {
+ rewriter._changes.add(this);
+ }
+
+ void setPrevious(Token setOn, Token previous) {
+ this.setOn = setOn;
+ this.previous = setOn.previous;
+
+ setOn.previous = previous;
+ }
+
+ @override
+ void undo() {
+ setOn.previous = previous;
+ }
+}
+
+/// Provides the capability of inserting tokens into a token stream. This
+/// implementation does this by rewriting the previous token to point to the
+/// inserted token. It also allows to undo these changes.
+class UndoableTokenStreamRewriter extends TokenStreamRewriter {
+ List<TokenStreamChange> _changes = new List<TokenStreamChange>();
+
+ void undo() {
+ for (int i = _changes.length - 1; i >= 0; i--) {
+ TokenStreamChange change = _changes[i];
+ change.undo();
+ }
+ _changes.clear();
+ }
+
+ @override
+ void _setEndGroup(BeginToken setOn, Token endGroup) {
+ new EndGroupTokenStreamChange(this).setEndGroup(setOn, endGroup);
+ }
+
+ @override
+ Token _setNext(Token setOn, Token nextToken) {
+ return new NextTokenStreamChange(this).setNext(setOn, nextToken);
+ }
+
+ @override
+ void _setOffset(Token setOn, int offset) {
+ new OffsetTokenStreamChange(this).setOffset(setOn, offset);
+ }
+
+ @override
+ void _setPrecedingComments(SimpleToken setOn, CommentToken comment) {
+ new PrecedingCommentsTokenStreamChange(this)
+ .setPrecedingComments(setOn, comment);
+ }
+
+ @override
+ void _setPrevious(Token setOn, Token previous) {
+ new PreviousTokenStreamChange(this).setPrevious(setOn, previous);
+ }
+}
diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart
index bf06c11..9a2abc6 100644
--- a/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart
@@ -909,7 +909,7 @@
* the first preceding comment token will have a lexeme of `/* one */` and
* the next comment token will have a lexeme of `/* two */`.
*/
- Token get precedingComments;
+ CommentToken get precedingComments;
/**
* Return the previous token in the token stream.
diff --git a/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart b/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart
index 4db476a..9fb0855 100644
--- a/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart
@@ -628,20 +628,95 @@
Map<String, List<String>> skipMap,
Uri nullUri});
+class MarkerOptions {
+ final Map<String, Uri> markers;
+
+ MarkerOptions.internal(this.markers);
+
+ factory MarkerOptions.fromDataDir(Directory dataDir,
+ {bool shouldFindScript: true}) {
+ File file = new File.fromUri(dataDir.uri.resolve('marker.options'));
+ File script = new File.fromUri(Platform.script);
+ if (!file.existsSync()) {
+ throw new ArgumentError("Marker option file '$file' doesn't exist.");
+ }
+
+ Map<String, Uri> markers = {};
+ String text = file.readAsStringSync();
+ bool isScriptFound = false;
+ for (String line in text.split('\n')) {
+ line = line.trim();
+ if (line.isEmpty || line.startsWith('#')) continue;
+ int eqPos = line.indexOf('=');
+ if (eqPos == -1) {
+ throw new ArgumentError(
+ "Unsupported marker option '$line' in ${file.uri}");
+ }
+ String marker = line.substring(0, eqPos);
+ String tester = line.substring(eqPos + 1);
+ File testerFile = new File(tester);
+ if (!testerFile.existsSync()) {
+ throw new ArgumentError(
+ "Tester '$tester' does not exist for marker '$marker' in "
+ "${file.uri}");
+ }
+ if (markers.containsKey(marker)) {
+ throw new ArgumentError("Duplicate marker '$marker' in ${file.uri}");
+ }
+ markers[marker] = testerFile.uri;
+ if (testerFile.absolute.uri == script.absolute.uri) {
+ isScriptFound = true;
+ }
+ }
+ if (shouldFindScript && !isScriptFound) {
+ throw new ArgumentError(
+ "Script '${script.uri}' not found in ${file.uri}");
+ }
+ return new MarkerOptions.internal(markers);
+ }
+
+ Iterable<String> get supportedMarkers => markers.keys;
+
+ Future<void> runAll(List<String> args) async {
+ Set<Uri> testers = markers.values.toSet();
+ bool allOk = true;
+ for (Uri tester in testers) {
+ print('================================================================');
+ print('Running tester: $tester ${args.join(' ')}');
+ print('================================================================');
+ Process process = await Process.start(
+ Platform.resolvedExecutable, [tester.toString(), ...args],
+ mode: ProcessStartMode.inheritStdio);
+ if (await process.exitCode != 0) {
+ allOk = false;
+ }
+ }
+ if (!allOk) {
+ throw "Error(s) occurred.";
+ }
+ }
+}
+
/// Check code for all tests in [dataDir] using [runTest].
Future<void> runTests<T>(Directory dataDir,
{List<String> args: const <String>[],
int shards: 1,
int shardIndex: 0,
void onTest(Uri uri),
- Iterable<String> supportedMarkers,
Uri createUriForFileName(String fileName),
void onFailure(String message),
RunTestFunction<T> runTest,
List<String> skipList,
Map<String, List<String>> skipMap}) async {
+ MarkerOptions markerOptions =
+ new MarkerOptions.fromDataDir(dataDir, shouldFindScript: shards == 1);
// TODO(johnniwinther): Support --show to show actual data for an input.
args = args.toList();
+ bool runAll = args.remove('--run-all');
+ if (runAll) {
+ await markerOptions.runAll(args);
+ return;
+ }
bool verbose = args.remove('-v');
bool succinct = args.remove('-s');
bool shouldContinue = args.remove('-c');
@@ -653,8 +728,11 @@
String relativeDir = dataDir.uri.path.replaceAll(Uri.base.path, '');
print('Data dir: ${relativeDir}');
- List<FileSystemEntity> entities =
- dataDir.listSync().where((entity) => !entity.path.endsWith('~')).toList();
+ List<FileSystemEntity> entities = dataDir
+ .listSync()
+ .where((entity) =>
+ !entity.path.endsWith('~') && !entity.path.endsWith('marker.options'))
+ .toList();
if (shards > 1) {
int start = entities.length * shardIndex ~/ shards;
int end = entities.length * (shardIndex + 1) ~/ shards;
@@ -688,7 +766,7 @@
}
TestData testData = computeTestData(entity,
- supportedMarkers: supportedMarkers,
+ supportedMarkers: markerOptions.supportedMarkers,
createTestUri: createTestUri,
onFailure: onFailure);
print('Test: ${testData.testFileUri}');
diff --git a/pkg/_fe_analyzer_shared/test/annotated_code_helper_test.dart b/pkg/_fe_analyzer_shared/test/annotated_code_helper_test.dart
index deafff8..e293175 100644
--- a/pkg/_fe_analyzer_shared/test/annotated_code_helper_test.dart
+++ b/pkg/_fe_analyzer_shared/test/annotated_code_helper_test.dart
@@ -9,18 +9,14 @@
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
main() {
- testDir('pkg/_fe_analyzer_shared/test/constants/data', sharedMarkers);
- testDir('pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables/data',
- cfeAnalyzerMarkers);
- testDir('pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment/data',
- cfeAnalyzerMarkers);
- testDir('pkg/_fe_analyzer_shared/test/flow_analysis/nullability/data',
- cfeAnalyzerMarkers);
- testDir('pkg/_fe_analyzer_shared/test/flow_analysis/reachability/data',
- cfeAnalyzerMarkers);
- testDir('pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data',
- cfeAnalyzerMarkers);
- testDir('pkg/_fe_analyzer_shared/test/inheritance/data', cfeAnalyzerMarkers);
+ testDir('pkg/_fe_analyzer_shared/test/constants/data');
+ testDir('pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables/data');
+ testDir(
+ 'pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment/data');
+ testDir('pkg/_fe_analyzer_shared/test/flow_analysis/nullability/data');
+ testDir('pkg/_fe_analyzer_shared/test/flow_analysis/reachability/data');
+ testDir('pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data');
+ testDir('pkg/_fe_analyzer_shared/test/inheritance/data');
}
void expectStringEquals(String value1, String value2) {
@@ -29,8 +25,10 @@
}
}
-void testDir(String dataDirPath, List<String> supportedMarkers) {
+void testDir(String dataDirPath) {
Directory dataDir = Directory(dataDirPath);
+ MarkerOptions markerOptions =
+ MarkerOptions.fromDataDir(dataDir, shouldFindScript: false);
String relativeDir = dataDir.uri.path.replaceAll(Uri.base.path, '');
print('Data dir: ${relativeDir}');
List<FileSystemEntity> entities =
@@ -39,7 +37,7 @@
print('----------------------------------------------------------------');
TestData testData = computeTestData(entity,
- supportedMarkers: supportedMarkers,
+ supportedMarkers: markerOptions.supportedMarkers,
createTestUri: (Uri uri, String name) => Uri.parse('memory:$name'),
onFailure: (String message) => throw message);
print('Test: ${testData.testFileUri}');
diff --git a/pkg/_fe_analyzer_shared/test/constants/data/marker.options b/pkg/_fe_analyzer_shared/test/constants/data/marker.options
new file mode 100644
index 0000000..f713e63
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/constants/data/marker.options
@@ -0,0 +1,3 @@
+cfe=pkg/front_end/test/id_tests/constant_test.dart
+analyzer=pkg/analyzer/test/id_tests/constant_test.dart
+dart2js=tests/compiler/dart2js/model/cfe_constant_test.dart
\ No newline at end of file
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables/data/marker.options b/pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables/data/marker.options
new file mode 100644
index 0000000..fed5739
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables/data/marker.options
@@ -0,0 +1,2 @@
+cfe=pkg/front_end/test/id_tests/assigned_variables_test.dart
+analyzer=pkg/analyzer/test/id_tests/assigned_variables_test.dart
\ No newline at end of file
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment/data/marker.options b/pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment/data/marker.options
new file mode 100644
index 0000000..22cc06d
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment/data/marker.options
@@ -0,0 +1,2 @@
+cfe=pkg/front_end/test/id_tests/definite_assignment_test.dart
+analyzer=pkg/analyzer/test/id_tests/definite_assignment_test.dart
\ No newline at end of file
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/nullability/data/marker.options b/pkg/_fe_analyzer_shared/test/flow_analysis/nullability/data/marker.options
new file mode 100644
index 0000000..c6ca880
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/nullability/data/marker.options
@@ -0,0 +1,2 @@
+cfe=pkg/front_end/test/id_tests/nullability_test.dart
+analyzer=pkg/analyzer/test/id_tests/nullability_test.dart
\ No newline at end of file
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/reachability/data/marker.options b/pkg/_fe_analyzer_shared/test/flow_analysis/reachability/data/marker.options
new file mode 100644
index 0000000..f56ffa9
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/reachability/data/marker.options
@@ -0,0 +1,2 @@
+cfe=pkg/front_end/test/id_tests/reachability_test.dart
+analyzer=pkg/analyzer/test/id_tests/reachability_test.dart
\ No newline at end of file
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data/marker.options b/pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data/marker.options
new file mode 100644
index 0000000..7aaeae9
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data/marker.options
@@ -0,0 +1,2 @@
+cfe=pkg/front_end/test/id_tests/type_promotion_test.dart
+analyzer=pkg/analyzer/test/id_tests/type_promotion_test.dart
\ No newline at end of file
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_in/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_in/main.dart
index 421d174..61e7e36 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_in/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_in/main.dart
@@ -31,7 +31,7 @@
class LegacyClass3b<T> extends Class3<T> implements GenericInterface<T> {}
/*cfe.class: LegacyClass4a:Class4a,GenericInterface<num*>,LegacyClass4a,Object*/
-/*cfe:builder.class: LegacyClass4a:Class4a,GenericInterface<num!>,LegacyClass4a,Object*/
+/*cfe:builder|analyzer.class: LegacyClass4a:Class4a,GenericInterface<num>,LegacyClass4a,Object*/
class LegacyClass4a extends Class4a {}
/*class: LegacyClass4b:GenericInterface<num*>,LegacyClass4b,Object*/
@@ -40,12 +40,15 @@
/*class: LegacyClass4c:Class4a,GenericInterface<num*>,LegacyClass4c,Object*/
class LegacyClass4c extends Class4a implements GenericInterface<num> {}
-/*class: LegacyClass4d:Class4a,Class4b,GenericInterface<num*>,LegacyClass4d,Object*/
+/*cfe|cfe:builder.class: LegacyClass4d:Class4a,Class4b,GenericInterface<num*>,LegacyClass4d,Object*/
+/*analyzer.class: LegacyClass4d:Class4a,Class4b,GenericInterface<num>,LegacyClass4d,Object*/
class LegacyClass4d implements Class4a, Class4b {}
-/*class: LegacyClass5:Class5,GenericInterface<dynamic>,LegacyClass5,Object*/
+/*cfe|cfe:builder.class: LegacyClass5:Class5,GenericInterface<dynamic>,LegacyClass5,Object*/
+/*analyzer.class: LegacyClass5:Class5,GenericInterface<Object*>,LegacyClass5,Object*/
+/*analyzer.error: CompileTimeErrorCode.CONFLICTING_GENERIC_INTERFACES*/
class
-/*error: AmbiguousSupertypes*/
+/*cfe|cfe:builder.error: AmbiguousSupertypes*/
LegacyClass5 extends Class5 implements GenericInterface<Object> {}
/*class: LegacyClass6a:
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_in/opt_in.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_in/opt_in.dart
index 5c5a42c..5cfbafc 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_in/opt_in.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_in/opt_in.dart
@@ -19,7 +19,7 @@
/*class: Class3:Class3<T>,GenericInterface<T>,Object*/
class Class3<T> implements GenericInterface<T> {}
-/*class: Class4a:Class4a,GenericInterface<num!>,Object*/
+/*class: Class4a:Class4a,GenericInterface<num>,Object*/
class Class4a implements GenericInterface<num> {}
/*class: Class4b:Class4b,GenericInterface<num?>,Object*/
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_out/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_out/main.dart
index b2a6b48..f65a1e6 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_out/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_out/main.dart
@@ -21,11 +21,11 @@
/*class: Class4a:Class4a,GenericInterface<num*>,LegacyClass4,Object*/
class Class4a extends LegacyClass4 {}
-/*class: Class4b:Class4b,GenericInterface<num!>,Object*/
+/*class: Class4b:Class4b,GenericInterface<num>,Object*/
class Class4b implements GenericInterface<num> {}
/*class: Class4c:Class4c,GenericInterface<num?>,Object*/
class Class4c implements GenericInterface<num?> {}
-/*class: Class4d:Class4d,GenericInterface<num!>,LegacyClass4,Object*/
+/*class: Class4d:Class4d,GenericInterface<num>,LegacyClass4,Object*/
class Class4d extends LegacyClass4 implements GenericInterface<num> {}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_out/opt_out.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_out/opt_out.dart
index 11c7b60..93b337e 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_out/opt_out.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/from_opt_out/opt_out.dart
@@ -36,19 +36,7 @@
*/
class LegacyClass5<T> extends LegacyClass3<T> implements GenericInterface<T> {}
-/*class: _LegacyClass6&Object&LegacyClass3:
- GenericInterface<T*>,
- LegacyClass3<T*>,
- Object,
- _LegacyClass6&Object&LegacyClass3<T*>
-*/
-/*class: LegacyClass6:
- GenericInterface<T*>,
- LegacyClass3<T*>,
- LegacyClass6<T*>,
- Object,
- _LegacyClass6&Object&LegacyClass3<T*>
-*/
+/*class: LegacyClass6:GenericInterface<T*>,LegacyClass3<T*>,LegacyClass6<T*>,Object*/
class LegacyClass6<T> extends Object
with LegacyClass3<T>
implements GenericInterface<T> {}
@@ -63,20 +51,7 @@
class LegacyClass7<T> extends LegacyClass3<T>
implements GenericSubInterface<T> {}
-/*class: _LegacyClass8&Object&LegacyClass3:
- GenericInterface<T*>,
- LegacyClass3<T*>,
- Object,
- _LegacyClass8&Object&LegacyClass3<T*>
-*/
-/*class: LegacyClass8:
- GenericInterface<T*>,
- GenericSubInterface<T*>,
- LegacyClass3<T*>,
- LegacyClass8<T*>,
- Object,
- _LegacyClass8&Object&LegacyClass3<T*>
-*/
+/*class: LegacyClass8:GenericInterface<T*>,GenericSubInterface<T*>,LegacyClass3<T*>,LegacyClass8<T*>,Object*/
class LegacyClass8<T> extends Object
with LegacyClass3<T>
implements GenericSubInterface<T> {}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_in/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_in/main.dart
index 9f0916a..673553b 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_in/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_in/main.dart
@@ -8,14 +8,14 @@
import 'opt_in.dart';
-/*class: MapImpl:Map<K*,V*>,MapImpl<K*,V*>,Object*/
+/*class: MapImpl:Map<K*, V*>,MapImpl<K*, V*>,Object*/
abstract class MapImpl<K, V> implements Map<K, V> {
- /*member: MapImpl.map:Map<K2*,V2*>* Function<K2,V2>(MapEntry<K2*,V2*>* Function(K*,V*)*)**/
+ /*member: MapImpl.map:Map<K2*, V2*>* Function<K2, V2>(MapEntry<K2*, V2*>* Function(K*, V*)*)**/
Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> Function(K key, V value) f);
}
-/*class: FixedMapImpl:FixedMapImpl,Map<int*,String*>,Object*/
+/*class: FixedMapImpl:FixedMapImpl,Map<int*, String*>,Object*/
abstract class FixedMapImpl implements Map<int, String> {
- /*member: FixedMapImpl.map:Map<K2*,V2*>* Function<K2,V2>(MapEntry<K2*,V2*>* Function(int*,String*)*)**/
+ /*member: FixedMapImpl.map:Map<K2*, V2*>* Function<K2, V2>(MapEntry<K2*, V2*>* Function(int*, String*)*)**/
Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> Function(int key, String value) f);
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_in/opt_in.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_in/opt_in.dart
index e0f9575..abc40c9 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_in/opt_in.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_in/opt_in.dart
@@ -4,8 +4,11 @@
/*library: nnbd=true*/
-/*class: Map:Map<K,V>,Object*/
+/*class: Map:Map<K, V>,Object*/
abstract class Map<K, V> {
- /*member: Map.map:Map<K2,V2>! Function<K2,V2>(MapEntry<K2,V2>! Function(K,V)!)!*/
+ /*member: Map.map:Map<K2, V2> Function<K2, V2>(MapEntry<K2, V2> Function(K, V))*/
Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> Function(K key, V value) f);
}
+
+/*class: MapEntry:MapEntry<K, V>,Object*/
+abstract class MapEntry<K, V> {}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_out/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_out/main.dart
index ebbea2e..cd53607 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_out/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_out/main.dart
@@ -6,14 +6,14 @@
import 'opt_out.dart';
-/*class: MapImpl:Map<K,V>,MapImpl<K,V>,Object*/
+/*class: MapImpl:Map<K, V>,MapImpl<K, V>,Object*/
abstract class MapImpl<K, V> implements Map<K, V> {
- /*member: MapImpl.map:Map<K2,V2>! Function<K2,V2>(MapEntry<K2,V2>! Function(K,V)!)!*/
+ /*member: MapImpl.map:Map<K2, V2> Function<K2, V2>(MapEntry<K2, V2> Function(K, V))*/
Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> Function(K key, V value) f);
}
-/*class: FixedMapImpl:FixedMapImpl,Map<int!,String?>,Object*/
+/*class: FixedMapImpl:FixedMapImpl,Map<int, String?>,Object*/
abstract class FixedMapImpl implements Map<int, String?> {
- /*member: FixedMapImpl.map:Map<K2,V2>! Function<K2,V2>(MapEntry<K2,V2>! Function(int!,String?)!)!*/
+ /*member: FixedMapImpl.map:Map<K2, V2> Function<K2, V2>(MapEntry<K2, V2> Function(int, String?))*/
Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> Function(int key, String? value) f);
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_out/opt_out.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_out/opt_out.dart
index 7d7688f..24926e7 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_out/opt_out.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/generic_members_from_opt_out/opt_out.dart
@@ -6,8 +6,11 @@
// @dart=2.5
-/*class: Map:Map<K*,V*>,Object*/
+/*class: Map:Map<K*, V*>,Object*/
abstract class Map<K, V> {
- /*member: Map.map:Map<K2*,V2*>* Function<K2,V2>(MapEntry<K2*,V2*>* Function(K*,V*)*)**/
+ /*member: Map.map:Map<K2*, V2*>* Function<K2, V2>(MapEntry<K2*, V2*>* Function(K*, V*)*)**/
Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> Function(K key, V value) f);
}
+
+/*class: MapEntry:MapEntry<K*, V*>,Object*/
+abstract class MapEntry<K, V> {}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/in_out_in/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/in_out_in/main.dart
index 93168a7..11d144e 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/in_out_in/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/in_out_in/main.dart
@@ -14,5 +14,6 @@
/*class: SubClass2:Class,Interface,LegacyClass2,Object,SubClass2*/
class SubClass2 extends LegacyClass2 implements Interface {
- /*member: SubClass2.method:int? Function(int!)!*/
+ /*cfe|cfe:builder.member: SubClass2.method:int? Function(int)*/
+ /*analyzer.member: SubClass2.method:int* Function(int*)**/
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/in_out_in/opt_in.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/in_out_in/opt_in.dart
index 886dbad..2e4244b 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/in_out_in/opt_in.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/in_out_in/opt_in.dart
@@ -6,12 +6,12 @@
/*class: Class:Class,Object*/
class Class {
- /*member: Class.method:int! Function(int?)!*/
+ /*member: Class.method:int Function(int?)*/
int method(int? i) => i ?? 0;
}
/*class: Interface:Interface,Object*/
abstract class Interface {
- /*member: Interface.method:int? Function(int!)!*/
+ /*member: Interface.method:int? Function(int)*/
int? method(int i) => i;
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/infer_opt_in_from_mixed/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/infer_opt_in_from_mixed/main.dart
index 07fa2ca..3bd4f32 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/infer_opt_in_from_mixed/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/infer_opt_in_from_mixed/main.dart
@@ -8,24 +8,28 @@
/*class: Nnbd:Nnbd,Object*/
abstract class Nnbd {
- /*member: Nnbd.mandatory:void Function(int!)!*/
+ /*member: Nnbd.mandatory:void Function(int)*/
void mandatory(int param);
- /*member: Nnbd.optional:void Function(int?)!*/
+ /*member: Nnbd.optional:void Function(int?)*/
void optional(int? param);
}
/*class: Both1:Both1,Legacy,Nnbd,Object*/
class Both1 implements Legacy, Nnbd {
- /*member: Both1.mandatory:void Function(int!)!*/
+ /*cfe|cfe:builder.member: Both1.mandatory:void Function(int)*/
+ /*analyzer.member: Both1.mandatory:void Function(dynamic)*/
void mandatory(param) {}
- /*member: Both1.optional:void Function(int?)!*/
+ /*cfe|cfe:builder.member: Both1.optional:void Function(int?)*/
+ /*analyzer.member: Both1.optional:void Function(dynamic)*/
void optional(param) {}
}
/*class: Both2:Both2,Legacy,Nnbd,Object*/
class Both2 implements Nnbd, Legacy {
- /*member: Both2.mandatory:void Function(int!)!*/
+ /*cfe|cfe:builder.member: Both2.mandatory:void Function(int)*/
+ /*analyzer.member: Both2.mandatory:void Function(dynamic)*/
void mandatory(param) {}
- /*member: Both2.optional:void Function(int?)!*/
+ /*cfe|cfe:builder.member: Both2.optional:void Function(int?)*/
+ /*analyzer.member: Both2.optional:void Function(dynamic)*/
void optional(param) {}
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/infer_opt_out_from_mixed/opt_in.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/infer_opt_out_from_mixed/opt_in.dart
index 9e428bb..914a821 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/infer_opt_out_from_mixed/opt_in.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/infer_opt_out_from_mixed/opt_in.dart
@@ -6,8 +6,8 @@
/*class: Nnbd:Nnbd,Object*/
abstract class Nnbd {
- /*member: Nnbd.mandatory:void Function(int!)!*/
+ /*member: Nnbd.mandatory:void Function(int)*/
void mandatory(int param);
- /*member: Nnbd.optional:void Function(int?)!*/
+ /*member: Nnbd.optional:void Function(int?)*/
void optional(int? param);
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/issue40524/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/issue40524/main.dart
index 83ad4bb..2428a5f 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/issue40524/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/issue40524/main.dart
@@ -11,7 +11,8 @@
/*member: B.getType:Type* Function()**/
}
-/*class: C:A<int?>,B,C,Object,out_int*/
+/*cfe|cfe:builder.class: C:A<int?>,B,C,Object,out_int*/
+/*analyzer.class: C:A<int*>,B,C,Object,out_int*/
class C extends out_int implements B {
/*member: C.getType:Type* Function()**/
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/issue40541.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/issue40541.dart
index 17c9609..16456a7 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/issue40541.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/issue40541.dart
@@ -1,27 +1,36 @@
+// Copyright (c) 2020, 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: nnbd=true*/
/*class: A:A<T>,Object*/
class A<T> {
- /*member: A.test:void Function()!*/
+ /*member: A.test:void Function()*/
void test() {
print(T);
}
}
/*class: B:A<Object?>,B,Object*/
-/*member: B.test:void Function()!*/
-class B extends A<Object?> {}
+class B extends A<Object?> {
+ /*member: B.test:void Function()*/
+}
/*class: C:A<dynamic>,C,Object*/
-/*member: C.test:void Function()!*/
-class C extends A<dynamic> {}
+class C extends A<dynamic> {
+ /*member: C.test:void Function()*/
+}
/*class: D1:A<Object?>,B,C,D1,Object*/
-/*member: D1.test:void Function()!*/
-class D1 extends B implements C {}
+class D1 extends B implements C {
+ /*member: D1.test:void Function()*/
+}
-/*class: D2:A<Object?>,B,C,D2,Object*/
-/*member: D2.test:void Function()!*/
-class D2 extends C implements B {}
+/*cfe|cfe:builder.class: D2:A<Object?>,B,C,D2,Object*/
+/*analyzer.class: D2:A<dynamic>,B,C,D2,Object*/
+class D2 extends C implements B {
+ /*member: D2.test:void Function()*/
+}
void main() {
D1().test();
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/issue40553/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/issue40553/main.dart
index 2164604..46bd14d 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/issue40553/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/issue40553/main.dart
@@ -4,17 +4,18 @@
Type typeOf<X>() => X;
-/*class: C:A<FutureOr<int?>!>,C,Object*/
+/*class: C:A<FutureOr<int?>>,C,Object*/
class C extends A<FutureOr<int?>> {
/*member: C.getType:Type* Function()**/
}
-/*class: D:A<FutureOr<int!>!>,D,Object*/
+/*class: D:A<FutureOr<int>>,D,Object*/
class D extends A<FutureOr<int>> {
/*member: D.getType:Type* Function()**/
}
-/*class: E:A<FutureOr<int?>?>,B,C,E,Object*/
+/*cfe|cfe:builder.class: E:A<FutureOr<int?>?>,B,C,E,Object*/
+/*analyzer.class: E:A<FutureOr<int*>*>,B,C,E,Object*/
class E extends B implements C {
/*member: E.getType:Type* Function()**/
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/marker.options b/pkg/_fe_analyzer_shared/test/inheritance/data/marker.options
new file mode 100644
index 0000000..34d58f9
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/marker.options
@@ -0,0 +1,3 @@
+cfe=pkg/front_end/test/id_tests/inheritance_test.dart
+cfe:builder=pkg/front_end/test/id_tests/inheritance_test.dart
+analyzer=pkg/analyzer/test/id_tests/inheritance_test.dart
\ No newline at end of file
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/member_from_opt_in/opt_in.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/member_from_opt_in/opt_in.dart
index 97729b5..6dd8da7 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/member_from_opt_in/opt_in.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/member_from_opt_in/opt_in.dart
@@ -6,12 +6,12 @@
/*class: Class:Class,Object*/
class Class {
- /*member: Class.method:int! Function(int?)!*/
+ /*member: Class.method:int Function(int?)*/
int method(int? i) => i ?? 0;
}
/*class: Interface:Interface,Object*/
abstract class Interface {
- /*member: Interface.method:int? Function(int!)!*/
+ /*member: Interface.method:int? Function(int)*/
int? method(int i);
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/member_from_opt_out/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/member_from_opt_out/main.dart
index 3c52a85..66fdf36 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/member_from_opt_out/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/member_from_opt_out/main.dart
@@ -8,11 +8,12 @@
/*class: Interface:Interface,Object*/
abstract class Interface {
- /*member: Interface.method:int! Function(int?)!*/
+ /*member: Interface.method:int Function(int?)*/
int method(int? i) => i ?? 0;
}
/*class: Class:Class,Interface,LegacyClass,Object*/
abstract class Class extends LegacyClass implements Interface {
- /*member: Class.method:int! Function(int?)!*/
+ /*cfe|cfe:builder.member: Class.method:int Function(int?)*/
+ /*analyzer.member: Class.method:int* Function(int*)**/
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_in/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_in/main.dart
index d6be79f..5cadc1d 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_in/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_in/main.dart
@@ -19,35 +19,35 @@
/*member: LegacyClass.method4:int* Function()**/
int method4() => 0;
- /*member: LegacyClass.method5a:int* Function(int*,int*)**/
- /*member: LegacyClass.method5b:int* Function(int*,[int*])**/
- /*member: LegacyClass.method5c:int* Function([int*,int*])**/
+ /*member: LegacyClass.method5a:int* Function(int*, int*)**/
+ /*member: LegacyClass.method5b:int* Function(int*, [int*])**/
+ /*member: LegacyClass.method5c:int* Function([int*, int*])**/
- /*member: LegacyClass.method6a:int* Function(int*,int*)**/
+ /*member: LegacyClass.method6a:int* Function(int*, int*)**/
int method6a(int a, int b) => 0;
- /*member: LegacyClass.method6b:int* Function(int*,[int*])**/
+ /*member: LegacyClass.method6b:int* Function(int*, [int*])**/
int method6b(int a, [int b]) => 0;
- /*member: LegacyClass.method6c:int* Function([int*,int*])**/
+ /*member: LegacyClass.method6c:int* Function([int*, int*])**/
int method6c([int a, int b]) => 0;
- /*member: LegacyClass.method7a:int* Function(int*,{int* b})**/
- /*member: LegacyClass.method7b:int* Function({int* a,int* b})**/
+ /*member: LegacyClass.method7a:int* Function(int*, {int* b})**/
+ /*member: LegacyClass.method7b:int* Function({int* a, int* b})**/
- /*member: LegacyClass.method8a:int* Function(int*,{int* b})**/
+ /*member: LegacyClass.method8a:int* Function(int*, {int* b})**/
int method8a(int a, {int b: 0}) => 0;
- /*member: LegacyClass.method8b:int* Function({int* a,int* b})**/
+ /*member: LegacyClass.method8b:int* Function({int* a, int* b})**/
int method8b({int a, int b: 0}) => 0;
- /*member: LegacyClass.method9a:int* Function(int*,{int* b})**/
- /*member: LegacyClass.method9b:int* Function({int* a,int* b})**/
+ /*member: LegacyClass.method9a:int* Function(int*, {int* b})**/
+ /*member: LegacyClass.method9b:int* Function({int* a, int* b})**/
- /*member: LegacyClass.method10a:int* Function(int*,{int* b})**/
+ /*member: LegacyClass.method10a:int* Function(int*, {int* b})**/
int method10a(int a, {int b}) => 0;
- /*member: LegacyClass.method10b:int* Function({int* a,int* b})**/
+ /*member: LegacyClass.method10b:int* Function({int* a, int* b})**/
int method10b({int a, int b}) => 0;
/*member: LegacyClass.getter1:int**/
@@ -71,24 +71,29 @@
/*member: LegacyClass.field1:int**/
/*member: LegacyClass.field1=:int**/
+
/*member: LegacyClass.field2:int**/
/*member: LegacyClass.field2=:int**/
/*member: LegacyClass.field3:int**/
+ /*member: LegacyClass.field3=:int**/
int field3;
/*member: LegacyClass.field4:int**/
+ /*member: LegacyClass.field4=:int**/
int field4;
- /*member: LegacyClass.field6a:int**/
- var field6a = 0;
-
- /*member: LegacyClass.field6b:int**/
- var field6b = constant;
-
/*member: LegacyClass.field5:int**/
/*member: LegacyClass.field5=:int**/
+ /*member: LegacyClass.field6a:int**/
+ /*member: LegacyClass.field6a=:int**/
+ var field6a = 0;
+
+ /*member: LegacyClass.field6b:int**/
+ /*member: LegacyClass.field6b=:int**/
+ var field6b = constant;
+
/*member: LegacyClass.property1:int**/
/*member: LegacyClass.property1=:int**/
/*member: LegacyClass.property2:int**/
@@ -108,13 +113,16 @@
/*member: LegacyClass.property5:int**/
/*member: LegacyClass.property5=:int**/
+
/*member: LegacyClass.property6:int**/
/*member: LegacyClass.property6=:int**/
/*member: LegacyClass.property7:int**/
+ /*member: LegacyClass.property7=:int**/
int property7;
/*member: LegacyClass.property8:int**/
+ /*member: LegacyClass.property8=:int**/
int property8;
}
@@ -126,6 +134,7 @@
/*member: LegacyClass2a.field2=:int**/
/*member: LegacyClass2a.field5:int**/
/*member: LegacyClass2a.field5=:int**/
+
/*member: LegacyClass2a.field6a:int**/
/*member: LegacyClass2a.field6a=:int**/
/*member: LegacyClass2a.field6b:int**/
@@ -136,13 +145,13 @@
/*member: LegacyClass2a.method1:int* Function()**/
/*member: LegacyClass2a.method2:int* Function()**/
- /*member: LegacyClass2a.method5a:int* Function(int*,int*)**/
- /*member: LegacyClass2a.method5b:int* Function(int*,[int*])**/
- /*member: LegacyClass2a.method5c:int* Function([int*,int*])**/
- /*member: LegacyClass2a.method7a:int* Function(int*,{int* b})**/
- /*member: LegacyClass2a.method7b:int* Function({int* a,int* b})**/
- /*member: LegacyClass2a.method9a:int* Function(int*,{int* b})**/
- /*member: LegacyClass2a.method9b:int* Function({int* a,int* b})**/
+ /*member: LegacyClass2a.method5a:int* Function(int*, int*)**/
+ /*member: LegacyClass2a.method5b:int* Function(int*, [int*])**/
+ /*member: LegacyClass2a.method5c:int* Function([int*, int*])**/
+ /*member: LegacyClass2a.method7a:int* Function(int*, {int* b})**/
+ /*member: LegacyClass2a.method7b:int* Function({int* a, int* b})**/
+ /*member: LegacyClass2a.method9a:int* Function(int*, {int* b})**/
+ /*member: LegacyClass2a.method9b:int* Function({int* a, int* b})**/
/*member: LegacyClass2a.property1:int**/
/*member: LegacyClass2a.property1=:int**/
@@ -177,20 +186,20 @@
/*member: LegacyInterface2.method2:int* Function()**/
/*member: LegacyInterface2.method3:int* Function()**/
/*member: LegacyInterface2.method4:int* Function()**/
- /*member: LegacyInterface2.method5a:int* Function(int*,int*)**/
- /*member: LegacyInterface2.method5b:int* Function(int*,[int*])**/
- /*member: LegacyInterface2.method5c:int* Function([int*,int*])**/
- /*member: LegacyInterface2.method6a:int* Function(int*,int*)**/
- /*member: LegacyInterface2.method6b:int* Function(int*,[int*])**/
- /*member: LegacyInterface2.method6c:int* Function([int*,int*])**/
- /*member: LegacyInterface2.method7a:int* Function(int*,{int* b})**/
- /*member: LegacyInterface2.method7b:int* Function({int* a,int* b})**/
- /*member: LegacyInterface2.method8a:int* Function(int*,{int* b})**/
- /*member: LegacyInterface2.method8b:int* Function({int* a,int* b})**/
- /*member: LegacyInterface2.method9a:int* Function(int*,{int* b})**/
- /*member: LegacyInterface2.method9b:int* Function({int* a,int* b})**/
- /*member: LegacyInterface2.method10a:int* Function(int*,{int* b})**/
- /*member: LegacyInterface2.method10b:int* Function({int* a,int* b})**/
+ /*member: LegacyInterface2.method5a:int* Function(int*, int*)**/
+ /*member: LegacyInterface2.method5b:int* Function(int*, [int*])**/
+ /*member: LegacyInterface2.method5c:int* Function([int*, int*])**/
+ /*member: LegacyInterface2.method6a:int* Function(int*, int*)**/
+ /*member: LegacyInterface2.method6b:int* Function(int*, [int*])**/
+ /*member: LegacyInterface2.method6c:int* Function([int*, int*])**/
+ /*member: LegacyInterface2.method7a:int* Function(int*, {int* b})**/
+ /*member: LegacyInterface2.method7b:int* Function({int* a, int* b})**/
+ /*member: LegacyInterface2.method8a:int* Function(int*, {int* b})**/
+ /*member: LegacyInterface2.method8b:int* Function({int* a, int* b})**/
+ /*member: LegacyInterface2.method9a:int* Function(int*, {int* b})**/
+ /*member: LegacyInterface2.method9b:int* Function({int* a, int* b})**/
+ /*member: LegacyInterface2.method10a:int* Function(int*, {int* b})**/
+ /*member: LegacyInterface2.method10b:int* Function({int* a, int* b})**/
/*member: LegacyInterface2.property1:int**/
/*member: LegacyInterface2.property1=:int**/
@@ -241,20 +250,20 @@
/*member: LegacyClass2b.method2:int* Function()**/
/*member: LegacyClass2b.method3:int* Function()**/
/*member: LegacyClass2b.method4:int* Function()**/
- /*member: LegacyClass2b.method5a:int* Function(int*,int*)**/
- /*member: LegacyClass2b.method5b:int* Function(int*,[int*])**/
- /*member: LegacyClass2b.method5c:int* Function([int*,int*])**/
- /*member: LegacyClass2b.method6a:int* Function(int*,int*)**/
- /*member: LegacyClass2b.method6b:int* Function(int*,[int*])**/
- /*member: LegacyClass2b.method6c:int* Function([int*,int*])**/
- /*member: LegacyClass2b.method7a:int* Function(int*,{int* b})**/
- /*member: LegacyClass2b.method7b:int* Function({int* a,int* b})**/
- /*member: LegacyClass2b.method8a:int* Function(int*,{int* b})**/
- /*member: LegacyClass2b.method8b:int* Function({int* a,int* b})**/
- /*member: LegacyClass2b.method9a:int* Function(int*,{int* b})**/
- /*member: LegacyClass2b.method9b:int* Function({int* a,int* b})**/
- /*member: LegacyClass2b.method10a:int* Function(int*,{int* b})**/
- /*member: LegacyClass2b.method10b:int* Function({int* a,int* b})**/
+ /*member: LegacyClass2b.method5a:int* Function(int*, int*)**/
+ /*member: LegacyClass2b.method5b:int* Function(int*, [int*])**/
+ /*member: LegacyClass2b.method5c:int* Function([int*, int*])**/
+ /*member: LegacyClass2b.method6a:int* Function(int*, int*)**/
+ /*member: LegacyClass2b.method6b:int* Function(int*, [int*])**/
+ /*member: LegacyClass2b.method6c:int* Function([int*, int*])**/
+ /*member: LegacyClass2b.method7a:int* Function(int*, {int* b})**/
+ /*member: LegacyClass2b.method7b:int* Function({int* a, int* b})**/
+ /*member: LegacyClass2b.method8a:int* Function(int*, {int* b})**/
+ /*member: LegacyClass2b.method8b:int* Function({int* a, int* b})**/
+ /*member: LegacyClass2b.method9a:int* Function(int*, {int* b})**/
+ /*member: LegacyClass2b.method9b:int* Function({int* a, int* b})**/
+ /*member: LegacyClass2b.method10a:int* Function(int*, {int* b})**/
+ /*member: LegacyClass2b.method10b:int* Function({int* a, int* b})**/
/*member: LegacyClass2b.property1:int**/
/*member: LegacyClass2b.property1=:int**/
@@ -281,6 +290,6 @@
/*class: LegacyGenericClass1:GenericInterface<T*>,LegacyGenericClass1<T*>,Object*/
abstract class LegacyGenericClass1<T> implements GenericInterface<T> {
- /*member: LegacyGenericClass1.genericMethod1:S* Function<S>(T*,S*,{T* c,S* d})**/
- /*member: LegacyGenericClass1.genericMethod2:S* Function<S>(T*,S*,[T*,S*])**/
+ /*member: LegacyGenericClass1.genericMethod1:S* Function<S>(T*, S*, {T* c, S* d})**/
+ /*member: LegacyGenericClass1.genericMethod2:S* Function<S>(T*, S*, [T*, S*])**/
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_in/opt_in.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_in/opt_in.dart
index ed18fed..a885acb 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_in/opt_in.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_in/opt_in.dart
@@ -6,67 +6,67 @@
/*class: Interface:Interface,Object*/
abstract class Interface {
- /*member: Interface.method1:int? Function()!*/
+ /*member: Interface.method1:int? Function()*/
int? method1();
- /*member: Interface.method2:int! Function()!*/
+ /*member: Interface.method2:int Function()*/
int method2();
- /*member: Interface.method3:int! Function()!*/
+ /*member: Interface.method3:int Function()*/
int method3();
- /*member: Interface.method4:int? Function()!*/
+ /*member: Interface.method4:int? Function()*/
int? method4();
- /*member: Interface.method5a:int! Function(int!,int?)!*/
+ /*member: Interface.method5a:int Function(int, int?)*/
int method5a(int a, int? b);
- /*member: Interface.method5b:int! Function(int!,[int?])!*/
+ /*member: Interface.method5b:int Function(int, [int?])*/
int method5b(int a, [int? b]);
- /*member: Interface.method5c:int! Function([int!,int?])!*/
+ /*member: Interface.method5c:int Function([int, int?])*/
int method5c([int a, int? b]);
- /*member: Interface.method6a:int? Function(int?,int!)!*/
+ /*member: Interface.method6a:int? Function(int?, int)*/
int? method6a(int? a, int b);
- /*member: Interface.method6b:int? Function(int?,[int!])!*/
+ /*member: Interface.method6b:int? Function(int?, [int])*/
int? method6b(int? a, [int b = 0]);
- /*member: Interface.method6c:int? Function([int?,int!])!*/
+ /*member: Interface.method6c:int? Function([int?, int])*/
int? method6c([int? a, int b = 0]);
- /*member: Interface.method7a:int! Function(int!,{int? b})!*/
+ /*member: Interface.method7a:int Function(int, {int? b})*/
int method7a(int a, {int? b});
- /*member: Interface.method7b:int! Function({int! a,int? b})!*/
+ /*member: Interface.method7b:int Function({int a, int? b})*/
int method7b({int a: 0, int? b});
- /*member: Interface.method8a:int? Function(int?,{int! b})!*/
+ /*member: Interface.method8a:int? Function(int?, {int b})*/
int? method8a(int? a, {int b: 0});
- /*member: Interface.method8b:int? Function({int? a,int! b})!*/
+ /*member: Interface.method8b:int? Function({int? a, int b})*/
int? method8b({int? a, int b: 0});
- /*member: Interface.method9a:int! Function(int!,{required int? b})!*/
+ /*member: Interface.method9a:int Function(int, {required int? b})*/
int method9a(int a, {required int? b});
- /*member: Interface.method9b:int! Function({required int! a,required int? b})!*/
+ /*member: Interface.method9b:int Function({required int a, required int? b})*/
int method9b({required int a, required int? b});
- /*member: Interface.method10a:int? Function(int?,{required int! b})!*/
+ /*member: Interface.method10a:int? Function(int?, {required int b})*/
int? method10a(int? a, {required int b});
- /*member: Interface.method10b:int? Function({required int? a,required int! b})!*/
+ /*member: Interface.method10b:int? Function({required int? a, required int b})*/
int? method10b({required int? a, required int b});
/*member: Interface.getter1:int?*/
int? get getter1;
- /*member: Interface.getter2:int!*/
+ /*member: Interface.getter2:int*/
int get getter2;
- /*member: Interface.getter3:int!*/
+ /*member: Interface.getter3:int*/
int get getter3;
/*member: Interface.getter4:int?*/
@@ -75,24 +75,28 @@
/*member: Interface.setter1=:int?*/
void set setter1(int? value);
- /*member: Interface.setter2=:int!*/
+ /*member: Interface.setter2=:int*/
void set setter2(int value);
- /*member: Interface.setter3=:int!*/
+ /*member: Interface.setter3=:int*/
void set setter3(int value);
/*member: Interface.setter4=:int?*/
void set setter4(int? value);
/*member: Interface.field1:int?*/
+ /*member: Interface.field1=:int?*/
int? field1;
- /*member: Interface.field2:int!*/
+ /*member: Interface.field2:int*/
+ /*member: Interface.field2=:int*/
int field2 = 0;
- /*member: Interface.field3:int!*/
+ /*member: Interface.field3:int*/
+ /*member: Interface.field3=:int*/
int field3 = 0;
+ /*member: Interface.field4=:int?*/
/*member: Interface.field4:int?*/
int? field4;
@@ -102,16 +106,16 @@
/*member: Interface.property1=:int?*/
void set property1(int? value);
- /*member: Interface.property2:int!*/
+ /*member: Interface.property2:int*/
int get property2;
- /*member: Interface.property2=:int!*/
+ /*member: Interface.property2=:int*/
void set property2(int value);
- /*member: Interface.property3:int!*/
+ /*member: Interface.property3:int*/
int get property3;
- /*member: Interface.property3=:int!*/
+ /*member: Interface.property3=:int*/
void set property3(int value);
/*member: Interface.property4:int?*/
@@ -126,16 +130,16 @@
/*member: Interface.property5=:int?*/
void set property5(int? value);
- /*member: Interface.property6:int!*/
+ /*member: Interface.property6:int*/
int get property6;
- /*member: Interface.property6=:int!*/
+ /*member: Interface.property6=:int*/
void set property6(int value);
- /*member: Interface.property7:int!*/
+ /*member: Interface.property7:int*/
int get property7;
- /*member: Interface.property7=:int!*/
+ /*member: Interface.property7=:int*/
void set property7(int value);
/*member: Interface.property8:int?*/
@@ -147,64 +151,69 @@
/*class: Class:Class,Object*/
class Class {
- /*member: Class.method1:int! Function()!*/
+ /*member: Class.method1:int Function()*/
int method1() => 0;
- /*member: Class.method2:int? Function()!*/
+ /*member: Class.method2:int? Function()*/
int? method2() => 0;
- /*member: Class.method5a:int! Function(int!,int?)!*/
+ /*member: Class.method5a:int Function(int, int?)*/
int method5a(int a, int? b) => 0;
- /*member: Class.method5b:int! Function(int!,[int?])!*/
+ /*member: Class.method5b:int Function(int, [int?])*/
int method5b(int a, [int? b]) => 0;
- /*member: Class.method5c:int! Function([int!,int?])!*/
+ /*member: Class.method5c:int Function([int, int?])*/
int method5c([int a = 0, int? b]) => 0;
- /*member: Class.method7a:int! Function(int!,{int? b})!*/
+ /*member: Class.method7a:int Function(int, {int? b})*/
int method7a(int a, {int? b}) => 0;
- /*member: Class.method7b:int! Function({int! a,int? b})!*/
+ /*member: Class.method7b:int Function({int a, int? b})*/
int method7b({int a: 0, int? b}) => 0;
- /*member: Class.method9a:int! Function(int!,{required int? b})!*/
+ /*member: Class.method9a:int Function(int, {required int? b})*/
int method9a(int a, {required int? b}) => 0;
- /*member: Class.method9b:int! Function({required int! a,required int? b})!*/
+ /*member: Class.method9b:int Function({required int a, required int? b})*/
int method9b({required int a, required int? b}) => 0;
- /*member: Class.getter1:int!*/
+ /*member: Class.getter1:int*/
int get getter1 => 0;
/*member: Class.getter2:int?*/
int? get getter2 => 0;
- /*member: Class.setter1=:int!*/
+ /*member: Class.setter1=:int*/
void set setter1(int value) {}
/*member: Class.setter2=:int?*/
void set setter2(int? value) {}
- /*member: Class.field1:int!*/
+ /*member: Class.field1:int*/
+ /*member: Class.field1=:int*/
int field1 = 0;
/*member: Class.field2:int?*/
+ /*member: Class.field2=:int?*/
int? field2;
- /*member: Class.field5:int!*/
+ /*member: Class.field5:int*/
+ /*member: Class.field5=:int*/
var field5 = 0;
- /*member: Class.field6a:int!*/
+ /*member: Class.field6a=:int*/
+ /*member: Class.field6a:int*/
var field6a = 0;
/*member: Class.field6b:int?*/
+ /*member: Class.field6b=:int?*/
var field6b = constant;
- /*member: Class.property1:int!*/
+ /*member: Class.property1:int*/
int get property1 => 0;
- /*member: Class.property1=:int!*/
+ /*member: Class.property1=:int*/
void set property1(int value) {}
/*member: Class.property2:int?*/
@@ -213,10 +222,12 @@
/*member: Class.property2=:int?*/
void set property2(int? value) {}
- /*member: Class.property5:int!*/
+ /*member: Class.property5:int*/
+ /*member: Class.property5=:int*/
int property5 = 0;
/*member: Class.property6:int?*/
+ /*member: Class.property6=:int?*/
int? property6;
}
@@ -224,9 +235,9 @@
/*class: GenericInterface:GenericInterface<T>,Object*/
abstract class GenericInterface<T> {
- /*member: GenericInterface.genericMethod1:S Function<S>(T,S,{T c,S d})!*/
+ /*member: GenericInterface.genericMethod1:S Function<S>(T, S, {T c, S d})*/
S genericMethod1<S>(T a, S b, {T c, S d});
- /*member: GenericInterface.genericMethod2:S Function<S>(T,S,[T,S])!*/
+ /*member: GenericInterface.genericMethod2:S Function<S>(T, S, [T, S])*/
S genericMethod2<S>(T a, S b, [T c, S d]);
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_out/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_out/main.dart
index 2af78cb..0fef8c6 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_out/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_out/main.dart
@@ -9,70 +9,76 @@
/*class: Interface:Interface,Object*/
abstract class Interface {
- /*member: Interface.method1:int! Function()!*/
+ /*member: Interface.method1:int Function()*/
int method1();
- /*member: Interface.method2:int? Function()!*/
+ /*member: Interface.method2:int? Function()*/
int? method2();
- /*member: Interface.method3a:int! Function(int!,int!)!*/
+ /*member: Interface.method3a:int Function(int, int)*/
int method3a(int a, int b);
- /*member: Interface.method3b:int! Function(int!,[int!])!*/
+ /*member: Interface.method3b:int Function(int, [int])*/
int method3b(int a, [int b]);
- /*member: Interface.method3c:int! Function([int!,int!])!*/
+ /*member: Interface.method3c:int Function([int, int])*/
int method3c([int a, int b]);
- /*member: Interface.method4a:int? Function(int?,int?)!*/
+ /*member: Interface.method4a:int? Function(int?, int?)*/
int? method4a(int? a, int? b);
- /*member: Interface.method4b:int? Function(int?,[int?])!*/
+ /*member: Interface.method4b:int? Function(int?, [int?])*/
int? method4b(int? a, [int? b]);
- /*member: Interface.method4c:int? Function([int?,int?])!*/
+ /*member: Interface.method4c:int? Function([int?, int?])*/
int? method4c([int? a, int? b]);
- /*member: Interface.method5a:int! Function(int!,{int! b})!*/
+ /*member: Interface.method5a:int Function(int, {int b})*/
int method5a(int a, {int b: 0});
- /*member: Interface.method5b:int! Function({int! a,int! b})!*/
+ /*member: Interface.method5b:int Function({int a, int b})*/
int method5b({int a: 0, int b: 0});
- /*member: Interface.method5c:int! Function({required int! a,required int! b})!*/
- int method5c({required int a: 0, required int b: 0});
+ /*member: Interface.method5c:int Function({required int a, required int b})*/
+ int method5c(
+ {required int /*analyzer.error: CompileTimeErrorCode.DEFAULT_VALUE_ON_REQUIRED_PARAMETER*/ a:
+ 0,
+ required int /*analyzer.error: CompileTimeErrorCode.DEFAULT_VALUE_ON_REQUIRED_PARAMETER*/ b:
+ 0});
- /*member: Interface.method6a:int? Function(int?,{int? b})!*/
+ /*member: Interface.method6a:int? Function(int?, {int? b})*/
int? method6a(int? a, {int? b});
- /*member: Interface.method6b:int? Function({int? a,int? b})!*/
+ /*member: Interface.method6b:int? Function({int? a, int? b})*/
int? method6b({int? a, int? b});
- /*member: Interface.method6c:int? Function({required int? a,required int? b})!*/
+ /*member: Interface.method6c:int? Function({required int? a, required int? b})*/
int? method6c({required int? a, required int? b});
- /*member: Interface.getter1:int!*/
+ /*member: Interface.getter1:int*/
int get getter1;
/*member: Interface.getter2:int?*/
int? get getter2;
- /*member: Interface.setter1=:int!*/
+ /*member: Interface.setter1=:int*/
void set setter1(int value);
/*member: Interface.setter2=:int?*/
void set setter2(int? value);
- /*member: Interface.field1:int!*/
+ /*member: Interface.field1:int*/
+ /*member: Interface.field1=:int*/
int field1 = 0;
/*member: Interface.field2:int?*/
+ /*member: Interface.field2=:int?*/
int? field2;
- /*member: Interface.field3:int!*/
+ /*member: Interface.field3:int*/
int get field3;
- /*member: Interface.field3=:int!*/
+ /*member: Interface.field3=:int*/
void set field3(int value);
/*member: Interface.field4:int?*/
@@ -81,16 +87,18 @@
/*member: Interface.field4=:int?*/
void set field4(int? value);
- /*member: Interface.field5:int!*/
+ /*member: Interface.field5:int*/
+ /*member: Interface.field5=:int*/
var field5 = 0;
/*member: Interface.field6:int?*/
+ /*member: Interface.field6=:int?*/
var field6 = constant;
- /*member: Interface.property1:int!*/
+ /*member: Interface.property1:int*/
int get property1;
- /*member: Interface.property1=:int!*/
+ /*member: Interface.property1=:int*/
void set property1(int value);
/*member: Interface.property2:int?*/
@@ -99,29 +107,37 @@
/*member: Interface.property2=:int?*/
void set property2(int? value);
- /*member: Interface.property3:int!*/
+ /*member: Interface.property3:int*/
+ /*member: Interface.property3=:int*/
int property3 = 0;
/*member: Interface.property4:int?*/
+ /*member: Interface.property4=:int?*/
int? property4;
}
/*class: Class1:Class1,LegacyClass,Object*/
+/*member: Class1.field1=:int**/
+/*member: Class1.field2=:int**/
+/*member: Class1.field3=:int**/
+/*member: Class1.field4=:int**/
+/*member: Class1.field5=:int**/
+/*member: Class1.field6=:int**/
class Class1 extends LegacyClass {
/*member: Class1.method1:int* Function()**/
/*member: Class1.method2:int* Function()**/
- /*member: Class1.method3a:int* Function(int*,int*)**/
- /*member: Class1.method3b:int* Function(int*,[int*])**/
- /*member: Class1.method3c:int* Function([int*,int*])**/
- /*member: Class1.method4a:int* Function(int*,int*)**/
- /*member: Class1.method4b:int* Function(int*,[int*])**/
- /*member: Class1.method4c:int* Function([int*,int*])**/
- /*member: Class1.method5a:int* Function(int*,{int* b})**/
- /*member: Class1.method5b:int* Function({int* a,int* b})**/
- /*member: Class1.method5c:int* Function({int* a,int* b})**/
- /*member: Class1.method6a:int* Function(int*,{int* b})**/
- /*member: Class1.method6b:int* Function({int* a,int* b})**/
- /*member: Class1.method6c:int* Function({int* a,int* b})**/
+ /*member: Class1.method3a:int* Function(int*, int*)**/
+ /*member: Class1.method3b:int* Function(int*, [int*])**/
+ /*member: Class1.method3c:int* Function([int*, int*])**/
+ /*member: Class1.method4a:int* Function(int*, int*)**/
+ /*member: Class1.method4b:int* Function(int*, [int*])**/
+ /*member: Class1.method4c:int* Function([int*, int*])**/
+ /*member: Class1.method5a:int* Function(int*, {int* b})**/
+ /*member: Class1.method5b:int* Function({int* a, int* b})**/
+ /*member: Class1.method5c:int* Function({int* a, int* b})**/
+ /*member: Class1.method6a:int* Function(int*, {int* b})**/
+ /*member: Class1.method6b:int* Function({int* a, int* b})**/
+ /*member: Class1.method6c:int* Function({int* a, int* b})**/
/*member: Class1.getter1:int**/
/*member: Class1.getter2:int**/
/*member: Class1.setter1=:int**/
@@ -144,134 +160,209 @@
/*class: Class2a:Class2a,Interface,LegacyClass,Object*/
class Class2a extends LegacyClass implements Interface {
- /*member: Class2a.method1:int! Function()!*/
- /*member: Class2a.method2:int? Function()!*/
- /*member: Class2a.method3a:int! Function(int!,int!)!*/
- /*member: Class2a.method3b:int! Function(int!,[int!])!*/
- /*member: Class2a.method3c:int! Function([int!,int!])!*/
- /*member: Class2a.method4a:int? Function(int?,int?)!*/
- /*member: Class2a.method4b:int? Function(int?,[int?])!*/
- /*member: Class2a.method4c:int? Function([int?,int?])!*/
- /*member: Class2a.method5a:int! Function(int!,{int! b})!*/
- /*member: Class2a.method5b:int! Function({int! a,int! b})!*/
+ /*cfe|cfe:builder.member: Class2a.method1:int Function()*/
+ /*analyzer.member: Class2a.method1:int* Function()**/
+
+ /*cfe|cfe:builder.member: Class2a.method2:int? Function()*/
+ /*analyzer.member: Class2a.method2:int* Function()**/
+
+ /*cfe|cfe:builder.member: Class2a.method3a:int Function(int, int)*/
+ /*analyzer.member: Class2a.method3a:int* Function(int*, int*)**/
+
+ /*cfe|cfe:builder.member: Class2a.method3b:int Function(int, [int])*/
+ /*analyzer.member: Class2a.method3b:int* Function(int*, [int*])**/
+
+ /*cfe|cfe:builder.member: Class2a.method3c:int Function([int, int])*/
+ /*analyzer.member: Class2a.method3c:int* Function([int*, int*])**/
+
+ /*cfe|cfe:builder.member: Class2a.method4a:int? Function(int?, int?)*/
+ /*analyzer.member: Class2a.method4a:int* Function(int*, int*)**/
+
+ /*cfe|cfe:builder.member: Class2a.method4b:int? Function(int?, [int?])*/
+ /*analyzer.member: Class2a.method4b:int* Function(int*, [int*])**/
+
+ /*cfe|cfe:builder.member: Class2a.method4c:int? Function([int?, int?])*/
+ /*analyzer.member: Class2a.method4c:int* Function([int*, int*])**/
+
+ /*cfe|cfe:builder.member: Class2a.method5a:int Function(int, {int b})*/
+ /*analyzer.member: Class2a.method5a:int* Function(int*, {int* b})**/
+
+ /*cfe|cfe:builder.member: Class2a.method5b:int Function({int a, int b})*/
+ /*analyzer.member: Class2a.method5b:int* Function({int* a, int* b})**/
+
// TODO(johnniwinther): Should `method5c` be an error? It mixes required
// and optional named parameters.
- /*member: Class2a.method5c:int! Function({int! a,int! b})!*/
- /*member: Class2a.method6a:int? Function(int?,{int? b})!*/
- /*member: Class2a.method6b:int? Function({int? a,int? b})!*/
+ /*cfe|cfe:builder.member: Class2a.method5c:int Function({int a, int b})*/
+ /*analyzer.member: Class2a.method5c:int* Function({int* a, int* b})**/
+
+ /*cfe|cfe:builder.member: Class2a.method6a:int? Function(int?, {int? b})*/
+ /*analyzer.member: Class2a.method6a:int* Function(int*, {int* b})**/
+
+ /*cfe|cfe:builder.member: Class2a.method6b:int? Function({int? a, int? b})*/
+ /*analyzer.member: Class2a.method6b:int* Function({int* a, int* b})**/
+
// TODO(johnniwinther): Should `method6c` be an error? It mixes required
// and optional named parameters.
- /*member: Class2a.method6c:int? Function({int? a,int? b})!*/
- /*member: Class2a.getter1:int!*/
- /*member: Class2a.getter2:int?*/
- /*member: Class2a.setter1=:int!*/
- /*member: Class2a.setter2=:int?*/
- /*member: Class2a.field1:int!*/
- /*member: Class2a.field1=:int!*/
- /*member: Class2a.field2:int?*/
- /*member: Class2a.field2=:int?*/
- /*member: Class2a.field3:int!*/
- /*member: Class2a.field3=:int!*/
- /*member: Class2a.field4:int?*/
- /*member: Class2a.field4=:int?*/
- /*member: Class2a.field5:int!*/
- /*member: Class2a.field5=:int!*/
- /*member: Class2a.field6:int?*/
- /*member: Class2a.field6=:int?*/
- /*member: Class2a.property1:int!*/
- /*member: Class2a.property1=:int!*/
- /*member: Class2a.property2:int?*/
- /*member: Class2a.property2=:int?*/
- /*member: Class2a.property3:int!*/
- /*member: Class2a.property3=:int!*/
- /*member: Class2a.property4:int?*/
- /*member: Class2a.property4=:int?*/
+ /*cfe|cfe:builder.member: Class2a.method6c:int? Function({int? a, int? b})*/
+ /*analyzer.member: Class2a.method6c:int* Function({int* a, int* b})**/
+
+ /*cfe|cfe:builder.member: Class2a.getter1:int*/
+ /*analyzer.member: Class2a.getter1:int**/
+ /*cfe|cfe:builder.member: Class2a.getter2:int?*/
+ /*analyzer.member: Class2a.getter2:int**/
+
+ /*cfe|cfe:builder.member: Class2a.setter1=:int*/
+ /*analyzer.member: Class2a.setter1=:int**/
+ /*cfe|cfe:builder.member: Class2a.setter2=:int?*/
+ /*analyzer.member: Class2a.setter2=:int**/
+
+ /*cfe|cfe:builder.member: Class2a.field1:int*/
+ /*analyzer.member: Class2a.field1:int**/
+ /*cfe|cfe:builder.member: Class2a.field1=:int*/
+ /*analyzer.member: Class2a.field1=:int**/
+
+ /*cfe|cfe:builder.member: Class2a.field2:int?*/
+ /*analyzer.member: Class2a.field2:int**/
+ /*cfe|cfe:builder.member: Class2a.field2=:int?*/
+ /*analyzer.member: Class2a.field2=:int**/
+
+ /*cfe|cfe:builder.member: Class2a.field3:int*/
+ /*analyzer.member: Class2a.field3:int**/
+ /*cfe|cfe:builder.member: Class2a.field3=:int*/
+ /*analyzer.member: Class2a.field3=:int**/
+
+ /*cfe|cfe:builder.member: Class2a.field4:int?*/
+ /*analyzer.member: Class2a.field4:int**/
+ /*cfe|cfe:builder.member: Class2a.field4=:int?*/
+ /*analyzer.member: Class2a.field4=:int**/
+
+ /*cfe|cfe:builder.member: Class2a.field5:int*/
+ /*analyzer.member: Class2a.field5:int**/
+ /*cfe|cfe:builder.member: Class2a.field5=:int*/
+ /*analyzer.member: Class2a.field5=:int**/
+
+ /*cfe|cfe:builder.member: Class2a.field6:int?*/
+ /*analyzer.member: Class2a.field6:int**/
+ /*cfe|cfe:builder.member: Class2a.field6=:int?*/
+ /*analyzer.member: Class2a.field6=:int**/
+
+ /*cfe|cfe:builder.member: Class2a.property1:int*/
+ /*analyzer.member: Class2a.property1:int**/
+ /*cfe|cfe:builder.member: Class2a.property1=:int*/
+ /*analyzer.member: Class2a.property1=:int**/
+
+ /*cfe|cfe:builder.member: Class2a.property2:int?*/
+ /*analyzer.member: Class2a.property2:int**/
+ /*cfe|cfe:builder.member: Class2a.property2=:int?*/
+ /*analyzer.member: Class2a.property2=:int**/
+
+ /*cfe|cfe:builder.member: Class2a.property3:int*/
+ /*analyzer.member: Class2a.property3:int**/
+ /*cfe|cfe:builder.member: Class2a.property3=:int*/
+ /*analyzer.member: Class2a.property3=:int**/
+
+ /*cfe|cfe:builder.member: Class2a.property4:int?*/
+ /*analyzer.member: Class2a.property4:int**/
+ /*cfe|cfe:builder.member: Class2a.property4=:int?*/
+ /*analyzer.member: Class2a.property4=:int**/
}
/*class: Class2b:Class2b,Interface,LegacyClass,Object*/
class Class2b extends LegacyClass implements Interface {
- /*member: Class2b.method1:int! Function()!*/
+ /*member: Class2b.method1:int Function()*/
int method1() => 0;
- /*member: Class2b.method2:int? Function()!*/
+ /*member: Class2b.method2:int? Function()*/
int? method2() => 0;
- /*member: Class2b.method3a:int! Function(int!,int!)!*/
+ /*member: Class2b.method3a:int Function(int, int)*/
int method3a(int a, int b) => 0;
- /*member: Class2b.method3b:int! Function(int!,[int!])!*/
- int method3b(int a, [int b]) => 0;
+ /*member: Class2b.method3b:int Function(int, [int])*/
+ int method3b(int a, [int b = 0]) => 0;
- /*member: Class2b.method3c:int! Function([int!,int!])!*/
- int method3c([int a, int b]) => 0;
+ /*member: Class2b.method3c:int Function([int, int])*/
+ int method3c([int a = 0, int b = 0]) => 0;
- /*member: Class2b.method4a:int? Function(int?,int?)!*/
+ /*member: Class2b.method4a:int? Function(int?, int?)*/
int? method4a(int? a, int? b) => 0;
- /*member: Class2b.method4b:int? Function(int?,[int?])!*/
+ /*member: Class2b.method4b:int? Function(int?, [int?])*/
int? method4b(int? a, [int? b]) => 0;
- /*member: Class2b.method4c:int? Function([int?,int?])!*/
+ /*member: Class2b.method4c:int? Function([int?, int?])*/
int? method4c([int? a, int? b]) => 0;
- /*member: Class2b.method5a:int! Function(int!,{int! b})!*/
+ /*member: Class2b.method5a:int Function(int, {int b})*/
int method5a(int a, {int b: 0}) => 0;
- /*member: Class2b.method5b:int! Function({int! a,int! b})!*/
+ /*member: Class2b.method5b:int Function({int a, int b})*/
int method5b({int a: 0, int b: 0}) => 0;
- /*member: Class2b.method5c:int! Function({required int! a,required int! b})!*/
- int method5c({required int a: 0, required int b: 0}) => 0;
+ /*member: Class2b.method5c:int Function({required int a, required int b})*/
+ int /*analyzer.error: CompileTimeErrorCode.INVALID_OVERRIDE*/
+ method5c(
+ {required int /*analyzer.error: CompileTimeErrorCode.DEFAULT_VALUE_ON_REQUIRED_PARAMETER*/ a:
+ 0,
+ required int /*analyzer.error: CompileTimeErrorCode.DEFAULT_VALUE_ON_REQUIRED_PARAMETER*/ b:
+ 0}) =>
+ 0;
- /*member: Class2b.method6a:int? Function(int?,{int? b})!*/
+ /*member: Class2b.method6a:int? Function(int?, {int? b})*/
int? method6a(int? a, {int? b}) => 0;
- /*member: Class2b.method6b:int? Function({int? a,int? b})!*/
+ /*member: Class2b.method6b:int? Function({int? a, int? b})*/
int? method6b({int? a, int? b}) => 0;
- /*member: Class2b.method6c:int? Function({required int? a,required int? b})!*/
- int? method6c({required int? a, required int? b}) => 0;
+ /*member: Class2b.method6c:int? Function({required int? a, required int? b})*/
+ int? /*analyzer.error: CompileTimeErrorCode.INVALID_OVERRIDE*/ method6c(
+ {required int? a, required int? b}) =>
+ 0;
- /*member: Class2b.getter1:int!*/
+ /*member: Class2b.getter1:int*/
int get getter1 => 0;
/*member: Class2b.getter2:int?*/
int? get getter2 => 0;
- /*member: Class2b.setter1=:int!*/
+ /*member: Class2b.setter1=:int*/
void set setter1(int value) {}
/*member: Class2b.setter2=:int?*/
void set setter2(int? value) {}
- /*member: Class2b.field1:int!*/
+ /*member: Class2b.field1:int*/
+ /*member: Class2b.field1=:int*/
int field1 = 0;
/*member: Class2b.field2:int?*/
+ /*member: Class2b.field2=:int?*/
int? field2;
- /*member: Class2b.field3:int!*/
+ /*member: Class2b.field3:int*/
int get field3 => 0;
- /*member: Class2b.field3=:int!*/
+ /*member: Class2b.field3=:int*/
void set field3(int value) {}
/*member: Class2b.field4:int?*/
int? get field4 => 0;
- /*member: Class2b.field5:int!*/
- int field5;
+ /*member: Class2b.field5:int*/
+ /*member: Class2b.field5=:int*/
+ int field5 = 0;
+ /*member: Class2b.field6=:int?*/
/*member: Class2b.field6:int?*/
int? field6;
/*member: Class2b.field4=:int?*/
void set field4(int? value) {}
- /*member: Class2b.property1:int!*/
+ /*member: Class2b.property1:int*/
int get property1 => 0;
- /*member: Class2b.property1=:int!*/
+ /*member: Class2b.property1=:int*/
void set property1(int value) {}
/*member: Class2b.property2:int?*/
@@ -280,14 +371,16 @@
/*member: Class2b.property2=:int?*/
void set property2(int? value) {}
- /*member: Class2b.property3:int!*/
+ /*member: Class2b.property3:int*/
+ /*member: Class2b.property3=:int*/
int property3 = 0;
+ /*member: Class2b.property4=:int?*/
/*member: Class2b.property4:int?*/
int? property4;
}
-/*class: Class3a:Class3a,GenericLegacyClass<int!>,Object*/
+/*class: Class3a:Class3a,GenericLegacyClass<int>,Object*/
class Class3a extends GenericLegacyClass<int> {
/*member: Class3a.method1:int* Function()**/
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_out/opt_out.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_out/opt_out.dart
index c1bd807..97e1926 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_out/opt_out.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/members_from_opt_out/opt_out.dart
@@ -15,40 +15,40 @@
/*member: LegacyClass.method2:int* Function()**/
int method2() => 0;
- /*member: LegacyClass.method3a:int* Function(int*,int*)**/
+ /*member: LegacyClass.method3a:int* Function(int*, int*)**/
int method3a(int a, int b) => 0;
- /*member: LegacyClass.method3b:int* Function(int*,[int*])**/
+ /*member: LegacyClass.method3b:int* Function(int*, [int*])**/
int method3b(int a, [int b]) => 0;
- /*member: LegacyClass.method3c:int* Function([int*,int*])**/
+ /*member: LegacyClass.method3c:int* Function([int*, int*])**/
int method3c([int a, int b]) => 0;
- /*member: LegacyClass.method4a:int* Function(int*,int*)**/
+ /*member: LegacyClass.method4a:int* Function(int*, int*)**/
int method4a(int a, int b) => 0;
- /*member: LegacyClass.method4b:int* Function(int*,[int*])**/
+ /*member: LegacyClass.method4b:int* Function(int*, [int*])**/
int method4b(int a, [int b]) => 0;
- /*member: LegacyClass.method4c:int* Function([int*,int*])**/
+ /*member: LegacyClass.method4c:int* Function([int*, int*])**/
int method4c([int a, int b]) => 0;
- /*member: LegacyClass.method5a:int* Function(int*,{int* b})**/
+ /*member: LegacyClass.method5a:int* Function(int*, {int* b})**/
int method5a(int a, {int b}) => 0;
- /*member: LegacyClass.method5b:int* Function({int* a,int* b})**/
+ /*member: LegacyClass.method5b:int* Function({int* a, int* b})**/
int method5b({int a, int b}) => 0;
- /*member: LegacyClass.method5c:int* Function({int* a,int* b})**/
+ /*member: LegacyClass.method5c:int* Function({int* a, int* b})**/
int method5c({int a, int b}) => 0;
- /*member: LegacyClass.method6a:int* Function(int*,{int* b})**/
+ /*member: LegacyClass.method6a:int* Function(int*, {int* b})**/
int method6a(int a, {int b}) => 0;
- /*member: LegacyClass.method6b:int* Function({int* a,int* b})**/
+ /*member: LegacyClass.method6b:int* Function({int* a, int* b})**/
int method6b({int a, int b}) => 0;
- /*member: LegacyClass.method6c:int* Function({int* a,int* b})**/
+ /*member: LegacyClass.method6c:int* Function({int* a, int* b})**/
int method6c({int a, int b}) => 0;
/*member: LegacyClass.getter1:int**/
@@ -64,21 +64,27 @@
void set setter2(int value) {}
/*member: LegacyClass.field1:int**/
+ /*member: LegacyClass.field1=:int**/
int field1;
/*member: LegacyClass.field2:int**/
+ /*member: LegacyClass.field2=:int**/
int field2;
/*member: LegacyClass.field3:int**/
+ /*member: LegacyClass.field3=:int**/
int field3;
/*member: LegacyClass.field4:int**/
+ /*member: LegacyClass.field4=:int**/
int field4;
/*member: LegacyClass.field5:int**/
+ /*member: LegacyClass.field5=:int**/
var field5 = 0;
/*member: LegacyClass.field6:int**/
+ /*member: LegacyClass.field6=:int**/
int field6 = 0;
/*member: LegacyClass.property1:int**/
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/members_opt_in.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/members_opt_in.dart
index 199378bf..1959e2e 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/members_opt_in.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/members_opt_in.dart
@@ -4,36 +4,50 @@
/*library: nnbd=true*/
-abstract class /*class: A1:A1,Object*/ A1 {
- void /*member: A1.close:void Function()!*/ close();
+/*class: A1:A1,Object*/
+abstract class A1 {
+ /*member: A1.close:void Function()*/
+ void close();
}
-abstract class /*class: B1:B1,Object*/ B1 {
- Object /*member: B1.close:Object! Function()!*/ close();
+/*class: B1:B1,Object*/
+abstract class B1 {
+ /*member: B1.close:Object Function()*/
+ Object close();
}
-abstract class /*class: C1a:A1,B1,C1a,Object*/ C1a implements A1, B1 {
- Object /*member: C1a.close:Object! Function()!*/ close();
+/*class: C1a:A1,B1,C1a,Object*/
+abstract class C1a implements A1, B1 {
+ /*member: C1a.close:Object Function()*/
+ Object close();
}
-abstract class /*class: C1b:A1,B1,C1b,Object*/ C1b implements B1, A1 {
- Object /*member: C1b.close:Object! Function()!*/ close();
+/*class: C1b:A1,B1,C1b,Object*/
+abstract class C1b implements B1, A1 {
+ /*member: C1b.close:Object Function()*/
+ Object close();
}
-abstract class /*class: A2:A2<T>,Object*/ A2<T> {
- void /*member: A2.close:void Function()!*/ close();
+/*class: A2:A2<T>,Object*/
+abstract class A2<T> {
+ /*member: A2.close:void Function()*/
+ void close();
}
-abstract class /*class: B2:B2<T>,Object*/ B2<T> {
- Object /*member: B2.close:Object! Function()!*/ close();
+/*class: B2:B2<T>,Object*/
+abstract class B2<T> {
+ /*member: B2.close:Object Function()*/
+ Object close();
}
-abstract class /*class: C2a:A2<T>,B2<T>,C2a<T>,Object*/ C2a<T>
- implements A2<T>, B2<T> {
- Object /*member: C2a.close:Object! Function()!*/ close();
+/*class: C2a:A2<T>,B2<T>,C2a<T>,Object*/
+abstract class C2a<T> implements A2<T>, B2<T> {
+ /*member: C2a.close:Object Function()*/
+ Object close();
}
-abstract class /*class: C2b:A2<T>,B2<T>,C2b<T>,Object*/ C2b<T>
- implements B2<T>, A2<T> {
- Object /*member: C2b.close:Object! Function()!*/ close();
+/*class: C2b:A2<T>,B2<T>,C2b<T>,Object*/
+abstract class C2b<T> implements B2<T>, A2<T> {
+ /*member: C2b.close:Object Function()*/
+ Object close();
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/members_opt_out.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/members_opt_out.dart
index db11524..6534bca 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/members_opt_out.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/members_opt_out.dart
@@ -6,63 +6,86 @@
/*library: nnbd=false*/
-abstract class /*class: A1:A1,Object*/ A1 {
- void /*member: A1.close:void Function()**/ close();
+/*class: A1:A1,Object*/
+abstract class A1 {
+ /*member: A1.close:void Function()**/
+ void close();
}
-abstract class /*class: B1:B1,Object*/ B1 {
- Object /*member: B1.close:Object* Function()**/ close();
+/*class: B1:B1,Object*/
+abstract class B1 {
+ /*member: B1.close:Object* Function()**/
+ Object close();
}
-abstract class /*class: C1a:A1,B1,C1a,Object*/ C1a implements A1, B1 {
- Object /*member: C1a.close:Object* Function()**/ close();
+/*class: C1a:A1,B1,C1a,Object*/
+abstract class C1a implements A1, B1 {
+ /*member: C1a.close:Object* Function()**/
+ Object close();
}
-abstract class /*class: C1b:A1,B1,C1b,Object*/ C1b implements B1, A1 {
- Object /*member: C1b.close:Object* Function()**/ close();
+/*class: C1b:A1,B1,C1b,Object*/
+abstract class C1b implements B1, A1 {
+ /*member: C1b.close:Object* Function()**/
+ Object close();
}
-abstract class /*class: A2:A2<T*>,Object*/ A2<T> {
- void /*member: A2.close:void Function()**/ close();
+/*class: A2:A2<T*>,Object*/
+abstract class A2<T> {
+ /*member: A2.close:void Function()**/
+ void close();
}
-abstract class /*class: B2a:B2a<T*>,Object*/ B2a<T> {
- Object /*member: B2a.close:Object* Function()**/ close();
+/*class: B2a:B2a<T*>,Object*/
+abstract class B2a<T> {
+ /*member: B2a.close:Object* Function()**/
+ Object close();
}
-abstract class /*class: B2b:B2a<dynamic>,B2b<T*>,Object*/ B2b<T>
- implements B2a {
- Object /*member: B2b.close:Object* Function()**/ close();
+/*class: B2b:B2a<dynamic>,B2b<T*>,Object*/
+abstract class B2b<T> implements B2a {
+ /*member: B2b.close:Object* Function()**/
+ Object close();
}
-abstract class /*class: C2a:A2<T*>,B2a<dynamic>,B2b<T*>,C2a<T*>,Object*/ C2a<T>
- implements A2<T>, B2b<T> {
- Object /*member: C2a.close:Object* Function()**/ close();
+/*class: C2a:A2<T*>,B2a<dynamic>,B2b<T*>,C2a<T*>,Object*/
+abstract class C2a<T> implements A2<T>, B2b<T> {
+ /*member: C2a.close:Object* Function()**/
+ Object close();
}
-abstract class /*class: C2b:A2<T*>,B2a<dynamic>,B2b<T*>,C2b<T*>,Object*/ C2b<T>
- implements B2b<T>, A2<T> {
- Object /*member: C2b.close:Object* Function()**/ close();
+/*class: C2b:A2<T*>,B2a<dynamic>,B2b<T*>,C2b<T*>,Object*/
+abstract class C2b<T> implements B2b<T>, A2<T> {
+ /*member: C2b.close:Object* Function()**/
+ Object close();
}
-abstract class /*class: A3a:A3a<T*>,Object*/ A3a<T> {
- void /*member: A3a.close:void Function()**/ close();
+/*class: A3a:A3a<T*>,Object*/
+abstract class A3a<T> {
+ /*member: A3a.close:void Function()**/
+ void close();
}
-abstract class /*class: A3b:A3a<T*>,A3b<T*>,Object*/ A3b<T> implements A3a<T> {
- void /*member: A3b.close:void Function()**/ close();
+/*class: A3b:A3a<T*>,A3b<T*>,Object*/
+abstract class A3b<T> implements A3a<T> {
+ /*member: A3b.close:void Function()**/
+ void close();
}
-abstract class /*class: B3:B3<T*>,Object*/ B3<T> {
- Object /*member: B3.close:Object* Function()**/ close();
+/*class: B3:B3<T*>,Object*/
+abstract class B3<T> {
+ /*member: B3.close:Object* Function()**/
+ Object close();
}
-abstract class /*class: C3a:A3a<T*>,A3b<T*>,B3<T*>,C3a<T*>,Object*/ C3a<T>
- implements A3b<T>, B3<T> {
- Object /*member: C3a.close:Object* Function()**/ close();
+/*class: C3a:A3a<T*>,A3b<T*>,B3<T*>,C3a<T*>,Object*/
+abstract class C3a<T> implements A3b<T>, B3<T> {
+ /*member: C3a.close:Object* Function()**/
+ Object close();
}
-abstract class /*class: C3b:A3a<T*>,A3b<T*>,B3<T*>,C3b<T*>,Object*/ C3b<T>
- implements B3<T>, A3b<T> {
- Object /*member: C3b.close:Object* Function()**/ close();
+/*class: C3b:A3a<T*>,A3b<T*>,B3<T*>,C3b<T*>,Object*/
+abstract class C3b<T> implements B3<T>, A3b<T> {
+ /*member: C3b.close:Object* Function()**/
+ Object close();
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/norm_supertypes.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/norm_supertypes.dart
index 0ffb78c..fc0acb4 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/norm_supertypes.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/norm_supertypes.dart
@@ -9,22 +9,25 @@
/*class: A:A<T>,Object*/
class A<T> {}
-/*class: Foo:A<FutureOr<T?>!>,Foo<T!,S!>,Object*/
+/*class: Foo:A<FutureOr<T?>>,Foo<T, S>,Object*/
class Foo<T extends S, S extends Never> implements A<FutureOr<T?>> {}
-/*class: Bar:A<FutureOr<Never>!>,Bar,Object*/
+/*cfe|cfe:builder.class: Bar:A<FutureOr<Never>>,Bar,Object*/
+/*analyzer.class: Bar:A<FutureOr<Never?>>,Bar,Object*/
class Bar implements A<FutureOr<Never?>> {}
/*class: Baz:A<Future<Null>?>,Baz,Object*/
class Baz implements A<Future<Null>?> {}
-/*class: Hest:A<Future<Null>?>,Bar,Foo<Never,Never>,Hest,Object*/
+/*cfe|cfe:builder.class: Hest:A<Future<Null>?>,Bar,Foo<Never, Never>,Hest,Object*/
+/*analyzer.class: Hest:A<FutureOr<Never?>>,Bar,Foo<Never, Never>,Hest,Object*/
class Hest extends Foo implements Bar {}
-/*class: Fisk:A<Future<Null>?>,Bar,Baz,Fisk,Object*/
+/*cfe|cfe:builder.class: Fisk:A<Future<Null>?>,Bar,Baz,Fisk,Object*/
+/*analyzer.class: Fisk:A<FutureOr<Never?>>,Bar,Baz,Fisk,Object*/
class Fisk extends Bar implements Baz {}
-/*class: Naebdyr:A<Future<Null>?>,Baz,Foo<Never,Never>,Naebdyr,Object*/
+/*class: Naebdyr:A<Future<Null>?>,Baz,Foo<Never, Never>,Naebdyr,Object*/
class Naebdyr extends Baz implements Foo {}
main() {}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/nsm_from_opt_in/main.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/nsm_from_opt_in/main.dart
index 984da7d..4a580a1 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/nsm_from_opt_in/main.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/nsm_from_opt_in/main.dart
@@ -10,7 +10,7 @@
/*class: B2:A,B2,C2,Object*/
abstract class B2 extends A implements C2 {
- /*member: B2.method:int* Function(int*,{dynamic optional})**/
+ /*member: B2.method:int* Function(int*, {dynamic optional})**/
/*member: B2.noSuchMethod:dynamic Function(Invocation*)**/
noSuchMethod(Invocation invocation) {
@@ -20,6 +20,6 @@
/*class: C2:C2,Object*/
abstract class C2 {
- /*member: C2.method:int* Function(int*,{dynamic optional})**/
+ /*member: C2.method:int* Function(int*, {dynamic optional})**/
int method(int i, {optional});
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/nsm_from_opt_in/opt_in.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/nsm_from_opt_in/opt_in.dart
index e7a737c..c3fa67b 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/nsm_from_opt_in/opt_in.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/nsm_from_opt_in/opt_in.dart
@@ -6,15 +6,15 @@
/*class: A:A,Object*/
class A {
- /*member: A.method:int! Function(int?)!*/
+ /*member: A.method:int Function(int?)*/
int method(int? i) => i ?? 0;
}
/*class: B1:A,B1,C1,Object*/
abstract class B1 extends A implements C1 {
- /*member: B1.method:int! Function(int?,{dynamic optional})!*/
+ /*member: B1.method:int Function(int?, {dynamic optional})*/
- /*member: B1.noSuchMethod:dynamic Function(Invocation!)!*/
+ /*member: B1.noSuchMethod:dynamic Function(Invocation)*/
noSuchMethod(Invocation invocation) {
return super.noSuchMethod(invocation);
}
@@ -22,6 +22,6 @@
/*class: C1:C1,Object*/
abstract class C1 {
- /*member: C1.method:int! Function(int?,{dynamic optional})!*/
+ /*member: C1.method:int Function(int?, {dynamic optional})*/
int method(int? i, {optional});
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/core.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/core.dart
index f91b62b..41a226e 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/core.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/core.dart
@@ -5,7 +5,7 @@
/*library: nnbd=true*/
import 'dart:async';
-import 'dart:_internal';
+import /*analyzer.error: CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY*/ 'dart:_internal';
export 'dart:async' show Future;
@@ -51,7 +51,7 @@
/*class: Set:Iterable<E>,Object,Set<E>*/
class Set<E> implements Iterable<E> {}
-/*class: Map:Map<K,V>,Object*/
+/*class: Map:Map<K, V>,Object*/
class Map<K, V> {}
/*class: Stream:Object,Stream<E>*/
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/libraries.json b/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/libraries.json
index 98467d2..ae39678 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/libraries.json
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/libraries.json
@@ -1,3 +1,5 @@
+/*analyzer.error: ParserErrorCode.EXPECTED_EXECUTABLE*/
+/*analyzer.library: nnbd=true*/
{
"none": {
"libraries": {
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/opt_in.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/opt_in.dart
index fa55142..50ed872 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/opt_in.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/opt_in.dart
@@ -6,6 +6,6 @@
/*class: Class:Class,Object*/
class Class {
- /*member: Class.==:bool! Function(Object!)!*/
+ /*member: Class.==:bool Function(Object)*/
operator ==(other) => true;
}
diff --git a/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/opt_out.dart b/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/opt_out.dart
index f42202d..fd240ef 100644
--- a/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/opt_out.dart
+++ b/pkg/_fe_analyzer_shared/test/inheritance/data/object_equals/opt_out.dart
@@ -11,7 +11,7 @@
/*member: Class1.noSuchMethod:dynamic Function(Invocation*)**/
/*member: Class1.toString:String* Function()**/
- /*member: Class1.==:bool! Function(dynamic)**/
+ /*member: Class1.==:bool Function(dynamic)**/
operator ==(other) => true;
}
@@ -111,13 +111,7 @@
String toString();
}
-/*class: _Expression&AbstractExpression&ExpressionWithEval:AbstractExpression,ExpressionWithEval,Object,_Expression&AbstractExpression&ExpressionWithEval*/
-/*member: _Expression&AbstractExpression&ExpressionWithEval.toString:String* Function()**/
-/*member: _Expression&AbstractExpression&ExpressionWithEval.eval:int**/
-/*member: _Expression&AbstractExpression&ExpressionWithEval.noSuchMethod:dynamic Function(Invocation*)**/
-/*member: _Expression&AbstractExpression&ExpressionWithEval.==:bool* Function(Object*)**/
-
-/*class: Expression:AbstractExpression,Expression,ExpressionWithEval,ExpressionWithStringConversion,Object,_Expression&AbstractExpression&ExpressionWithEval*/
+/*class: Expression:AbstractExpression,Expression,ExpressionWithEval,ExpressionWithStringConversion,Object*/
/*member: Expression.toString:String* Function()**/
/*member: Expression.eval:int**/
/*member: Expression.noSuchMethod:dynamic Function(Invocation*)**/
@@ -163,14 +157,7 @@
/*member: S2.==:bool* Function(Object*)**/
}
-/*class: _C2&S2&M2:A2,B2,M2,Object,S2,_C2&S2&M2*/
-/*member: _C2&S2&M2.b:int**/
-/*member: _C2&S2&M2.a:int**/
-/*member: _C2&S2&M2.toString:String* Function()**/
-/*member: _C2&S2&M2.noSuchMethod:dynamic Function(Invocation*)**/
-/*member: _C2&S2&M2.==:bool* Function(Object*)**/
-
-/*class: C2:A2,B2,C2,M2,Object,S2,_C2&S2&M2*/
+/*class: C2:A2,B2,C2,M2,Object,S2*/
class /*error: MissingImplementationNotAbstract*/ C2 extends S2 with M2 {
/*member: C2.b:int**/
/*member: C2.a:int**/
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 07829e6..066dc72 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -8,7 +8,6 @@
import 'dart:io' as io;
import 'dart:math' show max;
-import 'package:analyzer/dart/analysis/features.dart' as analyzer_features;
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/protocol/protocol_constants.dart'
show PROTOCOL_VERSION;
@@ -51,6 +50,7 @@
import 'package:analysis_server/src/utilities/null_string_sink.dart';
import 'package:analysis_server/src/utilities/request_statistics.dart';
import 'package:analysis_server/src/utilities/tee_string_sink.dart';
+import 'package:analyzer/dart/analysis/features.dart' as analyzer_features;
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/exception/exception.dart';
@@ -363,6 +363,11 @@
resourceProvider.pathContext.normalize(path) == path;
}
+ @override
+ void notifyFlutterWidgetDescriptions(String path) {
+ flutterWidgetDescriptions.flush();
+ }
+
/// Read all files, resolve all URIs, and perform required analysis in
/// all current analysis drivers.
void reanalyze() {
@@ -475,6 +480,7 @@
throw RequestFailure(Response.unsupportedFeature(requestId, e.message));
}
addContextsToDeclarationsTracker();
+ analysisDriverScheduler.transitionToAnalyzingToIdleIfNoFilesToAnalyze();
}
/// Implementation for `analysis.setSubscriptions`.
@@ -626,6 +632,7 @@
contextManager.getDriverFor(file)?.addFile(file);
notifyDeclarationsTracker(file);
+ notifyFlutterWidgetDescriptions(file);
// TODO(scheglov) implement other cases
});
@@ -903,6 +910,7 @@
@override
void broadcastWatchEvent(WatchEvent event) {
analysisServer.notifyDeclarationsTracker(event.path);
+ analysisServer.notifyFlutterWidgetDescriptions(event.path);
analysisServer.pluginManager.broadcastWatchEvent(event);
}
diff --git a/pkg/analysis_server/lib/src/analysis_server_abstract.dart b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
index 7f38fad..18ab156 100644
--- a/pkg/analysis_server/lib/src/analysis_server_abstract.dart
+++ b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
@@ -295,6 +295,10 @@
analysisDriverScheduler.notify(null);
}
+ /// Notify the flutter widget properties support that the file with the
+ /// given [path] was changed - added, updated, or removed.
+ void notifyFlutterWidgetDescriptions(String path) {}
+
/// Sends an error notification to the user.
void sendServerErrorNotification(
String message,
diff --git a/pkg/analysis_server/lib/src/edit/nnbd_migration/README.md b/pkg/analysis_server/lib/src/edit/nnbd_migration/README.md
index 2e622fa..57ad179 100644
--- a/pkg/analysis_server/lib/src/edit/nnbd_migration/README.md
+++ b/pkg/analysis_server/lib/src/edit/nnbd_migration/README.md
@@ -1,13 +1,9 @@
# Null Safety Migration Tooling
-Note: the null safety migration tooling and workflow is in a very early state;
+Note: the null safety migration tooling and workflow is in an early state;
this doc will be updated as the steps and workflow are simplified.
-## Background
-
-TODO:
-
-## Building the nnbd sdk
+## Building the NNBD sdk
In order to run the tool currently you have to be able to build your own copy
of the Dart SDK.
@@ -42,12 +38,12 @@
Then, run the migration tool from the top-level of the package directory:
```
-<sdk-repo>/xcodebuild/ReleaseX64/dart <sdk-repo>/pkg/dartfix/bin/dartfix.dart upgrade sdk --sdk=<sdk-repo>/xcodebuild/ReleaseX64NNBD/dart-sdk/ .
+<sdk-repo>/xcodebuild/ReleaseX64NNBD/dart <sdk-repo>/pkg/dartdev/bin/dartdev.dart migrate .
```
-The migration tool will run, print the proposed changes to the console,
-and display a url for the preview tool. Open that url from a browser to
-see a rich preview of the proposed null safety changes.
+The migration tool will run, print the proposed changes to the console, and
+display a url for the preview tool. Open that url from a browser to see a rich
+preview of the proposed null safety changes.
## Using the tool
diff --git a/pkg/analysis_server/lib/src/edit/nnbd_migration/info_builder.dart b/pkg/analysis_server/lib/src/edit/nnbd_migration/info_builder.dart
index 2d8f5c8..8d779c4 100644
--- a/pkg/analysis_server/lib/src/edit/nnbd_migration/info_builder.dart
+++ b/pkg/analysis_server/lib/src/edit/nnbd_migration/info_builder.dart
@@ -71,8 +71,19 @@
if (!session.getFile(filePath).isPart) {
ResolvedLibraryResult result =
await session.getResolvedLibrary(filePath);
- SourceInformation sourceInfo = sourceInfoMap[source];
for (ResolvedUnitResult unitResult in result.units) {
+ SourceInformation sourceInfo =
+ sourceInfoMap[unitResult.unit.declaredElement.source];
+ // Note: there might have been no information for this unit in
+ // sourceInfoMap. That can happen if there's an already-migrated
+ // library being referenced by the code being migrated, but not all
+ // parts of that library are referenced. To avoid exceptions later
+ // on, we just create an empty SourceInformation object.
+ // TODO(paulberry): we don't do a good job of the case where the
+ // already-migrated library's defining compilation unit isn't
+ // referenced (we'll just skip the entire library because we'll only
+ // ever see its parts).
+ sourceInfo ??= SourceInformation();
SourceFileEdit edit =
listener.sourceChange.getFileEdit(unitResult.path);
UnitInfo unit = _explainUnit(sourceInfo, unitResult, edit);
@@ -168,12 +179,22 @@
return 'A length is specified in the "List()" constructor and the list '
'items are initialized to null';
}
+ if (origin.kind == EdgeOriginKind.typeParameterInstantiation) {
+ return 'This type parameter is instantiated with a nullable type';
+ }
+ if (origin.kind == EdgeOriginKind.inferredTypeParameterInstantiation) {
+ return 'This type parameter is instantiated with an inferred nullable '
+ 'type';
+ }
CompilationUnit unit = node.thisOrAncestorOfType<CompilationUnit>();
int lineNumber = unit.lineInfo.getLocation(node.offset).lineNumber;
if (origin.kind == EdgeOriginKind.uninitializedRead) {
return 'Used on line $lineNumber, when it is possibly uninitialized';
+ } else if (origin.kind == EdgeOriginKind.implicitNullReturn) {
+ return 'This function contains a return statement with no value on line '
+ '$lineNumber, which implicitly returns null.';
}
/// If the [node] is inside the return expression for a function body,
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index 3be366b..30992a8 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -537,6 +537,7 @@
driverMap.values.forEach((driver) => driver.changeFile(path));
notifyDeclarationsTracker(path);
+ notifyFlutterWidgetDescriptions(path);
}
void _updateDriversPriorityFiles() {
@@ -676,6 +677,7 @@
@override
void broadcastWatchEvent(WatchEvent event) {
analysisServer.notifyDeclarationsTracker(event.path);
+ analysisServer.notifyFlutterWidgetDescriptions(event.path);
// TODO: implement plugin broadcastWatchEvent
}
diff --git a/pkg/analysis_server/lib/src/lsp/mapping.dart b/pkg/analysis_server/lib/src/lsp/mapping.dart
index af05200..3f3c452 100644
--- a/pkg/analysis_server/lib/src/lsp/mapping.dart
+++ b/pkg/analysis_server/lib/src/lsp/mapping.dart
@@ -466,17 +466,21 @@
// appear in the completion list, so displaying them as setters is misleading.
// To avoid this, always show only the return type, whether it's a getter
// or a setter.
- return prefix +
- (declaration.kind == dec.DeclarationKind.GETTER
- ? declaration.returnType
- // Don't assume setters always have parameters
- // See https://github.com/dart-lang/sdk/issues/27747
- : declaration.parameters != null &&
- declaration.parameters.isNotEmpty
- // Extract the type part from '(MyType value)`
- ? declaration.parameters
- .substring(1, declaration.parameters.lastIndexOf(' '))
- : '');
+ String suffix = '';
+ if (declaration.kind == dec.DeclarationKind.GETTER) {
+ suffix = declaration.returnType;
+ } else {
+ // Don't assume setters always have parameters
+ // See https://github.com/dart-lang/sdk/issues/27747
+ if (declaration.parameters != null && declaration.parameters.isNotEmpty) {
+ // Extract the type part from `(MyType value)`, if there is a type.
+ var spaceIndex = declaration.parameters.lastIndexOf(' ');
+ if (spaceIndex > 0) {
+ suffix = declaration.parameters.substring(1, spaceIndex);
+ }
+ }
+ }
+ return prefix + suffix;
} else if (hasParameters && hasReturnType) {
return '$prefix${declaration.parameters} → ${declaration.returnType}';
} else if (hasReturnType) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_if_null.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_if_null.dart
new file mode 100644
index 0000000..ceb57b5
--- /dev/null
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_if_null.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2020, 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:analysis_server/src/services/correction/dart/abstract_producer.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/source/source_range.dart';
+import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
+import 'package:analyzer_plugin/utilities/range_factory.dart';
+
+class RemoveDeadIfNull extends CorrectionProducer {
+ @override
+ Future<void> compute(DartChangeBuilder builder) async {
+ //
+ // Find the dead if-null expression.
+ //
+ BinaryExpression findIfNull() {
+ var child = node;
+ var parent = node.parent;
+ while (parent != null) {
+ if (parent is BinaryExpression &&
+ parent.operator.type == TokenType.QUESTION_QUESTION &&
+ parent.rightOperand == child) {
+ return parent;
+ }
+ child = parent;
+ parent = parent.parent;
+ }
+ return null;
+ }
+
+ var expression = findIfNull();
+ if (expression == null) {
+ return;
+ }
+ //
+ // Extract the information needed to build the edit.
+ //
+ SourceRange sourceRange =
+ range.endEnd(expression.leftOperand, expression.rightOperand);
+ //
+ // Build the edit.
+ //
+ await builder.addFileEdit(file, (DartFileEditBuilder builder) {
+ builder.addDeletion(sourceRange);
+ });
+ }
+}
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 3aaa193..0714dce 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -18,6 +18,7 @@
import 'package:analysis_server/src/services/correction/dart/convert_to_null_aware.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_set_literal.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_where_type.dart';
+import 'package:analysis_server/src/services/correction/dart/remove_dead_if_null.dart';
import 'package:analysis_server/src/services/correction/dart/remove_if_null_operator.dart';
import 'package:analysis_server/src/services/correction/fix.dart';
import 'package:analysis_server/src/services/correction/fix/dart/top_level_declarations.dart';
@@ -447,6 +448,9 @@
await _addFix_createMixin();
await _addFix_undefinedClass_useSimilar();
}
+ if (errorCode == StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE) {
+ await _addFix_importLibrary_withType();
+ }
if (errorCode ==
CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED) {
await _addFix_convertToNamedArgument();
@@ -1282,7 +1286,8 @@
node.thisOrAncestorOfType<FieldDeclaration>();
var changeBuilder = _newDartChangeBuilder();
await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
- builder.addSimpleInsertion(declaration.offset, 'static ');
+ var offset = declaration.firstTokenAfterCommentAndMetadata.offset;
+ builder.addSimpleInsertion(offset, 'static ');
});
_addFixFromBuilder(changeBuilder, DartFixKind.ADD_STATIC);
}
@@ -3402,12 +3407,17 @@
}
Future<void> _addFix_removeEmptyCatch() async {
+ if (node.parent is! CatchClause) {
+ return;
+ }
var catchClause = node.parent as CatchClause;
+
var tryStatement = catchClause.parent as TryStatement;
if (tryStatement.catchClauses.length == 1 &&
tryStatement.finallyBlock == null) {
return;
}
+
var changeBuilder = _newDartChangeBuilder();
await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
builder.addDeletion(utils.getLinesRange(range.node(catchClause)));
@@ -3757,7 +3767,7 @@
if (parent.variables.length == 1) {
sourceRange = utils.getLinesRange(range.node(parent.parent));
} else {
- sourceRange = range.nodeInList(parent.variables, node);
+ sourceRange = range.nodeInList(parent.variables, referencedNode);
}
} else {
sourceRange = utils.getLinesRange(range.node(referencedNode));
@@ -4697,7 +4707,12 @@
}
var errorCode = error.errorCode;
- if (errorCode is LintCode) {
+ if (errorCode == StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION) {
+ await compute(
+ RemoveDeadIfNull(),
+ DartFixKind.REMOVE_IF_NULL_OPERATOR,
+ );
+ } else if (errorCode is LintCode) {
String name = errorCode.name;
if (name == LintNames.prefer_collection_literals) {
await compute(
diff --git a/pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart b/pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart
index 136f0d5..65769b0 100644
--- a/pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart
+++ b/pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart
@@ -32,6 +32,12 @@
/// The mapping of identifiers of previously returned properties.
final Map<int, PropertyDescription> _properties = {};
+ /// Flush all data, because there was a change to a file.
+ void flush() {
+ _classRegistry.flush();
+ _properties.clear();
+ }
+
/// Return the description of the widget with [InstanceCreationExpression] in
/// the [resolvedUnit] at the [offset], or `null` if the location does not
/// correspond to a widget.
diff --git a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
index da3050d..1b43684 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
@@ -28,6 +28,7 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
+import 'package:analyzer/src/dart/analysis/index.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart'
show RefactoringMethodParameter, SourceChange;
@@ -384,6 +385,10 @@
int offset = node.offset;
int length = node.length;
+ if (node is SimpleIdentifier && element is ParameterElement) {
+ element = declaredParameterElement(node, element);
+ }
+
if (element is FieldFormalParameterElement) {
element = (element as FieldFormalParameterElement).field;
}
diff --git a/pkg/analysis_server/test/analysis/update_content_test.dart b/pkg/analysis_server/test/analysis/update_content_test.dart
index ddfe39d..6e794cd 100644
--- a/pkg/analysis_server/test/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/analysis/update_content_test.dart
@@ -186,8 +186,8 @@
@failingTest
Future<void> test_sendNoticesAfterNopChange() async {
// The errors are empty on the last line.
- createProject();
addTestFile('');
+ createProject();
await server.onAnalysisComplete;
// add an overlay
server.updateContent(
@@ -206,8 +206,8 @@
@failingTest
Future<void> test_sendNoticesAfterNopChange_flushedUnit() async {
// The list of errors is empty on the last line.
- createProject();
addTestFile('');
+ createProject();
await server.onAnalysisComplete;
// add an overlay
server.updateContent(
diff --git a/pkg/analysis_server/test/analysis_server_test.dart b/pkg/analysis_server/test/analysis_server_test.dart
index 4640cbb..e966735 100644
--- a/pkg/analysis_server/test/analysis_server_test.dart
+++ b/pkg/analysis_server/test/analysis_server_test.dart
@@ -98,33 +98,64 @@
});
}
- Future test_serverStatusNotifications() {
+ Future test_serverStatusNotifications_hasFile() async {
server.serverServices.add(ServerService.STATUS);
- var pkgFolder = convertPath('/pkg');
- newFolder(pkgFolder);
- newFolder(join(pkgFolder, 'lib'));
- newFile(join(pkgFolder, 'lib', 'test.dart'), content: 'class C {}');
- server.setAnalysisRoots('0', [pkgFolder], [], {});
- // Pump the event queue to make sure the server has finished any
- // analysis.
- return pumpEventQueue(times: 5000).then((_) {
- List<Notification> notifications = channel.notificationsReceived;
- expect(notifications, isNotEmpty);
- // expect at least one notification indicating analysis is in progress
- expect(notifications.any((Notification notification) {
- if (notification.event == SERVER_NOTIFICATION_STATUS) {
- var params = ServerStatusParams.fromNotification(notification);
- if (params.analysis != null) {
- return params.analysis.isAnalyzing;
- }
+
+ newFile('/test/lib/a.dart', content: r'''
+class A {}
+''');
+ server.setAnalysisRoots('0', [convertPath('/test')], [], {});
+
+ // Pump the event queue, so that the server has finished any analysis.
+ await pumpEventQueue(times: 5000);
+
+ var notifications = channel.notificationsReceived;
+ expect(notifications, isNotEmpty);
+
+ // At least one notification indicating analysis is in progress.
+ expect(notifications.any((Notification notification) {
+ if (notification.event == SERVER_NOTIFICATION_STATUS) {
+ var params = ServerStatusParams.fromNotification(notification);
+ if (params.analysis != null) {
+ return params.analysis.isAnalyzing;
}
- return false;
- }), isTrue);
- // the last notification should indicate that analysis is complete
- Notification notification = notifications[notifications.length - 1];
- var params = ServerStatusParams.fromNotification(notification);
- expect(params.analysis.isAnalyzing, isFalse);
- });
+ }
+ return false;
+ }), isTrue);
+
+ // The last notification should indicate that analysis is complete.
+ var notification = notifications[notifications.length - 1];
+ var params = ServerStatusParams.fromNotification(notification);
+ expect(params.analysis.isAnalyzing, isFalse);
+ }
+
+ Future test_serverStatusNotifications_noFiles() async {
+ server.serverServices.add(ServerService.STATUS);
+
+ newFolder('/test');
+ server.setAnalysisRoots('0', [convertPath('/test')], [], {});
+
+ // Pump the event queue, so that the server has finished any analysis.
+ await pumpEventQueue(times: 5000);
+
+ var notifications = channel.notificationsReceived;
+ expect(notifications, isNotEmpty);
+
+ // At least one notification indicating analysis is in progress.
+ expect(notifications.any((Notification notification) {
+ if (notification.event == SERVER_NOTIFICATION_STATUS) {
+ var params = ServerStatusParams.fromNotification(notification);
+ if (params.analysis != null) {
+ return params.analysis.isAnalyzing;
+ }
+ }
+ return false;
+ }), isTrue);
+
+ // The last notification should indicate that analysis is complete.
+ var notification = notifications[notifications.length - 1];
+ var params = ServerStatusParams.fromNotification(notification);
+ expect(params.analysis.isAnalyzing, isFalse);
}
Future<void>
@@ -142,7 +173,7 @@
});
// We respect subscriptions, even for excluded files.
- await server.onAnalysisComplete;
+ await pumpEventQueue();
expect(channel.notificationsReceived.any((notification) {
return notification.event == ANALYSIS_NOTIFICATION_NAVIGATION;
}), isTrue);
@@ -163,7 +194,7 @@
});
// We respect subscriptions, even for excluded files.
- await server.onAnalysisComplete;
+ await pumpEventQueue();
expect(channel.notificationsReceived.any((notification) {
return notification.event == ANALYSIS_NOTIFICATION_NAVIGATION;
}), isTrue);
diff --git a/pkg/analysis_server/test/edit/refactoring_test.dart b/pkg/analysis_server/test/edit/refactoring_test.dart
index 292c42f..1f1e01d 100644
--- a/pkg/analysis_server/test/edit/refactoring_test.dart
+++ b/pkg/analysis_server/test/edit/refactoring_test.dart
@@ -1845,6 +1845,52 @@
});
}
+ Future<void> test_formalParameter_named_ofConstructor_genericClass() {
+ addTestFile('''
+class A<T> {
+ A({T test});
+}
+
+main() {
+ A(test: 0);
+}
+''');
+ return assertSuccessfulRefactoring(() {
+ return sendRenameRequest('test: 0', 'newName');
+ }, '''
+class A<T> {
+ A({T newName});
+}
+
+main() {
+ A(newName: 0);
+}
+''');
+ }
+
+ Future<void> test_formalParameter_named_ofMethod_genericClass() {
+ addTestFile('''
+class A<T> {
+ void foo({T test}) {}
+}
+
+main(A<int> a) {
+ a.foo(test: 0);
+}
+''');
+ return assertSuccessfulRefactoring(() {
+ return sendRenameRequest('test: 0', 'newName');
+ }, '''
+class A<T> {
+ void foo({T newName}) {}
+}
+
+main(A<int> a) {
+ a.foo(newName: 0);
+}
+''');
+ }
+
Future<void> test_function() {
addTestFile('''
test() {}
diff --git a/pkg/analysis_server/test/integration/linter/lint_names_test.dart b/pkg/analysis_server/test/integration/linter/lint_names_test.dart
index 17f8287..ee12579 100644
--- a/pkg/analysis_server/test/integration/linter/lint_names_test.dart
+++ b/pkg/analysis_server/test/integration/linter/lint_names_test.dart
@@ -73,7 +73,12 @@
var startToken = scanner.tokenize();
errorListener.throwIfErrors();
- var parser = Parser(stringSource, errorListener, featureSet: featureSet);
+ var parser = Parser(
+ stringSource,
+ errorListener,
+ languageVersion: scanner.languageVersion,
+ featureSet: featureSet,
+ );
var cu = parser.parseCompilationUnit(startToken);
errorListener.throwIfErrors();
diff --git a/pkg/analysis_server/test/mock_packages/flutter/lib/src/foundation/diagnostics.dart b/pkg/analysis_server/test/mock_packages/flutter/lib/src/foundation/diagnostics.dart
index b624146..978d497 100644
--- a/pkg/analysis_server/test/mock_packages/flutter/lib/src/foundation/diagnostics.dart
+++ b/pkg/analysis_server/test/mock_packages/flutter/lib/src/foundation/diagnostics.dart
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-abstract class Diagnosticable {}
+abstract class Diagnosticable with DiagnosticableMixin {}
+
+mixin DiagnosticableMixin {}
class DiagnosticPropertiesBuilder {
void add(DiagnosticsNode property) {}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
index 0bd0de6..74f8c37 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
@@ -491,6 +491,61 @@
''');
}
+ Future<void>
+ test_createChange_parameter_named_ofConstructor_genericClass() async {
+ await indexTestUnit('''
+class A<T> {
+ A({T test});
+}
+
+main() {
+ A(test: 0);
+}
+''');
+ // configure refactoring
+ createRenameRefactoringAtString('test}');
+ expect(refactoring.refactoringName, 'Rename Parameter');
+ expect(refactoring.elementKindName, 'parameter');
+ refactoring.newName = 'newName';
+ // validate change
+ return assertSuccessfulRefactoring('''
+class A<T> {
+ A({T newName});
+}
+
+main() {
+ A(newName: 0);
+}
+''');
+ }
+
+ Future<void> test_createChange_parameter_named_ofMethod_genericClass() async {
+ await indexTestUnit('''
+class A<T> {
+ void foo({T test}) {}
+}
+
+main(A<int> a) {
+ a.foo(test: 0);
+}
+''');
+ // configure refactoring
+ createRenameRefactoringAtString('test}');
+ expect(refactoring.refactoringName, 'Rename Parameter');
+ expect(refactoring.elementKindName, 'parameter');
+ refactoring.newName = 'newName';
+ // validate change
+ return assertSuccessfulRefactoring('''
+class A<T> {
+ void foo({T newName}) {}
+}
+
+main(A<int> a) {
+ a.foo(newName: 0);
+}
+''');
+ }
+
Future<void> test_createChange_parameter_named_updateHierarchy() async {
await indexUnit('/home/test/lib/test2.dart', '''
library test2;
diff --git a/pkg/analysis_server/test/src/edit/nnbd_migration/info_builder_test.dart b/pkg/analysis_server/test/src/edit/nnbd_migration/info_builder_test.dart
index 8883e30..b59e70a 100644
--- a/pkg/analysis_server/test/src/edit/nnbd_migration/info_builder_test.dart
+++ b/pkg/analysis_server/test/src/edit/nnbd_migration/info_builder_test.dart
@@ -280,6 +280,114 @@
details: ['The value of the expression is nullable']);
}
+ Future<void> test_bound() async {
+ UnitInfo unit = await buildInfoForSingleTestFile('''
+class C<T extends Object> {}
+
+C<int/*?*/> c;
+''', migratedContent: '''
+class C<T extends Object?> {}
+
+C<int?/*?*/>? c;
+''');
+ List<RegionInfo> regions = unit.regions;
+ expect(regions, hasLength(3));
+ assertRegion(
+ region: regions[0],
+ offset: 24,
+ details: ['This type parameter is instantiated with a nullable type']);
+ }
+
+ Future<void> test_bound_instantiation_explicit() async {
+ UnitInfo unit = await buildInfoForSingleTestFile('''
+class C<T extends Object> {}
+
+void main() {
+ C<int/*?*/>();
+}
+''', migratedContent: '''
+class C<T extends Object?> {}
+
+void main() {
+ C<int?/*?*/>();
+}
+''');
+ List<RegionInfo> regions = unit.regions;
+ expect(regions, hasLength(2));
+ assertRegion(
+ region: regions[0],
+ offset: 24,
+ details: ['This type parameter is instantiated with a nullable type']);
+ }
+
+ Future<void> test_bound_instantiation_implicit() async {
+ UnitInfo unit = await buildInfoForSingleTestFile('''
+class C<T extends Object> {
+ C(T/*!*/ t);
+}
+
+void main() {
+ C(null);
+}
+''', migratedContent: '''
+class C<T extends Object?> {
+ C(T/*!*/ t);
+}
+
+void main() {
+ C(null);
+}
+''');
+ List<RegionInfo> regions = unit.regions;
+ expect(regions, hasLength(2));
+ assertRegion(region: regions[0], offset: 24, details: [
+ 'This type parameter is instantiated with an inferred nullable type'
+ ]);
+ }
+
+ Future<void> test_bound_method_explicit() async {
+ UnitInfo unit = await buildInfoForSingleTestFile('''
+f<T extends Object> {}
+
+void main() {
+ f<int/*?*/>();
+}
+''', migratedContent: '''
+f<T extends Object?> {}
+
+void main() {
+ f<int?/*?*/>();
+}
+''');
+ List<RegionInfo> regions = unit.regions;
+ expect(regions, hasLength(2));
+ assertRegion(
+ region: regions[0],
+ offset: 18,
+ details: ['This type parameter is instantiated with a nullable type']);
+ }
+
+ Future<void> test_bound_method_implicit() async {
+ UnitInfo unit = await buildInfoForSingleTestFile('''
+f<T extends Object>(T/*!*/ t) {}
+
+void main() {
+ f(null);
+}
+''', migratedContent: '''
+f<T extends Object?>(T/*!*/ t) {}
+
+void main() {
+ f(null);
+}
+''');
+ List<RegionInfo> regions = unit.regions;
+ expect(regions, hasLength(2));
+ assertRegion(region: regions[0], offset: 18, details: [
+ 'This type parameter is instantiated with an inferred nullable type'
+ ]);
+ }
+
Future<void> test_discardCondition() async {
UnitInfo unit = await buildInfoForSingleTestFile('''
void g(int i) {
@@ -1460,6 +1568,24 @@
assertDetail(detail: regions[0].details[0], offset: 15, length: 6);
}
+ Future<void> test_returnNoValue() async {
+ UnitInfo unit = await buildInfoForSingleTestFile('''
+int f() {
+ return;
+}
+''', migratedContent: '''
+int? f() {
+ return;
+}
+''');
+ List<RegionInfo> regions = unit.fixRegions;
+ expect(regions, hasLength(1));
+ assertRegion(region: regions[0], offset: 3, details: [
+ 'This function contains a return statement with no value on line 2,'
+ ' which implicitly returns null.'
+ ]);
+ }
+
Future<void> test_returnType_function_expression() async {
UnitInfo unit = await buildInfoForSingleTestFile('''
int _f = null;
diff --git a/pkg/analysis_server/test/src/edit/nnbd_migration/nnbd_migration_test_base.dart b/pkg/analysis_server/test/src/edit/nnbd_migration/nnbd_migration_test_base.dart
index 3d7a13e..c9c6c9e 100644
--- a/pkg/analysis_server/test/src/edit/nnbd_migration/nnbd_migration_test_base.dart
+++ b/pkg/analysis_server/test/src/edit/nnbd_migration/nnbd_migration_test_base.dart
@@ -8,6 +8,7 @@
import 'package:analysis_server/src/edit/nnbd_migration/instrumentation_information.dart';
import 'package:analysis_server/src/edit/nnbd_migration/instrumentation_listener.dart';
import 'package:analysis_server/src/edit/nnbd_migration/migration_info.dart';
+import 'package:analyzer/dart/analysis/results.dart';
import 'package:meta/meta.dart';
import 'package:nnbd_migration/nnbd_migration.dart';
import 'package:test/test.dart';
@@ -82,15 +83,20 @@
permissive: false,
instrumentation: instrumentationListener,
removeViaComments: removeViaComments);
- for (var testPath in testPaths) {
- var result = await server
- .getAnalysisDriver(testPath)
- .currentSession
- .getResolvedUnit(testPath);
- migration.prepareInput(result);
- migration.processInput(result);
- migration.finalizeInput(result);
+ Future<void> _forEachPath(
+ void Function(ResolvedUnitResult) callback) async {
+ for (var testPath in testPaths) {
+ var result = await server
+ .getAnalysisDriver(testPath)
+ .currentSession
+ .getResolvedUnit(testPath);
+ callback(result);
+ }
}
+
+ await _forEachPath(migration.prepareInput);
+ await _forEachPath(migration.processInput);
+ await _forEachPath(migration.finalizeInput);
migration.finish();
// Build the migration info.
InstrumentationInformation info = instrumentationListener.data;
diff --git a/pkg/analysis_server/test/src/edit/nnbd_migration/unit_renderer_test.dart b/pkg/analysis_server/test/src/edit/nnbd_migration/unit_renderer_test.dart
index 900f382..d2832d6 100644
--- a/pkg/analysis_server/test/src/edit/nnbd_migration/unit_renderer_test.dart
+++ b/pkg/analysis_server/test/src/edit/nnbd_migration/unit_renderer_test.dart
@@ -169,6 +169,45 @@
contains('int<span class="region added-region">?</span> a = null;'));
}
+ Future<void> test_project_with_parts() async {
+ // In this test, we migrate a library and its part file. Both files require
+ // addition of a `?`, but at different offsets. We make sure the `?`s get
+ // added at the correct locations in each file.
+ var files = {
+ convertPath('/project/lib/a.dart'): '''
+part 'b.dart';
+
+int f() => null;
+''',
+ convertPath('/project/lib/b.dart'): '''
+part of 'a.dart';
+
+int g() => null;
+''',
+ };
+ var packageRoot = convertPath('/project');
+ await buildInfoForTestFiles(files, includedRoot: packageRoot);
+ var outputJson = renderUnits();
+ expect(jsonDecode(outputJson[0])['sourceCode'], contains('int?'));
+ expect(jsonDecode(outputJson[1])['sourceCode'], contains('int?'));
+ }
+
+ Future<void> test_reference_to_sdk_file_with_parts() async {
+ await buildInfoForSingleTestFile('''
+import 'dart:async';
+Future<int> f(Future<int> x) {
+ return x.whenComplete(() {});
+}
+''', migratedContent: '''
+import 'dart:async';
+Future<int> f(Future<int> x) {
+ return x.whenComplete(() {});
+}
+''');
+ renderUnits();
+ // No assertions; we're just making sure there's no crash.
+ }
+
Future<void> test_regionsContainsEscapedHtml_ampersand() async {
await buildInfoForSingleTestFile('bool a = true && false;',
migratedContent: 'bool a = true && false;');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart
index e094001..5e8a9e2 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart
@@ -35,7 +35,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
bool get absorbing => _absorbing;
bool _absorbing;
bool ignoringSemantics;
@@ -50,7 +50,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
bool get absorbing => _absorbing;
bool _absorbing;
bool ignoringSemantics;
@@ -69,7 +69,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
bool ignoringSemantics;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -80,7 +80,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
bool ignoringSemantics;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -95,7 +95,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
bool ignoringSemantics;
@override
void debugFillProperties(DiagnosticPropertiesBuilder props) {
@@ -106,7 +106,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
bool ignoringSemantics;
@override
void debugFillProperties(DiagnosticPropertiesBuilder props) {
@@ -121,7 +121,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
bool get absorbing => _absorbing;
bool _absorbing;
@override
@@ -134,7 +134,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
bool get absorbing => _absorbing;
bool _absorbing;
@override
@@ -152,7 +152,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
Color field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -165,7 +165,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
Color field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -181,7 +181,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
double field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -193,7 +193,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
double field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -209,7 +209,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
dynamic field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -221,7 +221,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
dynamic field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -237,7 +237,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
Foo field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -250,7 +250,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
Foo field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -268,7 +268,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
ValueChanged<double> onChanged;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -282,7 +282,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
ValueChanged<double> onChanged;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -299,7 +299,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
int field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -311,7 +311,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
int field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -327,7 +327,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
Iterable<String> field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -339,7 +339,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
Iterable<String> field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -355,7 +355,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
List<List<String>> field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -367,7 +367,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
List<List<String>> field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -385,7 +385,7 @@
import 'package:flutter/widgets.dart';
import 'package:vector_math/vector_math_64.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
Matrix4 field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -398,7 +398,7 @@
import 'package:flutter/widgets.dart';
import 'package:vector_math/vector_math_64.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
Matrix4 field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -414,7 +414,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
Object field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -426,7 +426,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
Object field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -442,7 +442,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
String field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -454,7 +454,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
String field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -470,7 +470,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
String field;
}
''');
@@ -478,7 +478,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
String field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -494,7 +494,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
ClassNotInScope<bool> onChanged;
@override
@@ -507,7 +507,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
ClassNotInScope<bool> onChanged;
@override
@@ -526,7 +526,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
ClassNotInScope<bool> get onChanged => null;
@override
@@ -539,7 +539,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
ClassNotInScope<bool> get onChanged => null;
@override
@@ -558,7 +558,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
var field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -570,7 +570,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-class C extends Widget implements Diagnosticable {
+class C extends Widget with DiagnosticableMixin {
var field;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_static_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_static_test.dart
index 13f5b25..d547fbf 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_static_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_static_test.dart
@@ -44,4 +44,36 @@
}
''');
}
+
+ Future<void> test_withAnnotation() async {
+ await resolveTestUnit('''
+class C {
+ @ann
+ const int x = 0;
+}
+const ann = 0;
+''');
+ await assertHasFix('''
+class C {
+ @ann
+ static const int x = 0;
+}
+const ann = 0;
+''');
+ }
+
+ Future<void> test_withDocComment() async {
+ await resolveTestUnit('''
+class C {
+ /// Doc comment
+ const int x = 0;
+}
+''');
+ await assertHasFix('''
+class C {
+ /// Doc comment
+ static const int x = 0;
+}
+''');
+ }
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
index a2a8902..8df95c5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
@@ -495,6 +495,32 @@
});
}
+ Future<void> test_withClass_catchClause() async {
+ addSource('/home/test/lib/lib.dart', '''
+class Test {}
+''');
+ await resolveTestUnit('''
+void f() {
+ try {
+ print(1);
+ } on Test {
+ print(2);
+ }
+}
+''');
+ await assertHasFix('''
+import 'package:test/lib.dart';
+
+void f() {
+ try {
+ print(1);
+ } on Test {
+ print(2);
+ }
+}
+''');
+ }
+
Future<void> test_withTopLevelVariable() async {
addSource('/home/test/lib/lib.dart', '''
library lib;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_empty_catch_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_empty_catch_test.dart
index 5d83554..de5aedd 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_empty_catch_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_empty_catch_test.dart
@@ -23,6 +23,17 @@
@override
String get lintCode => LintNames.empty_catches;
+ Future<void> test_incompleteCatch() async {
+ await resolveTestUnit('''
+void foo() {
+ try {
+ 1;
+ } catch 2;
+}
+''');
+ assertNoExceptions();
+ }
+
Future<void> test_singleCatch_finally_newLine() async {
await resolveTestUnit('''
void foo() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_if_null_operator_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_if_null_operator_test.dart
index 17c760d..20529c8 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_if_null_operator_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_if_null_operator_test.dart
@@ -11,12 +11,43 @@
void main() {
defineReflectiveSuite(() {
- defineReflectiveTests(RemoveIfNullOperatorTest);
+ defineReflectiveTests(DeadNullAwareExpressionTest);
+ defineReflectiveTests(UnnecessaryNullInIfNullOperatorsTest);
});
}
@reflectiveTest
-class RemoveIfNullOperatorTest extends FixProcessorLintTest {
+class DeadNullAwareExpressionTest extends FixProcessorTest {
+ @override
+ FixKind get kind => DartFixKind.REMOVE_IF_NULL_OPERATOR;
+
+ @override
+ void setUp() {
+ super.setUp();
+ createAnalysisOptionsFile(experiments: ['non-nullable']);
+ }
+
+ Future<void> test_immediateChild() async {
+ await resolveTestUnit('''
+int f(int a, int b) => a ?? b;
+''');
+ await assertHasFix('''
+int f(int a, int b) => a;
+''');
+ }
+
+ Future<void> test_nestedChild() async {
+ await resolveTestUnit('''
+int f(int a, int b) => a ?? b * 2 + 1;
+''');
+ await assertHasFix('''
+int f(int a, int b) => a;
+''');
+ }
+}
+
+@reflectiveTest
+class UnnecessaryNullInIfNullOperatorsTest extends FixProcessorLintTest {
@override
FixKind get kind => DartFixKind.REMOVE_IF_NULL_OPERATOR;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart
index 5b35b7c..ef2456c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart
@@ -120,7 +120,7 @@
''');
}
- /// TODO(scheglov) This test will fail with NNBD SDK.
+ @FailingTest(issue: 'https://github.com/dart-lang/linter/issues/1997')
Future<void> test_method_toString() async {
await resolveTestUnit('''
class A {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_element_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_element_test.dart
index 2160a9c..12d377c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_element_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_element_test.dart
@@ -194,15 +194,31 @@
await assertNoFix();
}
- Future<void> test_topLevelVariable_notUsed_noReference() async {
+ Future<void> test_topLevelVariable_notUsed_noReference_first() async {
await resolveTestUnit(r'''
-int _a = 1;
-main() {
-}
+int _a = 1, b = 2;
''');
await assertHasFix(r'''
-main() {
-}
+int b = 2;
+''');
+ }
+
+ Future<void> test_topLevelVariable_notUsed_noReference_last() async {
+ await resolveTestUnit(r'''
+int a = 1, _b = 2;
+''');
+ await assertHasFix(r'''
+int a = 1;
+''');
+ }
+
+ Future<void> test_topLevelVariable_notUsed_noReference_only() async {
+ await resolveTestUnit(r'''
+int _a = 1;
+main() {}
+''');
+ await assertHasFix(r'''
+main() {}
''');
}
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart
index 99ea7c3..f26a92e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart
@@ -111,7 +111,7 @@
''');
}
- Future<void> test_unusedField_notUsed_declarationList() async {
+ Future<void> test_unusedField_notUsed_declarationList_first() async {
await resolveTestUnit(r'''
class A {
int _f, x;
@@ -130,7 +130,7 @@
''');
}
- Future<void> test_unusedField_notUsed_declarationList2() async {
+ Future<void> test_unusedField_notUsed_declarationList_last() async {
await resolveTestUnit(r'''
class A {
int x, _f;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_null_with_closure_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_null_with_closure_test.dart
index e26569b..a246435 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_null_with_closure_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_null_with_closure_test.dart
@@ -36,6 +36,7 @@
''');
}
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/40578')
Future<void> test_named_withArgs() async {
await resolveTestUnit('''
void f(String s) {
diff --git a/pkg/analysis_server/tool/completion_metrics/corpus.dart b/pkg/analysis_server/tool/completion_metrics/corpus.dart
new file mode 100644
index 0000000..dfb4bdb9
--- /dev/null
+++ b/pkg/analysis_server/tool/completion_metrics/corpus.dart
@@ -0,0 +1,156 @@
+// Copyright (c) 2020, 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:convert';
+import 'dart:io';
+
+import 'package:html/parser.dart' show parse;
+import 'package:http/http.dart' as http;
+import 'package:path/path.dart' as path;
+
+/// Generate or update corpus data.
+/// Input is a list of directories, or a file containing such a list.
+/// Output is produced in a `~/completion_metrics/third_party/apps` directory.
+Future<void> main(List<String> args) async {
+ if (args.isEmpty) {
+ print('A file name or list of directories is required.');
+ exit(1);
+ }
+
+ final repos = [];
+ if (args.length == 1 && !Directory(args[0]).existsSync()) {
+ final contents = File(args[0]).readAsStringSync();
+ repos.addAll(LineSplitter().convert(contents));
+ } else {
+ repos.addAll(args);
+ }
+
+ if (!Directory(_appDir).existsSync()) {
+ print('Creating: $_appDir');
+ Directory(_appDir).createSync(recursive: true);
+ }
+
+ print('Cloning repositories...');
+ if (!updateExistingClones) {
+ print('(Skipping git updates.)');
+ }
+ for (var repo in repos) {
+ final clone = await _clone(_trimName(repo));
+ if (clone.exitCode != 0) {
+ print('Error cloning $repo: ${clone.msg}');
+ } else {
+ await _runPub(clone.directory);
+ if (recurseForDependencies) {
+ for (var dir in Directory(clone.directory).listSync(recursive: true)) {
+ await _runPubGet(dir);
+ }
+ }
+ }
+ }
+}
+
+/// Whether to force a pub get if a package config is found.
+final forcePubUpdate = false;
+
+/// Whether to recurse into projects when installing dependencies.
+final recurseForDependencies = true;
+
+/// Whether to update existing clones.
+final updateExistingClones = false;
+
+final _appDir =
+ path.join(_homeDir, 'completion_metrics', 'third_party', 'apps');
+final _client = http.Client();
+
+final _homeDir = Platform.isWindows
+ ? Platform.environment['LOCALAPPDATA']
+ : Platform.environment['HOME'];
+
+final _package_config = path.join('.dart_tool', 'package_config.json');
+
+Future<CloneResult> _clone(String repo) async {
+ final name =
+ _trimName(repo.split('https://github.com/').last.replaceAll('/', '_'));
+ final cloneDir = path.join(_appDir, name);
+ var result;
+ if (Directory(cloneDir).existsSync()) {
+ if (!updateExistingClones) {
+ return CloneResult(0, cloneDir);
+ }
+ print('Repository "$name" exists -- pulling to update');
+ result = await Process.run('git', ['pull'], workingDirectory: cloneDir);
+ } else {
+ print('Cloning $repo to $cloneDir');
+ result = await Process.run('git', ['clone', '$repo.git', cloneDir]);
+ }
+ return CloneResult(result.exitCode, cloneDir, msg: result.stderr);
+}
+
+Future<String> _getBody(String url) async => (await _getResponse(url)).body;
+
+Future<http.Response> _getResponse(String url) async => _client
+ .get(url, headers: const {'User-Agent': 'dart.pkg.completion_metrics'});
+
+bool _hasPubspec(FileSystemEntity f) =>
+ f is Directory && File(path.join(f.path, 'pubspec.yaml')).existsSync();
+
+Future<ProcessResult> _runPub(String dir) async =>
+ await Process.run('flutter', ['pub', 'get'], workingDirectory: dir);
+
+Future<void> _runPubGet(FileSystemEntity dir) async {
+ if (_hasPubspec(dir)) {
+ final packageFile = path.join(dir.path, _package_config);
+ if (!File(packageFile).existsSync() || forcePubUpdate) {
+ print(
+ 'Updating pub dependencies for "${path.relative(dir.path, from: _appDir)}"...');
+ final pubRun = await _runPub(dir.path);
+ if (pubRun.exitCode != 0) {
+ print('Error: ' + pubRun.stderr);
+ }
+ }
+ }
+}
+
+String _trimName(String name) {
+ while (name.endsWith('/')) {
+ name = name.substring(0, name.length - 1);
+ }
+ return name;
+}
+
+class CloneResult {
+ final String directory;
+ final int exitCode;
+ final String msg;
+ CloneResult(this.exitCode, this.directory, {this.msg = ''});
+}
+
+class RepoList {
+ static const itsallwidgetsRssFeed = 'https://itsallwidgets.com/app/feed';
+
+ // (Re) generate the list of github repos on itsallwidgets.com
+ static Future<List<String>> fromItsAllWidgetsRssFeed() async {
+ final repos = <String>{};
+
+ final body = await _getBody(itsallwidgetsRssFeed);
+ final doc = parse(body);
+ final entries = doc.querySelectorAll('entry');
+ for (var entry in entries) {
+ final link = entry.querySelector('link');
+ final href = link.attributes['href'];
+ final body = await _getBody(href);
+ final doc = parse(body);
+ final links = doc.querySelectorAll('a');
+ for (var link in links) {
+ final href = link.attributes['href'];
+ if (href != null && href.startsWith('https://github.com/')) {
+ print(href);
+ repos.add(href);
+ continue;
+ }
+ }
+ }
+ return repos.toList();
+ }
+}
diff --git a/pkg/analysis_server/tool/completion_metrics/data/itsallwidgets_repos.txt b/pkg/analysis_server/tool/completion_metrics/data/itsallwidgets_repos.txt
new file mode 100644
index 0000000..5258107
--- /dev/null
+++ b/pkg/analysis_server/tool/completion_metrics/data/itsallwidgets_repos.txt
@@ -0,0 +1,327 @@
+https://github.com/FrazileDevelopers/FoodWallfy
+https://github.com/marchelo/developers-life-flutter
+https://github.com/bittenbytailfly/OnDemandOverdrive
+https://github.com/zesage/panorama
+https://github.com/3rsin3rgul/Release-Date
+https://github.com/champ96k/Spotify-Clone-in-Flutter
+https://github.com/TheAlphamerc/flutter_smart_course
+https://github.com/NandanSatheesh/Rick-And-Morty-Flutter-App
+https://github.com/marchellodev/sharik
+https://github.com/HoussemTN/Al-quran-Al-karim
+https://github.com/amhirin/eduprog_imei_validator
+https://github.com/amhirin/eduprog_game_math
+https://github.com/shenoyganeshprasad/Wallet-App-UI-Flutter
+https://github.com/noobcoder17/my_todo
+https://github.com/Jagjot26/ifAlz
+https://github.com/sidinaz/daggerito
+https://github.com/theindianappguy/applandingpage
+https://github.com/TheAlphamerc/flutter_login_signup
+https://github.com/shenoyganeshprasad/Wallpaper-App-Flutter
+https://github.com/theindianappguy/gradientbazaar
+https://github.com/theindianappguy/TinderGoldRedesign
+https://github.com/athulantonynp/InspiredMonster-Web-Flutter
+https://github.com/OpenConsultingGroup/Taxi-App
+https://github.com/pmathulan/Flutter-Music-Player-UI
+https://github.com/akshayyadav76/quiz_app
+https://github.com/henriquearthur/congressos-sereducacional
+https://github.com/himanshusharma89/Flutter-Blog-App
+https://github.com/xclud/flutter_crop
+https://github.com/ionicfirebaseapp/getflutter
+https://github.com/FlutterEurope/conference2020/
+https://github.com/ibrahimq21/realestate_app
+https://github.com/spidgorny/workingtimealert
+https://github.com/KiritchoukC/flutter_web_2048
+https://github.com/adcaine/flutter_binary_clock
+https://github.com/jeremySrgt/lynightProject
+https://github.com/GitJournal/GitJournal
+https://github.com/deandreamatias/tv-randshow/
+https://github.com/luizeof/flucast_app
+https://github.com/f2acode/computeiro
+https://github.com/Jagjot26/FlashChat
+https://github.com/theindianappguy/share_link_generator
+https://github.com/theindianappguy/whatsapp_link_generator
+https://github.com/bipin000/jagnik
+https://github.com/ricken07/flutter_challenge_chat_ui
+https://github.com/sagarshende23/flutter_liquid_swipe
+https://github.com/anirudhsharma392/portfolio_flutter
+https://github.com/HoussemTN/localizator
+https://github.com/shenoyganeshprasad/quotes_flutter
+https://github.com/JonathanSchndr/flutter-easy-fasting
+https://github.com/bimsina/reWalls
+https://github.com/zesage/flutter_cube
+https://github.com/Skyost/Beerstory
+https://github.com/srajpal/bmi_calculator/
+https://github.com/zesage/flutter_earth
+https://github.com/ronak197/Dearly
+https://github.com/YounesBenketira/Mobile-Compound-Interest-Calculator
+https://github.com/xyarim/upsplash-flutter
+https://github.com/ronak197/travex
+https://github.com/AubergineDevelopers/Platypus
+https://github.com/Tomison-E/ballers
+https://github.com/haadinorouzi/TicTocToe
+https://github.com/Albert221/Glance
+https://github.com/kickwaxapps/xcski-racer-points
+https://github.com/aeri/Nihonoari-App
+https://github.com/Ayman-Barghout/urban-dictionary-app
+https://github.com/Alameen688/dear_diary
+https://github.com/Tomison-E/Fantasy_footballTeam
+https://github.com/tavasolireza/Hangman-Game-Flutter
+https://github.com/tutecode/gente_toxica_app
+https://github.com/zubairehman/Portfolio-Demo
+https://github.com/bimsina/NotHotDog
+https://github.com/FredJul/Warmd
+https://github.com/YexelaV/memory_game
+https://github.com/amarell/germas
+https://github.com/LittleLightForDestiny/littlelight
+https://github.com/lukasschneiderapps/death_timer
+https://github.com/mouryaavadhesh/flutterpublicapp
+https://github.com/noobcoder17/solar_system
+https://github.com/lukasschneiderapps/coding_interview
+https://github.com/sagarshende23/flutter_zomato_ui
+https://github.com/Asti7/HelloWorldApp
+https://github.com/sagarshende23/flutter_native_ads_demo
+https://github.com/Maadhav/flutter-charity-donation-app-concept
+https://github.com/donwardpeng/midevfest
+https://github.com/Maadhav/flutter-youtube-redesign
+https://github.com/cingulo/flutter-sample
+https://github.com/D10100111001/minesweeper_online
+https://github.com/Maadhav/flutter-login-ui-concept
+https://github.com/cross-solutions/smart-notes
+https://github.com/Kasiits/FLUTTER-UI-Showcase
+https://github.com/Physicx101/Joinmun
+https://github.com/Maadhav/Happy-Diwali-Flutter-App
+https://github.com/adlucio87/YoutubeApiChannel
+https://github.com/ayush221b/newsline
+https://github.com/sidinaz/routex
+https://github.com/lukasschneiderapps/inf_sim_open
+https://github.com/fpagano/mlkit
+https://github.com/Zaouat/Muside
+https://github.com/oneLab-Projects/Construct-Diet
+https://github.com/Fenil-Nividata/FlutterBMI
+https://github.com/imtiyaz125/repositories
+https://github.com/skenderl/Flutter-LiteMorseTrainer
+https://github.com/skenderl/Flutter-BabyStepsQuiz
+https://github.com/giantsol/Blue-Diary
+https://github.com/janoodleFTW/timy-messenger
+https://github.com/EdvaldoMartins/flutter_annotations
+https://github.com/dbarton-uk/classic-wow-talents
+https://github.com/henriquearthur/simulador_timbeta
+https://github.com/dronwork/flutter_su
+https://github.com/ketanchoyal/InstaKnow
+https://github.com/nikhil269/sport-news
+https://github.com/roberto198907/flutterweb_landingpage
+https://github.com/cbonello/amiidex
+https://github.com/leandrogaluzzi/little-birds-flutter
+https://github.com/SSebigo/ahhhhhh
+https://github.com/ayusuke7/GeniusCollor
+https://github.com/sashko/speak_nato
+https://github.com/sagarshende23/reflectly-like-loginpage-flutter
+https://github.com/henriquearthur/congresso-unama
+https://github.com/authpass/authpass
+https://github.com/jacwib/ttschedule-but-its-just-a-link-to-my-gitlab-lol
+https://github.com/KlausJokinen/PocketBus
+https://github.com/pranaypatel512/FlutterLogin
+https://github.com/dasfoo/delern
+https://github.com/piyushsinha24/QuizAdda
+https://github.com/aagarwal1012/Liquid-Pull-To-Refresh
+https://github.com/skenderl/Flutter-UniversalController
+https://github.com/yowsa/Squatting
+https://github.com/kumar-aakash86/flutter_overboard
+https://github.com/EdwynZN/amiibo_network
+https://github.com/heejongahn/galpi
+https://github.com/newtonmunene99/tasker
+https://github.com/berkekurnaz/Semsiye
+https://github.com/luckycreationsindia/skroller
+https://github.com/appditto/blaise_wallet_flutter
+https://github.com/annshsingh/flutter-widget-guide
+https://github.com/Imgkl/Quote
+https://github.com/sbvkrishna/tictactoe-flutter
+https://github.com/divyanshub024/chitr
+https://github.com/Ali-Amin/shopx
+https://github.com/BaranMichal25/my_quotes
+https://github.com/thamaraiselvam/Numbers-Flutter-Game
+https://github.com/iambaljeet/baljeet_portfolio
+https://github.com/sterrenburg/flutterhole/
+https://github.com/iambaljeet/single_page_portfolio
+https://github.com/jancen-widmer/sight-check
+https://github.com/insin/vlc_remote
+https://github.com/jenthone/flutter_paint
+https://github.com/Skyost/CarPark
+https://github.com/chimon2000/hashnode
+https://github.com/thienlhh/flutter_simple_weather
+https://github.com/Tapaswi846580/Orientation_Week_Management
+https://github.com/KarimElghamry/cryptoholic
+https://github.com/torbenkeller/Bierzaehler
+https://github.com/cybdom/cloud_storage_status
+https://github.com/polina-c/flutter-auth-ui
+https://github.com/cybdom/flutter_crypto
+https://github.com/one-aalam/new-kid-to-bloc
+https://github.com/HossamElghamry/FLX
+https://github.com/viveky259259/emi_engagement
+https://github.com/gat786/quizappnew
+https://github.com/kevmoo/slide_puzzle
+https://github.com/Fabian-Stein/timeflow
+https://github.com/Datlyfe/flutter_tic_tac
+https://github.com/KarimElghamry/chillify
+https://github.com/Nicuz/Calcolapizza
+https://github.com/urmilshroff/dashboard_reborn
+https://github.com/urmilshroff/goalkeeper
+https://github.com/mkiisoft/taphero
+https://github.com/peakcool/flutter_news_watch
+https://github.com/ha-yi/flutter_showcases_bdd_mataram
+https://github.com/yudiz-solutions/yudiz_modal_sheet
+https://github.com/MobMaxime/FlagQuiz-Flutter
+https://github.com/MobMaxime/Flutter-To-Do-App
+https://github.com/sha3rawi33/Sehhetna
+https://github.com/ygunduz/siirdefterim
+https://github.com/roshanrahman/flutter-notes-app
+https://github.com/apps4bali/gatrabali-app
+https://github.com/artrmz/expenses-pal
+https://github.com/andersonmendess/Weather_Flutter
+https://github.com/deep-gaurav/MusicPiped/
+https://github.com/gligerglg/geodropin
+https://github.com/DevarshRanpara/UI_Design
+https://github.com/therealbitcoinclub/flutter_coinector
+https://github.com/iatsu/screeler
+https://github.com/CodeNextGen/youtube_redesign
+https://github.com/Levi-ackerman/my-note
+https://github.com/sagarshende23/Simple_calculator_flutter
+https://github.com/deven98/MetaFlutter
+https://github.com/mtwn105/Cipherly
+https://github.com/hifiaz/Qurani
+https://github.com/bimsina/Matinee-Flutter
+https://github.com/singhbhavneet/Flutter-Dribbble-Challenge
+https://github.com/hujianhang2996/forget
+https://github.com/sebyjt/locatecab
+https://github.com/adar2378/tip_calculator/
+https://github.com/AppleEducate/flutter_piano
+https://github.com/bimsina/notes-app
+https://github.com/itzmeanjan/locate
+https://github.com/herovickers/world_holidays
+https://github.com/bimsina/wallpaper
+https://github.com/dreamsoftin/facebook_audience_network
+https://github.com/flutter/samples
+https://github.com/iatsu/imaginate
+https://github.com/yum650350/tissuebox
+https://github.com/qsvtr/FoodScan
+https://github.com/shashilaheshan/movie-ui-app-flutter
+https://github.com/huangyanxiong01/Github-Trending-App
+https://github.com/lohanidamodar/flutter_ui_challenges
+https://github.com/itzmeanjan/transferZ
+https://github.com/bimsina/recipes
+https://github.com/NhaPCS/ezquiz_jp_flutter
+https://github.com/berger89/hmpaisrn
+https://github.com/xieweizhi/tubi_tv_flutter
+https://github.com/jesusrp98/space-curiosity
+https://github.com/mohak1283/Instagram-Clone
+https://github.com/itzmeanjan/fCreate
+https://github.com/MotionMobs/Sandwhich
+https://github.com/nitinmehtaa/Messenger
+https://github.com/itzmeanjan/locatorz
+https://github.com/huextrat/BurnOff
+https://github.com/CaramelDunes/nyanya_rocket
+https://github.com/hillelcoren/mudeo
+https://github.com/itzmeanjan/astroZ
+https://github.com/kalismeras61/flutter_wallet_ui
+https://github.com/mohak1283/Flutter-UIs-Collection
+https://github.com/bapspatil/kut_in
+https://github.com/SubirZ/Awesome_Flutter_UI
+https://github.com/cornetthomas/death_by_meeting/
+https://github.com/pidugusundeep/BMI_Flutter
+https://github.com/appditto/natrium_wallet_flutter
+https://github.com/JuniperPhoton/SwitchDecor
+https://github.com/json469/sound_doctrine
+https://github.com/dreamsoftin/flutter_wordpress
+https://github.com/itzmeanjan/sensorz/
+https://github.com/sabinbajracharya/fluttery-todo
+https://github.com/DiazMolina/Plants_Market
+https://github.com/Gabriel-Araujo/lineage2_servers_status
+https://github.com/rolimans/bingo_piadista
+https://github.com/berkekurnaz/ListeApp
+https://github.com/rxlabz/panache
+https://github.com/chinotapales/FlutterCurrencyConverter
+https://github.com/richie-south/ultimate_pi
+https://github.com/foxanna/WWW-flutter
+https://github.com/pedromassango/xtimer-flutter-app
+https://github.com/bananocoin/kalium_wallet_flutter
+https://github.com/eemp/NetcastsOSS
+https://github.com/vintage/party_flutter
+https://github.com/huanxsd/flutter_shuqi
+https://github.com/sagarprince/flutter_movies_app
+https://github.com/magnatronus/flutter-watchtips
+https://github.com/benadrasni/abherbs_flutter
+https://github.com/shubhamhackz/flutter-calculator
+https://github.com/kaparray/NewsDaily
+https://github.com/wchaowu/flutter_sample
+https://github.com/Renesanse/flickr_gallery
+https://github.com/Renesanse/popular_news
+https://github.com/Knove/flutter_gomoku
+https://github.com/Schwusch/codestats_flutter
+https://github.com/geovannyAndrew/speedrun.com
+https://github.com/abhay994/comboshoppers
+https://github.com/singhbhavneet/bungee
+https://github.com/AChep/15puzzle
+https://github.com/arslanaybars/MQuote
+https://github.com/CoolONEOfficial/ranepa_timetable
+https://github.com/Albert221/FastShopping
+https://github.com/Sky24n/flutter_wanandroid
+https://github.com/parth181195/bad-dad-joke
+https://github.com/X-Wei/flutter_catalog
+https://github.com/hpoul/finalyzer-game/
+https://github.com/ibhavikmakwana/cricket_team
+https://github.com/ibhavikmakwana/itsallwidgets_podcast
+https://github.com/ReindertKorver/Hoornbeeck-Rooster-app
+https://github.com/Naveen108/noteslock-Public
+https://github.com/ncosgray/cuppa_mobile/
+https://github.com/xsahil03x/Flutter-News-Reader
+https://github.com/aleksanderwozniak/deer
+https://github.com/Xbobo5530/linki
+https://github.com/Xbobo5530/chipkizi
+https://github.com/HaitaoYue/GithubTrender
+https://github.com/luyongfugx/flutter_ocr
+https://github.com/bizz84/flight_co2_calculator_flutter
+https://github.com/IKatsuba/frontend_notes
+https://github.com/ibhavikmakwana/FlutterPlayground
+https://github.com/follow2vivek/FlutterMovieDetail
+https://github.com/zhangjianli/flutter_news
+https://github.com/rotoxl/flutter_magic
+https://github.com/numcol/numcol
+https://github.com/mth2610/flutter_ap
+https://github.com/GroovinChip/CallManager
+https://github.com/wakahuula/xkcdViewer
+https://github.com/nitinmehtaa/e-commerce-suit-in-flutter
+https://github.com/sudhanshu-15/sunapsisConference2018Flutter
+https://github.com/Blakexx/PPoll_Redesign
+https://github.com/artrmz/wartermaniac
+https://github.com/parth181195/flutter-quotes
+https://github.com/huextrat/TheGorgeousLogin
+https://github.com/DK15/tour-guide-flutter
+https://github.com/naumanahmed19/flutter_play
+https://github.com/huextrat/Taskist
+https://github.com/MDSADABWASIM/Toughest
+https://github.com/jesusrp98/spacex-go
+https://github.com/trentpiercy/trace
+https://github.com/jmolins/flutboard
+https://github.com/zeyadkhaled/TemporaryContacts
+https://github.com/ConProgramming/circle_sketcher
+https://github.com/linusyoung/NASAApodViewer
+https://github.com/kserko/CineReel
+https://github.com/Rahiche/flutter_jobs_app
+https://github.com/Blakexx/CryptoTracker
+https://github.com/dazza5000/austin-feeds-me-flutter
+https://github.com/andreidiaconu/FlutterPalette
+https://github.com/MarcinusX/super_simple_budget
+https://github.com/MSzalek-Mobile/weight_tracker
+https://github.com/MDSADABWASIM/You
+https://github.com/ibhavikmakwana/Fluttery-Filmy
+https://github.com/avirias/Grey
+https://github.com/huextrat/CryptoShadow
+https://github.com/RafaelBarbosatec/flutter_news
+https://github.com/rohan20/flutter-chat-app
+https://github.com/vivekaris/flutter_wordcamp
+https://github.com/mdanics/fluttergram
+https://github.com/Sharvin26/BMI
+https://github.com/iampawan/Flutter-Music-Player
+https://github.com/roughike/inKino
+https://github.com/burhanrashid52/WhatTodo
+https://github.com/invoiceninja/flutter-mobile/
diff --git a/pkg/analysis_server/tool/completion_metrics/relevance_metrics.dart b/pkg/analysis_server/tool/completion_metrics/relevance_metrics.dart
index 1c6e0d3..0a864d8 100644
--- a/pkg/analysis_server/tool/completion_metrics/relevance_metrics.dart
+++ b/pkg/analysis_server/tool/completion_metrics/relevance_metrics.dart
@@ -30,6 +30,7 @@
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/generated/engine.dart';
+import 'package:path/path.dart' as path;
Future<void> main(List<String> args) async {
var out = io.stdout;
@@ -39,7 +40,8 @@
io.exit(1);
}
- var rootPath = args[0];
+ var corpus = args[0] == '--corpus';
+ var rootPath = corpus ? args[1] : args[0];
out.writeln('Analyzing root: \"$rootPath\"');
if (!io.Directory(rootPath).existsSync()) {
out.writeln('\tError: No such directory exists on this machine.\n');
@@ -49,7 +51,7 @@
var computer = RelevanceMetricsComputer();
var stopwatch = Stopwatch();
stopwatch.start();
- await computer.compute(rootPath);
+ await computer.compute(rootPath, corpus: corpus);
stopwatch.stop();
var duration = Duration(milliseconds: stopwatch.elapsedMilliseconds);
out.writeln(' Metrics computed in $duration');
@@ -71,15 +73,16 @@
/// A table mapping element kinds to counts by context.
Map<String, Map<String, int>> byElementKind = {};
- /// A table mapping AST node classes to counts by context.
- Map<String, Map<String, int>> byNodeClass = {};
-
/// A table mapping token types to counts by context.
Map<String, Map<String, int>> byTokenType = {};
/// A table mapping match types to counts by kind of type match.
Map<String, Map<String, int>> byTypeMatch = {};
+ /// A table mapping the depth of a target type to the distance between the
+ /// target type and the member type.
+ Map<int, Map<int, int>> distanceByDepthMap = {};
+
/// A table mapping distances from an identifier to the nearest previous token
/// with the same lexeme to the number of times that distance was found.
Map<int, int> tokenDistances = {};
@@ -97,9 +100,9 @@
void addDataFrom(RelevanceData data) {
_addToMap(byDistance, data.byDistance);
_addToMap(byElementKind, data.byElementKind);
- _addToMap(byNodeClass, data.byNodeClass);
_addToMap(byTokenType, data.byTokenType);
_addToMap(byTypeMatch, data.byTypeMatch);
+ _addToMap(distanceByDepthMap, distanceByDepthMap);
}
/// Record that a reference to an element was found and that the distance
@@ -111,6 +114,13 @@
contextMap[key] = (contextMap[key] ?? 0) + 1;
}
+ /// Given a member accessed on a target, record the distance between the
+ /// target class and the member class by the depth of the target class.
+ void recordDistanceByDepth(int targetDepth, int memberDistance) {
+ var innerMap = distanceByDepthMap.putIfAbsent(memberDistance, () => {});
+ innerMap[targetDepth] = (innerMap[targetDepth] ?? 0) + 1;
+ }
+
/// Record that an element of the given [kind] was found in the given
/// [context].
void recordElementKind(String context, ElementKind kind) {
@@ -119,17 +129,6 @@
contextMap[key] = (contextMap[key] ?? 0) + 1;
}
- /// Record that an element of the given [node] was found in the given
- /// [context].
- void recordNodeClass(String context, AstNode node) {
- var contextMap = byNodeClass.putIfAbsent(context, () => {});
- var className = node.runtimeType.toString();
- if (className.endsWith('Impl')) {
- className = className.substring(0, className.length - 4);
- }
- contextMap[className] = (contextMap[className] ?? 0) + 1;
- }
-
/// Record information about the distance between recurring tokens.
void recordTokenStream(int distance) {
tokenDistances[distance] = (tokenDistances[distance] ?? 0) + 1;
@@ -155,15 +154,14 @@
'version': currentVersion,
'byDistance': byDistance,
'byElementKind': byElementKind,
- 'byNodeClass': byNodeClass,
'byTokenType': byTokenType,
'byTypeMatch': byTypeMatch,
+ 'distanceByDepthMap': _encodeIntIntMap(distanceByDepthMap),
});
}
/// Add the data in the [source] map to the [target] map.
- void _addToMap(Map<String, Map<String, int>> target,
- Map<String, Map<String, int>> source) {
+ void _addToMap<K>(Map<K, Map<K, int>> target, Map<K, Map<K, int>> source) {
for (var outerEntry in source.entries) {
var innerTarget = target.putIfAbsent(outerEntry.key, () => {});
for (var innerEntry in outerEntry.value.entries) {
@@ -182,6 +180,22 @@
/// Decode the content of the [source] map into the [target] map, using the
/// [keyMapper] to map the inner keys from a string to a [T].
+ void _decodeIntIntMap(
+ Map<int, Map<int, int>> target, Map<String, dynamic> source) {
+ var outerMap = _convert(source);
+ for (var outerEntry in outerMap.entries) {
+ var outerKey = int.parse(outerEntry.key);
+ var innerMap = _convert(outerEntry.value);
+ for (var innerEntry in innerMap.entries) {
+ var innerKey = int.parse(innerEntry.key);
+ var count = innerEntry.value as int;
+ target.putIfAbsent(outerKey, () => {})[innerKey] = count;
+ }
+ }
+ }
+
+ /// Decode the content of the [source] map into the [target] map, using the
+ /// [keyMapper] to map the inner keys from a string to a [T].
void _decodeMap(
Map<String, Map<String, int>> target, Map<String, dynamic> source) {
var outerMap = _convert(source);
@@ -196,6 +210,18 @@
}
}
+ Map<String, Map<String, int>> _encodeIntIntMap(Map<int, Map<int, int>> map) {
+ var result = <String, Map<String, int>>{};
+ for (var outerEntry in map.entries) {
+ var convertedInner = <String, int>{};
+ for (var innerEntry in outerEntry.value.entries) {
+ convertedInner[innerEntry.key.toString()] = innerEntry.value;
+ }
+ result[outerEntry.key.toString()] = convertedInner;
+ }
+ return result;
+ }
+
/// Initialize the state of this object from the given JSON encoded [content].
void _initializeFromJson(String content) {
var contentObject = _convert(json.decode(content));
@@ -206,9 +232,9 @@
}
_decodeMap(byDistance, contentObject['byDistance']);
_decodeMap(byElementKind, contentObject['byElementKind']);
- _decodeMap(byNodeClass, contentObject['byNodeClass']);
_decodeMap(byTokenType, contentObject['byTokenType']);
_decodeMap(byTypeMatch, contentObject['byTypeMatch']);
+ _decodeIntIntMap(distanceByDepthMap, contentObject['distanceByDepthMap']);
}
}
@@ -290,13 +316,19 @@
@override
void visitArgumentList(ArgumentList node) {
+ String context = _argumentListContext(node);
for (var argument in node.arguments) {
if (argument is NamedExpression) {
- _recordDataForNode('ArgumentList (named)', argument.expression,
+ _recordDataForNode('ArgumentList (all, named)', argument.expression,
+ allowedKeywords: expressionKeywords);
+ _recordDataForNode(
+ 'ArgumentList ($context, named)', argument.expression,
allowedKeywords: expressionKeywords);
_recordTypeMatch(argument.expression);
} else {
- _recordDataForNode('ArgumentList (unnamed)', argument,
+ _recordDataForNode('ArgumentList (all, unnamed)', argument,
+ allowedKeywords: expressionKeywords);
+ _recordDataForNode('ArgumentList ($context, unnamed)', argument,
allowedKeywords: expressionKeywords);
_recordTypeMatch(argument);
}
@@ -447,7 +479,6 @@
void visitCommentReference(CommentReference node) {
void recordDataForCommentReference(String context, AstNode node) {
_recordElementKind(context, node);
- _recordNodeClass(context, node);
_recordTokenType(context, node);
}
@@ -459,6 +490,7 @@
void visitCompilationUnit(CompilationUnit node) {
enclosingLibrary = node.declaredElement.library;
typeSystem = enclosingLibrary.typeSystem;
+ inheritanceManager = InheritanceManager3();
for (var directive in node.directives) {
_recordTokenType('CompilationUnit (directive)', directive,
@@ -472,6 +504,7 @@
typeSystem = null;
enclosingLibrary = null;
+ inheritanceManager = null;
}
@override
@@ -663,7 +696,6 @@
@override
void visitForElement(ForElement node) {
- _recordNodeClass('ForElement (parts)', node.forLoopParts);
_recordTokenType('ForElement (parts)', node.forLoopParts);
_recordDataForNode('ForElement (body)', node.body);
super.visitForElement(node);
@@ -702,7 +734,6 @@
@override
void visitForStatement(ForStatement node) {
- _recordNodeClass('ForElement (parts)', node.forLoopParts);
_recordTokenType('ForElement (parts)', node.forLoopParts);
_recordDataForNode('ForElement (body)', node.body,
allowedKeywords: statementKeywords);
@@ -907,7 +938,7 @@
void visitMethodDeclaration(MethodDeclaration node) {
// There are no completions.
var element = node.declaredElement;
- if (!element.isStatic) {
+ if (!element.isStatic && element.enclosingElement is ClassElement) {
var overriddenMembers = inheritanceManager.getOverridden(
(element.enclosingElement as ClassElement).thisType,
Name(element.librarySource.uri, element.name));
@@ -1247,6 +1278,34 @@
super.visitYieldStatement(node);
}
+ /// Return the context in which the [node] occurs. The [node] is expected to
+ /// be the parent of the argument expression.
+ String _argumentListContext(AstNode node) {
+ if (node is ArgumentList) {
+ var parent = node.parent;
+ if (parent is InstanceCreationExpression) {
+ return 'constructor';
+ } else if (parent is MethodInvocation) {
+ return 'method';
+ } else if (parent is FunctionExpressionInvocation) {
+ return 'function';
+ } else if (parent is SuperConstructorInvocation ||
+ parent is RedirectingConstructorInvocation) {
+ return 'constructor redirect';
+ } else if (parent is Annotation) {
+ return 'annotation';
+ }
+ } else if (node is IndexExpression) {
+ return 'index';
+ } else if (node is AssignmentExpression ||
+ node is BinaryExpression ||
+ node is PrefixExpression ||
+ node is PostfixExpression) {
+ return 'binary/unary';
+ }
+ return 'unknown';
+ }
+
/// Return the depth of the given [element]. For example:
/// 0: imported
/// 1: prefix
@@ -1433,7 +1492,6 @@
void _recordDataForNode(String context, AstNode node,
{List<Keyword> allowedKeywords = noKeywords}) {
_recordElementKind(context, node);
- _recordNodeClass(context, node);
_recordReferenceDepth(node);
_recordTokenDistance(node);
_recordTokenType(context, node, allowedKeywords: allowedKeywords);
@@ -1462,30 +1520,32 @@
}
/// Record the distance between the static type of the target (the
- /// [targetType]) and the [element] to which the member reference was
- /// resolved.
- void _recordMemberDepth(DartType targetType, Element element) {
+ /// [targetType]) and the [member] to which the reference was resolved.
+ void _recordMemberDepth(DartType targetType, Element member) {
if (targetType is InterfaceType) {
- var subclass = targetType.element;
- var extension = element.thisOrAncestorOfType<ExtensionElement>();
+ var targetClass = targetType.element;
+ var extension = member.thisOrAncestorOfType<ExtensionElement>();
if (extension != null) {
_recordDistance('member (extension)', 0);
return;
}
// TODO(brianwilkerson) It might be interesting to also know whether the
// [element] was found in a class, interface, or mixin.
- var superclass = element.thisOrAncestorOfType<ClassElement>();
- if (superclass != null) {
+ var memberClass = member.thisOrAncestorOfType<ClassElement>();
+ if (memberClass != null) {
+ /// Return the distance between the [targetClass] and the [memberClass]
+ /// along the superclass chain. This includes all of the implicit
+ /// superclasses caused by mixins.
int getSuperclassDepth() {
var depth = 0;
- var currentClass = subclass;
+ var currentClass = targetClass;
while (currentClass != null) {
- if (currentClass == superclass) {
+ if (currentClass == memberClass) {
return depth;
}
for (var mixin in currentClass.mixins.reversed) {
depth++;
- if (mixin.element == superclass) {
+ if (mixin.element == memberClass) {
return depth;
}
}
@@ -1495,11 +1555,27 @@
return -1;
}
- var notFound = 0xFFFF;
+ /// Return the depth of the [targetClass] in the class hierarchy. This
+ /// includes all of the implicit superclasses caused by mixins.
+ int getTargetDepth() {
+ var depth = 0;
+ var currentClass = targetClass;
+ while (currentClass != null) {
+ depth += currentClass.mixins.length + 1;
+ currentClass = currentClass.supertype?.element;
+ }
+ return depth;
+ }
+
+ const notFound = 0xFFFF;
+
+ /// Return the minimum distance from the [currentClass] to the
+ /// [memberClass] along any inheritance chain (including interfaces).
+ /// This includes paths introduced by mixins.
int getInterfaceDepth(ClassElement currentClass) {
if (currentClass == null) {
return notFound;
- } else if (currentClass == superclass) {
+ } else if (currentClass == memberClass) {
return 0;
}
var minDepth = getInterfaceDepth(currentClass.supertype?.element);
@@ -1519,12 +1595,11 @@
}
int superclassDepth = getSuperclassDepth();
- // TODO(brianwilkerson) Consider cross referencing with the depth of the
- // class containing the reference.
if (superclassDepth >= 0) {
_recordDistance('member (superclass)', superclassDepth);
+ data.recordDistanceByDepth(getTargetDepth(), superclassDepth);
} else {
- int interfaceDepth = getInterfaceDepth(subclass);
+ int interfaceDepth = getInterfaceDepth(targetClass);
if (interfaceDepth < notFound) {
_recordDistance('member (interface)', interfaceDepth);
} else {
@@ -1535,13 +1610,6 @@
}
}
- /// Record the class of the [node] in the given [context].
- void _recordNodeClass(String context, AstNode node) {
- if (node != null) {
- data.recordNodeClass(context, node);
- }
- }
-
void _recordOverride(
ExecutableElement override, ExecutableElement overridden) {
var positionalInOverride = <ParameterElement>[];
@@ -1672,9 +1740,13 @@
if (parameterType == null || parameterType.isDynamic) {
return;
}
+ var context = _argumentListContext(argument.parent);
var argumentType = argument.staticType;
if (argumentType != null) {
- _recordTypeRelationships('argument (whole)', parameterType, argumentType);
+ _recordTypeRelationships(
+ 'argument (all, whole)', parameterType, argumentType);
+ _recordTypeRelationships(
+ 'argument ($context, whole)', parameterType, argumentType);
}
var identifier = _leftMostIdentifier(argument);
if (identifier != null) {
@@ -1692,7 +1764,9 @@
}
if (firstTokenType != null) {
_recordTypeRelationships(
- 'argument (first token)', parameterType, firstTokenType);
+ 'argument (all, first token)', parameterType, firstTokenType);
+ _recordTypeRelationships(
+ 'argument ($context, first token)', parameterType, firstTokenType);
}
}
}
@@ -1723,39 +1797,49 @@
RelevanceMetricsComputer();
/// Compute the metrics for the file(s) in the [rootPath].
- void compute(String rootPath) async {
- final collection = AnalysisContextCollection(
- includedPaths: [rootPath],
- resourceProvider: PhysicalResourceProvider.INSTANCE,
- );
+ /// If [corpus] is true, treat rootPath as a container of packages, creating
+ /// a new context collection for each subdirectory.
+ void compute(String rootPath, {bool corpus}) async {
final collector = RelevanceDataCollector(data);
-
- for (var context in collection.contexts) {
- for (var filePath in context.contextRoot.analyzedFiles()) {
- if (AnalysisEngine.isDartFileName(filePath)) {
- try {
- ResolvedUnitResult resolvedUnitResult =
- await context.currentSession.getResolvedUnit(filePath);
- //
- // Check for errors that cause the file to be skipped.
- //
- if (resolvedUnitResult.state != ResultState.VALID) {
- print('File $filePath skipped because it could not be analyzed.');
- print('');
- continue;
- } else if (hasError(resolvedUnitResult)) {
- print('File $filePath skipped due to errors:');
- for (var error in resolvedUnitResult.errors) {
- print(' ${error.toString()}');
+ var roots = _computeRootPaths(rootPath, corpus);
+ for (var root in roots) {
+ final collection = AnalysisContextCollection(
+ includedPaths: [root],
+ resourceProvider: PhysicalResourceProvider.INSTANCE,
+ );
+ for (var context in collection.contexts) {
+ for (var filePath in context.contextRoot.analyzedFiles()) {
+ if (AnalysisEngine.isDartFileName(filePath)) {
+ try {
+ ResolvedUnitResult resolvedUnitResult =
+ await context.currentSession.getResolvedUnit(filePath);
+ //
+ // Check for errors that cause the file to be skipped.
+ //
+ if (resolvedUnitResult == null) {
+ print('File $filePath skipped because resolved unit was null.');
+ print('');
+ continue;
+ } else if (resolvedUnitResult.state != ResultState.VALID) {
+ print(
+ 'File $filePath skipped because it could not be analyzed.');
+ print('');
+ continue;
+ } else if (hasError(resolvedUnitResult)) {
+ print('File $filePath skipped due to errors:');
+ for (var error in resolvedUnitResult.errors
+ .where((e) => e.severity == Severity.error)) {
+ print(' ${error.toString()}');
+ }
+ print('');
+ continue;
}
- print('');
- continue;
- }
- resolvedUnitResult.unit.accept(collector);
- } catch (exception) {
- print('Exception caught analyzing: "$filePath"');
- print(exception.toString());
+ resolvedUnitResult.unit.accept(collector);
+ } catch (exception, stacktrace) {
+ print('Exception caught analyzing: "$filePath"');
+ print(stacktrace);
+ }
}
}
}
@@ -1765,23 +1849,24 @@
/// Write a report of the metrics that were computed to the [sink].
void writeMetrics(StringSink sink) {
sink.writeln('');
- _writeSideBySide(
- sink,
- [data.byTokenType, data.byElementKind, data.byNodeClass],
- ['Token Types', 'Element Kinds', 'Node Classes']);
+ _writeSideBySide(sink, [data.byTokenType, data.byElementKind],
+ ['Token Types', 'Element Kinds']);
sink.writeln('');
sink.writeln('Type relationships');
_writeContextMap(sink, data.byTypeMatch);
sink.writeln('');
sink.writeln('Structural indicators');
_writeContextMap(sink, data.byDistance);
+ sink.writeln('');
+ sink.writeln('Distance to member (left) by depth of target class (top)');
+ _writeMatrix(sink, data.distanceByDepthMap);
_writeTokenData(sink, data.tokenDistances);
}
/// Return the minimum widths for each of the columns in the given [table].
///
- /// The table is represented as a list or rows, where each row is a list of the
- /// contents of the cells in that row.
+ /// The table is represented as a list or rows, where each row is a list of
+ /// the contents of the cells in that row.
///
/// Throws an [ArgumentError] if the table is empty or if the rows do not
/// contain the same number of cells.
@@ -1810,6 +1895,20 @@
return columnWidths;
}
+ List<String> _computeRootPaths(String rootPath, bool corpus) {
+ var roots = <String>[];
+ if (!corpus) {
+ roots.add(rootPath);
+ } else {
+ for (var child in io.Directory(rootPath).listSync()) {
+ if (child is io.Directory) {
+ roots.add(path.join(rootPath, child.path));
+ }
+ }
+ }
+ return roots;
+ }
+
Iterable<List<String>> _convertColumnsToRows(
Iterable<List<String>> columns) sync* {
var maxRowCount = columns.fold<int>(
@@ -1895,6 +1994,44 @@
}
}
+ /// Write the given [matrix] to the [sink]. The keys of the outer map will be
+ /// the row titles; the keys of the inner map will be the column titles.
+ void _writeMatrix(StringSink sink, Map<int, Map<int, int>> matrix) {
+ var maxTargetDepth = 0;
+ var maxValueWidth = 0;
+ for (var innerMap in matrix.values) {
+ for (var entry in innerMap.entries) {
+ maxTargetDepth = math.max(maxTargetDepth, entry.key);
+ maxValueWidth = math.max(maxValueWidth, entry.value.toString().length);
+ }
+ }
+ String intToString(int value, int width) {
+ var digits = value.toString();
+ var padding = ' ' * (width - digits.length);
+ return '$padding$digits';
+ }
+
+ var maxRowHeaderWidth = maxTargetDepth.toString().length;
+ var headerRow = [''];
+ for (int depth = maxTargetDepth; depth > 0; depth--) {
+ headerRow.add(intToString(depth, maxValueWidth));
+ }
+ var zero = intToString(0, maxValueWidth);
+ var table = [headerRow];
+ for (int distance = maxTargetDepth - 1; distance >= 0; distance--) {
+ var innerMap = matrix[distance] ?? {};
+ var row = [intToString(distance, maxRowHeaderWidth)];
+ for (int depth = maxTargetDepth; depth > 0; depth--) {
+ var value = innerMap[depth];
+ row.add(value == null
+ ? (distance < depth ? zero : '')
+ : intToString(value, maxValueWidth));
+ }
+ table.add(row);
+ }
+ _writeTable(sink, table);
+ }
+
/// Write the given [maps] to the given [sink], formatting them as side-by-side
/// columns titled by the given [columnTitles].
void _writeSideBySide(StringSink sink,
diff --git a/pkg/analyzer/doc/tutorial/analysis.md b/pkg/analyzer/doc/tutorial/analysis.md
index e71d245..c72050d 100644
--- a/pkg/analyzer/doc/tutorial/analysis.md
+++ b/pkg/analyzer/doc/tutorial/analysis.md
@@ -2,6 +2,33 @@
This document explains how to use the analyzer package to analyze Dart code.
+## Conceptual Model
+
+The analysis of Dart code depends on a set of metadata (data outside the code
+being analyzed). An _analysis context_ is a representation of a set of code that
+should be analyzed using the same sources of metadata (same package_spec.json
+file, same analysis options file, etc.). That set of code typically corresponds
+to a package.
+
+Despite the fact that the analyzer APIs do not support its use in an incremental
+system, it is used that way by the analysis server, and that fact has influenced
+the design of those APIs.
+
+Specifically, in an incremental system the metadata can change over time.
+Analysis results obtained with one state of the metadata won't necessarily be
+consistent with results obtained with a different state of the metadata. Clients
+that need to work in an incremental environment need to know whether the results
+are consistent. (Clients that aren't running in an incremental environment can
+typically ignore this complication.)
+
+An _analysis session_ provides a way for clients to know when newly requested
+results would be inconsistent with previously requested results. Each analysis
+session is associated with a single analysis context and represents a specific
+state of the metadata for that context. An instance of
+`InconsistentAnalysisException` is thrown by a session if the state of the
+metadata has changed since the session was created. This prevents clients from
+getting results that would be inconsistent.
+
## Configuring the Contexts
If you want to use the analyzer package to analyze one or more files, then you
diff --git a/pkg/analyzer/lib/analyzer.dart b/pkg/analyzer/lib/analyzer.dart
index d5adede..61b5ffb 100644
--- a/pkg/analyzer/lib/analyzer.dart
+++ b/pkg/analyzer/lib/analyzer.dart
@@ -124,7 +124,12 @@
var scanner = Scanner(source, reader, errorCollector)
..configureFeatures(featureSet);
var token = scanner.tokenize();
- var parser = Parser(source, errorCollector, featureSet: featureSet);
+ var parser = Parser(
+ source,
+ errorCollector,
+ languageVersion: scanner.languageVersion,
+ featureSet: featureSet,
+ );
var unit = parser.parseDirectives(token);
unit.lineInfo = LineInfo(scanner.lineStarts);
@@ -147,8 +152,12 @@
var scanner = Scanner(source, reader, errorCollector)
..configureFeatures(featureSet);
var token = scanner.tokenize();
- var parser = Parser(source, errorCollector, featureSet: featureSet)
- ..parseFunctionBodies = parseFunctionBodies;
+ var parser = Parser(
+ source,
+ errorCollector,
+ languageVersion: scanner.languageVersion,
+ featureSet: featureSet,
+ )..parseFunctionBodies = parseFunctionBodies;
var unit = parser.parseCompilationUnit(token)
..lineInfo = LineInfo(scanner.lineStarts);
diff --git a/pkg/analyzer/lib/dart/analysis/utilities.dart b/pkg/analyzer/lib/dart/analysis/utilities.dart
index 2da102e..8164d29 100644
--- a/pkg/analyzer/lib/dart/analysis/utilities.dart
+++ b/pkg/analyzer/lib/dart/analysis/utilities.dart
@@ -118,7 +118,12 @@
var scanner = Scanner(source, reader, errorCollector)
..configureFeatures(featureSet);
var token = scanner.tokenize();
- var parser = Parser(source, errorCollector, featureSet: scanner.featureSet);
+ var parser = Parser(
+ source,
+ errorCollector,
+ languageVersion: scanner.languageVersion,
+ featureSet: scanner.featureSet,
+ );
var unit = parser.parseCompilationUnit(token);
unit.lineInfo = LineInfo(scanner.lineStarts);
ParseStringResult result =
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index c67b1fb..3ebb54c 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -33,6 +33,7 @@
/// the elements that they refer to and every expression in the AST will have a
/// type associated with it.
import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/ast/language_version.dart';
import 'package:analyzer/dart/ast/precedence.dart';
import 'package:analyzer/dart/ast/syntactic_entity.dart';
import 'package:analyzer/dart/ast/token.dart';
@@ -1232,6 +1233,10 @@
/// resynthesized from a summary.
FeatureSet get featureSet;
+ /// The language version override specified for this compilation unit using a
+ /// token like '// @dart = 2.7', or `null` if no override is specified.
+ LanguageVersion get languageVersion;
+
/// Return the line information for this compilation unit.
LineInfo get lineInfo;
@@ -3195,14 +3200,18 @@
/// Set the left square bracket to the given [token].
set leftBracket(Token token);
- /// Return the period ("..") before a cascaded index expression, or `null` if
- /// this index expression is not part of a cascade expression.
+ /// Return the period (".." | "?..") before a cascaded index expression, or
+ /// `null` if this index expression is not part of a cascade expression.
Token get period;
/// Set the period ("..") before a cascaded index expression to the given
/// [token].
set period(Token token);
+ /// Return the question mark before the left bracket, or `null` if there is no
+ /// question mark.
+ Token get question;
+
/// Return the expression used to compute the object being indexed.
///
/// If this index expression is not part of a cascade expression, then this
diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart
index ac3b825..7d2ea31 100644
--- a/pkg/analyzer/lib/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart
@@ -5,6 +5,7 @@
import 'package:_fe_analyzer_shared/src/scanner/token.dart';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/language_version.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:meta/meta.dart';
@@ -165,7 +166,8 @@
List<Directive> directives,
List<CompilationUnitMember> declarations,
@required Token endToken,
- @required FeatureSet featureSet});
+ @required FeatureSet featureSet,
+ LanguageVersion languageVersion});
/// Returns a newly created conditional expression.
ConditionalExpression conditionalExpression(
@@ -606,14 +608,34 @@
List<Combinator> combinators,
Token semicolon);
- /// Returns a newly created index expression.
+ /// Returns a newly created index expression suitable for use in a cascade
+ /// expression.
+ @Deprecated('Use indexExpressionForCascade2')
IndexExpression indexExpressionForCascade(
Token period, Token leftBracket, Expression index, Token rightBracket);
/// Returns a newly created index expression.
+ IndexExpression indexExpressionForCascade2(
+ {@required Token period,
+ Token question,
+ @required Token leftBracket,
+ @required Expression index,
+ @required Token rightBracket});
+
+ /// Returns a newly created index expression suitable for use outside a
+ /// cascade expression.
+ @Deprecated('Use indexExpressionForTarget2')
IndexExpression indexExpressionForTarget(Expression target, Token leftBracket,
Expression index, Token rightBracket);
+ /// Returns a newly created index expression.
+ IndexExpression indexExpressionForTarget2(
+ {@required Expression target,
+ Token question,
+ @required Token leftBracket,
+ @required Expression index,
+ @required Token rightBracket});
+
/// Returns a newly created instance creation expression.
InstanceCreationExpression instanceCreationExpression(
Token keyword, ConstructorName constructorName, ArgumentList argumentList,
diff --git a/pkg/analyzer/lib/dart/ast/language_version.dart b/pkg/analyzer/lib/dart/ast/language_version.dart
new file mode 100644
index 0000000..14932f7
--- /dev/null
+++ b/pkg/analyzer/lib/dart/ast/language_version.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2020, 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.
+
+/// The language version override specified for a compilation unit.
+class LanguageVersion {
+ final int major;
+ final int minor;
+
+ LanguageVersion(this.major, this.minor);
+
+ @override
+ int get hashCode => major.hashCode * 13 + minor.hashCode * 17;
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(other, this)) {
+ return true;
+ }
+
+ return other is LanguageVersion &&
+ other.major == major &&
+ other.minor == minor;
+ }
+
+ @override
+ String toString() {
+ return 'LanguageVersion(major=$major,minor=$minor)';
+ }
+}
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index e3e0a79..a868f0c 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -77,7 +77,7 @@
CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT,
CompileTimeErrorCode.AWAIT_IN_LATE_LOCAL_VARIABLE_INITIALIZER,
CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT,
- CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY,
+ CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY,
CompileTimeErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER,
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME,
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_PREFIX_NAME,
@@ -441,6 +441,8 @@
HintCode.UNDEFINED_SHOWN_NAME,
HintCode.UNNECESSARY_CAST,
HintCode.UNNECESSARY_NO_SUCH_METHOD,
+ HintCode.UNNECESSARY_NULL_COMPARISON_FALSE,
+ HintCode.UNNECESSARY_NULL_COMPARISON_TRUE,
HintCode.UNNECESSARY_TYPE_CHECK_FALSE,
HintCode.UNNECESSARY_TYPE_CHECK_TRUE,
HintCode.UNUSED_CATCH_CLAUSE,
@@ -721,7 +723,7 @@
StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER,
// ignore: deprecated_member_use_from_same_package
StaticWarningCode.CONST_WITH_ABSTRACT_CLASS,
- StaticWarningCode.DEAD_NULL_COALESCE,
+ StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION,
StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAMED,
// ignore: deprecated_member_use_from_same_package
StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS,
diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart
index 0012349..8d313c8 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -13,8 +13,6 @@
import 'package:path/path.dart';
const String analysisOptionsFileOption = 'options';
-const String bazelAnalysisOptionsPath =
- 'package:dart.analysis_options/default.yaml';
const String defineVariableOption = 'D';
const String enableInitializingFormalAccessFlag = 'initializing-formal-access';
@deprecated
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index 5038e0f..ab6528f 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -11,10 +11,7 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/analysis_options/analysis_options_provider.dart';
import 'package:analyzer/src/command_line/arguments.dart'
- show
- applyAnalysisOptionFlags,
- bazelAnalysisOptionsPath,
- flutterAnalysisOptionsPath;
+ show applyAnalysisOptionFlags, flutterAnalysisOptionsPath;
import 'package:analyzer/src/context/context_root.dart';
import 'package:analyzer/src/context/packages.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
@@ -324,8 +321,8 @@
} else {
// Search for the default analysis options.
Source source;
- if (workspace is BazelWorkspace) {
- source = sourceFactory.forUri(bazelAnalysisOptionsPath);
+ if (workspace is WorkspaceWithDefaultAnalysisOptions) {
+ source = sourceFactory.forUri(WorkspaceWithDefaultAnalysisOptions.uri);
} else {
source = sourceFactory.forUri(flutterAnalysisOptionsPath);
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 9064ac6..e70caa1 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -91,7 +91,7 @@
/// TODO(scheglov) Clean up the list of implicitly analyzed files.
class AnalysisDriver implements AnalysisDriverGeneric {
/// The version of data format, should be incremented on every format change.
- static const int DATA_VERSION = 97;
+ static const int DATA_VERSION = 98;
/// The length of the list returned by [_computeDeclaredVariablesSignature].
static const int _declaredVariablesSignatureLength = 4;
@@ -1943,6 +1943,17 @@
_run();
}
+ /// Usually we transition status to analyzing only if there are files to
+ /// analyze. However when used in the server, there are rare cases when
+ /// analysis roots don't have any Dart files, but for consistency we still
+ /// want to get status to transition to analysis, and back to idle.
+ void transitionToAnalyzingToIdleIfNoFilesToAnalyze() {
+ if (!_hasFilesToAnalyze) {
+ _statusSupport.transitionToAnalyzing();
+ _statusSupport.transitionToIdle();
+ }
+ }
+
/// Return a future that will be completed the next time the status is idle.
///
/// If the status is currently idle, the returned future will be signaled
diff --git a/pkg/analyzer/lib/src/dart/analysis/feature_set_provider.dart b/pkg/analyzer/lib/src/dart/analysis/feature_set_provider.dart
index 7bd4571..40511f1 100644
--- a/pkg/analyzer/lib/src/dart/analysis/feature_set_provider.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/feature_set_provider.dart
@@ -7,14 +7,11 @@
import 'package:analyzer/src/context/packages.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:meta/meta.dart';
-import 'package:pub_semver/pub_semver.dart';
class FeatureSetProvider {
/// This flag will be turned to `true` and inlined when we un-fork SDK,
/// so that the only SDK is the Null Safe SDK.
- static const isNullSafetySdk = false;
-
- static final _preNonNullableVersion = Version(2, 7, 0);
+ static const isNullSafetySdk = true;
final FeatureSet _sdkFeatureSet;
final Packages _packages;
@@ -58,11 +55,7 @@
@required FeatureSet packageDefaultFeatureSet,
@required FeatureSet nonPackageDefaultFeatureSet,
}) {
- var sdkFeatureSet = _determineSdkFeatureSet(
- resourceProvider,
- sourceFactory,
- packageDefaultFeatureSet,
- );
+ var sdkFeatureSet = FeatureSet.fromEnableFlags(['non-nullable']);
return FeatureSetProvider._(
sdkFeatureSet: sdkFeatureSet,
@@ -71,32 +64,4 @@
nonPackageDefaultFeatureSet: nonPackageDefaultFeatureSet,
);
}
-
- /// Read `dart:core` file and determine if SDK in non-nullable by default.
- ///
- /// If it is, use the [defaultFeatureSet], which might have enabled
- /// [Feature.non_nullable], so SDK will be parsed and resolved as
- /// non-nullable.
- ///
- /// Otherwise, restrict the SDK language to the maximum known now.
- static FeatureSet _determineSdkFeatureSet(
- ResourceProvider resourceProvider,
- SourceFactory sourceFactory,
- FeatureSet defaultFeatureSet,
- ) {
- var objectSource = sourceFactory.forUri('dart:core/object.dart');
- if (objectSource == null) {
- objectSource = sourceFactory.forUri('dart:core');
- }
-
- try {
- var objectFile = resourceProvider.getFile(objectSource.fullName);
- var objectContent = objectFile.readAsStringSync();
- if (!objectContent.contains('bool operator ==(Object other)')) {
- return defaultFeatureSet.restrictToVersion(_preNonNullableVersion);
- }
- } catch (_) {}
-
- return defaultFeatureSet;
- }
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index e5bce30..ada9a29 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -534,8 +534,11 @@
CompilationUnit _createEmptyCompilationUnit() {
var token = Token.eof(0);
return astFactory.compilationUnit(
- beginToken: token, endToken: token, featureSet: _featureSet)
- ..lineInfo = LineInfo(const <int>[0]);
+ beginToken: token,
+ endToken: token,
+ languageVersion: null,
+ featureSet: _featureSet,
+ )..lineInfo = LineInfo(const <int>[0]);
}
/**
@@ -593,8 +596,13 @@
// Pass the feature set from the scanner to the parser
// because the scanner may have detected a language version comment
// and downgraded the feature set it holds.
- Parser parser = Parser(source, errorListener,
- featureSet: scanner.featureSet, useFasta: useFasta);
+ Parser parser = Parser(
+ source,
+ errorListener,
+ languageVersion: scanner.languageVersion,
+ featureSet: scanner.featureSet,
+ useFasta: useFasta,
+ );
parser.enableOptionalNewAndConst = true;
CompilationUnit unit = parser.parseCompilationUnit(token);
unit.lineInfo = lineInfo;
diff --git a/pkg/analyzer/lib/src/dart/analysis/index.dart b/pkg/analyzer/lib/src/dart/analysis/index.dart
index 2243000..a53d2a1 100644
--- a/pkg/analyzer/lib/src/dart/analysis/index.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/index.dart
@@ -10,6 +10,44 @@
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
+Element declaredParameterElement(
+ SimpleIdentifier node,
+ Element element,
+) {
+ if (element.enclosingElement != null) {
+ return element;
+ }
+
+ /// When we instantiate the [FunctionType] of an executable, we use
+ /// synthetic [ParameterElement]s, disconnected from the rest of the
+ /// element model. But we want to index these parameter references
+ /// as references to declared parameters.
+ ParameterElement namedParameterElement(ExecutableElement executable) {
+ var parameterName = node.name;
+ return executable.declaration.parameters.where((parameter) {
+ return parameter.isNamed && parameter.name == parameterName;
+ }).first;
+ }
+
+ var parent = node.parent;
+ if (parent is Label && parent.label == node) {
+ var namedExpression = parent.parent;
+ if (namedExpression is NamedExpression && namedExpression.name == parent) {
+ var argumentList = namedExpression.parent;
+ if (argumentList is ArgumentList) {
+ var invocation = argumentList.parent;
+ if (invocation is InstanceCreationExpression) {
+ return namedParameterElement(invocation.staticElement);
+ } else if (invocation is MethodInvocation) {
+ return namedParameterElement(invocation.methodName.staticElement);
+ }
+ }
+ }
+ }
+
+ return element;
+}
+
/**
* Return the [CompilationUnitElement] that should be used for [element].
* Throw [StateError] if the [element] is not linked into a unit.
@@ -719,7 +757,12 @@
if (node.inDeclarationContext()) {
return;
}
+
Element element = node.staticElement;
+ if (node is SimpleIdentifier && element is ParameterElement) {
+ element = declaredParameterElement(node, element);
+ }
+
// record unresolved name reference
bool isQualified = _isQualified(node);
if (element == null) {
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index ff0f534..5373504 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -7,6 +7,7 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/language_version.dart';
import 'package:analyzer/dart/ast/precedence.dart';
import 'package:analyzer/dart/ast/syntactic_entity.dart';
import 'package:analyzer/dart/ast/token.dart';
@@ -2011,6 +2012,9 @@
LineInfo lineInfo;
@override
+ final LanguageVersion languageVersion;
+
+ @override
final FeatureSet featureSet;
/// Initialize a newly created compilation unit to have the given directives
@@ -2024,6 +2028,7 @@
List<Directive> directives,
List<CompilationUnitMember> declarations,
this.endToken,
+ this.languageVersion,
this.featureSet) {
_scriptTag = _becomeParentOf(scriptTag);
_directives = NodeListImpl<Directive>(this, directives);
@@ -4083,10 +4088,7 @@
@override
Token get endToken {
- if (_parameters != null) {
- return _parameters.endToken;
- }
- return identifier.endToken;
+ return question ?? _parameters?.endToken ?? identifier.endToken;
}
@override
@@ -5175,7 +5177,7 @@
super._childEntities..add(_returnType)..add(identifier)..add(parameters);
@override
- Token get endToken => _parameters.endToken;
+ Token get endToken => question ?? _parameters.endToken;
@override
bool get isConst => false;
@@ -5770,23 +5772,22 @@
class IndexExpressionImpl extends ExpressionImpl
with NullShortableExpressionImpl
implements IndexExpression {
+ @override
+ Token period;
+
/// The expression used to compute the object being indexed, or `null` if this
/// index expression is part of a cascade expression.
ExpressionImpl _target;
- /// The period (".." | "?..") before a cascaded index expression,
- /// or `null` if this index expression is not part of a cascade expression.
@override
- Token period;
+ Token question;
- /// The left square bracket.
@override
Token leftBracket;
/// The expression used to compute the index.
ExpressionImpl _index;
- /// The right square bracket.
@override
Token rightBracket;
@@ -5802,15 +5803,17 @@
@override
AuxiliaryElements auxiliaryElements;
- /// Initialize a newly created index expression.
- IndexExpressionImpl.forCascade(
- this.period, this.leftBracket, ExpressionImpl index, this.rightBracket) {
+ /// Initialize a newly created index expression that is a child of a cascade
+ /// expression.
+ IndexExpressionImpl.forCascade(this.period, this.question, this.leftBracket,
+ ExpressionImpl index, this.rightBracket) {
_index = _becomeParentOf(index);
}
- /// Initialize a newly created index expression.
- IndexExpressionImpl.forTarget(ExpressionImpl target, this.leftBracket,
- ExpressionImpl index, this.rightBracket) {
+ /// Initialize a newly created index expression that is not a child of a
+ /// cascade expression.
+ IndexExpressionImpl.forTarget(ExpressionImpl target, this.question,
+ this.leftBracket, ExpressionImpl index, this.rightBracket) {
_target = _becomeParentOf(target);
_index = _becomeParentOf(index);
}
diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
index d39b8e9..01d66fa 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -6,6 +6,7 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/ast_factory.dart';
+import 'package:analyzer/dart/ast/language_version.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:meta/meta.dart';
@@ -185,9 +186,10 @@
List<Directive> directives,
List<CompilationUnitMember> declarations,
Token endToken,
- FeatureSet featureSet}) =>
+ FeatureSet featureSet,
+ LanguageVersion languageVersion}) =>
CompilationUnitImpl(beginToken, scriptTag, directives, declarations,
- endToken, featureSet);
+ endToken, languageVersion, featureSet);
@override
ConditionalExpression conditionalExpression(
@@ -674,14 +676,38 @@
semicolon);
@override
+ @Deprecated('Use indexExpressionForCascade2')
IndexExpression indexExpressionForCascade(Token period, Token leftBracket,
Expression index, Token rightBracket) =>
- IndexExpressionImpl.forCascade(period, leftBracket, index, rightBracket);
+ IndexExpressionImpl.forCascade(
+ period, null, leftBracket, index, rightBracket);
@override
+ IndexExpression indexExpressionForCascade2(
+ {@required Token period,
+ Token question,
+ @required Token leftBracket,
+ @required Expression index,
+ @required Token rightBracket}) =>
+ IndexExpressionImpl.forCascade(
+ period, question, leftBracket, index, rightBracket);
+
+ @override
+ @Deprecated('Use indexExpressionForTarget2')
IndexExpression indexExpressionForTarget(Expression target, Token leftBracket,
Expression index, Token rightBracket) =>
- IndexExpressionImpl.forTarget(target, leftBracket, index, rightBracket);
+ IndexExpressionImpl.forTarget(
+ target, null, leftBracket, index, rightBracket);
+
+ @override
+ IndexExpression indexExpressionForTarget2(
+ {@required Expression target,
+ Token question,
+ @required Token leftBracket,
+ @required Expression index,
+ @required Token rightBracket}) =>
+ IndexExpressionImpl.forTarget(
+ target, question, leftBracket, index, rightBracket);
@override
InstanceCreationExpression instanceCreationExpression(Token keyword,
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index 936b894..9f6863e 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -286,6 +286,7 @@
directives: cloneNodeList(node.directives),
declarations: cloneNodeList(node.declarations),
endToken: cloneToken(node.endToken),
+ languageVersion: node.languageVersion,
featureSet: node.featureSet);
clone.lineInfo = node.lineInfo;
return clone;
@@ -681,17 +682,17 @@
IndexExpression visitIndexExpression(IndexExpression node) {
Token period = node.period;
if (period == null) {
- return astFactory.indexExpressionForTarget(
- cloneNode(node.target),
- cloneToken(node.leftBracket),
- cloneNode(node.index),
- cloneToken(node.rightBracket));
+ return astFactory.indexExpressionForTarget2(
+ target: cloneNode(node.target),
+ leftBracket: cloneToken(node.leftBracket),
+ index: cloneNode(node.index),
+ rightBracket: cloneToken(node.rightBracket));
} else {
- return astFactory.indexExpressionForCascade(
- cloneToken(period),
- cloneToken(node.leftBracket),
- cloneNode(node.index),
- cloneToken(node.rightBracket));
+ return astFactory.indexExpressionForCascade2(
+ period: cloneToken(period),
+ leftBracket: cloneToken(node.leftBracket),
+ index: cloneNode(node.index),
+ rightBracket: cloneToken(node.rightBracket));
}
}
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index b2b9682..0b61689 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -82,7 +82,7 @@
DartType replaceTopAndBottom(TypeProvider typeProvider,
{bool isCovariant = true}) {
if (isCovariant) {
- return typeProvider.nullType;
+ return NeverTypeImpl.instance;
} else {
return this;
}
diff --git a/pkg/analyzer/lib/src/dart/element/type_demotion.dart b/pkg/analyzer/lib/src/dart/element/type_demotion.dart
new file mode 100644
index 0000000..f6adb1b
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/element/type_demotion.dart
@@ -0,0 +1,122 @@
+// Copyright (c) 2020, 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.md file.
+
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/nullability_suffix.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/replacement_visitor.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type_visitor.dart';
+
+/// Returns [type] in which all promoted type variables have been replace with
+/// their unpromoted equivalents, and, if [library] is non-nullable by default,
+/// replaces all legacy types with their non-nullable equivalents.
+DartType demoteType(LibraryElement library, DartType type) {
+ if (library.isNonNullableByDefault) {
+ var visitor = const _DemotionNonNullification();
+ return visitor.visit(type) ?? type;
+ } else {
+ var visitor = const _DemotionNonNullification(nonNullifyTypes: false);
+ return visitor.visit(type) ?? type;
+ }
+}
+
+/// Returns `true` if type contains a promoted type variable.
+bool hasPromotedTypeVariable(DartType type) {
+ return const _HasPromotedTypeVariableVisitor()._visit(type);
+}
+
+/// Returns [type] in which all legacy types have been replaced with
+/// non-nullable types.
+DartType nonNullifyType(LibraryElement library, DartType type) {
+ if (library.isNonNullableByDefault) {
+ var visitor = const _DemotionNonNullification(demoteTypeVariables: false);
+ return visitor.visit(type) ?? type;
+ }
+ return type;
+}
+
+/// Visitor that replaces all promoted type variables the type variable itself
+/// and/or replaces all legacy types with non-nullable types.
+///
+/// The visitor returns `null` if the type wasn't changed.
+class _DemotionNonNullification extends ReplacementVisitor {
+ final bool demoteTypeVariables;
+ final bool nonNullifyTypes;
+
+ const _DemotionNonNullification({
+ this.demoteTypeVariables = true,
+ this.nonNullifyTypes = true,
+ }) : assert(demoteTypeVariables || nonNullifyTypes);
+
+ @override
+ NullabilitySuffix visitNullability(DartType type) {
+ if (nonNullifyTypes && type.nullabilitySuffix == NullabilitySuffix.star) {
+ return NullabilitySuffix.none;
+ }
+ return null;
+ }
+
+ @override
+ DartType visitTypeParameterType(TypeParameterType type) {
+ var newNullability = visitNullability(type);
+
+ if (demoteTypeVariables) {
+ var typeImpl = type as TypeParameterTypeImpl;
+ if (typeImpl.promotedBound != null) {
+ return TypeParameterTypeImpl(
+ element: type.element,
+ nullabilitySuffix: newNullability ?? type.nullabilitySuffix,
+ );
+ }
+ }
+
+ return createTypeParameterType(
+ type: type,
+ newNullability: newNullability,
+ );
+ }
+}
+
+/// Visitor that returns `true` if a type contains a promoted type variable.
+class _HasPromotedTypeVariableVisitor extends DartTypeVisitor<bool> {
+ const _HasPromotedTypeVariableVisitor();
+
+ @override
+ bool defaultDartType(DartType type) => false;
+
+ @override
+ bool visitFunctionType(FunctionType type) {
+ if (_visit(type.returnType)) {
+ return true;
+ }
+
+ for (var parameter in type.parameters) {
+ if (_visit(parameter.type)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @override
+ bool visitInterfaceType(InterfaceType type) {
+ for (var typeArgument in type.typeArguments) {
+ if (_visit(typeArgument)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @override
+ bool visitTypeParameterType(TypeParameterType type) {
+ return (type as TypeParameterTypeImpl).promotedBound != null;
+ }
+
+ bool _visit(DartType type) {
+ return DartTypeVisitor.visit(type, this);
+ }
+}
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
index 5580f75..6d5e688 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
@@ -1492,7 +1492,7 @@
// sdk: '>=2.1.0 <2.4.0'
// ```
//
- // In the package that has that pubspec, code like the following generates
+ // In the package that has that pubspec, code like the following produces
// this diagnostic:
//
// ```dart
@@ -1668,7 +1668,7 @@
// sdk: '>=2.4.0 <2.7.0'
// ```
//
- // In the package that has that pubspec, code like the following generates
+ // In the package that has that pubspec, code like the following produces
// this diagnostic:
//
// ```dart
@@ -1787,7 +1787,7 @@
// sdk: '>=2.1.0 <2.4.0'
// ```
//
- // In the package that has that pubspec, code like the following generates
+ // In the package that has that pubspec, code like the following produces
// this diagnostic:
//
// ```dart
@@ -1947,7 +1947,7 @@
// sdk: '>=2.2.0 <2.4.0'
// ```
//
- // In the package that has that pubspec, code like the following generates
+ // In the package that has that pubspec, code like the following produces
// this diagnostic:
//
// ```dart
@@ -2008,7 +2008,7 @@
// sdk: '>=2.4.0 <2.6.0'
// ```
//
- // In the package that has that pubspec, code like the following generates
+ // In the package that has that pubspec, code like the following produces
// this diagnostic:
//
// ```dart
@@ -2201,17 +2201,44 @@
correction: "Try removing the declaration of 'noSuchMethod'.");
/**
- * Unnecessary type checks, the result is always false.
+ * No parameters.
*/
- static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = HintCode(
+ static const HintCode UNNECESSARY_NULL_COMPARISON_FALSE =
+ HintCodeWithUniqueName(
+ 'UNNECESSARY_NULL_COMPARISON',
+ 'UNNECESSARY_NULL_COMPARISON_FALSE',
+ "The operand can't be null, so the condition is always false.",
+ correction: "Try removing the condition, an enclosing condition, "
+ "or the whole conditional statement.");
+
+ /**
+ * No parameters.
+ */
+ static const HintCode UNNECESSARY_NULL_COMPARISON_TRUE =
+ HintCodeWithUniqueName(
+ 'UNNECESSARY_NULL_COMPARISON',
+ 'UNNECESSARY_NULL_COMPARISON_TRUE',
+ "The operand can't be null, so the condition is always true.",
+ correction: "Remove the condition.");
+
+ /**
+ * Unnecessary type checks, the result is always false.
+ *
+ * No parameters.
+ */
+ static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = HintCodeWithUniqueName(
+ 'UNNECESSARY_TYPE_CHECK',
'UNNECESSARY_TYPE_CHECK_FALSE',
"Unnecessary type check, the result is always false.",
correction: "Try correcting the type check, or removing the type check.");
/**
* Unnecessary type checks, the result is always true.
+ *
+ * No parameters.
*/
- static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = HintCode(
+ static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = HintCodeWithUniqueName(
+ 'UNNECESSARY_TYPE_CHECK',
'UNNECESSARY_TYPE_CHECK_TRUE',
"Unnecessary type check, the result is always true.",
correction: "Try correcting the type check, or removing the type check.");
diff --git a/pkg/analyzer/lib/src/dart/micro/analysis_context.dart b/pkg/analyzer/lib/src/dart/micro/analysis_context.dart
new file mode 100644
index 0000000..a9d7cf3
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/micro/analysis_context.dart
@@ -0,0 +1,131 @@
+// Copyright (c) 2020, 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/analysis/analysis_context.dart';
+import 'package:analyzer/dart/analysis/context_root.dart';
+import 'package:analyzer/dart/analysis/declared_variables.dart';
+import 'package:analyzer/dart/analysis/session.dart';
+import 'package:analyzer/dart/analysis/uri_converter.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/context/builder.dart';
+import 'package:analyzer/src/dart/analysis/session.dart';
+import 'package:analyzer/src/generated/engine.dart' show AnalysisOptions;
+import 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/src/dart/analysis/results.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/dart/micro/resolve_file.dart';
+import 'package:analyzer/src/workspace/workspace.dart';
+
+class MicroAnalysisContextImpl implements AnalysisContext {
+ final FileResolver fileResolver;
+
+ @override
+ final AnalysisOptions analysisOptions;
+
+ final ResourceProvider resourceProvider;
+
+ @override
+ final ContextRoot contextRoot;
+
+ final DeclaredVariables declaredVariables;
+ final SourceFactory sourceFactory;
+
+ Workspace _workspace;
+
+ @override
+ Workspace get workspace {
+ return _workspace ??= _buildWorkspace();
+ }
+
+ MicroAnalysisContextImpl(
+ this.fileResolver,
+ this.contextRoot,
+ this.analysisOptions,
+ this.declaredVariables,
+ this.sourceFactory,
+ this.resourceProvider,
+ {Workspace workspace})
+ : this._workspace = workspace;
+
+ @override
+ AnalysisSession get currentSession {
+ return _AnalysisSessionImpl(this, declaredVariables, sourceFactory);
+ }
+
+ Workspace _buildWorkspace() {
+ String path = contextRoot.root.path;
+ ContextBuilder builder = ContextBuilder(
+ resourceProvider, null /* sdkManager */, null /* contentCache */);
+ return ContextBuilder.createWorkspace(resourceProvider, path, builder);
+ }
+
+ @override
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
+
+class _AnalysisSessionImpl extends AnalysisSessionImpl {
+ @override
+ final MicroAnalysisContextImpl analysisContext;
+
+ @override
+ final DeclaredVariables declaredVariables;
+
+ @override
+ SourceFactory sourceFactory;
+
+ _AnalysisSessionImpl(
+ this.analysisContext,
+ this.declaredVariables,
+ this.sourceFactory,
+ ) : super(null);
+ @override
+ ResourceProvider get resourceProvider =>
+ analysisContext.contextRoot.resourceProvider;
+
+ @override
+ FileResult getFile(String path) {
+ return FileResultImpl(
+ this,
+ path,
+ uriConverter.pathToUri(path),
+ null,
+ false,
+ );
+ }
+
+ @override
+ Future<ResolvedUnitResult> getResolvedUnit(String path) async {
+ return analysisContext.fileResolver.resolve(path);
+ }
+
+ @override
+ UriConverter get uriConverter {
+ return _UriConverterImpl(
+ analysisContext.contextRoot.resourceProvider,
+ sourceFactory,
+ );
+ }
+
+ @override
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
+
+class _UriConverterImpl implements UriConverter {
+ final ResourceProvider resourceProvider;
+ final SourceFactory sourceFactory;
+
+ _UriConverterImpl(this.resourceProvider, this.sourceFactory);
+
+ @override
+ Uri pathToUri(String path, {String containingPath}) {
+ var fileUri = resourceProvider.pathContext.toUri(path);
+ var fileSource = sourceFactory.forUri2(fileUri);
+ return sourceFactory.restoreUri(fileSource);
+ }
+
+ @override
+ String uriToPath(Uri uri) {
+ return sourceFactory.forUri2(uri)?.fullName;
+ }
+}
diff --git a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
new file mode 100644
index 0000000..2b74ca3
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
@@ -0,0 +1,836 @@
+// Copyright (c) 2020, 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/analysis/declared_variables.dart';
+import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/error/error.dart';
+import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/context/builder.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/ast/utilities.dart';
+import 'package:analyzer/src/dart/constant/compute.dart';
+import 'package:analyzer/src/dart/constant/constant_verifier.dart';
+import 'package:analyzer/src/dart/constant/evaluation.dart';
+import 'package:analyzer/src/dart/constant/utilities.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
+import 'package:analyzer/src/dart/element/type_provider.dart';
+import 'package:analyzer/src/dart/micro/library_graph.dart';
+import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
+import 'package:analyzer/src/dart/resolver/legacy_type_asserter.dart';
+import 'package:analyzer/src/dart/resolver/resolution_visitor.dart';
+import 'package:analyzer/src/error/best_practices_verifier.dart';
+import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/error/dart2js_verifier.dart';
+import 'package:analyzer/src/error/dead_code_verifier.dart';
+import 'package:analyzer/src/error/imports_verifier.dart';
+import 'package:analyzer/src/error/inheritance_override.dart';
+import 'package:analyzer/src/error/override_verifier.dart';
+import 'package:analyzer/src/error/unused_local_elements_verifier.dart';
+import 'package:analyzer/src/generated/declaration_resolver.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/error_verifier.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/hint/sdk_constraint_verifier.dart';
+import 'package:analyzer/src/ignore_comments/ignore_info.dart';
+import 'package:analyzer/src/lint/linter.dart';
+import 'package:analyzer/src/lint/linter_visitor.dart';
+import 'package:analyzer/src/services/lint.dart';
+import 'package:analyzer/src/summary2/linked_element_factory.dart';
+import 'package:analyzer/src/task/strong/checker.dart';
+import 'package:analyzer/src/workspace/workspace.dart';
+import 'package:pub_semver/pub_semver.dart';
+import 'package:analyzer/src/error/todo_finder.dart';
+
+var timerLibraryAnalyzer = Stopwatch();
+var timerLibraryAnalyzerConst = Stopwatch();
+var timerLibraryAnalyzerFreshUnit = Stopwatch();
+var timerLibraryAnalyzerResolve = Stopwatch();
+var timerLibraryAnalyzerSplicer = Stopwatch();
+var timerLibraryAnalyzerVerify = Stopwatch();
+
+/**
+ * Analyzer of a single library.
+ */
+class LibraryAnalyzer {
+ /// A marker object used to prevent the initialization of
+ /// [_versionConstraintFromPubspec] when the previous initialization attempt
+ /// failed.
+ static final VersionRange noSpecifiedRange = VersionRange();
+ final AnalysisOptionsImpl _analysisOptions;
+ final DeclaredVariables _declaredVariables;
+ final SourceFactory _sourceFactory;
+ final FileState _library;
+ final ResourceProvider _resourceProvider;
+
+ final InheritanceManager3 _inheritance;
+ final bool Function(Uri) _isLibraryUri;
+ final AnalysisContext _context;
+ final LinkedElementFactory _elementFactory;
+
+ LibraryElement _libraryElement;
+
+ LibraryScope _libraryScope;
+ final Map<FileState, LineInfo> _fileToLineInfo = {};
+
+ final Map<FileState, IgnoreInfo> _fileToIgnoreInfo = {};
+ final Map<FileState, RecordingErrorListener> _errorListeners = {};
+ final Map<FileState, ErrorReporter> _errorReporters = {};
+ final List<UsedImportedElements> _usedImportedElementsList = [];
+ final List<UsedLocalElements> _usedLocalElementsList = [];
+
+ /**
+ * Constants in the current library.
+ *
+ * TODO(scheglov) Remove after https://github.com/dart-lang/sdk/issues/31925
+ */
+ final Set<ConstantEvaluationTarget> _libraryConstants = Set();
+
+ final Set<ConstantEvaluationTarget> _constants = Set();
+
+ final String Function(String path) getFileContent;
+
+ LibraryAnalyzer(
+ this._analysisOptions,
+ this._declaredVariables,
+ this._sourceFactory,
+ this._isLibraryUri,
+ this._context,
+ this._elementFactory,
+ this._inheritance,
+ this._library,
+ this._resourceProvider,
+ this.getFileContent,
+ );
+
+ TypeProviderImpl get _typeProvider => _libraryElement.typeProvider;
+
+ TypeSystemImpl get _typeSystem => _libraryElement.typeSystem;
+
+ /**
+ * Compute analysis results for all units of the library.
+ */
+ Map<FileState, UnitAnalysisResult> analyze() {
+ return PerformanceStatistics.analysis.makeCurrentWhile(() {
+ return analyzeSync();
+ });
+ }
+
+ /**
+ * Compute analysis results for all units of the library.
+ */
+ Map<FileState, UnitAnalysisResult> analyzeSync() {
+ timerLibraryAnalyzer.start();
+ Map<FileState, CompilationUnit> units = {};
+
+ // Parse all files.
+ timerLibraryAnalyzerFreshUnit.start();
+ for (FileState file in _library.libraryFiles) {
+ units[file] = _parse(file);
+ }
+ timerLibraryAnalyzerFreshUnit.stop();
+
+ // Resolve URIs in directives to corresponding sources.
+ FeatureSet featureSet = units[_library].featureSet;
+
+ units.forEach((file, unit) {
+ _validateFeatureSet(unit, featureSet);
+ _resolveUriBasedDirectives(file, unit);
+ });
+
+ _libraryElement = _elementFactory.libraryOfUri(_library.uriStr);
+
+ _libraryScope = LibraryScope(_libraryElement);
+
+ timerLibraryAnalyzerResolve.start();
+ _resolveDirectives(units);
+
+ units.forEach((file, unit) {
+ _resolveFile(file, unit);
+ });
+ timerLibraryAnalyzerResolve.stop();
+
+ timerLibraryAnalyzerConst.start();
+ units.values.forEach(_findConstants);
+ _clearConstantEvaluationResults();
+ _computeConstants();
+ timerLibraryAnalyzerConst.stop();
+
+ timerLibraryAnalyzerVerify.start();
+ PerformanceStatistics.errors.makeCurrentWhile(() {
+ units.forEach((file, unit) {
+ _computeVerifyErrors(file, unit);
+ });
+ });
+
+ if (_analysisOptions.hint) {
+ PerformanceStatistics.hints.makeCurrentWhile(() {
+ units.forEach((file, unit) {
+ {
+ var visitor = GatherUsedLocalElementsVisitor(_libraryElement);
+ unit.accept(visitor);
+ _usedLocalElementsList.add(visitor.usedElements);
+ }
+ {
+ var visitor = GatherUsedImportedElementsVisitor(_libraryElement);
+ unit.accept(visitor);
+ _usedImportedElementsList.add(visitor.usedElements);
+ }
+ });
+ units.forEach((file, unit) {
+ _computeHints(file, unit);
+ });
+ });
+ }
+
+ if (_analysisOptions.lint) {
+ PerformanceStatistics.lints.makeCurrentWhile(() {
+ var allUnits = _library.libraryFiles.map(
+ (file) {
+ var content = getFileContent(file.path);
+ return LinterContextUnit(content, units[file]);
+ },
+ ).toList();
+ for (int i = 0; i < allUnits.length; i++) {
+ _computeLints(_library.libraryFiles[i], allUnits[i], allUnits);
+ }
+ });
+ }
+
+ assert(units.values.every(LegacyTypeAsserter.assertLegacyTypes));
+
+ timerLibraryAnalyzerVerify.stop();
+
+ // Return full results.
+ Map<FileState, UnitAnalysisResult> results = {};
+ units.forEach((file, unit) {
+ List<AnalysisError> errors = _getErrorListener(file).errors;
+ errors = _filterIgnoredErrors(file, errors);
+ results[file] = UnitAnalysisResult(file, unit, errors);
+ });
+ timerLibraryAnalyzer.stop();
+ return results;
+ }
+
+ /**
+ * Clear evaluation results for all constants before computing them again.
+ * The reason is described in https://github.com/dart-lang/sdk/issues/35940
+ *
+ * Otherwise, we reuse results, including errors are recorded only when
+ * we evaluate constants resynthesized from summaries.
+ *
+ * TODO(scheglov) Remove after https://github.com/dart-lang/sdk/issues/31925
+ */
+ void _clearConstantEvaluationResults() {
+ for (var constant in _libraryConstants) {
+ if (constant is ConstFieldElementImpl_ofEnum) continue;
+ if (constant is ConstVariableElement) {
+ constant.evaluationResult = null;
+ }
+ }
+ }
+
+ void _computeConstantErrors(
+ ErrorReporter errorReporter, CompilationUnit unit) {
+ ConstantVerifier constantVerifier = ConstantVerifier(
+ errorReporter, _libraryElement, _declaredVariables,
+ featureSet: unit.featureSet, forAnalysisDriver: true);
+ unit.accept(constantVerifier);
+ }
+
+ /**
+ * Compute [_constants] in all units.
+ */
+ void _computeConstants() {
+ computeConstants(_typeProvider, _typeSystem, _declaredVariables,
+ _constants.toList(), _analysisOptions.experimentStatus);
+ }
+
+ void _computeHints(FileState file, CompilationUnit unit) {
+ if (file.source == null) {
+ return;
+ }
+
+ AnalysisErrorListener errorListener = _getErrorListener(file);
+ ErrorReporter errorReporter = _getErrorReporter(file);
+
+ unit.accept(DeadCodeVerifier(errorReporter, unit.featureSet,
+ typeSystem: _typeSystem));
+
+ // Dart2js analysis.
+ if (_analysisOptions.dart2jsHint) {
+ unit.accept(Dart2JSVerifier(errorReporter));
+ }
+
+ var content = getFileContent(file.path);
+ unit.accept(BestPracticesVerifier(
+ errorReporter, _typeProvider, _libraryElement, unit, content,
+ typeSystem: _typeSystem,
+ inheritanceManager: _inheritance,
+ resourceProvider: _resourceProvider,
+ analysisOptions: _context.analysisOptions));
+
+ unit.accept(OverrideVerifier(
+ _inheritance,
+ _libraryElement,
+ errorReporter,
+ ));
+
+ TodoFinder(errorReporter).findIn(unit);
+
+ // Verify imports.
+ {
+ ImportsVerifier verifier = ImportsVerifier();
+ verifier.addImports(unit);
+ _usedImportedElementsList.forEach(verifier.removeUsedElements);
+ verifier.generateDuplicateImportHints(errorReporter);
+ verifier.generateDuplicateShownHiddenNameHints(errorReporter);
+ verifier.generateUnusedImportHints(errorReporter);
+ verifier.generateUnusedShownNameHints(errorReporter);
+ }
+
+ // Unused local elements.
+ {
+ UsedLocalElements usedElements =
+ UsedLocalElements.merge(_usedLocalElementsList);
+ UnusedLocalElementsVerifier visitor = UnusedLocalElementsVerifier(
+ errorListener, usedElements, _inheritance, _libraryElement);
+ unit.accept(visitor);
+ }
+
+ //
+ // Find code that uses features from an SDK version that does not satisfy
+ // the SDK constraints specified in analysis options.
+ //
+ var sdkVersionConstraint = _analysisOptions.sdkVersionConstraint;
+ if (sdkVersionConstraint != null) {
+ SdkConstraintVerifier verifier = SdkConstraintVerifier(
+ errorReporter, _libraryElement, _typeProvider, sdkVersionConstraint);
+ unit.accept(verifier);
+ }
+ }
+
+ void _computeLints(FileState file, LinterContextUnit currentUnit,
+ List<LinterContextUnit> allUnits) {
+ var unit = currentUnit.unit;
+ if (file.source == null) {
+ return;
+ }
+
+ ErrorReporter errorReporter = _getErrorReporter(file);
+
+ var nodeRegistry = NodeLintRegistry(_analysisOptions.enableTiming);
+ var visitors = <AstVisitor>[];
+ final workspacePackage = _getPackage(currentUnit.unit);
+ var context = LinterContextImpl(
+ allUnits,
+ currentUnit,
+ _declaredVariables,
+ _typeProvider,
+ _typeSystem,
+ _inheritance,
+ _analysisOptions,
+ workspacePackage);
+ for (Linter linter in _analysisOptions.lintRules) {
+ linter.reporter = errorReporter;
+ if (linter is NodeLintRule) {
+ (linter as NodeLintRule).registerNodeProcessors(nodeRegistry, context);
+ } else {
+ AstVisitor visitor = linter.getVisitor();
+ if (visitor != null) {
+ if (_analysisOptions.enableTiming) {
+ var timer = lintRegistry.getTimer(linter);
+ visitor = TimedAstVisitor(visitor, timer);
+ }
+ visitors.add(visitor);
+ }
+ }
+ }
+
+ // Run lints that handle specific node types.
+ unit.accept(LinterVisitor(
+ nodeRegistry, ExceptionHandlingDelegatingAstVisitor.logException));
+
+ // Run visitor based lints.
+ if (visitors.isNotEmpty) {
+ AstVisitor visitor = ExceptionHandlingDelegatingAstVisitor(
+ visitors, ExceptionHandlingDelegatingAstVisitor.logException);
+ unit.accept(visitor);
+ }
+ }
+
+ WorkspacePackage _getPackage(CompilationUnit unit) {
+ final libraryPath = _library.source.fullName;
+ Workspace workspace =
+ unit.declaredElement.session?.analysisContext?.workspace;
+
+ // If there is no driver setup (as in test environments), we need to create
+ // a workspace ourselves.
+ // todo (pq): fix tests or otherwise de-dup this logic shared w/ resolver.
+ if (workspace == null) {
+ final builder = ContextBuilder(
+ _resourceProvider, null /* sdkManager */, null /* contentCache */);
+ workspace = ContextBuilder.createWorkspace(
+ _resourceProvider, libraryPath, builder);
+ }
+ return workspace?.findPackageFor(libraryPath);
+ }
+
+ void _computeVerifyErrors(FileState file, CompilationUnit unit) {
+ if (file.source == null) {
+ return;
+ }
+
+ RecordingErrorListener errorListener = _getErrorListener(file);
+
+ CodeChecker checker = CodeChecker(
+ _typeProvider,
+ _typeSystem,
+ _inheritance,
+ errorListener,
+ );
+ checker.visitCompilationUnit(unit);
+
+ ErrorReporter errorReporter = _getErrorReporter(file);
+
+ //
+ // Validate the directives.
+ //
+ _validateUriBasedDirectives(file, unit);
+
+ //
+ // Use the ConstantVerifier to compute errors.
+ //
+ _computeConstantErrors(errorReporter, unit);
+
+ //
+ // Compute inheritance and override errors.
+ //
+ var inheritanceOverrideVerifier =
+ InheritanceOverrideVerifier(_typeSystem, _inheritance, errorReporter);
+ inheritanceOverrideVerifier.verifyUnit(unit);
+
+ //
+ // Use the ErrorVerifier to compute errors.
+ //
+ ErrorVerifier errorVerifier = ErrorVerifier(
+ errorReporter, _libraryElement, _typeProvider, _inheritance, false);
+ unit.accept(errorVerifier);
+ }
+
+ /**
+ * Return a subset of the given [errors] that are not marked as ignored in
+ * the [file].
+ */
+ List<AnalysisError> _filterIgnoredErrors(
+ FileState file, List<AnalysisError> errors) {
+ if (errors.isEmpty) {
+ return errors;
+ }
+
+ IgnoreInfo ignoreInfo = _fileToIgnoreInfo[file];
+ if (!ignoreInfo.hasIgnores) {
+ return errors;
+ }
+
+ LineInfo lineInfo = _fileToLineInfo[file];
+
+ bool isIgnored(AnalysisError error) {
+ int errorLine = lineInfo.getLocation(error.offset).lineNumber;
+ String errorCode = error.errorCode.name.toLowerCase();
+ return ignoreInfo.ignoredAt(errorCode, errorLine);
+ }
+
+ return errors.where((AnalysisError e) => !isIgnored(e)).toList();
+ }
+
+ /// Find constants to compute.
+ void _findConstants(CompilationUnit unit) {
+ ConstantFinder constantFinder = ConstantFinder();
+ unit.accept(constantFinder);
+ _libraryConstants.addAll(constantFinder.constantsToCompute);
+ _constants.addAll(constantFinder.constantsToCompute);
+
+ var dependenciesFinder = ConstantExpressionsDependenciesFinder();
+ unit.accept(dependenciesFinder);
+ _constants.addAll(dependenciesFinder.dependencies);
+ }
+
+ RecordingErrorListener _getErrorListener(FileState file) =>
+ _errorListeners.putIfAbsent(file, () => RecordingErrorListener());
+
+ ErrorReporter _getErrorReporter(FileState file) {
+ return _errorReporters.putIfAbsent(file, () {
+ RecordingErrorListener listener = _getErrorListener(file);
+ return ErrorReporter(listener, file.source);
+ });
+ }
+
+ /**
+ * Return the name of the library that the given part is declared to be a
+ * part of, or `null` if the part does not contain a part-of directive.
+ */
+ _NameOrSource _getPartLibraryNameOrUri(Source partSource,
+ CompilationUnit partUnit, List<Directive> directivesToResolve) {
+ for (Directive directive in partUnit.directives) {
+ if (directive is PartOfDirective) {
+ directivesToResolve.add(directive);
+ LibraryIdentifier libraryName = directive.libraryName;
+ if (libraryName != null) {
+ return _NameOrSource(libraryName.name, null);
+ }
+ String uri = directive.uri?.stringValue;
+ if (uri != null) {
+ Source librarySource = _sourceFactory.resolveUri(partSource, uri);
+ if (librarySource != null) {
+ return _NameOrSource(null, librarySource);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ bool _isExistingSource(Source source) {
+ for (var file in _library.directReferencedFiles) {
+ if (file.uri == source.uri) {
+ return file.exists;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return `true` if the given [source] is a library.
+ */
+ bool _isLibrarySource(Source source) {
+ return _isLibraryUri(source.uri);
+ }
+
+ /**
+ * Return a parsed unresolved [CompilationUnit].
+ */
+ CompilationUnit _parse(FileState file) {
+ AnalysisErrorListener errorListener = _getErrorListener(file);
+ String content = getFileContent(file.path);
+ CompilationUnit unit = file.parse(errorListener, content);
+
+ LineInfo lineInfo = unit.lineInfo;
+ _fileToLineInfo[file] = lineInfo;
+ _fileToIgnoreInfo[file] = IgnoreInfo.calculateIgnores(content, lineInfo);
+
+ return unit;
+ }
+
+ void _resolveDirectives(Map<FileState, CompilationUnit> units) {
+ CompilationUnit definingCompilationUnit = units[_library];
+ definingCompilationUnit.element = _libraryElement.definingCompilationUnit;
+
+ bool matchNodeElement(Directive node, Element element) {
+ return node.keyword.offset == element.nameOffset;
+ }
+
+ ErrorReporter libraryErrorReporter = _getErrorReporter(_library);
+
+ LibraryIdentifier libraryNameNode;
+ var seenPartSources = Set<Source>();
+ var directivesToResolve = <Directive>[];
+ int partIndex = 0;
+ for (Directive directive in definingCompilationUnit.directives) {
+ if (directive is LibraryDirective) {
+ libraryNameNode = directive.name;
+ directivesToResolve.add(directive);
+ } else if (directive is ImportDirective) {
+ for (ImportElement importElement in _libraryElement.imports) {
+ if (matchNodeElement(directive, importElement)) {
+ directive.element = importElement;
+ directive.prefix?.staticElement = importElement.prefix;
+ Source source = importElement.importedLibrary?.source;
+ if (source != null && !_isLibrarySource(source)) {
+ ErrorCode errorCode = CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY;
+ libraryErrorReporter.reportErrorForNode(
+ errorCode, directive.uri, [directive.uri]);
+ }
+ }
+ }
+ } else if (directive is ExportDirective) {
+ for (ExportElement exportElement in _libraryElement.exports) {
+ if (matchNodeElement(directive, exportElement)) {
+ directive.element = exportElement;
+ Source source = exportElement.exportedLibrary?.source;
+ if (source != null && !_isLibrarySource(source)) {
+ libraryErrorReporter.reportErrorForNode(
+ CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY,
+ directive.uri,
+ [directive.uri]);
+ }
+ }
+ }
+ } else if (directive is PartDirective) {
+ StringLiteral partUri = directive.uri;
+
+ FileState partFile = _library.partedFiles[partIndex];
+ CompilationUnit partUnit = units[partFile];
+ CompilationUnitElement partElement = _libraryElement.parts[partIndex];
+ partUnit.element = partElement;
+ directive.element = partElement;
+ partIndex++;
+
+ Source partSource = directive.uriSource;
+ if (partSource == null) {
+ continue;
+ }
+
+ //
+ // Validate that the part source is unique in the library.
+ //
+ if (!seenPartSources.add(partSource)) {
+ libraryErrorReporter.reportErrorForNode(
+ CompileTimeErrorCode.DUPLICATE_PART, partUri, [partSource.uri]);
+ }
+
+ //
+ // Validate that the part contains a part-of directive with the same
+ // name or uri as the library.
+ //
+ if (_isExistingSource(partSource)) {
+ _NameOrSource nameOrSource = _getPartLibraryNameOrUri(
+ partSource, partUnit, directivesToResolve);
+ if (nameOrSource == null) {
+ libraryErrorReporter.reportErrorForNode(
+ CompileTimeErrorCode.PART_OF_NON_PART,
+ partUri,
+ [partUri.toSource()]);
+ } else {
+ String name = nameOrSource.name;
+ if (name != null) {
+ if (libraryNameNode == null) {
+ libraryErrorReporter.reportErrorForNode(
+ CompileTimeErrorCode.PART_OF_UNNAMED_LIBRARY,
+ partUri,
+ [name]);
+ } else if (libraryNameNode.name != name) {
+ libraryErrorReporter.reportErrorForNode(
+ StaticWarningCode.PART_OF_DIFFERENT_LIBRARY,
+ partUri,
+ [libraryNameNode.name, name]);
+ }
+ } else {
+ Source source = nameOrSource.source;
+ if (source != _library.source) {
+ libraryErrorReporter.reportErrorForNode(
+ StaticWarningCode.PART_OF_DIFFERENT_LIBRARY,
+ partUri,
+ [_library.uriStr, source.uri]);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // TODO(brianwilkerson) Report the error
+ // ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART
+
+ //
+ // Resolve the relevant directives to the library element.
+ //
+ for (Directive directive in directivesToResolve) {
+ directive.element = _libraryElement;
+ }
+
+ // TODO(scheglov) remove DirectiveResolver class
+ }
+
+ void _resolveFile(FileState file, CompilationUnit unit) {
+ Source source = file.source;
+ if (source == null) {
+ return;
+ }
+
+ RecordingErrorListener errorListener = _getErrorListener(file);
+
+ CompilationUnitElement unitElement = unit.declaredElement;
+
+ // TODO(scheglov) Hack: set types for top-level variables
+ // Otherwise TypeResolverVisitor will set declared types, and because we
+ // don't run InferStaticVariableTypeTask, we will stuck with these declared
+ // types. And we don't need to run this task - resynthesized elements have
+ // inferred types.
+ for (var e in unitElement.topLevelVariables) {
+ if (!e.isSynthetic) {
+ e.type;
+ }
+ }
+
+ unit.accept(
+ ResolutionVisitor(
+ unitElement: unitElement,
+ errorListener: errorListener,
+ featureSet: unit.featureSet,
+ nameScope: _libraryScope,
+ elementWalker: ElementWalker.forCompilationUnit(unitElement),
+ ),
+ );
+
+ unit.accept(VariableResolverVisitor(
+ _libraryElement, source, _typeProvider, errorListener,
+ nameScope: _libraryScope));
+
+ // Nothing for RESOLVED_UNIT8?
+ // Nothing for RESOLVED_UNIT9?
+ // Nothing for RESOLVED_UNIT10?
+
+ FlowAnalysisHelper flowAnalysisHelper;
+ if (unit.featureSet.isEnabled(Feature.non_nullable)) {
+ flowAnalysisHelper = FlowAnalysisHelper(_typeSystem, false);
+ }
+
+ unit.accept(ResolverVisitor(
+ _inheritance, _libraryElement, source, _typeProvider, errorListener,
+ featureSet: unit.featureSet, flowAnalysisHelper: flowAnalysisHelper));
+ }
+
+ /**
+ * Return the result of resolve the given [uriContent], reporting errors
+ * against the [uriLiteral].
+ */
+ Source _resolveUri(FileState file, bool isImport, StringLiteral uriLiteral,
+ String uriContent) {
+ UriValidationCode code =
+ UriBasedDirectiveImpl.validateUri(isImport, uriLiteral, uriContent);
+ if (code == null) {
+ try {
+ Uri.parse(uriContent);
+ } on FormatException {
+ return null;
+ }
+ return _sourceFactory.resolveUri(file.source, uriContent);
+ } else if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) {
+ return null;
+ } else if (code == UriValidationCode.URI_WITH_INTERPOLATION) {
+ _getErrorReporter(file).reportErrorForNode(
+ CompileTimeErrorCode.URI_WITH_INTERPOLATION, uriLiteral);
+ return null;
+ } else if (code == UriValidationCode.INVALID_URI) {
+ _getErrorReporter(file).reportErrorForNode(
+ CompileTimeErrorCode.INVALID_URI, uriLiteral, [uriContent]);
+ return null;
+ }
+ return null;
+ }
+
+ void _resolveUriBasedDirectives(FileState file, CompilationUnit unit) {
+ for (Directive directive in unit.directives) {
+ if (directive is UriBasedDirective) {
+ StringLiteral uriLiteral = directive.uri;
+ String uriContent = uriLiteral.stringValue?.trim();
+ directive.uriContent = uriContent;
+ Source defaultSource = _resolveUri(
+ file, directive is ImportDirective, uriLiteral, uriContent);
+ directive.uriSource = defaultSource;
+ }
+ }
+ }
+
+ /// Validate that the feature set associated with the compilation [unit] is
+ /// the same as the [expectedSet] of features supported by the library.
+ void _validateFeatureSet(CompilationUnit unit, FeatureSet expectedSet) {
+ FeatureSet actualSet = unit.featureSet;
+ if (actualSet != expectedSet) {
+ // TODO(brianwilkerson) Generate a diagnostic.
+ }
+ }
+
+ /**
+ * Check the given [directive] to see if the referenced source exists and
+ * report an error if it does not.
+ */
+ void _validateUriBasedDirective(
+ FileState file, UriBasedDirectiveImpl directive) {
+ Source source = directive.uriSource;
+ if (source != null) {
+ if (_isExistingSource(source)) {
+ return;
+ }
+ } else {
+ // Don't report errors already reported by ParseDartTask.resolveDirective
+ // TODO(scheglov) we don't use this task here
+ if (directive.validate() != null) {
+ return;
+ }
+ }
+ StringLiteral uriLiteral = directive.uri;
+ CompileTimeErrorCode errorCode = CompileTimeErrorCode.URI_DOES_NOT_EXIST;
+ if (_isGenerated(source)) {
+ errorCode = CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED;
+ }
+ _getErrorReporter(file)
+ .reportErrorForNode(errorCode, uriLiteral, [directive.uriContent]);
+ }
+
+ /**
+ * Check each directive in the given [unit] to see if the referenced source
+ * exists and report an error if it does not.
+ */
+ void _validateUriBasedDirectives(FileState file, CompilationUnit unit) {
+ for (Directive directive in unit.directives) {
+ if (directive is UriBasedDirective) {
+ _validateUriBasedDirective(file, directive);
+ }
+ }
+ }
+
+ /**
+ * Return `true` if the given [source] refers to a file that is assumed to be
+ * generated.
+ */
+ static bool _isGenerated(Source source) {
+ if (source == null) {
+ return false;
+ }
+ // TODO(brianwilkerson) Generalize this mechanism.
+ const List<String> suffixes = <String>[
+ '.g.dart',
+ '.pb.dart',
+ '.pbenum.dart',
+ '.pbserver.dart',
+ '.pbjson.dart',
+ '.template.dart'
+ ];
+ String fullName = source.fullName;
+ for (String suffix in suffixes) {
+ if (fullName.endsWith(suffix)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+/**
+ * Analysis result for single file.
+ */
+class UnitAnalysisResult {
+ final FileState file;
+ final CompilationUnit unit;
+ final List<AnalysisError> errors;
+
+ UnitAnalysisResult(this.file, this.unit, this.errors);
+}
+
+/**
+ * Either the name or the source associated with a part-of directive.
+ */
+class _NameOrSource {
+ final String name;
+ final Source source;
+
+ _NameOrSource(this.name, this.source);
+}
diff --git a/pkg/analyzer/lib/src/dart/micro/library_graph.dart b/pkg/analyzer/lib/src/dart/micro/library_graph.dart
new file mode 100644
index 0000000..fbccb1d
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/micro/library_graph.dart
@@ -0,0 +1,504 @@
+// Copyright (c) 2020, 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:convert';
+import 'dart:typed_data';
+
+import 'package:_fe_analyzer_shared/src/scanner/token_impl.dart';
+import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/dart/analysis/byte_store.dart';
+import 'package:analyzer/src/dart/analysis/feature_set_provider.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/unlinked_api_signature.dart';
+import 'package:analyzer/src/dart/scanner/reader.dart';
+import 'package:analyzer/src/dart/scanner/scanner.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/parser.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/generated/utilities_dart.dart';
+import 'package:analyzer/src/summary/api_signature.dart';
+import 'package:analyzer/src/summary/format.dart';
+import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary/link.dart' as graph
+ show DependencyWalker, Node;
+import 'package:analyzer/src/summary2/informative_data.dart';
+import 'package:collection/collection.dart';
+
+/// Ensure that the [FileState.libraryCycle] for the [file] and anything it
+/// depends on is computed.
+void computeLibraryCycle(Uint32List linkedSalt, FileState file) {
+ var libraryWalker = _LibraryWalker(linkedSalt);
+ libraryWalker.walk(libraryWalker.getNode(file));
+}
+
+class FileState {
+ final FileSystemState _fsState;
+
+ /**
+ * The path of the file.
+ */
+ final String path;
+
+ /**
+ * The URI of the file.
+ */
+ final Uri uri;
+
+ /**
+ * The [Source] of the file with the [uri].
+ */
+ final Source source;
+
+ /*
+ * A function that returns the digest for a file as a String. The function
+ * returns a non null value, can return an empty string if file does
+ * not exist/has no contents.
+ */
+ final String Function(String path) getFileDigest;
+
+ final List<FileState> importedFiles = [];
+ final List<FileState> exportedFiles = [];
+ final List<FileState> partedFiles = [];
+ final Set<FileState> directReferencedFiles = Set();
+ final Set<FileState> directReferencedLibraries = Set();
+ final List<FileState> libraryFiles = [];
+
+ bool _exists;
+ List<int> _apiSignature;
+ UnlinkedUnit2 unlinked2;
+ LibraryCycle _libraryCycle;
+
+ FileState._(
+ this._fsState, this.path, this.uri, this.source, this.getFileDigest);
+
+ List<int> get apiSignature => _apiSignature;
+
+ bool get exists => _exists;
+
+ /// Return the [LibraryCycle] this file belongs to, even if it consists of
+ /// just this file. If the library cycle is not known yet, compute it.
+ LibraryCycle get libraryCycle {
+ if (_libraryCycle == null) {
+ computeLibraryCycle(_fsState._linkedSalt, this);
+ }
+ return _libraryCycle;
+ }
+
+ /// Return the [uri] string.
+ String get uriStr => uri.toString();
+
+ void internal_setLibraryCycle(LibraryCycle cycle, String signature) {
+ _libraryCycle = cycle;
+ }
+
+ CompilationUnit parse(AnalysisErrorListener errorListener, String content) {
+ AnalysisOptionsImpl analysisOptions = _fsState._analysisOptions;
+ FeatureSet featureSet =
+ _fsState.featureSetProvider.getFeatureSet(path, uri);
+
+ CharSequenceReader reader = CharSequenceReader(content);
+ Scanner scanner = Scanner(source, reader, errorListener)
+ ..configureFeatures(featureSet);
+ Token token = PerformanceStatistics.scan.makeCurrentWhile(() {
+ return scanner.tokenize(reportScannerErrors: false);
+ });
+ LineInfo lineInfo = LineInfo(scanner.lineStarts);
+
+ bool useFasta = analysisOptions.useFastaParser;
+ // Pass the feature set from the scanner to the parser
+ // because the scanner may have detected a language version comment
+ // and downgraded the feature set it holds.
+ Parser parser = Parser(
+ source,
+ errorListener,
+ languageVersion: scanner.languageVersion,
+ featureSet: scanner.featureSet,
+ useFasta: useFasta,
+ );
+ parser.enableOptionalNewAndConst = true;
+ CompilationUnit unit = parser.parseCompilationUnit(token);
+ unit.lineInfo = lineInfo;
+
+ // StringToken uses a static instance of StringCanonicalizer, so we need
+ // to clear it explicitly once we are done using it for this file.
+ StringToken.canonicalizer.clear();
+
+ return unit;
+ }
+
+ void refresh() {
+ var digest = utf8.encode(getFileDigest(path));
+ _exists = digest.isNotEmpty;
+ String unlinkedKey = path;
+
+ // Prepare bytes of the unlinked bundle - existing or new.
+ List<int> bytes;
+ {
+ bytes = _fsState._byteStore.get(unlinkedKey);
+ // unlinked summary should be updated if contents have changed, can be
+ // seen if file digest has changed.
+ if (bytes != null) {
+ var ciderUnlinkedUnit = CiderUnlinkedUnit.fromBuffer(bytes);
+ if (!const ListEquality()
+ .equals(ciderUnlinkedUnit.contentDigest, digest)) {
+ bytes = null;
+ }
+ }
+
+ if (bytes == null || bytes.isEmpty) {
+ String content;
+ try {
+ content = _fsState._resourceProvider.getFile(path).readAsStringSync();
+ } catch (_) {
+ content = '';
+ }
+ var unit = parse(AnalysisErrorListener.NULL_LISTENER, content);
+ _fsState._logger.run('Create unlinked for $path', () {
+ var unlinkedBuilder = serializeAstCiderUnlinked(digest, unit);
+ bytes = unlinkedBuilder.toBuffer();
+ _fsState._byteStore.put(unlinkedKey, bytes);
+ });
+ }
+ }
+
+ // Read the unlinked bundle.
+ unlinked2 = CiderUnlinkedUnit.fromBuffer(bytes).unlinkedUnit;
+ _apiSignature = Uint8List.fromList(unlinked2.apiSignature);
+
+ // Build the graph.
+ for (var directive in unlinked2.imports) {
+ var file = _fileForRelativeUri(directive.uri);
+ importedFiles.add(file);
+ }
+ for (var directive in unlinked2.exports) {
+ var file = _fileForRelativeUri(directive.uri);
+ exportedFiles.add(file);
+ }
+ for (var uri in unlinked2.parts) {
+ var file = _fileForRelativeUri(uri);
+ partedFiles.add(file);
+ }
+ libraryFiles.add(this);
+ libraryFiles.addAll(partedFiles);
+
+ // Compute referenced files.
+ directReferencedFiles
+ ..addAll(importedFiles)
+ ..addAll(exportedFiles)
+ ..addAll(partedFiles);
+ directReferencedLibraries..addAll(importedFiles)..addAll(exportedFiles);
+ }
+
+ FileState _fileForRelativeUri(String relativeUri) {
+ if (relativeUri.isEmpty) {
+ return _fsState.unresolvedFile;
+ }
+
+ Uri absoluteUri;
+ try {
+ absoluteUri = resolveRelativeUri(uri, Uri.parse(relativeUri));
+ } on FormatException {
+ return _fsState.unresolvedFile;
+ }
+
+ return _fsState.getFileForUri(absoluteUri);
+ }
+
+ static CiderUnlinkedUnitBuilder serializeAstCiderUnlinked(
+ List<int> digest, CompilationUnit unit) {
+ var exports = <UnlinkedNamespaceDirectiveBuilder>[];
+ var imports = <UnlinkedNamespaceDirectiveBuilder>[];
+ var parts = <String>[];
+ var hasDartCoreImport = false;
+ var hasLibraryDirective = false;
+ var hasPartOfDirective = false;
+ for (var directive in unit.directives) {
+ if (directive is ExportDirective) {
+ var builder = _serializeNamespaceDirective(directive);
+ exports.add(builder);
+ } else if (directive is ImportDirective) {
+ var builder = _serializeNamespaceDirective(directive);
+ imports.add(builder);
+ if (builder.uri == 'dart:core') {
+ hasDartCoreImport = true;
+ }
+ } else if (directive is LibraryDirective) {
+ hasLibraryDirective = true;
+ } else if (directive is PartDirective) {
+ var uriStr = directive.uri.stringValue;
+ parts.add(uriStr ?? '');
+ } else if (directive is PartOfDirective) {
+ hasPartOfDirective = true;
+ }
+ }
+ if (!hasDartCoreImport) {
+ imports.add(
+ UnlinkedNamespaceDirectiveBuilder(
+ uri: 'dart:core',
+ ),
+ );
+ }
+ var informativeData = createInformativeData(unit);
+ var unlinkedBuilder = UnlinkedUnit2Builder(
+ apiSignature: computeUnlinkedApiSignature(unit),
+ exports: exports,
+ imports: imports,
+ parts: parts,
+ hasLibraryDirective: hasLibraryDirective,
+ hasPartOfDirective: hasPartOfDirective,
+ lineStarts: unit.lineInfo.lineStarts,
+ informativeData: informativeData,
+ );
+ return CiderUnlinkedUnitBuilder(
+ contentDigest: digest, unlinkedUnit: unlinkedBuilder);
+ }
+
+ static UnlinkedNamespaceDirectiveBuilder _serializeNamespaceDirective(
+ NamespaceDirective directive) {
+ return UnlinkedNamespaceDirectiveBuilder(
+ configurations: directive.configurations.map((configuration) {
+ var name = configuration.name.components.join('.');
+ var value = configuration.value?.stringValue ?? '';
+ return UnlinkedNamespaceDirectiveConfigurationBuilder(
+ name: name,
+ value: value,
+ uri: configuration.uri.stringValue ?? '',
+ );
+ }).toList(),
+ uri: directive.uri.stringValue ?? '',
+ );
+ }
+}
+
+class FileSystemState {
+ final PerformanceLog _logger;
+ final ResourceProvider _resourceProvider;
+ final MemoryByteStore _byteStore;
+ final SourceFactory _sourceFactory;
+ final AnalysisOptions _analysisOptions;
+ final Uint32List _linkedSalt;
+ final String Function(String path) getFileDigest;
+
+ final Map<String, FileState> _pathToFile = {};
+ final Map<Uri, FileState> _uriToFile = {};
+
+ final FeatureSetProvider featureSetProvider;
+
+ /**
+ * The [FileState] instance that correspond to an unresolved URI.
+ */
+ FileState _unresolvedFile;
+
+ FileSystemState(
+ this._logger,
+ this._resourceProvider,
+ this._byteStore,
+ this._sourceFactory,
+ this._analysisOptions,
+ this._linkedSalt,
+ this.featureSetProvider,
+ this.getFileDigest,
+ );
+
+ /**
+ * Return the [FileState] instance that correspond to an unresolved URI.
+ */
+ FileState get unresolvedFile {
+ if (_unresolvedFile == null) {
+ _unresolvedFile = FileState._(this, null, null, null, null);
+ _unresolvedFile.refresh();
+ }
+ return _unresolvedFile;
+ }
+
+ FileState getFileForPath(String path) {
+ var file = _pathToFile[path];
+ if (file == null) {
+ var fileUri = _resourceProvider.pathContext.toUri(path);
+ var uri = _sourceFactory.restoreUri(
+ _FakeSource(path, fileUri),
+ );
+
+ var source = _sourceFactory.forUri2(uri);
+ file = FileState._(this, path, uri, source, getFileDigest);
+
+ _pathToFile[path] = file;
+ _uriToFile[uri] = file;
+
+ file.refresh();
+ }
+ return file;
+ }
+
+ FileState getFileForUri(Uri uri) {
+ FileState file = _uriToFile[uri];
+ if (file == null) {
+ var source = _sourceFactory.forUri2(uri);
+ if (source == null) {
+ print('[library_graph] could not create source for $uri');
+ }
+ var path = source.fullName;
+
+ file = FileState._(this, path, uri, source, getFileDigest);
+ _pathToFile[path] = file;
+ _uriToFile[uri] = file;
+
+ file.refresh();
+ }
+ return file;
+ }
+}
+
+/// Information about libraries that reference each other, so form a cycle.
+class LibraryCycle {
+ /// The libraries that belong to this cycle.
+ final List<FileState> libraries = [];
+
+ /// The library cycles that this cycle references directly.
+ final Set<LibraryCycle> directDependencies = Set<LibraryCycle>();
+
+ /// The transitive signature of this cycle.
+ ///
+ /// It is based on the API signatures of all files of the [libraries], and
+ /// the signatures of the cycles that the [libraries] reference
+ /// directly. So, indirectly it is based on the transitive closure of all
+ /// files that [libraries] reference (but we don't compute these files).
+ List<int> signature;
+
+ // The hash for all the paths of the files in this cycle.
+ String cyclePathsHash;
+
+ LibraryCycle();
+
+ @override
+ String toString() {
+ return '[' + libraries.join(', ') + ']';
+ }
+}
+
+class _FakeSource implements Source {
+ @override
+ final String fullName;
+
+ @override
+ final Uri uri;
+
+ _FakeSource(this.fullName, this.uri);
+
+ @override
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
+
+/// Node in [_LibraryWalker].
+class _LibraryNode extends graph.Node<_LibraryNode> {
+ final _LibraryWalker walker;
+ final FileState file;
+
+ _LibraryNode(this.walker, this.file);
+
+ @override
+ bool get isEvaluated => file._libraryCycle != null;
+
+ @override
+ List<_LibraryNode> computeDependencies() {
+ return file.directReferencedLibraries.map(walker.getNode).toList();
+ }
+}
+
+/// Helper that organizes dependencies of a library into topologically
+/// sorted [LibraryCycle]s.
+class _LibraryWalker extends graph.DependencyWalker<_LibraryNode> {
+ final Uint32List _linkedSalt;
+ final Map<FileState, _LibraryNode> nodesOfFiles = {};
+
+ _LibraryWalker(this._linkedSalt);
+
+ @override
+ void evaluate(_LibraryNode v) {
+ evaluateScc([v]);
+ }
+
+ @override
+ void evaluateScc(List<_LibraryNode> scc) {
+ var cycle = LibraryCycle();
+
+ var signature = ApiSignature();
+ signature.addUint32List(_linkedSalt);
+
+ // Sort libraries to produce stable signatures.
+ scc.sort((first, second) {
+ var firstPath = first.file.path;
+ var secondPath = second.file.path;
+ return firstPath.compareTo(secondPath);
+ });
+
+ // Append direct referenced cycles.
+ for (var node in scc) {
+ var file = node.file;
+ _appendDirectlyReferenced(cycle, signature, file.importedFiles);
+ _appendDirectlyReferenced(cycle, signature, file.exportedFiles);
+ }
+
+ // Fill the cycle with libraries.
+ for (var node in scc) {
+ cycle.libraries.add(node.file);
+
+ signature.addString(node.file.uriStr);
+
+ signature.addInt(node.file.libraryFiles.length);
+ for (var file in node.file.libraryFiles) {
+ signature.addBool(file.exists);
+ signature.addBytes(file.apiSignature);
+ }
+ }
+
+ // Compute the general library cycle signature.
+ cycle.signature = signature.toByteList();
+
+ // Compute the cycle file paths signature.
+ var filePathsSignature = ApiSignature();
+ for (var node in scc) {
+ filePathsSignature.addString(node.file.path);
+ }
+ cycle.cyclePathsHash = filePathsSignature.toHex();
+
+ // Compute library specific signatures.
+ for (var node in scc) {
+ var librarySignatureBuilder = ApiSignature()
+ ..addString(node.file.uriStr)
+ ..addBytes(cycle.signature);
+ var librarySignature = librarySignatureBuilder.toHex();
+
+ node.file.internal_setLibraryCycle(
+ cycle,
+ librarySignature,
+ );
+ }
+ }
+
+ _LibraryNode getNode(FileState file) {
+ return nodesOfFiles.putIfAbsent(file, () => _LibraryNode(this, file));
+ }
+
+ void _appendDirectlyReferenced(
+ LibraryCycle cycle,
+ ApiSignature signature,
+ List<FileState> directlyReferenced,
+ ) {
+ signature.addInt(directlyReferenced.length);
+ for (var referencedLibrary in directlyReferenced) {
+ var referencedCycle = referencedLibrary._libraryCycle;
+ // We get null when the library is a part of the cycle being build.
+ if (referencedCycle == null) continue;
+
+ if (cycle.directDependencies.add(referencedCycle)) {
+ signature.addBytes(referencedCycle.signature);
+ }
+ }
+ }
+}
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
new file mode 100644
index 0000000..86cf045
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -0,0 +1,375 @@
+// Copyright (c) 2020, 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:typed_data';
+
+import 'package:analyzer/dart/analysis/context_locator.dart';
+import 'package:analyzer/dart/analysis/declared_variables.dart';
+import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/dart/analysis/session.dart';
+import 'package:analyzer/src/context/context.dart';
+import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
+import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/context/packages.dart';
+import 'package:analyzer/src/dart/analysis/byte_store.dart';
+import 'package:analyzer/src/dart/analysis/feature_set_provider.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
+import 'package:analyzer/src/dart/analysis/results.dart';
+import 'package:analyzer/src/dart/analysis/session.dart';
+import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
+import 'package:analyzer/src/dart/micro/analysis_context.dart';
+import 'package:analyzer/src/dart/micro/library_analyzer.dart';
+import 'package:analyzer/src/dart/micro/library_graph.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/summary/format.dart';
+import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary2/link.dart' as link2;
+import 'package:analyzer/src/summary2/linked_bundle_context.dart';
+import 'package:analyzer/src/summary2/linked_element_factory.dart';
+import 'package:analyzer/src/summary2/reference.dart';
+import 'package:analyzer/src/workspace/workspace.dart';
+import 'package:collection/collection.dart';
+
+/*
+ * Resolves a single file.
+ */
+class FileResolver {
+ final PerformanceLog logger;
+ final ResourceProvider resourceProvider;
+ final MemoryByteStore byteStore;
+ final SourceFactory sourceFactory;
+
+ /*
+ * A function that returns the digest for a file as a String. The function
+ * returns a non null value, can return an empty string if file does
+ * not exist/has no contents.
+ */
+ final String Function(String path) getFileDigest;
+
+ Workspace workspace;
+
+ MicroAnalysisContextImpl analysisContext;
+
+ FileResolver(this.logger, this.resourceProvider, this.byteStore,
+ this.sourceFactory, this.getFileDigest,
+ {Workspace workspace})
+ : this.workspace = workspace;
+
+ FeatureSet get defaultFeatureSet => FeatureSet.fromEnableFlags([]);
+
+ ResolvedUnitResult resolve(String path) {
+ _throwIfNotAbsoluteNormalizedPath(path);
+
+ return logger.run('Resolve $path', () {
+ logger.run('Create AnalysisContext', () {
+ var contextLocator = ContextLocator(
+ resourceProvider: this.resourceProvider,
+ );
+
+ var roots = contextLocator.locateRoots(
+ includedPaths: [path],
+ excludedPaths: [],
+ );
+ if (roots.length != 1) {
+ throw StateError('Exactly one root expected: $roots');
+ }
+ var root = roots[0];
+
+ var analysisOptions = AnalysisOptionsImpl();
+ var declaredVariables = DeclaredVariables();
+
+ analysisContext = MicroAnalysisContextImpl(
+ this,
+ root,
+ analysisOptions,
+ declaredVariables,
+ sourceFactory,
+ resourceProvider,
+ workspace: workspace,
+ );
+ });
+
+ return _resolve(path);
+ });
+ }
+
+ ResolvedUnitResultImpl _resolve(String path) {
+ var options = analysisContext.analysisOptions;
+ var featureSetProvider = FeatureSetProvider.build(
+ resourceProvider: resourceProvider,
+ packages: Packages.empty,
+ sourceFactory: analysisContext.sourceFactory,
+ packageDefaultFeatureSet: analysisContext.analysisOptions.contextFeatures,
+ nonPackageDefaultFeatureSet:
+ (options as AnalysisOptionsImpl).nonPackageFeatureSet,
+ );
+
+ var fsState = FileSystemState(
+ logger,
+ resourceProvider,
+ byteStore,
+ analysisContext.sourceFactory,
+ analysisContext.analysisOptions,
+ Uint32List(0), // linkedSalt
+ featureSetProvider,
+ getFileDigest,
+ );
+
+ FileState file;
+ logger.run('Get file $path', () {
+ file = fsState.getFileForPath(path);
+ });
+
+ var errorListener = RecordingErrorListener();
+ var content = resourceProvider.getFile(path).readAsStringSync();
+ var unit = file.parse(errorListener, content);
+
+ _LibraryContext libraryContext = _LibraryContext(
+ logger,
+ resourceProvider,
+ byteStore,
+ analysisContext.currentSession,
+ analysisContext.analysisOptions,
+ analysisContext.sourceFactory,
+ analysisContext.declaredVariables,
+ );
+ libraryContext.load2(file);
+
+ Map<FileState, UnitAnalysisResult> results;
+ logger.run('Compute analysis results', () {
+ var libraryAnalyzer = LibraryAnalyzer(
+ analysisContext.analysisOptions,
+ analysisContext.declaredVariables,
+ analysisContext.sourceFactory,
+ (_) => true, // _isLibraryUri
+ libraryContext.analysisContext,
+ libraryContext.elementFactory,
+ libraryContext.inheritanceManager,
+ file,
+ resourceProvider,
+ (String path) => resourceProvider.getFile(path).readAsStringSync(),
+ );
+
+ results = libraryAnalyzer.analyzeSync();
+ });
+ UnitAnalysisResult fileResult = results[file];
+
+ return ResolvedUnitResultImpl(
+ analysisContext.currentSession,
+ path,
+ file.uri,
+ file.exists,
+ content,
+ unit.lineInfo,
+ false, // isPart
+ fileResult.unit,
+ fileResult.errors,
+ );
+ }
+
+ void _throwIfNotAbsoluteNormalizedPath(String path) {
+ var pathContext = resourceProvider.pathContext;
+ if (pathContext.normalize(path) != path) {
+ throw ArgumentError(
+ 'Only normalized paths are supported: $path',
+ );
+ }
+ }
+}
+
+class _LibraryContext {
+ final PerformanceLog logger;
+ final ResourceProvider resourceProvider;
+ final MemoryByteStore byteStore;
+ final AnalysisSession analysisSession;
+
+ AnalysisContextImpl analysisContext;
+ LinkedElementFactory elementFactory;
+ InheritanceManager3 inheritanceManager;
+
+ Set<LibraryCycle> loadedBundles = Set.identity();
+
+ _LibraryContext(
+ this.logger,
+ this.resourceProvider,
+ this.byteStore,
+ this.analysisSession,
+ AnalysisOptionsImpl analysisOptions,
+ SourceFactory sourceFactory,
+ DeclaredVariables declaredVariables,
+ ) {
+ var synchronousSession =
+ SynchronousSession(analysisOptions, declaredVariables);
+ analysisContext = AnalysisContextImpl(
+ synchronousSession,
+ sourceFactory,
+ );
+
+ _createElementFactory();
+ }
+
+ /// Load data required to access elements of the given [targetLibrary].
+ void load2(FileState targetLibrary) {
+ var inputBundles = <LinkedNodeBundle>[];
+
+ var numCycles = 0;
+ var librariesTotal = 0;
+ var librariesLoaded = 0;
+ var librariesLinked = 0;
+ var librariesLinkedTimer = Stopwatch();
+ var inputsTimer = Stopwatch();
+ var bytesGet = 0;
+ var bytesPut = 0;
+
+ void loadBundle(LibraryCycle cycle) {
+ if (!loadedBundles.add(cycle)) return;
+
+ numCycles++;
+ librariesTotal += cycle.libraries.length;
+
+ cycle.directDependencies.forEach(loadBundle);
+
+ var key = cycle.cyclePathsHash;
+ var bytes = byteStore.get(key);
+
+ // check to see if any of the sources have changed
+ if (bytes != null) {
+ var hash = CiderLinkedLibraryCycle.fromBuffer(bytes).signature;
+ if (!const ListEquality().equals(hash, cycle.signature)) {
+ bytes = null;
+ }
+ }
+
+ if (bytes == null) {
+ librariesLinkedTimer.start();
+
+ inputsTimer.start();
+ var inputLibraries = <link2.LinkInputLibrary>[];
+ for (var libraryFile in cycle.libraries) {
+ var librarySource = libraryFile.source;
+ if (librarySource == null) continue;
+
+ var inputUnits = <link2.LinkInputUnit>[];
+ var partIndex = -1;
+ for (var file in libraryFile.libraryFiles) {
+ var isSynthetic = !file.exists;
+ var content = '';
+ try {
+ content = resourceProvider.getFile(file.path).readAsStringSync();
+ } catch (_) {}
+ var unit = file.parse(
+ AnalysisErrorListener.NULL_LISTENER,
+ content,
+ );
+
+ String partUriStr;
+ if (partIndex >= 0) {
+ partUriStr = libraryFile.unlinked2.parts[partIndex];
+ }
+ partIndex++;
+
+ inputUnits.add(
+ link2.LinkInputUnit(
+ partUriStr,
+ file.source,
+ isSynthetic,
+ unit,
+ ),
+ );
+ }
+
+ inputLibraries.add(
+ link2.LinkInputLibrary(librarySource, inputUnits),
+ );
+ }
+ inputsTimer.stop();
+
+ var linkResult = link2.link(elementFactory, inputLibraries);
+ librariesLinked += cycle.libraries.length;
+
+ bytes = serializeBundle(cycle.signature, linkResult).toBuffer();
+
+ byteStore.put(key, bytes);
+ bytesPut += bytes.length;
+
+ librariesLinkedTimer.stop();
+ } else {
+ // TODO(scheglov) Take / clear parsed units in files.
+ bytesGet += bytes.length;
+ librariesLoaded += cycle.libraries.length;
+ }
+
+ // We are about to load dart:core, but if we have just linked it, the
+ // linker might have set the type provider. So, clear it, and recreate
+ // the element factory - it is empty anyway.
+ if (!elementFactory.hasDartCore) {
+ analysisContext.clearTypeProvider();
+ _createElementFactory();
+ }
+ var cBundle = CiderLinkedLibraryCycle.fromBuffer(bytes);
+ inputBundles.add(cBundle.bundle);
+ elementFactory.addBundle(
+ LinkedBundleContext(elementFactory, cBundle.bundle),
+ );
+
+ // Set informative data.
+ for (var libraryFile in cycle.libraries) {
+ for (var unitFile in libraryFile.libraryFiles) {
+ elementFactory.setInformativeData(
+ libraryFile.uriStr,
+ unitFile.uriStr,
+ unitFile.unlinked2.informativeData,
+ );
+ }
+ }
+ }
+
+ logger.run('Prepare linked bundles', () {
+ var libraryCycle = targetLibrary.libraryCycle;
+ loadBundle(libraryCycle);
+ logger.writeln(
+ '[numCycles: $numCycles]'
+ '[librariesTotal: $librariesTotal]'
+ '[librariesLoaded: $librariesLoaded]'
+ '[inputsTimer: ${inputsTimer.elapsedMilliseconds} ms]'
+ '[librariesLinked: $librariesLinked]'
+ '[librariesLinkedTimer: ${librariesLinkedTimer.elapsedMilliseconds} ms]'
+ '[bytesGet: $bytesGet][bytesPut: $bytesPut]',
+ );
+ });
+
+ // There might be a rare (and wrong) situation, when the external summaries
+ // already include the [targetLibrary]. When this happens, [loadBundle]
+ // exists without doing any work. But the type provider must be created.
+ _createElementFactoryTypeProvider();
+ inheritanceManager = InheritanceManager3();
+ }
+
+ static CiderLinkedLibraryCycleBuilder serializeBundle(
+ List<int> signature, link2.LinkResult linkResult) {
+ return CiderLinkedLibraryCycleBuilder(
+ signature: signature,
+ bundle: linkResult.bundle,
+ );
+ }
+
+ void _createElementFactory() {
+ elementFactory = LinkedElementFactory(
+ analysisContext,
+ analysisSession,
+ Reference.root(),
+ );
+ }
+
+ /// Ensure that type provider is created.
+ void _createElementFactoryTypeProvider() {
+ if (analysisContext.typeProviderNonNullableByDefault == null) {
+ var dartCore = elementFactory.libraryOfUri('dart:core');
+ var dartAsync = elementFactory.libraryOfUri('dart:async');
+ elementFactory.createTypeProviders(dartCore, dartAsync);
+ }
+ }
+}
diff --git a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
index f51e9a1..7ceee5d 100644
--- a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
@@ -339,7 +339,7 @@
/// The visitor that gathers local variables that are potentially assigned
/// in corresponding statements, such as loops, `switch` and `try`.
class _AssignedVariablesVisitor extends RecursiveAstVisitor<void> {
- final AssignedVariables assignedVariables;
+ final AssignedVariables<AstNode, PromotableElement> assignedVariables;
_AssignedVariablesVisitor(this.assignedVariables);
diff --git a/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart
new file mode 100644
index 0000000..d7a6426
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart
@@ -0,0 +1,173 @@
+// Copyright (c) 2020, 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/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/type_system.dart';
+import 'package:meta/meta.dart';
+
+/// Helper for resolving [ForStatement]s and [ForElement]s.
+class ForResolver {
+ final ResolverVisitor _resolver;
+ final FlowAnalysisHelper _flowAnalysis;
+
+ ForResolver({
+ @required ResolverVisitor resolver,
+ @required FlowAnalysisHelper flowAnalysis,
+ }) : _resolver = resolver,
+ _flowAnalysis = flowAnalysis;
+
+ void resolveElement(ForElementImpl node) {
+ var forLoopParts = node.forLoopParts;
+ if (forLoopParts is ForParts) {
+ _forParts(node, forLoopParts, node.body);
+ } else if (forLoopParts is ForEachParts) {
+ _forEachParts(node, node.awaitKeyword != null, forLoopParts, node.body);
+ }
+ }
+
+ void resolveStatement(ForStatementImpl node) {
+ _flowAnalysis?.checkUnreachableNode(node);
+
+ var forLoopParts = node.forLoopParts;
+ if (forLoopParts is ForParts) {
+ _forParts(node, forLoopParts, node.body);
+ } else if (forLoopParts is ForEachParts) {
+ _forEachParts(node, node.awaitKeyword != null, forLoopParts, node.body);
+ }
+ }
+
+ /// Given an iterable expression from a foreach loop, attempt to infer
+ /// a type for the elements being iterated over. Inference is based
+ /// on the type of the iterator or stream over which the foreach loop
+ /// is defined.
+ DartType _computeForEachElementType(Expression iterable, bool isAsync) {
+ DartType iterableType = iterable.staticType;
+ if (iterableType == null) return null;
+ iterableType =
+ iterableType.resolveToBound(_resolver.typeProvider.objectType);
+
+ ClassElement iteratedElement = isAsync
+ ? _resolver.typeProvider.streamElement
+ : _resolver.typeProvider.iterableElement;
+
+ InterfaceType iteratedType = iterableType is InterfaceTypeImpl
+ ? iterableType.asInstanceOf(iteratedElement)
+ : null;
+
+ if (iteratedType != null) {
+ return iteratedType.typeArguments.single;
+ } else {
+ return null;
+ }
+ }
+
+ void _forEachParts(
+ AstNode node,
+ bool isAsync,
+ ForEachParts forEachParts,
+ AstNode body,
+ ) {
+ Expression iterable = forEachParts.iterable;
+ DeclaredIdentifier loopVariable;
+ SimpleIdentifier identifier;
+ Element identifierElement;
+ if (forEachParts is ForEachPartsWithDeclaration) {
+ loopVariable = forEachParts.loopVariable;
+ } else if (forEachParts is ForEachPartsWithIdentifier) {
+ identifier = forEachParts.identifier;
+ identifier?.accept(_resolver);
+ }
+
+ DartType valueType;
+ if (loopVariable != null) {
+ TypeAnnotation typeAnnotation = loopVariable.type;
+ valueType = typeAnnotation?.type ?? UnknownInferredType.instance;
+ }
+ if (identifier != null) {
+ identifierElement = identifier.staticElement;
+ if (identifierElement is VariableElement) {
+ valueType = identifierElement.type;
+ } else if (identifierElement is PropertyAccessorElement) {
+ var parameters = identifierElement.parameters;
+ if (parameters.isNotEmpty) {
+ valueType = parameters[0].type;
+ }
+ }
+ }
+ if (valueType != null) {
+ InterfaceType targetType = isAsync
+ ? _resolver.typeProvider.streamType2(valueType)
+ : _resolver.typeProvider.iterableType2(valueType);
+ InferenceContext.setType(iterable, targetType);
+ }
+
+ iterable?.accept(_resolver);
+ iterable = forEachParts.iterable;
+
+ _resolver.nullableDereferenceVerifier.expression(iterable);
+
+ loopVariable?.accept(_resolver);
+ var elementType = _computeForEachElementType(iterable, isAsync);
+ if (loopVariable != null &&
+ elementType != null &&
+ loopVariable.type == null) {
+ var loopVariableElement =
+ loopVariable.declaredElement as LocalVariableElementImpl;
+ loopVariableElement.type = elementType;
+ }
+
+ _flowAnalysis?.flow?.forEach_bodyBegin(
+ node,
+ identifierElement is VariableElement
+ ? identifierElement
+ : loopVariable?.declaredElement,
+ elementType ?? DynamicTypeImpl.instance,
+ );
+
+ _resolveBody(body);
+
+ _flowAnalysis?.flow?.forEach_end();
+ }
+
+ void _forParts(AstNode node, ForParts forParts, AstNode body) {
+ if (forParts is ForPartsWithDeclarations) {
+ forParts.variables?.accept(_resolver);
+ } else if (forParts is ForPartsWithExpression) {
+ forParts.initialization?.accept(_resolver);
+ }
+
+ _flowAnalysis?.for_conditionBegin(node);
+
+ var condition = forParts.condition;
+ if (condition != null) {
+ InferenceContext.setType(condition, _resolver.typeProvider.boolType);
+ condition.accept(_resolver);
+ condition = forParts.condition;
+ _resolver.boolExpressionVerifier.checkForNonBoolCondition(condition);
+ }
+
+ _flowAnalysis?.for_bodyBegin(node, condition);
+ _resolveBody(body);
+
+ _flowAnalysis?.flow?.for_updaterBegin();
+ forParts.updaters.accept(_resolver);
+
+ _flowAnalysis?.flow?.for_end();
+ }
+
+ void _resolveBody(AstNode body) {
+ if (body is Statement) {
+ _resolver.visitStatementInScope(body);
+ } else {
+ body.accept(_resolver);
+ }
+ }
+}
diff --git a/pkg/analyzer/lib/src/dart/resolver/type_name_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/type_name_resolver.dart
index 982e042..cbf7366 100644
--- a/pkg/analyzer/lib/src/dart/resolver/type_name_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/type_name_resolver.dart
@@ -81,8 +81,8 @@
TypeArgumentList argumentList = node.typeArguments;
Element element = nameScope.lookup(typeName, definingLibrary);
if (element == null) {
+ node.type = dynamicType;
if (nameScope.shouldIgnoreUndefined(typeName)) {
- node.type = dynamicType;
return;
}
//
@@ -102,7 +102,6 @@
element = nameScope.lookup(prefix, definingLibrary);
if (element is PrefixElement) {
if (nameScope.shouldIgnoreUndefined(typeName)) {
- node.type = dynamicType;
return;
}
AstNode grandParent = parent.parent;
@@ -143,7 +142,6 @@
}
}
if (nameScope.shouldIgnoreUndefined(typeName)) {
- node.type = dynamicType;
return;
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
new file mode 100644
index 0000000..9928a16
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
@@ -0,0 +1,175 @@
+// Copyright (c) 2020, 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/dart/element/type_provider.dart';
+import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/type_system.dart';
+import 'package:meta/meta.dart';
+
+/// Helper for resolving [YieldStatement]s.
+class YieldStatementResolver {
+ final ResolverVisitor _resolver;
+
+ YieldStatementResolver({
+ @required ResolverVisitor resolver,
+ }) : _resolver = resolver;
+
+ ExecutableElement get _enclosingFunction => _resolver.enclosingFunction;
+
+ ErrorReporter get _errorReporter => _resolver.errorReporter;
+
+ TypeProvider get _typeProvider => _resolver.typeProvider;
+
+ TypeSystemImpl get _typeSystem => _resolver.typeSystem;
+
+ void resolve(YieldStatement node) {
+ if (_enclosingFunction?.isGenerator ?? false) {
+ _resolve_generator(node);
+ } else {
+ _resolve_notGenerator(node);
+ }
+ }
+
+ /// Check for situations where the result of a method or function is used, when
+ /// it returns 'void'. Or, in rare cases, when other types of expressions are
+ /// void, such as identifiers.
+ ///
+ /// See [StaticWarningCode.USE_OF_VOID_RESULT].
+ ///
+ /// TODO(scheglov) This is duplicate
+ /// TODO(scheglov) Also in [BoolExpressionVerifier]
+ bool _checkForUseOfVoidResult(Expression expression) {
+ if (!identical(expression.staticType, VoidTypeImpl.instance)) {
+ return false;
+ }
+
+ if (expression is MethodInvocation) {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.USE_OF_VOID_RESULT,
+ expression.methodName,
+ );
+ } else {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.USE_OF_VOID_RESULT,
+ expression,
+ );
+ }
+
+ return true;
+ }
+
+ /// Check for a type mis-match between the yielded type and the declared
+ /// return type of a generator function.
+ ///
+ /// This method should only be called in generator functions.
+ void _checkForYieldOfInvalidType(YieldStatement node, bool isYieldEach) {
+ var declaredReturnType = _enclosingFunction.returnType;
+
+ var expression = node.expression;
+ var expressionType = expression.staticType;
+
+ DartType impliedReturnType;
+ if (isYieldEach) {
+ impliedReturnType = expressionType;
+ } else if (_enclosingFunction.isSynchronous) {
+ impliedReturnType = _typeProvider.iterableType2(expressionType);
+ } else {
+ impliedReturnType = _typeProvider.streamType2(expressionType);
+ }
+
+ if (declaredReturnType != null) {
+ if (!_typeSystem.isAssignableTo2(impliedReturnType, declaredReturnType)) {
+ _errorReporter.reportErrorForNode(
+ StaticTypeWarningCode.YIELD_OF_INVALID_TYPE,
+ expression,
+ [impliedReturnType, declaredReturnType],
+ );
+ return;
+ }
+ }
+
+ if (isYieldEach) {
+ // Since the declared return type might have been "dynamic", we need to
+ // also check that the implied return type is assignable to generic
+ // Iterable/Stream.
+ DartType requiredReturnType;
+ if (_enclosingFunction.isSynchronous) {
+ requiredReturnType = _typeProvider.iterableDynamicType;
+ } else {
+ requiredReturnType = _typeProvider.streamDynamicType;
+ }
+
+ if (!_typeSystem.isAssignableTo2(impliedReturnType, requiredReturnType)) {
+ _errorReporter.reportErrorForNode(
+ StaticTypeWarningCode.YIELD_OF_INVALID_TYPE,
+ expression,
+ [impliedReturnType, requiredReturnType],
+ );
+ }
+ }
+ }
+
+ void _computeElementType(YieldStatement node) {
+ var elementType = _resolver.inferenceContext.returnContext;
+ if (elementType != null) {
+ var contextType = elementType;
+ if (node.star != null) {
+ contextType = _enclosingFunction.isSynchronous
+ ? _typeProvider.iterableType2(elementType)
+ : _typeProvider.streamType2(elementType);
+ }
+ InferenceContext.setType(node.expression, contextType);
+ }
+ }
+
+ void _resolve_generator(YieldStatement node) {
+ _computeElementType(node);
+
+ node.expression.accept(_resolver);
+
+ if (node.star != null) {
+ _resolver.nullableDereferenceVerifier.expression(node.expression);
+ }
+
+ DartType type = node.expression?.staticType;
+ // If this just a yield, then we just pass on the element type
+ if (node.star != null) {
+ // If this is a yield*, then we unwrap the element return type
+ // If it's synchronous, we expect Iterable<T>, otherwise Stream<T>
+ if (type is InterfaceType) {
+ ClassElement wrapperElement = _enclosingFunction.isSynchronous
+ ? _typeProvider.iterableElement
+ : _typeProvider.streamElement;
+ var asInstanceType =
+ (type as InterfaceTypeImpl).asInstanceOf(wrapperElement);
+ if (asInstanceType != null) {
+ type = asInstanceType.typeArguments[0];
+ }
+ }
+ }
+ _resolver.inferenceContext.addReturnOrYieldType(type);
+
+ _checkForYieldOfInvalidType(node, node.star != null);
+ _checkForUseOfVoidResult(node.expression);
+ }
+
+ void _resolve_notGenerator(YieldStatement node) {
+ node.expression.accept(_resolver);
+
+ _errorReporter.reportErrorForNode(
+ node.star != null
+ ? CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR
+ : CompileTimeErrorCode.YIELD_IN_NON_GENERATOR,
+ node,
+ );
+
+ _checkForUseOfVoidResult(node.expression);
+ }
+}
diff --git a/pkg/analyzer/lib/src/dart/scanner/scanner.dart b/pkg/analyzer/lib/src/dart/scanner/scanner.dart
index 6058b89..bdcc724 100644
--- a/pkg/analyzer/lib/src/dart/scanner/scanner.dart
+++ b/pkg/analyzer/lib/src/dart/scanner/scanner.dart
@@ -8,6 +8,7 @@
import 'package:_fe_analyzer_shared/src/scanner/token.dart'
show Token, TokenType;
import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/ast/language_version.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
@@ -71,6 +72,8 @@
*/
bool enableNonNullable = false;
+ LanguageVersion _languageVersion;
+
FeatureSet _featureSet;
/**
@@ -107,6 +110,12 @@
*/
FeatureSet get featureSet => _featureSet;
+ /**
+ * The language version override specified for this compilation unit using a
+ * token like '// @dart = 2.7', or `null` if no override is specified.
+ */
+ LanguageVersion get languageVersion => _languageVersion;
+
set preserveComments(bool preserveComments) {
this._preserveComments = preserveComments;
}
@@ -189,8 +198,12 @@
void _languageVersionChanged(
fasta.Scanner scanner, fasta.LanguageVersionToken languageVersion) {
- if (_featureSet != null) {
- if (languageVersion.major >= 0 && languageVersion.minor >= 0) {
+ if (languageVersion.major >= 0 && languageVersion.minor >= 0) {
+ _languageVersion = LanguageVersion(
+ languageVersion.major,
+ languageVersion.minor,
+ );
+ if (_featureSet != null) {
_featureSet = _featureSet.restrictToVersion(
Version(languageVersion.major, languageVersion.minor, 0));
scanner.configuration = buildConfig(_featureSet);
diff --git a/pkg/analyzer/lib/src/dart/sdk/patch.dart b/pkg/analyzer/lib/src/dart/sdk/patch.dart
deleted file mode 100644
index 8acc3ab..0000000
--- a/pkg/analyzer/lib/src/dart/sdk/patch.dart
+++ /dev/null
@@ -1,468 +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 'package:analyzer/dart/analysis/features.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/error/listener.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/source/line_info.dart';
-import 'package:analyzer/src/dart/scanner/reader.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
-import 'package:analyzer/src/generated/parser.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:meta/meta.dart';
-
-/**
- * [SdkPatcher] applies patches to SDK [CompilationUnit].
- */
-class SdkPatcher {
- bool _allowNewPublicNames;
- String _baseDesc;
- String _patchDesc;
- CompilationUnit _patchUnit;
-
- /**
- * Patch the given [unit] of a SDK [source] with the patches defined in
- * [allPatchPaths]. Throw [ArgumentError] if a patch
- * file cannot be read, or the contents violates rules for patch files.
- */
- void patch(
- ResourceProvider resourceProvider,
- Map<String, List<String>> allPatchPaths,
- AnalysisErrorListener errorListener,
- Source source,
- CompilationUnit unit) {
- // Process URI.
- String libraryUriStr;
- bool isLibraryDefiningUnit;
- {
- Uri uri = source.uri;
- if (uri.scheme != 'dart') {
- throw ArgumentError(
- 'The URI of the unit to patch must have the "dart" scheme: $uri');
- }
- List<String> uriSegments = uri.pathSegments;
- String libraryName = uriSegments.first;
- libraryUriStr = 'dart:$libraryName';
- isLibraryDefiningUnit = uriSegments.length == 1;
- _allowNewPublicNames = libraryName == '_internal';
- }
- // Prepare the patch files to apply.
- List<String> patchPaths = allPatchPaths[libraryUriStr] ?? const <String>[];
-
- for (String path in patchPaths) {
- File patchFile = resourceProvider.getFile(path);
- if (!patchFile.exists) {
- throw ArgumentError(
- 'The patch file ${patchFile.path} for $source does not exist.');
- }
- Source patchSource = patchFile.createSource();
- CompilationUnit patchUnit =
- parse(patchSource, errorListener, unit.featureSet);
-
- // Prepare for reporting errors.
- _baseDesc = source.toString();
- _patchDesc = patchFile.path;
- _patchUnit = patchUnit;
-
- if (isLibraryDefiningUnit) {
- _patchDirectives(source, unit, patchSource, patchUnit);
- }
- _patchTopLevelDeclarations(unit, patchUnit, isLibraryDefiningUnit);
- }
- }
-
- void _failExternalKeyword(String name, int offset) {
- throw ArgumentError(
- 'The keyword "external" was expected for "$name" in $_baseDesc @ $offset.');
- }
-
- void _failIfPublicName(AstNode node, String name) {
- if (_allowNewPublicNames) {
- return;
- }
- if (!Identifier.isPrivateName(name)) {
- _failInPatch('contains a public declaration "$name"', node.offset);
- }
- }
-
- void _failInPatch(String message, int offset) {
- String loc = _getLocationDesc3(_patchUnit, offset);
- throw ArgumentError(
- 'The patch file $_patchDesc for $_baseDesc $message at $loc.');
- }
-
- String _getLocationDesc3(CompilationUnit unit, int offset) {
- CharacterLocation location = unit.lineInfo.getLocation(offset);
- return 'the line ${location.lineNumber}';
- }
-
- void _matchParameterLists(FormalParameterList baseParameters,
- FormalParameterList patchParameters, String Function() context) {
- if (baseParameters == null && patchParameters == null) return;
- if (baseParameters == null || patchParameters == null) {
- throw ArgumentError("${context()}, parameter lists don't match");
- }
- if (baseParameters.parameters.length != patchParameters.parameters.length) {
- throw ArgumentError(
- '${context()}, parameter lists have different lengths');
- }
- for (var i = 0; i < baseParameters.parameters.length; i++) {
- _matchParameters(baseParameters.parameters[i],
- patchParameters.parameters[i], () => '${context()}, parameter $i');
- }
- }
-
- void _matchParameters(FormalParameter baseParameter,
- FormalParameter patchParameter, String Function() whichParameter) {
- if (baseParameter.identifier.name != patchParameter.identifier.name) {
- throw ArgumentError('${whichParameter()} has different name');
- }
- NormalFormalParameter baseParameterWithoutDefault =
- _withoutDefault(baseParameter);
- NormalFormalParameter patchParameterWithoutDefault =
- _withoutDefault(patchParameter);
- if (baseParameterWithoutDefault is SimpleFormalParameter &&
- patchParameterWithoutDefault is SimpleFormalParameter) {
- _matchTypes(baseParameterWithoutDefault.type,
- patchParameterWithoutDefault.type, () => '${whichParameter()} type');
- } else if (baseParameterWithoutDefault is FunctionTypedFormalParameter &&
- patchParameterWithoutDefault is FunctionTypedFormalParameter) {
- _matchTypes(
- baseParameterWithoutDefault.returnType,
- patchParameterWithoutDefault.returnType,
- () => '${whichParameter()} return type');
- _matchParameterLists(
- baseParameterWithoutDefault.parameters,
- patchParameterWithoutDefault.parameters,
- () => '${whichParameter()} parameters');
- } else if (baseParameterWithoutDefault is FieldFormalParameter &&
- patchParameter is FieldFormalParameter) {
- throw ArgumentError(
- '${whichParameter()} cannot be patched (field formal parameters are not supported)');
- } else {
- throw ArgumentError(
- '${whichParameter()} mismatch (different parameter kinds)');
- }
- }
-
- void _matchTypes(
- TypeName baseType, TypeName patchType, String Function() whichType) {
- error() => ArgumentError("${whichType()} doesn't match");
- if (baseType == null && patchType == null) return;
- if (baseType == null || patchType == null) throw error();
- // Match up the types token by token; this is more restrictive than strictly
- // necessary, but it's easy and sufficient for patching purposes.
- Token baseToken = baseType.beginToken;
- Token patchToken = patchType.beginToken;
- while (true) {
- if (baseToken.lexeme != patchToken.lexeme) throw error();
- if (identical(baseToken, baseType.endToken) &&
- identical(patchToken, patchType.endToken)) {
- break;
- }
- if (identical(baseToken, baseType.endToken) ||
- identical(patchToken, patchType.endToken)) {
- throw error();
- }
- baseToken = baseToken.next;
- patchToken = patchToken.next;
- }
- }
-
- void _patchClassMembers(
- ClassDeclaration baseClass, ClassDeclaration patchClass) {
- String className = baseClass.name.name;
- List<ClassMember> membersToAppend = [];
- for (ClassMember patchMember in patchClass.members) {
- if (patchMember is FieldDeclaration) {
- if (_hasPatchAnnotation(patchMember.metadata)) {
- _failInPatch('attempts to patch a field', patchMember.offset);
- }
- List<VariableDeclaration> fields = patchMember.fields.variables;
- if (fields.length != 1) {
- _failInPatch('contains a field declaration with more than one field',
- patchMember.offset);
- }
- String name = fields[0].name.name;
- if (!_allowNewPublicNames &&
- !Identifier.isPrivateName(className) &&
- !Identifier.isPrivateName(name)) {
- _failInPatch('contains a public field', patchMember.offset);
- }
- membersToAppend.add(patchMember);
- } else if (patchMember is MethodDeclaration) {
- String name = patchMember.name.name;
- if (_hasPatchAnnotation(patchMember.metadata)) {
- for (ClassMember baseMember in baseClass.members) {
- if (baseMember is MethodDeclaration &&
- baseMember.name.name == name) {
- // Remove the "external" keyword.
- Token externalKeyword = baseMember.externalKeyword;
- if (externalKeyword != null) {
- baseMember.externalKeyword = null;
- _removeToken(externalKeyword);
- } else {
- _failExternalKeyword(name, baseMember.offset);
- }
- _matchParameterLists(
- baseMember.parameters,
- patchMember.parameters,
- () => 'While patching $className.$name');
- _matchTypes(baseMember.returnType, patchMember.returnType,
- () => 'While patching $className.$name, return type');
- // Replace the body.
- FunctionBody oldBody = baseMember.body;
- FunctionBody newBody = patchMember.body;
- _replaceNodeTokens(oldBody, newBody);
- baseMember.body = newBody;
- }
- }
- } else {
- _failIfPublicName(patchMember, name);
- membersToAppend.add(patchMember);
- }
- } else if (patchMember is ConstructorDeclaration) {
- String name = patchMember.name?.name;
- if (_hasPatchAnnotation(patchMember.metadata)) {
- for (ClassMember baseMember in baseClass.members) {
- if (baseMember is ConstructorDeclaration &&
- baseMember.name?.name == name) {
- // Remove the "external" keyword.
- Token externalKeyword = baseMember.externalKeyword;
- if (externalKeyword != null) {
- baseMember.externalKeyword = null;
- _removeToken(externalKeyword);
- } else {
- _failExternalKeyword(name, baseMember.offset);
- }
- // Factory vs. generative.
- if (baseMember.factoryKeyword == null &&
- patchMember.factoryKeyword != null) {
- _failInPatch(
- 'attempts to replace generative constructor with a factory one',
- patchMember.offset);
- } else if (baseMember.factoryKeyword != null &&
- patchMember.factoryKeyword == null) {
- _failInPatch(
- 'attempts to replace factory constructor with a generative one',
- patchMember.offset);
- }
- // The base constructor should not have initializers.
- if (baseMember.initializers.isNotEmpty) {
- throw ArgumentError(
- 'Cannot patch external constructors with initializers '
- 'in $_baseDesc.');
- }
- _matchParameterLists(
- baseMember.parameters, patchMember.parameters, () {
- String nameSuffix = name == null ? '' : '.$name';
- return 'While patching $className$nameSuffix';
- });
- // Prepare nodes.
- FunctionBody baseBody = baseMember.body;
- FunctionBody patchBody = patchMember.body;
- NodeList<ConstructorInitializer> baseInitializers =
- baseMember.initializers;
- NodeList<ConstructorInitializer> patchInitializers =
- patchMember.initializers;
- // Replace initializers and link tokens.
- if (patchInitializers.isNotEmpty) {
- baseMember.parameters.endToken
- .setNext(patchInitializers.beginToken.previous);
- baseInitializers.addAll(patchInitializers);
- patchBody.endToken.setNext(baseBody.endToken.next);
- } else {
- _replaceNodeTokens(baseBody, patchBody);
- }
- // Replace the body.
- baseMember.body = patchBody;
- }
- }
- } else {
- if (name == null) {
- if (!_allowNewPublicNames && !Identifier.isPrivateName(className)) {
- _failInPatch(
- 'contains an unnamed public constructor', patchMember.offset);
- }
- } else {
- _failIfPublicName(patchMember, name);
- }
- membersToAppend.add(patchMember);
- }
- } else {
- String className = patchClass.name.name;
- _failInPatch('contains an unsupported class member in $className',
- patchMember.offset);
- }
- }
- // Append new class members.
- _appendToNodeList(
- baseClass.members, membersToAppend, baseClass.leftBracket);
- }
-
- void _patchDirectives(Source baseSource, CompilationUnit baseUnit,
- Source patchSource, CompilationUnit patchUnit) {
- for (Directive patchDirective in patchUnit.directives) {
- if (patchDirective is ImportDirective) {
- baseUnit.directives.add(patchDirective);
- } else {
- _failInPatch('contains an unsupported "$patchDirective" directive',
- patchDirective.offset);
- }
- }
- }
-
- void _patchTopLevelDeclarations(CompilationUnit baseUnit,
- CompilationUnit patchUnit, bool appendNewTopLevelDeclarations) {
- List<CompilationUnitMember> declarationsToAppend = [];
- for (CompilationUnitMember patchDeclaration in patchUnit.declarations) {
- if (patchDeclaration is FunctionDeclaration) {
- String name = patchDeclaration.name.name;
- if (_hasPatchAnnotation(patchDeclaration.metadata)) {
- for (CompilationUnitMember baseDeclaration in baseUnit.declarations) {
- if (patchDeclaration is FunctionDeclaration &&
- baseDeclaration is FunctionDeclaration &&
- baseDeclaration.name.name == name) {
- // Remove the "external" keyword.
- Token externalKeyword = baseDeclaration.externalKeyword;
- if (externalKeyword != null) {
- baseDeclaration.externalKeyword = null;
- _removeToken(externalKeyword);
- } else {
- _failExternalKeyword(name, baseDeclaration.offset);
- }
- _matchParameterLists(
- baseDeclaration.functionExpression.parameters,
- patchDeclaration.functionExpression.parameters,
- () => 'While patching $name');
- _matchTypes(
- baseDeclaration.returnType,
- patchDeclaration.returnType,
- () => 'While patching $name, return type');
- // Replace the body.
- FunctionExpression oldExpr = baseDeclaration.functionExpression;
- FunctionBody newBody = patchDeclaration.functionExpression.body;
- _replaceNodeTokens(oldExpr.body, newBody);
- oldExpr.body = newBody;
- }
- }
- } else if (appendNewTopLevelDeclarations) {
- _failIfPublicName(patchDeclaration, name);
- declarationsToAppend.add(patchDeclaration);
- }
- } else if (patchDeclaration is FunctionTypeAlias) {
- if (patchDeclaration.metadata.isNotEmpty) {
- _failInPatch('contains a function type alias with an annotation',
- patchDeclaration.offset);
- }
- _failIfPublicName(patchDeclaration, patchDeclaration.name.name);
- declarationsToAppend.add(patchDeclaration);
- } else if (patchDeclaration is ClassDeclaration) {
- if (_hasPatchAnnotation(patchDeclaration.metadata)) {
- String name = patchDeclaration.name.name;
- for (CompilationUnitMember baseDeclaration in baseUnit.declarations) {
- if (baseDeclaration is ClassDeclaration &&
- baseDeclaration.name.name == name) {
- _patchClassMembers(baseDeclaration, patchDeclaration);
- }
- }
- } else {
- _failIfPublicName(patchDeclaration, patchDeclaration.name.name);
- declarationsToAppend.add(patchDeclaration);
- }
- } else if (patchDeclaration is TopLevelVariableDeclaration &&
- !_hasPatchAnnotation(patchDeclaration.metadata)) {
- for (VariableDeclaration variable
- in patchDeclaration.variables.variables) {
- _failIfPublicName(patchDeclaration, variable.name.name);
- }
- declarationsToAppend.add(patchDeclaration);
- } else {
- _failInPatch('contains an unsupported top-level declaration',
- patchDeclaration.offset);
- }
- }
- // Append new top-level declarations.
- if (appendNewTopLevelDeclarations) {
- _appendToNodeList(baseUnit.declarations, declarationsToAppend,
- baseUnit.endToken.previous);
- }
- }
-
- NormalFormalParameter _withoutDefault(FormalParameter parameter) {
- if (parameter is NormalFormalParameter) {
- return parameter;
- } else if (parameter is DefaultFormalParameter) {
- return parameter.parameter;
- } else {
- // Should not happen.
- assert(false);
- return null;
- }
- }
-
- /**
- * Parse the given [source] into AST.
- */
- @visibleForTesting
- static CompilationUnit parse(Source source,
- AnalysisErrorListener errorListener, FeatureSet featureSet) {
- String code = source.contents.data;
-
- CharSequenceReader reader = CharSequenceReader(code);
- Scanner scanner = Scanner(source, reader, errorListener)
- ..configureFeatures(featureSet);
- Token token = scanner.tokenize();
- LineInfo lineInfo = LineInfo(scanner.lineStarts);
-
- Parser parser = Parser(source, errorListener, featureSet: featureSet);
- CompilationUnit unit = parser.parseCompilationUnit(token);
- unit.lineInfo = lineInfo;
- return unit;
- }
-
- /**
- * Append [newNodes] to the given [nodes] and attach new tokens to the end
- * token of the last [nodes] items, or, if it is empty, to [defaultPrevToken].
- */
- static void _appendToNodeList(
- NodeList<AstNode> nodes, List<AstNode> newNodes, Token defaultPrevToken) {
- Token prevToken = nodes.endToken ?? defaultPrevToken;
- for (AstNode newNode in newNodes) {
- newNode.endToken.setNext(prevToken.next);
- prevToken.setNext(newNode.beginToken);
- nodes.add(newNode);
- prevToken = newNode.endToken;
- }
- }
-
- /**
- * Return `true` if [metadata] has the `@patch` annotation.
- */
- static bool _hasPatchAnnotation(List<Annotation> metadata) {
- return metadata.any((annotation) {
- Identifier name = annotation.name;
- return annotation.constructorName == null &&
- name is SimpleIdentifier &&
- name.name == 'patch';
- });
- }
-
- /**
- * Remove the [token] from the stream.
- */
- static void _removeToken(Token token) {
- token.previous.setNext(token.next);
- }
-
- /**
- * Replace tokens of the [oldNode] with tokens of the [newNode].
- */
- static void _replaceNodeTokens(AstNode oldNode, AstNode newNode) {
- oldNode.beginToken.previous.setNext(newNode.beginToken);
- newNode.endToken.setNext(oldNode.endToken.next);
- }
-}
diff --git a/pkg/analyzer/lib/src/dart/sdk/sdk.dart b/pkg/analyzer/lib/src/dart/sdk/sdk.dart
index c3486ea..a6938c2 100644
--- a/pkg/analyzer/lib/src/dart/sdk/sdk.dart
+++ b/pkg/analyzer/lib/src/dart/sdk/sdk.dart
@@ -6,17 +6,13 @@
import 'dart:io' as io;
import 'package:analyzer/dart/analysis/features.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/src/context/context.dart';
-import 'package:analyzer/src/dart/scanner/reader.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/java_engine_io.dart';
-import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
@@ -740,20 +736,19 @@
* of the file is already known to be [libraryFileContents].
*/
LibraryMap readFromSource(Source source, String libraryFileContents) {
- BooleanErrorListener errorListener = BooleanErrorListener();
// TODO(paulberry): initialize the feature set appropriately based on the
// version of the SDK we are reading, and enable flags.
var featureSet = FeatureSet.fromEnableFlags([]);
- Scanner scanner =
- Scanner(source, CharSequenceReader(libraryFileContents), errorListener)
- ..configureFeatures(featureSet);
- Parser parser = Parser(source, errorListener, featureSet: featureSet);
- CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize());
- SdkLibrariesReader_LibraryBuilder libraryBuilder =
- SdkLibrariesReader_LibraryBuilder();
- // If any syntactic errors were found then don't try to visit the AST
- // structure.
- if (!errorListener.errorReported) {
+
+ var parseResult = parseString(
+ content: libraryFileContents,
+ featureSet: featureSet,
+ throwIfDiagnostics: false,
+ );
+ var unit = parseResult.unit;
+
+ var libraryBuilder = SdkLibrariesReader_LibraryBuilder();
+ if (parseResult.errors.isEmpty) {
unit.accept(libraryBuilder);
}
return libraryBuilder.librariesMap;
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index fcc266f..31d7255 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -6,6 +6,7 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/syntactic_entity.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -236,6 +237,7 @@
void visitBinaryExpression(BinaryExpression node) {
_checkForDivisionOptimizationHint(node);
_checkForDeprecatedMemberUse(node.staticElement, node);
+ _checkForInvariantNullComparison(node);
super.visitBinaryExpression(node);
}
@@ -973,6 +975,45 @@
}
}
+ void _checkForInvariantNullComparison(BinaryExpression node) {
+ if (!_isNonNullableByDefault) return;
+
+ void reportStartEnd(
+ HintCode errorCode,
+ SyntacticEntity startEntity,
+ SyntacticEntity endEntity,
+ ) {
+ var offset = startEntity.offset;
+ _errorReporter.reportErrorForOffset(
+ errorCode,
+ offset,
+ endEntity.end - offset,
+ );
+ }
+
+ void checkLeftRight(HintCode errorCode) {
+ if (node.leftOperand is NullLiteral) {
+ var rightType = node.rightOperand.staticType;
+ if (_typeSystem.isStrictlyNonNullable(rightType)) {
+ reportStartEnd(errorCode, node.leftOperand, node.operator);
+ }
+ }
+
+ if (node.rightOperand is NullLiteral) {
+ var leftType = node.leftOperand.staticType;
+ if (_typeSystem.isStrictlyNonNullable(leftType)) {
+ reportStartEnd(errorCode, node.operator, node.rightOperand);
+ }
+ }
+ }
+
+ if (node.operator.type == TokenType.BANG_EQ) {
+ checkLeftRight(HintCode.UNNECESSARY_NULL_COMPARISON_TRUE);
+ } else if (node.operator.type == TokenType.EQ_EQ) {
+ checkLeftRight(HintCode.UNNECESSARY_NULL_COMPARISON_FALSE);
+ }
+ }
+
/// Check that the instance creation node is const if the constructor is
/// marked with [literal].
void _checkForLiteralConstructorUse(InstanceCreationExpression node) {
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 9b4993e..ddaf44d 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -487,9 +487,9 @@
* expression with a potentially non-nullable return type may completely
* normally.
*/
- static const CompileTimeErrorCode BODY_MAY_COMPLETE_NORMALLY =
+ static const CompileTimeErrorCode BODY_MIGHT_COMPLETE_NORMALLY =
CompileTimeErrorCode(
- 'BODY_MAY_COMPLETE_NORMALLY',
+ 'BODY_MIGHT_COMPLETE_NORMALLY',
"The body might complete normally, which would cause 'null' to be "
"returned, but the return type is a potentially "
"non-nullable type.",
@@ -1747,7 +1747,7 @@
//
// #### Examples
//
- // The following code generates this diagnostic:
+ // The following code produces this diagnostic:
//
// ```dart
// var map = <String, int>{'a': 0, 'b': 1, [!'c'!]};
@@ -3083,7 +3083,7 @@
// class A {}
//
// class C {
- // factory [!A!]() => null;
+ // factory [!A!]() => throw 0;
// }
// ```
//
@@ -3096,7 +3096,7 @@
// class A {}
//
// class C {
- // factory C() => null;
+ // factory C() => throw 0;
// }
// ```
//
@@ -3105,7 +3105,7 @@
//
// ```dart
// class A {
- // factory A() => null;
+ // factory A() => throw 0;
// }
//
// class C {}
@@ -3119,7 +3119,7 @@
// class A {}
//
// class C {
- // static A a() => null;
+ // static A a() => throw 0;
// }
// ```
static const CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS =
@@ -4443,13 +4443,12 @@
* marked with the `late` modifier.
*
* Parameters:
- *
- * Parameters:
* 0: the name of the field that is not initialized
*/
static const CompileTimeErrorCode
NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD_CONSTRUCTOR =
- CompileTimeErrorCode(
+ CompileTimeErrorCodeWithUniqueName(
+ 'NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD',
'NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD_CONSTRUCTOR',
"Non-nullable instance field '{0}' must be initialized.",
correction: "Try adding an initializer expression, "
@@ -4479,7 +4478,7 @@
//
// #### Examples
//
- // The following code generates this diagnostic:
+ // The following code produces this diagnostic:
//
// ```dart
// var m = <String, int>{'a': 0, 'b': 1};
@@ -4904,7 +4903,7 @@
// The following code produces this diagnostic because `f` is a function:
//
// ```dart
- // C f() => null;
+ // C f() => throw 0;
//
// class C {
// factory C() = [!f!];
@@ -4923,7 +4922,7 @@
// the constructor to return the value from the constructor's body:
//
// ```dart
- // C f() => null;
+ // C f() => throw 0;
//
// class C {
// factory C() => f();
@@ -7745,9 +7744,11 @@
/**
* It is a warning to use null aware operators '??' or '??=' on an
* expression of type `T` if `T` is strictly non-nullable.
+ *
+ * No parameters.
*/
- static const StaticWarningCode DEAD_NULL_COALESCE = StaticWarningCode(
- 'DEAD_NULL_COALESCE',
+ static const StaticWarningCode DEAD_NULL_AWARE_EXPRESSION = StaticWarningCode(
+ 'DEAD_NULL_AWARE_EXPRESSION',
"The left operand can't be null, so the right operand is never executed.",
correction: "Try removing the right operand.",
errorSeverity: ErrorSeverity.WARNING);
diff --git a/pkg/analyzer/lib/src/error/invalid_language_version_override_finder.dart b/pkg/analyzer/lib/src/error/invalid_language_version_override_finder.dart
index 2c18728..23d397f 100644
--- a/pkg/analyzer/lib/src/error/invalid_language_version_override_finder.dart
+++ b/pkg/analyzer/lib/src/error/invalid_language_version_override_finder.dart
@@ -94,14 +94,19 @@
(character >= 0x41 && character <= 0x5A) ||
(character >= 0x61 && character <= 0x7A);
+ void skipWhitespaces() {
+ while (index < length && isWhitespace(comment.codeUnitAt(index))) {
+ index++;
+ }
+ }
+
// Count the number of `/` characters at the beginning.
while (index < length && comment.codeUnitAt(index) == 0x2F) {
index++;
}
int slashCount = index;
- while (index < length && isWhitespace(comment.codeUnitAt(index))) {
- index++;
- }
+
+ skipWhitespaces();
if (index == length) {
// This is not an attempted language version override comment.
return false;
@@ -123,9 +128,7 @@
}
index += 4;
- while (index < length && isWhitespace(comment.codeUnitAt(index))) {
- index++;
- }
+ skipWhitespaces();
if (index == length) {
// This is not an attempted language version override comment.
return false;
@@ -149,9 +152,7 @@
}
int dartVersionSeparatorLength = index - dartVersionSeparatorStartIndex;
- while (index < length && isWhitespace(comment.codeUnitAt(index))) {
- index++;
- }
+ skipWhitespaces();
if (index == length) {
// This is not an attempted language version override comment.
return false;
@@ -233,24 +234,30 @@
// Nothing preceding the version number makes this comment invalid. Check
// the format of the version number, and trailing characters.
- index++;
+ // Skip major version.
+ while (index < length && isNumeric(comment.codeUnitAt(index))) {
+ index++;
+ }
+
+ // Skip '.' separator.
if (index == length || comment.codeUnitAt(index) != 0x2E) {
reportInvalidNumber();
return false;
}
index++;
- if (index == length || !isNumeric(comment.codeUnitAt(index))) {
- reportInvalidNumber();
- return false;
- }
- index++;
- while (index < length && isWhitespace(comment.codeUnitAt(index))) {
+
+ // Skip minor version.
+ while (index < length && isNumeric(comment.codeUnitAt(index))) {
index++;
}
+
+ skipWhitespaces();
+
+ // OK, no trailing characters.
if (index == length) {
- // This is a valid language version override comment.
return true;
}
+
// This comment is a valid language version override, except for trailing
// characters.
_errorReporter.reportErrorForOffset(
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index c612c30..ad982f9 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -44,12 +44,13 @@
import 'package:_fe_analyzer_shared/src/scanner/errors.dart'
show translateErrorToken;
import 'package:_fe_analyzer_shared/src/scanner/scanner.dart' hide StringToken;
-import 'package:_fe_analyzer_shared/src/scanner/token_constants.dart';
import 'package:_fe_analyzer_shared/src/scanner/token.dart'
show SyntheticStringToken, SyntheticToken;
+import 'package:_fe_analyzer_shared/src/scanner/token_constants.dart';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory;
+import 'package:analyzer/dart/ast/language_version.dart';
import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard;
import 'package:analyzer/dart/ast/token.dart' show Token, TokenType;
import 'package:analyzer/error/listener.dart';
@@ -79,11 +80,6 @@
@override
final Uri uri;
- @override
- dynamic internalProblem(Message message, int charOffset, Uri uri) {
- throw UnsupportedError(message.message);
- }
-
/// The parser that uses this listener, used to parse optional parts, e.g.
/// `native` support.
Parser parser;
@@ -131,10 +127,13 @@
/// `true` if variance behavior is enabled
final bool enableVariance;
+ /// The language version override, `null` if not such token.
+ LanguageVersion _languageVersion;
+
final FeatureSet _featureSet;
AstBuilder(ErrorReporter errorReporter, this.fileUri, this.isFullAst,
- this._featureSet,
+ this._languageVersion, this._featureSet,
[Uri uri])
: this.errorReporter = FastaErrorReporter(errorReporter),
this.enableNonNullable = _featureSet.isEnabled(Feature.non_nullable),
@@ -960,6 +959,7 @@
directives: directives,
declarations: declarations,
endToken: endToken,
+ languageVersion: _languageVersion,
featureSet: _featureSet) as CompilationUnitImpl;
push(unit);
}
@@ -2713,7 +2713,8 @@
}
@override
- void handleIndexedExpression(Token leftBracket, Token rightBracket) {
+ void handleIndexedExpression(
+ Token question, Token leftBracket, Token rightBracket) {
assert(optional('[', leftBracket) ||
(enableNonNullable && optional('?.[', leftBracket)));
assert(optional(']', rightBracket));
@@ -2725,13 +2726,21 @@
CascadeExpression receiver = pop();
Token token = peek();
push(receiver);
- IndexExpression expression = ast.indexExpressionForCascade(
- token, leftBracket, index, rightBracket);
+ IndexExpression expression = ast.indexExpressionForCascade2(
+ period: token,
+ question: question,
+ leftBracket: leftBracket,
+ index: index,
+ rightBracket: rightBracket);
assert(expression.isCascaded);
push(expression);
} else {
- push(ast.indexExpressionForTarget(
- target, leftBracket, index, rightBracket));
+ push(ast.indexExpressionForTarget2(
+ target: target,
+ question: question,
+ leftBracket: leftBracket,
+ index: index,
+ rightBracket: rightBracket));
}
}
@@ -3427,6 +3436,11 @@
handleType(voidKeyword, null);
}
+ @override
+ dynamic internalProblem(Message message, int charOffset, Uri uri) {
+ throw UnsupportedError(message.message);
+ }
+
/// Return `true` if [token] is either `null` or is the symbol or keyword
/// [value].
bool optionalOrNull(String value, Token token) {
@@ -3534,14 +3548,6 @@
}
}
- void reportErrorIfSuper(Expression expression) {
- if (expression is SuperExpression) {
- // This error is also reported by the body builder.
- handleRecoverableError(messageMissingAssignableSelector,
- expression.beginToken, expression.endToken);
- }
- }
-
void reportErrorIfNullableType(Token questionMark) {
if (questionMark != null) {
assert(optional('?', questionMark));
@@ -3552,6 +3558,14 @@
}
}
+ void reportErrorIfSuper(Expression expression) {
+ if (expression is SuperExpression) {
+ // This error is also reported by the body builder.
+ handleRecoverableError(messageMissingAssignableSelector,
+ expression.beginToken, expression.endToken);
+ }
+ }
+
void reportNonNullableModifierError(Token modifierToken) {
if (modifierToken != null) {
handleRecoverableError(
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index ed86ab6..933ffb5 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -6,6 +6,7 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/syntactic_entity.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -1312,23 +1313,6 @@
super.visitWithClause(node);
}
- @override
- void visitYieldStatement(YieldStatement node) {
- if (_inGenerator) {
- _checkForYieldOfInvalidType(node.expression, node.star != null);
- } else {
- CompileTimeErrorCode errorCode;
- if (node.star != null) {
- errorCode = CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR;
- } else {
- errorCode = CompileTimeErrorCode.YIELD_IN_NON_GENERATOR;
- }
- _errorReporter.reportErrorForNode(errorCode, node);
- }
- _checkForUseOfVoidResult(node.expression);
- super.visitYieldStatement(node);
- }
-
/**
* Checks the class for problems with the superclass, mixins, or implemented
* interfaces.
@@ -2325,7 +2309,7 @@
if (_typeSystem.isStrictlyNonNullable(lhsType)) {
_errorReporter.reportErrorForNode(
- StaticWarningCode.DEAD_NULL_COALESCE,
+ StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION,
rhs,
);
}
@@ -2419,6 +2403,13 @@
return false;
}
+ // TODO(scheglov) use NullableDereferenceVerifier
+ if (_isNonNullableByDefault) {
+ if (_typeSystem.isNullable(iterableType)) {
+ return false;
+ }
+ }
+
// The type of the loop variable.
DartType variableType;
var variableElement = variable.staticElement;
@@ -2444,37 +2435,46 @@
// TODO(rnystrom): Move this into mostSpecificTypeArgument()?
iterableType = iterableType.resolveToBound(_typeProvider.objectType);
- ClassElement sequenceElement = awaitKeyword != null
- ? _typeProvider.streamElement
- : _typeProvider.iterableElement;
+ var requiredSequenceType = awaitKeyword != null
+ ? _typeProvider.streamDynamicType
+ : _typeProvider.iterableDynamicType;
- DartType bestIterableType;
+ if (_typeSystem.isTop(iterableType)) {
+ iterableType = requiredSequenceType;
+ }
+
+ if (!_typeSystem.isAssignableTo2(iterableType, requiredSequenceType)) {
+ _errorReporter.reportErrorForNode(
+ StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE,
+ node.iterable,
+ [iterableType, loopTypeName],
+ );
+ return false;
+ }
+
+ DartType sequenceElementType;
if (iterableType is InterfaceTypeImpl) {
+ var sequenceElement = awaitKeyword != null
+ ? _typeProvider.streamElement
+ : _typeProvider.iterableElement;
var sequenceType = iterableType.asInstanceOf(sequenceElement);
if (sequenceType != null) {
- bestIterableType = sequenceType.typeArguments[0];
+ sequenceElementType = sequenceType.typeArguments[0];
}
}
- // Allow it to be a supertype of Iterable<T> (basically just Object) and do
- // an implicit downcast to Iterable<dynamic>.
- if (bestIterableType == null) {
- if (iterableType == _typeProvider.objectType) {
- bestIterableType = DynamicTypeImpl.instance;
- }
+ if (sequenceElementType == null) {
+ return true;
}
- if (bestIterableType == null) {
+ if (!_typeSystem.isAssignableTo2(sequenceElementType, variableType)) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE,
- node.iterable,
- [iterableType, loopTypeName]);
- } else if (!_typeSystem.isAssignableTo2(bestIterableType, variableType)) {
- _errorReporter.reportErrorForNode(
- StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE,
- node.iterable,
- [iterableType, loopTypeName, variableType]);
+ StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE,
+ node.iterable,
+ [iterableType, loopTypeName, variableType],
+ );
}
+
return true;
}
@@ -2811,7 +2811,13 @@
void _checkForFinalNotInitializedInClass(List<ClassMember> members) {
for (ClassMember classMember in members) {
if (classMember is ConstructorDeclaration) {
- return;
+ if (_isNonNullableByDefault) {
+ if (classMember.factoryKeyword == null) {
+ return;
+ }
+ } else {
+ return;
+ }
}
}
for (ClassMember classMember in members) {
@@ -4181,8 +4187,11 @@
parameter.identifier);
}
}
- _checkForRedirectToNonConstConstructor(declaration.declaredElement,
- redirectedConstructor.staticElement, redirectedConstructor);
+ _checkForRedirectToNonConstConstructor(
+ declaration.declaredElement,
+ redirectedConstructor.staticElement,
+ redirectedConstructor,
+ );
}
// check if there are redirected invocations
int numRedirections = 0;
@@ -4217,8 +4226,11 @@
}
// [declaration] is a redirecting constructor via a redirecting
// initializer.
- _checkForRedirectToNonConstConstructor(declaration.declaredElement,
- initializer.staticElement, initializer.constructorName);
+ _checkForRedirectToNonConstConstructor(
+ declaration.declaredElement,
+ initializer.staticElement,
+ initializer.constructorName ?? initializer.thisKeyword,
+ );
numRedirections++;
}
}
@@ -4250,15 +4262,20 @@
*
* See [CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR].
*/
- void _checkForRedirectToNonConstConstructor(ConstructorElement element,
- ConstructorElement redirectedElement, AstNode reportingNode) {
+ void _checkForRedirectToNonConstConstructor(
+ ConstructorElement element,
+ ConstructorElement redirectedElement,
+ SyntacticEntity errorEntity,
+ ) {
// This constructor is const, but it redirects to a non-const constructor.
if (redirectedElement != null &&
element.isConst &&
!redirectedElement.isConst) {
- _errorReporter.reportErrorForNode(
- CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR,
- reportingNode);
+ _errorReporter.reportErrorForOffset(
+ CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR,
+ errorEntity.offset,
+ errorEntity.end - errorEntity.offset,
+ );
}
}
@@ -5075,52 +5092,6 @@
}
/**
- * Check for a type mis-match between the yielded type and the declared
- * return type of a generator function.
- *
- * This method should only be called in generator functions.
- */
- void _checkForYieldOfInvalidType(
- Expression yieldExpression, bool isYieldEach) {
- assert(_inGenerator);
- if (_enclosingFunction == null) {
- return;
- }
- DartType declaredReturnType = _enclosingFunction.returnType;
- DartType staticYieldedType = getStaticType(yieldExpression);
- DartType impliedReturnType;
- if (isYieldEach) {
- impliedReturnType = staticYieldedType;
- } else if (_enclosingFunction.isAsynchronous) {
- impliedReturnType = _typeProvider.streamType2(staticYieldedType);
- } else {
- impliedReturnType = _typeProvider.iterableType2(staticYieldedType);
- }
- if (!_checkForAssignableExpressionAtType(yieldExpression, impliedReturnType,
- declaredReturnType, StaticTypeWarningCode.YIELD_OF_INVALID_TYPE)) {
- return;
- }
- if (isYieldEach) {
- // Since the declared return type might have been "dynamic", we need to
- // also check that the implied return type is assignable to generic
- // Stream/Iterable.
- DartType requiredReturnType;
- if (_enclosingFunction.isAsynchronous) {
- requiredReturnType = _typeProvider.streamDynamicType;
- } else {
- requiredReturnType = _typeProvider.iterableDynamicType;
- }
- if (!_typeSystem.isAssignableTo2(impliedReturnType, requiredReturnType)) {
- _errorReporter.reportErrorForNode(
- StaticTypeWarningCode.YIELD_OF_INVALID_TYPE,
- yieldExpression,
- [impliedReturnType, requiredReturnType]);
- return;
- }
- }
- }
-
- /**
* Verify that the given class [declaration] does not have the same class in
* the 'extends' and 'implements' clauses.
*
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index 8014a1f..dd79471 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -15,6 +15,7 @@
import 'package:_fe_analyzer_shared/src/scanner/scanner.dart' as fasta;
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/language_version.dart';
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/error/error.dart';
@@ -201,10 +202,12 @@
/// Initialize a newly created parser to parse tokens in the given [_source]
/// and to report any errors that are found to the given [_errorListener].
factory Parser(Source source, AnalysisErrorListener errorListener,
- {bool useFasta, @required FeatureSet featureSet}) {
+ {bool useFasta,
+ LanguageVersion languageVersion,
+ @required FeatureSet featureSet}) {
featureSet ??= FeatureSet.fromEnableFlags([]);
if (useFasta ?? Parser.useFasta) {
- return _Parser2(source, errorListener, featureSet,
+ return _Parser2(source, errorListener, languageVersion, featureSet,
allowNativeClause: true);
} else {
return Parser.withoutFasta(source, errorListener, featureSet: featureSet);
@@ -786,8 +789,11 @@
try {
Expression index = parseExpression2();
Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET);
- return astFactory.indexExpressionForTarget(
- prefix, leftBracket, index, rightBracket);
+ return astFactory.indexExpressionForTarget2(
+ target: prefix,
+ leftBracket: leftBracket,
+ index: index,
+ rightBracket: rightBracket);
} finally {
_inInitializer = wasInInitializer;
}
@@ -807,8 +813,11 @@
Token leftBracket = getAndAdvance();
Expression index = parseSimpleIdentifier();
Token rightBracket = getAndAdvance();
- return astFactory.indexExpressionForTarget(
- prefix, leftBracket, index, rightBracket);
+ return astFactory.indexExpressionForTarget2(
+ target: prefix,
+ leftBracket: leftBracket,
+ index: index,
+ rightBracket: rightBracket);
} else {
if (!optional) {
// Report the missing selector.
@@ -979,8 +988,11 @@
try {
Expression index = parseExpression2();
Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET);
- expression = astFactory.indexExpressionForCascade(
- period, leftBracket, index, rightBracket);
+ expression = astFactory.indexExpressionForCascade2(
+ period: period,
+ leftBracket: leftBracket,
+ index: index,
+ rightBracket: rightBracket);
period;
} finally {
_inInitializer = wasInInitializer;
@@ -1890,7 +1902,11 @@
_reportErrorForToken(ParserErrorCode.STACK_OVERFLOW, _currentToken);
Token eof = Token.eof(0);
return astFactory.compilationUnit(
- beginToken: eof, endToken: eof, featureSet: _featureSet);
+ beginToken: eof,
+ endToken: eof,
+ languageVersion: null,
+ featureSet: _featureSet,
+ );
}
if (member != null) {
declarations.add(member);
@@ -1940,12 +1956,14 @@
}
}
return astFactory.compilationUnit(
- beginToken: firstToken,
- scriptTag: scriptTag,
- directives: directives,
- declarations: declarations,
- endToken: _currentToken,
- featureSet: _featureSet);
+ beginToken: firstToken,
+ scriptTag: scriptTag,
+ directives: directives,
+ declarations: declarations,
+ endToken: _currentToken,
+ languageVersion: null,
+ featureSet: _featureSet,
+ );
}
/// Parse a compilation unit member. The [commentAndMetadata] is the metadata
@@ -2396,19 +2414,23 @@
_advance();
}
return astFactory.compilationUnit(
- beginToken: firstToken,
- scriptTag: scriptTag,
- directives: directives,
- endToken: _currentToken,
- featureSet: _featureSet);
+ beginToken: firstToken,
+ scriptTag: scriptTag,
+ directives: directives,
+ endToken: _currentToken,
+ languageVersion: null,
+ featureSet: _featureSet,
+ );
}
}
return astFactory.compilationUnit(
- beginToken: firstToken,
- scriptTag: scriptTag,
- directives: directives,
- endToken: _currentToken,
- featureSet: _featureSet);
+ beginToken: firstToken,
+ scriptTag: scriptTag,
+ directives: directives,
+ endToken: _currentToken,
+ languageVersion: null,
+ featureSet: _featureSet,
+ );
}
/// Parse a documentation comment based on the given list of documentation
diff --git a/pkg/analyzer/lib/src/generated/parser_fasta.dart b/pkg/analyzer/lib/src/generated/parser_fasta.dart
index 8f9706b..3287a18 100644
--- a/pkg/analyzer/lib/src/generated/parser_fasta.dart
+++ b/pkg/analyzer/lib/src/generated/parser_fasta.dart
@@ -24,10 +24,11 @@
final AstBuilder astBuilder;
ParserAdapter(this.currentToken, ErrorReporter errorReporter, Uri fileUri,
- FeatureSet featureSet,
+ LanguageVersion languageVersion, FeatureSet featureSet,
{bool allowNativeClause = false})
: fastaParser = fasta.Parser(null),
- astBuilder = AstBuilder(errorReporter, fileUri, true, featureSet) {
+ astBuilder = AstBuilder(
+ errorReporter, fileUri, true, languageVersion, featureSet) {
fastaParser.listener = astBuilder;
astBuilder.parser = fastaParser;
astBuilder.allowNativeClause = allowNativeClause;
@@ -378,21 +379,23 @@
@override
bool enableUriInPartOf = true;
- factory _Parser2(
- Source source, AnalysisErrorListener errorListener, FeatureSet featureSet,
+ factory _Parser2(Source source, AnalysisErrorListener errorListener,
+ LanguageVersion languageVersion, FeatureSet featureSet,
{bool allowNativeClause = false}) {
var errorReporter = ErrorReporter(
errorListener,
source,
isNonNullableByDefault: featureSet.isEnabled(Feature.non_nullable),
);
- return _Parser2._(source, errorReporter, source.uri, featureSet,
+ return _Parser2._(
+ source, errorReporter, source.uri, languageVersion, featureSet,
allowNativeClause: allowNativeClause);
}
_Parser2._(this._source, ErrorReporter errorReporter, Uri fileUri,
- FeatureSet featureSet, {bool allowNativeClause = false})
- : super(null, errorReporter, fileUri, featureSet,
+ LanguageVersion languageVersion, FeatureSet featureSet,
+ {bool allowNativeClause = false})
+ : super(null, errorReporter, fileUri, languageVersion, featureSet,
allowNativeClause: allowNativeClause);
@override
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 6b85e8a..ab1a3b7 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -26,6 +26,7 @@
import 'package:analyzer/src/dart/resolver/binary_expression_resolver.dart';
import 'package:analyzer/src/dart/resolver/extension_member_resolver.dart';
import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
+import 'package:analyzer/src/dart/resolver/for_resolver.dart';
import 'package:analyzer/src/dart/resolver/function_expression_invocation_resolver.dart';
import 'package:analyzer/src/dart/resolver/invocation_inference_helper.dart';
import 'package:analyzer/src/dart/resolver/method_invocation_resolver.dart';
@@ -34,6 +35,7 @@
import 'package:analyzer/src/dart/resolver/scope.dart';
import 'package:analyzer/src/dart/resolver/type_property_resolver.dart';
import 'package:analyzer/src/dart/resolver/typed_literal_resolver.dart';
+import 'package:analyzer/src/dart/resolver/yield_statement_resolver.dart';
import 'package:analyzer/src/error/bool_expression_verifier.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/error/nullable_dereference_verifier.dart';
@@ -217,8 +219,10 @@
AssignmentExpressionResolver _assignmentExpressionResolver;
BinaryExpressionResolver _binaryExpressionResolver;
FunctionExpressionInvocationResolver _functionExpressionInvocationResolver;
+ ForResolver _forResolver;
PostfixExpressionResolver _postfixExpressionResolver;
PrefixExpressionResolver _prefixExpressionResolver;
+ YieldStatementResolver _yieldStatementResolver;
InvocationInferenceHelper inferenceHelper;
@@ -367,6 +371,10 @@
FunctionExpressionInvocationResolver(
resolver: this,
);
+ this._forResolver = ForResolver(
+ resolver: this,
+ flowAnalysis: _flowAnalysis,
+ );
this._postfixExpressionResolver = PostfixExpressionResolver(
resolver: this,
flowAnalysis: _flowAnalysis,
@@ -375,6 +383,9 @@
resolver: this,
flowAnalysis: _flowAnalysis,
);
+ this._yieldStatementResolver = YieldStatementResolver(
+ resolver: this,
+ );
this.elementResolver = ElementResolver(this,
reportConstEvaluationErrors: reportConstEvaluationErrors,
migratableAstInfoProvider: _migratableAstInfoProvider);
@@ -1017,192 +1028,12 @@
@override
void visitForElementInScope(ForElement node) {
- ForLoopParts forLoopParts = node.forLoopParts;
- if (forLoopParts is ForParts) {
- if (forLoopParts is ForPartsWithDeclarations) {
- forLoopParts.variables?.accept(this);
- } else if (forLoopParts is ForPartsWithExpression) {
- forLoopParts.initialization?.accept(this);
- }
-
- var condition = forLoopParts.condition;
-
- _flowAnalysis?.for_conditionBegin(node);
- if (condition != null) {
- InferenceContext.setType(condition, typeProvider.boolType);
- condition.accept(this);
- condition = forLoopParts.condition;
- boolExpressionVerifier.checkForNonBoolCondition(condition);
- }
-
- _flowAnalysis?.for_bodyBegin(node, condition);
- node.body?.accept(this);
-
- _flowAnalysis?.flow?.for_updaterBegin();
- forLoopParts.updaters.accept(this);
-
- _flowAnalysis?.flow?.for_end();
- } else if (forLoopParts is ForEachParts) {
- Expression iterable = forLoopParts.iterable;
- DeclaredIdentifier loopVariable;
- DartType valueType;
- Element identifierElement;
- if (forLoopParts is ForEachPartsWithDeclaration) {
- loopVariable = forLoopParts.loopVariable;
- valueType = loopVariable?.type?.type ?? UnknownInferredType.instance;
- } else if (forLoopParts is ForEachPartsWithIdentifier) {
- SimpleIdentifier identifier = forLoopParts.identifier;
- identifier?.accept(this);
- identifierElement = identifier?.staticElement;
- if (identifierElement is VariableElement) {
- valueType = identifierElement.type;
- } else if (identifierElement is PropertyAccessorElement) {
- var parameters = identifierElement.parameters;
- if (parameters.isNotEmpty) {
- valueType = parameters[0].type;
- }
- }
- }
-
- if (valueType != null) {
- InterfaceType targetType = (node.awaitKeyword == null)
- ? typeProvider.iterableType2(valueType)
- : typeProvider.streamType2(valueType);
- InferenceContext.setType(iterable, targetType);
- }
- //
- // We visit the iterator before the loop variable because the loop
- // variable cannot be in scope while visiting the iterator.
- //
- iterable?.accept(this);
- // Note: the iterable could have been rewritten so grab it from
- // forLoopParts again.
- iterable = forLoopParts.iterable;
- loopVariable?.accept(this);
- var elementType = typeAnalyzer.computeForEachElementType(
- iterable, node.awaitKeyword != null);
- if (loopVariable != null &&
- elementType != null &&
- loopVariable.type == null) {
- var loopVariableElement =
- loopVariable.declaredElement as LocalVariableElementImpl;
- loopVariableElement.type = elementType;
- }
- _flowAnalysis?.flow?.forEach_bodyBegin(
- node,
- identifierElement is VariableElement
- ? identifierElement
- : loopVariable?.declaredElement,
- elementType ?? typeProvider.dynamicType);
- node.body?.accept(this);
- _flowAnalysis?.flow?.forEach_end();
-
- node.accept(elementResolver);
- node.accept(typeAnalyzer);
- }
+ _forResolver.resolveElement(node);
}
@override
void visitForStatementInScope(ForStatement node) {
- _flowAnalysis?.checkUnreachableNode(node);
-
- ForLoopParts forLoopParts = node.forLoopParts;
- if (forLoopParts is ForParts) {
- if (forLoopParts is ForPartsWithDeclarations) {
- forLoopParts.variables?.accept(this);
- } else if (forLoopParts is ForPartsWithExpression) {
- forLoopParts.initialization?.accept(this);
- }
-
- var condition = forLoopParts.condition;
-
- _flowAnalysis?.for_conditionBegin(node);
- if (condition != null) {
- InferenceContext.setType(condition, typeProvider.boolType);
- condition.accept(this);
- condition = forLoopParts.condition;
- boolExpressionVerifier.checkForNonBoolCondition(condition);
- }
-
- _flowAnalysis?.for_bodyBegin(node, condition);
- visitStatementInScope(node.body);
-
- _flowAnalysis?.flow?.for_updaterBegin();
- forLoopParts.updaters.accept(this);
-
- _flowAnalysis?.flow?.for_end();
- } else if (forLoopParts is ForEachParts) {
- Expression iterable = forLoopParts.iterable;
- DeclaredIdentifier loopVariable;
- SimpleIdentifier identifier;
- Element identifierElement;
- if (forLoopParts is ForEachPartsWithDeclaration) {
- loopVariable = forLoopParts.loopVariable;
- } else if (forLoopParts is ForEachPartsWithIdentifier) {
- identifier = forLoopParts.identifier;
- identifier?.accept(this);
- }
-
- DartType valueType;
- if (loopVariable != null) {
- TypeAnnotation typeAnnotation = loopVariable.type;
- valueType = typeAnnotation?.type ?? UnknownInferredType.instance;
- }
- if (identifier != null) {
- identifierElement = identifier.staticElement;
- if (identifierElement is VariableElement) {
- valueType = identifierElement.type;
- } else if (identifierElement is PropertyAccessorElement) {
- var parameters = identifierElement.parameters;
- if (parameters.isNotEmpty) {
- valueType = parameters[0].type;
- }
- }
- }
- if (valueType != null) {
- InterfaceType targetType = (node.awaitKeyword == null)
- ? typeProvider.iterableType2(valueType)
- : typeProvider.streamType2(valueType);
- InferenceContext.setType(iterable, targetType);
- }
- //
- // We visit the iterator before the loop variable because the loop variable
- // cannot be in scope while visiting the iterator.
- //
- iterable?.accept(this);
- // Note: the iterable could have been rewritten so grab it again.
- iterable = forLoopParts.iterable;
-
- nullableDereferenceVerifier.expression(iterable);
-
- loopVariable?.accept(this);
- var elementType = typeAnalyzer.computeForEachElementType(
- iterable, node.awaitKeyword != null);
- if (loopVariable != null &&
- elementType != null &&
- loopVariable.type == null) {
- var loopVariableElement =
- loopVariable.declaredElement as LocalVariableElementImpl;
- loopVariableElement.type = elementType;
- }
-
- _flowAnalysis?.flow?.forEach_bodyBegin(
- node,
- identifierElement is VariableElement
- ? identifierElement
- : loopVariable?.declaredElement,
- elementType ?? typeProvider.dynamicType);
-
- Statement body = node.body;
- if (body != null) {
- visitStatementInScope(body);
- }
-
- _flowAnalysis?.flow?.forEach_end();
-
- node.accept(elementResolver);
- node.accept(typeAnalyzer);
- }
+ _forResolver.resolveStatement(node);
}
@override
@@ -1886,51 +1717,7 @@
@override
void visitYieldStatement(YieldStatement node) {
- Expression e = node.expression;
- DartType returnType = inferenceContext.returnContext;
- bool isGenerator = _enclosingFunction?.isGenerator ?? false;
- if (returnType != null && isGenerator) {
- // If we're not in a generator ([a]sync*, then we shouldn't have a yield.
- // so don't infer
-
- // If this just a yield, then we just pass on the element type
- DartType type = returnType;
- if (node.star != null) {
- // If this is a yield*, then we wrap the element return type
- // If it's synchronous, we expect Iterable<T>, otherwise Stream<T>
- type = _enclosingFunction.isSynchronous
- ? typeProvider.iterableType2(type)
- : typeProvider.streamType2(type);
- }
- InferenceContext.setType(e, type);
- }
- super.visitYieldStatement(node);
-
- if (node.star != null) {
- nullableDereferenceVerifier.expression(node.expression);
- }
-
- DartType type = e?.staticType;
- if (type != null && isGenerator) {
- // If this just a yield, then we just pass on the element type
- if (node.star != null) {
- // If this is a yield*, then we unwrap the element return type
- // If it's synchronous, we expect Iterable<T>, otherwise Stream<T>
- if (type is InterfaceType) {
- ClassElement wrapperElement = _enclosingFunction.isSynchronous
- ? typeProvider.iterableElement
- : typeProvider.streamElement;
- var asInstanceType =
- (type as InterfaceTypeImpl).asInstanceOf(wrapperElement);
- if (asInstanceType != null) {
- type = asInstanceType.typeArguments[0];
- }
- }
- }
- if (type != null) {
- inferenceContext.addReturnOrYieldType(type);
- }
- }
+ _yieldStatementResolver.resolve(node);
}
void _checkForBodyMayCompleteNormally({
@@ -1953,7 +1740,7 @@
if (typeSystem.isPotentiallyNonNullable(returnType)) {
errorReporter.reportErrorForNode(
- CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY,
+ CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY,
errorNode,
);
}
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index 7d9c573..299771f 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -12,6 +12,7 @@
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart' show ConstructorMember;
import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type_demotion.dart';
import 'package:analyzer/src/dart/element/type_provider.dart';
import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
import 'package:analyzer/src/error/codes.dart';
@@ -99,31 +100,6 @@
_featureSet.isEnabled(Feature.non_nullable);
/**
- * Given an iterable expression from a foreach loop, attempt to infer
- * a type for the elements being iterated over. Inference is based
- * on the type of the iterator or stream over which the foreach loop
- * is defined.
- */
- DartType computeForEachElementType(Expression iterable, bool isAsync) {
- DartType iterableType = iterable.staticType;
- if (iterableType == null) return null;
- iterableType = iterableType.resolveToBound(_typeProvider.objectType);
-
- ClassElement iteratedElement =
- isAsync ? _typeProvider.streamElement : _typeProvider.iterableElement;
-
- InterfaceType iteratedType = iterableType is InterfaceTypeImpl
- ? iterableType.asInstanceOf(iteratedElement)
- : null;
-
- if (iteratedType != null) {
- return iteratedType.typeArguments.single;
- } else {
- return null;
- }
- }
-
- /**
* Given a constructor for a generic type, returns the equivalent generic
* function type that we could use to forward to the constructor, or for a
* non-generic type simply returns the constructor type.
@@ -985,7 +961,12 @@
if (type != null && !type.isBottom && !type.isDartCoreNull) {
VariableElement element = node.declaredElement;
if (element is LocalVariableElementImpl) {
- element.type = initializer.staticType;
+ var initializerType = initializer.staticType;
+ var inferredType = demoteType(
+ _resolver.definingLibrary,
+ initializerType,
+ );
+ element.type = inferredType;
}
}
}
diff --git a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
index c1bfbc5..2f012c8 100644
--- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -4,6 +4,7 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/language_version.dart';
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -138,11 +139,13 @@
identifier3(label), TokenFactory.tokenFromType(TokenType.SEMICOLON));
static IndexExpression cascadedIndexExpression(Expression index) =>
- astFactory.indexExpressionForCascade(
- TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD),
- TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET),
- index,
- TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET));
+ astFactory.indexExpressionForCascade2(
+ period: TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD),
+ leftBracket:
+ TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET),
+ index: index,
+ rightBracket:
+ TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET));
static MethodInvocation cascadedMethodInvocation(String methodName,
[List<Expression> arguments]) =>
@@ -287,12 +290,14 @@
directives: directives ?? <Directive>[],
declarations: declarations ?? <CompilationUnitMember>[],
endToken: TokenFactory.tokenFromType(TokenType.EOF),
+ languageVersion: null,
featureSet: null);
static CompilationUnit compilationUnit9(
{String scriptTag,
List<Directive> directives,
List<CompilationUnitMember> declarations,
+ LanguageVersion languageVersion,
FeatureSet featureSet}) =>
astFactory.compilationUnit(
beginToken: TokenFactory.tokenFromType(TokenType.EOF),
@@ -301,6 +306,7 @@
directives: directives ?? <Directive>[],
declarations: declarations ?? <CompilationUnitMember>[],
endToken: TokenFactory.tokenFromType(TokenType.EOF),
+ languageVersion: languageVersion,
featureSet: featureSet);
static ConditionalExpression conditionalExpression(Expression condition,
@@ -774,19 +780,21 @@
static IndexExpression indexExpression(Expression array, Expression index,
[TokenType leftBracket = TokenType.OPEN_SQUARE_BRACKET]) =>
- astFactory.indexExpressionForTarget(
- array,
- TokenFactory.tokenFromType(leftBracket),
- index,
- TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET));
+ astFactory.indexExpressionForTarget2(
+ target: array,
+ leftBracket: TokenFactory.tokenFromType(leftBracket),
+ index: index,
+ rightBracket:
+ TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET));
static IndexExpression indexExpressionForCascade(Expression array,
Expression index, TokenType period, TokenType leftBracket) =>
- astFactory.indexExpressionForCascade(
- TokenFactory.tokenFromType(period),
- TokenFactory.tokenFromType(leftBracket),
- index,
- TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET));
+ astFactory.indexExpressionForCascade2(
+ period: TokenFactory.tokenFromType(period),
+ leftBracket: TokenFactory.tokenFromType(leftBracket),
+ index: index,
+ rightBracket:
+ TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET));
static InstanceCreationExpression instanceCreationExpression(
Keyword keyword, ConstructorName name,
diff --git a/pkg/analyzer/lib/src/lint/util.dart b/pkg/analyzer/lib/src/lint/util.dart
index 6161c6b..25b2ec5 100644
--- a/pkg/analyzer/lib/src/lint/util.dart
+++ b/pkg/analyzer/lib/src/lint/util.dart
@@ -5,16 +5,11 @@
import 'dart:io';
import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
-import 'package:analyzer/error/error.dart';
-import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/ast/token.dart';
-import 'package:analyzer/src/dart/scanner/reader.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
-import 'package:analyzer/src/generated/parser.dart' show Parser;
-import 'package:analyzer/src/string_source.dart' show StringSource;
import 'package:path/path.dart' as path;
final _identifier = RegExp(r'^([(_|$)a-zA-Z]+([_a-zA-Z0-9])*)$');
@@ -98,38 +93,13 @@
void spelunk() {
var contents = File(path).readAsStringSync();
- var errorListener = _ErrorListener();
-
- var reader = CharSequenceReader(contents);
- var stringSource = StringSource(contents, path);
- var scanner = Scanner(stringSource, reader, errorListener)
- ..configureFeatures(featureSet);
- var startToken = scanner.tokenize();
-
- errorListener.throwIfErrors();
-
- var parser = Parser(stringSource, errorListener, featureSet: featureSet);
- var node = parser.parseCompilationUnit(startToken);
-
- errorListener.throwIfErrors();
+ var parseResult = parseString(
+ content: contents,
+ featureSet: featureSet,
+ );
var visitor = _SourceVisitor(sink);
- node.accept(visitor);
- }
-}
-
-class _ErrorListener implements AnalysisErrorListener {
- final errors = <AnalysisError>[];
-
- @override
- void onError(AnalysisError error) {
- errors.add(error);
- }
-
- void throwIfErrors() {
- if (errors.isNotEmpty) {
- throw Exception(errors);
- }
+ parseResult.unit.accept(visitor);
}
}
diff --git a/pkg/analyzer/lib/src/services/available_declarations.dart b/pkg/analyzer/lib/src/services/available_declarations.dart
index fe71b79..87254cc 100644
--- a/pkg/analyzer/lib/src/services/available_declarations.dart
+++ b/pkg/analyzer/lib/src/services/available_declarations.dart
@@ -7,21 +7,17 @@
import 'package:analyzer/dart/analysis/analysis_context.dart';
import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/source/line_info.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/analysis/session.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/token.dart';
-import 'package:analyzer/src/dart/scanner/reader.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart';
-import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
-import 'package:analyzer/src/string_source.dart';
import 'package:analyzer/src/summary/api_signature.dart';
import 'package:analyzer/src/summary/format.dart' as idl;
import 'package:analyzer/src/summary/idl.dart' as idl;
@@ -1873,20 +1869,11 @@
}
static CompilationUnit _parse(FeatureSet featureSet, String content) {
- var errorListener = AnalysisErrorListener.NULL_LISTENER;
- var source = StringSource(content, '');
-
- var reader = CharSequenceReader(content);
- var scanner = Scanner(null, reader, errorListener)
- ..configureFeatures(featureSet);
- var token = scanner.tokenize();
-
- var parser =
- Parser(source, errorListener, featureSet: featureSet, useFasta: true);
- var unit = parser.parseCompilationUnit(token);
- unit.lineInfo = LineInfo(scanner.lineStarts);
-
- return unit;
+ return parseString(
+ content: content,
+ featureSet: featureSet,
+ throwIfDiagnostics: false,
+ ).unit;
}
static String _readContent(File resource) {
diff --git a/pkg/analyzer/lib/src/summary/summary_file_builder.dart b/pkg/analyzer/lib/src/summary/summary_file_builder.dart
index 0083fed..4380c3d 100644
--- a/pkg/analyzer/lib/src/summary/summary_file_builder.dart
+++ b/pkg/analyzer/lib/src/summary/summary_file_builder.dart
@@ -5,17 +5,13 @@
import 'dart:collection';
import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/src/dart/analysis/session.dart';
-import 'package:analyzer/src/dart/scanner/reader.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/dart/sdk/sdk.dart';
import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/summary/summarize_elements.dart';
@@ -135,19 +131,10 @@
}
CompilationUnit _parse(Source source) {
- AnalysisErrorListener errorListener = AnalysisErrorListener.NULL_LISTENER;
- String code = source.contents.data;
- CharSequenceReader reader = CharSequenceReader(code);
- Scanner scanner = Scanner(source, reader, errorListener)
- ..configureFeatures(featureSet);
- Token token = scanner.tokenize();
- LineInfo lineInfo = LineInfo(scanner.lineStarts);
- Parser parser = Parser(source, errorListener,
- featureSet: scanner.featureSet,
- useFasta: context.analysisOptions.useFastaParser);
- parser.enableOptionalNewAndConst = true;
- CompilationUnit unit = parser.parseCompilationUnit(token);
- unit.lineInfo = lineInfo;
- return unit;
+ return parseString(
+ content: source.contents.data,
+ featureSet: featureSet,
+ throwIfDiagnostics: false,
+ ).unit;
}
}
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart b/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart
index ba41968..beac780 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart
@@ -49,6 +49,7 @@
1,
FieldFormalParameter,
GenericFunctionType,
+ IndexExpression,
TypeName,
);
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
index bad8134..4e1d249 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
@@ -94,13 +94,6 @@
return def;
}
- Token _varianceKeyword(LinkedNode data) {
- if (data.typeParameter_variance != UnlinkedTokenType.NOTHING) {
- return _Tokens.fromType(data.typeParameter_variance);
- }
- return null;
- }
-
Element _elementOfComponents(
int rawElementIndex,
LinkedNodeTypeSubstitution substitutionNode,
@@ -365,6 +358,7 @@
directives: _readNodeList(data.compilationUnit_directives),
declarations: _readNodeList(data.compilationUnit_declarations),
endToken: null,
+ languageVersion: null,
featureSet: null);
}
@@ -1012,11 +1006,13 @@
}
IndexExpression _read_indexExpression(LinkedNode data) {
- return astFactory.indexExpressionForTarget(
- _readNode(data.indexExpression_target),
- _Tokens.OPEN_SQUARE_BRACKET,
- _readNode(data.indexExpression_index),
- _Tokens.CLOSE_SQUARE_BRACKET,
+ return astFactory.indexExpressionForTarget2(
+ target: _readNode(data.indexExpression_target),
+ question:
+ AstBinaryFlags.hasQuestion(data.flags) ? _Tokens.QUESTION : null,
+ leftBracket: _Tokens.OPEN_SQUARE_BRACKET,
+ index: _readNode(data.indexExpression_index),
+ rightBracket: _Tokens.CLOSE_SQUARE_BRACKET,
)
..period =
AstBinaryFlags.hasPeriod(data.flags) ? _Tokens.PERIOD_PERIOD : null
@@ -1948,6 +1944,13 @@
return _unitContext.readType(data);
}
+ Token _varianceKeyword(LinkedNode data) {
+ if (data.typeParameter_variance != UnlinkedTokenType.NOTHING) {
+ return _Tokens.fromType(data.typeParameter_variance);
+ }
+ return null;
+ }
+
static ParameterKind _toParameterKind(LinkedNodeFormalParameterKind kind) {
switch (kind) {
case LinkedNodeFormalParameterKind.requiredPositional:
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
index 3b165e8..eeb0d76 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
@@ -823,6 +823,7 @@
);
builder.flags = AstBinaryFlags.encode(
hasPeriod: node.period != null,
+ hasQuestion: node.question != null,
);
return builder;
}
@@ -1484,6 +1485,15 @@
return _ElementComponents(elementIndex, null);
}
+ UnlinkedTokenType _getVarianceToken(TypeParameter parameter) {
+ // TODO (kallentu) : Clean up TypeParameterImpl casting once variance is
+ // added to the interface.
+ var parameterImpl = parameter as TypeParameterImpl;
+ return parameterImpl.varianceKeyword != null
+ ? TokensWriter.astToBinaryTokenType(parameterImpl.varianceKeyword.type)
+ : null;
+ }
+
int _indexOfElement(Element element) {
return _linkingContext.indexOfElement(element);
}
@@ -1679,15 +1689,6 @@
return _linkingContext.writeType(type);
}
- UnlinkedTokenType _getVarianceToken(TypeParameter parameter) {
- // TODO (kallentu) : Clean up TypeParameterImpl casting once variance is
- // added to the interface.
- var parameterImpl = parameter as TypeParameterImpl;
- return parameterImpl.varianceKeyword != null
- ? TokensWriter.astToBinaryTokenType(parameterImpl.varianceKeyword.type)
- : null;
- }
-
/// Return `true` if the expression might be successfully serialized.
///
/// This does not mean that the expression is constant, it just means that
diff --git a/pkg/analyzer/lib/src/summary2/ast_resolver.dart b/pkg/analyzer/lib/src/summary2/ast_resolver.dart
index 203818e..efb6e65 100644
--- a/pkg/analyzer/lib/src/summary2/ast_resolver.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_resolver.dart
@@ -16,21 +16,13 @@
final CompilationUnitElement _unitElement;
final Scope _nameScope;
- /// This field is set if the library is non-nullable by default.
- FlowAnalysisHelper flowAnalysis;
-
- AstResolver(this._linker, this._unitElement, this._nameScope) {
- if (_unitElement.library.isNonNullableByDefault) {
- flowAnalysis = FlowAnalysisHelper(
- _unitElement.library.typeSystem,
- false,
- );
- }
- }
+ AstResolver(this._linker, this._unitElement, this._nameScope);
void resolve(
AstNode node,
AstNode Function() getNode, {
+ bool buildElements = true,
+ bool isTopLevelVariableInitializer = false,
ClassElement enclosingClassElement,
ExecutableElement enclosingExecutableElement,
FunctionBody enclosingFunctionBody,
@@ -38,24 +30,37 @@
var featureSet = node.thisOrAncestorOfType<CompilationUnit>().featureSet;
var errorListener = AnalysisErrorListener.NULL_LISTENER;
- node.accept(
- ResolutionVisitor(
- unitElement: _unitElement,
- featureSet: featureSet,
- nameScope: _nameScope,
- errorListener: errorListener,
- ),
- );
- node = getNode();
+ if (buildElements) {
+ node.accept(
+ ResolutionVisitor(
+ unitElement: _unitElement,
+ featureSet: featureSet,
+ nameScope: _nameScope,
+ errorListener: errorListener,
+ ),
+ );
+ node = getNode();
- var variableResolverVisitor = VariableResolverVisitor(
- _unitElement.library,
- _unitElement.source,
- _unitElement.library.typeProvider,
- errorListener,
- nameScope: _nameScope,
- );
- node.accept(variableResolverVisitor);
+ var variableResolverVisitor = VariableResolverVisitor(
+ _unitElement.library,
+ _unitElement.source,
+ _unitElement.library.typeProvider,
+ errorListener,
+ nameScope: _nameScope,
+ );
+ node.accept(variableResolverVisitor);
+ }
+
+ FlowAnalysisHelper flowAnalysis;
+ if (isTopLevelVariableInitializer) {
+ if (_unitElement.library.isNonNullableByDefault) {
+ flowAnalysis = FlowAnalysisHelper(
+ _unitElement.library.typeSystem,
+ false,
+ );
+ flowAnalysis.topLevelDeclaration_enter(node.parent, null, null);
+ }
+ }
var resolverVisitor = ResolverVisitor(
_linker.inheritance,
@@ -78,5 +83,9 @@
}
node.accept(resolverVisitor);
+
+ if (isTopLevelVariableInitializer) {
+ flowAnalysis?.topLevelDeclaration_exit();
+ }
}
}
diff --git a/pkg/analyzer/lib/src/summary2/top_level_inference.dart b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
index ee81b9b..df2cc09 100644
--- a/pkg/analyzer/lib/src/summary2/top_level_inference.dart
+++ b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
@@ -20,6 +20,7 @@
import 'package:analyzer/src/summary2/link.dart';
import 'package:analyzer/src/summary2/linking_node_scope.dart';
import 'package:analyzer/src/task/strong_mode.dart';
+import 'package:meta/meta.dart';
DartType _dynamicIfNull(DartType type) {
if (type == null || type.isBottom || type.isDartCoreNull) {
@@ -399,7 +400,7 @@
@override
List<_InferenceNode> computeDependencies() {
- _resolveInitializer();
+ _resolveInitializer(forDependencies: true);
var collector = _InferenceDependenciesCollector();
_node.initializer.accept(collector);
@@ -427,7 +428,7 @@
@override
void evaluate() {
- _resolveInitializer();
+ _resolveInitializer(forDependencies: false);
if (LazyAst.getType(_node) == null) {
var initializerType = _node.initializer.staticType;
@@ -458,9 +459,13 @@
isEvaluated = true;
}
- void _resolveInitializer() {
+ void _resolveInitializer({@required bool forDependencies}) {
var astResolver = AstResolver(_walker._linker, _unitElement, _scope);
- astResolver.flowAnalysis?.topLevelDeclaration_enter(_node, null, null);
- astResolver.resolve(_node.initializer, () => _node.initializer);
+ astResolver.resolve(
+ _node.initializer,
+ () => _node.initializer,
+ buildElements: forDependencies,
+ isTopLevelVariableInitializer: true,
+ );
}
}
diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
index c1c120b..92374b8 100644
--- a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
+++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
@@ -26,29 +26,46 @@
part 'stream.dart';
-class Future<T> {
- factory Future(computation()) => null;
- factory Future.delayed(Duration duration, [T computation()]) => null;
- factory Future.microtask(FutureOr<T> computation()) => null;
- factory Future.value([FutureOr<T> result]) => null;
+abstract class Future<T> {
+ factory Future(computation()) {
+ throw 0;
+ }
- Future<R> then<R>(FutureOr<R> onValue(T value)) => null;
+ factory Future.delayed(Duration duration, [T computation()?]) {
+ throw 0;
+ }
+
+ factory Future.microtask(FutureOr<T> computation()) {
+ throw 0;
+ }
+
+ factory Future.value([FutureOr<T>? result]) {
+ throw 0;
+ }
+
+ Future<R> then<R>(FutureOr<R> onValue(T value));
+
Future<T> whenComplete(action());
- static Future<List<T>> wait<T>(Iterable<Future<T>> futures) => null;
+ static Future<List<T>> wait<T>(Iterable<Future<T>> futures) => throw 0;
}
-class FutureOr<T> {}
+abstract class FutureOr<T> {}
abstract class Completer<T> {
- factory Completer() => null;
- factory Completer.sync() => null;
+ factory Completer() {
+ throw 0;
+ }
+
+ factory Completer.sync() {
+ throw 0;
+ }
Future<T> get future;
bool get isCompleted;
- void complete([value]);
- void completeError(Object error, [StackTrace stackTrace]);
+ void complete([FutureOr<T>? value]);
+ void completeError(Object error, [StackTrace? stackTrace]);
}
abstract class Timer {
@@ -64,14 +81,14 @@
abstract class Stream<T> {
Stream();
- factory Stream.fromIterable(Iterable<T> data) => null;
+ factory Stream.fromIterable(Iterable<T> data) {
+ throw 0;
+ }
Future<T> get first;
- StreamSubscription<T> listen(void onData(T event),
- { Function onError,
- void onDone(),
- bool cancelOnError});
+ StreamSubscription<T> listen(void onData(T event)?,
+ {Function? onError, void onDone()?, bool? cancelOnError});
}
abstract class StreamIterator<T> {}
@@ -79,12 +96,12 @@
abstract class StreamSubscription<T> {
bool get isPaused;
- Future<E> asFuture<E>([E futureValue]);
+ Future<E> asFuture<E>([E? futureValue]);
Future cancel();
- void onData(void handleData(T data));
- void onError(Function handleError);
- void onDone(void handleDone());
- void pause([Future resumeSignal]);
+ void onData(void handleData(T data)?);
+ void onError(Function? handleError);
+ void onDone(void handleDone()?);
+ void pause([Future<void>? resumeSignal]);
void resume();
}
@@ -114,56 +131,80 @@
abstract class HashMap<K, V> implements Map<K, V> {
external factory HashMap(
- {bool equals(K key1, K key2),
- int hashCode(K key),
- bool isValidKey(potentialKey)});
+ {bool Function(K, K)? equals,
+ int Function(K)? hashCode,
+ bool Function(dynamic)? isValidKey});
external factory HashMap.identity();
- factory HashMap.from(Map other) => null;
+ factory HashMap.from(Map<dynamic, dynamic> other) {
+ throw 0;
+ }
- factory HashMap.of(Map<K, V> other) => null;
+ factory HashMap.of(Map<K, V> other) {
+ throw 0;
+ }
factory HashMap.fromIterable(Iterable iterable,
- {K key(element), V value(element)}) => null;
+ {K Function(dynamic element)? key, V Function(dynamic element)? value}) {
+ throw 0;
+ }
- factory HashMap.fromIterables(Iterable<K> keys, Iterable<V> values) => null;
+ factory HashMap.fromIterables(Iterable<K> keys, Iterable<V> values) {
+ throw 0;
+ }
- factory HashMap.fromEntries(Iterable<MapEntry<K, V>> entries) => null;
+ factory HashMap.fromEntries(Iterable<MapEntry<K, V>> entries) {
+ throw 0;
+ }
}
abstract class LinkedHashMap<K, V> implements Map<K, V> {
external factory LinkedHashMap(
- {bool equals(K key1, K key2),
- int hashCode(K key),
- bool isValidKey(potentialKey)});
+ {bool Function(K, K)? equals,
+ int Function(K)? hashCode,
+ bool Function(dynamic)? isValidKey});
external factory LinkedHashMap.identity();
- factory LinkedHashMap.from(Map other) => null;
+ factory LinkedHashMap.from(Map<dynamic, dynamic> other) {
+ throw 0;
+ }
- factory LinkedHashMap.of(Map<K, V> other) => null;
+ factory LinkedHashMap.of(Map<K, V> other) {
+ throw 0;
+ }
- factory LinkedHashMap.fromIterable(Iterable iterable,
- {K key(element), V value(element)}) => null;
+ factory LinkedHashMap.fromIterable(Iterable iterable,
+ {K Function(dynamic element)? key, V Function(dynamic element)? value}) {
+ throw 0;
+ }
- factory LinkedHashMap.fromIterables(Iterable<K> keys, Iterable<V> values)
- => null;
- factory LinkedHashMap.fromEntries(Iterable<MapEntry<K, V>> entries) => null;
+ factory LinkedHashMap.fromIterables(Iterable<K> keys, Iterable<V> values) {
+ throw 0;
+ }
+
+ factory LinkedHashMap.fromEntries(Iterable<MapEntry<K, V>> entries) {
+ throw 0;
+ }
}
abstract class LinkedHashSet<E> implements Set<E> {
external factory LinkedHashSet(
- {bool equals(E e1, E e2),
- int hashCode(E e),
- bool isValidKey(potentialKey)});
+ {bool Function(E, E)? equals,
+ int Function(E)? hashCode,
+ bool Function(dynamic)? isValidKey});
external factory LinkedHashSet.identity();
- factory LinkedHashSet.from(Iterable elements) => null;
+ factory LinkedHashSet.from(Iterable<dynamic> elements) {
+ throw 0;
+ }
- factory LinkedHashSet.of(Iterable<E> elements) => null;
+ factory LinkedHashSet.of(Iterable<E> elements) {
+ throw 0;
+ }
}
''',
)
@@ -205,9 +246,9 @@
const proxy = const _Proxy();
-external bool identical(Object a, Object b);
+external bool identical(Object? a, Object? b);
-void print(Object object) {}
+void print(Object? object) {}
abstract class bool extends Object {
external const factory bool.fromEnvironment(String name,
@@ -233,7 +274,7 @@
class pragma {
final String name;
- final Object options;
+ final Object? options;
const pragma(this.name, [this.options]);
}
@@ -264,19 +305,24 @@
int truncate();
double truncateToDouble();
- external static double parse(String source, [double onError(String source)]);
+ external static double parse(String source,
+ [@deprecated double onError(String source)?]);
+
+ external static double? tryParse(String source);
}
class Duration implements Comparable<Duration> {}
class Error {
Error();
- static String safeToString(Object object) => '';
- external StackTrace get stackTrace;
+ static String safeToString(Object? object) => '';
+ external StackTrace? get stackTrace;
}
class Exception {
- factory Exception([var message]) => null;
+ factory Exception([var message]) {
+ throw 0;
+ }
}
class FormatException implements Exception {}
@@ -284,7 +330,8 @@
class Function {}
abstract class int extends num {
- external const factory int.fromEnvironment(String name, {int defaultValue});
+ external const factory int.fromEnvironment(String name,
+ {int defaultValue = 0});
bool get isEven => false;
bool get isNegative;
@@ -302,7 +349,9 @@
String toString();
external static int parse(String source,
- {int radix, int onError(String source)});
+ {int? radix, @deprecated int onError(String source)?});
+
+ external static int? tryParse(String source, {int? radix});
}
abstract class Invocation {}
@@ -318,9 +367,9 @@
Iterable<T> expand<T>(Iterable<T> f(E element));
- E firstWhere(bool test(E element), { E orElse()});
+ E firstWhere(bool test(E element), {E orElse()?});
- R fold<R>(R initialValue, R combine(R previousValue, E element)) => null;
+ R fold<R>(R initialValue, R combine(R previousValue, E element));
void forEach(void f(E element));
@@ -339,17 +388,17 @@
}
class List<E> implements Iterable<E> {
- List([int length]);
- external factory List.from(Iterable elements, {bool growable: true});
+ external factory List([int? length]);
external factory List.filled(int length, E fill, {bool growable = false});
+ external factory List.empty({bool growable = false});
external factory List.from(Iterable elements, {bool growable = true});
external factory List.of(Iterable<E> elements, {bool growable = true});
external factory List.generate(int length, E generator(int index),
{bool growable = true});
external factory List.unmodifiable(Iterable elements);
- E get last => null;
- E operator [](int index) => null;
+ E get last => throw 0;
+ E operator [](int index) => throw 0;
void operator []=(int index, E value) {}
void add(E value) {}
@@ -362,27 +411,43 @@
noSuchMethod(Invocation invocation) => null;
}
-class Map<K, V> {
- factory Map() => null;
+abstract class Map<K, V> {
+ external factory Map();
+ external factory Map.from();
+ external Map.of(Map<K, V> other);
+ external factory Map.unmodifiable(Map<dynamic, dynamic> other);
+ external factory Map.identity();
- factory Map.fromIterable(Iterable iterable,
- {K key(element), V value(element)}) => null;
+ external factory Map.fromIterable(Iterable iterable,
+ {K key(element)?, V value(element)?});
- Iterable<K> get keys => null;
+ external factory Map.fromIterables(Iterable<K> keys, Iterable<V> values);
+ external factory Map.fromEntries(Iterable<MapEntry<K, V>> entries);
+
+ Iterable<K> get keys;
bool get isEmpty;
bool get isNotEmpty;
int get length => 0;
- Iterable<V> get values => null;
+ Iterable<V> get values;
- V operator [](K key) => null;
- void operator []=(K key, V value) {}
+ V? operator [](K key);
+ void operator []=(K key, V value);
- Map<RK, RV> cast<RK, RV>() => null;
- bool containsKey(Object key) => false;
+ Map<RK, RV> cast<RK, RV>();
+ bool containsKey(Object? key);
}
class Null extends Object {
- factory Null._uninstantiable() => null;
+ factory Null._uninstantiable() {
+ throw 0;
+ }
+}
+
+class MapEntry<K, V> {
+ final K key;
+ final V value;
+ const factory MapEntry(K key, V value) = MapEntry<K, V>._;
+ const MapEntry._(this.key, this.value);
}
abstract class num implements Comparable<num> {
@@ -414,13 +479,13 @@
class Object {
const Object();
- int get hashCode => 0;
- Type get runtimeType => null;
+ external int get hashCode;
+ external Type get runtimeType;
- bool operator ==(Object other) => identical(this, other);
+ external bool operator ==(Object other);
- String toString() => 'a string';
- dynamic noSuchMethod(Invocation invocation) => null;
+ external String toString();
+ external dynamic noSuchMethod(Invocation invocation);
}
abstract class Pattern {}
@@ -430,36 +495,48 @@
}
abstract class Set<E> implements Iterable<E> {
- factory Set() => null;
- factory Set.identity() => null;
- factory Set.from(Iterable elements) => null;
- factory Set.of(Iterable<E> elements) => null;
+ external factory Set();
+ external factory Set.identity();
+ external factory Set.from(Iterable elements);
+ external factory Set.of(Iterable<E> elements);
Set<R> cast<R>();
- void add(E element) {}
+ bool add(E value);
+ void addAll(Iterable<E> elements);
+ bool remove(Object? value);
+ E? lookup(Object? object);
}
class StackTrace {}
abstract class String implements Comparable<String>, Pattern {
external factory String.fromCharCodes(Iterable<int> charCodes,
- [int start = 0, int end]);
+ [int start = 0, int? end]);
+
+ external factory String.fromCharCode(int charCode);
+
+ external const factory String.fromEnvironment(String name,
+ {String defaultValue = ""});
List<int> get codeUnits;
- int indexOf(Pattern pattern, [int start]);
bool get isEmpty => false;
bool get isNotEmpty => false;
int get length => 0;
- String operator +(String other) => null;
bool operator ==(Object other);
+ String operator [](int index);
+ String operator +(String other);
+ String operator *(int times);
int codeUnitAt(int index);
bool contains(String other, [int startIndex = 0]);
+ int indexOf(Pattern pattern, [int start = 0]);
+ int lastIndexOf(Pattern pattern, [int? start]);
+ bool startsWith(Pattern pattern, [int index = 0]);
String splitMapJoin(Pattern pattern,
- {String onMatch(Match match), String onNonMatch(String nonMatch)});
- String substring(int len) => null;
+ {String Function(Match)? onMatch, String Function(String)? onNonMatch});
+ String substring(int startIndex, [int? endIndex]);
String toLowerCase();
String toUpperCase();
}
@@ -576,26 +653,26 @@
abstract class Element {
/// Stream of `cut` events handled by this [Element].
- ElementStream<Event> get onCut => null;
+ ElementStream<Event> get onCut => throw 0;
- String get id => null;
+ String get id => throw 0;
- set id(String value) => null;
+ set id(String value) => throw 0;
}
class HtmlElement extends Element {
int tabIndex;
- ElementStream<Event> get onChange => null;
- ElementStream<MouseEvent> get onClick => null;
- ElementStream<KeyEvent> get onKeyUp => null;
- ElementStream<KeyEvent> get onKeyDown => null;
+ ElementStream<Event> get onChange => throw 0;
+ ElementStream<MouseEvent> get onClick => throw 0;
+ ElementStream<KeyEvent> get onKeyUp => throw 0;
+ ElementStream<KeyEvent> get onKeyDown => throw 0;
- bool get hidden => null;
- set hidden(bool value) => null;
+ bool get hidden => throw 0;
+ set hidden(bool value) {}
- void set className(String s){}
- void set readOnly(bool b){}
- void set tabIndex(int i){}
+ void set className(String s) {}
+ void set readOnly(bool b) {}
+ void set tabIndex(int i) {}
String _innerHtml;
String get innerHtml {
@@ -621,7 +698,7 @@
class BodyElement extends HtmlElement {
factory BodyElement() => document.createElement("body");
- ElementStream<Event> get onUnload => null;
+ ElementStream<Event> get onUnload => throw 0;
}
class ButtonElement extends HtmlElement {
@@ -680,12 +757,12 @@
class TableSectionElement extends HtmlElement {
- List<TableRowElement> get rows => null;
+ List<TableRowElement> get rows => throw 0;
TableRowElement addRow() {
}
- TableRowElement insertRow(int index) => null;
+ TableRowElement insertRow(int index) => throw 0;
factory TableSectionElement._() { throw new UnsupportedError("Not supported"); }
@@ -762,42 +839,46 @@
library dart.io;
abstract class Directory implements FileSystemEntity {
- factory Directory(String path) => null;
+ factory Directory(String path) {
+ throw 0;
+ }
Future<bool> exists() async => true;
bool existsSync() => true;
- Future<FileStat> stat() async => null;
- FileStat statSync() => null;
+ Future<FileStat> stat() async => throw 0;
+ FileStat statSync() => throw 0;
}
abstract class File implements FileSystemEntity {
- factory File(String path) => null;
+ factory File(String path) {
+ throw 0;
+ }
Future<DateTime> lastModified();
DateTime lastModifiedSync();
- Future<bool> exists() async => true;
- bool existsSync() => true;
+ Future<bool> exists();
+ bool existsSync();
- Future<FileStat> stat() async => null;
- FileStat statSync() => null;
+ Future<FileStat> stat();
+ FileStat statSync();
}
abstract class FileSystemEntity {
- static Future<bool> isDirectory(String path) => true;
+ static Future<bool> isDirectory(String path) async => true;
static bool isDirectorySync(String path) => true;
- static Future<bool> isFile(String path) => true;
+ static Future<bool> isFile(String path) async => true;
static bool isFileSync(String path) => true;
- static Future<bool> isLink(String path) => true;
+ static Future<bool> isLink(String path) async => true;
static bool isLinkSync(String path) => true;
static Future<FileSystemEntityType> type(
- String path, {bool followLinks: true}) async => null;
+ String path, {bool followLinks: true}) => throw 0;
static FileSystemEntityType typeSync(
- String path, {bool followLinks: true}) => null;
+ String path, {bool followLinks: true}) => throw 0;
}
''',
)
@@ -816,8 +897,8 @@
const double PI = 3.1415926535897932;
const double LN10 = 2.302585092994046;
-T min<T extends num>(T a, T b) => null;
-T max<T extends num>(T a, T b) => null;
+T min<T extends num>(T a, T b) => throw 0;
+T max<T extends num>(T a, T b) => throw 0;
external double cos(num radians);
external double sin(num radians);
diff --git a/pkg/analyzer/lib/src/util/ast_data_extractor.dart b/pkg/analyzer/lib/src/util/ast_data_extractor.dart
index eb295b2..eb603e4 100644
--- a/pkg/analyzer/lib/src/util/ast_data_extractor.dart
+++ b/pkg/analyzer/lib/src/util/ast_data_extractor.dart
@@ -2,8 +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:_fe_analyzer_shared/src/testing/id.dart'
- show ActualData, DataRegistry, Id, IdKind, MemberId, NodeId;
+import 'package:_fe_analyzer_shared/src/testing/id.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -30,6 +29,18 @@
registerValue(uri, node.offset, id, value, node);
}
+ void computeForLibrary(LibraryElement library, Id id) {
+ if (id == null) return;
+ T value = computeElementValue(id, library);
+ registerValue(uri, 0, id, value, library);
+ }
+
+ void computeForClass(Declaration node, Id id) {
+ if (id == null) return;
+ T value = computeNodeValue(id, node);
+ registerValue(uri, node.offset, id, value, node);
+ }
+
void computeForMember(Declaration node, Id id) {
if (id == null) return;
T value = computeNodeValue(id, node);
@@ -47,6 +58,22 @@
/// If `null` is returned, [node] has no associated data.
T computeNodeValue(Id id, AstNode node);
+ T computeElementValue(Id id, Element element) => null;
+
+ Id createLibraryId(LibraryElement node) {
+ Uri uri = node.source.uri;
+ if (uri.path.startsWith(r'/C:')) {
+ // The `MemoryResourceProvider.convertPath` inserts '/C:' on Windows.
+ uri = Uri(scheme: uri.scheme, path: uri.path.substring(3));
+ }
+ return LibraryId(uri);
+ }
+
+ Id createClassId(Declaration node) {
+ var element = node.declaredElement;
+ return ClassId(element.name);
+ }
+
Id createMemberId(Declaration node) {
var element = node.declaredElement;
if (element.enclosingElement is CompilationUnitElement) {
@@ -83,6 +110,19 @@
}
@override
+ visitCompilationUnit(CompilationUnit node) {
+ var library = node.declaredElement.library;
+ computeForLibrary(library, createLibraryId(library));
+ return super.visitCompilationUnit(node);
+ }
+
+ @override
+ visitClassDeclaration(ClassDeclaration node) {
+ computeForClass(node, createClassId(node));
+ return super.visitClassDeclaration(node);
+ }
+
+ @override
visitCollectionElement(CollectionElement node) {
computeForCollectionElement(node, computeDefaultNodeId(node));
super.visitCollectionElement(node);
diff --git a/pkg/analyzer/lib/src/workspace/bazel.dart b/pkg/analyzer/lib/src/workspace/bazel.dart
index 9e42c63..8f8065d 100644
--- a/pkg/analyzer/lib/src/workspace/bazel.dart
+++ b/pkg/analyzer/lib/src/workspace/bazel.dart
@@ -148,7 +148,8 @@
/**
* Information about a Bazel workspace.
*/
-class BazelWorkspace extends Workspace {
+class BazelWorkspace extends Workspace
+ implements WorkspaceWithDefaultAnalysisOptions {
static const String _WORKSPACE = 'WORKSPACE';
static const String _READONLY = 'READONLY';
diff --git a/pkg/analyzer/lib/src/workspace/workspace.dart b/pkg/analyzer/lib/src/workspace/workspace.dart
index 1d6de14..3681cdf 100644
--- a/pkg/analyzer/lib/src/workspace/workspace.dart
+++ b/pkg/analyzer/lib/src/workspace/workspace.dart
@@ -71,3 +71,15 @@
}
}
}
+
+/**
+ * An interface for a workspace that contains a default analysis options file.
+ * Classes that provide information of such a workspace should implement this
+ * interface.
+ */
+class WorkspaceWithDefaultAnalysisOptions {
+ /**
+ * The uri for the analysis options file.
+ */
+ static const String uri = 'package:dart.analysis_options/default.yaml';
+}
diff --git a/pkg/analyzer/test/dart/analysis/utilities_test.dart b/pkg/analyzer/test/dart/analysis/utilities_test.dart
index 27bf7c6..15fcd19 100644
--- a/pkg/analyzer/test/dart/analysis/utilities_test.dart
+++ b/pkg/analyzer/test/dart/analysis/utilities_test.dart
@@ -203,6 +203,35 @@
expect(result.unit.toString(), equals('int? f() => 1;'));
}
+ test_parseString_languageVersion() {
+ var content = '''
+// @dart = 2.7
+class A {}
+''';
+ var result = parseString(
+ content: content,
+ throwIfDiagnostics: false,
+ featureSet: FeatureSet.fromEnableFlags([]),
+ );
+
+ var languageVersion = result.unit.languageVersion;
+ expect(languageVersion.major, 2);
+ expect(languageVersion.minor, 7);
+ }
+
+ test_parseString_languageVersion_null() {
+ var content = '''
+class A {}
+''';
+ var result = parseString(
+ content: content,
+ throwIfDiagnostics: false,
+ featureSet: FeatureSet.fromEnableFlags([]),
+ );
+
+ expect(result.unit.languageVersion, isNull);
+ }
+
test_parseString_lineInfo() {
String content = '''
main() {
diff --git a/pkg/analyzer/test/dart/ast/ast_test.dart b/pkg/analyzer/test/dart/ast/ast_test.dart
index 72c5442..bbdf072 100644
--- a/pkg/analyzer/test/dart/ast/ast_test.dart
+++ b/pkg/analyzer/test/dart/ast/ast_test.dart
@@ -716,8 +716,13 @@
var scanner = Scanner.fasta(source, listener)
..configureFeatures(featureSet);
Token tokens = scanner.tokenize();
- _unit = Parser(source, listener, featureSet: featureSet, useFasta: true)
- .parseCompilationUnit(tokens);
+ _unit = Parser(
+ source,
+ listener,
+ languageVersion: scanner.languageVersion,
+ featureSet: featureSet,
+ useFasta: true,
+ ).parseCompilationUnit(tokens);
}
return _unit;
}
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index 49b1fea..2b9fc1f 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -3420,183 +3420,4 @@
core.dynamic dynamicVariable;
''');
}
-
- test_yield_async_to_dynamic_type() async {
- await assertNoErrorsInCode('''
-dynamic f() async* {
- yield 3;
-}
-''');
- }
-
- test_yield_async_to_generic_type() async {
- await assertNoErrorsInCode('''
-import 'dart:async';
-Stream f() async* {
- yield 3;
-}
-''');
- }
-
- test_yield_async_to_parameterized_type() async {
- await assertNoErrorsInCode('''
-import 'dart:async';
-Stream<int> f() async* {
- yield 3;
-}
-''');
- }
-
- test_yield_async_to_untyped() async {
- await assertNoErrorsInCode('''
-f() async* {
- yield 3;
-}
-''');
- }
-
- test_yield_each_async_dynamic_to_dynamic() async {
- await assertNoErrorsInCode('''
-f() async* {
- yield* g();
-}
-g() => null;
-''');
- }
-
- test_yield_each_async_dynamic_to_stream() async {
- await assertNoErrorsInCode('''
-import 'dart:async';
-Stream f() async* {
- yield* g();
-}
-g() => null;
-''');
- }
-
- test_yield_each_async_dynamic_to_typed_stream() async {
- await assertNoErrorsInCode('''
-import 'dart:async';
-Stream<int> f() async* {
- yield* g();
-}
-g() => null;
-''');
- }
-
- test_yield_each_async_stream_to_dynamic() async {
- await assertNoErrorsInCode('''
-import 'dart:async';
-f() async* {
- yield* g();
-}
-Stream g() => null;
-''');
- }
-
- test_yield_each_async_typed_stream_to_dynamic() async {
- await assertNoErrorsInCode('''
-import 'dart:async';
-f() async* {
- yield* g();
-}
-Stream<int> g() => null;
-''');
- }
-
- test_yield_each_async_typed_stream_to_typed_stream() async {
- await assertNoErrorsInCode('''
-import 'dart:async';
-Stream<int> f() async* {
- yield* g();
-}
-Stream<int> g() => null;
-''');
- }
-
- test_yield_each_sync_dynamic_to_dynamic() async {
- await assertNoErrorsInCode('''
-f() sync* {
- yield* g();
-}
-g() => null;
-''');
- }
-
- test_yield_each_sync_dynamic_to_iterable() async {
- await assertNoErrorsInCode('''
-Iterable f() sync* {
- yield* g();
-}
-g() => null;
-''');
- }
-
- test_yield_each_sync_dynamic_to_typed_iterable() async {
- await assertNoErrorsInCode('''
-Iterable<int> f() sync* {
- yield* g();
-}
-g() => null;
-''');
- }
-
- test_yield_each_sync_iterable_to_dynamic() async {
- await assertNoErrorsInCode('''
-f() sync* {
- yield* g();
-}
-Iterable g() => null;
-''');
- }
-
- test_yield_each_sync_typed_iterable_to_dynamic() async {
- await assertNoErrorsInCode('''
-f() sync* {
- yield* g();
-}
-Iterable<int> g() => null;
-''');
- }
-
- test_yield_each_sync_typed_iterable_to_typed_iterable() async {
- await assertNoErrorsInCode('''
-Iterable<int> f() sync* {
- yield* g();
-}
-Iterable<int> g() => null;
-''');
- }
-
- test_yield_sync_to_dynamic_type() async {
- await assertNoErrorsInCode('''
-dynamic f() sync* {
- yield 3;
-}
-''');
- }
-
- test_yield_sync_to_generic_type() async {
- await assertNoErrorsInCode('''
-Iterable f() sync* {
- yield 3;
-}
-''');
- }
-
- test_yield_sync_to_parameterized_type() async {
- await assertNoErrorsInCode('''
-Iterable<int> f() sync* {
- yield 3;
-}
-''');
- }
-
- test_yield_sync_to_untyped() async {
- await assertNoErrorsInCode('''
-f() sync* {
- yield 3;
-}
-''');
- }
}
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index be82c6f..e67b9a8 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -13,6 +13,7 @@
show LanguageVersionToken, ScannerConfiguration, ScannerResult, scanString;
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/language_version.dart';
import 'package:analyzer/dart/ast/token.dart' as analyzer;
import 'package:analyzer/dart/ast/token.dart' show Token, TokenType;
import 'package:analyzer/error/error.dart';
@@ -1949,7 +1950,9 @@
@override
void createParser(String content,
- {int expectedEndOffset, FeatureSet featureSet}) {
+ {int expectedEndOffset,
+ LanguageVersion languageVersion,
+ FeatureSet featureSet}) {
featureSet ??= FeatureSet.forTesting();
var result = scanString(content,
configuration: featureSet.isEnabled(Feature.non_nullable)
@@ -1957,7 +1960,7 @@
: ScannerConfiguration.classic,
includeComments: true);
_fastaTokens = result.tokens;
- _parserProxy = ParserProxy(_fastaTokens, featureSet,
+ _parserProxy = ParserProxy(_fastaTokens, languageVersion, featureSet,
allowNativeClause: allowNativeClause,
expectedEndOffset: expectedEndOffset);
}
@@ -2068,7 +2071,7 @@
CompilationUnit parseCompilationUnit2(
String content, GatheringErrorListener listener,
- {FeatureSet featureSet}) {
+ {LanguageVersion languageVersion, FeatureSet featureSet}) {
featureSet ??= FeatureSet.forTesting();
var source = StringSource(content, 'parser_test_StringSource.dart');
@@ -2094,8 +2097,8 @@
isNonNullableByDefault: false,
);
fasta.Parser parser = fasta.Parser(null);
- AstBuilder astBuilder =
- AstBuilder(errorReporter, source.uri, true, featureSet);
+ AstBuilder astBuilder = AstBuilder(
+ errorReporter, source.uri, true, languageVersion, featureSet);
parser.listener = astBuilder;
astBuilder.parser = parser;
astBuilder.allowNativeClause = allowNativeClause;
@@ -2440,6 +2443,7 @@
expect(functionParameter.typeParameters, isNull);
expect(functionParameter.parameters, isNotNull);
expect(functionParameter.question, isNotNull);
+ expect(functionParameter.endToken, functionParameter.question);
}
void test_functionTyped_named_nullable() {
@@ -2664,6 +2668,7 @@
expect(functionParameter.typeParameters, isNull);
expect(functionParameter.parameters, isNotNull);
expect(functionParameter.question, isNotNull);
+ expect(functionParameter.endToken, functionParameter.question);
}
}
@@ -3357,7 +3362,8 @@
* Creates a [ParserProxy] which is prepared to begin parsing at the given
* Fasta token.
*/
- factory ParserProxy(analyzer.Token firstToken, FeatureSet featureSet,
+ factory ParserProxy(analyzer.Token firstToken,
+ LanguageVersion languageVersion, FeatureSet featureSet,
{bool allowNativeClause = false, int expectedEndOffset}) {
TestSource source = TestSource();
var errorListener = GatheringErrorListener(checkRanges: true);
@@ -3366,16 +3372,22 @@
source,
isNonNullableByDefault: false,
);
- return ParserProxy._(
- firstToken, errorReporter, null, errorListener, featureSet,
+ return ParserProxy._(firstToken, errorReporter, null, errorListener,
+ languageVersion, featureSet,
allowNativeClause: allowNativeClause,
expectedEndOffset: expectedEndOffset);
}
- ParserProxy._(analyzer.Token firstToken, ErrorReporter errorReporter,
- Uri fileUri, this._errorListener, FeatureSet featureSet,
- {bool allowNativeClause = false, this.expectedEndOffset})
- : super(firstToken, errorReporter, fileUri, featureSet,
+ ParserProxy._(
+ analyzer.Token firstToken,
+ ErrorReporter errorReporter,
+ Uri fileUri,
+ this._errorListener,
+ LanguageVersion languageVersion,
+ FeatureSet featureSet,
+ {bool allowNativeClause = false,
+ this.expectedEndOffset})
+ : super(firstToken, errorReporter, fileUri, languageVersion, featureSet,
allowNativeClause: allowNativeClause) {
_eventListener = ForwardingTestListener(astBuilder);
fastaParser.listener = _eventListener;
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index bb538e6..a2efa50 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -9474,7 +9474,12 @@
ScannerResult result = scanString(content, includeComments: true);
listener.setLineInfo(source, result.lineStarts);
- parser = Parser(source, listener, featureSet: FeatureSet.forTesting());
+ parser = Parser(
+ source,
+ listener,
+ languageVersion: null,
+ featureSet: FeatureSet.forTesting(),
+ );
parser.allowNativeClause = allowNativeClause;
parser.parseFunctionBodies = parseFunctionBodies;
parser.enableOptionalNewAndConst = enableOptionalNewAndConst;
@@ -9604,8 +9609,12 @@
ScannerResult result = scanString(content, includeComments: true);
listener.setLineInfo(source, result.lineStarts);
- Parser parser =
- Parser(source, listener, featureSet: FeatureSet.forTesting());
+ Parser parser = Parser(
+ source,
+ listener,
+ languageVersion: null,
+ featureSet: FeatureSet.forTesting(),
+ );
parser.enableOptionalNewAndConst = enableOptionalNewAndConst;
CompilationUnit unit = parser.parseCompilationUnit(result.tokens);
expect(unit, isNotNull);
@@ -9629,8 +9638,12 @@
ScannerResult result = scanString(content, includeComments: true);
- Parser parser =
- Parser(source, listener, featureSet: FeatureSet.forTesting());
+ Parser parser = Parser(
+ source,
+ listener,
+ languageVersion: null,
+ featureSet: FeatureSet.forTesting(),
+ );
parser.enableOptionalNewAndConst = enableOptionalNewAndConst;
CompilationUnit unit = parser.parseCompilationUnit(result.tokens);
unit.lineInfo = LineInfo(result.lineStarts);
@@ -9966,8 +9979,12 @@
ScannerResult result = scanString(content, includeComments: true);
listener.setLineInfo(source, result.lineStarts);
- Parser parser =
- Parser(source, listener, featureSet: FeatureSet.forTesting());
+ Parser parser = Parser(
+ source,
+ listener,
+ languageVersion: null,
+ featureSet: FeatureSet.forTesting(),
+ );
parser.enableOptionalNewAndConst = enableOptionalNewAndConst;
Statement statement = parser.parseStatement(result.tokens);
expect(statement, isNotNull);
@@ -9993,8 +10010,12 @@
ScannerResult result = scanString(content);
listener.setLineInfo(source, result.lineStarts);
- Parser parser =
- Parser(source, listener, featureSet: FeatureSet.forTesting());
+ Parser parser = Parser(
+ source,
+ listener,
+ languageVersion: null,
+ featureSet: FeatureSet.forTesting(),
+ );
parser.enableOptionalNewAndConst = enableOptionalNewAndConst;
List<Statement> statements = parser.parseStatements(result.tokens);
expect(statements, hasLength(expectedCount));
@@ -12390,9 +12411,14 @@
void test_Parser() {
expect(
- Parser(NonExistingSource.unknown, null,
- featureSet: FeatureSet.forTesting()),
- isNotNull);
+ Parser(
+ NonExistingSource.unknown,
+ null,
+ languageVersion: null,
+ featureSet: FeatureSet.forTesting(),
+ ),
+ isNotNull,
+ );
}
void test_skipPrefixedIdentifier_invalid() {
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
index 9e1de0d..013ef08 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -100,17 +100,6 @@
]);
}
- test_awaitForIn_dynamicStream() async {
- await assertErrorsInCode('''
-f() async {
- dynamic stream;
- await for (int i in stream) {}
-}
-''', [
- error(HintCode.UNUSED_LOCAL_VARIABLE, 47, 1),
- ]);
- }
-
test_awaitForIn_dynamicVariable() async {
await assertErrorsInCode('''
import 'dart:async';
@@ -150,17 +139,6 @@
]);
}
- test_awaitForIn_notStream() async {
- await assertErrorsInCode('''
-f() async {
- await for (var i in true) {}
-}
-''', [
- error(HintCode.UNUSED_LOCAL_VARIABLE, 29, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, 34, 4),
- ]);
- }
-
test_awaitForIn_streamOfDynamic() async {
await assertErrorsInCode('''
import 'dart:async';
@@ -338,17 +316,6 @@
]);
}
- test_forIn_notIterable() async {
- await assertErrorsInCode('''
-f() {
- for (var i in true) {}
-}
-''', [
- error(HintCode.UNUSED_LOCAL_VARIABLE, 17, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, 22, 4),
- ]);
- }
-
test_forIn_object() async {
await assertErrorsInCode('''
f() {
@@ -1243,115 +1210,6 @@
error(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, 35, 10),
]);
}
-
- test_yield_async_to_basic_type() async {
- await assertErrorsInCode('''
-int f() async* {
- yield 3;
-}
-''', [
- error(StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, 0, 3),
- error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 25, 1),
- ]);
- }
-
- test_yield_async_to_iterable() async {
- await assertErrorsInCode('''
-Iterable<int> f() async* {
- yield 3;
-}
-''', [
- error(StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, 0, 13),
- error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 35, 1),
- ]);
- }
-
- test_yield_async_to_mistyped_stream() async {
- await assertErrorsInCode('''
-import 'dart:async';
-Stream<int> f() async* {
- yield "foo";
-}
-''', [
- error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 54, 5),
- ]);
- }
-
- test_yield_each_async_non_stream() async {
- await assertErrorsInCode('''
-f() async* {
- yield* 0;
-}
-''', [
- error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 22, 1),
- ]);
- }
-
- test_yield_each_async_to_mistyped_stream() async {
- await assertErrorsInCode('''
-import 'dart:async';
-Stream<int> f() async* {
- yield* g();
-}
-Stream<String> g() => null;
-''', [
- error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 55, 3),
- ]);
- }
-
- test_yield_each_sync_non_iterable() async {
- await assertErrorsInCode('''
-f() sync* {
- yield* 0;
-}
-''', [
- error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 21, 1),
- ]);
- }
-
- test_yield_each_sync_to_mistyped_iterable() async {
- await assertErrorsInCode('''
-Iterable<int> f() sync* {
- yield* g();
-}
-Iterable<String> g() => null;
-''', [
- error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 35, 3),
- ]);
- }
-
- test_yield_sync_to_basic_type() async {
- await assertErrorsInCode('''
-int f() sync* {
- yield 3;
-}
-''', [
- error(StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, 0, 3),
- error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 24, 1),
- ]);
- }
-
- test_yield_sync_to_mistyped_iterable() async {
- await assertErrorsInCode('''
-Iterable<int> f() sync* {
- yield "foo";
-}
-''', [
- error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 34, 5),
- ]);
- }
-
- test_yield_sync_to_stream() async {
- await assertErrorsInCode('''
-import 'dart:async';
-Stream<int> f() sync* {
- yield 3;
-}
-''', [
- error(StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, 21, 11),
- error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 53, 1),
- ]);
- }
}
@reflectiveTest
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index 85fac85..568173f 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -54,7 +54,6 @@
AsserterBuilder<Asserter<DartType>, InterfaceType> _isListOf;
AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, InterfaceType>
_isMapOf;
- AsserterBuilder<List<Asserter<DartType>>, InterfaceType> _isStreamOf;
AsserterBuilder<DartType, DartType> _isType;
AsserterBuilder<Element, DartType> _hasElement;
@@ -97,7 +96,6 @@
_isFutureOfInt = _isFutureOf([_isInt]);
_isFutureOfNull = _isFutureOf([_isNull]);
_isFutureOrOfInt = _isFutureOrOf([_isInt]);
- _isStreamOf = _isInstantiationOf(_hasElement(typeProvider.streamElement));
}
return result;
}
@@ -222,61 +220,6 @@
check("g5", _isFutureOfInt);
}
- test_async_star_method_propagation() async {
- String code = r'''
- import "dart:async";
- class A {
- Stream g0() async* { yield []; }
- Stream g1() async* { yield* new Stream(); }
-
- Stream<List<int>> g2() async* { yield []; }
- Stream<List<int>> g3() async* { yield* new Stream(); }
- }
- ''';
- CompilationUnit unit = await resolveSource(code);
-
- void check(String name, Asserter<InterfaceType> typeTest) {
- MethodDeclaration test = AstFinder.getMethodInClass(unit, "A", name);
- BlockFunctionBody body = test.body;
- YieldStatement stmt = body.block.statements[0];
- Expression exp = stmt.expression;
- typeTest(exp.staticType);
- }
-
- check("g0", _isListOf(_isDynamic));
- check("g1", _isStreamOf([_isDynamic]));
-
- check("g2", _isListOf(_isInt));
- check("g3", _isStreamOf([(DartType type) => _isListOf(_isInt)(type)]));
- }
-
- test_async_star_propagation() async {
- String code = r'''
- import "dart:async";
-
- Stream g0() async* { yield []; }
- Stream g1() async* { yield* new Stream(); }
-
- Stream<List<int>> g2() async* { yield []; }
- Stream<List<int>> g3() async* { yield* new Stream(); }
- ''';
- CompilationUnit unit = await resolveSource(code);
-
- void check(String name, Asserter<InterfaceType> typeTest) {
- FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, name);
- BlockFunctionBody body = test.functionExpression.body;
- YieldStatement stmt = body.block.statements[0];
- Expression exp = stmt.expression;
- typeTest(exp.staticType);
- }
-
- check("g0", _isListOf(_isDynamic));
- check("g1", _isStreamOf([_isDynamic]));
-
- check("g2", _isListOf(_isInt));
- check("g3", _isStreamOf([(DartType type) => _isListOf(_isInt)(type)]));
- }
-
test_cascadeExpression() async {
String code = r'''
class A<T> {
@@ -2425,61 +2368,6 @@
_isListOf(_isString)(exp.staticType);
}
- test_sync_star_method_propagation() async {
- String code = r'''
- import "dart:async";
- class A {
- Iterable f0() sync* { yield []; }
- Iterable f1() sync* { yield* new List(); }
-
- Iterable<List<int>> f2() sync* { yield []; }
- Iterable<List<int>> f3() sync* { yield* new List(); }
- }
- ''';
- CompilationUnit unit = await resolveSource(code);
-
- void check(String name, Asserter<InterfaceType> typeTest) {
- MethodDeclaration test = AstFinder.getMethodInClass(unit, "A", name);
- BlockFunctionBody body = test.body;
- YieldStatement stmt = body.block.statements[0];
- Expression exp = stmt.expression;
- typeTest(exp.staticType);
- }
-
- check("f0", _isListOf(_isDynamic));
- check("f1", _isListOf(_isDynamic));
-
- check("f2", _isListOf(_isInt));
- check("f3", _isListOf((DartType type) => _isListOf(_isInt)(type)));
- }
-
- test_sync_star_propagation() async {
- String code = r'''
- import "dart:async";
-
- Iterable f0() sync* { yield []; }
- Iterable f1() sync* { yield* new List(); }
-
- Iterable<List<int>> f2() sync* { yield []; }
- Iterable<List<int>> f3() sync* { yield* new List(); }
- ''';
- CompilationUnit unit = await resolveSource(code);
-
- void check(String name, Asserter<InterfaceType> typeTest) {
- FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, name);
- BlockFunctionBody body = test.functionExpression.body;
- YieldStatement stmt = body.block.statements[0];
- Expression exp = stmt.expression;
- typeTest(exp.staticType);
- }
-
- check("f0", _isListOf(_isDynamic));
- check("f1", _isListOf(_isDynamic));
-
- check("f2", _isListOf(_isInt));
- check("f3", _isListOf((DartType type) => _isListOf(_isInt)(type)));
- }
-
/// Verifies the source has the expected [errorCodes] as well as the
/// expected [errorMessage].
void _expectInferenceError(
diff --git a/pkg/analyzer/test/generated/utilities_test.dart b/pkg/analyzer/test/generated/utilities_test.dart
index aee51bb..1ece9e3 100644
--- a/pkg/analyzer/test/generated/utilities_test.dart
+++ b/pkg/analyzer/test/generated/utilities_test.dart
@@ -1184,8 +1184,12 @@
Scanner scanner = Scanner(null, reader, listener)
..configureFeatures(featureSet);
Token token = scanner.tokenize();
- Parser parser =
- Parser(NonExistingSource.unknown, listener, featureSet: featureSet);
+ Parser parser = Parser(
+ NonExistingSource.unknown,
+ listener,
+ languageVersion: scanner.languageVersion,
+ featureSet: featureSet,
+ );
CompilationUnit unit = parser.parseCompilationUnit(token);
expect(unit, isNotNull);
listener.assertNoErrors();
diff --git a/pkg/analyzer/test/id_tests/assigned_variables_test.dart b/pkg/analyzer/test/id_tests/assigned_variables_test.dart
index a46ec06..9ac842c 100644
--- a/pkg/analyzer/test/id_tests/assigned_variables_test.dart
+++ b/pkg/analyzer/test/id_tests/assigned_variables_test.dart
@@ -23,7 +23,6 @@
await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
return runTests<_Data>(dataDir,
args: args,
- supportedMarkers: cfeAnalyzerMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(
diff --git a/pkg/analyzer/test/id_tests/constant_test.dart b/pkg/analyzer/test/id_tests/constant_test.dart
index 5ea6df5..e249afe2 100644
--- a/pkg/analyzer/test/id_tests/constant_test.dart
+++ b/pkg/analyzer/test/id_tests/constant_test.dart
@@ -22,7 +22,6 @@
await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
return runTests<String>(dataDir,
args: args,
- supportedMarkers: sharedMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(
diff --git a/pkg/analyzer/test/id_tests/definite_assignment_test.dart b/pkg/analyzer/test/id_tests/definite_assignment_test.dart
index 999e039..929b8df 100644
--- a/pkg/analyzer/test/id_tests/definite_assignment_test.dart
+++ b/pkg/analyzer/test/id_tests/definite_assignment_test.dart
@@ -22,7 +22,6 @@
await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
return runTests<String>(dataDir,
args: args,
- supportedMarkers: cfeAnalyzerMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(
diff --git a/pkg/analyzer/test/id_tests/inheritance_test.dart b/pkg/analyzer/test/id_tests/inheritance_test.dart
new file mode 100644
index 0000000..511d2c9
--- /dev/null
+++ b/pkg/analyzer/test/id_tests/inheritance_test.dart
@@ -0,0 +1,224 @@
+// Copyright (c) 2019, 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 'package:_fe_analyzer_shared/src/testing/id.dart';
+import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/error/error.dart';
+import 'package:analyzer/src/dart/analysis/testing_data.dart';
+import 'package:analyzer/src/util/ast_data_extractor.dart';
+
+import '../util/id_testing_helper.dart';
+
+main(List<String> args) async {
+ Directory dataDir = Directory.fromUri(Platform.script
+ .resolve('../../../_fe_analyzer_shared/test/inheritance/data'));
+ await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
+ return runTests<String>(dataDir,
+ args: args,
+ createUriForFileName: createUriForFileName,
+ onFailure: onFailure,
+ runTest:
+ runTestFor(const _InheritanceDataComputer(), [analyzerNnbdConfig]),
+ skipMap: {
+ analyzerMarker: [
+ // This is a CFE-centric test for an opt-in sdk.
+ 'object_equals',
+ ]
+ });
+ });
+}
+
+class _InheritanceDataComputer extends DataComputer<String> {
+ const _InheritanceDataComputer();
+
+ @override
+ DataInterpreter<String> get dataValidator => const StringDataInterpreter();
+
+ @override
+ void computeUnitData(TestingData testingData, CompilationUnit unit,
+ Map<Id, ActualData<String>> actualMap) {
+ _InheritanceDataExtractor(unit.declaredElement.source.uri, actualMap)
+ .run(unit);
+ }
+
+ @override
+ bool get supportsErrors => true;
+
+ @override
+ String computeErrorData(TestConfig config, TestingData testingData, Id id,
+ List<AnalysisError> errors) {
+ return errors.map((e) => e.errorCode).join(',');
+ }
+}
+
+class _InheritanceDataExtractor extends AstDataExtractor<String> {
+ _InheritanceDataExtractor(Uri uri, Map<Id, ActualData<String>> actualMap)
+ : super(uri, actualMap);
+
+ @override
+ String computeElementValue(Id id, Element element) {
+ if (element is LibraryElement) {
+ return 'nnbd=${element.isNonNullableByDefault}';
+ }
+ return null;
+ }
+
+ @override
+ void computeForClass(Declaration node, Id id) {
+ super.computeForClass(node, id);
+ if (node is ClassDeclaration) {
+ var cls = node.declaredElement;
+
+ var getterNames = <Name>{};
+ var setterNames = <Name>{};
+ var methodNames = <Name>{};
+
+ void collectMembers(InterfaceType type) {
+ for (var element in type.accessors) {
+ if (element.isGetter) {
+ getterNames.add(Name(element));
+ }
+ if (element.isSetter) {
+ setterNames.add(Name(element, isSetter: true));
+ }
+ var getter = element.correspondingGetter;
+ if (getter != null) {
+ getterNames.add(Name(getter));
+ }
+ var setter = element.correspondingSetter;
+ if (setter != null) {
+ setterNames.add(Name(setter, isSetter: true));
+ }
+ }
+ for (var method in type.methods) {
+ methodNames.add(Name(method));
+ }
+ }
+
+ collectMembers(cls.thisType);
+ for (var supertype in cls.allSupertypes) {
+ collectMembers(supertype);
+ }
+
+ void registerMember(
+ MemberId id, int offset, Object object, DartType type) {
+ registerValue(uri, offset, id,
+ type.getDisplayString(withNullability: true), object);
+ }
+
+ for (var getterName in getterNames) {
+ var getter =
+ cls.thisType.lookUpGetter2(getterName.text, getterName.library);
+ if (getter != null) {
+ ClassElement enclosingClass = getter.enclosingElement;
+ if (enclosingClass.isDartCoreObject) continue;
+ var id = MemberId.internal(getterName.text, className: cls.name);
+ var offset =
+ enclosingClass == cls ? getter.nameOffset : cls.nameOffset;
+ registerMember(id, offset, getter, getter.returnType);
+ }
+ }
+
+ for (var setterName in setterNames) {
+ var setter =
+ cls.thisType.lookUpSetter2(setterName.text, setterName.library);
+ if (setter != null) {
+ ClassElement enclosingClass = setter.enclosingElement;
+ if (enclosingClass.isDartCoreObject) continue;
+ var id =
+ MemberId.internal('${setterName.text}=', className: cls.name);
+ var offset =
+ enclosingClass == cls ? setter.nameOffset : cls.nameOffset;
+ registerMember(id, offset, setter, setter.type.parameters.first.type);
+ }
+ }
+
+ for (var methodName in methodNames) {
+ var method =
+ cls.thisType.lookUpMethod2(methodName.text, methodName.library);
+ if (method != null) {
+ ClassElement enclosingClass = method.enclosingElement;
+ if (enclosingClass.isDartCoreObject) continue;
+ var id = MemberId.internal(methodName.text, className: cls.name);
+ var offset =
+ enclosingClass == cls ? method.nameOffset : cls.nameOffset;
+ registerMember(id, offset, method, method.type);
+ }
+ }
+ }
+ }
+
+ @override
+ String computeNodeValue(Id id, AstNode node) {
+ if (node is ClassDeclaration) {
+ var cls = node.declaredElement;
+ var supertypes = <String>[];
+ supertypes.add(supertypeToString(cls.thisType));
+ for (var supertype in cls.allSupertypes) {
+ supertypes.add(supertypeToString(supertype));
+ }
+ supertypes.sort();
+ return supertypes.join(',');
+ }
+ return null;
+ }
+}
+
+String supertypeToString(InterfaceType type) {
+ var sb = StringBuffer();
+ sb.write(type.element.name);
+ if (type.typeArguments.isNotEmpty) {
+ sb.write('<');
+ var comma = '';
+ for (var typeArgument in type.typeArguments) {
+ sb.write(comma);
+ sb.write(typeArgument.getDisplayString(withNullability: true));
+ comma = ', ';
+ }
+ sb.write('>');
+ }
+ return sb.toString();
+}
+
+class Name {
+ final String text;
+ final bool isPrivate;
+ final LibraryElement library;
+
+ Name.internal(this.text, this.isPrivate, this.library);
+
+ factory Name(Element element, {bool isSetter = false}) {
+ String name = element.name;
+ if (isSetter) {
+ if (!name.endsWith('=')) {
+ throw UnsupportedError("Unexpected setter name '$name'");
+ }
+ name = name.substring(0, name.length - 1);
+ }
+ return Name.internal(name, element.isPrivate, element.library);
+ }
+
+ @override
+ int get hashCode => isPrivate
+ ? text.hashCode * 13 + library.hashCode * 17
+ : text.hashCode * 13;
+
+ @override
+ bool operator ==(Object other) {
+ if (identical(this, other)) return true;
+ return other is Name &&
+ text == other.text &&
+ isPrivate == other.isPrivate &&
+ (!isPrivate || library == other.library);
+ }
+
+ @override
+ String toString() => isPrivate ? '${library.name}::$text' : text;
+}
diff --git a/pkg/analyzer/test/id_tests/nullability_test.dart b/pkg/analyzer/test/id_tests/nullability_test.dart
index e15edc8..4d9128a 100644
--- a/pkg/analyzer/test/id_tests/nullability_test.dart
+++ b/pkg/analyzer/test/id_tests/nullability_test.dart
@@ -25,7 +25,6 @@
await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
return runTests<String>(dataDir,
args: args,
- supportedMarkers: cfeAnalyzerMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest:
diff --git a/pkg/analyzer/test/id_tests/reachability_test.dart b/pkg/analyzer/test/id_tests/reachability_test.dart
index 6b85af8..093d824 100644
--- a/pkg/analyzer/test/id_tests/reachability_test.dart
+++ b/pkg/analyzer/test/id_tests/reachability_test.dart
@@ -22,7 +22,6 @@
await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
return runTests<Set<_ReachabilityAssertion>>(dataDir,
args: args,
- supportedMarkers: cfeAnalyzerMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(
diff --git a/pkg/analyzer/test/id_tests/type_promotion_test.dart b/pkg/analyzer/test/id_tests/type_promotion_test.dart
index 617f906..4e7705a 100644
--- a/pkg/analyzer/test/id_tests/type_promotion_test.dart
+++ b/pkg/analyzer/test/id_tests/type_promotion_test.dart
@@ -23,7 +23,6 @@
await NullSafetyUnderstandingFlag.enableNullSafetyTypes(() {
return runTests<DartType>(dataDir,
args: args,
- supportedMarkers: sharedMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 789a977d..1d99fe9 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -1612,6 +1612,19 @@
await driver.getResult(testFile);
}
+ test_getResult_languageVersion() async {
+ var path = convertPath('/test/lib/test.dart');
+ newFile(path, content: r'''
+// @dart = 2.7
+class A{}
+''');
+
+ var result = await driver.getResult(path);
+ var languageVersion = result.unit.languageVersion;
+ expect(languageVersion.major, 2);
+ expect(languageVersion.minor, 7);
+ }
+
test_getResult_mix_fileAndPackageUris() async {
var a = convertPath('/test/bin/a.dart');
var b = convertPath('/test/bin/b.dart');
@@ -2186,6 +2199,31 @@
expect(clazz.name.name, 'A2');
}
+ test_parseFileSync_languageVersion() async {
+ var path = convertPath('/test/lib/test.dart');
+
+ newFile(path, content: r'''
+// @dart = 2.7
+class A {}
+''');
+
+ var parseResult = driver.parseFileSync(path);
+ var languageVersion = parseResult.unit.languageVersion;
+ expect(languageVersion.major, 2);
+ expect(languageVersion.minor, 7);
+ }
+
+ test_parseFileSync_languageVersion_null() async {
+ var path = convertPath('/test/lib/test.dart');
+
+ newFile(path, content: r'''
+class A {}
+''');
+
+ var parseResult = driver.parseFileSync(path);
+ expect(parseResult.unit.languageVersion, isNull);
+ }
+
test_parseFileSync_notAbsolutePath() async {
expect(() {
driver.parseFileSync('not_absolute.dart');
diff --git a/pkg/analyzer/test/src/dart/analysis/feature_set_provider_test.dart b/pkg/analyzer/test/src/dart/analysis/feature_set_provider_test.dart
index 419c32b..7fa6a02 100644
--- a/pkg/analyzer/test/src/dart/analysis/feature_set_provider_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/feature_set_provider_test.dart
@@ -134,7 +134,7 @@
_buildProvider([]);
var featureSet = _getSdkFeatureSet();
- expect(featureSet.isEnabled(Feature.non_nullable), isFalse);
+ expect(featureSet.isEnabled(Feature.non_nullable), isTrue);
}
test_sdk_defaultNonNullable_sdkLegacy() {
@@ -145,7 +145,7 @@
_buildProvider(['non-nullable']);
var featureSet = _getSdkFeatureSet();
- expect(featureSet.isEnabled(Feature.non_nullable), isFalse);
+ expect(featureSet.isEnabled(Feature.non_nullable), isTrue);
}
test_sdk_defaultNonNullable_sdkNonNullable() {
diff --git a/pkg/analyzer/test/src/dart/analysis/index_test.dart b/pkg/analyzer/test/src/dart/analysis/index_test.dart
index 25f93cf..c5bc120 100644
--- a/pkg/analyzer/test/src/dart/analysis/index_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/index_test.dart
@@ -906,6 +906,34 @@
assertThat(element)..isReferencedAt('p: 1', true);
}
+ test_isReferencedBy_ParameterElement_named_ofMethod_genericClass() async {
+ await _indexTestUnit('''
+class A<T> {
+ void foo({T test}) {}
+}
+
+main(A<int> a) {
+ a.foo(test: 0);
+}
+''');
+ Element element = findElement('test');
+ assertThat(element)..isReferencedAt('test: 0', true);
+ }
+
+ test_isReferencedBy_ParameterElement_named_ofConstructor_genericClass() async {
+ await _indexTestUnit('''
+class A<T> {
+ A({T test});
+}
+
+main() {
+ A(test: 0);
+}
+''');
+ Element element = findElement('test');
+ assertThat(element)..isReferencedAt('test: 0', true);
+ }
+
test_isReferencedBy_ParameterElement_genericFunctionType() async {
await _indexTestUnit('''
typedef F = void Function({int p});
diff --git a/pkg/analyzer/test/src/dart/ast/parse_base.dart b/pkg/analyzer/test/src/dart/ast/parse_base.dart
index 107a20e..19ca5e7 100644
--- a/pkg/analyzer/test/src/dart/ast/parse_base.dart
+++ b/pkg/analyzer/test/src/dart/ast/parse_base.dart
@@ -34,8 +34,13 @@
featureSet = scanner.featureSet;
var useFasta = analysisOptions.useFastaParser;
- var parser = Parser(source, errorListener,
- featureSet: featureSet, useFasta: useFasta);
+ var parser = Parser(
+ source,
+ errorListener,
+ languageVersion: scanner.languageVersion,
+ featureSet: featureSet,
+ useFasta: useFasta,
+ );
parser.enableOptionalNewAndConst = true;
var unit = parser.parseCompilationUnit(token);
diff --git a/pkg/analyzer/test/src/dart/micro/file_resolution.dart b/pkg/analyzer/test/src/dart/micro/file_resolution.dart
new file mode 100644
index 0000000..fb0cfd0
--- /dev/null
+++ b/pkg/analyzer/test/src/dart/micro/file_resolution.dart
@@ -0,0 +1,81 @@
+// Copyright (c) 2020, 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:convert';
+
+import 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/dart/analysis/byte_store.dart';
+import 'package:analyzer/src/dart/analysis/performance_logger.dart';
+import 'package:analyzer/src/dart/micro/resolve_file.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/sdk.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/source/package_map_resolver.dart';
+import 'package:analyzer/src/test_utilities/mock_sdk.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
+import 'package:crypto/crypto.dart';
+
+import '../resolution/resolution.dart';
+
+/// [FileResolver] based implementation of [ResolutionTest].
+class FileResolutionTest with ResourceProviderMixin, ResolutionTest {
+ final ByteStore byteStore = MemoryByteStore();
+
+ final StringBuffer logBuffer = StringBuffer();
+ PerformanceLog logger;
+
+ DartSdk sdk;
+ Map<String, List<Folder>> packageMap;
+ FileResolver fileResolver;
+
+ List<MockSdkLibrary> get additionalMockSdkLibraries => [];
+
+ /// Override this to change the analysis options for a given set of tests.
+ AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl();
+
+ @override
+ Future<ResolvedUnitResult> resolveFile(String path) async {
+ return fileResolver.resolve(path);
+ }
+
+ String _getDigest(String path) {
+ var content;
+ try {
+ content = resourceProvider.getFile(path).readAsStringSync();
+ } catch (_) {
+ return '';
+ }
+ var contentBytes = utf8.encode(content);
+ return md5.convert(contentBytes).toString();
+ }
+
+ void setUp() {
+ sdk = MockSdk(
+ resourceProvider: resourceProvider,
+ additionalLibraries: additionalMockSdkLibraries,
+ );
+ logger = PerformanceLog(logBuffer);
+
+ // TODO(brianwilkerson) Create an empty package map by default and only add
+ // packages in the tests that need them.
+ packageMap = <String, List<Folder>>{
+ 'test': [getFolder('/test/lib')],
+ 'aaa': [getFolder('/aaa/lib')],
+ 'bbb': [getFolder('/bbb/lib')],
+ 'meta': [getFolder('/.pub-cache/meta/lib')],
+ };
+
+ fileResolver = FileResolver(
+ logger,
+ resourceProvider,
+ byteStore,
+ SourceFactory([
+ DartUriResolver(sdk),
+ PackageMapUriResolver(resourceProvider, packageMap),
+ ResourceUriResolver(resourceProvider)
+ ]),
+ (String path) => _getDigest(path));
+ }
+}
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
new file mode 100644
index 0000000..d4155ce
--- /dev/null
+++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -0,0 +1,1302 @@
+// Copyright (c) 2020, 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/src/error/codes.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'file_resolution.dart';
+import '../../../generated/resolver_test_case.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(SimpleFileResolverTest);
+ });
+}
+
+@reflectiveTest
+class SimpleFileResolverTest extends FileResolutionTest {
+ test_argumentResolution_required_matching() async {
+ await resolveTestCode(r'''
+class A {
+ void f() {
+ g(1, 2, 3);
+ }
+ void g(a, b, c) {}
+}''');
+ await _validateArgumentResolution([0, 1, 2]);
+ }
+
+ test_argumentResolution_required_tooFew() async {
+ await resolveTestCode(r'''
+class A {
+ void f() {
+ g(1, 2);
+ }
+ void g(a, b, c) {}
+}''');
+ await _validateArgumentResolution([0, 1]);
+ }
+
+ test_argumentResolution_required_tooMany() async {
+ await resolveTestCode(r'''
+class A {
+ void f() {
+ g(1, 2, 3);
+ }
+ void g(a, b) {}
+}''');
+ await _validateArgumentResolution([0, 1, -1]);
+ }
+
+ test_argumentResolution_requiredAndNamed_extra() async {
+ await resolveTestCode('''
+class A {
+ void f() {
+ g(1, 2, c: 3, d: 4);
+ }
+ void g(a, b, {c}) {}
+}''');
+ await _validateArgumentResolution([0, 1, 2, -1]);
+ }
+
+ test_argumentResolution_requiredAndNamed_matching() async {
+ await resolveTestCode(r'''
+class A {
+ void f() {
+ g(1, 2, c: 3);
+ }
+ void g(a, b, {c}) {}
+}''');
+ await _validateArgumentResolution([0, 1, 2]);
+ }
+
+ test_argumentResolution_requiredAndNamed_missing() async {
+ await resolveTestCode('''
+class A {
+ void f() {
+ g(1, 2, d: 3);
+ }
+ void g(a, b, {c, d}) {}
+}''');
+ await _validateArgumentResolution([0, 1, 3]);
+ }
+
+ test_argumentResolution_requiredAndPositional_fewer() async {
+ await resolveTestCode('''
+class A {
+ void f() {
+ g(1, 2, 3);
+ }
+ void g(a, b, [c, d]) {}
+}''');
+ await _validateArgumentResolution([0, 1, 2]);
+ }
+
+ test_argumentResolution_requiredAndPositional_matching() async {
+ await resolveTestCode(r'''
+class A {
+ void f() {
+ g(1, 2, 3, 4);
+ }
+ void g(a, b, [c, d]) {}
+}''');
+ await _validateArgumentResolution([0, 1, 2, 3]);
+ }
+
+ test_argumentResolution_requiredAndPositional_more() async {
+ await resolveTestCode(r'''
+class A {
+ void f() {
+ g(1, 2, 3, 4);
+ }
+ void g(a, b, [c]) {}
+}''');
+ await _validateArgumentResolution([0, 1, 2, -1]);
+ }
+
+ test_argumentResolution_setter_propagated() async {
+ await resolveTestCode(r'''
+main() {
+ var a = new A();
+ a.sss = 0;
+}
+class A {
+ set sss(x) {}
+}''');
+ var rhs = findNode.assignment(' = 0;').rightHandSide;
+ expect(
+ rhs.staticParameterElement,
+ findElement.parameter('x'),
+ );
+ }
+
+ test_argumentResolution_setter_propagated_propertyAccess() async {
+ await resolveTestCode(r'''
+main() {
+ var a = new A();
+ a.b.sss = 0;
+}
+class A {
+ B b = new B();
+}
+class B {
+ set sss(x) {}
+}''');
+ var rhs = findNode.assignment(' = 0;').rightHandSide;
+ expect(
+ rhs.staticParameterElement,
+ findElement.parameter('x'),
+ );
+ }
+
+ test_argumentResolution_setter_static() async {
+ await resolveTestCode(r'''
+main() {
+ A a = new A();
+ a.sss = 0;
+}
+class A {
+ set sss(x) {}
+}''');
+ var rhs = findNode.assignment(' = 0;').rightHandSide;
+ expect(
+ rhs.staticParameterElement,
+ findElement.parameter('x'),
+ );
+ }
+
+ test_argumentResolution_setter_static_propertyAccess() async {
+ await resolveTestCode(r'''
+main() {
+ A a = new A();
+ a.b.sss = 0;
+}
+class A {
+ B b = new B();
+}
+class B {
+ set sss(x) {}
+}''');
+ var rhs = findNode.assignment(' = 0;').rightHandSide;
+ expect(
+ rhs.staticParameterElement,
+ findElement.parameter('x'),
+ );
+ }
+
+ test_breakTarget_labeled() async {
+ // Verify that the target of the label is correctly found and is recorded
+ // as the unlabeled portion of the statement.
+ await resolveTestCode(r'''
+void f() {
+ loop1: while (true) {
+ loop2: for (int i = 0; i < 10; i++) {
+ break loop1;
+ break loop2;
+ }
+ }
+}
+''');
+ var break1 = findNode.breakStatement('break loop1;');
+ var whileStatement = findNode.whileStatement('while (');
+ expect(break1.target, same(whileStatement));
+
+ var break2 = findNode.breakStatement('break loop2;');
+ var forStatement = findNode.forStatement('for (');
+ expect(break2.target, same(forStatement));
+ }
+
+ test_breakTarget_unlabeledBreakFromDo() async {
+ await resolveTestCode('''
+void f() {
+ do {
+ break;
+ } while (true);
+}
+''');
+ var doStatement = findNode.doStatement('do {');
+ var breakStatement = findNode.breakStatement('break;');
+ expect(breakStatement.target, same(doStatement));
+ }
+
+ test_breakTarget_unlabeledBreakFromFor() async {
+ await resolveTestCode(r'''
+void f() {
+ for (int i = 0; i < 10; i++) {
+ break;
+ }
+}
+''');
+ var forStatement = findNode.forStatement('for (');
+ var breakStatement = findNode.breakStatement('break;');
+ expect(breakStatement.target, same(forStatement));
+ }
+
+ test_breakTarget_unlabeledBreakFromForEach() async {
+ await resolveTestCode('''
+void f() {
+ for (x in []) {
+ break;
+ }
+}
+''');
+ var forStatement = findNode.forStatement('for (');
+ var breakStatement = findNode.breakStatement('break;');
+ expect(breakStatement.target, same(forStatement));
+ }
+
+ test_breakTarget_unlabeledBreakFromSwitch() async {
+ await resolveTestCode(r'''
+void f() {
+ while (true) {
+ switch (0) {
+ case 0:
+ break;
+ }
+ }
+}
+''');
+ var switchStatement = findNode.switchStatement('switch (');
+ var breakStatement = findNode.breakStatement('break;');
+ expect(breakStatement.target, same(switchStatement));
+ }
+
+ test_breakTarget_unlabeledBreakFromWhile() async {
+ await resolveTestCode(r'''
+void f() {
+ while (true) {
+ break;
+ }
+}
+''');
+ var whileStatement = findNode.whileStatement('while (');
+ var breakStatement = findNode.breakStatement('break;');
+ expect(breakStatement.target, same(whileStatement));
+ }
+
+ test_breakTarget_unlabeledBreakToOuterFunction() async {
+ // Verify that unlabeled break statements can't resolve to loops in an
+ // outer function.
+ await resolveTestCode(r'''
+void f() {
+ while (true) {
+ void g() {
+ break;
+ }
+ }
+}
+''');
+ var breakStatement = findNode.breakStatement('break;');
+ expect(breakStatement.target, isNull);
+ }
+
+ test_class_definesCall() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ int call(int x) { return x; }
+}
+int f(A a) {
+ return a(0);
+}''');
+ }
+
+ test_class_extends_implements() async {
+ await assertNoErrorsInCode(r'''
+class A extends B implements C {}
+class B {}
+class C {}''');
+ }
+
+ test_continueTarget_labeled() async {
+ // Verify that the target of the label is correctly found and is recorded
+ // as the unlabeled portion of the statement.
+ await resolveTestCode('''
+void f() {
+ loop1: while (true) {
+ loop2: for (int i = 0; i < 10; i++) {
+ continue loop1;
+ continue loop2;
+ }
+ }
+}
+''');
+ var continue1 = findNode.continueStatement('continue loop1');
+ var whileStatement = findNode.whileStatement('while (');
+ expect(continue1.target, same(whileStatement));
+
+ var continue2 = findNode.continueStatement('continue loop2');
+ var forStatement = findNode.forStatement('for (');
+ expect(continue2.target, same(forStatement));
+ }
+
+ test_continueTarget_unlabeledContinueFromDo() async {
+ await resolveTestCode('''
+void f() {
+ do {
+ continue;
+ } while (true);
+}
+''');
+ var doStatement = findNode.doStatement('do {');
+ var continueStatement = findNode.continueStatement('continue;');
+ expect(continueStatement.target, same(doStatement));
+ }
+
+ test_continueTarget_unlabeledContinueFromFor() async {
+ await resolveTestCode('''
+void f() {
+ for (int i = 0; i < 10; i++) {
+ continue;
+ }
+}
+''');
+ var forStatement = findNode.forStatement('for (');
+ var continueStatement = findNode.continueStatement('continue;');
+ expect(continueStatement.target, same(forStatement));
+ }
+
+ test_continueTarget_unlabeledContinueFromForEach() async {
+ await resolveTestCode(r'''
+void f() {
+ for (x in []) {
+ continue;
+ }
+}
+''');
+ var forStatement = findNode.forStatement('for (');
+ var continueStatement = findNode.continueStatement('continue;');
+ expect(continueStatement.target, same(forStatement));
+ }
+
+ test_continueTarget_unlabeledContinueFromWhile() async {
+ await resolveTestCode(r'''
+void f() {
+ while (true) {
+ continue;
+ }
+}
+''');
+ var whileStatement = findNode.whileStatement('while (');
+ var continueStatement = findNode.continueStatement('continue;');
+ expect(continueStatement.target, same(whileStatement));
+ }
+
+ test_continueTarget_unlabeledContinueSkipsSwitch() async {
+ await resolveTestCode(r'''
+void f() {
+ while (true) {
+ switch (0) {
+ case 0:
+ continue;
+ }
+ }
+}
+''');
+ var whileStatement = findNode.whileStatement('while (');
+ var continueStatement = findNode.continueStatement('continue;');
+ expect(continueStatement.target, same(whileStatement));
+ }
+
+ test_continueTarget_unlabeledContinueToOuterFunction() async {
+ // Verify that unlabeled continue statements can't resolve to loops in an
+ // outer function.
+ await resolveTestCode(r'''
+void f() {
+ while (true) {
+ void g() {
+ continue;
+ }
+ }
+}
+''');
+ var continueStatement = findNode.continueStatement('continue;');
+ expect(continueStatement.target, isNull);
+ }
+
+ test_empty() async {
+ await assertNoErrorsInCode('');
+ }
+
+ test_entryPoint_exported() async {
+ newFile('/test/lib/a.dart', content: r'''
+main() {}
+''');
+
+ await assertNoErrorsInCode(r'''
+export 'a.dart';
+''');
+
+ var library = result.libraryElement;
+ var main = library.entryPoint;
+
+ expect(main, isNotNull);
+ expect(main.library, isNot(same(library)));
+ }
+
+ test_entryPoint_local() async {
+ await assertNoErrorsInCode(r'''
+main() {}
+''');
+
+ var library = result.libraryElement;
+ var main = library.entryPoint;
+
+ expect(main, isNotNull);
+ expect(main.library, same(library));
+ }
+
+ test_entryPoint_none() async {
+ await assertNoErrorsInCode('');
+
+ var library = result.libraryElement;
+ expect(library.entryPoint, isNull);
+ }
+
+ test_enum_externalLibrary() async {
+ newFile('/test/lib/a.dart', content: r'''
+enum EEE {A, B, C}
+''');
+ await assertNoErrorsInCode(r'''
+import 'a.dart';
+
+void f(EEE e) {}
+''');
+ verifyTestResolved();
+ }
+
+ test_extractedMethodAsConstant() async {
+ await assertNoErrorsInCode(r'''
+abstract class Comparable<T> {
+ int compareTo(T other);
+ static int compare(Comparable a, Comparable b) => a.compareTo(b);
+}
+class A {
+ void sort([compare = Comparable.compare]) {}
+}''');
+ verifyTestResolved();
+ }
+
+ test_fieldFormalParameter() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ int x;
+ int y;
+ A(this.x) : y = x {}
+}''');
+ verifyTestResolved();
+
+ var xParameter = findNode.fieldFormalParameter('this.x');
+
+ var xParameterElement =
+ xParameter.declaredElement as FieldFormalParameterElement;
+ expect(xParameterElement.field, findElement.field('x'));
+
+ assertElement(
+ findNode.simple('x {}'),
+ xParameterElement,
+ );
+ }
+
+ test_forEachLoops_nonConflicting() async {
+ await assertErrorsInCode(r'''
+f() {
+ List list = [1,2,3];
+ for (int x in list) {}
+ for (int x in list) {}
+}
+''', [
+ error(HintCode.UNUSED_LOCAL_VARIABLE, 40, 1),
+ error(HintCode.UNUSED_LOCAL_VARIABLE, 65, 1),
+ ]);
+ verifyTestResolved();
+ }
+
+ test_forLoops_nonConflicting() async {
+ await assertNoErrorsInCode(r'''
+f() {
+ for (int i = 0; i < 3; i++) {
+ }
+ for (int i = 0; i < 3; i++) {
+ }
+}''');
+ verifyTestResolved();
+ }
+
+ test_functionTypeAlias() async {
+ await assertNoErrorsInCode(r'''
+typedef bool P(e);
+class A {
+ P p;
+ m(e) {
+ if (p(e)) {}
+ }
+}''');
+ verifyTestResolved();
+ }
+
+ test_getter_and_setter_fromMixins_bare_identifier() async {
+ await assertNoErrorsInCode('''
+class B {}
+class M1 {
+ get x => null;
+ set x(value) {}
+}
+class M2 {
+ get x => null;
+ set x(value) {}
+}
+class C extends B with M1, M2 {
+ void f() {
+ x += 1;
+ }
+}
+''');
+ verifyTestResolved();
+
+ // Verify that both the getter and setter for "x" in C.f() refer to the
+ // accessors defined in M2.
+ var leftHandSide = findNode.simple('x +=');
+ expect(
+ leftHandSide.staticElement,
+ findElement.setter('x', of: 'M2'),
+ );
+ expect(
+ leftHandSide.auxiliaryElements.staticElement,
+ findElement.getter('x', of: 'M2'),
+ );
+ }
+
+ test_getter_and_setter_fromMixins_property_access() async {
+ await assertNoErrorsInCode(r'''
+class B {}
+class M1 {
+ get x => null;
+ set x(value) {}
+}
+class M2 {
+ get x => null;
+ set x(value) {}
+}
+class C extends B with M1, M2 {}
+void main() {
+ new C().x += 1;
+}
+''');
+ verifyTestResolved();
+
+ // Verify that both the getter and setter for "x" in "new C().x" refer to
+ // the accessors defined in M2.
+ var leftHandSide = findNode.simple('x +=');
+ expect(
+ leftHandSide.staticElement,
+ findElement.setter('x', of: 'M2'),
+ );
+ expect(
+ leftHandSide.auxiliaryElements.staticElement,
+ findElement.getter('x', of: 'M2'),
+ );
+ }
+
+ test_getter_fromMixins_bare_identifier() async {
+ await assertNoErrorsInCode('''
+class B {}
+class M1 {
+ get x => null;
+}
+class M2 {
+ get x => null;
+}
+class C extends B with M1, M2 {
+ f() {
+ return x;
+ }
+}
+''');
+ verifyTestResolved();
+
+ // Verify that the getter for "x" in C.f() refers to the getter defined in
+ // M2.
+ expect(
+ findNode.simple('x;').staticElement,
+ findElement.getter('x', of: 'M2'),
+ );
+ }
+
+ test_getter_fromMixins_property_access() async {
+ await assertErrorsInCode('''
+class B {}
+class M1 {
+ get x => null;
+}
+class M2 {
+ get x => null;
+}
+class C extends B with M1, M2 {}
+void main() {
+ var y = new C().x;
+}
+''', [
+ error(HintCode.UNUSED_LOCAL_VARIABLE, 124, 1),
+ ]);
+ verifyTestResolved();
+
+ // Verify that the getter for "x" in "new C().x" refers to the getter
+ // defined in M2.
+ expect(
+ findNode.simple('x;').staticElement,
+ findElement.getter('x', of: 'M2'),
+ );
+ }
+
+ test_hasReferenceToSuper() async {
+ await assertNoErrorsInCode(r'''
+class A {}
+class B {toString() => super.toString();}''');
+ verifyTestResolved();
+
+ var a = findElement.class_('A');
+ expect(a.hasReferenceToSuper, isFalse);
+
+ var b = findElement.class_('B');
+ expect(b.hasReferenceToSuper, isTrue);
+ }
+
+ test_import_hide() async {
+ newFile('/test/lib/lib1.dart', content: r'''
+set foo(value) {}
+class A {}''');
+
+ newFile('/test/lib/lib2.dart', content: r'''
+set foo(value) {}''');
+
+ await assertNoErrorsInCode(r'''
+import 'lib1.dart' hide foo;
+import 'lib2.dart';
+
+main() {
+ foo = 0;
+}
+A a;''');
+ verifyTestResolved();
+ }
+
+ test_import_prefix() async {
+ newFile('/test/lib/a.dart', content: r'''
+f(int x) {
+ return x * x;
+}''');
+
+ await assertNoErrorsInCode(r'''
+import 'a.dart' as _a;
+main() {
+ _a.f(0);
+}''');
+ verifyTestResolved();
+ }
+
+ test_import_prefix_doesNotExist() async {
+ //
+ // The primary purpose of this test is to ensure that we are only getting a
+ // single error generated when the only problem is that an imported file
+ // does not exist.
+ //
+ await assertErrorsInCode('''
+import 'missing.dart' as p;
+int a = p.q + p.r.s;
+String b = p.t(a) + p.u(v: 0);
+p.T c = new p.T();
+class D<E> extends p.T {
+ D(int i) : super(i);
+ p.U f = new p.V();
+}
+class F implements p.T {
+ p.T m(p.U u) => null;
+}
+class G extends Object with p.V {}
+class H extends D<p.W> {
+ H(int i) : super(i);
+}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 14),
+ ]);
+ verifyTestResolved();
+ }
+
+ test_import_show_doesNotExist() async {
+ //
+ // The primary purpose of this test is to ensure that we are only getting a
+ // single error generated when the only problem is that an imported file
+ // does not exist.
+ //
+ await assertErrorsInCode('''
+import 'missing.dart' show q, r, t, u, T, U, V, W;
+int a = q + r.s;
+String b = t(a) + u(v: 0);
+T c = new T();
+class D<E> extends T {
+ D(int i) : super(i);
+ U f = new V();
+}
+class F implements T {
+ T m(U u) => null;
+}
+class G extends Object with V {}
+class H extends D<W> {
+ H(int i) : super(i);
+}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 14),
+ ]);
+ }
+
+ @failingTest
+ test_import_spaceInUri() async {
+ // TODO(scheglov) Fix this. The problem is in `package` URI resolver.
+ newFile('/test/lib/sub folder/a.dart', content: r'''
+foo() {}''');
+
+ await assertNoErrorsInCode(r'''
+import 'sub folder/a.dart';
+
+main() {
+ foo();
+}''');
+ verifyTestResolved();
+ }
+
+ test_indexExpression_typeParameters() async {
+ await assertNoErrorsInCode(r'''
+f() {
+ List<int> a;
+ a[0];
+ List<List<int>> b;
+ b[0][0];
+ List<List<List<int>>> c;
+ c[0][0][0];
+}''');
+ verifyTestResolved();
+ }
+
+ test_indexExpression_typeParameters_invalidAssignmentWarning() async {
+ await assertErrorsInCode(r'''
+f() {
+ List<List<int>> b;
+ b[0][0] = 'hi';
+}''', [
+ error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 39, 4),
+ ]);
+ verifyTestResolved();
+ }
+
+ test_indirectOperatorThroughCall() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ B call() { return new B(); }
+}
+
+class B {
+ int operator [](int i) { return i; }
+}
+
+A f = new A();
+
+g(int x) {}
+
+main() {
+ g(f()[0]);
+}''');
+ verifyTestResolved();
+ }
+
+ test_invoke_dynamicThroughGetter() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ List get X => [() => 0];
+ m(A a) {
+ X.last;
+ }
+}''');
+ verifyTestResolved();
+ }
+
+ test_isValidMixin_badSuperclass() async {
+ await assertErrorsInCode(r'''
+class A extends B {}
+class B {}
+class C = Object with A;''', [
+ error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 54, 1),
+ ]);
+ verifyTestResolved();
+
+ var a = findElement.class_('A');
+ expect(a.isValidMixin, isFalse);
+ }
+
+ test_isValidMixin_constructor() async {
+ await assertErrorsInCode(r'''
+class A {
+ A() {}
+}
+class C = Object with A;''', [
+ error(CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR, 43, 1),
+ ]);
+ verifyTestResolved();
+
+ var a = findElement.class_('A');
+ expect(a.isValidMixin, isFalse);
+ }
+
+ test_isValidMixin_factoryConstructor() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ factory A() => throw 0;
+}
+class C = Object with A;''');
+ verifyTestResolved();
+
+ var a = findElement.class_('A');
+ expect(a.isValidMixin, isTrue);
+ }
+
+ test_isValidMixin_super() async {
+ await assertErrorsInCode(r'''
+class A {
+ toString() {
+ return super.toString();
+ }
+}
+class C = Object with A;''', [
+ error(CompileTimeErrorCode.MIXIN_REFERENCES_SUPER, 82, 1),
+ ]);
+ verifyTestResolved();
+
+ var a = findElement.class_('A');
+ expect(a.isValidMixin, isFalse);
+ }
+
+ test_isValidMixin_valid() async {
+ await assertNoErrorsInCode('''
+class A {}
+class C = Object with A;''');
+ verifyTestResolved();
+
+ var a = findElement.class_('A');
+ expect(a.isValidMixin, isTrue);
+ }
+
+ test_labels_switch() async {
+ await assertNoErrorsInCode(r'''
+void doSwitch(int target) {
+ switch (target) {
+ l0: case 0:
+ continue l1;
+ l1: case 1:
+ continue l0;
+ default:
+ continue l1;
+ }
+}''');
+ verifyTestResolved();
+ }
+
+ test_localVariable_types_invoked() async {
+ await resolveTestCode(r'''
+const A = null;
+main() {
+ var myVar = (int p) => 'foo';
+ myVar(42);
+}''');
+ var node = findNode.simple('myVar(42)');
+ assertType(node, 'String Function(int)');
+ }
+
+ test_metadata_class() async {
+ await assertNoErrorsInCode(r'''
+const A = null;
+@A class C<A> {}''');
+ verifyTestResolved();
+
+ var annotations = findElement.class_('C').metadata;
+ expect(annotations, hasLength(1));
+
+ var cDeclaration = findNode.classDeclaration('C<A>');
+ assertElement(
+ cDeclaration.metadata[0].name,
+ findElement.topGet('A'),
+ );
+ }
+
+ test_metadata_field() async {
+ await assertNoErrorsInCode(r'''
+const A = null;
+class C {
+ @A int f;
+}''');
+ verifyTestResolved();
+
+ var metadata = findElement.field('f').metadata;
+ expect(metadata, hasLength(1));
+ }
+
+ test_metadata_fieldFormalParameter() async {
+ await assertNoErrorsInCode(r'''
+const A = null;
+class C {
+ int f;
+ C(@A this.f);
+}''');
+ verifyTestResolved();
+
+ var metadata = findElement.fieldFormalParameter('f').metadata;
+ expect(metadata, hasLength(1));
+ }
+
+ test_metadata_function() async {
+ await assertNoErrorsInCode(r'''
+const A = null;
+@A f() {}''');
+ verifyTestResolved();
+
+ var annotations = findElement.topFunction('f').metadata;
+ expect(annotations, hasLength(1));
+ }
+
+ test_metadata_functionTypedParameter() async {
+ await assertNoErrorsInCode(r'''
+const A = null;
+f(@A int p(int x)) {}''');
+ verifyTestResolved();
+
+ var metadata = findElement.parameter('p').metadata;
+ expect(metadata, hasLength(1));
+ }
+
+ test_metadata_libraryDirective() async {
+ await assertNoErrorsInCode(r'''
+@A library lib;
+const A = null;''');
+ verifyTestResolved();
+
+ var metadata = result.libraryElement.metadata;
+ expect(metadata, hasLength(1));
+ }
+
+ test_metadata_method() async {
+ await assertNoErrorsInCode(r'''
+const A = null;
+class C {
+ @A void m() {}
+}''');
+ verifyTestResolved();
+
+ var metadata = findElement.method('m').metadata;
+ expect(metadata, hasLength(1));
+ }
+
+ test_metadata_namedParameter() async {
+ await assertNoErrorsInCode(r'''
+const A = null;
+f({@A int p : 0}) {}''');
+ verifyTestResolved();
+
+ var metadata = findElement.parameter('p').metadata;
+ expect(metadata, hasLength(1));
+ }
+
+ test_metadata_positionalParameter() async {
+ await assertNoErrorsInCode(r'''
+const A = null;
+f([@A int p = 0]) {}''');
+ verifyTestResolved();
+
+ var metadata = findElement.parameter('p').metadata;
+ expect(metadata, hasLength(1));
+ }
+
+ test_metadata_simpleParameter() async {
+ await assertNoErrorsInCode(r'''
+const A = null;
+f(@A p1, @A int p2) {}''');
+ verifyTestResolved();
+
+ expect(findElement.parameter('p1').metadata, hasLength(1));
+ expect(findElement.parameter('p2').metadata, hasLength(1));
+ }
+
+ test_metadata_typedef() async {
+ await assertNoErrorsInCode(r'''
+const A = null;
+@A typedef F<A>();''');
+ verifyTestResolved();
+
+ expect(
+ findElement.functionTypeAlias('F').metadata,
+ hasLength(1),
+ );
+
+ var actualElement = findNode.annotation('@A').name.staticElement;
+ expect(actualElement, findElement.topGet('A'));
+ }
+
+ test_method_fromMixin() async {
+ await assertNoErrorsInCode(r'''
+class B {
+ bar() => 1;
+}
+class A {
+ foo() => 2;
+}
+
+class C extends B with A {
+ bar() => super.bar();
+ foo() => super.foo();
+}''');
+ verifyTestResolved();
+ }
+
+ test_method_fromMixins() async {
+ await assertNoErrorsInCode('''
+class B {}
+class M1 {
+ void f() {}
+}
+class M2 {
+ void f() {}
+}
+class C extends B with M1, M2 {}
+void main() {
+ new C().f();
+}
+''');
+ verifyTestResolved();
+
+ expect(
+ findNode.simple('f();').staticElement,
+ findElement.method('f', of: 'M2'),
+ );
+ }
+
+ test_method_fromMixins_bare_identifier() async {
+ await assertNoErrorsInCode('''
+class B {}
+class M1 {
+ void f() {}
+}
+class M2 {
+ void f() {}
+}
+class C extends B with M1, M2 {
+ void g() {
+ f();
+ }
+}
+''');
+ verifyTestResolved();
+
+ expect(
+ findNode.simple('f();').staticElement,
+ findElement.method('f', of: 'M2'),
+ );
+ }
+
+ test_method_fromMixins_invoked_from_outside_class() async {
+ await assertNoErrorsInCode('''
+class B {}
+class M1 {
+ void f() {}
+}
+class M2 {
+ void f() {}
+}
+class C extends B with M1, M2 {}
+void main() {
+ new C().f();
+}
+''');
+ verifyTestResolved();
+
+ expect(
+ findNode.simple('f();').staticElement,
+ findElement.method('f', of: 'M2'),
+ );
+ }
+
+ test_method_fromSuperclassMixin() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ void m1() {}
+}
+class B extends Object with A {
+}
+class C extends B {
+}
+f(C c) {
+ c.m1();
+}''');
+ verifyTestResolved();
+ }
+
+ test_methodCascades() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ void m1() {}
+ void m2() {}
+ void m() {
+ A a = new A();
+ a..m1()
+ ..m2();
+ }
+}''');
+ verifyTestResolved();
+ }
+
+ test_methodCascades_withSetter() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ String name;
+ void m1() {}
+ void m2() {}
+ void m() {
+ A a = new A();
+ a..m1()
+ ..name = 'name'
+ ..m2();
+ }
+}''');
+ verifyTestResolved();
+ }
+
+ test_resolveAgainstNull() async {
+ await assertNoErrorsInCode(r'''
+f(var p) {
+ return null == p;
+}''');
+ verifyTestResolved();
+ }
+
+ test_setter_fromMixins_bare_identifier() async {
+ await resolveTestCode('''
+class B {}assertNoErrorsInCode
+class M1 {
+ set x(value) {}
+}
+class M2 {
+ set x(value) {}
+}
+class C extends B with M1, M2 {
+ void f() {
+ x = 1;
+ }
+}
+''');
+ verifyTestResolved();
+
+ expect(
+ findNode.simple('x = ').staticElement,
+ findElement.setter('x', of: 'M2'),
+ );
+ }
+
+ test_setter_fromMixins_property_access() async {
+ await assertNoErrorsInCode('''
+class B {}
+class M1 {
+ set x(value) {}
+}
+class M2 {
+ set x(value) {}
+}
+class C extends B with M1, M2 {}
+void main() {
+ new C().x = 1;
+}
+''');
+ verifyTestResolved();
+
+ expect(
+ findNode.simple('x = ').staticElement,
+ findElement.setter('x', of: 'M2'),
+ );
+ }
+
+ test_setter_inherited() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ int get x => 0;
+ set x(int p) {}
+}
+class B extends A {
+ int get x => super.x == null ? 0 : super.x;
+ int f() => x = 1;
+}''');
+ verifyTestResolved();
+ }
+
+ test_setter_static() async {
+ await assertNoErrorsInCode(r'''
+set s(x) {
+}
+
+main() {
+ s = 123;
+}''');
+ verifyTestResolved();
+ }
+
+ /**
+ * Verify that all of the identifiers in the [result] have been resolved.
+ */
+ void verifyTestResolved() {
+ var verifier = ResolutionVerifier();
+ result.unit.accept(verifier);
+ verifier.assertResolved();
+ }
+
+ /**
+ * Resolve the test file and verify that the arguments in a specific method
+ * invocation were correctly resolved.
+ *
+ * The file is expected to define a method named `g`, and has exactly one
+ * [MethodInvocation] in a statement ending with `);`. It is the arguments to
+ * that method invocation that are tested. The method invocation can contain
+ * errors.
+ *
+ * The arguments were resolved correctly if the number of expressions in the list matches the
+ * length of the array of indices and if, for each index in the array of indices, the parameter to
+ * which the argument expression was resolved is the parameter in the invoked method's list of
+ * parameters at that index. Arguments that should not be resolved to a parameter because of an
+ * error can be denoted by including a negative index in the array of indices.
+ *
+ * @param indices the array of indices used to associate arguments with parameters
+ * @throws Exception if the source could not be resolved or if the structure of the source is not
+ * valid
+ */
+ Future<void> _validateArgumentResolution(List<int> indices) async {
+ var g = findElement.method('g');
+ var parameters = g.parameters;
+
+ var invocation = findNode.methodInvocation(');');
+
+ var arguments = invocation.argumentList.arguments;
+
+ var argumentCount = arguments.length;
+ expect(argumentCount, indices.length);
+
+ for (var i = 0; i < argumentCount; i++) {
+ var argument = arguments[i];
+ var actualParameter = argument.staticParameterElement;
+
+ var index = indices[i];
+ if (index < 0) {
+ expect(actualParameter, isNull);
+ } else {
+ var expectedParameter = parameters[index];
+ expect(actualParameter, same(expectedParameter));
+ }
+ }
+ }
+}
diff --git a/pkg/analyzer/test/src/dart/micro/test_all.dart b/pkg/analyzer/test/src/dart/micro/test_all.dart
new file mode 100644
index 0000000..b70019e
--- /dev/null
+++ b/pkg/analyzer/test/src/dart/micro/test_all.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2020, 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:test_reflective_loader/test_reflective_loader.dart';
+
+import 'simple_file_resolver_test.dart' as simple_file_resolver_test;
+
+main() {
+ defineReflectiveSuite(() {
+ simple_file_resolver_test.main();
+ }, name: 'micro');
+}
diff --git a/pkg/analyzer/test/src/dart/resolution/resolution.dart b/pkg/analyzer/test/src/dart/resolution/resolution.dart
index 6baf12f..be19ec4 100644
--- a/pkg/analyzer/test/src/dart/resolution/resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/resolution.dart
@@ -662,6 +662,17 @@
messageContains: messageContains,
expectedContextMessages: contextMessages);
+ List<ExpectedError> expectedErrorsByNullability({
+ @required List<ExpectedError> nullable,
+ @required List<ExpectedError> legacy,
+ }) {
+ if (typeToStringWithNullability) {
+ return nullable;
+ } else {
+ return legacy;
+ }
+ }
+
AuxiliaryElements getNodeAuxElements(AstNode node) {
if (node is IndexExpression) {
return node.auxiliaryElements;
@@ -739,6 +750,17 @@
String typeString(DartType type) =>
type.getDisplayString(withNullability: typeToStringWithNullability);
+ String typeStringByNullability({
+ @required String nullable,
+ @required String legacy,
+ }) {
+ if (typeToStringWithNullability) {
+ return nullable;
+ } else {
+ return legacy;
+ }
+ }
+
_ElementMatcher _elementMatcher(Object elementOrMatcher) {
if (elementOrMatcher is Element) {
return _ElementMatcher(this, declaration: elementOrMatcher);
diff --git a/pkg/analyzer/test/src/dart/resolution/test_all.dart b/pkg/analyzer/test/src/dart/resolution/test_all.dart
index 4fb7da7..91f8c97 100644
--- a/pkg/analyzer/test/src/dart/resolution/test_all.dart
+++ b/pkg/analyzer/test/src/dart/resolution/test_all.dart
@@ -50,6 +50,7 @@
import 'top_type_inference_test.dart' as top_type_inference;
import 'type_inference/test_all.dart' as type_inference;
import 'type_name_test.dart' as type_name;
+import 'yield_statement_test.dart' as yield_statement;
main() {
defineReflectiveSuite(() {
@@ -96,5 +97,6 @@
top_type_inference.main();
type_name.main();
type_inference.main();
+ yield_statement.main();
}, name: 'resolution');
}
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart
index 79769e0..b00bbab 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart
@@ -5,10 +5,8 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
-import 'package:meta/meta.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import '../../../../generated/test_support.dart';
import '../driver_resolution.dart';
main() {
@@ -20,17 +18,6 @@
@reflectiveTest
class FunctionExpressionTest extends DriverResolutionTest {
- List<ExpectedError> expectedErrorsByNullability({
- @required List<ExpectedError> nullable,
- @required List<ExpectedError> legacy,
- }) {
- if (typeToStringWithNullability) {
- return nullable;
- } else {
- return legacy;
- }
- }
-
test_downward_argumentType_Never() async {
await assertNoErrorsInCode(r'''
void foo(void Function(Never) a) {}
@@ -213,17 +200,6 @@
var element = findNode.functionExpression('() =>').declaredElement;
assertType(element.returnType, 'Null');
}
-
- String typeStringByNullability({
- @required String nullable,
- @required String legacy,
- }) {
- if (typeToStringWithNullability) {
- return nullable;
- } else {
- return legacy;
- }
- }
}
@reflectiveTest
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
index 6997b23..08ba80b 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
@@ -258,7 +258,13 @@
var a = [1, ...?await futureNull, 2];
}
''');
- assertType(findNode.listLiteral('['), 'List<int>');
+ assertType(
+ findNode.listLiteral('['),
+ typeStringByNullability(
+ nullable: 'List<int?>',
+ legacy: 'List<int>',
+ ),
+ );
}
test_noContext_noTypeArgs_spread_nullAware_onlyNull() async {
@@ -302,7 +308,7 @@
}
@reflectiveTest
-class ListLiteralWithNnbdTest extends DriverResolutionTest {
+class ListLiteralWithNnbdTest extends ListLiteralTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/local_variable_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/local_variable_test.dart
new file mode 100644
index 0000000..89060e8
--- /dev/null
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/local_variable_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2020, 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/type.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../driver_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(LocalVariableTest);
+ });
+}
+
+@reflectiveTest
+class LocalVariableTest extends DriverResolutionTest {
+ void assertPromotedBound(DartType type, Matcher promotedBound) {
+ if (type is TypeParameterTypeImpl) {
+ expect(type.promotedBound, promotedBound);
+ }
+ }
+
+ test_demoteTypeParameterType() async {
+ await assertNoErrorsInCode('''
+void f<T>(T a, T b) {
+ if (a is String) {
+ var o = a;
+ o = b;
+ o; // ref
+ }
+}
+''');
+
+ var type = findNode.simple('o; // ref').staticType;
+ assertType(type, 'T');
+ assertPromotedBound(type, isNull);
+ }
+}
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
index b257ea5..023d13e 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
@@ -271,7 +271,13 @@
a;
}
''');
- assertType(setOrMapLiteral('{1'), 'Map<int, String>');
+ assertType(
+ setOrMapLiteral('{1'),
+ typeStringByNullability(
+ nullable: 'Map<int?, String?>',
+ legacy: 'Map<int, String>',
+ ),
+ );
}
test_noContext_noTypeArgs_spread_nullAware_nullAndNotNull_set() async {
@@ -282,7 +288,13 @@
a;
}
''');
- assertType(setOrMapLiteral('{1'), 'Set<int>');
+ assertType(
+ setOrMapLiteral('{1'),
+ typeStringByNullability(
+ nullable: 'Set<int?>',
+ legacy: 'Set<int>',
+ ),
+ );
}
test_noContext_noTypeArgs_spread_nullAware_onlyNull() async {
@@ -343,7 +355,7 @@
}
@reflectiveTest
-class MapLiteralWithNnbdTest extends DriverResolutionTest {
+class MapLiteralWithNnbdTest extends MapLiteralTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
@@ -353,15 +365,6 @@
@override
bool get typeToStringWithNullability => true;
- AstNode setOrMapLiteral(String search) => findNode.setOrMapLiteral(search);
-
- test_context_noTypeArgs_noEntries() async {
- await resolveTestCode('''
-Map<String, String> a = {};
-''');
- assertType(setOrMapLiteral('{'), 'Map<String, String>');
- }
-
test_context_noTypeArgs_noEntries_typeParameterNullable() async {
await resolveTestCode('''
class C<T extends Object?> {
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/set_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/set_literal_test.dart
index 35b910e..dc673a4 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/set_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/set_literal_test.dart
@@ -267,7 +267,7 @@
}
@reflectiveTest
-class SetLiteralWithNnbdTest extends DriverResolutionTest {
+class SetLiteralWithNnbdTest extends SetLiteralTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/test_all.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/test_all.dart
index 8262958..a998d76 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/test_all.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/test_all.dart
@@ -10,6 +10,7 @@
import 'extension_methods_test.dart' as extension_methods;
import 'function_expression_test.dart' as function_expression;
import 'list_literal_test.dart' as list_literal;
+import 'local_variable_test.dart' as local_variable;
import 'logical_boolean_expressions_test.dart' as logical_boolean_expressions;
import 'map_literal_test.dart' as map_literal;
import 'set_literal_test.dart' as set_literal;
@@ -26,6 +27,7 @@
extension_methods.main();
function_expression.main();
list_literal.main();
+ local_variable.main();
logical_boolean_expressions.main();
map_literal.main();
set_literal.main();
diff --git a/pkg/analyzer/test/src/dart/resolution/type_name_test.dart b/pkg/analyzer/test/src/dart/resolution/type_name_test.dart
index c1a4cf0..6c54c0b 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_name_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_name_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/test_utilities/find_element.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -133,6 +134,57 @@
);
}
+ test_instanceCreation_explicitNew_prefix_unresolvedClass() async {
+ await assertErrorsInCode(r'''
+import 'dart:math' as math;
+
+main() {
+ new math.A();
+}
+''', [
+ error(StaticWarningCode.NEW_WITH_NON_TYPE, 49, 1),
+ ]);
+
+ assertTypeName(
+ findNode.typeName('A();'),
+ null,
+ 'dynamic',
+ expectedPrefix: findElement.prefix('math'),
+ );
+ }
+
+ test_instanceCreation_explicitNew_resolvedClass() async {
+ await assertNoErrorsInCode(r'''
+class A {}
+
+main() {
+ new A();
+}
+''');
+
+ assertTypeName(
+ findNode.typeName('A();'),
+ findElement.class_('A'),
+ typeStr('A', 'A*'),
+ );
+ }
+
+ test_instanceCreation_explicitNew_unresolvedClass() async {
+ await assertErrorsInCode(r'''
+main() {
+ new A();
+}
+''', [
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 15, 1),
+ ]);
+
+ assertTypeName(
+ findNode.typeName('A();'),
+ null,
+ 'dynamic',
+ );
+ }
+
test_never() async {
await assertNoErrorsInCode(r'''
f(Never a) {}
diff --git a/pkg/analyzer/test/src/dart/resolution/yield_statement_test.dart b/pkg/analyzer/test/src/dart/resolution/yield_statement_test.dart
new file mode 100644
index 0000000..b0c5179
--- /dev/null
+++ b/pkg/analyzer/test/src/dart/resolution/yield_statement_test.dart
@@ -0,0 +1,248 @@
+// Copyright (c) 2020, 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:test_reflective_loader/test_reflective_loader.dart';
+
+import 'driver_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(YieldStatementResolutionTest);
+ });
+}
+
+@reflectiveTest
+class YieldStatementResolutionTest extends DriverResolutionTest {
+ @override
+ setUp() {
+ super.setUp();
+
+ newFile('/test/lib/my_stream.dart', content: r'''
+import 'dart:async';
+
+export 'dart:async';
+
+class MyStream<T> implements Stream<T> {
+ @override
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
+''');
+ }
+
+ test_downInference_function_asyncStar() async {
+ await assertNoErrorsInCode(r'''
+import 'my_stream.dart';
+
+Stream f1() async* {
+ yield []; // 1
+ yield* MyStream(); // 2
+}
+
+Stream<List<int>> f2() async* {
+ yield []; // 3
+ yield* MyStream(); // 4
+}
+''');
+ assertType(
+ findNode.listLiteral('[]; // 1'),
+ 'List<dynamic>',
+ );
+
+ assertType(
+ findNode.instanceCreation('MyStream(); // 2'),
+ 'MyStream<dynamic>',
+ );
+
+ assertType(
+ findNode.listLiteral('[]; // 3'),
+ 'List<int>',
+ );
+
+ assertType(
+ findNode.instanceCreation('MyStream(); // 4'),
+ 'MyStream<List<int>>',
+ );
+ }
+
+ test_downInference_function_syncStar() async {
+ await assertNoErrorsInCode(r'''
+Iterable f1() sync* {
+ yield []; // 1
+ yield* List(); // 2
+}
+
+Iterable<List<int>> f2() sync* {
+ yield []; // 3
+ yield* List(); // 4
+}
+''');
+ assertType(
+ findNode.listLiteral('[]; // 1'),
+ 'List<dynamic>',
+ );
+
+ assertType(
+ findNode.instanceCreation('List(); // 2'),
+ 'List<dynamic>',
+ );
+
+ assertType(
+ findNode.listLiteral('[]; // 3'),
+ 'List<int>',
+ );
+
+ assertType(
+ findNode.instanceCreation('List(); // 4'),
+ 'List<List<int>>',
+ );
+ }
+
+ test_downInference_functionExpression_asyncStar() async {
+ await assertNoErrorsInCode(r'''
+import 'my_stream.dart';
+
+main() {
+ Stream Function() f1 = () async* {
+ yield []; // 1
+ yield* MyStream(); // 2
+ };
+ f1;
+
+ Stream<List<int>> Function() f2 = () async* {
+ yield []; // 3
+ yield* MyStream(); // 4
+ };
+ f2;
+}
+''');
+ assertType(
+ findNode.listLiteral('[]; // 1'),
+ 'List<dynamic>',
+ );
+
+ assertType(
+ findNode.instanceCreation('MyStream(); // 2'),
+ 'MyStream<dynamic>',
+ );
+
+ assertType(
+ findNode.listLiteral('[]; // 3'),
+ 'List<int>',
+ );
+
+ assertType(
+ findNode.instanceCreation('MyStream(); // 4'),
+ 'MyStream<List<int>>',
+ );
+ }
+
+ test_downInference_functionExpression_syncStar() async {
+ await assertNoErrorsInCode(r'''
+main() {
+ Iterable Function() f1 = () sync* {
+ yield []; // 1
+ yield* List(); // 2
+ };
+ f1;
+
+ Iterable<List<int>> Function() f2 = () sync* {
+ yield []; // 3
+ yield* List(); // 4
+ };
+ f2;
+}
+''');
+ assertType(
+ findNode.listLiteral('[]; // 1'),
+ 'List<dynamic>',
+ );
+
+ assertType(
+ findNode.instanceCreation('List(); // 2'),
+ 'List<dynamic>',
+ );
+
+ assertType(
+ findNode.listLiteral('[]; // 3'),
+ 'List<int>',
+ );
+
+ assertType(
+ findNode.instanceCreation('List(); // 4'),
+ 'List<List<int>>',
+ );
+ }
+
+ test_downInference_method_asyncStar() async {
+ await assertNoErrorsInCode(r'''
+import 'my_stream.dart';
+
+class A {
+ Stream m1() async* {
+ yield []; // 1
+ yield* MyStream(); // 2
+ }
+
+ Stream<List<int>> m2() async* {
+ yield []; // 3
+ yield* MyStream(); // 4
+ }
+}
+''');
+ assertType(
+ findNode.listLiteral('[]; // 1'),
+ 'List<dynamic>',
+ );
+
+ assertType(
+ findNode.instanceCreation('MyStream(); // 2'),
+ 'MyStream<dynamic>',
+ );
+
+ assertType(
+ findNode.listLiteral('[]; // 3'),
+ 'List<int>',
+ );
+
+ assertType(
+ findNode.instanceCreation('MyStream(); // 4'),
+ 'MyStream<List<int>>',
+ );
+ }
+
+ test_downInference_method_syncStar() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ Iterable m1() sync* {
+ yield []; // 1
+ yield* List(); // 2
+ }
+
+ Iterable<List<int>> m2() sync* {
+ yield []; // 3
+ yield* List(); // 4
+ }
+}
+''');
+ assertType(
+ findNode.listLiteral('[]; // 1'),
+ 'List<dynamic>',
+ );
+
+ assertType(
+ findNode.instanceCreation('List(); // 2'),
+ 'List<dynamic>',
+ );
+
+ assertType(
+ findNode.listLiteral('[]; // 3'),
+ 'List<int>',
+ );
+
+ assertType(
+ findNode.instanceCreation('List(); // 4'),
+ 'List<List<int>>',
+ );
+ }
+}
diff --git a/pkg/analyzer/test/src/dart/sdk/patch_test.dart b/pkg/analyzer/test/src/dart/sdk/patch_test.dart
deleted file mode 100644
index 0f7646d..0000000
--- a/pkg/analyzer/test/src/dart/sdk/patch_test.dart
+++ /dev/null
@@ -1,1093 +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 'package:analyzer/dart/analysis/features.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/dart/sdk/patch.dart';
-import 'package:analyzer/src/dart/sdk/sdk.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(SdkPatcherTest);
- });
-}
-
-@reflectiveTest
-class SdkPatcherTest with ResourceProviderMixin {
- final featureSet = FeatureSet.forTesting(sdkVersion: '2.2.2');
-
- Folder sdkFolder;
- FolderBasedDartSdk sdk;
-
- SdkPatcher patcher = SdkPatcher();
- RecordingErrorListener listener = RecordingErrorListener();
-
- void setUp() {
- sdkFolder = getFolder('/sdk');
- }
-
- test_class_constructor_append_fail_notPrivate_named() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {}
-''', r'''
-@patch
-class C {
- C.named() {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_append_fail_notPrivate_unnamed() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {}
-''', r'''
-@patch
-class C {
- C() {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_append_named() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class C {
-}
-''', r'''
-@patch
-class C {
- C._named() {}
-}
-''');
- _assertUnitCode(unit, 'class C {C._named() {}}');
- ClassDeclaration clazz = unit.declarations[0];
- ConstructorDeclaration constructor = clazz.members[0];
- _assertPrevNextToken(clazz.leftBracket, constructor.beginToken);
- _assertPrevNextToken(constructor.endToken, clazz.rightBracket);
- }
-
- test_class_constructor_append_unnamed() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class _C {
-}
-''', r'''
-@patch
-class _C {
- _C() {}
-}
-''');
- _assertUnitCode(unit, 'class _C {_C() {}}');
- ClassDeclaration clazz = unit.declarations[0];
- ConstructorDeclaration constructor = clazz.members[0];
- _assertPrevNextToken(clazz.leftBracket, constructor.beginToken);
- _assertPrevNextToken(constructor.endToken, clazz.rightBracket);
- }
-
- test_class_constructor_patch() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class C {
- external C.named();
-}
-''', r'''
-@patch
-class C {
- @patch
- C.named() {
- print(42);
- }
-}
-''');
- _assertUnitCode(unit, 'class C {C.named() {print(42);}}');
- ClassDeclaration clazz = unit.declarations[0];
- ConstructorDeclaration constructor = clazz.members[0];
- expect(constructor.externalKeyword, isNull);
- _assertPrevNextToken(
- constructor.parameters.endToken, constructor.body.beginToken);
- _assertPrevNextToken(constructor.endToken, clazz.rightBracket);
- }
-
- test_class_constructor_patch_fail_baseFactory_patchGenerative() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external factory C.named();
-}
-''', r'''
-@patch
-class C {
- @patch
- C.named() {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_patch_fail_baseGenerative_patchFactory() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external C.named();
-}
-''', r'''
-@patch
-class C {
- @patch
- factory C.named() {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_patch_fail_fieldFormalParam_inBase() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- int f;
- external C.named(this.f);
-}
-''', r'''
-@patch
-class C {
- @patch
- C.named() : f = 2 {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_patch_fail_fieldFormalParam_inPatch() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- int f;
- external C.named(int f);
-}
-''', r'''
-@patch
-class C {
- @patch
- C.named(this.f) {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_patch_fail_fieldFormalParam_inPatchAndBase() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- int f;
- external C.named(this.f);
-}
-''', r'''
-@patch
-class C {
- @patch
- C.named(this.f) {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_patch_fail_hasInitializers() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- int f;
- external C.named() : f = 1;
-}
-''', r'''
-@patch
-class C {
- @patch
- C.named() : f = 2 {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_patch_fail_noExternalKeyword() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- C.named();
-}
-''', r'''
-@patch
-class C {
- @patch
- C.named() {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_patch_fail_signatureChange() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external C.named(int x);
-}
-''', r'''
-@patch
-class C {
- @patch
- C.named(double x) {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_patch_fail_signatureChange_nameOnly() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external C.named(int x);
-}
-''', r'''
-@patch
-class C {
- @patch
- C.named(int y) {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_constructor_patch_initializers() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class C {
- int f;
- external C.named();
-}
-''', r'''
-@patch
-class C {
- @patch
- C.named() : f = 2 {
- print(42);
- }
-}
-''');
- _assertUnitCode(unit, 'class C {int f; C.named() : f = 2 {print(42);}}');
- ClassDeclaration clazz = unit.declarations[0];
- ConstructorDeclaration constructor = clazz.members[1];
- expect(constructor.externalKeyword, isNull);
- _assertPrevNextToken(constructor.parameters.endToken,
- constructor.initializers.beginToken.previous);
- _assertPrevNextToken(constructor.endToken, clazz.rightBracket);
- }
-
- test_class_field_append() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class C {
- void a() {}
-}
-''', r'''
-@patch
-class C {
- int _b = 42;
-}
-''');
- _assertUnitCode(unit, 'class C {void a() {} int _b = 42;}');
- ClassDeclaration clazz = unit.declarations[0];
- MethodDeclaration a = clazz.members[0];
- FieldDeclaration b = clazz.members[1];
- _assertPrevNextToken(a.endToken, b.beginToken);
- _assertPrevNextToken(b.endToken, clazz.rightBracket);
- }
-
- test_class_field_append_fail_moreThanOne() {
- expect(() {
- _doTopLevelPatching(r'''
-class A {}
-''', r'''
-@patch
-class A {
- @patch
- int _f1, _f2;
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_field_append_fail_notPrivate() {
- expect(() {
- _doTopLevelPatching(r'''
-class A {}
-''', r'''
-@patch
-class A {
- @patch
- int b;
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_field_append_publicInPrivateClass() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class _C {
- void a() {}
-}
-''', r'''
-@patch
-class _C {
- int b = 42;
-}
-''');
- _assertUnitCode(unit, 'class _C {void a() {} int b = 42;}');
- ClassDeclaration clazz = unit.declarations[0];
- MethodDeclaration a = clazz.members[0];
- FieldDeclaration b = clazz.members[1];
- _assertPrevNextToken(a.endToken, b.beginToken);
- _assertPrevNextToken(b.endToken, clazz.rightBracket);
- }
-
- test_class_field_patch_fail() {
- expect(() {
- _doTopLevelPatching(r'''
-class A {}
-''', r'''
-@patch
-class A {
- @patch
- int _f;
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_getter_append() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class C {
- void a() {}
-}
-''', r'''
-@patch
-class C {
- int get _b => 2;
-}
-''');
- _assertUnitCode(unit, 'class C {void a() {} int get _b => 2;}');
- }
-
- test_class_method_append() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class C {
- void a() {}
-}
-''', r'''
-@patch
-class C {
- void _b() {}
- void _c() {}
-}
-''');
- _assertUnitCode(unit, 'class C {void a() {} void _b() {} void _c() {}}');
- ClassDeclaration clazz = unit.declarations[0];
- MethodDeclaration a = clazz.members[0];
- MethodDeclaration b = clazz.members[1];
- MethodDeclaration c = clazz.members[2];
- _assertPrevNextToken(a.endToken, b.beginToken);
- _assertPrevNextToken(b.endToken, c.beginToken);
- _assertPrevNextToken(c.endToken, clazz.rightBracket);
- }
-
- test_class_method_fail_notPrivate() {
- expect(() {
- _doTopLevelPatching(r'''
-class A {}
-''', r'''
-@patch
-class A {
- void m() {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class C {
- external int m();
-}
-''', r'''
-@patch
-class C {
- @patch
- int m() => 42;
-}
-''');
- _assertUnitCode(unit, 'class C {int m() => 42;}');
- ClassDeclaration clazz = unit.declarations[0];
- MethodDeclaration m = clazz.members[0];
- expect(m.externalKeyword, isNull);
- _assertPrevNextToken(m.parameters.rightParenthesis, m.body.beginToken);
- _assertPrevNextToken(m.body.endToken, clazz.rightBracket);
- }
-
- test_class_method_patch_fail_noExternalKeyword() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- int m();
-}
-''', r'''
-@patch
-class C {
- @patch
- int m() => 42;
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_fail_signatureChange() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external void f(int x);
-}
-''', r'''
-@patch
-class C {
- @patch
- void f(double x) {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_fail_signatureChange_extraArgument() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external void f();
-}
-''', r'''
-@patch
-class C {
- @patch
- void f(int x) {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_fail_signatureChange_extraTypeTokens() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external List f();
-}
-''', r'''
-@patch
-class C {
- @patch
- List<int> f() => null;
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_fail_signatureChange_functionTypedParam_paramType() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external void f(void x(int y));
-}
-''', r'''
-@patch
-class C {
- @patch
- void f(void x(double y)) {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_fail_signatureChange_functionTypedParam_returnType() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external void f(int x());
-}
-''', r'''
-@patch
-class C {
- @patch
- void f(double x()) {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_fail_signatureChange_makeReturnTypeExplicit() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external f();
-}
-''', r'''
-@patch
-class C {
- @patch
- int f() => 0;
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_fail_signatureChange_missingArgument() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external void f(int x);
-}
-''', r'''
-@patch
-class C {
- @patch
- void f() {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_fail_signatureChange_missingTypeTokens() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external List<int> f();
-}
-''', r'''
-@patch
-class C {
- @patch
- List f() => null;
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_fail_signatureChange_nameOnly() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external void f(int x);
-}
-''', r'''
-@patch
-class C {
- @patch
- void f(int y) {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_fail_signatureChange_returnTypeOnly() {
- expect(() {
- _doTopLevelPatching(r'''
-class C {
- external void f(int x);
-}
-''', r'''
-@patch
-class C {
- @patch
- int f(int x) {}
-}
-''');
- }, throwsArgumentError);
- }
-
- test_class_method_patch_success_defaultFormalParameter() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class C {
- external void f(int x = 0);
-}
-''', r'''
-@patch
-class C {
- @patch
- void f(int x) {}
-}
-''');
- ClassDeclaration cls = unit.declarations[0];
- MethodDeclaration method = cls.members[0];
- FormalParameter parameter = method.parameters.parameters[0];
- expect(parameter, TypeMatcher<DefaultFormalParameter>());
- }
-
- test_class_method_patch_success_implicitReturnType() {
- _doTopLevelPatching(r'''
-class C {
- external f();
-}
-''', r'''
-@patch
-class C {
- @patch
- f() => null;
-}
-''');
- }
-
- test_class_method_patch_success_multiTokenReturnType() {
- _doTopLevelPatching(r'''
-class C {
- external List<int> f();
-}
-''', r'''
-@patch
-class C {
- @patch
- List<int> f() => null;
-}
-''');
- }
-
- test_class_method_patch_success_signatureChange_functionTypedParam_matching() {
- _doTopLevelPatching(r'''
-class C {
- external void f(void x(int y));
-}
-''', r'''
-@patch
-class C {
- @patch
- void f(void x(int y)) {}
-}
-''');
- }
-
- test_class_setter_append() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class C {
- void a() {}
-}
-''', r'''
-@patch
-class C {
- void set _b(_) {}
-}
-''');
- _assertUnitCode(unit, 'class C {void a() {} void set _b(_) {}}');
- }
-
- test_directive_fail_export() {
- expect(() {
- _doTopLevelPatching(r'''
-import 'a.dart';
-''', r'''
-export 'c.dart';
-''');
- }, throwsArgumentError);
- }
-
- test_directive_import() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-import 'a.dart';
-part 'b.dart';
-int bar() => 0;
-''', r'''
-import 'c.dart';
-''');
- _assertUnitCode(unit,
- "import 'a.dart'; part 'b.dart'; import 'c.dart'; int bar() => 0;");
- }
-
- test_fail_patchFileDoesNotExist() {
- expect(() {
- _setSdkLibraries(r'''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
- 'test' : const LibraryInfo(
- 'test/test.dart'),
-};''');
- _createSdk();
- var patchPaths = {
- 'dart:test': [convertPath('/sdk/lib/does_not_exist.dart')]
- };
- File file = newFile('/sdk/lib/test/test.dart');
- Source source = file.createSource(Uri.parse('dart:test'));
- CompilationUnit unit = SdkPatcher.parse(source, listener, featureSet);
- patcher.patch(resourceProvider, patchPaths, listener, source, unit);
- }, throwsArgumentError);
- }
-
- test_internal_allowNewPublicNames() {
- _setSdkLibraries(r'''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
- '_internal' : const LibraryInfo(
- 'internal/internal.dart'),
-};''');
- var patchPaths = {
- 'dart:_internal': [convertPath('/sdk/lib/internal/internal_patch.dart')]
- };
- File file = newFile('/sdk/lib/internal/internal.dart', content: r'''
-library dart._internal;
-class A {}
-class B {
- B();
-}
-''');
- newFile(convertPath('/sdk/lib/internal/internal_patch.dart'), content: r'''
-@patch
-class B {
- int newField;
- B.newConstructor();
- int newMethod() => 1;
-}
-class NewClass {}
-int newFunction() => 2;
-''');
-
- _createSdk();
-
- Source source = file.createSource(Uri.parse('dart:_internal'));
- CompilationUnit unit = SdkPatcher.parse(source, listener, featureSet);
- patcher.patch(resourceProvider, patchPaths, listener, source, unit);
- _assertUnitCode(
- unit,
- 'library dart._internal; class A {} '
- 'class B {B(); int newField; B.newConstructor(); int newMethod() => 1;} '
- 'class NewClass {} int newFunction() => 2;');
- }
-
- test_part() {
- String baseLibCode = r'''
-library test;
-part 'test_part.dart';
-class A {}
-''';
- String basePartCode = r'''
-part of test;
-class B {}
-''';
- _setSdkLibraries(r'''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
- 'test' : const LibraryInfo(
- 'test/test.dart',
- patches: {VM_PLATFORM: ['test/test_patch.dart']}),
-};''');
- var patchPaths = {
- 'dart:test': [convertPath('/sdk/lib/test/test_patch.dart')]
- };
- File fileLib = newFile('/sdk/lib/test/test.dart', content: baseLibCode);
- File filePart =
- newFile('/sdk/lib/test/test_part.dart', content: basePartCode);
- newFile('/sdk/lib/test/test_patch.dart', content: r'''
-import 'foo.dart';
-
-@patch
-class A {
- int _a() => 1;
-}
-
-@patch
-class B {
- int _b() => 1;
-}
-
-class _C {}
-''');
-
- _createSdk();
-
- {
- Uri uri = Uri.parse('dart:test');
- Source source = fileLib.createSource(uri);
- CompilationUnit unit = SdkPatcher.parse(source, listener, featureSet);
- patcher.patch(resourceProvider, patchPaths, listener, source, unit);
- _assertUnitCode(
- unit,
- "library test; part 'test_part.dart'; import 'foo.dart'; "
- "class A {int _a() => 1;} class _C {}");
- }
-
- {
- Uri uri = Uri.parse('dart:test/test_part.dart');
- Source source = filePart.createSource(uri);
- CompilationUnit unit = SdkPatcher.parse(source, listener, featureSet);
- patcher.patch(resourceProvider, patchPaths, listener, source, unit);
- _assertUnitCode(unit, "part of test; class B {int _b() => 1;}");
- }
- }
-
- test_topLevel_class_append() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-class A {}
-''', r'''
-class _B {
- void mmm() {}
-}
-''');
- _assertUnitCode(unit, 'class A {} class _B {void mmm() {}}');
- ClassDeclaration a = unit.declarations[0];
- ClassDeclaration b = unit.declarations[1];
- _assertPrevNextToken(a.endToken, b.beginToken);
- }
-
- test_topLevel_class_fail_mixinApplication() {
- expect(() {
- _doTopLevelPatching(r'''
-class A {}
-''', r'''
-class _B {}
-class _C = Object with _B;
-''');
- }, throwsArgumentError);
- }
-
- test_topLevel_class_fail_notPrivate() {
- expect(() {
- _doTopLevelPatching(r'''
-class A {}
-''', r'''
-class B {}
-''');
- }, throwsArgumentError);
- }
-
- test_topLevel_function_append() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-int foo() => 0;
-''', r'''
-int _bar1() => 1;
-int _bar2() => 2;
-''');
- _assertUnitCode(
- unit, 'int foo() => 0; int _bar1() => 1; int _bar2() => 2;');
-
- FunctionDeclaration foo = unit.declarations[0];
- FunctionDeclaration bar1 = unit.declarations[1];
- FunctionDeclaration bar2 = unit.declarations[2];
-
- _assertPrevNextToken(foo.endToken, bar1.beginToken);
- _assertPrevNextToken(bar1.endToken, bar2.beginToken);
- }
-
- test_topLevel_function_fail_noExternalKeyword() {
- expect(() {
- _doTopLevelPatching(r'''
-int foo();
-''', r'''
-@patch
-int foo() => 1;
-''');
- }, throwsArgumentError);
- }
-
- test_topLevel_function_fail_notPrivate() {
- expect(() {
- _doTopLevelPatching(r'''
-int foo() => 1;
-''', r'''
-int bar() => 2;
-''');
- }, throwsArgumentError);
- }
-
- test_topLevel_functionTypeAlias_append() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-int foo() => 0;
-''', r'''
-typedef int _bar1();
-typedef int _bar2();
-''');
- _assertUnitCode(
- unit, 'int foo() => 0; typedef int _bar1(); typedef int _bar2();');
-
- FunctionDeclaration foo = unit.declarations[0];
- FunctionTypeAlias bar1 = unit.declarations[1];
- FunctionTypeAlias bar2 = unit.declarations[2];
-
- _assertPrevNextToken(foo.endToken, bar1.beginToken);
- _assertPrevNextToken(bar1.endToken, bar2.beginToken);
- expect(unit.endToken.type, TokenType.EOF);
- expect(bar2.endToken.next, same(unit.endToken));
- }
-
- test_topLevel_functionTypeAlias_fail_hasAnnotation() {
- expect(() {
- _doTopLevelPatching(r'''
-int foo() => 0;
-''', r'''
-@patch
-typedef int _bar();
-''');
- }, throwsArgumentError);
- }
-
- test_topLevel_functionTypeAlias_fail_notPrivate() {
- expect(() {
- _doTopLevelPatching(r'''
-int foo() => 0;
-''', r'''
-typedef int bar();
-''');
- }, throwsArgumentError);
- }
-
- test_topLevel_patch_function() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-external int foo();
-int bar() => 2;
-''', r'''
-@patch
-int foo() => 1;
-''');
- _assertUnitCode(unit, 'int foo() => 1; int bar() => 2;');
-
- // Prepare functions.
- FunctionDeclaration foo = unit.declarations[0];
- FunctionDeclaration bar = unit.declarations[1];
-
- // The "external" token is removed from the stream.
- {
- expect(foo.externalKeyword, isNull);
- Token token = foo.beginToken;
- expect(token.lexeme, 'int');
- expect(token.previous.type, TokenType.EOF);
- }
-
- // The body tokens are included into the patched token stream.
- {
- FunctionExpression fooExpr = foo.functionExpression;
- FunctionBody fooBody = fooExpr.body;
- expect(fooBody.beginToken.previous, same(fooExpr.parameters.endToken));
- expect(fooBody.endToken.next, same(bar.beginToken));
- }
- }
-
- test_topLevel_patch_function_blockBody() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-external int foo();
-''', r'''
-@patch
-int foo() {int v = 1; return v + 2;}
-''');
- _assertUnitCode(unit, 'int foo() {int v = 1; return v + 2;}');
- }
-
- test_topLevel_patch_function_fail_signatureChange() {
- expect(() {
- _doTopLevelPatching(r'''
-external void f(int x);
-''', r'''
-@patch
-void f(double x) {}
-''');
- }, throwsArgumentError);
- }
-
- test_topLevel_patch_function_fail_signatureChange_nameOnly() {
- expect(() {
- _doTopLevelPatching(r'''
-external void f(int x);
-''', r'''
-@patch
-void f(int y) {}
-''');
- }, throwsArgumentError);
- }
-
- test_topLevel_patch_function_fail_signatureChange_returnTypeOnly() {
- expect(() {
- _doTopLevelPatching(r'''
-external void f(int x);
-''', r'''
-@patch
-int f(int x) {}
-''');
- }, throwsArgumentError);
- }
-
- test_topLevel_patch_getter() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-external int get foo;
-int bar() => 2;
-''', r'''
-@patch
-int get foo => 1;
-''');
- _assertUnitCode(unit, 'int get foo => 1; int bar() => 2;');
- }
-
- test_topLevel_patch_setter() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-external void set foo(int val);
-int bar() => 2;
-''', r'''
-@patch
-void set foo(int val) {}
-''');
- _assertUnitCode(unit, 'void set foo(int val) {} int bar() => 2;');
- }
-
- test_topLevel_topLevelVariable_append() {
- CompilationUnit unit = _doTopLevelPatching(r'''
-int foo() => 0;
-''', r'''
-int _bar;
-''');
- _assertUnitCode(unit, 'int foo() => 0; int _bar;');
- FunctionDeclaration a = unit.declarations[0];
- TopLevelVariableDeclaration b = unit.declarations[1];
- _assertPrevNextToken(a.endToken, b.beginToken);
- }
-
- void _assertUnitCode(CompilationUnit unit, String expectedCode) {
- expect(unit.toSource(), expectedCode);
- }
-
- void _createSdk() {
- sdk = FolderBasedDartSdk(resourceProvider, sdkFolder);
- sdk.analysisOptions = AnalysisOptionsImpl();
- }
-
- CompilationUnit _doTopLevelPatching(String baseCode, String patchCode) {
- _setSdkLibraries(r'''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
- 'test' : const LibraryInfo(
- 'test/test.dart'),
-};''');
- var patchPaths = {
- 'dart:test': [convertPath('/sdk/lib/test/test_patch.dart')]
- };
- File file = newFile('/sdk/lib/test/test.dart', content: baseCode);
- newFile('/sdk/lib/test/test_patch.dart', content: patchCode);
-
- _createSdk();
-
- Source source = file.createSource(Uri.parse('dart:test'));
- CompilationUnit unit = SdkPatcher.parse(source, listener, featureSet);
- patcher.patch(resourceProvider, patchPaths, listener, source, unit);
- return unit;
- }
-
- void _setSdkLibraries(String code) {
- newFile(
- '/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
- content: code,
- );
- }
-
- static void _assertPrevNextToken(Token prev, Token next) {
- expect(prev.next, same(next));
- expect(next.previous, same(prev));
- }
-}
diff --git a/pkg/analyzer/test/src/dart/sdk/test_all.dart b/pkg/analyzer/test/src/dart/sdk/test_all.dart
index eda411d..a68b8ef 100644
--- a/pkg/analyzer/test/src/dart/sdk/test_all.dart
+++ b/pkg/analyzer/test/src/dart/sdk/test_all.dart
@@ -4,13 +4,11 @@
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import 'patch_test.dart' as patch_test;
import 'sdk_test.dart' as sdk;
/// Utility for manually running all tests.
main() {
defineReflectiveSuite(() {
- patch_test.main();
sdk.main();
}, name: 'sdk');
}
diff --git a/pkg/analyzer/test/src/dart/test_all.dart b/pkg/analyzer/test/src/dart/test_all.dart
index adae467..929ba07 100644
--- a/pkg/analyzer/test/src/dart/test_all.dart
+++ b/pkg/analyzer/test/src/dart/test_all.dart
@@ -8,6 +8,7 @@
import 'ast/test_all.dart' as ast;
import 'constant/test_all.dart' as constant;
import 'element/test_all.dart' as element;
+import 'micro/test_all.dart' as micro;
import 'resolution/test_all.dart' as resolution;
import 'resolver/test_all.dart' as resolver;
import 'sdk/test_all.dart' as sdk;
@@ -19,6 +20,7 @@
ast.main();
constant.main();
element.main();
+ micro.main();
resolution.main();
resolver.main();
sdk.main();
diff --git a/pkg/analyzer/test/src/diagnostics/body_may_complete_normally_test.dart b/pkg/analyzer/test/src/diagnostics/body_might_complete_normally_test.dart
similarity index 87%
rename from pkg/analyzer/test/src/diagnostics/body_may_complete_normally_test.dart
rename to pkg/analyzer/test/src/diagnostics/body_might_complete_normally_test.dart
index 6589466..9051278 100644
--- a/pkg/analyzer/test/src/diagnostics/body_may_complete_normally_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/body_might_complete_normally_test.dart
@@ -26,7 +26,7 @@
await assertErrorsInCode(r'''
Future<int> foo() async {}
''', [
- error(CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY, 12, 3),
+ error(CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY, 12, 3),
]);
}
@@ -34,7 +34,7 @@
await assertErrorsInCode(r'''
Future<void> foo() {}
''', [
- error(CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY, 13, 3),
+ error(CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY, 13, 3),
]);
}
@@ -48,7 +48,7 @@
await assertErrorsInCode(r'''
int foo() {}
''', [
- error(CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY, 4, 3),
+ error(CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY, 4, 3),
]);
}
@@ -79,7 +79,7 @@
foo;
}
''', [
- error(CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY, 43, 8),
+ error(CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY, 43, 8),
]);
}
@@ -90,7 +90,7 @@
foo;
}
''', [
- error(CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY, 44, 2),
+ error(CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY, 44, 2),
]);
}
@@ -111,7 +111,7 @@
foo;
}
''', [
- error(CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY, 35, 5),
+ error(CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY, 35, 5),
]);
}
@@ -142,7 +142,7 @@
Future<int> foo() async {}
}
''', [
- error(CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY, 24, 3),
+ error(CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY, 24, 3),
]);
}
@@ -152,7 +152,7 @@
Future<void> foo() {}
}
''', [
- error(CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY, 25, 3),
+ error(CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY, 25, 3),
]);
}
@@ -170,7 +170,7 @@
int foo() {}
}
''', [
- error(CompileTimeErrorCode.BODY_MAY_COMPLETE_NORMALLY, 16, 3),
+ error(CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY, 16, 3),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/dead_null_coalesce_test.dart b/pkg/analyzer/test/src/diagnostics/dead_null_aware_expression_test.dart
similarity index 88%
rename from pkg/analyzer/test/src/diagnostics/dead_null_coalesce_test.dart
rename to pkg/analyzer/test/src/diagnostics/dead_null_aware_expression_test.dart
index af9445e..939300f 100644
--- a/pkg/analyzer/test/src/diagnostics/dead_null_coalesce_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/dead_null_aware_expression_test.dart
@@ -12,12 +12,12 @@
main() {
defineReflectiveSuite(() {
- defineReflectiveTests(DeadNullCoalesceTest);
+ defineReflectiveTests(DeadNullAwareExpressionTest);
});
}
@reflectiveTest
-class DeadNullCoalesceTest extends DriverResolutionTest {
+class DeadNullAwareExpressionTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
@@ -58,7 +58,7 @@
x ??= 0;
}
''', [
- error(StaticWarningCode.DEAD_NULL_COALESCE, 19, 1),
+ error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 19, 1),
]);
}
@@ -91,7 +91,7 @@
x ?? 0;
}
''', [
- error(StaticWarningCode.DEAD_NULL_COALESCE, 18, 1),
+ error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 18, 1),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/final_not_initialized_test.dart b/pkg/analyzer/test/src/diagnostics/final_not_initialized_test.dart
index 3cd983f..55ac07f 100644
--- a/pkg/analyzer/test/src/diagnostics/final_not_initialized_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/final_not_initialized_test.dart
@@ -20,6 +20,15 @@
@reflectiveTest
class FinalNotInitializedTest extends DriverResolutionTest {
+ test_class_instanceField_final_factoryConstructor_only() async {
+ await assertNoErrorsInCode('''
+class A {
+ final int x;
+
+ factory A() => throw 0;
+}''');
+ }
+
test_instanceField_final() async {
await assertErrorsInCode('''
class A {
diff --git a/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_type_test.dart b/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_type_test.dart
index 674987e..0ff696e 100644
--- a/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_type_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_type_test.dart
@@ -2,7 +2,9 @@
// 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/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
@@ -10,30 +12,85 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ForInOfInvalidTypeTest);
+ defineReflectiveTests(ForInOfInvalidTypeWithNnbdTest);
});
}
@reflectiveTest
class ForInOfInvalidTypeTest extends DriverResolutionTest {
- test_await_notStream() async {
+ test_awaitForIn_dynamic() async {
+ await assertNoErrorsInCode('''
+f(dynamic e) async {
+ await for (var id in e) {
+ id;
+ }
+}
+''');
+ }
+
+ test_awaitForIn_interfaceType_notStream() async {
await assertErrorsInCode('''
-f() async {
- await for (var i in true) {}
+f(bool e) async {
+ await for (var id in e) {
+ id;
+ }
}
''', [
- error(HintCode.UNUSED_LOCAL_VARIABLE, 29, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, 34, 4),
+ error(StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, 41, 1),
]);
}
- test_notIterable() async {
+ test_forIn_dynamic() async {
+ await assertNoErrorsInCode('''
+f(dynamic e) {
+ for (var id in e) {
+ id;
+ }
+}
+''');
+ }
+
+ test_forIn_interfaceType_notIterable() async {
await assertErrorsInCode('''
-f() {
- for (var i in true) {}
+f(bool e) {
+ for (var id in e) {
+ id;
+ }
}
''', [
- error(HintCode.UNUSED_LOCAL_VARIABLE, 17, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, 22, 4),
+ error(StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, 29, 1),
]);
}
}
+
+@reflectiveTest
+class ForInOfInvalidTypeWithNnbdTest extends ForInOfInvalidTypeTest {
+ @override
+ AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
+ ..contextFeatures = FeatureSet.forTesting(
+ sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
+
+ test_awaitForIn_never() async {
+ await assertNoErrorsInCode('''
+f(Never e) async {
+ await for (var id in e) {
+ id;
+ }
+}
+''');
+ // TODO(scheglov) extract for-in resolution and implement
+// assertType(findNode.simple('id;'), 'Never');
+ }
+
+ test_forIn_never() async {
+ await assertNoErrorsInCode('''
+f(Never e) {
+ for (var id in e) {
+ id;
+ }
+}
+''');
+ // TODO(scheglov) extract for-in resolution and implement
+// assertType(findNode.simple('id;'), 'Never');
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_language_override_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_language_override_test.dart
index f7b74a5..8a9aa78 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_language_override_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_language_override_test.dart
@@ -15,9 +15,23 @@
@reflectiveTest
class BadDartLanguageOverrideTest extends DriverResolutionTest {
- test_correct_withMultipleWhitespace() async {
+ test_correct_11_12() async {
await assertNoErrorsInCode(r'''
-// @dart = 2.0
+// @dart = 11.12
+int i = 0;
+''');
+ }
+
+ test_correct_2_10() async {
+ await assertNoErrorsInCode(r'''
+// @dart = 2.10
+int i = 0;
+''');
+ }
+
+ test_correct_withMultipleWhitespace() async {
+ await assertNoErrorsInCode('''
+// @dart = 2.0${" "}
int i = 0;
''');
}
@@ -113,8 +127,8 @@
}
test_nonVersionOverride_onlyWhitespace() async {
- await assertNoErrorsInCode(r'''
-///
+ await assertNoErrorsInCode('''
+///${" "}
int i = 0;
''');
@@ -232,14 +246,4 @@
int i = 0;
''', [error(HintCode.INVALID_LANGUAGE_VERSION_OVERRIDE_PREFIX, 0, 15)]);
}
-
- test_wrongVersion_tooManyDigits() async {
- await assertErrorsInCode(r'''
-// @dart = 2.00
-int i = 0;
-''', [
- error(
- HintCode.INVALID_LANGUAGE_VERSION_OVERRIDE_TRAILING_CHARACTERS, 0, 15)
- ]);
- }
}
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_override_different_default_values_named_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_override_different_default_values_named_test.dart
index 5bf7f5e..8db5d07 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_override_different_default_values_named_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_override_different_default_values_named_test.dart
@@ -60,15 +60,12 @@
void foo({x});
}
''',
- typeToStringWithNullability
- ? []
- : [
- error(
- StaticWarningCode
- .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
- 86,
- 1),
- ]);
+ expectedErrorsByNullability(nullable: [], legacy: [
+ error(
+ StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
+ 86,
+ 1),
+ ]));
}
test_abstract_noDefault_multipleBase_differentValue() async {
@@ -86,20 +83,16 @@
void foo({x});
}
''',
- typeToStringWithNullability
- ? []
- : [
- error(
- StaticWarningCode
- .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
- 142,
- 1),
- error(
- StaticWarningCode
- .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
- 142,
- 1),
- ]);
+ expectedErrorsByNullability(nullable: [], legacy: [
+ error(
+ StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
+ 142,
+ 1),
+ error(
+ StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
+ 142,
+ 1),
+ ]));
}
test_abstract_noDefault_multipleBase_sameValue() async {
@@ -117,20 +110,16 @@
void foo({x});
}
''',
- typeToStringWithNullability
- ? []
- : [
- error(
- StaticWarningCode
- .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
- 140,
- 1),
- error(
- StaticWarningCode
- .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
- 140,
- 1),
- ]);
+ expectedErrorsByNullability(nullable: [], legacy: [
+ error(
+ StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
+ 140,
+ 1),
+ error(
+ StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
+ 140,
+ 1),
+ ]));
}
test_abstract_value_base_noDefault() async {
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_override_different_default_values_positional_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_override_different_default_values_positional_test.dart
index 5e9ced6..1c00700 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_override_different_default_values_positional_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_override_different_default_values_positional_test.dart
@@ -63,15 +63,13 @@
void foo([x]);
}
''',
- typeToStringWithNullability
- ? []
- : [
- error(
- StaticWarningCode
- .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
- 86,
- 1),
- ]);
+ expectedErrorsByNullability(nullable: [], legacy: [
+ error(
+ StaticWarningCode
+ .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
+ 86,
+ 1),
+ ]));
}
test_abstract_noDefault_multipleBase_differentValue() async {
@@ -89,20 +87,18 @@
void foo([x]);
}
''',
- typeToStringWithNullability
- ? []
- : [
- error(
- StaticWarningCode
- .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
- 142,
- 1),
- error(
- StaticWarningCode
- .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
- 142,
- 1),
- ]);
+ expectedErrorsByNullability(nullable: [], legacy: [
+ error(
+ StaticWarningCode
+ .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
+ 142,
+ 1),
+ error(
+ StaticWarningCode
+ .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
+ 142,
+ 1),
+ ]));
}
test_abstract_noDefault_multipleBase_sameValue() async {
@@ -120,20 +116,18 @@
void foo([x]);
}
''',
- typeToStringWithNullability
- ? []
- : [
- error(
- StaticWarningCode
- .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
- 140,
- 1),
- error(
- StaticWarningCode
- .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
- 140,
- 1),
- ]);
+ expectedErrorsByNullability(nullable: [], legacy: [
+ error(
+ StaticWarningCode
+ .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
+ 140,
+ 1),
+ error(
+ StaticWarningCode
+ .INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
+ 140,
+ 1),
+ ]));
}
test_abstract_value_base_noDefault() async {
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_use_of_null_value_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_use_of_null_value_test.dart
index 6eae1c1..c680ec7 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_use_of_null_value_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_use_of_null_value_test.dart
@@ -68,7 +68,6 @@
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 27, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, 32, 1),
error(StaticWarningCode.INVALID_USE_OF_NULL_VALUE, 32, 1),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart b/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart
index 5aadc08..9a758ed 100644
--- a/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart
@@ -93,7 +93,7 @@
}
''', [
_notAssignedError(22, 1),
- error(StaticWarningCode.DEAD_NULL_COALESCE, 28, 1),
+ error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 28, 1),
]);
}
@@ -105,7 +105,7 @@
}
''', [
_notAssignedError(22, 1),
- error(StaticWarningCode.DEAD_NULL_COALESCE, 28, 1),
+ error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 28, 1),
_notAssignedError(28, 1),
]);
}
@@ -127,7 +127,7 @@
(v = 0) ?? 0;
v;
}
-''', [error(StaticWarningCode.DEAD_NULL_COALESCE, 33, 1)]);
+''', [error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 33, 1)]);
}
test_binaryExpression_ifNull_right() async {
@@ -138,7 +138,7 @@
v;
}
''', [
- error(StaticWarningCode.DEAD_NULL_COALESCE, 32, 7),
+ error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 32, 7),
_notAssignedError(43, 1),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/not_initialized_non_nullable_instance_field_test.dart b/pkg/analyzer/test/src/diagnostics/not_initialized_non_nullable_instance_field_test.dart
index 42f170a..c6bc64f 100644
--- a/pkg/analyzer/test/src/diagnostics/not_initialized_non_nullable_instance_field_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/not_initialized_non_nullable_instance_field_test.dart
@@ -24,17 +24,7 @@
[EnableString.non_nullable],
);
- test_constructorFieldInitializer() async {
- await assertNoErrorsInCode('''
-class A {
- int x;
-
- A() : x = 0;
-}
-''');
- }
-
- test_factoryConstructor() async {
+ test_class_factoryConstructor() async {
await assertNoErrorsInCode('''
class A {
int x = 0;
@@ -46,6 +36,37 @@
''');
}
+ test_class_notNullable_factoryConstructor_only() async {
+ await assertErrorsInCode('''
+class A {
+ int x;
+
+ factory A() => throw 0;
+}
+''', [
+ error(CompileTimeErrorCode.NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD,
+ 16, 1),
+ ]);
+ }
+
+ test_class_notNullable_late() async {
+ await assertNoErrorsInCode('''
+class A {
+ late int x;
+}
+''');
+ }
+
+ test_constructorFieldInitializer() async {
+ await assertNoErrorsInCode('''
+class A {
+ int x;
+
+ A() : x = 0;
+}
+''');
+ }
+
test_fieldFormal() async {
await assertNoErrorsInCode('''
class A {
@@ -89,9 +110,20 @@
]);
}
- test_late() async {
+ test_mixin_notNullable() async {
+ await assertErrorsInCode('''
+mixin M {
+ int x;
+}
+''', [
+ error(CompileTimeErrorCode.NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD,
+ 16, 1),
+ ]);
+ }
+
+ test_mixin_notNullable_late() async {
await assertNoErrorsInCode('''
-class A {
+mixin M {
late int x;
}
''');
diff --git a/pkg/analyzer/test/src/diagnostics/redirect_to_non_const_constructor_test.dart b/pkg/analyzer/test/src/diagnostics/redirect_to_non_const_constructor_test.dart
index 835f8bed..25c414f 100644
--- a/pkg/analyzer/test/src/diagnostics/redirect_to_non_const_constructor_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/redirect_to_non_const_constructor_test.dart
@@ -66,6 +66,17 @@
]);
}
+ test_constRedirector_nonConstRedirectee_viaInitializer_unnamed() async {
+ await assertErrorsInCode(r'''
+class A {
+ A();
+ const A.named() : this();
+}
+''', [
+ error(CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR, 37, 4),
+ ]);
+ }
+
test_constRedirector_viaInitializer_cannotResolveRedirectee() async {
// No crash when redirectee cannot be resolved.
await assertErrorsInCode(r'''
diff --git a/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart b/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart
index 72981c0..c21f0a5 100644
--- a/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart
@@ -48,8 +48,8 @@
error(StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, 0, 3),
error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 25, 1,
contextMessages: [
- message('/sdk/lib/core/core.dart', 2003, 3),
- message('/sdk/lib/core/core.dart', 2003, 3)
+ message('/sdk/lib/core/core.dart', 2090, 3),
+ message('/sdk/lib/core/core.dart', 2090, 3)
]),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index c071c71..4f56a78 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -27,7 +27,7 @@
as async_keyword_used_as_identifier;
import 'await_in_late_local_variable_initializer_test.dart'
as await_in_late_local_variable_initializer;
-import 'body_may_complete_normally_test.dart' as body_may_complete_normally;
+import 'body_might_complete_normally_test.dart' as body_might_complete_normally;
import 'builtin_identifier_as_extension_name_test.dart'
as builtin_as_extension_name;
import 'can_be_null_after_null_aware_test.dart' as can_be_null_after_null_aware;
@@ -57,7 +57,7 @@
as const_spread_expected_list_or_set;
import 'const_spread_expected_map_test.dart' as const_spread_expected_map;
import 'dead_code_test.dart' as dead_code;
-import 'dead_null_coalesce_test.dart' as dead_null_coalesce;
+import 'dead_null_aware_expression_test.dart' as dead_null_aware_expression;
import 'default_list_constructor_mismatch_test.dart'
as default_list_constructor_mismatch;
import 'default_value_in_function_type_test.dart'
@@ -473,8 +473,8 @@
import 'unnecessary_null_aware_call_test.dart' as unnecessary_null_aware_call;
import 'unnecessary_null_aware_spread_test.dart'
as unnecessary_null_aware_spread;
-import 'unnecessary_type_check_false_test.dart' as unnecessary_type_check_false;
-import 'unnecessary_type_check_true_test.dart' as unnecessary_type_check_true;
+import 'unnecessary_null_comparison_test.dart' as unnecessary_null_comparison;
+import 'unnecessary_type_check_test.dart' as unnecessary_type_check;
import 'unqualified_reference_to_static_member_of_extended_type_test.dart'
as unqualified_reference_to_static_member_of_extended_type;
import 'unused_catch_clause_test.dart' as unused_catch_clause;
@@ -499,6 +499,7 @@
as wrong_type_parameter_variance_in_superinterface;
import 'yield_each_in_non_generator_test.dart' as yield_each_in_non_generator;
import 'yield_in_non_generator_test.dart' as yield_in_non_generator;
+import 'yield_of_invalid_type_test.dart' as yield_of_invalid_type;
main() {
defineReflectiveSuite(() {
@@ -519,7 +520,7 @@
assignment_to_type.main();
async_keyword_used_as_identifier.main();
await_in_late_local_variable_initializer.main();
- body_may_complete_normally.main();
+ body_might_complete_normally.main();
builtin_as_extension_name.main();
can_be_null_after_null_aware.main();
case_block_not_terminated.main();
@@ -538,7 +539,7 @@
const_spread_expected_list_or_set.main();
const_spread_expected_map.main();
dead_code.main();
- dead_null_coalesce.main();
+ dead_null_aware_expression.main();
default_list_constructor_mismatch.main();
default_value_in_function_type.main();
default_value_in_function_typed_parameter.main();
@@ -821,8 +822,8 @@
unnecessary_non_null_assertion.main();
unnecessary_null_aware_call.main();
unnecessary_null_aware_spread.main();
- unnecessary_type_check_false.main();
- unnecessary_type_check_true.main();
+ unnecessary_null_comparison.main();
+ unnecessary_type_check.main();
unqualified_reference_to_static_member_of_extended_type.main();
unused_catch_clause.main();
unused_catch_stack.main();
@@ -842,5 +843,6 @@
wrong_type_parameter_variance_in_superinterface.main();
yield_each_in_non_generator.main();
yield_in_non_generator.main();
+ yield_of_invalid_type.main();
}, name: 'diagnostics');
}
diff --git a/pkg/analyzer/test/src/diagnostics/type_argument_not_matching_bounds_test.dart b/pkg/analyzer/test/src/diagnostics/type_argument_not_matching_bounds_test.dart
index dfc00d0..2497f4e 100644
--- a/pkg/analyzer/test/src/diagnostics/type_argument_not_matching_bounds_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/type_argument_not_matching_bounds_test.dart
@@ -452,4 +452,12 @@
}
''');
}
+
+ test_superBounded() async {
+ await assertNoErrorsInCode(r'''
+class A<X extends A<X>> {}
+
+A get foo => throw 0;
+''');
+ }
}
diff --git a/pkg/analyzer/test/src/diagnostics/unnecessary_null_comparison_test.dart b/pkg/analyzer/test/src/diagnostics/unnecessary_null_comparison_test.dart
new file mode 100644
index 0000000..bc58a11
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/unnecessary_null_comparison_test.dart
@@ -0,0 +1,152 @@
+// Copyright (c) 2020, 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/analysis/features.dart';
+import 'package:analyzer/src/dart/analysis/experiments.dart';
+import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/driver_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(UnnecessaryNullComparisonFalseTest);
+ defineReflectiveTests(UnnecessaryNullComparisonTrueTest);
+ });
+}
+
+@reflectiveTest
+class UnnecessaryNullComparisonFalseTest extends DriverResolutionTest {
+ @override
+ AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
+ ..contextFeatures = FeatureSet.fromEnableFlags(
+ [EnableString.non_nullable],
+ );
+
+ test_equal_intLiteral() async {
+ await assertNoErrorsInCode('''
+f(int a, int? b) {
+ a == 0;
+ 0 == a;
+ b == 0;
+ 0 == b;
+}
+''');
+ }
+
+ test_equal_legacy() async {
+ newFile('/test/lib/a.dart', content: r'''
+// @dart = 2.5
+var a = 0;
+''');
+
+ await assertNoErrorsInCode('''
+import 'a.dart';
+
+f() {
+ a == null;
+ null == a;
+}
+''');
+ }
+
+ test_equal_legacyLibrary() async {
+ await assertNoErrorsInCode('''
+// @dart = 2.5
+f(int a) {
+ a == null;
+ null == a;
+}
+''');
+ }
+
+ test_equal_notNullable() async {
+ await assertErrorsInCode('''
+f(int a) {
+ a == null;
+ null == a;
+}
+''', [
+ error(HintCode.UNNECESSARY_NULL_COMPARISON_FALSE, 15, 7),
+ error(HintCode.UNNECESSARY_NULL_COMPARISON_FALSE, 26, 7),
+ ]);
+ }
+
+ test_equal_nullable() async {
+ await assertNoErrorsInCode('''
+f(int? a) {
+ a == null;
+ null == a;
+}
+''');
+ }
+}
+
+@reflectiveTest
+class UnnecessaryNullComparisonTrueTest extends DriverResolutionTest {
+ @override
+ AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
+ ..contextFeatures = FeatureSet.fromEnableFlags(
+ [EnableString.non_nullable],
+ );
+
+ test_notEqual_intLiteral() async {
+ await assertNoErrorsInCode('''
+f(int a, int? b) {
+ a != 0;
+ 0 != a;
+ b != 0;
+ 0 != b;
+}
+''');
+ }
+
+ test_notEqual_legacy() async {
+ newFile('/test/lib/a.dart', content: r'''
+// @dart = 2.5
+var a = 0;
+''');
+
+ await assertNoErrorsInCode('''
+import 'a.dart';
+
+f() {
+ a != null;
+ null != a;
+}
+''');
+ }
+
+ test_notEqual_legacyLibrary() async {
+ await assertNoErrorsInCode('''
+// @dart = 2.5
+f(int a) {
+ a != null;
+ null != a;
+}
+''');
+ }
+
+ test_notEqual_notNullable() async {
+ await assertErrorsInCode('''
+f(int a) {
+ a != null;
+ null != a;
+}
+''', [
+ error(HintCode.UNNECESSARY_NULL_COMPARISON_TRUE, 15, 7),
+ error(HintCode.UNNECESSARY_NULL_COMPARISON_TRUE, 26, 7),
+ ]);
+ }
+
+ test_notEqual_nullable() async {
+ await assertNoErrorsInCode('''
+f(int? a) {
+ a != null;
+ null != a;
+}
+''');
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_false_test.dart b/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_false_test.dart
deleted file mode 100644
index dd021db..0000000
--- a/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_false_test.dart
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2019, 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/analysis/features.dart';
-import 'package:analyzer/src/dart/error/hint_codes.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../dart/resolution/driver_resolution.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(UnnecessaryTypeCheckFalseTest);
- defineReflectiveTests(UnnecessaryTypeCheckFalseWithNnbdTest);
- });
-}
-
-@reflectiveTest
-class UnnecessaryTypeCheckFalseTest extends DriverResolutionTest {
- test_null_not_Null() async {
- await assertErrorsInCode(r'''
-var b = null is! Null;
-''', [
- error(HintCode.UNNECESSARY_TYPE_CHECK_FALSE, 8, 13),
- ]);
- }
-
- test_type_not_dynamic() async {
- await assertErrorsInCode(r'''
-void f<T>(T a) {
- a is! dynamic;
-}
-''', [
- error(HintCode.UNNECESSARY_TYPE_CHECK_FALSE, 19, 13),
- ]);
- }
-
- test_type_not_object() async {
- await assertErrorsInCode(r'''
-void f<T>(T a) {
- a is! Object;
-}
-''', [
- error(HintCode.UNNECESSARY_TYPE_CHECK_FALSE, 19, 12),
- ]);
- }
-}
-
-@reflectiveTest
-class UnnecessaryTypeCheckFalseWithNnbdTest
- extends UnnecessaryTypeCheckFalseTest {
- @override
- AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
- ..contextFeatures = FeatureSet.forTesting(
- sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
-
- @override
- test_type_not_object() async {
- await assertNoErrorsInCode(r'''
-void f<T>(T a) {
- a is! Object;
-}
-''');
- }
-
- test_type_not_objectQuestion() async {
- await assertErrorsInCode(r'''
-void f<T>(T a) {
- a is! Object?;
-}
-''', [
- error(HintCode.UNNECESSARY_TYPE_CHECK_FALSE, 19, 13),
- ]);
- }
-}
diff --git a/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_test.dart b/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_test.dart
new file mode 100644
index 0000000..0a21ca9
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_test.dart
@@ -0,0 +1,137 @@
+// Copyright (c) 2019, 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/analysis/features.dart';
+import 'package:analyzer/src/dart/error/hint_codes.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/driver_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(UnnecessaryTypeCheckFalseTest);
+ defineReflectiveTests(UnnecessaryTypeCheckFalseWithNnbdTest);
+ defineReflectiveTests(UnnecessaryTypeCheckTrueTest);
+ defineReflectiveTests(UnnecessaryTypeCheckTrueWithNnbdTest);
+ });
+}
+
+@reflectiveTest
+class UnnecessaryTypeCheckFalseTest extends DriverResolutionTest {
+ test_null_not_Null() async {
+ await assertErrorsInCode(r'''
+var b = null is! Null;
+''', [
+ error(HintCode.UNNECESSARY_TYPE_CHECK_FALSE, 8, 13),
+ ]);
+ }
+
+ test_type_not_dynamic() async {
+ await assertErrorsInCode(r'''
+void f<T>(T a) {
+ a is! dynamic;
+}
+''', [
+ error(HintCode.UNNECESSARY_TYPE_CHECK_FALSE, 19, 13),
+ ]);
+ }
+
+ test_type_not_object() async {
+ await assertErrorsInCode(r'''
+void f<T>(T a) {
+ a is! Object;
+}
+''', [
+ error(HintCode.UNNECESSARY_TYPE_CHECK_FALSE, 19, 12),
+ ]);
+ }
+}
+
+@reflectiveTest
+class UnnecessaryTypeCheckFalseWithNnbdTest
+ extends UnnecessaryTypeCheckFalseTest {
+ @override
+ AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
+ ..contextFeatures = FeatureSet.forTesting(
+ sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
+
+ @override
+ test_type_not_object() async {
+ await assertNoErrorsInCode(r'''
+void f<T>(T a) {
+ a is! Object;
+}
+''');
+ }
+
+ test_type_not_objectQuestion() async {
+ await assertErrorsInCode(r'''
+void f<T>(T a) {
+ a is! Object?;
+}
+''', [
+ error(HintCode.UNNECESSARY_TYPE_CHECK_FALSE, 19, 13),
+ ]);
+ }
+}
+
+@reflectiveTest
+class UnnecessaryTypeCheckTrueTest extends DriverResolutionTest {
+ test_null_is_Null() async {
+ await assertErrorsInCode(r'''
+var b = null is Null;
+''', [
+ error(HintCode.UNNECESSARY_TYPE_CHECK_TRUE, 8, 12),
+ ]);
+ }
+
+ test_type_is_dynamic() async {
+ await assertErrorsInCode(r'''
+void f<T>(T a) {
+ a is dynamic;
+}
+''', [
+ error(HintCode.UNNECESSARY_TYPE_CHECK_TRUE, 19, 12),
+ ]);
+ }
+
+ test_type_is_object() async {
+ await assertErrorsInCode(r'''
+void f<T>(T a) {
+ a is Object;
+}
+''', [
+ error(HintCode.UNNECESSARY_TYPE_CHECK_TRUE, 19, 11),
+ ]);
+ }
+}
+
+@reflectiveTest
+class UnnecessaryTypeCheckTrueWithNnbdTest
+ extends UnnecessaryTypeCheckTrueTest {
+ @override
+ AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
+ ..contextFeatures = FeatureSet.forTesting(
+ sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
+
+ @override
+ test_type_is_object() async {
+ await assertNoErrorsInCode(r'''
+void f<T>(T a) {
+ a is Object;
+}
+''');
+ }
+
+ test_type_is_objectQuestion() async {
+ await assertErrorsInCode(r'''
+void f<T>(T a) {
+ a is Object?;
+}
+''', [
+ error(HintCode.UNNECESSARY_TYPE_CHECK_TRUE, 19, 12),
+ ]);
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_true_test.dart b/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_true_test.dart
deleted file mode 100644
index 9a2d852..0000000
--- a/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_true_test.dart
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2019, 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/analysis/features.dart';
-import 'package:analyzer/src/dart/error/hint_codes.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../dart/resolution/driver_resolution.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(UnnecessaryTypeCheckTrueTest);
- defineReflectiveTests(UnnecessaryTypeCheckTrueWithNnbdTest);
- });
-}
-
-@reflectiveTest
-class UnnecessaryTypeCheckTrueTest extends DriverResolutionTest {
- test_null_is_Null() async {
- await assertErrorsInCode(r'''
-var b = null is Null;
-''', [
- error(HintCode.UNNECESSARY_TYPE_CHECK_TRUE, 8, 12),
- ]);
- }
-
- test_type_is_dynamic() async {
- await assertErrorsInCode(r'''
-void f<T>(T a) {
- a is dynamic;
-}
-''', [
- error(HintCode.UNNECESSARY_TYPE_CHECK_TRUE, 19, 12),
- ]);
- }
-
- test_type_is_object() async {
- await assertErrorsInCode(r'''
-void f<T>(T a) {
- a is Object;
-}
-''', [
- error(HintCode.UNNECESSARY_TYPE_CHECK_TRUE, 19, 11),
- ]);
- }
-}
-
-@reflectiveTest
-class UnnecessaryTypeCheckTrueWithNnbdTest
- extends UnnecessaryTypeCheckTrueTest {
- @override
- AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
- ..contextFeatures = FeatureSet.forTesting(
- sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
-
- @override
- test_type_is_object() async {
- await assertNoErrorsInCode(r'''
-void f<T>(T a) {
- a is Object;
-}
-''');
- }
-
- test_type_is_objectQuestion() async {
- await assertErrorsInCode(r'''
-void f<T>(T a) {
- a is Object?;
-}
-''', [
- error(HintCode.UNNECESSARY_TYPE_CHECK_TRUE, 19, 12),
- ]);
- }
-}
diff --git a/pkg/analyzer/test/src/diagnostics/yield_of_invalid_type_test.dart b/pkg/analyzer/test/src/diagnostics/yield_of_invalid_type_test.dart
new file mode 100644
index 0000000..8963c73
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/yield_of_invalid_type_test.dart
@@ -0,0 +1,451 @@
+// Copyright (c) 2020, 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/analysis/features.dart';
+import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/driver_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(YieldOfInvalidTypeTest);
+ defineReflectiveTests(YieldOfInvalidTypeTest2);
+ });
+}
+
+@reflectiveTest
+class YieldOfInvalidTypeTest extends DriverResolutionTest {
+ test_none_asyncStar_dynamic_to_streamInt() async {
+ await assertErrorsInCode(
+ '''
+import 'dart:async';
+
+Stream<int> f() async* {
+ dynamic a = 0;
+ yield a;
+}
+''',
+ expectedErrorsByNullability(nullable: [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 72, 1),
+ ], legacy: []));
+ }
+
+ test_none_asyncStar_int_to_basic() async {
+ await assertErrorsInCode('''
+int f() async* {
+ yield 0;
+}
+''', [
+ error(StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, 0, 3),
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 25, 1),
+ ]);
+ }
+
+ test_none_asyncStar_int_to_dynamic() async {
+ await assertNoErrorsInCode('''
+dynamic f() async* {
+ yield 0;
+}
+''');
+ }
+
+ test_none_asyncStar_int_to_iterableDynamic() async {
+ await assertErrorsInCode('''
+Iterable<int> f() async* {
+ yield 0;
+}
+''', [
+ error(StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, 0, 13),
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 35, 1),
+ ]);
+ }
+
+ test_none_asyncStar_int_to_streamDynamic() async {
+ await assertNoErrorsInCode('''
+import 'dart:async';
+
+Stream f() async* {
+ yield 0;
+}
+''');
+ }
+
+ test_none_asyncStar_int_to_streamInt() async {
+ await assertNoErrorsInCode('''
+import 'dart:async';
+
+Stream<int> f() async* {
+ yield 0;
+}
+''');
+ }
+
+ test_none_asyncStar_int_to_streamString() async {
+ await assertErrorsInCode('''
+import 'dart:async';
+
+Stream<String> f() async* {
+ yield 0;
+}
+''', [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 58, 1),
+ ]);
+ }
+
+ test_none_asyncStar_int_to_untyped() async {
+ await assertNoErrorsInCode('''
+f() async* {
+ yield 0;
+}
+''');
+ }
+
+ test_none_syncStar_dynamic_to_iterableInt() async {
+ await assertErrorsInCode(
+ '''
+Iterable<int> f() sync* {
+ dynamic a = 0;
+ yield a;
+}
+''',
+ expectedErrorsByNullability(nullable: [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 51, 1),
+ ], legacy: []));
+ }
+
+ test_none_syncStar_int_to_basic() async {
+ await assertErrorsInCode('''
+int f() sync* {
+ yield 0;
+}
+''', [
+ error(StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, 0, 3),
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 24, 1),
+ ]);
+ }
+
+ test_none_syncStar_int_to_dynamic() async {
+ await assertNoErrorsInCode('''
+dynamic f() sync* {
+ yield 0;
+}
+''');
+ }
+
+ test_none_syncStar_int_to_iterableDynamic() async {
+ await assertNoErrorsInCode('''
+Iterable f() sync* {
+ yield 0;
+}
+''');
+ }
+
+ test_none_syncStar_int_to_iterableInt() async {
+ await assertNoErrorsInCode('''
+Iterable<int> f() sync* {
+ yield 0;
+}
+''');
+ }
+
+ test_none_syncStar_int_to_iterableString() async {
+ await assertErrorsInCode('''
+Iterable<String> f() sync* {
+ yield 0;
+}
+''', [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 37, 1),
+ ]);
+ }
+
+ test_none_syncStar_int_to_stream() async {
+ await assertErrorsInCode('''
+import 'dart:async';
+
+Stream<int> f() sync* {
+ yield 0;
+}
+''', [
+ error(StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, 22, 11),
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 54, 1),
+ ]);
+ }
+
+ test_none_syncStar_int_to_untyped() async {
+ await assertNoErrorsInCode('''
+f() sync* {
+ yield 0;
+}
+''');
+ }
+
+ test_star_asyncStar_dynamic_to_dynamic() async {
+ await assertNoErrorsInCode('''
+f() async* {
+ yield* g();
+}
+
+g() => throw 0;
+''');
+ }
+
+ test_star_asyncStar_dynamic_to_streamDynamic() async {
+ await assertNoErrorsInCode('''
+import 'dart:async';
+
+Stream f() async* {
+ yield* g();
+}
+
+g() => throw 0;
+''');
+ }
+
+ test_star_asyncStar_dynamic_to_streamInt() async {
+ await assertNoErrorsInCode('''
+import 'dart:async';
+
+Stream<int> f() async* {
+ yield* g();
+}
+
+g() => throw 0;
+''');
+ }
+
+ test_star_asyncStar_int_to_dynamic() async {
+ await assertErrorsInCode('''
+f() async* {
+ yield* 0;
+}
+''', [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 22, 1),
+ ]);
+ }
+
+ test_star_asyncStar_iterableInt_to_dynamic() async {
+ await assertErrorsInCode('''
+f() async* {
+ var a = <int>[];
+ yield* a;
+}
+''', [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 41, 1),
+ ]);
+ }
+
+ test_star_asyncStar_iterableInt_to_streamInt() async {
+ await assertErrorsInCode('''
+import 'dart:async';
+
+Stream<int> f() async* {
+ var a = <int>[];
+ yield* a;
+}
+''', [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 75, 1),
+ ]);
+ }
+
+ test_star_asyncStar_iterableString_to_streamInt() async {
+ await assertErrorsInCode('''
+import 'dart:async';
+
+Stream<int> f() async* {
+ var a = <String>[];
+ yield* a;
+}
+''', [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 78, 1),
+ ]);
+ }
+
+ test_star_asyncStar_streamDynamic_to_dynamic() async {
+ await assertNoErrorsInCode('''
+import 'dart:async';
+
+f() async* {
+ yield* g();
+}
+
+Stream g() => throw 0;
+''');
+ }
+
+ test_star_asyncStar_streamDynamic_to_streamInt() async {
+ await assertErrorsInCode(
+ '''
+import 'dart:async';
+
+Stream<int> f() async* {
+ yield* g();
+}
+
+Stream g() => throw 0;
+''',
+ expectedErrorsByNullability(nullable: [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 56, 3),
+ ], legacy: []));
+ }
+
+ test_star_asyncStar_streamInt_to_dynamic() async {
+ await assertNoErrorsInCode('''
+import 'dart:async';
+
+f() async* {
+ yield* g();
+}
+
+Stream<int> g() => throw 0;
+''');
+ }
+
+ test_star_asyncStar_streamInt_to_streamInt() async {
+ await assertNoErrorsInCode('''
+import 'dart:async';
+
+Stream<int> f() async* {
+ yield* g();
+}
+
+Stream<int> g() => throw 0;
+''');
+ }
+
+ test_star_asyncStar_streamString_to_streamInt() async {
+ await assertErrorsInCode('''
+import 'dart:async';
+
+Stream<int> f() async* {
+ yield* g();
+}
+
+Stream<String> g() => throw 0;
+''', [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 56, 3),
+ ]);
+ }
+
+ test_star_syncStar_dynamic_to_dynamic() async {
+ await assertNoErrorsInCode('''
+f() sync* {
+ yield* g();
+}
+
+g() => throw 0;
+''');
+ }
+
+ test_star_syncStar_dynamic_to_iterableDynamic() async {
+ await assertNoErrorsInCode('''
+Iterable f() sync* {
+ yield* g();
+}
+
+g() => throw 0;
+''');
+ }
+
+ test_star_syncStar_dynamic_to_iterableInt() async {
+ await assertNoErrorsInCode('''
+Iterable<int> f() sync* {
+ yield* g();
+}
+
+g() => throw 0;
+''');
+ }
+
+ test_star_syncStar_int() async {
+ await assertErrorsInCode('''
+f() sync* {
+ yield* 0;
+}
+''', [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 21, 1),
+ ]);
+ }
+
+ test_star_syncStar_int_closure() async {
+ await assertErrorsInCode('''
+main() {
+ var f = () sync* {
+ yield* 0;
+ };
+ f;
+}
+''', [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 41, 1),
+ ]);
+ }
+
+ test_star_syncStar_iterableDynamic_to_dynamic() async {
+ await assertNoErrorsInCode('''
+f() sync* {
+ yield* g();
+}
+
+Iterable g() => throw 0;
+''');
+ }
+
+ test_star_syncStar_iterableDynamic_to_iterableInt() async {
+ await assertErrorsInCode(
+ '''
+Iterable<int> f() sync* {
+ yield* g();
+}
+
+Iterable g() => throw 0;
+''',
+ expectedErrorsByNullability(nullable: [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 35, 3),
+ ], legacy: []));
+ }
+
+ test_star_syncStar_iterableInt_to_dynamic() async {
+ await assertNoErrorsInCode('''
+f() sync* {
+ yield* g();
+}
+
+Iterable<int> g() => throw 0;
+''');
+ }
+
+ test_star_syncStar_iterableInt_to_iterableInt() async {
+ await assertNoErrorsInCode('''
+Iterable<int> f() sync* {
+ yield* g();
+}
+
+Iterable<int> g() => throw 0;
+''');
+ }
+
+ test_star_syncStar_iterableString_to_iterableInt() async {
+ await assertErrorsInCode('''
+Iterable<int> f() sync* {
+ yield* g();
+}
+
+Iterable<String> g() => throw 0;
+''', [
+ error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 35, 3),
+ ]);
+ }
+}
+
+@reflectiveTest
+class YieldOfInvalidTypeTest2 extends YieldOfInvalidTypeTest {
+ @override
+ AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
+ ..contextFeatures = FeatureSet.forTesting(
+ sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
+
+ @override
+ bool get typeToStringWithNullability => true;
+}
diff --git a/pkg/analyzer/test/src/summary/test_strategies.dart b/pkg/analyzer/test/src/summary/test_strategies.dart
index 2496fa0..7253a77 100644
--- a/pkg/analyzer/test/src/summary/test_strategies.dart
+++ b/pkg/analyzer/test/src/summary/test_strategies.dart
@@ -29,8 +29,11 @@
// because the scanner may have detected a language version comment
// and downgraded the feature set it holds.
Parser parser = Parser(
- NonExistingSource.unknown, AnalysisErrorListener.NULL_LISTENER,
- featureSet: scanner.featureSet);
+ NonExistingSource.unknown,
+ AnalysisErrorListener.NULL_LISTENER,
+ languageVersion: scanner.languageVersion,
+ featureSet: scanner.featureSet,
+ );
CompilationUnit unit = parser.parseCompilationUnit(token);
unit.lineInfo = LineInfo(scanner.lineStarts);
return unit;
diff --git a/pkg/analyzer/test/src/summary2/ast_text_printer_integration_test.dart b/pkg/analyzer/test/src/summary2/ast_text_printer_integration_test.dart
index 43a4011..7e4c9f9 100644
--- a/pkg/analyzer/test/src/summary2/ast_text_printer_integration_test.dart
+++ b/pkg/analyzer/test/src/summary2/ast_text_printer_integration_test.dart
@@ -34,6 +34,18 @@
test(relPath, () {
var code = file.readAsStringSync();
assertParseCodeAndPrintAst(base, code, mightHasParseErrors: true);
- });
+ }, skip: tempSkipped(file));
}
}
+
+dynamic tempSkipped(File file) {
+ String uriString = file.uri.toString();
+ if (uriString.endsWith(
+ "front_end/parser_testcases/nnbd/issue_40267_case_02.dart") ||
+ uriString.endsWith(
+ "front_end/parser_testcases/nnbd/issue_40267_case_05.dart")) {
+ return "Temporarily skipped because of "
+ "https://dart-review.googlesource.com/c/sdk/+/135903";
+ }
+ return false;
+}
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
index 1e72ef3..f96bb3d 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -955,48 +955,6 @@
''');
}
- test_functionModifiers_asyncStar() async {
- await checkFile('''
-import 'dart:async';
-
-dynamic x;
-
-Stream<int> intStream;
-
-abstract class MyStream<T> extends Stream<T> {
- factory MyStream() => throw 0;
-}
-
-bar1() async* { yield x; }
-Stream bar2() async* { yield x; }
-Stream<int> bar3() async* { yield x; }
-Stream<int> bar4() async* { yield /*error:YIELD_OF_INVALID_TYPE*/intStream; }
-
-baz1() async* { yield* x; }
-Stream baz2() async* { yield* x; }
-Stream<int> baz3() async* { yield* x; }
-Stream<int> baz4() async* { yield* intStream; }
-Stream<int> baz5() async* { yield* new MyStream(); }
-''');
- }
-
- test_functionModifiers_syncStar() async {
- await checkFile('''
-dynamic x;
-
-bar1() sync* { yield x; }
-Iterable bar2() sync* { yield x; }
-Iterable<int> bar3() sync* { yield x; }
-Iterable<int> bar4() sync* { yield /*error:YIELD_OF_INVALID_TYPE*/bar3(); }
-
-baz1() sync* { yield* x; }
-Iterable baz2() sync* { yield* x; }
-Iterable<int> baz3() sync* { yield* x; }
-Iterable<int> baz4() sync* { yield* bar3(); }
-Iterable<int> baz5() sync* { yield* new List(); }
-''');
- }
-
test_functionTypingAndSubtyping_classes() async {
await checkFile('''
class A {}
@@ -4645,7 +4603,7 @@
// This captures the type `T extends int`.
var g = () => x;
g = f;
- g().isEven;
+ g()./*error:UNDEFINED_GETTER*/isEven;
q = g();
int r = x;
}
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
index 01004bb..533cc72 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -1485,30 +1485,6 @@
''');
}
- test_downwardsInferenceYieldYieldStar() async {
- await checkFileElement('''
-import 'dart:async';
-
-abstract class MyStream<T> extends Stream<T> {
- factory MyStream() => throw 0;
-}
-
-Stream<List<int>> foo() async* {
- yield [];
- yield /*error:YIELD_OF_INVALID_TYPE*/new MyStream();
- yield* /*error:YIELD_OF_INVALID_TYPE*/[];
- yield* new MyStream();
-}
-
-Iterable<Map<int, int>> bar() sync* {
- yield {};
- yield /*error:YIELD_OF_INVALID_TYPE*/new List();
- yield* {};
- yield* new List();
-}
-''');
- }
-
test_fieldRefersToStaticGetter() async {
var mainUnit = await checkFileElement('''
class C {
@@ -4425,33 +4401,6 @@
return unit.declaredElement;
}
- @override
- test_downwardsInferenceYieldYieldStar() async {
- // The fifth to last case is inferred differently with set_literals enabled,
- // and no longer an error compared to the base implementation.
- await checkFileElement('''
-import 'dart:async';
-
-abstract class MyStream<T> extends Stream<T> {
- factory MyStream() => throw 0;
-}
-
-Stream<List<int>> foo() async* {
- yield [];
- yield /*error:YIELD_OF_INVALID_TYPE*/new MyStream();
- yield* /*error:YIELD_OF_INVALID_TYPE*/[];
- yield* new MyStream();
-}
-
-Iterable<Map<int, int>> bar() sync* {
- yield {};
- yield /*error:YIELD_OF_INVALID_TYPE*/new List();
- yield* {};
- yield* new List();
-}
-''');
- }
-
@failingTest
@override
test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaExpr1() {
diff --git a/pkg/analyzer/test/util/id_testing_helper.dart b/pkg/analyzer/test/util/id_testing_helper.dart
index 6058bbf..645ddfd 100644
--- a/pkg/analyzer/test/util/id_testing_helper.dart
+++ b/pkg/analyzer/test/util/id_testing_helper.dart
@@ -6,10 +6,10 @@
// annotated code from CFE.
import 'package:_fe_analyzer_shared/src/testing/annotated_code_helper.dart';
-import 'package:_fe_analyzer_shared/src/testing/id.dart'
- show ActualData, Id, IdValue, MemberId, NodeId;
+import 'package:_fe_analyzer_shared/src/testing/id.dart';
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart' hide Annotation;
import 'package:analyzer/diagnostic/diagnostic.dart';
@@ -82,6 +82,13 @@
Iterable<Id> globalIds = const <Id>[],
void Function(String message) onFailure,
Map<String, List<String>> skipMap}) async {
+ for (TestConfig config in testedConfigs) {
+ if (!testData.expectedMaps.containsKey(config.marker)) {
+ throw ArgumentError("Unexpected test marker '${config.marker}'. "
+ "Supported markers: ${testData.expectedMaps.keys}.");
+ }
+ }
+
Map<String, TestResult<T>> results = {};
for (TestConfig config in testedConfigs) {
if (skipForConfig(testData.name, config.marker, skipMap)) {
@@ -122,9 +129,12 @@
MemberAnnotations<IdValue> memberAnnotations =
testData.expectedMaps[config.marker];
var resourceProvider = MemoryResourceProvider();
+ var testUris = [];
for (var entry in testData.memorySourceFiles.entries) {
+ var testUri = _toTestUri(entry.key);
+ testUris.add(testUri);
resourceProvider.newFile(
- resourceProvider.convertPath(_toTestUri(entry.key).path), entry.value);
+ resourceProvider.convertPath(testUri.path), entry.value);
}
var sdk = MockSdk(resourceProvider: resourceProvider);
var logBuffer = StringBuffer();
@@ -151,19 +161,7 @@
packages: Packages.empty,
retainDataForTesting: true);
scheduler.start();
- var result = await driver
- .getResult(resourceProvider.convertPath(testData.entryPoint.path));
- var errors =
- result.errors.where((e) => e.severity == Severity.error).toList();
- if (errors.isNotEmpty) {
- String _formatError(AnalysisError e) {
- var locationInfo = result.unit.lineInfo.getLocation(e.offset);
- return '$locationInfo: ${e.errorCode}: ${e.message}';
- }
- onFailure('Errors found:\n ${errors.map(_formatError).join('\n ')}');
- return TestResult<T>.erroneous();
- }
Map<Uri, Map<Id, ActualData<T>>> actualMaps = <Uri, Map<Id, ActualData<T>>>{};
Map<Id, ActualData<T>> globalData = <Id, ActualData<T>>{};
@@ -171,8 +169,49 @@
return actualMaps.putIfAbsent(uri, () => <Id, ActualData<T>>{});
}
- dataComputer.computeUnitData(
- driver.testingData, result.unit, actualMapFor(testData.entryPoint));
+ var results = <Uri, ResolvedUnitResult>{};
+ for (var testUri in testUris) {
+ var result =
+ await driver.getResult(resourceProvider.convertPath(testUri.path));
+ var errors =
+ result.errors.where((e) => e.severity == Severity.error).toList();
+ if (errors.isNotEmpty) {
+ if (dataComputer.supportsErrors) {
+ var errorMap = <int, List<AnalysisError>>{};
+ for (var error in errors) {
+ var offset = error.offset;
+ if (offset == 0 || offset < 0) {
+ // Position errors without offset in the begin of the file.
+ offset = 0;
+ }
+ (errorMap[offset] ??= <AnalysisError>[]).add(error);
+ }
+ errorMap.forEach((offset, errors) {
+ var id = NodeId(offset, IdKind.error);
+ var data = dataComputer.computeErrorData(
+ config, driver.testingData, id, errors);
+ if (data != null) {
+ Map<Id, ActualData<T>> actualMap = actualMapFor(testUri);
+ actualMap[id] = ActualData<T>(id, data, testUri, offset, errors);
+ }
+ });
+ } else {
+ String _formatError(AnalysisError e) {
+ var locationInfo = result.unit.lineInfo.getLocation(e.offset);
+ return '$locationInfo: ${e.errorCode}: ${e.message}';
+ }
+
+ onFailure('Errors found:\n ${errors.map(_formatError).join('\n ')}');
+ return TestResult<T>.erroneous();
+ }
+ }
+ results[testUri] = result;
+ }
+
+ results.forEach((testUri, result) {
+ dataComputer.computeUnitData(
+ driver.testingData, result.unit, actualMapFor(testUri));
+ });
var compiledData = AnalyzerCompiledData<T>(
testData.code, testData.entryPoint, actualMaps, globalData);
return checkCode(config.name, testData.testFileUri, testData.code,
@@ -227,9 +266,11 @@
}
}
}
+ // Use class offset for members not declared in the class.
+ return declaration.offset;
}
}
- throw StateError('Member not found: $className.$name');
+ return 0;
}
for (var declaration in unit.declarations) {
if (declaration is FunctionDeclaration) {
@@ -244,7 +285,25 @@
}
}
}
- throw StateError('Member not found: $name');
+ return 0;
+ } else if (id is ClassId) {
+ var className = id.className;
+ var unit =
+ parseString(content: code[uri].sourceCode, throwIfDiagnostics: false)
+ .unit;
+ for (var declaration in unit.declarations) {
+ if (declaration is ClassDeclaration &&
+ declaration.name.name == className) {
+ return declaration.offset;
+ }
+ }
+ return 0;
+ } else if (id is LibraryId) {
+ var unit =
+ parseString(content: code[uri].sourceCode, throwIfDiagnostics: false)
+ .unit;
+ var offset = unit?.declaredElement?.library?.nameOffset ?? -1;
+ return offset >= 0 ? offset : 0;
} else {
throw StateError('Unexpected id ${id.runtimeType}');
}
@@ -268,6 +327,18 @@
/// for the data origin.
void computeUnitData(TestingData testingData, CompilationUnit unit,
Map<Id, ActualData<T>> actualMap);
+
+ /// Returns `true` if this data computer supports tests with compile-time
+ /// errors.
+ ///
+ /// Unsuccessful compilation might leave the compiler in an inconsistent
+ /// state, so this testing feature is opt-in.
+ bool get supportsErrors => false;
+
+ /// Returns data corresponding to [error].
+ T computeErrorData(TestConfig config, TestingData testingData, Id id,
+ List<AnalysisError> errors) =>
+ null;
}
class TestConfig {
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index 00dbad9..96b84bd 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -1479,7 +1479,7 @@
#### Examples
-The following code generates this diagnostic:
+The following code produces this diagnostic:
{% prettify dart %}
var map = <String, int>{'a': 0, 'b': 1, [!'c'!]};
@@ -2652,7 +2652,7 @@
class A {}
class C {
- factory [!A!]() => null;
+ factory [!A!]() => throw 0;
}
{% endprettify %}
@@ -2665,7 +2665,7 @@
class A {}
class C {
- factory C() => null;
+ factory C() => throw 0;
}
{% endprettify %}
@@ -2674,7 +2674,7 @@
{% prettify dart %}
class A {
- factory A() => null;
+ factory A() => throw 0;
}
class C {}
@@ -2688,7 +2688,7 @@
class A {}
class C {
- static A a() => null;
+ static A a() => throw 0;
}
{% endprettify %}
@@ -4226,7 +4226,7 @@
#### Examples
-The following code generates this diagnostic:
+The following code produces this diagnostic:
{% prettify dart %}
var m = <String, int>{'a': 0, 'b': 1};
@@ -4540,7 +4540,7 @@
The following code produces this diagnostic because `f` is a function:
{% prettify dart %}
-C f() => null;
+C f() => throw 0;
class C {
factory C() = [!f!];
@@ -4559,7 +4559,7 @@
the constructor to return the value from the constructor's body:
{% prettify dart %}
-C f() => null;
+C f() => throw 0;
class C {
factory C() => f();
@@ -4785,7 +4785,7 @@
sdk: '>=2.1.0 <2.4.0'
```
-In the package that has that pubspec, code like the following generates
+In the package that has that pubspec, code like the following produces
this diagnostic:
{% prettify dart %}
@@ -4943,7 +4943,7 @@
sdk: '>=2.4.0 <2.7.0'
```
-In the package that has that pubspec, code like the following generates
+In the package that has that pubspec, code like the following produces
this diagnostic:
{% prettify dart %}
@@ -4999,7 +4999,7 @@
sdk: '>=2.1.0 <2.4.0'
```
-In the package that has that pubspec, code like the following generates
+In the package that has that pubspec, code like the following produces
this diagnostic:
{% prettify dart %}
@@ -5096,7 +5096,7 @@
sdk: '>=2.2.0 <2.4.0'
```
-In the package that has that pubspec, code like the following generates
+In the package that has that pubspec, code like the following produces
this diagnostic:
{% prettify dart %}
@@ -5152,7 +5152,7 @@
sdk: '>=2.4.0 <2.6.0'
```
-In the package that has that pubspec, code like the following generates
+In the package that has that pubspec, code like the following produces
this diagnostic:
{% prettify dart %}
diff --git a/pkg/analyzer_cli/tool/perf.dart b/pkg/analyzer_cli/tool/perf.dart
index d50e5db..a480e85 100644
--- a/pkg/analyzer_cli/tool/perf.dart
+++ b/pkg/analyzer_cli/tool/perf.dart
@@ -83,9 +83,12 @@
/// Uses the diet-parser to parse only directives in [source].
CompilationUnit parseDirectives(Source source) {
var token = tokenize(source);
- var featureSet = FeatureSet.fromEnableFlags([]);
- var parser = Parser(source, AnalysisErrorListener.NULL_LISTENER,
- featureSet: featureSet);
+ var parser = Parser(
+ source,
+ AnalysisErrorListener.NULL_LISTENER,
+ languageVersion: null,
+ featureSet: FeatureSet.fromEnableFlags([]),
+ );
return parser.parseDirectives(token);
}
@@ -115,9 +118,12 @@
/// Parse the full body of [source] and return it's compilation unit.
CompilationUnit parseFull(Source source) {
var token = tokenize(source);
- var featureSet = FeatureSet.fromEnableFlags([]);
- var parser = Parser(source, AnalysisErrorListener.NULL_LISTENER,
- featureSet: featureSet);
+ var parser = Parser(
+ source,
+ AnalysisErrorListener.NULL_LISTENER,
+ languageVersion: null,
+ featureSet: FeatureSet.fromEnableFlags([]),
+ );
return parser.parseCompilationUnit(token);
}
diff --git a/pkg/analyzer_plugin/test/src/utilities/visitors/local_declaration_visitor_test.dart b/pkg/analyzer_plugin/test/src/utilities/visitors/local_declaration_visitor_test.dart
index 78a03aa..80c31da 100644
--- a/pkg/analyzer_plugin/test/src/utilities/visitors/local_declaration_visitor_test.dart
+++ b/pkg/analyzer_plugin/test/src/utilities/visitors/local_declaration_visitor_test.dart
@@ -2,14 +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:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/error/listener.dart';
-import 'package:analyzer/src/dart/scanner/reader.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
-import 'package:analyzer/src/generated/parser.dart';
-import 'package:analyzer/src/string_source.dart';
import 'package:analyzer_plugin/src/utilities/visitors/local_declaration_visitor.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -23,16 +17,7 @@
@reflectiveTest
class LocalDeclarationVisitorTest {
CompilationUnit parseCompilationUnit(String content) {
- AnalysisErrorListener listener = AnalysisErrorListener.NULL_LISTENER;
- var featureSet = FeatureSet.forTesting(sdkVersion: '2.2.2');
- Scanner scanner = Scanner(null, CharSequenceReader(content), listener)
- ..configureFeatures(featureSet);
- Token token = scanner.tokenize();
- var source = StringSource(content, '/test.dart');
- Parser parser = Parser(source, listener, featureSet: featureSet);
- CompilationUnit unit = parser.parseCompilationUnit(token);
- expect(unit, isNotNull);
- return unit;
+ return parseString(content: content).unit;
}
void test_visitForEachStatement() {
diff --git a/pkg/analyzer_plugin/test/utilities/completion/completion_target_test.dart b/pkg/analyzer_plugin/test/utilities/completion/completion_target_test.dart
deleted file mode 100644
index 9333c75..0000000
--- a/pkg/analyzer_plugin/test/utilities/completion/completion_target_test.dart
+++ /dev/null
@@ -1,79 +0,0 @@
-// 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:analyzer/dart/analysis/features.dart';
-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/error/error.dart';
-import 'package:analyzer/error/listener.dart';
-import 'package:analyzer/src/dart/ast/token.dart'
- show SyntheticBeginToken, SyntheticToken;
-import 'package:analyzer/src/dart/scanner/reader.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
-import 'package:analyzer/src/generated/parser.dart';
-import 'package:analyzer/src/string_source.dart';
-import 'package:analyzer_plugin/src/utilities/completion/completion_target.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-void main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(CompletionTargetTest);
- });
-}
-
-@reflectiveTest
-class CompletionTargetTest {
- /// Parse a dangling expression (no parent node). The angular plugin, for
- /// instance, does this.
- Expression parseDanglingDart(String code) {
- final reader = CharSequenceReader(code);
- var featureSet = FeatureSet.forTesting(sdkVersion: '2.2.2');
- final scanner = Scanner(null, reader, null)..configureFeatures(featureSet);
- final source = StringSource(code, 'test.dart');
- final listener = _ErrorCollector();
- final parser = Parser(source, listener, featureSet: featureSet);
-
- return parser.parseExpression(scanner.tokenize());
- }
-
- void test_danglingExpressionCompletionIsValid() {
- // Test that users can parse dangling expressions of dart and autocomplete
- // them without crash/with the correct offset information.
- final snippet = wrapForCompliance(parseDanglingDart('identifier'));
- final completionTarget =
- // ignore: deprecated_member_use
- CompletionTarget.forOffset(null, 1, entryPoint: snippet);
- expect(completionTarget.offset, 1);
- final replacementRange = completionTarget.computeReplacementRange(1);
- expect(replacementRange.offset, 0);
- expect(replacementRange.length, 'identifier'.length);
- }
-
- Expression wrapForCompliance(Expression expression) {
- // TODO(mfairhurst) This should be performed for clients or the need should
- // be dropped. It's a fairly valid invariant that all autocompletion target
- // expressions should have parents, and one we can enforce via synthetics.
- // But clients should not be doing this ideally.
- return astFactory.parenthesizedExpression(
- SyntheticBeginToken(TokenType.OPEN_PAREN, expression.offset)
- ..next = expression.beginToken,
- expression,
- SyntheticToken(TokenType.CLOSE_PAREN, expression.end));
- }
-}
-
-/// A simple error listener that collects errors into an [AnalyzerErrorGroup].
-class _ErrorCollector extends AnalysisErrorListener {
- final _errors = <AnalysisError>[];
-
- _ErrorCollector();
-
- /// Whether any errors where collected.
- bool get hasErrors => _errors.isNotEmpty;
-
- @override
- void onError(AnalysisError error) => _errors.add(error);
-}
diff --git a/pkg/analyzer_plugin/test/utilities/completion/test_all.dart b/pkg/analyzer_plugin/test/utilities/completion/test_all.dart
index 5fd7132..9af46c6 100644
--- a/pkg/analyzer_plugin/test/utilities/completion/test_all.dart
+++ b/pkg/analyzer_plugin/test/utilities/completion/test_all.dart
@@ -4,7 +4,6 @@
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import 'completion_target_test.dart' as completion_target_test;
import 'inherited_reference_contributor_test.dart'
as inherited_reference_contributor_test;
import 'type_member_contributor_test.dart' as type_member_contributor_test;
@@ -13,6 +12,5 @@
defineReflectiveSuite(() {
inherited_reference_contributor_test.main();
type_member_contributor_test.main();
- completion_target_test.main();
}, name: 'subscriptions');
}
diff --git a/pkg/async_helper/lib/async_minitest.dart b/pkg/async_helper/lib/async_minitest.dart
index a52b2a8..3668aba 100644
--- a/pkg/async_helper/lib/async_minitest.dart
+++ b/pkg/async_helper/lib/async_minitest.dart
@@ -151,61 +151,61 @@
}
// Matchers
-typedef Matcher = void Function(Object);
+typedef Matcher = void Function(dynamic);
-Matcher same(Object o) => (v) {
+Matcher same(dynamic o) => (v) {
Expect.identical(o, v);
};
-Matcher equals(Object o) => (v) {
+Matcher equals(dynamic o) => (v) {
Expect.deepEquals(o, v);
};
-Matcher greaterThan(num n) => (Object v) {
+Matcher greaterThan(num n) => (dynamic v) {
Expect.type<num>(v);
num value = v;
if (value > n) return;
Expect.fail("$v is not greater than $n");
};
-Matcher greaterThanOrEqualTo(num n) => (Object v) {
+Matcher greaterThanOrEqualTo(num n) => (dynamic v) {
Expect.type<num>(v);
num value = v;
if (value >= n) return;
Expect.fail("$v is not greater than $n");
};
-Matcher lessThan(num n) => (Object v) {
+Matcher lessThan(num n) => (dynamic v) {
Expect.type<num>(v);
num value = v;
if (value < n) return;
Expect.fail("$v is not less than $n");
};
-Matcher lessThanOrEqualTo(num n) => (Object v) {
+Matcher lessThanOrEqualTo(num n) => (dynamic v) {
Expect.type<num>(v);
num value = v;
if (value <= n) return;
Expect.fail("$v is not less than $n");
};
-void isTrue(Object v) {
+void isTrue(dynamic v) {
Expect.isTrue(v);
}
-void isFalse(Object v) {
+void isFalse(dynamic v) {
Expect.isFalse(v);
}
-void isNull(Object o) {
+void isNull(dynamic o) {
Expect.isNull(o);
}
-bool isStateError(Object o) {
+bool isStateError(dynamic o) {
Expect.type<StateError>(o);
}
-void _checkThrow<T>(Object v, void onError(error)) {
+void _checkThrow<T>(dynamic v, void onError(error)) {
if (v is Future) {
var test = _currentTest..asyncWait();
v.then((_) {
@@ -223,17 +223,17 @@
});
}
-void throws(Object v) {
- _checkThrow<Object>(v, null);
+void throws(dynamic v) {
+ _checkThrow<Object>(v, (_) {});
}
-Matcher throwsA(matcher) => (Object o) {
- _checkThrow<Object>(o, (Object error) {
+Matcher throwsA(matcher) => (dynamic o) {
+ _checkThrow<Object>(o, (error) {
expect(error, matcher);
});
};
-Matcher completion(matcher) => (Object o) {
+Matcher completion(matcher) => (dynamic o) {
Expect.type<Future>(o);
Future future = o;
_currentTest.asyncWait();
@@ -243,7 +243,7 @@
});
};
-void completes(Object o) {
+void completes(dynamic o) {
Expect.type<Future>(o);
Future future = o;
_currentTest.asyncWait();
@@ -252,30 +252,30 @@
});
}
-void isMap(Object o) {
+void isMap(dynamic o) {
Expect.type<Map>(o);
}
-void isList(Object o) {
+void isList(dynamic o) {
Expect.type<List>(o);
}
-void isNotNull(Object o) {
+void isNotNull(dynamic o) {
Expect.isNotNull(o);
}
abstract class _Matcher {
- void call(Object o);
+ void call(dynamic o);
}
class isInstanceOf<T> implements _Matcher {
- void call(Object o) {
+ void call(dynamic o) {
Expect.type<T>(o);
}
}
-void throwsArgumentError(Object v) {
- _checkThrow<ArgumentError>(v, null);
+void throwsArgumentError(dynamic v) {
+ _checkThrow<ArgumentError>(v, (_) {});
}
String fail(String message) {
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index 2429d36..89edda7 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -5,7 +5,6 @@
import 'package:kernel/ast.dart' as ir;
import 'common.dart';
import 'elements/entities.dart';
-import 'elements/types.dart';
import 'js_model/closure.dart';
import 'js_model/element_map.dart';
import 'serialization/serialization.dart';
@@ -345,12 +344,12 @@
/// A type variable as a local variable.
class TypeVariableLocal implements Local {
- final TypeVariableType typeVariable;
+ final TypeVariableEntity typeVariable;
TypeVariableLocal(this.typeVariable);
@override
- String get name => typeVariable.element.name;
+ String get name => typeVariable.name;
@override
int get hashCode => typeVariable.hashCode;
diff --git a/pkg/compiler/lib/src/common_elements.dart b/pkg/compiler/lib/src/common_elements.dart
index dfd9047..3a77982 100644
--- a/pkg/compiler/lib/src/common_elements.dart
+++ b/pkg/compiler/lib/src/common_elements.dart
@@ -178,38 +178,37 @@
/// [elementType] as its type argument.
///
/// If no type argument is provided, the canonical raw type is returned.
- InterfaceType listType(Nullability nullability, [DartType elementType]);
+ InterfaceType listType([DartType elementType]);
/// Returns an instance of the `Set` type defined in 'dart:core' with
/// [elementType] as its type argument.
///
/// If no type argument is provided, the canonical raw type is returned.
- InterfaceType setType(Nullability nullability, [DartType elementType]);
+ InterfaceType setType([DartType elementType]);
/// Returns an instance of the `Map` type defined in 'dart:core' with
/// [keyType] and [valueType] as its type arguments.
///
/// If no type arguments are provided, the canonical raw type is returned.
- InterfaceType mapType(Nullability nullability,
- [DartType keyType, DartType valueType]);
+ InterfaceType mapType([DartType keyType, DartType valueType]);
/// Returns an instance of the `Iterable` type defined in 'dart:core' with
/// [elementType] as its type argument.
///
/// If no type argument is provided, the canonical raw type is returned.
- InterfaceType iterableType(Nullability nullability, [DartType elementType]);
+ InterfaceType iterableType([DartType elementType]);
/// Returns an instance of the `Future` type defined in 'dart:async' with
/// [elementType] as its type argument.
///
/// If no type argument is provided, the canonical raw type is returned.
- InterfaceType futureType(Nullability nullability, [DartType elementType]);
+ InterfaceType futureType([DartType elementType]);
/// Returns an instance of the `Stream` type defined in 'dart:async' with
/// [elementType] as its type argument.
///
/// If no type argument is provided, the canonical raw type is returned.
- InterfaceType streamType(Nullability nullability, [DartType elementType]);
+ InterfaceType streamType([DartType elementType]);
/// Returns `true` if [element] is a superclass of `String` or `num`.
bool isNumberOrStringSupertype(ClassEntity element);
@@ -929,24 +928,23 @@
InterfaceType get stackTraceType => _getRawType(stackTraceClass);
@override
- InterfaceType listType(Nullability nullability, [DartType elementType]) {
+ InterfaceType listType([DartType elementType]) {
if (elementType == null) {
return _getRawType(listClass);
}
- return _createInterfaceType(listClass, [elementType], nullability);
+ return _createInterfaceType(listClass, [elementType]);
}
@override
- InterfaceType setType(Nullability nullability, [DartType elementType]) {
+ InterfaceType setType([DartType elementType]) {
if (elementType == null) {
return _getRawType(setClass);
}
- return _createInterfaceType(setClass, [elementType], nullability);
+ return _createInterfaceType(setClass, [elementType]);
}
@override
- InterfaceType mapType(Nullability nullability,
- [DartType keyType, DartType valueType]) {
+ InterfaceType mapType([DartType keyType, DartType valueType]) {
if (keyType == null && valueType == null) {
return _getRawType(mapClass);
} else if (keyType == null) {
@@ -954,31 +952,31 @@
} else if (valueType == null) {
valueType = dynamicType;
}
- return _createInterfaceType(mapClass, [keyType, valueType], nullability);
+ return _createInterfaceType(mapClass, [keyType, valueType]);
}
@override
- InterfaceType iterableType(Nullability nullability, [DartType elementType]) {
+ InterfaceType iterableType([DartType elementType]) {
if (elementType == null) {
return _getRawType(iterableClass);
}
- return _createInterfaceType(iterableClass, [elementType], nullability);
+ return _createInterfaceType(iterableClass, [elementType]);
}
@override
- InterfaceType futureType(Nullability nullability, [DartType elementType]) {
+ InterfaceType futureType([DartType elementType]) {
if (elementType == null) {
return _getRawType(futureClass);
}
- return _createInterfaceType(futureClass, [elementType], nullability);
+ return _createInterfaceType(futureClass, [elementType]);
}
@override
- InterfaceType streamType(Nullability nullability, [DartType elementType]) {
+ InterfaceType streamType([DartType elementType]) {
if (elementType == null) {
return _getRawType(streamClass);
}
- return _createInterfaceType(streamClass, [elementType], nullability);
+ return _createInterfaceType(streamClass, [elementType]);
}
@override
@@ -1026,16 +1024,15 @@
/// Create the instantiation of [cls] with the given [typeArguments] and
/// [nullability].
InterfaceType _createInterfaceType(
- ClassEntity cls, List<DartType> typeArguments, Nullability nullability) {
- return _env.createInterfaceType(cls, typeArguments, nullability);
+ ClassEntity cls, List<DartType> typeArguments) {
+ return _env.createInterfaceType(cls, typeArguments);
}
@override
InterfaceType getConstantListTypeFor(InterfaceType sourceType) =>
dartTypes.treatAsRawType(sourceType)
? _env.getRawType(jsArrayClass)
- : _env.createInterfaceType(
- jsArrayClass, sourceType.typeArguments, sourceType.nullability);
+ : _env.createInterfaceType(jsArrayClass, sourceType.typeArguments);
@override
InterfaceType getConstantMapTypeFor(InterfaceType sourceType,
@@ -1046,8 +1043,7 @@
if (dartTypes.treatAsRawType(sourceType)) {
return _env.getRawType(classElement);
} else {
- return _env.createInterfaceType(
- classElement, sourceType.typeArguments, sourceType.nullability);
+ return _env.createInterfaceType(classElement, sourceType.typeArguments);
}
}
@@ -1055,8 +1051,8 @@
InterfaceType getConstantSetTypeFor(InterfaceType sourceType) =>
dartTypes.treatAsRawType(sourceType)
? _env.getRawType(constSetLiteralClass)
- : _env.createInterfaceType(constSetLiteralClass,
- sourceType.typeArguments, sourceType.nullability);
+ : _env.createInterfaceType(
+ constSetLiteralClass, sourceType.typeArguments);
@override
FieldEntity get symbolField => symbolImplementationField;
@@ -2292,7 +2288,7 @@
/// Create the instantiation of [cls] with the given [typeArguments] and
/// [nullability].
InterfaceType createInterfaceType(
- ClassEntity cls, List<DartType> typeArguments, Nullability nullability);
+ ClassEntity cls, List<DartType> typeArguments);
/// Returns the `dynamic` type.
DartType get dynamicType;
diff --git a/pkg/compiler/lib/src/constants/constant_system.dart b/pkg/compiler/lib/src/constants/constant_system.dart
index de5ed0b..afbb8f4 100644
--- a/pkg/compiler/lib/src/constants/constant_system.dart
+++ b/pkg/compiler/lib/src/constants/constant_system.dart
@@ -142,8 +142,8 @@
InterfaceType sourceType, List<ConstantValue> values) {
InterfaceType type = commonElements.getConstantSetTypeFor(sourceType);
DartType elementType = type.typeArguments.first;
- InterfaceType mapType = commonElements.mapType(
- Nullability.none, elementType, commonElements.nullType);
+ InterfaceType mapType =
+ commonElements.mapType(elementType, commonElements.nullType);
List<NullConstantValue> nulls = new List<NullConstantValue>.filled(
values.length, const NullConstantValue());
MapConstantValue entries = createMap(commonElements, mapType, values, nulls);
@@ -174,10 +174,9 @@
bool hasProtoKey = (protoValue != null);
InterfaceType keysType;
if (commonElements.dartTypes.treatAsRawType(sourceType)) {
- keysType = commonElements.listType(Nullability.none);
+ keysType = commonElements.listType();
} else {
- keysType = commonElements.listType(
- Nullability.none, sourceType.typeArguments.first);
+ keysType = commonElements.listType(sourceType.typeArguments.first);
}
ListConstantValue keysList = createList(commonElements, keysType, keys);
InterfaceType type = commonElements.getConstantMapTypeFor(sourceType,
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index 6ee4b90..7083e91 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -1653,6 +1653,16 @@
}
@override
+ void visitLegacyType(LegacyType type, Null argument) {
+ visit(type.baseType);
+ }
+
+ @override
+ void visitNullableType(NullableType type, Null argument) {
+ visit(type.baseType);
+ }
+
+ @override
void visitFutureOrType(FutureOrType type, Null argument) {
_dependencies.addClass(_commonElements.futureClass);
visit(type.typeArgument);
diff --git a/pkg/compiler/lib/src/elements/types.dart b/pkg/compiler/lib/src/elements/types.dart
index bfcf8c5..db6165b 100644
--- a/pkg/compiler/lib/src/elements/types.dart
+++ b/pkg/compiler/lib/src/elements/types.dart
@@ -23,22 +23,6 @@
/// implemented directly but other entity systems, for instance based directly
/// on kernel ir without the need for [Element].
-enum Nullability {
- none,
- question,
- star,
-}
-
-extension NullabilityUtils on Nullability {
- bool get isNone => this == Nullability.none;
- bool get isQuestion => this == Nullability.question;
- bool get isStar => this == Nullability.star;
- bool get isPotentiallyNull => isQuestion || isStar;
- bool get isPotentiallyNonNull => isNone || isStar;
-
- int compareTo(Nullability other) => index.compareTo(other.index);
-}
-
extension on DataSource {
List<DartType> _readDartTypes(
List<FunctionTypeVariable> functionTypeVariables) {
@@ -62,8 +46,6 @@
}
abstract class DartType {
- Nullability get nullability;
-
const DartType();
factory DartType.readFromDataSource(
@@ -72,6 +54,10 @@
switch (kind) {
case DartTypeKind.none:
return null;
+ case DartTypeKind.legacyType:
+ return LegacyType._readFromDataSource(source, functionTypeVariables);
+ case DartTypeKind.nullableType:
+ return NullableType._readFromDataSource(source, functionTypeVariables);
case DartTypeKind.neverType:
return NeverType._readFromDataSource(source, functionTypeVariables);
case DartTypeKind.voidType:
@@ -101,37 +87,21 @@
void writeToDataSink(
DataSink sink, List<FunctionTypeVariable> functionTypeVariables);
- /// Returns a new type formed by replacing the current [nullability] with the
- /// specified one.
- ///
- /// Caution: This directly manipulates the type without renormalizing.
- DartType _withNullability(Nullability nullability);
+ /// Returns the base type if this is a [LegacyType] or [NullableType] and
+ /// returns this type otherwise.
+ DartType get withoutNullability => this;
- /// Returns a new type formed by removing the [nullability] suffix from this
- /// type.
- DartType get _toNonNullable => _withNullability(Nullability.none);
-
- /// Returns a new type formed by replacing the [nullability] suffix on this
- /// type with [Nullability.question].
- /// Caution: This directly manipulates the type without renormalizing.
- DartType get _toNullable => _withNullability(Nullability.question);
-
- /// Returns a new type formed by replacing the [nullability] suffix on this
- /// type with [Nullability.star].
- /// Caution: This directly manipulates the type without renormalizing.
- DartType get _toLegacy => _withNullability(Nullability.star);
+ /// Is `true` if this type is a top type but not a legacy top type.
+ bool _isStrongTop(bool useNullSafety) => false;
/// Is `true` if this type is a top type.
- bool _isTop(bool useNullSafety) => false;
+ bool _isTop(bool useNullSafety) => _isStrongTop(useNullSafety);
/// Is `true` if every type argument of this type is a top type.
// TODO(fishythefish): Should we instead check if each type argument is at its
// bound?
bool _treatAsRaw(bool useNullSafety) => true;
- /// Is `true` if this type is a top type but not a legacy top type.
- bool _isStrongTop(bool useNullSafety) => _isTop(useNullSafety);
-
/// Whether this type contains a type variable.
bool get containsTypeVariables => false;
@@ -236,21 +206,140 @@
}
}
+class LegacyType extends DartType {
+ final DartType baseType;
+
+ const LegacyType._(this.baseType);
+
+ factory LegacyType._readFromDataSource(
+ DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
+ DartType baseType =
+ DartType.readFromDataSource(source, functionTypeVariables);
+ return LegacyType._(baseType);
+ }
+
+ @override
+ void writeToDataSink(
+ DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
+ sink.writeEnum(DartTypeKind.legacyType);
+ baseType.writeToDataSink(sink, functionTypeVariables);
+ }
+
+ @override
+ DartType get withoutNullability => baseType;
+
+ @override
+ bool _isTop(bool useNullSafety) => baseType.isObject;
+
+ @override
+ bool _treatAsRaw(bool useNullSafety) => baseType._treatAsRaw(useNullSafety);
+
+ @override
+ bool get containsTypeVariables => baseType.containsTypeVariables;
+
+ @override
+ void forEachTypeVariable(f(TypeVariableType variable)) {
+ baseType.forEachTypeVariable(f);
+ }
+
+ @override
+ R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
+ visitor.visitLegacyType(this, argument);
+
+ @override
+ int get hashCode => baseType.hashCode * 31;
+
+ @override
+ bool operator ==(other) {
+ if (identical(this, other)) return true;
+ if (other is! LegacyType) return false;
+ return _equalsInternal(other, null);
+ }
+
+ @override
+ bool _equals(DartType other, _Assumptions assumptions) {
+ if (identical(this, other)) return true;
+ if (other is! LegacyType) return false;
+ return _equalsInternal(other, assumptions);
+ }
+
+ bool _equalsInternal(LegacyType other, _Assumptions assumptions) =>
+ baseType._equals(other.baseType, assumptions);
+}
+
+class NullableType extends DartType {
+ final DartType baseType;
+
+ const NullableType._(this.baseType);
+
+ factory NullableType._readFromDataSource(
+ DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
+ DartType baseType =
+ DartType.readFromDataSource(source, functionTypeVariables);
+ return NullableType._(baseType);
+ }
+
+ @override
+ void writeToDataSink(
+ DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
+ sink.writeEnum(DartTypeKind.nullableType);
+ baseType.writeToDataSink(sink, functionTypeVariables);
+ }
+
+ @override
+ DartType get withoutNullability => baseType;
+
+ @override
+ bool _isStrongTop(bool isLegacy) => baseType.isObject;
+
+ @override
+ bool _treatAsRaw(bool useNullSafety) => baseType._treatAsRaw(useNullSafety);
+
+ @override
+ bool get containsTypeVariables => baseType.containsTypeVariables;
+
+ @override
+ void forEachTypeVariable(f(TypeVariableType variable)) {
+ baseType.forEachTypeVariable(f);
+ }
+
+ @override
+ R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
+ visitor.visitNullableType(this, argument);
+
+ @override
+ int get hashCode => baseType.hashCode * 37;
+
+ @override
+ bool operator ==(other) {
+ if (identical(this, other)) return true;
+ if (other is! NullableType) return false;
+ return _equalsInternal(other, null);
+ }
+
+ @override
+ bool _equals(DartType other, _Assumptions assumptions) {
+ if (identical(this, other)) return true;
+ if (other is! NullableType) return false;
+ return _equalsInternal(other, assumptions);
+ }
+
+ bool _equalsInternal(NullableType other, _Assumptions assumptions) =>
+ baseType._equals(other.baseType, assumptions);
+}
+
class InterfaceType extends DartType {
final ClassEntity element;
final List<DartType> typeArguments;
- @override
- final Nullability nullability;
- InterfaceType._(this.element, this.typeArguments, this.nullability)
+ InterfaceType._(this.element, this.typeArguments)
: assert(typeArguments.every((e) => e != null));
factory InterfaceType._readFromDataSource(
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
ClassEntity element = source.readClass();
List<DartType> typeArguments = source._readDartTypes(functionTypeVariables);
- Nullability nullability = source.readEnum(Nullability.values);
- return InterfaceType._(element, typeArguments, nullability);
+ return InterfaceType._(element, typeArguments);
}
@override
@@ -259,20 +348,10 @@
sink.writeEnum(DartTypeKind.interfaceType);
sink.writeClass(element);
sink._writeDartTypes(typeArguments, functionTypeVariables);
- sink.writeEnum(nullability);
}
@override
- DartType _withNullability(Nullability nullability) =>
- InterfaceType._(element, typeArguments, nullability);
-
- @override
- bool _isTop(bool useNullSafety) =>
- isObject && (!useNullSafety || nullability.isPotentiallyNull);
-
- @override
- bool _isStrongTop(bool useNullSafety) =>
- isObject && (!useNullSafety || nullability.isQuestion);
+ bool _isStrongTop(bool useNullSafety) => useNullSafety ? false : isObject;
@override
bool get isObject =>
@@ -311,7 +390,6 @@
int argumentHash = argument != null ? argument.hashCode : 0;
hash = 17 * hash + 3 * argumentHash;
}
- hash = 17 * hash + nullability.hashCode;
return hash;
}
@@ -330,24 +408,20 @@
}
bool _equalsInternal(InterfaceType other, _Assumptions assumptions) {
- return nullability == other.nullability &&
- identical(element, other.element) &&
+ return identical(element, other.element) &&
_equalTypes(typeArguments, other.typeArguments, assumptions);
}
}
class TypeVariableType extends DartType {
final TypeVariableEntity element;
- @override
- final Nullability nullability;
- const TypeVariableType._(this.element, this.nullability);
+ const TypeVariableType._(this.element);
factory TypeVariableType._readFromDataSource(
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
TypeVariableEntity element = source.readTypeVariable();
- Nullability nullability = source.readEnum(Nullability.values);
- return TypeVariableType._(element, nullability);
+ return TypeVariableType._(element);
}
@override
@@ -355,14 +429,9 @@
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
sink.writeEnum(DartTypeKind.typeVariable);
sink.writeTypeVariable(element);
- sink.writeEnum(nullability);
}
@override
- DartType _withNullability(Nullability nullability) =>
- TypeVariableType._(element, nullability);
-
- @override
bool get containsTypeVariables => true;
@override
@@ -375,14 +444,12 @@
visitor.visitTypeVariableType(this, argument);
@override
- int get hashCode => 17 * element.hashCode + nullability.hashCode;
+ int get hashCode => 17 * element.hashCode;
@override
bool operator ==(other) =>
identical(this, other) ||
- other is TypeVariableType &&
- nullability == other.nullability &&
- identical(other.element, element);
+ other is TypeVariableType && identical(other.element, element);
@override
bool _equals(DartType other, _Assumptions assumptions) => this == other;
@@ -402,13 +469,10 @@
/// type.
final int index;
- @override
- final Nullability nullability;
-
/// The bound of this function type variable.
DartType _bound;
- FunctionTypeVariable._(this.index, this.nullability);
+ FunctionTypeVariable._(this.index);
factory FunctionTypeVariable._readFromDataSource(
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
@@ -430,10 +494,6 @@
}
}
- @override
- DartType _withNullability(Nullability nullability) =>
- FunctionTypeVariable._(index, nullability)..bound = bound;
-
DartType get bound {
assert(_bound != null, "Bound has not been set.");
return _bound;
@@ -448,7 +508,6 @@
bool _equals(DartType other, _Assumptions assumptions) {
if (identical(this, other)) return true;
if (other is! FunctionTypeVariable) return false;
- if (nullability != other.nullability) return false;
if (assumptions != null) return assumptions.isAssumed(this, other);
return false;
}
@@ -459,39 +518,28 @@
}
class NeverType extends DartType {
- @override
- final Nullability nullability;
-
- const NeverType._(this.nullability);
+ const NeverType._();
factory NeverType._readFromDataSource(
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
- Nullability nullability = source.readEnum(Nullability.values);
- return NeverType._(nullability);
+ return const NeverType._();
}
@override
void writeToDataSink(
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
sink.writeEnum(DartTypeKind.neverType);
- sink.writeEnum(nullability);
}
@override
- DartType _withNullability(Nullability nullability) =>
- NeverType._(nullability);
-
- @override
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
visitor.visitNeverType(this, argument);
@override
- int get hashCode => nullability.hashCode;
+ int get hashCode => 43;
@override
- bool operator ==(other) =>
- identical(this, other) ||
- other is NeverType && nullability == other.nullability;
+ bool operator ==(other) => identical(this, other) || other is NeverType;
@override
bool _equals(DartType other, _Assumptions assumptions) => this == other;
@@ -511,13 +559,7 @@
}
@override
- Nullability get nullability => Nullability.none;
-
- @override
- DartType _withNullability(Nullability nullability) => this;
-
- @override
- bool _isTop(bool useNullSafety) => true;
+ bool _isStrongTop(bool useNullSafety) => true;
@override
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
@@ -547,13 +589,7 @@
}
@override
- Nullability get nullability => Nullability.none;
-
- @override
- DartType _withNullability(Nullability nullability) => this;
-
- @override
- bool _isTop(bool useNullSafety) => true;
+ bool _isStrongTop(bool useNullSafety) => true;
@override
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
@@ -583,13 +619,7 @@
}
@override
- Nullability get nullability => Nullability.none;
-
- @override
- DartType _withNullability(Nullability nullability) => this;
-
- @override
- bool _isTop(bool useNullSafety) => true;
+ bool _isStrongTop(bool useNullSafety) => true;
@override
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
@@ -630,13 +660,7 @@
}
@override
- Nullability get nullability => Nullability.none;
-
- @override
- DartType _withNullability(Nullability nullability) => this;
-
- @override
- bool _isTop(bool useNullSafety) => true;
+ bool _isStrongTop(bool useNullSafety) => true;
@override
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
@@ -666,17 +690,13 @@
final List<FunctionTypeVariable> typeVariables;
- @override
- final Nullability nullability;
-
FunctionType._(
this.returnType,
this.parameterTypes,
this.optionalParameterTypes,
this.namedParameters,
this.namedParameterTypes,
- this.typeVariables,
- this.nullability) {
+ this.typeVariables) {
assert(returnType != null, "Invalid return type in $this.");
assert(!parameterTypes.contains(null), "Invalid parameter types in $this.");
assert(!optionalParameterTypes.contains(null),
@@ -692,10 +712,8 @@
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
int typeVariableCount = source.readInt();
List<FunctionTypeVariable> typeVariables =
- List<FunctionTypeVariable>.generate(typeVariableCount, (int index) {
- Nullability nullability = source.readEnum(Nullability.values);
- return FunctionTypeVariable._(index, nullability);
- });
+ List<FunctionTypeVariable>.generate(
+ typeVariableCount, (int index) => FunctionTypeVariable._(index));
functionTypeVariables = List<FunctionTypeVariable>.of(functionTypeVariables)
..addAll(typeVariables);
for (int index = 0; index < typeVariableCount; index++) {
@@ -714,9 +732,8 @@
for (int i = 0; i < namedParameters.length; i++) {
namedParameters[i] = source.readString();
}
- Nullability nullability = source.readEnum(Nullability.values);
return FunctionType._(returnType, parameterTypes, optionalParameterTypes,
- namedParameters, namedParameterTypes, typeVariables, nullability);
+ namedParameters, namedParameterTypes, typeVariables);
}
@override
@@ -727,9 +744,6 @@
..addAll(typeVariables);
sink.writeInt(typeVariables.length);
for (FunctionTypeVariable variable in typeVariables) {
- sink.writeEnum(variable.nullability);
- }
- for (FunctionTypeVariable variable in typeVariables) {
variable.bound.writeToDataSink(sink, functionTypeVariables);
}
returnType.writeToDataSink(sink, functionTypeVariables);
@@ -739,20 +753,9 @@
for (String namedParameter in namedParameters) {
sink.writeString(namedParameter);
}
- sink.writeEnum(nullability);
}
@override
- DartType _withNullability(Nullability nullability) => FunctionType._(
- returnType,
- parameterTypes,
- optionalParameterTypes,
- namedParameters,
- namedParameterTypes,
- typeVariables,
- nullability);
-
- @override
bool get containsTypeVariables {
return typeVariables.any((type) => type.bound.containsTypeVariables) ||
returnType.containsTypeVariables ||
@@ -789,7 +792,6 @@
for (DartType parameter in namedParameterTypes) {
hash = 29 * hash + 13 * parameter.hashCode;
}
- hash = 31 * hash + nullability.hashCode;
return hash;
}
@@ -808,7 +810,6 @@
}
bool _equalsInternal(FunctionType other, _Assumptions assumptions) {
- if (nullability != other.nullability) return false;
if (typeVariables.length != other.typeVariables.length) return false;
assumptions ??= _Assumptions();
assumptions.assumePairs(typeVariables, other.typeVariables);
@@ -836,17 +837,13 @@
class FutureOrType extends DartType {
final DartType typeArgument;
- @override
- final Nullability nullability;
-
- const FutureOrType._(this.typeArgument, this.nullability);
+ const FutureOrType._(this.typeArgument);
factory FutureOrType._readFromDataSource(
DataSource source, List<FunctionTypeVariable> functionTypeVariables) {
DartType typeArgument =
DartType.readFromDataSource(source, functionTypeVariables);
- Nullability nullability = source.readEnum(Nullability.values);
- return FutureOrType._(typeArgument, nullability);
+ return FutureOrType._(typeArgument);
}
@override
@@ -854,14 +851,9 @@
DataSink sink, List<FunctionTypeVariable> functionTypeVariables) {
sink.writeEnum(DartTypeKind.futureOr);
typeArgument.writeToDataSink(sink, functionTypeVariables);
- sink.writeEnum(nullability);
}
@override
- DartType _withNullability(Nullability nullability) =>
- FutureOrType._(typeArgument, nullability);
-
- @override
bool get containsTypeVariables => typeArgument.containsTypeVariables;
@override
@@ -874,7 +866,7 @@
visitor.visitFutureOrType(this, argument);
@override
- int get hashCode => typeArgument.hashCode * 13 + nullability.hashCode;
+ int get hashCode => typeArgument.hashCode * 13;
@override
bool operator ==(other) {
@@ -891,8 +883,7 @@
}
bool _equalsInternal(FutureOrType other, _Assumptions assumptions) {
- return nullability == other.nullability &&
- typeArgument._equals(other.typeArgument, assumptions);
+ return typeArgument._equals(other.typeArgument, assumptions);
}
}
@@ -911,6 +902,10 @@
R visit(covariant DartType type, A argument) => type.accept(this, argument);
+ R visitLegacyType(covariant LegacyType type, A argument) => null;
+
+ R visitNullableType(covariant NullableType type, A argument) => null;
+
R visitNeverType(covariant NeverType type, A argument) => null;
R visitVoidType(covariant VoidType type, A argument) => null;
@@ -940,6 +935,14 @@
R visitType(covariant DartType type, A argument);
@override
+ R visitLegacyType(covariant LegacyType type, A argument) =>
+ visitType(type, argument);
+
+ @override
+ R visitNullableType(covariant NullableType type, A argument) =>
+ visitType(type, argument);
+
+ @override
R visitNeverType(covariant NeverType type, A argument) =>
visitType(type, argument);
@@ -1012,6 +1015,32 @@
type;
@override
+ DartType visitLegacyType(covariant LegacyType type, A argument) {
+ DartType probe = _map[type];
+ if (probe != null) return probe;
+
+ DartType newBaseType = visit(type.baseType, argument);
+ // Create a new type only if necessary.
+ if (identical(type.baseType, newBaseType)) {
+ return _mapped(type, type);
+ }
+ return _mapped(type, dartTypes.legacyType(newBaseType));
+ }
+
+ @override
+ DartType visitNullableType(covariant NullableType type, A argument) {
+ DartType probe = _map[type];
+ if (probe != null) return probe;
+
+ DartType newBaseType = visit(type.baseType, argument);
+ // Create a new type only if necessary.
+ if (identical(type.baseType, newBaseType)) {
+ return _mapped(type, type);
+ }
+ return _mapped(type, dartTypes.nullableType(newBaseType));
+ }
+
+ @override
DartType visitNeverType(covariant NeverType type, A argument) => type;
@override
@@ -1062,7 +1091,7 @@
FunctionTypeVariable t = newTypeVariables[i];
if (identical(t, type.typeVariables[i])) continue;
DartType bound = t.bound;
- if (bound.nullability.isNone && bound is NeverType) {
+ if (bound is NeverType) {
normalizableVariables.add(t);
}
}
@@ -1070,8 +1099,8 @@
return _mapped(
type,
dartTypes.subst(
- List<DartType>.filled(normalizableVariables.length,
- dartTypes.neverType(Nullability.none)),
+ List<DartType>.filled(
+ normalizableVariables.length, dartTypes.neverType()),
normalizableVariables,
dartTypes.functionType(
newReturnType,
@@ -1079,8 +1108,7 @@
newOptionalParameterTypes,
type.namedParameters,
newNamedParameterTypes,
- newTypeVariables,
- type.nullability)));
+ newTypeVariables)));
}
List<FunctionTypeVariable> _handleFunctionTypeVariables(
@@ -1128,8 +1156,8 @@
changed = true;
undecided[i] = null;
newVariables ??= variables.toList();
- FunctionTypeVariable newVariable = dartTypes.functionTypeVariable(
- variable.index, variable.nullability);
+ FunctionTypeVariable newVariable =
+ dartTypes.functionTypeVariable(variable.index);
newVariables[i] = newVariable;
_mapped(variable, newVariable);
}
@@ -1164,9 +1192,7 @@
return _mapped(type, type);
}
return _mapped(
- type,
- dartTypes.interfaceType(
- type.element, newTypeArguments, type.nullability));
+ type, dartTypes.interfaceType(type.element, newTypeArguments));
}
@override
@@ -1188,8 +1214,7 @@
if (identical(type.typeArgument, newTypeArgument)) {
return _mapped(type, type);
}
- return _mapped(
- type, dartTypes.futureOrType(newTypeArgument, type.nullability));
+ return _mapped(type, dartTypes.futureOrType(newTypeArgument));
}
List<DartType> _substTypes(List<DartType> types, A argument) {
@@ -1240,6 +1265,8 @@
bool run(DartType type) => visit(type, null);
+ bool handleLegacyType(LegacyType type) => false;
+ bool handleNullableType(NullableType type) => false;
bool handleNeverType(NeverType type) => false;
bool handleVoidType(VoidType type) => false;
bool handleTypeVariableType(TypeVariableType type) => false;
@@ -1253,6 +1280,15 @@
bool handleFutureOrType(FutureOrType type) => false;
@override
+ bool visitLegacyType(LegacyType type, List<FunctionTypeVariable> bindings) =>
+ handleLegacyType(type) || visit(type.baseType, bindings);
+
+ @override
+ bool visitNullableType(
+ NullableType type, List<FunctionTypeVariable> bindings) =>
+ handleNullableType(type) || visit(type.baseType, bindings);
+
+ @override
bool visitNeverType(NeverType type, List<FunctionTypeVariable> bindings) =>
false;
@@ -1354,9 +1390,9 @@
@override
DartType substituteTypeVariableType(
TypeVariableType type, Null _, bool freshReference) {
- int index = this.parameters.indexOf(type);
+ int index = parameters.indexOf(type);
if (index != -1) {
- return this.arguments[index];
+ return arguments[index];
}
// The type variable was not substituted.
return type;
@@ -1365,11 +1401,11 @@
@override
DartType substituteFunctionTypeVariable(
covariant FunctionTypeVariable type, Null _, bool freshReference) {
- int index = this.parameters.indexOf(type);
+ int index = parameters.indexOf(type);
if (index != -1) {
- return this.arguments[index];
+ return arguments[index];
}
- // The function type variable was not substituted.
+ // The type variable was not substituted.
return type;
}
}
@@ -1442,19 +1478,24 @@
type.accept(this, null);
}
- void _handleNullability(Nullability nullability) {
+ @override
+ void visitLegacyType(covariant LegacyType type, _) {
+ _visit(type.baseType);
// We do not emit the '*' token for legacy types because this is a purely
// internal notion. The language specification does not define a '*' token
// in the type language, and no such token should be surfaced to users.
- if (nullability.isQuestion) {
- _token('?');
- }
+ // TODO(fishythefish): Add a flag to enable printing '*'.
+ }
+
+ @override
+ void visitNullableType(covariant NullableType type, _) {
+ _visit(type.baseType);
+ _token('?');
}
@override
void visitNeverType(covariant NeverType type, _) {
_identifier('Never');
- _handleNullability(type.nullability);
}
@override
@@ -1482,7 +1523,6 @@
_identifier(type.element.typeDeclaration.name);
_token('.');
_identifier(type.element.name);
- _handleNullability(type.nullability);
}
_DeferredName _nameFor(FunctionTypeVariable type) {
@@ -1500,7 +1540,6 @@
if (_boundVariables == null || !_boundVariables.contains(type)) {
_token('/*free*/');
}
- _handleNullability(type.nullability);
}
@override
@@ -1568,7 +1607,6 @@
_token('}');
}
_token(')');
- _handleNullability(type.nullability);
// Exit function type variable scope.
_boundVariables?.length -= type.typeVariables.length;
}
@@ -1577,7 +1615,6 @@
void visitInterfaceType(covariant InterfaceType type, _) {
_identifier(type.element.name);
_optionalTypeArguments(type.typeArguments);
- _handleNullability(type.nullability);
}
void _optionalTypeArguments(List<DartType> types) {
@@ -1598,7 +1635,6 @@
_token('<');
_visit(type.typeArgument);
_token('>');
- _handleNullability(type.nullability);
}
}
@@ -1610,30 +1646,68 @@
bool get useNullSafety;
bool get useLegacySubtyping;
- DartType bottomType() => useLegacySubtyping
- ? commonElements.nullType
- : neverType(Nullability.none);
+ DartType bottomType() =>
+ useLegacySubtyping ? commonElements.nullType : neverType();
- DartType interfaceType(ClassEntity element, List<DartType> typeArguments,
- Nullability nullability) =>
- _normalizeNullability(
- InterfaceType._(element, typeArguments, Nullability.none),
- nullability);
+ DartType legacyType(DartType baseType) {
+ DartType result;
+ if (isTopType(baseType) ||
+ baseType.isNull ||
+ baseType is LegacyType ||
+ baseType is NullableType) {
+ result = baseType;
+ } else {
+ result = LegacyType._(baseType);
+ }
+ return result;
+ }
+
+ DartType nullableType(DartType baseType) {
+ bool _isNullable(DartType t) =>
+ // Note that we can assume NNBD is enabled here.
+ t.isNull ||
+ t is NullableType ||
+ t is LegacyType && _isNullable(t.baseType) ||
+ t is FutureOrType && _isNullable(t.typeArgument) ||
+ _isStrongTopType(t);
+
+ DartType result;
+ if (_isStrongTopType(baseType) ||
+ baseType.isNull ||
+ baseType is NullableType ||
+ baseType is FutureOrType && _isNullable(baseType.typeArgument)) {
+ result = baseType;
+ } else if (baseType is NeverType) {
+ result = commonElements.nullType;
+ } else if (baseType is LegacyType) {
+ DartType legacyBaseType = baseType.baseType;
+ if (legacyBaseType is NeverType) {
+ result = commonElements.nullType;
+ } else if (legacyBaseType is FutureOrType &&
+ _isNullable(legacyBaseType.typeArgument)) {
+ result = legacyBaseType.typeArgument;
+ } else {
+ result = nullableType(legacyBaseType);
+ }
+ } else {
+ result = NullableType._(baseType);
+ }
+ return result;
+ }
+
+ DartType interfaceType(ClassEntity element, List<DartType> typeArguments) =>
+ InterfaceType._(element, typeArguments);
// Since all [TypeVariableType] bounds come from the CFE, we assume that no
// bound will ever be `Never` (or else the CFE would have already normalized
// the type variable to `Never`). Therefore, we can skip normalization.
- TypeVariableType typeVariableType(
- TypeVariableEntity element, Nullability nullability) =>
- TypeVariableType._(element, nullability);
+ TypeVariableType typeVariableType(TypeVariableEntity element) =>
+ TypeVariableType._(element);
// We normalize when we substitute function types.
- DartType functionTypeVariable(int index, Nullability nullability) =>
- FunctionTypeVariable._(index, nullability);
+ DartType functionTypeVariable(int index) => FunctionTypeVariable._(index);
- DartType neverType(Nullability nullability) => nullability.isQuestion
- ? commonElements.nullType
- : NeverType._(nullability);
+ DartType neverType() => const NeverType._();
VoidType voidType() => const VoidType._();
@@ -1649,66 +1723,22 @@
List<DartType> optionalParameterTypes,
List<String> namedParameters,
List<DartType> namedParameterTypes,
- List<FunctionTypeVariable> typeVariables,
- Nullability nullability) =>
+ List<FunctionTypeVariable> typeVariables) =>
FunctionType._(returnType, parameterTypes, optionalParameterTypes,
- namedParameters, namedParameterTypes, typeVariables, nullability);
+ namedParameters, namedParameterTypes, typeVariables);
- DartType futureOrType(DartType typeArgument, Nullability nullability) {
+ DartType futureOrType(DartType typeArgument) {
DartType result;
if (isTopType(typeArgument) || typeArgument.isObject) {
result = typeArgument;
} else if (typeArgument is NeverType) {
- result = commonElements.futureType(
- Nullability.none, neverType(Nullability.none));
+ result = commonElements.futureType(typeArgument);
} else if (typeArgument.isNull) {
- result = commonElements.futureType(
- useNullSafety ? Nullability.question : Nullability.none,
- commonElements.nullType);
+ DartType futureOfNull =
+ commonElements.futureType(commonElements.nullType);
+ result = useNullSafety ? nullableType(futureOfNull) : futureOfNull;
} else {
- result = FutureOrType._(typeArgument, nullability);
- }
- return _normalizeNullability(result, nullability);
- }
-
- DartType _normalizeNullability(DartType t, Nullability nullability) {
- switch (nullability) {
- case Nullability.question:
- return _normalizeQuestionOf(t);
- case Nullability.star:
- return _normalizeStarOf(t);
- default:
- return t;
- }
- }
-
- DartType _normalizeQuestionOf(DartType t) {
- bool _isNullable(DartType t) =>
- // Note that we can assume NNBD is enabled here.
- t.isNull ||
- t.nullability.isQuestion ||
- _isStrongTopType(t) ||
- t is FutureOrType && _isNullable(t.typeArgument);
-
- DartType result;
- if (t.isNull || t.nullability.isQuestion || _isStrongTopType(t)) {
- result = t;
- } else if (t is NeverType) {
- result = commonElements.nullType;
- } else if (t is FutureOrType && _isNullable(t.typeArgument)) {
- result = t.nullability.isStar ? t._toNonNullable : t;
- } else {
- result = t._toNullable;
- }
- return result;
- }
-
- DartType _normalizeStarOf(DartType t) {
- DartType result;
- if (t.isNull || t.nullability.isPotentiallyNull || isTopType(t)) {
- result = t;
- } else {
- result = t._toLegacy;
+ result = FutureOrType._(typeArgument);
}
return result;
}
@@ -1734,10 +1764,6 @@
return subst(arguments, t.typeVariables, t);
}
- // TODO(fishythefish): Clean up all uses of [defaultNullability].
- Nullability get defaultNullability =>
- useNullSafety ? Nullability.star : Nullability.none;
-
/// Returns `true` if every type argument of [t] is a top type.
// TODO(fishythefish): Should we instead check if each type argument is at its
// bound?
@@ -1777,20 +1803,13 @@
if (env != null &&
s is FunctionTypeVariable &&
t is FunctionTypeVariable &&
- s.nullability == t.nullability &&
env.isAssumed(s, t)) return true;
if (s is AnyType) return true;
- if (allowPotentialSubtypes) {
- if (t is TypeVariableType) return true;
- if (s is TypeVariableType && s.nullability.isPotentiallyNonNull)
- return true;
- }
- if (assumeInstantiations) {
- if (t is FunctionTypeVariable) return true;
- if (s is FunctionTypeVariable && s.nullability.isPotentiallyNonNull)
- return true;
- }
+ if (allowPotentialSubtypes &&
+ (s is TypeVariableType || t is TypeVariableType)) return true;
+ if (assumeInstantiations &&
+ (s is FunctionTypeVariable || t is FunctionTypeVariable)) return true;
// Right Top:
if (isTopType(t)) return true;
@@ -1806,10 +1825,10 @@
}
// Left Type Variable Bound 1:
- if (s is TypeVariableType && s.nullability.isPotentiallyNonNull) {
+ if (s is TypeVariableType) {
if (_isSubtype(getTypeVariableBound(s.element), t, env)) return true;
}
- if (s is FunctionTypeVariable && s.nullability.isPotentiallyNonNull) {
+ if (s is FunctionTypeVariable) {
if (_isSubtype(s._bound, t, env)) return true;
}
@@ -1817,54 +1836,48 @@
// Note: Interchanging the Left Null and Right Object rules allows us to
// reduce casework.
if (!useLegacySubtyping && s.isNull) {
- if (t.nullability.isPotentiallyNull) return true;
if (t is FutureOrType) {
return _isSubtype(s, t.typeArgument, env);
}
- return t.isNull;
+ return t.isNull || t is LegacyType || t is NullableType;
}
// Right Object:
- if (!useLegacySubtyping && t.isObject && t.nullability.isNone) {
- if (s is FutureOrType && s.nullability.isNone) {
+ if (!useLegacySubtyping && t.isObject) {
+ if (s is FutureOrType) {
return _isSubtype(s.typeArgument, t, env);
}
- if (s.nullability.isStar) {
- return _isSubtype(s._toNonNullable, t, env);
+ if (s is LegacyType) {
+ return _isSubtype(s.baseType, t, env);
}
- return !s.nullability.isQuestion;
+ return s is! NullableType;
}
// Left Legacy:
- if (s.nullability.isStar) {
- return _isSubtype(s._toNonNullable, t, env);
+ if (s is LegacyType) {
+ return _isSubtype(s.baseType, t, env);
}
// Right Legacy:
- if (t.nullability.isStar) {
+ if (t is LegacyType) {
// Note that to convert `T*` to `T?`, we can't just say `t._toNullable`.
// The resulting type `T?` may be normalizable (e.g. if `T` is `Never`).
return _isSubtype(
- s,
- useLegacySubtyping ? t._toNonNullable : _normalizeQuestionOf(t),
- env);
+ s, useLegacySubtyping ? t.baseType : nullableType(t), env);
}
// Left FutureOr:
- if (s is FutureOrType && s.nullability.isNone) {
+ if (s is FutureOrType) {
DartType typeArgument = s.typeArgument;
return _isSubtype(typeArgument, t, env) &&
- _isSubtype(
- commonElements.futureType(Nullability.none, typeArgument),
- t,
- env);
+ _isSubtype(commonElements.futureType(typeArgument), t, env);
}
// Left Nullable:
- if (s.nullability.isQuestion) {
+ if (s is NullableType) {
return (useLegacySubtyping ||
_isSubtype(commonElements.nullType, t, env)) &&
- _isSubtype(s._toNonNullable, t, env);
+ _isSubtype(s.baseType, t, env);
}
// Type Variable Reflexivity 1 is subsumed by Reflexivity and therefore
@@ -1875,18 +1888,17 @@
// promoted type variables.
// Right FutureOr:
- if (t is FutureOrType && t.nullability.isNone) {
+ if (t is FutureOrType) {
DartType typeArgument = t.typeArgument;
return _isSubtype(s, typeArgument, env) ||
- _isSubtype(s,
- commonElements.futureType(Nullability.none, typeArgument), env);
+ _isSubtype(s, commonElements.futureType(typeArgument), env);
}
// Right Nullable:
- if (t.nullability.isQuestion) {
+ if (t is NullableType) {
return (!useLegacySubtyping &&
_isSubtype(s, commonElements.nullType, env)) ||
- _isSubtype(s, t._toNonNullable, env);
+ _isSubtype(s, t.baseType, env);
}
// Left Promoted Variable does not apply because we do not represent
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index 5685069..2a8247f 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -2251,6 +2251,7 @@
AbstractValue _narrowType(
JClosedWorld closedWorld, AbstractValue type, DartType annotation,
{bool isNullable: true}) {
+ annotation = annotation.withoutNullability;
AbstractValueDomain abstractValueDomain = closedWorld.abstractValueDomain;
AbstractValue otherType;
if (closedWorld.dartTypes.isTopType(annotation)) {
diff --git a/pkg/compiler/lib/src/inferrer/type_system.dart b/pkg/compiler/lib/src/inferrer/type_system.dart
index 43c0f1d..597ae50 100644
--- a/pkg/compiler/lib/src/inferrer/type_system.dart
+++ b/pkg/compiler/lib/src/inferrer/type_system.dart
@@ -317,6 +317,7 @@
/// type.
TypeInformation narrowType(TypeInformation type, DartType annotation,
{bool isNullable: true}) {
+ annotation = annotation.withoutNullability;
AbstractValue otherType;
if (annotation is VoidType) return type;
if (_closedWorld.dartTypes.isTopType(annotation)) {
diff --git a/pkg/compiler/lib/src/ir/constants.dart b/pkg/compiler/lib/src/ir/constants.dart
index 768b8e1..959ee45 100644
--- a/pkg/compiler/lib/src/ir/constants.dart
+++ b/pkg/compiler/lib/src/ir/constants.dart
@@ -81,6 +81,11 @@
ErrorReporter(this._reportError);
+ // TODO(johnniwinther,dmitryas): Remove the getter when the NNBD error
+ // reporting is enabled by default.
+ @override
+ bool get performNnbdChecks => false;
+
@override
void reportInvalidExpression(ir.InvalidExpression node) {
// Ignore.
diff --git a/pkg/compiler/lib/src/ir/element_map.dart b/pkg/compiler/lib/src/ir/element_map.dart
index c486baf..9ef5260 100644
--- a/pkg/compiler/lib/src/ir/element_map.dart
+++ b/pkg/compiler/lib/src/ir/element_map.dart
@@ -45,7 +45,7 @@
/// Return the [InterfaceType] corresponding to the [cls] with the given
/// [typeArguments] and [nullability].
InterfaceType createInterfaceType(
- ir.Class cls, List<ir.DartType> typeArguments, Nullability nullability);
+ ir.Class cls, List<ir.DartType> typeArguments);
/// Returns the [CallStructure] corresponding to the [arguments].
CallStructure getCallStructure(ir.Arguments arguments);
diff --git a/pkg/compiler/lib/src/ir/static_type.dart b/pkg/compiler/lib/src/ir/static_type.dart
index 76c5ab9..3301d8f 100644
--- a/pkg/compiler/lib/src/ir/static_type.dart
+++ b/pkg/compiler/lib/src/ir/static_type.dart
@@ -192,7 +192,8 @@
// subtypes of Object (not just interface types), and function types are
// considered subtypes of Function.
if (superclass.typeParameters.isEmpty) {
- return typeEnvironment.coreTypes.rawType(superclass, type.nullability);
+ return typeEnvironment.coreTypes
+ .rawType(superclass, ir.Nullability.legacy);
}
while (type is ir.TypeParameterType) {
type = (type as ir.TypeParameterType).parameter.bound;
diff --git a/pkg/compiler/lib/src/ir/visitors.dart b/pkg/compiler/lib/src/ir/visitors.dart
index e87efff..7893f77 100644
--- a/pkg/compiler/lib/src/ir/visitors.dart
+++ b/pkg/compiler/lib/src/ir/visitors.dart
@@ -54,15 +54,15 @@
DartTypes get _dartTypes => elementMap.commonElements.dartTypes;
- Nullability _convertNullability(ir.Nullability nullability) {
- if (!_options.useNullSafety) return Nullability.none;
+ DartType _convertNullability(DartType baseType, ir.Nullability nullability) {
+ if (!_options.useNullSafety) return baseType;
switch (nullability) {
case ir.Nullability.nullable:
- return Nullability.question;
+ return _dartTypes.nullableType(baseType);
case ir.Nullability.legacy:
- return Nullability.star;
+ return _dartTypes.legacyType(baseType);
default:
- return Nullability.none;
+ return baseType;
}
}
@@ -78,7 +78,7 @@
}
InterfaceType visitSupertype(ir.Supertype node) =>
- visitInterfaceType(node.asInterfaceType);
+ visitInterfaceType(node.asInterfaceType).withoutNullability;
List<DartType> visitTypes(List<ir.DartType> types) {
topLevel = false;
@@ -90,7 +90,7 @@
DartType visitTypeParameterType(ir.TypeParameterType node) {
DartType typeParameter = currentFunctionTypeParameters[node.parameter];
if (typeParameter != null) {
- return typeParameter;
+ return _convertNullability(typeParameter, node.nullability);
}
if (node.parameter.parent is ir.Typedef) {
// Typedefs are only used in type literals so we never need their type
@@ -99,9 +99,9 @@
}
// We assume the incoming type is already normalized, so the bound is not
// `Never`. Attempting to check the bound here will overflow the stack.
- return _dartTypes.typeVariableType(
- elementMap.getTypeVariable(node.parameter),
- _convertNullability(node.nullability));
+ return _convertNullability(
+ _dartTypes.typeVariableType(elementMap.getTypeVariable(node.parameter)),
+ node.nullability);
}
@override
@@ -110,7 +110,7 @@
List<FunctionTypeVariable> typeVariables;
for (ir.TypeParameter typeParameter in node.typeParameters) {
FunctionTypeVariable typeVariable =
- _dartTypes.functionTypeVariable(index, Nullability.none);
+ _dartTypes.functionTypeVariable(index);
currentFunctionTypeParameters[typeParameter] = typeVariable;
typeVariables ??= <FunctionTypeVariable>[];
typeVariables.add(typeVariable);
@@ -123,7 +123,7 @@
}
}
- FunctionType type = _dartTypes.functionType(
+ FunctionType functionType = _dartTypes.functionType(
visitType(node.returnType),
visitTypes(node.positionalParameters
.take(node.requiredParameterCount)
@@ -133,8 +133,8 @@
.toList()),
node.namedParameters.map((n) => n.name).toList(),
node.namedParameters.map((n) => visitType(n.type)).toList(),
- typeVariables ?? const <FunctionTypeVariable>[],
- _convertNullability(node.nullability));
+ typeVariables ?? const <FunctionTypeVariable>[]);
+ DartType type = _convertNullability(functionType, node.nullability);
for (ir.TypeParameter typeParameter in node.typeParameters) {
currentFunctionTypeParameters.remove(typeParameter);
}
@@ -143,15 +143,16 @@
@override
DartType visitInterfaceType(ir.InterfaceType node) {
- Nullability nullability = _convertNullability(node.nullability);
ClassEntity cls = elementMap.getClass(node.classNode);
if (cls.name == 'FutureOr' &&
cls.library == elementMap.commonElements.asyncLibrary) {
- return _dartTypes.futureOrType(
- visitTypes(node.typeArguments).single, nullability);
+ return _convertNullability(
+ _dartTypes.futureOrType(visitTypes(node.typeArguments).single),
+ node.nullability);
}
- return _dartTypes.interfaceType(
- cls, visitTypes(node.typeArguments), nullability);
+ return _convertNullability(
+ _dartTypes.interfaceType(cls, visitTypes(node.typeArguments)),
+ node.nullability);
}
@override
@@ -178,7 +179,7 @@
@override
DartType visitNeverType(ir.NeverType node) {
- return _dartTypes.neverType(_convertNullability(node.nullability));
+ return _convertNullability(_dartTypes.neverType(), node.nullability);
}
}
@@ -224,8 +225,8 @@
@override
ConstantValue visitInstanceConstant(ir.InstanceConstant node) {
- InterfaceType type = elementMap.createInterfaceType(
- node.classNode, node.typeArguments, Nullability.none);
+ InterfaceType type =
+ elementMap.createInterfaceType(node.classNode, node.typeArguments);
Map<FieldEntity, ConstantValue> fields = {};
node.fieldValues.forEach((ir.Reference reference, ir.Constant value) {
FieldEntity field = elementMap.getField(reference.asField);
@@ -241,7 +242,7 @@
elements.add(visitConstant(element));
}
DartType type = elementMap.commonElements
- .listType(Nullability.none, elementMap.getDartType(node.typeArgument));
+ .listType(elementMap.getDartType(node.typeArgument));
return constant_system.createList(
elementMap.commonElements, type, elements);
}
@@ -253,7 +254,7 @@
elements.add(visitConstant(element));
}
DartType type = elementMap.commonElements
- .setType(Nullability.none, elementMap.getDartType(node.typeArgument));
+ .setType(elementMap.getDartType(node.typeArgument));
return constant_system.createSet(elementMap.commonElements, type, elements);
}
@@ -266,7 +267,6 @@
values.add(visitConstant(element.value));
}
DartType type = elementMap.commonElements.mapType(
- Nullability.none,
elementMap.getDartType(node.keyType),
elementMap.getDartType(node.valueType));
return constant_system.createMap(
diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
index bcf5a8f..25a309e 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -448,7 +448,7 @@
];
if (_options.useNewRti) {
fields.add(_reifiedTypeNewRti(_commonElements.dartTypes
- .interfaceType(cls, constant.typeArguments, Nullability.none)));
+ .interfaceType(cls, constant.typeArguments)));
} else {
fields.add(_reifiedTypeArguments(constant, constant.typeArguments));
}
diff --git a/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart b/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
index 4e026b2..8699611 100644
--- a/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
@@ -50,6 +50,5 @@
new List<DartType>.filled(16, dartTypes.dynamicType()),
const <String>[],
const <DartType>[],
- const <FunctionTypeVariable>[],
- dartTypes.defaultNullability);
+ const <FunctionTypeVariable>[]);
}
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index 3268416..4511fdf 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -636,6 +636,8 @@
String privateName(Name originalName) {
String text = originalName.text;
+ text = text.replaceAll(_nonIdentifierRE, '_');
+
// Public names are easy.
if (!originalName.isPrivate) return text;
@@ -883,7 +885,8 @@
if (_closedWorld.isUsedAsMixin(enclosingClass) ||
_isShadowingSuperField(element) ||
_isUserClassExtendingNative(enclosingClass)) {
- String proposeName() => '${enclosingClass.name}_${element.name}';
+ String proposeName() => '${enclosingClass.name}_${element.name}'
+ .replaceAll(_nonIdentifierRE, '_');
return _disambiguateInternalMember(element, proposeName);
}
@@ -1258,7 +1261,8 @@
return _proposeNameForMember(element.function) + r'$body';
} else if (element.enclosingClass != null) {
ClassEntity enclosingClass = element.enclosingClass;
- return '${enclosingClass.name}_${element.name}';
+ return '${enclosingClass.name}_${element.name}'
+ .replaceAll(_nonIdentifierRE, '_');
}
return element.name.replaceAll(_nonIdentifierRE, '_');
}
@@ -1612,6 +1616,7 @@
}
String getTypeRepresentationForTypeConstant(DartType type) {
+ type = type.withoutNullability;
if (type is DynamicType) return "dynamic";
if (type is FutureOrType) {
return "FutureOr<dynamic>";
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index b45c907..f0f376a 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -1005,6 +1005,17 @@
}
@override
+ jsAst.Expression visitLegacyType(LegacyType type, ModularEmitter emitter) {
+ throw UnsupportedError('Legacy RTI does not support legacy types');
+ }
+
+ @override
+ jsAst.Expression visitNullableType(
+ NullableType type, ModularEmitter emitter) {
+ throw UnsupportedError('Legacy RTI does not support nullable types');
+ }
+
+ @override
jsAst.Expression visitNeverType(NeverType type, ModularEmitter emitter) {
throw UnsupportedError('Legacy RTI does not support the Never type');
}
@@ -1238,6 +1249,16 @@
void collectAll(List<DartType> types) => types.forEach(collect);
@override
+ void visitLegacyType(LegacyType type, _) {
+ collect(type.baseType);
+ }
+
+ @override
+ void visitNullableType(NullableType type, _) {
+ collect(type.baseType);
+ }
+
+ @override
void visitFutureOrType(FutureOrType type, _) {
collect(type.typeArgument);
}
@@ -1314,6 +1335,14 @@
}
@override
+ void visitLegacyType(LegacyType type, TypeVisitorState state) =>
+ visitType(type.baseType, state);
+
+ @override
+ void visitNullableType(NullableType type, TypeVisitorState state) =>
+ visitType(type.baseType, state);
+
+ @override
void visitFutureOrType(FutureOrType type, TypeVisitorState state) =>
visitType(type.typeArgument, state);
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types_new.dart b/pkg/compiler/lib/src/js_backend/runtime_types_new.dart
index 9c7723a..4c371aa 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types_new.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types_new.dart
@@ -210,35 +210,32 @@
_emitCode(Recipe.extensionOp);
}
- void _emitNullability(Nullability nullability) {
- switch (nullability) {
- case Nullability.none:
- return;
- case Nullability.question:
- _emitCode(Recipe.wrapQuestion);
- return;
- case Nullability.star:
- _emitCode(Recipe.wrapStar);
- return;
- }
- }
-
@override
void visit(DartType type, _) => type.accept(this, _);
@override
+ void visitLegacyType(LegacyType type, _) {
+ visit(type.baseType, _);
+ _emitCode(Recipe.wrapStar);
+ }
+
+ @override
+ void visitNullableType(NullableType type, _) {
+ visit(type.baseType, _);
+ _emitCode(Recipe.wrapQuestion);
+ }
+
+ @override
void visitNeverType(NeverType type, _) {
_emitExtensionOp(Recipe.pushNeverExtension);
- _emitNullability(type.nullability);
}
@override
void visitTypeVariableType(TypeVariableType type, _) {
TypeEnvironmentStructure environment = _environment;
if (environment is SingletonTypeEnvironmentStructure) {
- if (type.element == environment.variable.element) {
+ if (type == environment.variable) {
_emitInteger(0);
- _emitNullability(type.nullability);
return;
}
}
@@ -248,13 +245,11 @@
metadata: metadata);
if (index != null) {
_emitInteger(index);
- _emitNullability(type.nullability);
return;
}
jsAst.Name name = _emitter.typeVariableAccessNewRti(type.element);
_emitName(name);
- _emitNullability(type.nullability);
typeVariables.add(type);
return;
}
@@ -270,7 +265,6 @@
// See [visitFunctionType] for explanation.
_emitInteger(functionTypeVariables.length - position - 1);
_emitCode(Recipe.genericFunctionTypeParameterIndex);
- _emitNullability(type.nullability);
}
@override
@@ -295,7 +289,6 @@
// Push the name, which is later converted by an implicit toType
// operation.
_emitName(name);
- _emitNullability(type.nullability);
} else {
_emitName(name);
_emitCode(Recipe.startTypeArguments);
@@ -313,7 +306,6 @@
first = false;
}
_emitCode(Recipe.endTypeArguments);
- _emitNullability(type.nullability);
}
}
@@ -408,8 +400,6 @@
// Exit generic function scope. Remove the type variables pushed at entry.
functionTypeVariables.length -= type.typeVariables.length;
}
-
- _emitNullability(type.nullability);
}
@override
@@ -421,7 +411,6 @@
void visitFutureOrType(FutureOrType type, _) {
visit(type.typeArgument, _);
_emitCode(Recipe.wrapFutureOr);
- _emitNullability(type.nullability);
}
}
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart b/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart
index d9810af..ca9bcf9 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart
@@ -570,8 +570,7 @@
void addImplicitCheck(DartType type) {
if (implicitIsChecks.add(type)) {
if (type is FutureOrType) {
- addImplicitCheck(
- commonElements.futureType(Nullability.none, type.typeArgument));
+ addImplicitCheck(commonElements.futureType(type.typeArgument));
addImplicitCheck(type.typeArgument);
}
}
@@ -583,8 +582,7 @@
world.isChecks.forEach((DartType type) {
if (type is FutureOrType) {
- addImplicitCheck(
- commonElements.futureType(Nullability.none, type.typeArgument));
+ addImplicitCheck(commonElements.futureType(type.typeArgument));
addImplicitCheck(type.typeArgument);
}
});
@@ -1057,6 +1055,7 @@
void processChecks(Set<DartType> checks) {
checks.forEach((DartType type) {
+ type = type.withoutNullability;
if (type is InterfaceType) {
InterfaceType itf = type;
if (!closedWorld.dartTypes.treatAsRawType(itf)) {
@@ -1142,6 +1141,7 @@
Set<ClassEntity> classesDirectlyNeedingRuntimeType = new Set<ClassEntity>();
Iterable<ClassEntity> impliedClasses(DartType type) {
+ type = type.withoutNullability;
if (type is InterfaceType) {
return [type.element];
} else if (type is DynamicType) {
diff --git a/pkg/compiler/lib/src/js_backend/type_reference.dart b/pkg/compiler/lib/src/js_backend/type_reference.dart
index 68887ad..ac15b8e 100644
--- a/pkg/compiler/lib/src/js_backend/type_reference.dart
+++ b/pkg/compiler/lib/src/js_backend/type_reference.dart
@@ -615,26 +615,24 @@
return true;
}
- void _handleNullability(Nullability nullability) {
- switch (nullability) {
- case Nullability.none:
- return;
- case Nullability.star:
- _add('legacy');
- return;
- case Nullability.question:
- _add('nullable');
- return;
- }
- }
-
void _visit(DartType type, DartType parent) {
type.accept(this, parent);
}
@override
+ void visitLegacyType(covariant LegacyType type, _) {
+ _add('legacy');
+ _visit(type.baseType, type);
+ }
+
+ @override
+ void visitNullableType(covariant NullableType type, _) {
+ _add('nullable');
+ _visit(type.baseType, type);
+ }
+
+ @override
void visitNeverType(covariant NeverType type, _) {
- _handleNullability(type.nullability);
_add('Never');
}
@@ -660,7 +658,6 @@
@override
void visitTypeVariableType(covariant TypeVariableType type, DartType parent) {
- _handleNullability(type.nullability);
if (parent != type.element.typeDeclaration) {
_identifier(type.element.typeDeclaration.name);
}
@@ -669,7 +666,6 @@
@override
void visitFunctionTypeVariable(covariant FunctionTypeVariable type, _) {
- _handleNullability(type.nullability);
int index = type.index;
String name = index < 26 ? String.fromCharCode($A + index) : 'v\$${index}';
_add(name);
@@ -680,7 +676,6 @@
if (_dagCheck(type)) return;
_visit(type.returnType, type);
- _handleNullability(type.nullability);
_add('Function');
var typeVariables = type.typeVariables;
if (typeVariables.isNotEmpty) {
@@ -744,7 +739,6 @@
// types which 'print' as a single identifier.
if (arguments.isNotEmpty && _dagCheck(type)) return;
- _handleNullability(type.nullability);
_identifier(type.element.name);
if (arguments.isEmpty) return;
@@ -793,7 +787,6 @@
@override
void visitFutureOrType(covariant FutureOrType type, _) {
- _handleNullability(type.nullability);
_identifier('FutureOr');
_visit(type.typeArgument, type);
}
diff --git a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
index 5f6068d..2b044b3 100644
--- a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
+++ b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
@@ -219,6 +219,10 @@
int visitErasedType(ErasedType type, _) => 8;
@override
int visitFutureOrType(FutureOrType type, _) => 9;
+ @override
+ int visitLegacyType(LegacyType type, _) => 10;
+ @override
+ int visitNullableType(NullableType type, _) => 11;
}
class _DartTypeOrdering extends DartTypeVisitor<int, DartType> {
@@ -239,16 +243,19 @@
return r;
}
- int _compareNullability(DartType a, DartType b) =>
- a.nullability.compareTo(b.nullability);
+ @override
+ int visitLegacyType(covariant LegacyType type, covariant LegacyType other) =>
+ visit(type.baseType, other.baseType);
+
+ @override
+ int visitNullableType(
+ covariant NullableType type, covariant NullableType other) =>
+ visit(type.baseType, other.baseType);
@override
int visitFutureOrType(
- covariant FutureOrType type, covariant FutureOrType other) {
- int r = _compareNullability(type, other);
- if (r != 0) return r;
- return visit(type.typeArgument, other.typeArgument);
- }
+ covariant FutureOrType type, covariant FutureOrType other) =>
+ visit(type.typeArgument, other.typeArgument);
@override
int visitNeverType(covariant NeverType type, covariant NeverType other) {
@@ -270,13 +277,11 @@
@override
int visitFunctionTypeVariable(covariant FunctionTypeVariable type,
covariant FunctionTypeVariable other) {
- int r = _compareNullability(type, other);
- if (r != 0) return r;
int leftIndex = _leftFunctionTypeVariables.indexOf(type);
int rightIndex = _rightFunctionTypeVariables.indexOf(other);
assert(leftIndex != -1);
assert(rightIndex != -1);
- r = leftIndex.compareTo(rightIndex);
+ int r = leftIndex.compareTo(rightIndex);
if (r != 0) return r;
return compare(type.bound, other.bound);
}
@@ -284,14 +289,12 @@
@override
int visitFunctionType(
covariant FunctionType type, covariant FunctionType other) {
- int r = _compareNullability(type, other);
- if (r != 0) return r;
int oldLeftLength = _leftFunctionTypeVariables.length;
int oldRightLength = _rightFunctionTypeVariables.length;
_leftFunctionTypeVariables.addAll(type.typeVariables);
_rightFunctionTypeVariables.addAll(other.typeVariables);
try {
- r = _compareTypeArguments(type.parameterTypes, other.parameterTypes);
+ int r = _compareTypeArguments(type.parameterTypes, other.parameterTypes);
if (r != 0) return r;
r = _compareTypeArguments(
type.optionalParameterTypes, other.optionalParameterTypes);
@@ -314,9 +317,7 @@
@override
int visitInterfaceType(
covariant InterfaceType type, covariant InterfaceType other) {
- int r = _compareNullability(type, other);
- if (r != 0) return r;
- r = _constantOrdering.compareClasses(type.element, other.element);
+ int r = _constantOrdering.compareClasses(type.element, other.element);
if (r != 0) return r;
return _compareTypeArguments(type.typeArguments, other.typeArguments);
}
diff --git a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
index 6075868..c1e165f 100644
--- a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
@@ -324,6 +324,14 @@
}
@override
+ bool visitLegacyType(LegacyType type, OutputUnit argument) =>
+ visit(type.baseType, argument);
+
+ @override
+ bool visitNullableType(NullableType type, OutputUnit argument) =>
+ visit(type.baseType, argument);
+
+ @override
bool visitNeverType(NeverType type, OutputUnit argument) => true;
@override
diff --git a/pkg/compiler/lib/src/js_model/element_map.dart b/pkg/compiler/lib/src/js_model/element_map.dart
index e50c1269..00cb033 100644
--- a/pkg/compiler/lib/src/js_model/element_map.dart
+++ b/pkg/compiler/lib/src/js_model/element_map.dart
@@ -49,7 +49,7 @@
/// Return the [InterfaceType] corresponding to the [cls] with the given
/// [typeArguments] and [nullability].
InterfaceType createInterfaceType(
- ir.Class cls, List<ir.DartType> typeArguments, Nullability nullability);
+ ir.Class cls, List<ir.DartType> typeArguments);
/// Returns the [CallStructure] corresponding to the [arguments].
CallStructure getCallStructure(ir.Arguments arguments);
diff --git a/pkg/compiler/lib/src/js_model/element_map_impl.dart b/pkg/compiler/lib/src/js_model/element_map_impl.dart
index af5e1fb..8b24a2f 100644
--- a/pkg/compiler/lib/src/js_model/element_map_impl.dart
+++ b/pkg/compiler/lib/src/js_model/element_map_impl.dart
@@ -618,9 +618,8 @@
@override
InterfaceType createInterfaceType(
- ir.Class cls, List<ir.DartType> typeArguments, Nullability nullability) {
- return types.interfaceType(
- getClass(cls), getDartTypes(typeArguments), nullability);
+ ir.Class cls, List<ir.DartType> typeArguments) {
+ return types.interfaceType(getClass(cls), getDartTypes(typeArguments));
}
@override
@@ -642,23 +641,20 @@
if (data is JClassDataImpl && data.thisType == null) {
ir.Class node = data.cls;
if (node.typeParameters.isEmpty) {
- data.thisType = data.rawType = types.interfaceType(
- cls, const <DartType>[], types.defaultNullability);
+ data.thisType =
+ data.rawType = types.interfaceType(cls, const <DartType>[]);
} else {
data.thisType = types.interfaceType(
cls,
new List<DartType>.generate(node.typeParameters.length,
(int index) {
return types.typeVariableType(
- getTypeVariableInternal(node.typeParameters[index]),
- types.defaultNullability);
- }),
- types.defaultNullability);
+ getTypeVariableInternal(node.typeParameters[index]));
+ }));
data.rawType = types.interfaceType(
cls,
new List<DartType>.filled(
- node.typeParameters.length, types.dynamicType()),
- types.defaultNullability);
+ node.typeParameters.length, types.dynamicType()));
}
}
}
@@ -671,10 +667,8 @@
_ensureThisAndRawType(cls, data);
data.jsInteropType = data.thisType;
} else {
- data.jsInteropType = types.interfaceType(
- cls,
- List<DartType>.filled(node.typeParameters.length, types.anyType()),
- types.defaultNullability);
+ data.jsInteropType = types.interfaceType(cls,
+ List<DartType>.filled(node.typeParameters.length, types.anyType()));
}
}
}
@@ -847,7 +841,7 @@
@override
TypeVariableType getTypeVariableType(ir.TypeParameterType type) =>
- getDartType(type);
+ getDartType(type).withoutNullability;
@override
List<DartType> getDartTypes(List<ir.DartType> types) {
@@ -860,7 +854,7 @@
@override
InterfaceType getInterfaceType(ir.InterfaceType type) =>
- _typeConverter.convert(type);
+ _typeConverter.convert(type).withoutNullability;
@override
FunctionType getFunctionType(ir.FunctionNode node) {
@@ -902,13 +896,12 @@
if (node.typeParameters.isNotEmpty) {
List<DartType> typeParameters = <DartType>[];
for (ir.TypeParameter typeParameter in node.typeParameters) {
- typeParameters.add(getDartType(new ir.TypeParameterType(typeParameter,
- ir.TypeParameterType.computeNullabilityFromBound(typeParameter))));
+ typeParameters.add(getDartType(new ir.TypeParameterType(
+ typeParameter, ir.Nullability.nonNullable)));
}
typeVariables = new List<FunctionTypeVariable>.generate(
node.typeParameters.length,
- (int index) =>
- types.functionTypeVariable(index, types.defaultNullability));
+ (int index) => types.functionTypeVariable(index));
DartType subst(DartType type) {
return types.subst(typeVariables, typeParameters, type);
@@ -932,8 +925,7 @@
optionalParameterTypes,
namedParameters,
namedParameterTypes,
- typeVariables,
- types.defaultNullability);
+ typeVariables);
}
@override
@@ -1756,8 +1748,8 @@
Map<String, IndexedMember> memberMap = <String, IndexedMember>{};
JRecord container = new JRecord(member.library, box.name);
BoxLocal boxLocal = new BoxLocal(container);
- InterfaceType thisType = types.interfaceType(
- container, const <DartType>[], types.defaultNullability);
+ InterfaceType thisType =
+ types.interfaceType(container, const <DartType>[]);
InterfaceType supertype = commonElements.objectType;
JClassData containerData = new RecordClassData(
new RecordContainerDefinition(getMemberDefinition(member).location),
@@ -1820,8 +1812,8 @@
JClass classEntity = new JClosureClass(enclosingLibrary, name);
// Create a classData and set up the interfaces and subclass
// relationships that _ensureSupertypes and _ensureThisAndRawType are doing
- InterfaceType thisType = types.interfaceType(
- classEntity, const <DartType>[], types.defaultNullability);
+ InterfaceType thisType =
+ types.interfaceType(classEntity, const <DartType>[]);
ClosureClassData closureData = new ClosureClassData(
new ClosureClassDefinition(location),
thisType,
@@ -2233,8 +2225,8 @@
@override
InterfaceType createInterfaceType(
- ClassEntity cls, List<DartType> typeArguments, Nullability nullability) {
- return elementMap.types.interfaceType(cls, typeArguments, nullability);
+ ClassEntity cls, List<DartType> typeArguments) {
+ return elementMap.types.interfaceType(cls, typeArguments);
}
@override
diff --git a/pkg/compiler/lib/src/js_model/env.dart b/pkg/compiler/lib/src/js_model/env.dart
index cbfda1d..5d22abe 100644
--- a/pkg/compiler/lib/src/js_model/env.dart
+++ b/pkg/compiler/lib/src/js_model/env.dart
@@ -617,10 +617,12 @@
} else {
_typeVariables = functionNode.typeParameters
.map<TypeVariableType>((ir.TypeParameter typeParameter) {
- return elementMap.getDartType(new ir.TypeParameterType(
- typeParameter,
- ir.TypeParameterType.computeNullabilityFromBound(
- typeParameter)));
+ return elementMap
+ .getDartType(new ir.TypeParameterType(
+ typeParameter,
+ ir.TypeParameterType.computeNullabilityFromBound(
+ typeParameter)))
+ .withoutNullability;
}).toList();
}
}
@@ -778,8 +780,10 @@
List<TypeVariableType> getFunctionTypeVariables(IrToElementMap elementMap) {
return typeParameters
.map<TypeVariableType>((ir.TypeParameter typeParameter) {
- return elementMap.getDartType(new ir.TypeParameterType(typeParameter,
- ir.TypeParameterType.computeNullabilityFromBound(typeParameter)));
+ return elementMap
+ .getDartType(new ir.TypeParameterType(typeParameter,
+ ir.TypeParameterType.computeNullabilityFromBound(typeParameter)))
+ .withoutNullability;
}).toList();
}
diff --git a/pkg/compiler/lib/src/js_model/js_world_builder.dart b/pkg/compiler/lib/src/js_model/js_world_builder.dart
index a2e7016..f9dfd30 100644
--- a/pkg/compiler/lib/src/js_model/js_world_builder.dart
+++ b/pkg/compiler/lib/src/js_model/js_world_builder.dart
@@ -428,8 +428,7 @@
boxedVariables,
info,
localsMap,
- _dartTypes.interfaceType(
- superclass, const [], _elementMap.types.defaultNullability),
+ _dartTypes.interfaceType(superclass, const []),
createSignatureMethod: createSignatureMethod);
// Tell the hierarchy that this is the super class. then we can use
@@ -761,40 +760,44 @@
}
@override
- DartType visitNeverType(NeverType type, _EntityConverter converter) =>
- _dartTypes.neverType(type.nullability);
+ DartType visitLegacyType(LegacyType type, _EntityConverter converter) =>
+ _dartTypes.legacyType(visit(type.baseType, converter));
+
+ @override
+ DartType visitNullableType(NullableType type, _EntityConverter converter) =>
+ _dartTypes.nullableType(visit(type.baseType, converter));
+
+ @override
+ DartType visitNeverType(NeverType type, _EntityConverter converter) => type;
@override
DartType visitDynamicType(DynamicType type, _EntityConverter converter) =>
- _dartTypes.dynamicType();
+ type;
@override
- DartType visitErasedType(ErasedType type, _EntityConverter converter) =>
- _dartTypes.erasedType();
+ DartType visitErasedType(ErasedType type, _EntityConverter converter) => type;
@override
- DartType visitAnyType(AnyType type, _EntityConverter converter) =>
- _dartTypes.anyType();
+ DartType visitAnyType(AnyType type, _EntityConverter converter) => type;
@override
DartType visitInterfaceType(InterfaceType type, _EntityConverter converter) {
- return _dartTypes.interfaceType(converter(type.element),
- visitList(type.typeArguments, converter), type.nullability);
+ return _dartTypes.interfaceType(
+ converter(type.element), visitList(type.typeArguments, converter));
}
@override
DartType visitTypeVariableType(
TypeVariableType type, _EntityConverter converter) {
- return _dartTypes.typeVariableType(
- converter(type.element), type.nullability);
+ return _dartTypes.typeVariableType(converter(type.element));
}
@override
DartType visitFunctionType(FunctionType type, _EntityConverter converter) {
List<FunctionTypeVariable> typeVariables = <FunctionTypeVariable>[];
for (FunctionTypeVariable typeVariable in type.typeVariables) {
- typeVariables.add(_functionTypeVariables[typeVariable] = _dartTypes
- .functionTypeVariable(typeVariable.index, typeVariable.nullability));
+ typeVariables.add(_functionTypeVariables[typeVariable] =
+ _dartTypes.functionTypeVariable(typeVariable.index));
}
for (FunctionTypeVariable typeVariable in type.typeVariables) {
_functionTypeVariables[typeVariable].bound = typeVariable.bound != null
@@ -816,8 +819,7 @@
optionalParameterTypes,
type.namedParameters,
namedParameterTypes,
- typeVariables,
- type.nullability);
+ typeVariables);
}
@override
@@ -838,8 +840,7 @@
@override
DartType visitFutureOrType(FutureOrType type, _EntityConverter converter) =>
- _dartTypes.futureOrType(
- visit(type.typeArgument, converter), type.nullability);
+ _dartTypes.futureOrType(visit(type.typeArgument, converter));
}
class _ConstantConverter implements ConstantValueVisitor<ConstantValue, Null> {
diff --git a/pkg/compiler/lib/src/js_model/locals.dart b/pkg/compiler/lib/src/js_model/locals.dart
index d6666c0..e9bcb42 100644
--- a/pkg/compiler/lib/src/js_model/locals.dart
+++ b/pkg/compiler/lib/src/js_model/locals.dart
@@ -274,7 +274,7 @@
// TODO(efortuna, johnniwinther): We're not registering the type variables
// like we are for the variable declarations. Is that okay or do we need to
// make TypeVariableLocal a JLocal?
- return new TypeVariableLocal(elementMap.getTypeVariableType(node));
+ return new TypeVariableLocal(elementMap.getTypeVariableType(node).element);
}
@override
diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
index 47c412f..8fbb7d9 100644
--- a/pkg/compiler/lib/src/kernel/element_map.dart
+++ b/pkg/compiler/lib/src/kernel/element_map.dart
@@ -55,7 +55,7 @@
/// Return the [InterfaceType] corresponding to the [cls] with the given
/// [typeArguments] and [nullability].
InterfaceType createInterfaceType(
- ir.Class cls, List<ir.DartType> typeArguments, Nullability nullability);
+ ir.Class cls, List<ir.DartType> typeArguments);
/// Returns the [CallStructure] corresponding to the [arguments].
CallStructure getCallStructure(ir.Arguments arguments);
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index 239a631..e5bf56a 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -239,9 +239,8 @@
@override
InterfaceType createInterfaceType(
- ir.Class cls, List<ir.DartType> typeArguments, Nullability nullability) {
- return types.interfaceType(
- getClass(cls), getDartTypes(typeArguments), nullability);
+ ir.Class cls, List<ir.DartType> typeArguments) {
+ return types.interfaceType(getClass(cls), getDartTypes(typeArguments));
}
LibraryEntity getLibrary(ir.Library node) => getLibraryInternal(node);
@@ -262,23 +261,20 @@
if (data is KClassDataImpl && data.thisType == null) {
ir.Class node = data.node;
if (node.typeParameters.isEmpty) {
- data.thisType = data.rawType = types.interfaceType(
- cls, const <DartType>[], types.defaultNullability);
+ data.thisType =
+ data.rawType = types.interfaceType(cls, const <DartType>[]);
} else {
data.thisType = types.interfaceType(
cls,
new List<DartType>.generate(node.typeParameters.length,
(int index) {
return types.typeVariableType(
- getTypeVariableInternal(node.typeParameters[index]),
- types.defaultNullability);
- }),
- types.defaultNullability);
+ getTypeVariableInternal(node.typeParameters[index]));
+ }));
data.rawType = types.interfaceType(
cls,
new List<DartType>.filled(
- node.typeParameters.length, types.dynamicType()),
- types.defaultNullability);
+ node.typeParameters.length, types.dynamicType()));
}
}
}
@@ -291,10 +287,8 @@
_ensureThisAndRawType(cls, data);
data.jsInteropType = data.thisType;
} else {
- data.jsInteropType = types.interfaceType(
- cls,
- List<DartType>.filled(node.typeParameters.length, types.anyType()),
- types.defaultNullability);
+ data.jsInteropType = types.interfaceType(cls,
+ List<DartType>.filled(node.typeParameters.length, types.anyType()));
}
}
}
@@ -471,7 +465,7 @@
@override
TypeVariableType getTypeVariableType(ir.TypeParameterType type) =>
- getDartType(type);
+ getDartType(type).withoutNullability;
List<DartType> getDartTypes(List<ir.DartType> types) {
List<DartType> list = <DartType>[];
@@ -483,7 +477,7 @@
@override
InterfaceType getInterfaceType(ir.InterfaceType type) =>
- _typeConverter.convert(type);
+ _typeConverter.convert(type).withoutNullability;
@override
FunctionType getFunctionType(ir.FunctionNode node) {
@@ -525,13 +519,12 @@
if (node.typeParameters.isNotEmpty) {
List<DartType> typeParameters = <DartType>[];
for (ir.TypeParameter typeParameter in node.typeParameters) {
- typeParameters.add(getDartType(new ir.TypeParameterType(typeParameter,
- ir.TypeParameterType.computeNullabilityFromBound(typeParameter))));
+ typeParameters.add(getDartType(new ir.TypeParameterType(
+ typeParameter, ir.Nullability.nonNullable)));
}
typeVariables = new List<FunctionTypeVariable>.generate(
node.typeParameters.length,
- (int index) =>
- types.functionTypeVariable(index, types.defaultNullability));
+ (int index) => types.functionTypeVariable(index));
DartType subst(DartType type) {
return types.subst(typeVariables, typeParameters, type);
@@ -555,8 +548,7 @@
optionalParameterTypes,
namedParameters,
namedParameterTypes,
- typeVariables,
- types.defaultNullability);
+ typeVariables);
}
@override
@@ -1688,8 +1680,8 @@
@override
InterfaceType createInterfaceType(
- ClassEntity cls, List<DartType> typeArguments, Nullability nullability) {
- return elementMap.types.interfaceType(cls, typeArguments, nullability);
+ ClassEntity cls, List<DartType> typeArguments) {
+ return elementMap.types.interfaceType(cls, typeArguments);
}
@override
diff --git a/pkg/compiler/lib/src/kernel/env.dart b/pkg/compiler/lib/src/kernel/env.dart
index 200fa58..94e3f0a 100644
--- a/pkg/compiler/lib/src/kernel/env.dart
+++ b/pkg/compiler/lib/src/kernel/env.dart
@@ -760,10 +760,12 @@
} else {
_typeVariables = functionNode.typeParameters
.map<TypeVariableType>((ir.TypeParameter typeParameter) {
- return elementMap.getDartType(new ir.TypeParameterType(
- typeParameter,
- ir.TypeParameterType.computeNullabilityFromBound(
- typeParameter)));
+ return elementMap
+ .getDartType(new ir.TypeParameterType(
+ typeParameter,
+ ir.TypeParameterType.computeNullabilityFromBound(
+ typeParameter)))
+ .withoutNullability;
}).toList();
}
}
diff --git a/pkg/compiler/lib/src/kernel/kernel_impact.dart b/pkg/compiler/lib/src/kernel/kernel_impact.dart
index 02d0f16..5d0a9bf 100644
--- a/pkg/compiler/lib/src/kernel/kernel_impact.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_impact.dart
@@ -285,8 +285,7 @@
void registerListLiteral(ir.DartType elementType,
{bool isConst, bool isEmpty}) {
impactBuilder.registerListLiteral(new ListLiteralUse(
- commonElements.listType(
- Nullability.none, elementMap.getDartType(elementType)),
+ commonElements.listType(elementMap.getDartType(elementType)),
isConstant: isConst,
isEmpty: isEmpty));
}
@@ -295,8 +294,7 @@
void registerSetLiteral(ir.DartType elementType,
{bool isConst, bool isEmpty}) {
impactBuilder.registerSetLiteral(new SetLiteralUse(
- commonElements.setType(
- Nullability.none, elementMap.getDartType(elementType)),
+ commonElements.setType(elementMap.getDartType(elementType)),
isConstant: isConst,
isEmpty: isEmpty));
}
@@ -305,7 +303,7 @@
void registerMapLiteral(ir.DartType keyType, ir.DartType valueType,
{bool isConst, bool isEmpty}) {
impactBuilder.registerMapLiteral(new MapLiteralUse(
- commonElements.mapType(Nullability.none,
+ commonElements.mapType(
elementMap.getDartType(keyType), elementMap.getDartType(valueType)),
isConstant: isConst,
isEmpty: isEmpty));
@@ -328,9 +326,9 @@
ImportEntity deferredImport = elementMap.getImport(import);
impactBuilder.registerStaticUse(isConst
? new StaticUse.constConstructorInvoke(constructor, callStructure,
- elementMap.getDartType(type), deferredImport)
+ elementMap.getDartType(type).withoutNullability, deferredImport)
: new StaticUse.typedConstructorInvoke(constructor, callStructure,
- elementMap.getDartType(type), deferredImport));
+ elementMap.getDartType(type).withoutNullability, deferredImport));
if (type.typeArguments.any((ir.DartType type) => type is! ir.DynamicType)) {
impactBuilder.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK);
}
@@ -352,8 +350,7 @@
void registerConstInstantiation(ir.Class cls, List<ir.DartType> typeArguments,
ir.LibraryDependency import) {
ImportEntity deferredImport = elementMap.getImport(import);
- InterfaceType type =
- elementMap.createInterfaceType(cls, typeArguments, Nullability.none);
+ InterfaceType type = elementMap.createInterfaceType(cls, typeArguments);
impactBuilder
.registerTypeUse(new TypeUse.constInstantiation(type, deferredImport));
}
diff --git a/pkg/compiler/lib/src/serialization/abstract_sink.dart b/pkg/compiler/lib/src/serialization/abstract_sink.dart
index 0f90be4..19b110a 100644
--- a/pkg/compiler/lib/src/serialization/abstract_sink.dart
+++ b/pkg/compiler/lib/src/serialization/abstract_sink.dart
@@ -423,7 +423,7 @@
writeClass(local.closureClass);
} else if (local is TypeVariableLocal) {
writeEnum(LocalKind.typeVariableLocal);
- writeDartType(local.typeVariable);
+ writeTypeVariable(local.typeVariable);
} else {
throw new UnsupportedError("Unsupported local ${local.runtimeType}");
}
diff --git a/pkg/compiler/lib/src/serialization/abstract_source.dart b/pkg/compiler/lib/src/serialization/abstract_source.dart
index 122cfb0..27435a1 100644
--- a/pkg/compiler/lib/src/serialization/abstract_source.dart
+++ b/pkg/compiler/lib/src/serialization/abstract_source.dart
@@ -188,6 +188,9 @@
return const ir.BottomType();
case DartTypeNodeKind.doesNotComplete:
return const DoesNotCompleteType();
+ case DartTypeNodeKind.neverType:
+ ir.Nullability nullability = readEnum(ir.Nullability.values);
+ return ir.NeverType(nullability);
case DartTypeNodeKind.typeParameterType:
ir.TypeParameter typeParameter = readTypeParameterNode();
ir.Nullability typeParameterTypeNullability =
@@ -643,7 +646,7 @@
ClassEntity cls = readClass();
return new AnonymousClosureLocal(cls);
case LocalKind.typeVariableLocal:
- TypeVariableType typeVariable = readDartType();
+ TypeVariableEntity typeVariable = readTypeVariable();
return new TypeVariableLocal(typeVariable);
}
throw new UnsupportedError("Unexpected local kind $kind");
diff --git a/pkg/compiler/lib/src/serialization/helpers.dart b/pkg/compiler/lib/src/serialization/helpers.dart
index dfd868f..61023e8 100644
--- a/pkg/compiler/lib/src/serialization/helpers.dart
+++ b/pkg/compiler/lib/src/serialization/helpers.dart
@@ -89,6 +89,8 @@
/// Enum used for identifying [DartType] subclasses in serialization.
enum DartTypeKind {
none,
+ legacyType,
+ nullableType,
neverType,
voidType,
typeVariable,
@@ -116,6 +118,7 @@
thisInterfaceType,
exactInterfaceType,
doesNotComplete,
+ neverType,
}
const String functionTypeNodeTag = 'function-type-node';
@@ -170,6 +173,13 @@
}
@override
+ void visitNeverType(
+ ir.NeverType node, List<ir.TypeParameter> functionTypeVariables) {
+ _sink.writeEnum(DartTypeNodeKind.neverType);
+ _sink.writeEnum(node.nullability);
+ }
+
+ @override
void visitInterfaceType(
ir.InterfaceType node, List<ir.TypeParameter> functionTypeVariables) {
if (node is ThisInterfaceType) {
diff --git a/pkg/compiler/lib/src/serialization/node_indexer.dart b/pkg/compiler/lib/src/serialization/node_indexer.dart
index 92b90d2..e20df93 100644
--- a/pkg/compiler/lib/src/serialization/node_indexer.dart
+++ b/pkg/compiler/lib/src/serialization/node_indexer.dart
@@ -199,6 +199,12 @@
registerNode(node);
super.visitConstantExpression(node);
}
+
+ @override
+ void visitNullCheck(ir.NullCheck node) {
+ registerNode(node);
+ super.visitNullCheck(node);
+ }
}
/// Visitor that ascribes an index to all [ir.Constant]s that we potentially
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index af25181..ee11cdb 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -2126,9 +2126,8 @@
List<HInstruction> arguments = [pop()];
ClassEntity cls = _commonElements.streamIterator;
DartType typeArg = _elementMap.getDartType(node.variable.type);
- InterfaceType instanceType = localsHandler.substInContext(
- dartTypes.interfaceType(
- cls, [typeArg], closedWorld.dartTypes.defaultNullability));
+ InterfaceType instanceType =
+ localsHandler.substInContext(dartTypes.interfaceType(cls, [typeArg]));
// TODO(johnniwinther): This should be the exact type.
StaticType staticInstanceType =
new StaticType(instanceType, ClassRelation.subtype);
@@ -3115,9 +3114,7 @@
if (options.useNewRti) {
// [type] could be `List<T>`, so ensure it is `JSArray<T>`.
InterfaceType arrayType = dartTypes.interfaceType(
- _commonElements.jsArrayClass,
- type.typeArguments,
- closedWorld.dartTypes.defaultNullability);
+ _commonElements.jsArrayClass, type.typeArguments);
HInstruction rti =
_typeBuilder.analyzeTypeArgumentNewRti(arrayType, sourceElement);
@@ -3152,8 +3149,7 @@
SourceInformation sourceInformation =
_sourceInformationBuilder.buildListLiteral(node);
InterfaceType type = localsHandler.substInContext(
- _commonElements.listType(
- Nullability.none, _elementMap.getDartType(node.typeArgument)));
+ _commonElements.listType(_elementMap.getDartType(node.typeArgument)));
listInstruction = _setListRuntimeTypeInfoIfNeeded(
listInstruction, type, sourceInformation);
}
@@ -3196,8 +3192,8 @@
assert(
constructor is ConstructorEntity && constructor.isFactoryConstructor);
- InterfaceType type = localsHandler.substInContext(_commonElements.setType(
- Nullability.none, _elementMap.getDartType(node.typeArgument)));
+ InterfaceType type = localsHandler.substInContext(
+ _commonElements.setType(_elementMap.getDartType(node.typeArgument)));
ClassEntity cls = constructor.enclosingClass;
if (_rtiNeed.classNeedsTypeArguments(cls)) {
@@ -3278,7 +3274,6 @@
constructor is ConstructorEntity && constructor.isFactoryConstructor);
InterfaceType type = localsHandler.substInContext(_commonElements.mapType(
- Nullability.none,
_elementMap.getDartType(node.keyType),
_elementMap.getDartType(node.valueType)));
ClassEntity cls = constructor.enclosingClass;
@@ -3891,9 +3886,7 @@
}
InterfaceType instanceType = _elementMap.createInterfaceType(
- invocation.target.enclosingClass,
- invocation.arguments.types,
- Nullability.none);
+ invocation.target.enclosingClass, invocation.arguments.types);
AbstractValue resultType = typeMask;
@@ -4018,9 +4011,7 @@
isGrowableListConstructorCall ||
isJSArrayTypedConstructor)) {
InterfaceType type = _elementMap.createInterfaceType(
- invocation.target.enclosingClass,
- invocation.arguments.types,
- Nullability.none);
+ invocation.target.enclosingClass, invocation.arguments.types);
stack
.add(_setListRuntimeTypeInfoIfNeeded(pop(), type, sourceInformation));
}
@@ -4149,6 +4140,8 @@
_handleCreateInvocationMirror(invocation);
} else if (name == 'TYPE_REF') {
_handleForeignTypeRef(invocation);
+ } else if (name == 'LEGACY_TYPE_REF') {
+ _handleForeignLegacyTypeRef(invocation);
} else {
reporter.internalError(
_elementMap.getSpannable(targetElement, invocation),
@@ -4682,8 +4675,10 @@
if (argumentInstruction is HConstant) {
ConstantValue argumentConstant = argumentInstruction.constant;
if (argumentConstant is TypeConstantValue &&
- argumentConstant.representedType is InterfaceType) {
- InterfaceType type = argumentConstant.representedType;
+ argumentConstant.representedType.withoutNullability
+ is InterfaceType) {
+ InterfaceType type =
+ argumentConstant.representedType.withoutNullability;
// TODO(sra): Check that type is a subclass of [Interceptor].
ConstantValue constant = new InterceptorConstantValue(type.element);
HInstruction instruction = graph.addConstant(constant, closedWorld);
@@ -4727,10 +4722,8 @@
}
// TODO(sra): This should be JSArray<any>, created via
// _elementEnvironment.getJsInteropType(_elementEnvironment.jsArrayClass);
- InterfaceType interopType = dartTypes.interfaceType(
- _commonElements.jsArrayClass,
- [dartTypes.dynamicType()],
- closedWorld.dartTypes.defaultNullability);
+ InterfaceType interopType = dartTypes
+ .interfaceType(_commonElements.jsArrayClass, [dartTypes.dynamicType()]);
SourceInformation sourceInformation =
_sourceInformationBuilder.buildCall(invocation, invocation);
HInstruction rti =
@@ -4834,6 +4827,22 @@
..sourceInformation = sourceInformation);
}
+ void _handleForeignLegacyTypeRef(ir.StaticInvocation invocation) {
+ if (_unexpectedForeignArguments(invocation,
+ minPositional: 0, maxPositional: 0, typeArgumentCount: 1)) {
+ stack.add(
+ // Result expected on stack.
+ graph.addConstantNull(closedWorld));
+ return;
+ }
+ DartType type = closedWorld.dartTypes
+ .legacyType(_elementMap.getDartType(invocation.arguments.types.single));
+ SourceInformation sourceInformation =
+ _sourceInformationBuilder.buildCall(invocation, invocation);
+ push(HLoadType.type(type, _abstractValueDomain.dynamicType)
+ ..sourceInformation = sourceInformation);
+ }
+
void _pushStaticInvocation(MemberEntity target, List<HInstruction> arguments,
AbstractValue typeMask, List<DartType> typeArguments,
{SourceInformation sourceInformation, InterfaceType instanceType}) {
@@ -5386,7 +5395,7 @@
ClassEntity cls = constructor.enclosingClass;
AbstractValue typeMask = _abstractValueDomain.createNonNullExact(cls);
InterfaceType instanceType = _elementMap.createInterfaceType(
- target.enclosingClass, node.arguments.types, Nullability.none);
+ target.enclosingClass, node.arguments.types);
instanceType = localsHandler.substInContext(instanceType);
List<HInstruction> arguments = <HInstruction>[];
diff --git a/pkg/compiler/lib/src/ssa/locals_handler.dart b/pkg/compiler/lib/src/ssa/locals_handler.dart
index de63ecb..3798e19 100644
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart
@@ -34,8 +34,8 @@
Map<Local, FieldEntity> redirectionMapping = new Map<Local, FieldEntity>();
final KernelSsaGraphBuilder builder;
ScopeInfo scopeInfo;
- Map<TypeVariableType, TypeVariableLocal> typeVariableLocals =
- new Map<TypeVariableType, TypeVariableLocal>();
+ Map<TypeVariableEntity, TypeVariableLocal> typeVariableLocals =
+ new Map<TypeVariableEntity, TypeVariableLocal>();
final Entity executableContext;
final MemberEntity memberContext;
@@ -408,9 +408,8 @@
}
Local getTypeVariableAsLocal(TypeVariableType type) {
- return typeVariableLocals.putIfAbsent(type, () {
- return new TypeVariableLocal(type);
- });
+ return typeVariableLocals[type.element] ??=
+ new TypeVariableLocal(type.element);
}
/// Sets the [element] to [value]. If the element is boxed or stored in a
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 5836058..e8c6a86 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -694,9 +694,7 @@
if (_options.useNewRti) {
typeInfo = HLoadType.type(
_closedWorld.elementEnvironment.createInterfaceType(
- commonElements.jsArrayClass,
- [commonElements.stringType],
- Nullability.none),
+ commonElements.jsArrayClass, [commonElements.stringType]),
_abstractValueDomain.dynamicType);
node.block.addBefore(node, typeInfo);
} else {
diff --git a/pkg/compiler/lib/src/tracer.dart b/pkg/compiler/lib/src/tracer.dart
index c67cafc..f7add43 100644
--- a/pkg/compiler/lib/src/tracer.dart
+++ b/pkg/compiler/lib/src/tracer.dart
@@ -12,11 +12,13 @@
/// If non-null, we only trace methods whose name match the regexp defined by
/// the given pattern.
-String get TRACE_FILTER_PATTERN =>
- TRACE_FILTER_PATTERN_FROM_ENVIRONMENT ?? TRACE_FILTER_PATTERN_FOR_TEST;
+String get TRACE_FILTER_PATTERN => TRACE_FILTER_PATTERN_FROM_ENVIRONMENT == ''
+ ? TRACE_FILTER_PATTERN_FOR_TEST
+ : null;
const String TRACE_FILTER_PATTERN_FROM_ENVIRONMENT =
- const String.fromEnvironment("DUMP_IR");
+ // TODO(sigmund): remove `?? ''` once #40678 is backported.
+ const String.fromEnvironment("DUMP_IR") ?? '';
String TRACE_FILTER_PATTERN_FOR_TEST;
/// Dumps the intermediate representation after each phase in a format
diff --git a/pkg/dartdev/lib/dartdev.dart b/pkg/dartdev/lib/dartdev.dart
index 3dc5b3c..d3934f7 100644
--- a/pkg/dartdev/lib/dartdev.dart
+++ b/pkg/dartdev/lib/dartdev.dart
@@ -5,7 +5,9 @@
import 'package:args/args.dart';
import 'package:args/command_runner.dart';
import 'package:cli_util/cli_logging.dart';
+import 'package:dartfix/src/migrate/migrate.dart';
+import 'src/commands/analyze.dart';
import 'src/commands/create.dart';
import 'src/commands/format.dart';
import 'src/commands/pub.dart';
@@ -21,8 +23,10 @@
argParser.addFlag('verbose',
abbr: 'v', negatable: false, help: 'Show verbose output.');
+ addCommand(AnalyzeCommand(verbose: verbose));
addCommand(CreateCommand(verbose: verbose));
addCommand(FormatCommand(verbose: verbose));
+ addCommand(MigrateCommand(logProvider: () => log));
addCommand(PubCommand(verbose: verbose));
}
diff --git a/pkg/dartdev/lib/src/commands/analyze.dart b/pkg/dartdev/lib/src/commands/analyze.dart
new file mode 100644
index 0000000..8965b45
--- /dev/null
+++ b/pkg/dartdev/lib/src/commands/analyze.dart
@@ -0,0 +1,140 @@
+// Copyright (c) 2020, 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:async';
+import 'dart:io';
+
+import 'package:path/path.dart' as path;
+
+import '../core.dart';
+import '../sdk.dart';
+import '../utils.dart';
+import 'analyze_impl.dart';
+
+class AnalyzeCommand extends DartdevCommand<int> {
+ AnalyzeCommand({bool verbose = false})
+ : super('analyze', "Analyze the project's Dart code.") {
+ argParser
+ ..addFlag('fatal-infos',
+ help: 'Treat info level issues as fatal.',
+ defaultsTo: false,
+ negatable: false)
+ ..addFlag('fatal-warnings',
+ help: 'Treat warning level issues as fatal.',
+ defaultsTo: true,
+ negatable: true);
+ }
+
+ @override
+ String get invocation => '${super.invocation} [<directory>]';
+
+ @override
+ FutureOr<int> run() async {
+ if (argResults.rest.length > 1) {
+ usageException("Only one directory is expected.");
+ }
+
+ // find directory from argResults.rest
+ var dir = argResults.rest.isEmpty
+ ? Directory.current
+ : Directory(argResults.rest.single);
+ if (!dir.existsSync()) {
+ usageException("Directory doesn't exist: ${dir.path}");
+ }
+
+ final Completer<void> analysisCompleter = Completer<void>();
+ final List<AnalysisError> errors = <AnalysisError>[];
+
+ var progress = log.progress('Analyzing ${path.basename(dir.path)}');
+
+ final AnalysisServer server = AnalysisServer(
+ Directory(sdk.sdkPath),
+ [dir],
+ );
+
+ StreamSubscription<bool> subscription;
+ subscription = server.onAnalyzing.listen((bool isAnalyzing) {
+ if (!isAnalyzing) {
+ analysisCompleter.complete();
+ subscription.cancel();
+ }
+ });
+ server.onErrors.listen((FileAnalysisErrors fileErrors) {
+ // Record the issues found (but filter out to do comments).
+ errors.addAll(fileErrors.errors
+ .where((AnalysisError error) => error.type != 'TODO'));
+ });
+
+ await server.start();
+ // Completing the future in the callback can't fail.
+ //ignore: unawaited_futures
+ server.onExit.then<void>((int exitCode) {
+ if (!analysisCompleter.isCompleted) {
+ analysisCompleter.completeError('analysis server exited: $exitCode');
+ }
+ });
+
+ await analysisCompleter.future;
+
+ progress.finish(showTiming: true);
+
+ errors.sort();
+
+ if (errors.isNotEmpty) {
+ final bullet = log.ansi.bullet;
+
+ log.stdout('');
+
+ bool hasErrors = false;
+ bool hasWarnings = false;
+ bool hasInfos = false;
+
+ for (final AnalysisError error in errors) {
+ // error • Message ... at path.dart:line:col • (code)
+
+ var filePath = path.relative(error.file, from: dir.path);
+ var severity = error.severity.toLowerCase().padLeft(7);
+ if (error.isError) {
+ severity = log.ansi.error(severity);
+ }
+
+ log.stdout(
+ '$severity $bullet '
+ '${log.ansi.emphasized(error.messageSentenceFragment)} '
+ 'at $filePath:${error.startLine}:${error.startColumn} $bullet '
+ '(${error.code})',
+ );
+
+ hasErrors |= error.isError;
+ hasWarnings |= error.isWarning;
+ hasInfos |= error.isInfo;
+ }
+
+ log.stdout('');
+
+ final errorCount = errors.length;
+ log.stdout('$errorCount ${pluralize('issue', errorCount)} found.');
+
+ // Return an error code in the range [0-3] dependent on the severity of
+ // the issue(s) found.
+ if (hasErrors) {
+ return 3;
+ }
+
+ bool fatalWarnings = argResults['fatal-warnings'];
+ bool fatalInfos = argResults['fatal-infos'];
+
+ if (fatalWarnings && hasWarnings) {
+ return 2;
+ } else if (fatalInfos && hasInfos) {
+ return 1;
+ } else {
+ return 0;
+ }
+ } else {
+ log.stdout('No issues found!');
+ return 0;
+ }
+ }
+}
diff --git a/pkg/dartdev/lib/src/commands/analyze_impl.dart b/pkg/dartdev/lib/src/commands/analyze_impl.dart
new file mode 100644
index 0000000..41627fa
--- /dev/null
+++ b/pkg/dartdev/lib/src/commands/analyze_impl.dart
@@ -0,0 +1,257 @@
+// Copyright (c) 2020, 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:async';
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:path/path.dart' as path;
+
+import '../core.dart';
+import '../sdk.dart';
+import '../utils.dart';
+
+/// A class to provide an API wrapper around an analysis server process.
+class AnalysisServer {
+ AnalysisServer(this.sdkPath, this.directories);
+
+ final Directory sdkPath;
+ final List<Directory> directories;
+
+ Process _process;
+ final StreamController<bool> _analyzingController =
+ StreamController<bool>.broadcast();
+ final StreamController<FileAnalysisErrors> _errorsController =
+ StreamController<FileAnalysisErrors>.broadcast();
+ bool _didServerErrorOccur = false;
+
+ int _id = 0;
+
+ bool get didServerErrorOccur => _didServerErrorOccur;
+
+ Stream<bool> get onAnalyzing => _analyzingController.stream;
+
+ Stream<FileAnalysisErrors> get onErrors => _errorsController.stream;
+
+ Future<int> get onExit => _process.exitCode;
+
+ Future<void> start() async {
+ final List<String> command = <String>[
+ sdk.analysis_server_snapshot,
+ '--disable-server-feature-completion',
+ '--disable-server-feature-search',
+ '--sdk',
+ sdkPath.path,
+ ];
+
+ log.trace('dart ${command.join(' ')}');
+ _process = await startProcess(sdk.dart, command);
+ // This callback hookup can't throw.
+ //ignore: unawaited_futures
+ _process.exitCode.whenComplete(() => _process = null);
+
+ final Stream<String> errorStream = _process.stderr
+ .transform<String>(utf8.decoder)
+ .transform<String>(const LineSplitter());
+ errorStream.listen(log.stderr);
+
+ final Stream<String> inStream = _process.stdout
+ .transform<String>(utf8.decoder)
+ .transform<String>(const LineSplitter());
+ inStream.listen(_handleServerResponse);
+
+ _sendCommand('server.setSubscriptions', <String, dynamic>{
+ 'subscriptions': <String>['STATUS'],
+ });
+
+ // Reference and trim off any trailing slash, the Dart Analysis Server
+ // protocol throws an error (INVALID_FILE_PATH_FORMAT) if there is a
+ // trailing slash.
+ //
+ // The call to absolute.resolveSymbolicLinksSync() canonicalizes the path
+ // to be passed to the analysis server.
+ var dirPath = trimEnd(
+ directories.single.absolute.resolveSymbolicLinksSync(),
+ path.context.separator,
+ );
+
+ _sendCommand('analysis.setAnalysisRoots', <String, dynamic>{
+ 'included': [dirPath],
+ 'excluded': <String>[]
+ });
+ }
+
+ void _sendCommand(String method, Map<String, dynamic> params) {
+ final String message = json.encode(<String, dynamic>{
+ 'id': (++_id).toString(),
+ 'method': method,
+ 'params': params,
+ });
+ _process.stdin.writeln(message);
+ log.trace('==> $message');
+ }
+
+ void _handleServerResponse(String line) {
+ log.trace('<== $line');
+
+ final dynamic response = json.decode(line);
+
+ if (response is Map<String, dynamic>) {
+ if (response['event'] != null) {
+ final String event = response['event'] as String;
+ final dynamic params = response['params'];
+
+ if (params is Map<String, dynamic>) {
+ if (event == 'server.status') {
+ _handleStatus(_castStringKeyedMap(response['params']));
+ } else if (event == 'analysis.errors') {
+ _handleAnalysisIssues(_castStringKeyedMap(response['params']));
+ } else if (event == 'server.error') {
+ _handleServerError(_castStringKeyedMap(response['params']));
+ }
+ }
+ } else if (response['error'] != null) {
+ // Fields are 'code', 'message', and 'stackTrace'.
+ final Map<String, dynamic> error =
+ _castStringKeyedMap(response['error']);
+ log.stderr(
+ 'Error response from the server: ${error['code']} ${error['message']}');
+ if (error['stackTrace'] != null) {
+ log.stderr(error['stackTrace'] as String);
+ }
+ // Dispose of the process at this point so the process doesn't hang.
+ dispose();
+ }
+ }
+ }
+
+ void _handleStatus(Map<String, dynamic> statusInfo) {
+ // {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
+ if (statusInfo['analysis'] != null && !_analyzingController.isClosed) {
+ final bool isAnalyzing = statusInfo['analysis']['isAnalyzing'] as bool;
+ _analyzingController.add(isAnalyzing);
+ }
+ }
+
+ void _handleServerError(Map<String, dynamic> error) {
+ // Fields are 'isFatal', 'message', and 'stackTrace'.
+ log.stderr('Error from the analysis server: ${error['message']}');
+ if (error['stackTrace'] != null) {
+ log.stderr(error['stackTrace'] as String);
+ }
+ _didServerErrorOccur = true;
+ }
+
+ void _handleAnalysisIssues(Map<String, dynamic> issueInfo) {
+ // {"event":"analysis.errors","params":{"file":"/Users/.../lib/main.dart","errors":[]}}
+ final String file = issueInfo['file'] as String;
+ final List<dynamic> errorsList = issueInfo['errors'] as List<dynamic>;
+ final List<AnalysisError> errors = errorsList
+ .map<Map<String, dynamic>>(_castStringKeyedMap)
+ .map<AnalysisError>((Map<String, dynamic> json) => AnalysisError(json))
+ .toList();
+ if (!_errorsController.isClosed) {
+ _errorsController.add(FileAnalysisErrors(file, errors));
+ }
+ }
+
+ Future<bool> dispose() async {
+ await _analyzingController.close();
+ await _errorsController.close();
+ return _process?.kill();
+ }
+}
+
+/// Given a data structure which is a Map of String to dynamic values, return
+/// the same structure (`Map<String, dynamic>`) with the correct runtime types.
+Map<String, dynamic> _castStringKeyedMap(dynamic untyped) {
+ final Map<dynamic, dynamic> map = untyped as Map<dynamic, dynamic>;
+ return map?.cast<String, dynamic>();
+}
+
+enum _AnalysisSeverity {
+ error,
+ warning,
+ info,
+ none,
+}
+
+class AnalysisError implements Comparable<AnalysisError> {
+ AnalysisError(this.json);
+
+ static final Map<String, _AnalysisSeverity> _severityMap =
+ <String, _AnalysisSeverity>{
+ 'INFO': _AnalysisSeverity.info,
+ 'WARNING': _AnalysisSeverity.warning,
+ 'ERROR': _AnalysisSeverity.error,
+ };
+
+ // "severity":"INFO","type":"TODO","location":{
+ // "file":"/Users/.../lib/test.dart","offset":362,"length":72,"startLine":15,"startColumn":4
+ // },"message":"...","hasFix":false}
+ Map<String, dynamic> json;
+
+ String get severity => json['severity'] as String;
+
+ _AnalysisSeverity get _severityLevel =>
+ _severityMap[severity] ?? _AnalysisSeverity.none;
+
+ bool get isInfo => _severityLevel == _AnalysisSeverity.info;
+
+ bool get isWarning => _severityLevel == _AnalysisSeverity.warning;
+
+ bool get isError => _severityLevel == _AnalysisSeverity.error;
+
+ String get type => json['type'] as String;
+
+ String get message => json['message'] as String;
+
+ String get code => json['code'] as String;
+
+ String get file => json['location']['file'] as String;
+
+ int get startLine => json['location']['startLine'] as int;
+
+ int get startColumn => json['location']['startColumn'] as int;
+
+ int get offset => json['location']['offset'] as int;
+
+ String get messageSentenceFragment => trimEnd(message, '.');
+
+ // TODO(jwren) add some tests to verify that the results are what we are
+ // expecting, 'other' is not always on the RHS of the subtraction in the
+ // implementation.
+ @override
+ int compareTo(AnalysisError other) {
+ // Sort in order of file path, error location, severity, and message.
+ if (file != other.file) {
+ return file.compareTo(other.file);
+ }
+
+ if (offset != other.offset) {
+ return offset - other.offset;
+ }
+
+ final int diff = other._severityLevel.index - _severityLevel.index;
+ if (diff != 0) {
+ return diff;
+ }
+
+ return message.compareTo(other.message);
+ }
+
+ @override
+ String toString() {
+ return '${severity.toLowerCase()} • '
+ '$messageSentenceFragment at $file:$startLine:$startColumn • '
+ '($code)';
+ }
+}
+
+class FileAnalysisErrors {
+ final String file;
+ final List<AnalysisError> errors;
+
+ FileAnalysisErrors(this.file, this.errors);
+}
diff --git a/pkg/dartdev/lib/src/commands/create.dart b/pkg/dartdev/lib/src/commands/create.dart
index 513bf65..c323f78 100644
--- a/pkg/dartdev/lib/src/commands/create.dart
+++ b/pkg/dartdev/lib/src/commands/create.dart
@@ -15,19 +15,22 @@
/// A command to create a new project from a set of templates.
class CreateCommand extends DartdevCommand {
- static String defaultTemplateId = 'console-full';
+ static String defaultTemplateId = 'console-simple';
static List<String> legalTemplateIds = [
+ 'console-simple',
'console-full',
'package-simple',
'web-simple'
];
- static Iterable<stagehand.Generator> get generators =>
- stagehand.generators.where((g) => legalTemplateIds.contains(g.id));
+ static Iterable<stagehand.Generator> get generators {
+ return legalTemplateIds.map(retrieveTemplateGenerator);
+ }
- static stagehand.Generator retrieveTemplateGenerator(String templateId) =>
- stagehand.getGenerator(templateId);
+ static stagehand.Generator retrieveTemplateGenerator(String templateId) {
+ return stagehand.getGenerator(templateId);
+ }
CreateCommand({bool verbose = false})
: super('create', 'Create a new project.') {
@@ -132,9 +135,10 @@
@override
String get usageFooter {
int width = legalTemplateIds.map((s) => s.length).reduce(math.max);
- String desc = generators
- .map((g) => ' ${g.id.padLeft(width)}: ${g.description}')
- .join('\n');
+ String desc = generators.map((g) {
+ String suffix = g.id == defaultTemplateId ? ' (default)' : '';
+ return ' ${g.id.padLeft(width)}: ${g.description}$suffix';
+ }).join('\n');
return '\nAvailable templates:\n$desc';
}
diff --git a/pkg/dartdev/lib/src/commands/format.dart b/pkg/dartdev/lib/src/commands/format.dart
index 99a8066..30f8b67 100644
--- a/pkg/dartdev/lib/src/commands/format.dart
+++ b/pkg/dartdev/lib/src/commands/format.dart
@@ -9,10 +9,7 @@
class FormatCommand extends DartdevCommand {
FormatCommand({bool verbose = false})
- : super(
- 'format',
- 'Idiomatically formats Dart source code.',
- ) {
+ : super('format', 'Format Dart source code.') {
// TODO(jwren) When https://github.com/dart-lang/dart_style/issues/889
// is resolved, have dart_style provide the ArgParser, instead of creating
// one here.
diff --git a/pkg/dartdev/lib/src/commands/pub.dart b/pkg/dartdev/lib/src/commands/pub.dart
index 9305900..acc8e39 100644
--- a/pkg/dartdev/lib/src/commands/pub.dart
+++ b/pkg/dartdev/lib/src/commands/pub.dart
@@ -3,76 +3,30 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
+import 'dart:io';
-import 'package:pub/src/command/cache.dart';
-import 'package:pub/src/command/deps.dart';
-import 'package:pub/src/command/downgrade.dart';
-import 'package:pub/src/command/get.dart';
-import 'package:pub/src/command/global.dart';
-import 'package:pub/src/command/lish.dart';
-import 'package:pub/src/command/list_package_dirs.dart';
-import 'package:pub/src/command/logout.dart';
-import 'package:pub/src/command/run.dart';
-import 'package:pub/src/command/serve.dart';
-import 'package:pub/src/command/upgrade.dart';
-import 'package:pub/src/command/uploader.dart';
-import 'package:pub/src/command_runner.dart';
+import 'package:args/args.dart';
import '../core.dart';
-import '../utils.dart';
+import '../sdk.dart';
class PubCommand extends DartdevCommand<int> {
- var pubCommandRunner = PubCommandRunner();
+ PubCommand({bool verbose = false}) : super('pub', 'Work with packages.');
- PubCommand({bool verbose = false})
- : super('pub', 'Pub is a package manager for Dart.') {
- argParser.addFlag('version', negatable: false, help: 'Print pub version.');
- argParser.addFlag('trace',
- help: 'Print debugging information when an error occurs.');
- argParser
- .addOption('verbosity', help: 'Control output verbosity.', allowed: [
- 'error',
- 'warning',
- 'normal',
- 'io',
- 'solver',
- 'all'
- ], allowedHelp: {
- 'error': 'Show only errors.',
- 'warning': 'Show only errors and warnings.',
- 'normal': 'Show errors, warnings, and user messages.',
- 'io': 'Also show IO operations.',
- 'solver': 'Show steps during version resolution.',
- 'all': 'Show all output including internal tracing messages.'
- });
- argParser.addFlag('verbose',
- abbr: 'v', negatable: false, help: 'Shortcut for "--verbosity=all".');
- argParser.addFlag('with-prejudice',
- hide: !isAprilFools,
- negatable: false,
- help: 'Execute commands with prejudice.');
- argParser.addFlag('sparkle',
- hide: !isAprilFools,
- negatable: false,
- help: 'A more sparkly experience.');
-
- addSubcommand(CacheCommand());
- addSubcommand(DepsCommand());
- addSubcommand(DowngradeCommand());
- addSubcommand(GlobalCommand());
- addSubcommand(GetCommand());
- addSubcommand(ListPackageDirsCommand());
- addSubcommand(LishCommand());
- addSubcommand(RunCommand());
- addSubcommand(ServeCommand());
- addSubcommand(UpgradeCommand());
- addSubcommand(UploaderCommand());
- addSubcommand(LogoutCommand());
- }
+ final ArgParser argParser = ArgParser.allowAnything();
@override
FutureOr<int> run() async {
- await pubCommandRunner.run(argResults.arguments);
- return 0;
+ final command = sdk.pub;
+ final args = argResults.arguments;
+
+ log.trace('$command ${args.join(' ')}');
+
+ // Starting in ProcessStartMode.inheritStdio mode means the child process
+ // can detect support for ansi chars.
+ var process =
+ await Process.start(command, args, mode: ProcessStartMode.inheritStdio);
+
+ return process.exitCode;
}
}
diff --git a/pkg/dartdev/lib/src/sdk.dart b/pkg/dartdev/lib/src/sdk.dart
index 73afe8d..b67fa07 100644
--- a/pkg/dartdev/lib/src/sdk.dart
+++ b/pkg/dartdev/lib/src/sdk.dart
@@ -15,9 +15,12 @@
Sdk() : dir = getSdkPath();
+ String get sdkPath => dir;
+
String get dart => path.join(dir, 'bin', _exeName('dart'));
- String get dartanalyzer => path.join(dir, 'bin', _binName('dartanalyzer'));
+ String get analysis_server_snapshot =>
+ path.join(dir, 'bin', 'snapshots', 'analysis_server.dart.snapshot');
String get dartfmt => path.join(dir, 'bin', _binName('dartfmt'));
diff --git a/pkg/dartdev/lib/src/utils.dart b/pkg/dartdev/lib/src/utils.dart
index cf0944d..eff4b38 100644
--- a/pkg/dartdev/lib/src/utils.dart
+++ b/pkg/dartdev/lib/src/utils.dart
@@ -16,7 +16,7 @@
String getUserHomeDir() {
String envKey = Platform.operatingSystem == 'windows' ? 'APPDATA' : 'HOME';
String value = Platform.environment[envKey];
- return value == null ? '.' : value;
+ return value ?? '.';
}
/// A typedef to represent a function taking no arguments and with no return
@@ -36,3 +36,11 @@
/// Emit the given word with the correct pluralization.
String pluralize(String word, int count) => count == 1 ? word : '${word}s';
+
+/// String utility to trim some suffix from the end of a [String].
+String trimEnd(String s, String suffix) {
+ if (s != null && suffix != null && suffix.isNotEmpty && s.endsWith(suffix)) {
+ return s.substring(0, s.length - suffix.length);
+ }
+ return s;
+}
diff --git a/pkg/dartdev/pubspec.yaml b/pkg/dartdev/pubspec.yaml
index 57ba7ac..949d21c 100644
--- a/pkg/dartdev/pubspec.yaml
+++ b/pkg/dartdev/pubspec.yaml
@@ -10,7 +10,7 @@
cli_util: ^0.1.0
intl: ^0.16.0
path: ^1.6.2
- stagehand: 3.3.6
+ stagehand: 3.3.7
watcher: ^0.9.7+13
yaml: ^2.2.0
diff --git a/pkg/dartdev/test/commands/analyze_test.dart b/pkg/dartdev/test/commands/analyze_test.dart
new file mode 100644
index 0000000..4be7ba6
--- /dev/null
+++ b/pkg/dartdev/test/commands/analyze_test.dart
@@ -0,0 +1,155 @@
+// Copyright (c) 2020, 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:test/test.dart';
+
+import '../utils.dart';
+
+void main() {
+ group('analyze', defineAnalyze, timeout: defaultTimeout);
+}
+
+const String _analyzeDescriptionText = "Analyze the project's Dart code.";
+
+const String _analyzeUsageText =
+ 'Usage: dart analyze [arguments] [<directory>]';
+
+const String _warningDartCodeSnippet = '''
+ enum E { e1, e2 }
+ void f(E e) {
+ switch (e) {
+ case E.e1:
+ break;
+ }
+ }
+ ''';
+
+void defineAnalyze() {
+ TestProject p;
+
+ setUp(() => p = null);
+
+ tearDown(() => p?.dispose());
+
+ test('--help', () {
+ p = project();
+ var result = p.runSync('analyze', ['--help']);
+
+ expect(result.exitCode, 0);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains(_analyzeDescriptionText));
+ expect(result.stdout, contains(_analyzeUsageText));
+ });
+
+ test('multiple directories', () {
+ p = project();
+ var result = p.runSync('analyze', ['/no/such/dir1/', '/no/such/dir2/']);
+
+ expect(result.exitCode, 64);
+ expect(result.stdout, isEmpty);
+ expect(result.stderr, contains('Only one directory is expected.'));
+ expect(result.stderr, contains(_analyzeUsageText));
+ });
+
+ test('no such directory', () {
+ p = project();
+ var result = p.runSync('analyze', ['/no/such/dir1/']);
+
+ expect(result.exitCode, 64);
+ expect(result.stdout, isEmpty);
+ expect(result.stderr, contains("Directory doesn't exist: /no/such/dir1/"));
+ expect(result.stderr, contains(_analyzeUsageText));
+ });
+
+ test('current working directory', () {
+ p = project(mainSrc: 'int get foo => 1;\n');
+
+ var result = p.runSync('analyze', [], workingDir: p.dirPath);
+
+ expect(result.exitCode, 0);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains('No issues found!'));
+ });
+
+ test('no errors', () {
+ p = project(mainSrc: 'int get foo => 1;\n');
+ var result = p.runSync('analyze', [p.dirPath]);
+
+ expect(result.exitCode, 0);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains('No issues found!'));
+ });
+
+ test('one error', () {
+ p = project(mainSrc: "int get foo => 'str';\n");
+ var result = p.runSync('analyze', [p.dirPath]);
+
+ expect(result.exitCode, 3);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains("A value of type "));
+ expect(result.stdout, contains("lib/main.dart:1:16 "));
+ expect(result.stdout, contains("return_of_invalid_type"));
+ expect(result.stdout, contains("1 issue found."));
+ });
+
+ test('two errors', () {
+ p = project(mainSrc: "int get foo => 'str';\nint get bar => 'str';\n");
+ var result = p.runSync('analyze', [p.dirPath]);
+
+ expect(result.exitCode, 3);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains("2 issues found."));
+ });
+
+ test('warning --fatal-warnings', () {
+ p = project(mainSrc: _warningDartCodeSnippet);
+ var result = p.runSync('analyze', ['--fatal-warnings', p.dirPath]);
+
+ //TODO(jwren) Once http://dartbug.com/40768 is resolved, this assertion
+ // should be exitCode == 2, not greater than 0:
+ expect(result.exitCode, greaterThan(0));
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains("1 issue found."));
+ });
+
+ test('warning implicit --fatal-warnings', () {
+ p = project(mainSrc: _warningDartCodeSnippet);
+ var result = p.runSync('analyze', [p.dirPath]);
+
+ //TODO(jwren) Once http://dartbug.com/40768 is resolved, this assertion
+ // should be exitCode == 2, not greater than 0:
+ expect(result.exitCode, greaterThan(0));
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains("1 issue found."));
+ });
+
+ test('warning --no-fatal-warnings', () {
+ p = project(mainSrc: _warningDartCodeSnippet);
+ var result = p.runSync('analyze', ['--no-fatal-warnings', p.dirPath]);
+
+ //TODO(jwren) Once http://dartbug.com/40768 is resolved, this assertion
+ // should be exitCode == 0:
+ // expect(result.exitCode, 0);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains("1 issue found."));
+ });
+
+ test('info implicit no --fatal-infos', () {
+ p = project(mainSrc: "String foo() {}");
+ var result = p.runSync('analyze', [p.dirPath]);
+
+ expect(result.exitCode, 0);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains("1 issue found."));
+ });
+
+ test('info --fatal-infos', () {
+ p = project(mainSrc: "String foo() {}");
+ var result = p.runSync('analyze', ['--fatal-infos', p.dirPath]);
+
+ expect(result.exitCode, 1);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains("1 issue found."));
+ });
+}
diff --git a/pkg/dartdev/test/commands/create_test.dart b/pkg/dartdev/test/commands/create_test.dart
index 6a63cf7..4eaee40 100644
--- a/pkg/dartdev/test/commands/create_test.dart
+++ b/pkg/dartdev/test/commands/create_test.dart
@@ -12,10 +12,10 @@
import '../utils.dart';
void main() {
- group('create', defineCreate);
+ group('create', defineCreateTests);
}
-void defineCreate() {
+void defineCreateTests() {
TestProject p;
setUp(() => p = null);
@@ -50,7 +50,7 @@
test('no directory given', () {
p = project();
- ProcessResult result = p.runSync('create');
+ ProcessResult result = p.runSync('create', []);
expect(result.exitCode, 1);
});
diff --git a/pkg/dartdev/test/commands/flag_test.dart b/pkg/dartdev/test/commands/flag_test.dart
index 9d53664..437a7c1 100644
--- a/pkg/dartdev/test/commands/flag_test.dart
+++ b/pkg/dartdev/test/commands/flag_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 'package:args/command_runner.dart';
import 'package:dartdev/dartdev.dart';
import 'package:test/test.dart';
@@ -18,8 +19,7 @@
test('--help', () {
p = project();
-
- var result = p.runSync('--help');
+ var result = p.runSync('--help', []);
expect(result.exitCode, 0);
expect(result.stderr, isEmpty);
@@ -28,4 +28,15 @@
expect(result.stdout, contains('Global options:'));
expect(result.stdout, contains('Available commands:'));
});
+
+ // For each command description, assert that the values are not empty, don't
+ // have trailing white space and end with a period.
+ test('description formatting', () {
+ DartdevRunner([]).commands.forEach((String commandKey, Command command) {
+ expect(commandKey, isNotEmpty);
+ expect(command.description, isNotEmpty);
+ expect(command.description, endsWith('.'));
+ expect(command.description.trim(), equals(command.description));
+ });
+ });
}
diff --git a/pkg/dartdev/test/commands/format_test.dart b/pkg/dartdev/test/commands/format_test.dart
index 6d8b905..4d8ed8f 100644
--- a/pkg/dartdev/test/commands/format_test.dart
+++ b/pkg/dartdev/test/commands/format_test.dart
@@ -19,10 +19,10 @@
test('implicit --help', () {
p = project();
- var result = p.runSync('format');
+ var result = p.runSync('format', []);
expect(result.exitCode, 0);
expect(result.stderr, isEmpty);
- expect(result.stdout, contains('Idiomatically formats Dart source code.'));
+ expect(result.stdout, contains('Format Dart source code.'));
expect(result.stdout, contains('Usage: dart format [arguments]'));
});
@@ -31,7 +31,7 @@
var result = p.runSync('format', ['--help']);
expect(result.exitCode, 0);
expect(result.stderr, isEmpty);
- expect(result.stdout, contains('Idiomatically formats Dart source code.'));
+ expect(result.stdout, contains('Format Dart source code.'));
expect(result.stdout, contains('Usage: dart format [arguments]'));
});
diff --git a/pkg/dartdev/test/commands/migrate_test.dart b/pkg/dartdev/test/commands/migrate_test.dart
new file mode 100644
index 0000000..513ddc3
--- /dev/null
+++ b/pkg/dartdev/test/commands/migrate_test.dart
@@ -0,0 +1,56 @@
+// Copyright (c) 2020, 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.
+
+/// A set of integration tests for `dart migrate`.
+import 'package:test/test.dart';
+
+import '../utils.dart';
+
+void main() {
+ group('migrate', defineMigrateTests);
+}
+
+void defineMigrateTests() {
+ TestProject p;
+
+ tearDown(() => p?.dispose());
+
+ test('--help', () {
+ p = project();
+ var result = p.runSync('migrate', ['--help']);
+
+ expect(result.exitCode, 0);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout,
+ contains('Perform a null safety migration on a project or package.'));
+ expect(result.stdout,
+ contains('Usage: dart migrate [arguments] [project or directory]'));
+ });
+
+ test('directory implicit', () {
+ p = project(mainSrc: 'int get foo => 1;\n');
+ var result =
+ p.runSync('migrate', ['--no-web-preview'], workingDir: p.dirPath);
+ expect(result.exitCode, 0);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains('Generating migration suggestions'));
+ });
+
+ test('directory explicit', () {
+ p = project(mainSrc: 'int get foo => 1;\n');
+ var result = p.runSync('migrate', ['--no-web-preview', p.dirPath]);
+ expect(result.exitCode, 0);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains('Generating migration suggestions'));
+ });
+
+ test('bad directory', () {
+ p = project(mainSrc: 'int get foo => 1;\n');
+ var result = p.runSync('migrate', ['foo_bar_dir']);
+ expect(result.exitCode, 64);
+ expect(result.stderr,
+ contains('not found; please provide a path to a package or directory'));
+ expect(result.stdout, isEmpty);
+ });
+}
diff --git a/pkg/dartdev/test/commands/pub_test.dart b/pkg/dartdev/test/commands/pub_test.dart
index 011b323..fa49271 100644
--- a/pkg/dartdev/test/commands/pub_test.dart
+++ b/pkg/dartdev/test/commands/pub_test.dart
@@ -17,12 +17,11 @@
test('implicit --help', () {
p = project();
- var result = p.runSync('pub');
- expect(result.exitCode, 64);
- expect(result.stdout, isEmpty);
- expect(result.stderr, contains('Usage: dart pub <subcommand> [arguments]'));
- expect(result.stderr,
- contains('Print debugging information when an error occurs.'));
+ var result = p.runSync('pub', []);
+ expect(result.exitCode, 0);
+ expect(result.stdout, contains('Pub is a package manager for Dart'));
+ expect(result.stdout, contains('Available commands:'));
+ expect(result.stderr, isEmpty);
});
test('--help', () {
@@ -30,29 +29,24 @@
var result = p.runSync('pub', ['--help']);
expect(result.exitCode, 0);
+ expect(result.stdout, contains('Pub is a package manager for Dart'));
+ expect(result.stdout, contains('Available commands:'));
expect(result.stderr, isEmpty);
- expect(result.stdout, contains('Pub is a package manager for Dart.'));
- expect(result.stdout, contains('Usage: dart pub <subcommand> [arguments]'));
- expect(result.stdout,
- contains('Print debugging information when an error occurs.'));
- });
-
- test('success', () {
- p = project(mainSrc: 'int get foo => 1;\n');
- var result = p.runSync('pub', ['deps']);
- expect(result.exitCode, 1);
- expect(
- result.stderr,
- startsWith(
- '''No pubspec.lock file found, please run "pub get" first.'''));
- expect(result.stdout, isEmpty);
});
test('failure', () {
p = project(mainSrc: 'int get foo => 1;\n');
+ var result = p.runSync('pub', ['deps']);
+ expect(result.exitCode, 65);
+ expect(result.stdout, isEmpty);
+ expect(result.stderr, contains('No pubspec.lock file found'));
+ });
+
+ test('failure unknown option', () {
+ p = project(mainSrc: 'int get foo => 1;\n');
var result = p.runSync('pub', ['deps', '--foo']);
expect(result.exitCode, 64);
- expect(result.stderr, startsWith('Could not find an option named "foo".'));
expect(result.stdout, isEmpty);
+ expect(result.stderr, startsWith('Could not find an option named "foo".'));
});
}
diff --git a/pkg/dartdev/test/test_all.dart b/pkg/dartdev/test/test_all.dart
index 914f41c..3feaae2 100644
--- a/pkg/dartdev/test/test_all.dart
+++ b/pkg/dartdev/test/test_all.dart
@@ -4,17 +4,21 @@
import 'package:test/test.dart';
+import 'commands/analyze_test.dart' as analyze;
import 'commands/create_test.dart' as create;
import 'commands/flag_test.dart' as flag;
import 'commands/format_test.dart' as format;
+import 'commands/migrate_test.dart' as migrate;
import 'commands/pub_test.dart' as pub;
import 'utils_test.dart' as utils;
main() {
group('dartdev', () {
+ analyze.main();
create.main();
flag.main();
format.main();
+ migrate.main();
pub.main();
utils.main();
});
diff --git a/pkg/dartdev/test/utils.dart b/pkg/dartdev/test/utils.dart
index abd3b18..f852731 100644
--- a/pkg/dartdev/test/utils.dart
+++ b/pkg/dartdev/test/utils.dart
@@ -5,13 +5,18 @@
import 'dart:io';
import 'package:path/path.dart' as path;
+import 'package:test/test.dart';
+
+Timeout defaultTimeout = Timeout(Duration(seconds: 15));
TestProject project({String mainSrc}) => TestProject(mainSrc: mainSrc);
class TestProject {
+ static String get defaultProjectName => 'dartdev_temp';
+
Directory dir;
- static String get defaultProjectName => 'dartdev_temp';
+ String get dirPath => dir.path;
String get name => defaultProjectName;
@@ -32,10 +37,16 @@
}
void dispose() {
- dir.deleteSync(recursive: true);
+ if (dir.existsSync()) {
+ dir.deleteSync(recursive: true);
+ }
}
- ProcessResult runSync(String command, [List<String> args]) {
+ ProcessResult runSync(
+ String command,
+ List<String> args, {
+ String workingDir,
+ }) {
var arguments = [
absolutePathToDartdevFile,
command,
@@ -48,7 +59,7 @@
return Process.runSync(
Platform.resolvedExecutable,
arguments,
- workingDirectory: dir.path,
+ workingDirectory: workingDir ?? dir.path,
);
}
diff --git a/pkg/dartdev/test/utils_test.dart b/pkg/dartdev/test/utils_test.dart
index 5850905..be84f59 100644
--- a/pkg/dartdev/test/utils_test.dart
+++ b/pkg/dartdev/test/utils_test.dart
@@ -19,4 +19,26 @@
expect(pluralize('cat', 2), 'cats');
});
});
+
+ group('trimEnd', () {
+ test('null string', () {
+ expect(trimEnd(null, 'suffix'), null);
+ });
+
+ test('null suffix', () {
+ expect(trimEnd('string', null), 'string');
+ });
+
+ test('suffix empty', () {
+ expect(trimEnd('string', ''), 'string');
+ });
+
+ test('suffix miss', () {
+ expect(trimEnd('string', 'suf'), 'string');
+ });
+
+ test('suffix hit', () {
+ expect(trimEnd('string', 'ring'), 'st');
+ });
+ });
}
diff --git a/pkg/dartfix/analysis_options.yaml b/pkg/dartfix/analysis_options.yaml
index bfac98e..bef508c 100644
--- a/pkg/dartfix/analysis_options.yaml
+++ b/pkg/dartfix/analysis_options.yaml
@@ -23,7 +23,7 @@
#
#- always_declare_return_types # 17
- always_require_non_null_named_parameters
- #- annotate_overrides # 4
+ - annotate_overrides
- avoid_null_checks_in_equality_operators
- camel_case_extensions
#- omit_local_variable_types # 44
@@ -36,5 +36,5 @@
#- prefer_if_null_operators # 2
- prefer_single_quotes
- prefer_spread_collections
- #- unnecessary_this # 1
+ - unnecessary_this
- use_function_type_syntax_for_parameters
diff --git a/pkg/dartfix/lib/src/context.dart b/pkg/dartfix/lib/src/context.dart
index e6bb598..dd28a47 100644
--- a/pkg/dartfix/lib/src/context.dart
+++ b/pkg/dartfix/lib/src/context.dart
@@ -8,15 +8,17 @@
class Context {
String get workingDir => io.Directory.current.path;
- bool exists(String filePath) =>
- io.FileSystemEntity.typeSync(filePath) !=
- io.FileSystemEntityType.notFound;
+ bool exists(String filePath) {
+ return io.FileSystemEntity.typeSync(filePath) !=
+ io.FileSystemEntityType.notFound;
+ }
void exit(int code) {
io.exit(code);
}
- bool isDirectory(String filePath) =>
- io.FileSystemEntity.typeSync(filePath) ==
- io.FileSystemEntityType.directory;
+ bool isDirectory(String filePath) {
+ return io.FileSystemEntity.typeSync(filePath) ==
+ io.FileSystemEntityType.directory;
+ }
}
diff --git a/pkg/dartfix/lib/src/driver.dart b/pkg/dartfix/lib/src/driver.dart
index 334a785..11e3616 100644
--- a/pkg/dartfix/lib/src/driver.dart
+++ b/pkg/dartfix/lib/src/driver.dart
@@ -235,7 +235,7 @@
context = testContext ?? options.context;
logger = testLogger ?? options.logger;
server = Server(listener: _Listener(logger));
- handler = _Handler(this);
+ handler = _Handler(this, context);
// Start showing progress before we start the analysis server.
Progress progress;
@@ -404,12 +404,13 @@
with NotificationHandler, ConnectionHandler, AnalysisCompleteHandler {
final Driver driver;
final Logger logger;
+ final Context context;
@override
final Server server;
Version serverProtocolVersion;
- _Handler(this.driver)
+ _Handler(this.driver, this.context)
: logger = driver.logger,
server = driver.server;
@@ -434,11 +435,15 @@
' • ${loc.startLine}:${loc.startColumn}');
}
}
+ super.onAnalysisErrors(params);
+ // Analysis errors are non-fatal; no need to exit.
}
@override
void onFailedToConnect() {
logger.stderr('Failed to connect to server');
+ super.onFailedToConnect();
+ // Exiting on connection failure is already handled by [Driver.start].
}
@override
@@ -462,6 +467,8 @@
pub global activate dartfix <version>
''');
}
+ super.onProtocolNotSupported(version);
+ // This is handled by the connection failure case; no need to exit here.
}
@override
@@ -475,6 +482,8 @@
logger.stderr(params.stackTrace);
}
super.onServerError(params);
+ // Server is stopped by super method, so we can safely exit here.
+ context.exit(16);
}
}
diff --git a/pkg/dartfix/lib/src/migrate/apply.dart b/pkg/dartfix/lib/src/migrate/apply.dart
new file mode 100644
index 0000000..0120c5c
--- /dev/null
+++ b/pkg/dartfix/lib/src/migrate/apply.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2020, 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:analysis_server_client/protocol.dart';
+
+/// Perform the indicated source edits to the given source, returning the
+/// resulting transformed text.
+String applyEdits(SourceFileEdit sourceFileEdit, String source) {
+ // Sort edits in reverse offset order.
+ List<SourceEdit> edits = sourceFileEdit.edits.toList();
+ edits.sort((a, b) {
+ return b.offset - a.offset;
+ });
+
+ return SourceEdit.applySequence(source, edits);
+}
diff --git a/pkg/dartfix/lib/src/migrate/display.dart b/pkg/dartfix/lib/src/migrate/display.dart
new file mode 100644
index 0000000..2099835
--- /dev/null
+++ b/pkg/dartfix/lib/src/migrate/display.dart
@@ -0,0 +1,74 @@
+// Copyright (c) 2020, 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:analysis_server_client/protocol.dart';
+import 'package:cli_util/cli_logging.dart';
+import 'package:path/path.dart' as path;
+
+/// Given a Logger and an analysis issue, render the issue to the logger.
+class IssueRenderer {
+ final Logger logger;
+ final String rootDirectory;
+
+ IssueRenderer(this.logger, this.rootDirectory);
+
+ void render(AnalysisError issue) {
+ // severity • Message ... at foo/bar.dart:6:1 • (error_code)
+
+ final Ansi ansi = logger.ansi;
+
+ logger.stdout(
+ ' ${ansi.error(issue.severity.name.toLowerCase())} • '
+ '${ansi.emphasized(_removePeriod(issue.message))} '
+ 'at ${path.relative(issue.location.file, from: rootDirectory)}'
+ ':${issue.location.startLine}:'
+ '${issue.location.startColumn} '
+ '• (${issue.code})',
+ );
+ }
+}
+
+typedef LineProcessor = void Function(int lineNumber, String lineText);
+
+class SourcePrinter {
+ static final String red = '\u001b[31m';
+ static final String bold = '\u001b[1m';
+ static final String reversed = '\u001b[7m';
+ static final String none = '\u001b[0m';
+
+ String source;
+
+ SourcePrinter(this.source);
+
+ void deleteRange(int offset, int length) {
+ // \u001b[31m - red
+
+ source = source.substring(0, offset) +
+ red +
+ reversed +
+ source.substring(offset, offset + length) +
+ none +
+ source.substring(offset + length);
+ }
+
+ void insertText(int offset, String text) {
+ text = '$reversed$text$none';
+ source = source.substring(0, offset) + text + source.substring(offset);
+ }
+
+ void processChangedLines(LineProcessor callback) {
+ List<String> lines = source.split('\n');
+ for (int i = 0; i < lines.length; i++) {
+ String line = lines[i];
+
+ if (line.contains(none)) {
+ callback(i + 1, line);
+ }
+ }
+ }
+}
+
+String _removePeriod(String value) {
+ return value.endsWith('.') ? value.substring(0, value.length - 1) : value;
+}
diff --git a/pkg/dartfix/lib/src/migrate/migrate.dart b/pkg/dartfix/lib/src/migrate/migrate.dart
new file mode 100644
index 0000000..30ef821
--- /dev/null
+++ b/pkg/dartfix/lib/src/migrate/migrate.dart
@@ -0,0 +1,442 @@
+// Copyright (c) 2020, 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:async';
+import 'dart:io';
+
+import 'package:analysis_server_client/handler/notification_handler.dart';
+import 'package:analysis_server_client/listener/server_listener.dart';
+import 'package:analysis_server_client/protocol.dart';
+import 'package:analysis_server_client/server.dart';
+import 'package:args/command_runner.dart';
+import 'package:cli_util/cli_logging.dart';
+import 'package:path/path.dart' as path;
+
+import 'apply.dart';
+import 'display.dart';
+import 'options.dart';
+
+typedef LogProvider = Logger Function();
+
+// TODO(devoncarew): Over time, we should look to share code with the
+// implementation here and that in lib/src/driver.dart.
+
+/// Perform null safety related migrations on the user's code.
+class MigrateCommand extends Command {
+ final LogProvider logProvider;
+
+ @override
+ String get name => 'migrate';
+
+ @override
+ String get description =>
+ 'Perform a null safety migration on a project or package.';
+
+ @override
+ String get invocation {
+ return '${super.invocation} [project or directory]';
+ }
+
+ MigrateCommand({this.logProvider}) {
+ MigrateOptions.defineOptions(argParser);
+ }
+
+ @override
+ Future<int> run() async {
+ MigrateOptions options = _parseAndValidateOptions();
+
+ Logger logger;
+ if (logProvider != null) {
+ logger = logProvider();
+ }
+ logger ??= Logger.standard();
+
+ final Ansi ansi = logger.ansi;
+
+ logger.stdout('Migrating ${options.directory}');
+ logger.stdout('');
+
+ Progress progress =
+ logger.progress('${ansi.emphasized('Analyzing project')}');
+
+ Server server =
+ Server(listener: logger.isVerbose ? _ServerListener(logger) : null);
+
+ Map<String, List<AnalysisError>> fileErrors = {};
+
+ try {
+ await server.start(
+ clientId: 'dart $name', clientVersion: _dartSdkVersion);
+ _ServerNotifications serverNotifications = _ServerNotifications(server);
+ await serverNotifications.listenToServer(server);
+
+ serverNotifications.analysisErrorsEvents
+ .listen((AnalysisErrorsParams event) {
+ List<AnalysisError> errors = event.errors
+ .where((error) => error.severity == AnalysisErrorSeverity.ERROR)
+ .toList();
+ if (errors.isEmpty) {
+ fileErrors.remove(event.file);
+ } else {
+ fileErrors[event.file] = errors;
+ }
+ });
+
+ var params =
+ AnalysisSetAnalysisRootsParams([options.directoryAbsolute], []);
+ await server.send(ANALYSIS_REQUEST_SET_ANALYSIS_ROOTS, params.toJson());
+
+ await serverNotifications.onNextAnalysisComplete;
+
+ progress.finish(showTiming: true);
+ } finally {
+ progress.cancel();
+ }
+
+ // Handle if there were any errors.
+ if (fileErrors.isEmpty) {
+ logger.stdout('No analysis issues found.');
+ } else {
+ logger.stdout('');
+
+ int issueCount =
+ fileErrors.values.map((list) => list.length).reduce((a, b) => a + b);
+ logger.stdout(
+ '$issueCount analysis ${_pluralize('issue', issueCount)} found:');
+ _displayIssues(
+ logger,
+ options.directory,
+ fileErrors.values
+ .fold(<AnalysisError>[], (list, element) => list..addAll(element)),
+ );
+
+ logger.stdout('');
+ logger.stdout(
+ 'Note: analysis errors will result in erroneous migration suggestions.');
+
+ if (options.ignoreErrors) {
+ logger.stdout('Continuing with migration suggestions due to the use of '
+ '--${MigrateOptions.ignoreErrorsOption}.');
+ } else if (!options.ignoreErrors) {
+ // Fail with how to continue.
+ logger.stdout('');
+ logger.stdout(
+ 'Please fix the analysis issues (or, force generation of migration '
+ 'suggestions by re-running with '
+ '--${MigrateOptions.ignoreErrorsOption}).');
+ return 1;
+ }
+ }
+
+ // Calculate migration suggestions.
+ logger.stdout('');
+ progress = logger
+ .progress('${ansi.emphasized('Generating migration suggestions')}');
+
+ Map<String, dynamic> json;
+
+ try {
+ final EditDartfixParams params =
+ EditDartfixParams([options.directoryAbsolute]);
+ params.includedFixes = ['non-nullable'];
+ json = await server.send(EDIT_REQUEST_DARTFIX, params.toJson());
+ progress.finish(showTiming: true);
+ } finally {
+ progress.cancel();
+ }
+
+ EditDartfixResult migrationResults =
+ EditDartfixResult.fromJson(ResponseDecoder(null), 'result', json);
+
+ if (migrationResults.suggestions.isEmpty) {
+ logger.stdout('No migration changes necessary.');
+ return 0;
+ }
+
+ List<SourceEdit> allEdits = migrationResults.edits
+ .fold(<SourceEdit>[], (list, edit) => list..addAll(edit.edits));
+ List<String> files =
+ migrationResults.edits.map((edit) => edit.file).toList();
+
+ logger.stdout('Found ${allEdits.length} '
+ 'suggested ${_pluralize('change', allEdits.length)} in '
+ '${files.length} ${_pluralize('file', files.length)}.');
+
+ logger.stdout('');
+
+ if (options.applyChanges) {
+ logger.stdout(ansi.emphasized('Applying changes:'));
+
+ _applyMigrationSuggestions(logger, options.directory, migrationResults);
+
+ logger.stdout('');
+ logger.stdout(
+ 'Applied ${allEdits.length} ${_pluralize('edit', allEdits.length)}.');
+
+ return 0;
+ }
+
+ if (options.webPreview) {
+ String url = migrationResults.urls.first;
+
+ logger.stdout(ansi.emphasized('Migration results available:'));
+ logger.stdout('Visit $url to see the migration results.');
+
+ // TODO(devoncarew): Open a browser automatically.
+
+ logger.stdout('');
+ logger.stdout('To apply these changes, re-run the tool with '
+ '--${MigrateOptions.applyChangesOption}.');
+
+ logger.stdout('');
+ logger.stdout('When finished with the preview, hit ctrl-c '
+ 'to terminate this process.');
+
+ // Block until sigint (ctrl-c).
+ await _blockUntilSignalInterrupt();
+ } else {
+ logger.stdout(ansi.emphasized('Summary of changes:'));
+
+ _displayChangeSummary(logger, options.directory, migrationResults);
+
+ logger.stdout('');
+ logger.stdout('To apply these changes, re-run the tool with '
+ '--${MigrateOptions.applyChangesOption}.');
+ }
+
+ // ignore: unawaited_futures
+ server.stop(timeLimit: Duration(seconds: 1));
+
+ return 0;
+ }
+
+ /// Parse and validate the user's options; throw a UsageException if there are
+ /// issues, and return an [MigrateOptions] result otherwise.
+ MigrateOptions _parseAndValidateOptions() {
+ String dirPath;
+
+ if (argResults.rest.isNotEmpty) {
+ if (argResults.rest.length == 1) {
+ dirPath = argResults.rest.first;
+
+ if (FileSystemEntity.isFileSync(dirPath)) {
+ // Calling this will throw an exception.
+ usageException(
+ 'Please provide a path to a package or directory to migrate.');
+ } else if (!FileSystemEntity.isDirectorySync(dirPath)) {
+ // Calling this will throw an exception.
+ usageException("'$dirPath' not found; "
+ 'please provide a path to a package or directory to migrate.');
+ }
+ } else {
+ // Calling this will throw an exception.
+ usageException(
+ 'Please provide a path to a package or directory to migrate.');
+ }
+ } else {
+ dirPath = Directory.current.path;
+ }
+
+ return MigrateOptions(argResults, dirPath);
+ }
+
+ void _displayIssues(
+ Logger logger,
+ String directory,
+ List<AnalysisError> issues,
+ ) {
+ issues.sort((AnalysisError one, AnalysisError two) {
+ if (one.location.file != two.location.file) {
+ return one.location.file.compareTo(two.location.file);
+ }
+ return one.location.offset - two.location.offset;
+ });
+
+ IssueRenderer renderer = IssueRenderer(logger, directory);
+ for (AnalysisError issue in issues) {
+ renderer.render(issue);
+ }
+ }
+
+ void _displayChangeSummary(
+ Logger logger,
+ String directory,
+ EditDartfixResult migrationResults,
+ ) {
+ final Ansi ansi = logger.ansi;
+
+ Map<String, List<DartFixSuggestion>> fileSuggestions = {};
+ for (DartFixSuggestion suggestion in migrationResults.suggestions) {
+ String file = suggestion.location.file;
+ fileSuggestions.putIfAbsent(file, () => <DartFixSuggestion>[]);
+ fileSuggestions[file].add(suggestion);
+ }
+
+ // present a diff-like view
+ for (SourceFileEdit sourceFileEdit in migrationResults.edits) {
+ String file = sourceFileEdit.file;
+ String relPath = path.relative(file, from: directory);
+ int count = sourceFileEdit.edits.length;
+
+ logger.stdout('');
+ logger.stdout('${ansi.emphasized(relPath)} '
+ '($count ${_pluralize('change', count)}):');
+
+ String source;
+ try {
+ source = File(file).readAsStringSync();
+ } catch (_) {}
+
+ if (source == null) {
+ logger.stdout(' (unable to retrieve source for file)');
+ } else {
+ SourcePrinter sourcePrinter = SourcePrinter(source);
+
+ // Sort edits in reverse offset order.
+ List<SourceEdit> edits = sourceFileEdit.edits;
+ edits.sort((a, b) {
+ return b.offset - a.offset;
+ });
+
+ for (SourceEdit edit in sourceFileEdit.edits) {
+ if (edit.replacement.isNotEmpty) {
+ // an addition
+ sourcePrinter.insertText(
+ edit.offset + edit.length, edit.replacement);
+ }
+
+ if (edit.length != 0) {
+ // a removal
+ sourcePrinter.deleteRange(edit.offset, edit.length);
+ }
+ }
+
+ // Render the changed lines.
+ sourcePrinter.processChangedLines((lineNumber, lineText) {
+ String prefix = ' line ${lineNumber.toString().padRight(3)} •';
+ logger.stdout('$prefix ${lineText.trim()}');
+ });
+ }
+ }
+ }
+
+ void _applyMigrationSuggestions(
+ Logger logger,
+ String directory,
+ EditDartfixResult migrationResults,
+ ) {
+ // Apply the changes to disk.
+ for (SourceFileEdit sourceFileEdit in migrationResults.edits) {
+ String relPath = path.relative(sourceFileEdit.file, from: directory);
+ int count = sourceFileEdit.edits.length;
+ logger.stdout(' $relPath ($count ${_pluralize('change', count)})');
+
+ String source;
+ try {
+ source = File(sourceFileEdit.file).readAsStringSync();
+ } catch (_) {}
+
+ if (source == null) {
+ logger.stdout(' Unable to retrieve source for file.');
+ } else {
+ source = applyEdits(sourceFileEdit, source);
+
+ try {
+ File(sourceFileEdit.file).writeAsStringSync(source);
+ } catch (e) {
+ logger.stdout(' Unable to write source for file: $e');
+ }
+ }
+ }
+ }
+
+ Future _blockUntilSignalInterrupt() {
+ Stream<ProcessSignal> stream = ProcessSignal.sigint.watch();
+ return stream.first;
+ }
+}
+
+class _ServerNotifications with NotificationHandler {
+ final Server server;
+
+ StreamController<ServerStatusParams> _serverStatusController =
+ StreamController<ServerStatusParams>.broadcast();
+
+ StreamController<AnalysisErrorsParams> _analysisErrorsController =
+ StreamController<AnalysisErrorsParams>.broadcast();
+
+ _ServerNotifications(this.server);
+
+ Stream<ServerStatusParams> get serverStatusEvents =>
+ _serverStatusController.stream;
+
+ Stream<AnalysisErrorsParams> get analysisErrorsEvents =>
+ _analysisErrorsController.stream;
+
+ Future listenToServer(Server server) async {
+ server.listenToOutput(notificationProcessor: handleEvent);
+
+ await server.send(SERVER_REQUEST_SET_SUBSCRIPTIONS,
+ ServerSetSubscriptionsParams([ServerService.STATUS]).toJson());
+ }
+
+ @override
+ void onServerStatus(ServerStatusParams event) {
+ if (event.analysis != null) {
+ _serverStatusController.add(event);
+ }
+ }
+
+ Future get onNextAnalysisComplete {
+ Completer completer = Completer();
+
+ StreamSubscription sub;
+ sub = serverStatusEvents.listen((event) {
+ if (!event.analysis.isAnalyzing) {
+ sub.cancel();
+ completer.complete();
+ }
+ });
+
+ return completer.future;
+ }
+
+ @override
+ void onAnalysisErrors(AnalysisErrorsParams event) {
+ _analysisErrorsController.add(event);
+ }
+}
+
+class _ServerListener with ServerListener {
+ final Logger logger;
+
+ _ServerListener(this.logger);
+
+ @override
+ void log(String prefix, String details) {
+ logger.trace('[$prefix] $details');
+ }
+}
+
+String get _dartSdkVersion {
+ String version = Platform.version;
+
+ // Remove the build date and OS.
+ if (version.contains(' ')) {
+ version = version.substring(0, version.indexOf(' '));
+ }
+
+ // Convert a git hash to 8 chars.
+ // '2.8.0-edge.fd992e423ef69ece9f44bd3ac58fa2355b563212'
+ final RegExp versionRegExp = RegExp(r'^.*\.([0123456789abcdef]+)$');
+ RegExpMatch match = versionRegExp.firstMatch(version);
+ if (match != null && match.group(1).length == 40) {
+ String commit = match.group(1);
+ version = version.replaceAll(commit, commit.substring(0, 10));
+ }
+
+ return version;
+}
+
+String _pluralize(String word, int count) => count == 1 ? word : '${word}s';
diff --git a/pkg/dartfix/lib/src/migrate/options.dart b/pkg/dartfix/lib/src/migrate/options.dart
new file mode 100644
index 0000000..d72394a
--- /dev/null
+++ b/pkg/dartfix/lib/src/migrate/options.dart
@@ -0,0 +1,56 @@
+// Copyright (c) 2020, 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 'package:args/args.dart';
+import 'package:args/src/arg_parser.dart';
+import 'package:path/path.dart' as path;
+
+class MigrateOptions {
+ static const ignoreErrorsOption = 'ignore-errors';
+ static const applyChangesOption = 'apply-changes';
+
+ final String directory;
+ final bool applyChanges;
+ final bool ignoreErrors;
+ final bool webPreview;
+
+ MigrateOptions(ArgResults argResults, this.directory)
+ : applyChanges = argResults[applyChangesOption] as bool,
+ ignoreErrors = argResults[ignoreErrorsOption] as bool,
+ webPreview = argResults['web-preview'] as bool;
+
+ String get directoryAbsolute => Directory(path.canonicalize(directory)).path;
+
+ @override
+ String toString() {
+ return '[$directory]';
+ }
+
+ static void defineOptions(ArgParser argParser) {
+ argParser.addFlag(
+ applyChangesOption,
+ defaultsTo: false,
+ negatable: false,
+ help: 'Apply the proposed null safety changes to the files on disk.',
+ );
+ argParser.addFlag(
+ ignoreErrorsOption,
+ defaultsTo: false,
+ negatable: false,
+ help: 'Attempt to perform null safety analysis even if there are '
+ 'analysis errors in the project.',
+ );
+ argParser.addFlag(
+ 'web-preview',
+ defaultsTo: true,
+ negatable: true,
+ help: 'Show an interactive preview of the proposed null safety changes '
+ 'in a browser window.\n'
+ 'With --no-web-preview, the proposed changes are instead printed to '
+ 'the console.',
+ );
+ }
+}
diff --git a/pkg/dartfix/pubspec.yaml b/pkg/dartfix/pubspec.yaml
index 126019a..628c71b 100644
--- a/pkg/dartfix/pubspec.yaml
+++ b/pkg/dartfix/pubspec.yaml
@@ -24,7 +24,3 @@
analyzer: ^0.37.0
pedantic: ^1.8.0
test: ^1.3.0
-
-dependency_overrides:
- analysis_server_client:
- path: ../analysis_server_client
diff --git a/pkg/dartfix/test/src/migrate_command_test.dart b/pkg/dartfix/test/src/migrate_command_test.dart
new file mode 100644
index 0000000..4215266
--- /dev/null
+++ b/pkg/dartfix/test/src/migrate_command_test.dart
@@ -0,0 +1,190 @@
+// Copyright (c) 2020, 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 'package:analysis_server_client/protocol.dart';
+import 'package:cli_util/cli_logging.dart';
+import 'package:dartfix/src/migrate/apply.dart';
+import 'package:dartfix/src/migrate/display.dart';
+import 'package:test/test.dart';
+
+void main() {
+ defineMigrateTests();
+}
+
+void defineMigrateTests() {
+ group('issue render', defineIssueRenderTests);
+ group('SourcePrinter', defineSourcePrinterTests);
+ group('applyEdits', defineApplyEditsTests);
+}
+
+void defineIssueRenderTests() {
+ IssueRenderer renderer;
+ TestLogger logger;
+
+ setUp(() {
+ logger = TestLogger();
+ renderer = IssueRenderer(logger, '.');
+ });
+
+ test('issue1', () {
+ AnalysisError issue = AnalysisError(
+ AnalysisErrorSeverity.ERROR,
+ AnalysisErrorType.COMPILE_TIME_ERROR,
+ Location('foo/bar/baz.dart', 1, 2, 3, 4),
+ 'My message.',
+ 'my_error_code',
+ );
+
+ renderer.render(issue);
+
+ expect(
+ logger.stdoutText.trim(),
+ contains(platformPath(
+ 'error • My message at foo/bar/baz.dart:3:4 • (my_error_code)')),
+ );
+ expect(logger.stderrText, isEmpty);
+ });
+
+ test('issue2', () {
+ AnalysisError issue = AnalysisError(
+ AnalysisErrorSeverity.INFO,
+ AnalysisErrorType.TODO,
+ Location('foo/bar/qux.dart', 1, 2, 3, 4),
+ 'todo: My message.',
+ 'todo',
+ );
+
+ renderer.render(issue);
+
+ expect(
+ logger.stdoutText,
+ contains(platformPath(
+ 'info • todo: My message at foo/bar/qux.dart:3:4 • (todo)')));
+
+ expect(logger.stderrText, isEmpty);
+ });
+}
+
+void defineSourcePrinterTests() {
+ SourcePrinter printer;
+
+ setUp(() {
+ printer = SourcePrinter('''
+void main() {
+ Cat one = Cat('Tabby');
+ print(one);
+}
+
+class Cat {
+ final String name;
+ String color;
+
+ Cat(this.name);
+
+ String toString() {
+ return name?.toString() + ' is ' + color.toString();
+ }
+}
+''');
+ });
+
+ test('add and remove', () {
+ printer.insertText(192, '?');
+ printer.deleteRange(164, 1);
+ printer.insertText(98, '?');
+
+ StringBuffer buf = StringBuffer();
+ printer.processChangedLines((lineNumber, lineText) {
+ buf.writeln('$lineNumber ${lineText.trim()}');
+ });
+
+ expect(buf.toString().trim(), '''
+8 String\x1B[7m?\x1B[0m color;
+13 return name?\x1B[31m\x1B[7m.\x1B[0mtoString() + \' is \' + color\x1B[7m?\x1B[0m.toString();''');
+ });
+}
+
+void defineApplyEditsTests() {
+ test('insert', () {
+ String source = 'one two\nthree four';
+ SourceFileEdit edit = SourceFileEdit('foo.dart', 0, edits: [
+ SourceEdit(0, 0, 'five '),
+ ]);
+
+ String result = applyEdits(edit, source);
+ expect(result, 'five one two\nthree four');
+ });
+
+ test('delete', () {
+ String source = 'one two\nthree four';
+ SourceFileEdit edit = SourceFileEdit('foo.dart', 0, edits: [
+ SourceEdit(0, 4, ''),
+ SourceEdit(8, 6, ''),
+ ]);
+
+ String result = applyEdits(edit, source);
+ expect(result, 'two\nfour');
+ });
+
+ test('insert and delete', () {
+ String source = 'one two\nthree four';
+ SourceFileEdit edit = SourceFileEdit('foo.dart', 0, edits: [
+ SourceEdit(13, 5, ''),
+ SourceEdit(8, 0, 'six '),
+ SourceEdit(7, 1, ' '),
+ ]);
+
+ String result = applyEdits(edit, source);
+ expect(result, 'one two six three');
+ });
+}
+
+class TestLogger implements Logger {
+ final bool debug;
+
+ @override
+ final Ansi ansi;
+ final stdoutBuffer = StringBuffer();
+ final stderrBuffer = StringBuffer();
+
+ TestLogger({this.debug = false}) : ansi = Ansi(false);
+
+ @override
+ void flush() {}
+
+ @override
+ bool get isVerbose => debug;
+
+ @override
+ Progress progress(String message) {
+ return SimpleProgress(this, message);
+ }
+
+ @override
+ void stdout(String message) {
+ stdoutBuffer.writeln(message);
+ }
+
+ @override
+ void stderr(String message) {
+ stderrBuffer.writeln(message);
+ }
+
+ @override
+ void trace(String message) {
+ if (debug) {
+ stdoutBuffer.writeln(message);
+ }
+ }
+
+ String get stdoutText => stdoutBuffer.toString();
+
+ String get stderrText => stderrBuffer.toString();
+}
+
+String platformPath(String path) {
+ return path.replaceAll('/', Platform.pathSeparator);
+}
diff --git a/pkg/dartfix/test/test_all.dart b/pkg/dartfix/test/test_all.dart
index 54dc9ce..c87a99f 100644
--- a/pkg/dartfix/test/test_all.dart
+++ b/pkg/dartfix/test/test_all.dart
@@ -12,6 +12,7 @@
import 'src/driver_pedantic_test.dart' as driver_pedantic;
import 'src/driver_prefer_is_empty_test.dart' as driver_prefer_is_empty;
import 'src/driver_test.dart' as driver;
+import 'src/migrate_command_test.dart' as migrate_command_test;
import 'src/options_test.dart' as options_test;
void main() {
@@ -23,5 +24,6 @@
group('driver', driver_pedantic.main);
group('driver', driver_prefer_is_empty.main);
group('driver', driver.main);
+ group('migrate', migrate_command_test.main);
group('options', options_test.main);
}
diff --git a/pkg/dev_compiler/lib/src/compiler/shared_command.dart b/pkg/dev_compiler/lib/src/compiler/shared_command.dart
index 37b4771..435c241 100644
--- a/pkg/dev_compiler/lib/src/compiler/shared_command.dart
+++ b/pkg/dev_compiler/lib/src/compiler/shared_command.dart
@@ -146,10 +146,6 @@
..addOption('module-name',
help: 'The output module name, used in some JS module formats.\n'
'Defaults to the output file name (without .js).')
- ..addOption('library-root',
- help: '(deprecated) used to name libraries inside the module, '
- 'ignored with -k.',
- hide: hide)
..addFlag('repl-compile',
help: 'compile in a more permissive REPL mode, allowing access'
' to private members across library boundaries. This should'
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index fc2238b..603618c 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -209,6 +209,9 @@
/// Maps Kernel constants to their JS aliases.
final constAliasCache = HashMap<Constant, js_ast.Expression>();
+ /// Maps uri strings in asserts and elsewhere to hoisted identifiers.
+ final _uriMap = HashMap<String, js_ast.Identifier>();
+
final Class _jsArrayClass;
final Class _privateSymbolClass;
final Class _linkedHashMapImplClass;
@@ -350,6 +353,12 @@
_constLazyAccessors.clear();
}
+ // Add assert locations
+ _uriMap.forEach((location, id) {
+ moduleItems
+ .add(js.statement('var # = #;', [id, js.escapedString(location)]));
+ });
+
moduleItems.addAll(afterClassDefItems);
afterClassDefItems.clear();
@@ -753,6 +762,8 @@
t, t.typeArguments.map(emitDeferredType));
}
return _emitInterfaceType(t, emitNullability: false);
+ } else if (t is TypeParameterType) {
+ return _emitTypeParameterType(t, emitNullability: false);
}
return _emitType(t);
}
@@ -1298,10 +1309,8 @@
emitSignature('Setter', instanceSetters);
emitSignature('StaticGetter', staticGetters);
emitSignature('StaticSetter', staticSetters);
- body.add(runtimeStatement('setLibraryUri(#, #)', [
- className,
- js.escapedString(jsLibraryDebuggerName(c.enclosingLibrary))
- ]));
+ body.add(runtimeStatement('setLibraryUri(#, #)',
+ [className, _cacheUri(jsLibraryDebuggerName(c.enclosingLibrary))]));
var instanceFields = <js_ast.Property>[];
var staticFields = <js_ast.Property>[];
@@ -1373,11 +1382,11 @@
FunctionType result;
if (!f.positionalParameters.any(isCovariantParameter) &&
!f.namedParameters.any(isCovariantParameter)) {
- result = f.computeThisFunctionType(member.enclosingLibrary.nonNullable);
+ // Avoid tagging a member as Function? or Function*
+ result = f.computeThisFunctionType(Nullability.nonNullable);
} else {
DartType reifyParameter(VariableDeclaration p) => isCovariantParameter(p)
- ? _coreTypes.objectClass.getThisType(
- _coreTypes, _coreTypes.objectClass.enclosingLibrary.nonNullable)
+ ? _coreTypes.objectRawType(member.enclosingLibrary.nullable)
: p.type;
NamedType reifyNamedParameter(VariableDeclaration p) =>
NamedType(p.name, reifyParameter(p));
@@ -1385,7 +1394,7 @@
// TODO(jmesserly): do covariant type parameter bounds also need to be
// reified as `Object`?
result = FunctionType(f.positionalParameters.map(reifyParameter).toList(),
- f.returnType, Nullability.legacy,
+ f.returnType, Nullability.nonNullable,
namedParameters: f.namedParameters.map(reifyNamedParameter).toList()
..sort(),
typeParameters: f
@@ -2542,7 +2551,10 @@
js_ast.Expression _emitFunctionTagged(js_ast.Expression fn, FunctionType type,
{bool topLevel = false}) {
var lazy = topLevel && !_canEmitTypeAtTopLevel(type);
- var typeRep = visitFunctionType(type, lazy: lazy);
+ var typeRep = visitFunctionType(
+ // Avoid tagging a closure as Function? or Function*
+ type.withNullability(Nullability.nonNullable),
+ lazy: lazy);
return runtimeCall(lazy ? 'lazyFn(#, #)' : 'fn(#, #)', [fn, typeRep]);
}
@@ -2742,14 +2754,12 @@
: namedTypes.add(param));
var allNamedTypes = type.namedParameters;
- var returnType = _emitNullabilityWrapper(
- _emitType(type.returnType), type.returnType.nullability);
+ var returnType = _emitType(type.returnType);
var requiredArgs = _emitTypeNames(requiredTypes, requiredParams, member);
List<js_ast.Expression> typeParts;
if (allNamedTypes.isNotEmpty) {
assert(optionalTypes.isEmpty);
- // TODO(vsm): The old pageloader may require annotations here.
var namedArgs = _emitTypeProperties(namedTypes);
var requiredNamedArgs = _emitTypeProperties(requiredNamedTypes);
typeParts = [returnType, requiredArgs, namedArgs, requiredNamedArgs];
@@ -2815,9 +2825,13 @@
helperCall = 'fnType(#)';
}
var typeRep = runtimeCall(helperCall, [typeParts]);
- return _cacheTypes
+ // Avoid caching the nullability of the function type itself so it can be
+ // shared by nullable, non-nullable, and legacy versions at the use site.
+ typeRep = _cacheTypes
? _typeTable.nameFunctionType(type, typeRep, lazy: lazy)
: typeRep;
+
+ return _emitNullabilityWrapper(typeRep, type.nullability);
}
js_ast.Expression _emitAnnotatedFunctionType(
@@ -3228,7 +3242,7 @@
var check = js.statement(' if (#) #.nullFailed(#, #, #, #);', [
condition,
runtimeModule,
- js.escapedString(location.file.toString()),
+ _cacheUri(location.file.toString()),
js.number(location.line),
js.number(location.column),
js.escapedString('${p.name}'),
@@ -3491,6 +3505,18 @@
throw UnsupportedError('compilation of an assert block');
}
+ // Replace a string `uri` literal with a cached top-level variable containing
+ // the value to reduce overall code size.
+ js_ast.Identifier _cacheUri(String uri) {
+ var id = _uriMap[uri];
+ if (id == null) {
+ var name = 'L${_uriMap.length}';
+ id = js_ast.TemporaryId(name);
+ _uriMap[uri] = id;
+ }
+ return id;
+ }
+
@override
js_ast.Statement visitAssertStatement(AssertStatement node) {
if (!_options.enableAsserts) return js_ast.EmptyStatement();
@@ -3519,7 +3545,7 @@
js_ast.LiteralNull()
else
_visitExpression(node.message),
- js.escapedString(location.sourceUrl.toString()),
+ _cacheUri(location.sourceUrl.toString()),
// Lines and columns are typically printed with 1 based indexing.
js.number(location.line + 1),
js.number(location.column + 1),
@@ -5258,23 +5284,48 @@
//
var isTypeError = node.isTypeError;
if (!isTypeError &&
- _types.isSubtypeOf(from, to, SubtypeCheckMode.ignoringNullabilities)) {
+ _types.isSubtypeOf(from, to, SubtypeCheckMode.withNullabilities)) {
return jsFrom;
}
- // All Dart number types map to a JS double.
+ if (!isTypeError &&
+ from.withNullability(Nullability.nonNullable) == to &&
+ _mustBeNonNullable(to)) {
+ // If the underlying type is the same, we only need a null check.
+ return runtimeCall('nullCast(#, #, #)',
+ [jsFrom, _emitType(to), js.boolean(isTypeError)]);
+ }
+
+ // All Dart number types map to a JS double. We can specialize these
+ // cases.
if (_typeRep.isNumber(from) && _typeRep.isNumber(to)) {
- // Make sure to check when converting to int.
- if (from != _coreTypes.intLegacyRawType &&
- to == _coreTypes.intLegacyRawType) {
- // TODO(jmesserly): fuse this with notNull check.
- // TODO(jmesserly): this does not correctly distinguish user casts from
- // required-for-soundness casts.
+ // If `to` is some form of `num`, it should have been filtered above.
+
+ // * -> double? | double* : no-op
+ if (to == _coreTypes.doubleLegacyRawType ||
+ to == _coreTypes.doubleNullableRawType) {
+ return jsFrom;
+ }
+
+ // * -> double : null check
+ if (to == _coreTypes.doubleNonNullableRawType) {
+ if (from.nullability == Nullability.nonNullable) {
+ return jsFrom;
+ }
+ return runtimeCall('nullCast(#, #, #)',
+ [jsFrom, _emitType(to), js.boolean(isTypeError)]);
+ }
+
+ // * -> int : asInt check
+ if (to == _coreTypes.intNonNullableRawType) {
return runtimeCall('asInt(#)', [jsFrom]);
}
- // A no-op in JavaScript.
- return jsFrom;
+ // * -> int? | int* : asNullableInt check
+ if (to == _coreTypes.intLegacyRawType ||
+ to == _coreTypes.intNullableRawType) {
+ return runtimeCall('asNullableInt(#)', [jsFrom]);
+ }
}
return _emitCast(jsFrom, to, implicit: isTypeError);
diff --git a/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt b/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt
index c20ae41..d689db5 100644
--- a/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt
+++ b/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt
@@ -1,19 +1,26 @@
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_runtime/lib/js_helper.dart|2688|17|17|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_runtime/lib/js_helper.dart|3632|5|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_runtime/lib/js_helper.dart|3660|5|6|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_runtime/lib/js_helper.dart|2688|17|17|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_runtime/lib/js_helper.dart|3628|5|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_runtime/lib/js_helper.dart|3656|5|6|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '&': int.& (int Function(int)), JSNumber.& (num Function(num)).
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '<<': int.<< (int Function(int)), JSNumber.<< (num Function(num)).
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '>>': int.>> (int Function(int)), JSNumber.>> (num Function(num)).
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '\|': int.\| (int Function(int)), JSNumber.\| (num Function(num)).
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '^': int.^ (int Function(int)), JSNumber.^ (num Function(num)).
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1003|10|5|Non-nullable instance field 'value' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1029|8|6|Non-nullable instance field 'secure' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1035|8|8|Non-nullable instance field 'httpOnly' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1491|12|11|Non-nullable instance field 'idleTimeout' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1541|8|14|Non-nullable instance field 'autoUncompress' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|171|8|12|Non-nullable instance field 'autoCompress' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|990|10|4|Non-nullable instance field 'name' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/io/io.dart|5589|12|8|Non-nullable instance field 'encoding' must be initialized.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1654|28|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1656|27|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1659|17|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1664|18|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1664|44|1|The operator '&' isn't defined for the type 'JSInt'.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|1476|39|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/developer/developer.dart|315|25|23|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/html/dart2js/html_dart2js.dart|4076|25|2|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/io/io.dart|9167|16|1|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|1476|39|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/developer/developer.dart|315|25|23|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/io/io.dart|9188|16|1|The left operand can't be null, so the right operand is never executed.
diff --git a/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt b/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt
index ccf9e8e..9fc6d71 100644
--- a/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt
+++ b/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt
@@ -1,24 +1,30 @@
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|109|3|2|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|162|8|21|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|167|8|21|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|170|8|20|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|173|8|18|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|176|8|22|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|182|8|26|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|185|8|17|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|188|8|14|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|191|8|20|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|197|8|32|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|203|8|32|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|209|8|40|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|215|8|40|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|221|8|37|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|224|8|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-ERROR|COMPILE_TIME_ERROR|BODY_MAY_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|228|6|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|1476|39|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/collection/collection.dart|1076|46|13|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/developer/developer.dart|332|25|23|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/html/dart2js/html_dart2js.dart|4076|25|2|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/io/io.dart|9167|16|1|The left operand can't be null, so the right operand is never executed.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|109|3|2|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|162|8|21|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|167|8|21|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|170|8|20|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|173|8|18|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|176|8|22|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|182|8|26|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|185|8|17|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|188|8|14|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|191|8|20|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|197|8|32|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|203|8|32|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|209|8|40|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|215|8|40|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|221|8|37|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|224|8|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|228|6|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1003|10|5|Non-nullable instance field 'value' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1029|8|6|Non-nullable instance field 'secure' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1035|8|8|Non-nullable instance field 'httpOnly' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1491|12|11|Non-nullable instance field 'idleTimeout' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1541|8|14|Non-nullable instance field 'autoUncompress' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|171|8|12|Non-nullable instance field 'autoCompress' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|990|10|4|Non-nullable instance field 'name' must be initialized.
+ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/io/io.dart|5589|12|8|Non-nullable instance field 'encoding' must be initialized.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|1476|39|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/developer/developer.dart|332|25|23|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/io/io.dart|9188|16|1|The left operand can't be null, so the right operand is never executed.
diff --git a/pkg/expect/lib/expect.dart b/pkg/expect/lib/expect.dart
index ef8ceec..83b2ab0 100644
--- a/pkg/expect/lib/expect.dart
+++ b/pkg/expect/lib/expect.dart
@@ -434,6 +434,22 @@
_fail("$defaultMessage$diff");
}
+ /// Checks that [actual] contains a given list of [substrings] in order.
+ ///
+ /// For example, this succeeds:
+ ///
+ /// Expect.stringContainsInOrder("abcdefg", ["a", "c", "e"]);
+ static void stringContainsInOrder(String actual, List<String> substrings) {
+ var start = 0;
+ for (var s in substrings) {
+ start = actual.indexOf(s, start);
+ if (start < 0) {
+ _fail("String '$actual' did not contain '$s' in the expected order: " +
+ substrings.map((s) => "'$s'").join(", "));
+ }
+ }
+ }
+
/**
* Checks that every element of [expected] is also in [actual], and that
* every element of [actual] is also in [expected].
diff --git a/pkg/expect/pubspec.yaml b/pkg/expect/pubspec.yaml
index 2a7405d..5e6beb6 100644
--- a/pkg/expect/pubspec.yaml
+++ b/pkg/expect/pubspec.yaml
@@ -7,7 +7,7 @@
the expect() function in the unit test library instead for
test assertions.
environment:
- sdk: ">=0.8.10+6 <3.0.0"
+ sdk: ">=2.0.0 <3.0.0"
dependencies:
meta: any
diff --git a/pkg/front_end/lib/src/api_prototype/compiler_options.dart b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
index a801bb3..c9b519d 100644
--- a/pkg/front_end/lib/src/api_prototype/compiler_options.dart
+++ b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
@@ -11,6 +11,8 @@
import 'package:kernel/target/targets.dart' show Target;
+import '../base/nnbd_mode.dart';
+
import 'experimental_flags.dart'
show
defaultExperimentalFlags,
@@ -230,8 +232,9 @@
/// Whether to write a file (e.g. a dill file) when reporting a crash.
bool writeFileOnCrashReport = true;
- /// Whether nnbd strong mode is used if experiment 'non-nullable' is enabled.
- bool nnbdStrongMode = false;
+ /// Whether nnbd weak, strong or agnostic mode is used if experiment
+ /// 'non-nullable' is enabled.
+ NnbdMode nnbdMode = NnbdMode.Weak;
/// Whether nnbd checks are performed when experiment 'non-nullable' is
/// enabled.
diff --git a/pkg/front_end/lib/src/api_unstable/vm.dart b/pkg/front_end/lib/src/api_unstable/vm.dart
index 469da44..dadc7d6 100644
--- a/pkg/front_end/lib/src/api_unstable/vm.dart
+++ b/pkg/front_end/lib/src/api_unstable/vm.dart
@@ -31,6 +31,8 @@
export '../api_prototype/terminal_color_support.dart'
show printDiagnosticMessage;
+export '../base/nnbd_mode.dart' show NnbdMode;
+
export '../base/processed_options.dart' show ProcessedOptions;
export '../compute_platform_binaries_location.dart'
diff --git a/pkg/front_end/lib/src/base/command_line_options.dart b/pkg/front_end/lib/src/base/command_line_options.dart
index fd6cb7a..e29ac5a 100644
--- a/pkg/front_end/lib/src/base/command_line_options.dart
+++ b/pkg/front_end/lib/src/base/command_line_options.dart
@@ -6,9 +6,12 @@
class Flags {
// TODO(johnniwinther): What is the right name for this?
static const String nnbdStrongMode = "--nnbd-strong";
+ static const String nnbdAgnosticMode = "--nnbd-agnostic";
static const String forceLateLowering = "--force-late-lowering";
static const String forceNnbdChecks = "--force-nnbd-checks";
static const String forceNoExplicitGetterCalls =
"--force-no-explicit-getter-calls";
+
+ static const String target = "--target";
}
diff --git a/pkg/front_end/lib/src/base/nnbd_mode.dart b/pkg/front_end/lib/src/base/nnbd_mode.dart
new file mode 100644
index 0000000..86366be
--- /dev/null
+++ b/pkg/front_end/lib/src/base/nnbd_mode.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2020, 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.
+
+enum NnbdMode {
+ Weak,
+ Strong,
+ Agnostic,
+}
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 7b3056d..458cda1 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -69,6 +69,8 @@
LibrariesSpecificationException,
TargetLibrariesSpecification;
+import 'nnbd_mode.dart';
+
/// All options needed for the front end implementation.
///
/// This includes: all of [CompilerOptions] in a form useful to the
@@ -173,7 +175,7 @@
bool get performNnbdChecks => _raw.performNnbdChecks;
- bool get nnbdStrongMode => _raw.nnbdStrongMode;
+ NnbdMode get nnbdMode => _raw.nnbdMode;
/// The entry-points provided to the compiler.
final List<Uri> inputs;
diff --git a/pkg/front_end/lib/src/fasta/builder/class_builder.dart b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
index 9a160af..63ba309 100644
--- a/pkg/front_end/lib/src/fasta/builder/class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
@@ -57,6 +57,8 @@
import '../../base/common.dart';
+import '../../base/nnbd_mode.dart';
+
import '../dill/dill_member_builder.dart' show DillMemberBuilder;
import '../fasta_codes.dart';
@@ -756,14 +758,16 @@
nnbdIssues ??= const {};
if (inferred) {
- if (nnbdIssues.contains(issue) && !library.loader.nnbdStrongMode) {
+ if (nnbdIssues.contains(issue) &&
+ library.loader.nnbdMode == NnbdMode.Weak) {
reportProblem(
templateIncorrectTypeArgumentInSupertypeInferredWarning);
} else {
reportProblem(templateIncorrectTypeArgumentInSupertypeInferred);
}
} else {
- if (nnbdIssues.contains(issue) && !library.loader.nnbdStrongMode) {
+ if (nnbdIssues.contains(issue) &&
+ library.loader.nnbdMode == NnbdMode.Weak) {
reportProblem(templateIncorrectTypeArgumentInSupertypeWarning);
} else {
reportProblem(templateIncorrectTypeArgumentInSupertype);
@@ -836,7 +840,8 @@
}
nnbdIssues ??= const {};
- if (nnbdIssues.contains(issue) && !library.loader.nnbdStrongMode) {
+ if (nnbdIssues.contains(issue) &&
+ library.loader.nnbdMode == NnbdMode.Weak) {
reportProblem(templateIncorrectTypeArgumentWarning);
} else {
reportProblem(templateIncorrectTypeArgument);
@@ -890,7 +895,7 @@
if (builder is FunctionBuilder &&
!builder.isAbstract &&
builder.formals != null) {
- library.checkInitializersInFormals(builder.formals);
+ library.checkInitializersInFormals(builder.formals, typeEnvironment);
}
});
}
@@ -1268,11 +1273,12 @@
bool performNnbdChecks = loader is SourceLoader &&
library.isNonNullableByDefault &&
loader.performNnbdChecks;
- bool nnbdStrongMode = loader is SourceLoader && loader.nnbdStrongMode;
+ bool nnbdWeakMode =
+ loader is SourceLoader && loader.nnbdMode == NnbdMode.Weak;
bool isError =
- isErrorInNnbdOptedOutMode || performNnbdChecks && nnbdStrongMode;
+ isErrorInNnbdOptedOutMode || performNnbdChecks && !nnbdWeakMode;
bool isWarning =
- !isErrorInNnbdOptedOutMode && performNnbdChecks && !nnbdStrongMode;
+ !isErrorInNnbdOptedOutMode && performNnbdChecks && nnbdWeakMode;
assert(
!isError || !isWarning,
"A compile-time problem can't be an error and a warning "
@@ -1771,15 +1777,7 @@
loader.performNnbdChecks) {
if (!typeEnvironment.isSubtypeOf(typeArgument, typeParameterBound,
SubtypeCheckMode.withNullabilities)) {
- if (loader.nnbdStrongMode) {
- addProblem(
- templateRedirectingFactoryIncompatibleTypeArgument
- .withArguments(typeArgument, typeParameterBound,
- library.isNonNullableByDefault),
- redirectionTarget.charOffset,
- noLength);
- hasProblem = true;
- } else {
+ if (loader.nnbdMode == NnbdMode.Weak) {
addProblem(
templateRedirectingFactoryIncompatibleTypeArgumentWarning
.withArguments(typeArgument, typeParameterBound,
@@ -1787,6 +1785,14 @@
redirectionTarget.charOffset,
noLength);
hasProblem = false;
+ } else {
+ addProblem(
+ templateRedirectingFactoryIncompatibleTypeArgument
+ .withArguments(typeArgument, typeParameterBound,
+ library.isNonNullableByDefault),
+ redirectionTarget.charOffset,
+ noLength);
+ hasProblem = true;
}
}
}
@@ -1856,15 +1862,15 @@
loader.performNnbdChecks) {
if (!typeEnvironment.isSubtypeOf(
redirecteeType, factoryType, SubtypeCheckMode.withNullabilities)) {
- if (loader.nnbdStrongMode) {
+ if (loader.nnbdMode == NnbdMode.Weak) {
addProblem(
- templateIncompatibleRedirecteeFunctionType.withArguments(
+ templateIncompatibleRedirecteeFunctionTypeWarning.withArguments(
redirecteeType, factoryType, library.isNonNullableByDefault),
factory.redirectionTarget.charOffset,
noLength);
} else {
addProblem(
- templateIncompatibleRedirecteeFunctionTypeWarning.withArguments(
+ templateIncompatibleRedirecteeFunctionType.withArguments(
redirecteeType, factoryType, library.isNonNullableByDefault),
factory.redirectionTarget.charOffset,
noLength);
diff --git a/pkg/front_end/lib/src/fasta/builder/field_builder.dart b/pkg/front_end/lib/src/fasta/builder/field_builder.dart
index b777d2e..97b2ede 100644
--- a/pkg/front_end/lib/src/fasta/builder/field_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/field_builder.dart
@@ -540,8 +540,10 @@
FieldNameType.Field);
_field
..hasImplicitGetter = isInstanceMember
- ..hasImplicitSetter =
- isInstanceMember && !fieldBuilder.isConst && !fieldBuilder.isFinal
+ ..hasImplicitSetter = isInstanceMember &&
+ !fieldBuilder.isConst &&
+ (!fieldBuilder.isFinal ||
+ (fieldBuilder.isLate && !fieldBuilder.hasInitializer))
..isStatic = !isInstanceMember
..isExtensionMember = false;
}
@@ -582,7 +584,9 @@
@override
List<ClassMember> getLocalSetters(SourceFieldBuilder fieldBuilder) =>
- const <ClassMember>[];
+ fieldBuilder.isAssignable
+ ? <ClassMember>[new SourceFieldMember(fieldBuilder)]
+ : const <ClassMember>[];
}
class SourceFieldMember extends BuilderClassMember {
@@ -621,6 +625,12 @@
Procedure _lateGetter;
Procedure _lateSetter;
+ // If `true`, the is-set field was register before the type was known to be
+ // nullable or non-nullable. In this case we do not try to remove it from
+ // the generated AST to avoid inconsistency between the class hierarchy used
+ // during and after inference.
+ bool _forceIncludeIsSetField = false;
+
AbstractLateFieldEncoding(
this.name,
Uri fileUri,
@@ -660,7 +670,7 @@
void createBodies(CoreTypes coreTypes, Expression initializer) {
assert(_type != null, "Type has not been computed for field $name.");
_field.initializer = new NullLiteral()..parent = _field;
- if (_type.isPotentiallyNullable) {
+ if (_lateIsSetField != null) {
_lateIsSetField.initializer = new BoolLiteral(false)
..parent = _lateIsSetField;
}
@@ -764,7 +774,7 @@
if (_lateSetter != null) {
_lateSetter.function.positionalParameters.single.type = value;
}
- if (!_type.isPotentiallyNullable) {
+ if (!_type.isPotentiallyNullable && !_forceIncludeIsSetField) {
// We only need the is-set field if the field is potentially nullable.
// Otherwise we use `null` to signal that the field is uninitialized.
_lateIsSetField = null;
@@ -885,6 +895,7 @@
? BuiltMemberKind.ExtensionField
: BuiltMemberKind.Field);
if (_lateIsSetField != null) {
+ _forceIncludeIsSetField = true;
f(_lateIsSetField, BuiltMemberKind.LateIsSetField);
}
f(_lateGetter, BuiltMemberKind.LateGetter);
@@ -907,9 +918,14 @@
@override
List<ClassMember> getLocalSetters(SourceFieldBuilder fieldBuilder) {
- return _lateSetter == null
- ? const <ClassMember>[]
- : <ClassMember>[new _LateFieldClassMember(fieldBuilder, _lateSetter)];
+ List<ClassMember> list = <ClassMember>[];
+ if (_lateIsSetField != null) {
+ list.add(new _LateFieldClassMember(fieldBuilder, _lateIsSetField));
+ }
+ if (_lateSetter != null) {
+ list.add(new _LateFieldClassMember(fieldBuilder, _lateSetter));
+ }
+ return list;
}
}
diff --git a/pkg/front_end/lib/src/fasta/builder/function_builder.dart b/pkg/front_end/lib/src/fasta/builder/function_builder.dart
index ae09709..d16302b 100644
--- a/pkg/front_end/lib/src/fasta/builder/function_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/function_builder.dart
@@ -11,6 +11,8 @@
import 'package:kernel/type_algebra.dart';
+import '../../base/nnbd_mode.dart';
+
import '../identifiers.dart';
import '../scope.dart';
@@ -391,16 +393,16 @@
library.loader.target.performNnbdChecks) {
// Required named parameters can't have default values.
if (formal.isNamedRequired && formal.initializerToken != null) {
- if (library.loader.nnbdStrongMode) {
+ if (library.loader.nnbdMode == NnbdMode.Weak) {
library.addProblem(
- templateRequiredNamedParameterHasDefaultValueError
+ templateRequiredNamedParameterHasDefaultValueWarning
.withArguments(formal.name),
formal.charOffset,
formal.name.length,
formal.fileUri);
} else {
library.addProblem(
- templateRequiredNamedParameterHasDefaultValueWarning
+ templateRequiredNamedParameterHasDefaultValueError
.withArguments(formal.name),
formal.charOffset,
formal.name.length,
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_class_builder.dart b/pkg/front_end/lib/src/fasta/dill/dill_class_builder.dart
index a51997c..04f75bc 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_class_builder.dart
@@ -138,6 +138,11 @@
void set mixedInType(TypeBuilder mixin) {
unimplemented("mixedInType=", -1, null);
}
+
+ void clearCachedValues() {
+ supertype = null;
+ interfaces = null;
+ }
}
int computeModifiers(Class cls) {
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
index 0ce2b66..047a3f9 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
@@ -103,6 +103,9 @@
ClassBuilder computeClassBuilderFromTargetClass(Class cls) {
Library kernelLibrary = cls.enclosingLibrary;
LibraryBuilder library = builders[kernelLibrary.importUri];
+ if (library == null) {
+ library = currentSourceLoader?.builders[kernelLibrary.importUri];
+ }
return library.lookupLocalMember(cls.name, required: true);
}
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_member_builder.dart b/pkg/front_end/lib/src/fasta/dill/dill_member_builder.dart
index 615e519..1604ace 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_member_builder.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_member_builder.dart
@@ -135,9 +135,10 @@
: <ClassMember>[new DillClassMember(this)];
@override
- List<ClassMember> get localSetters => isSetter
- ? <ClassMember>[new DillClassMember(this)]
- : const <ClassMember>[];
+ List<ClassMember> get localSetters =>
+ isSetter || member is Field && member.hasSetter
+ ? <ClassMember>[new DillClassMember(this)]
+ : const <ClassMember>[];
}
class DillClassMember extends BuilderClassMember {
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
index 274f920..9e88644 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
@@ -87,6 +87,36 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(Constant _constant, bool isNonNullableByDefault)>
+ templateConstEvalCaseImplementsEqual = const Template<
+ Message Function(Constant _constant, bool isNonNullableByDefault)>(
+ messageTemplate:
+ r"""Case expression '#constant' does not have a primitive operator '=='.""",
+ withArguments: _withArgumentsConstEvalCaseImplementsEqual);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(Constant _constant, bool isNonNullableByDefault)>
+ codeConstEvalCaseImplementsEqual = const Code<
+ Message Function(Constant _constant, bool isNonNullableByDefault)>(
+ "ConstEvalCaseImplementsEqual",
+ templateConstEvalCaseImplementsEqual,
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsConstEvalCaseImplementsEqual(
+ Constant _constant, bool isNonNullableByDefault) {
+ TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
+ List<Object> constantParts = labeler.labelConstant(_constant);
+ String constant = constantParts.join();
+ return new Message(codeConstEvalCaseImplementsEqual,
+ message:
+ """Case expression '${constant}' does not have a primitive operator '=='.""" +
+ labeler.originMessages,
+ arguments: {'constant': _constant});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(Constant _constant, bool isNonNullableByDefault)>
templateConstEvalDuplicateElement = const Template<
Message Function(Constant _constant, bool isNonNullableByDefault)>(
messageTemplate:
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 5d80494..298bd28 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -358,6 +358,14 @@
if (dillBuilder.isBuilt) {
dillBuilder.exportScope
.patchUpScope(replacementMap, replacementSettersMap);
+
+ // Clear cached calculations that points (potential) to now replaced
+ // things.
+ for (Builder builder in dillBuilder.scope.localMembers) {
+ if (builder is DillClassBuilder) {
+ builder.clearCachedValues();
+ }
+ }
}
}
replacementMap = null;
@@ -366,6 +374,8 @@
}
userCode.loader.buildersCreatedWithReferences.clear();
userCode.loader.builderHierarchy.nodes.clear();
+ userCode.loader.builderHierarchy.overrideChecks.clear();
+ userCode.loader.builderHierarchy.delayedSignatureComputations.clear();
userCode.loader.referenceFromIndex = null;
convertedLibraries = null;
experimentalInvalidation = null;
@@ -697,8 +707,7 @@
// mark things as needed.
for (Builder builder in builder.scope.localMembers) {
if (builder is DillClassBuilder) {
- builder.supertype = null;
- builder.interfaces = null;
+ builder.clearCachedValues();
}
}
builder.isBuiltAndMarked = false;
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 ace9ea1..7cdb900 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -43,6 +43,8 @@
import 'package:kernel/ast.dart';
import 'package:kernel/type_environment.dart';
+import '../../base/nnbd_mode.dart';
+
import '../builder/builder.dart';
import '../builder/class_builder.dart';
import '../builder/constructor_builder.dart';
@@ -3582,7 +3584,7 @@
@override
void handleIndexedExpression(
- Token openSquareBracket, Token closeSquareBracket) {
+ Token question, Token openSquareBracket, Token closeSquareBracket) {
assert(checkState(openSquareBracket, [
unionOfKinds([ValueKinds.Expression, ValueKinds.Generator]),
unionOfKinds(
@@ -3591,7 +3593,7 @@
debugEvent("IndexedExpression");
Expression index = popForValue();
Object receiver = pop();
- bool isNullAware = optional('?.[', openSquareBracket);
+ bool isNullAware = optional('?.[', openSquareBracket) || question != null;
if (isNullAware && !libraryBuilder.isNonNullableByDefault) {
reportMissingNonNullableSupport(openSquareBracket);
}
@@ -3896,16 +3898,16 @@
Set<String> argumentNames = new Set.from(named.map((a) => a.name));
for (VariableDeclaration parameter in function.namedParameters) {
if (parameter.isRequired && !argumentNames.contains(parameter.name)) {
- if (libraryBuilder.loader.nnbdStrongMode) {
- return fasta.templateValueForRequiredParameterNotProvidedError
- .withArguments(parameter.name)
- .withLocation(uri, arguments.fileOffset, fasta.noLength);
- } else {
+ if (libraryBuilder.loader.nnbdMode == NnbdMode.Weak) {
addProblem(
fasta.templateValueForRequiredParameterNotProvidedWarning
.withArguments(parameter.name),
arguments.fileOffset,
fasta.noLength);
+ } else {
+ return fasta.templateValueForRequiredParameterNotProvidedError
+ .withArguments(parameter.name)
+ .withLocation(uri, arguments.fileOffset, fasta.noLength);
}
}
}
@@ -3964,16 +3966,16 @@
Set<String> argumentNames = new Set.from(named.map((a) => a.name));
for (NamedType parameter in function.namedParameters) {
if (parameter.isRequired && !argumentNames.contains(parameter.name)) {
- if (libraryBuilder.loader.nnbdStrongMode) {
- return fasta.templateValueForRequiredParameterNotProvidedError
- .withArguments(parameter.name)
- .withLocation(uri, arguments.fileOffset, fasta.noLength);
- } else {
+ if (libraryBuilder.loader.nnbdMode == NnbdMode.Weak) {
addProblem(
fasta.templateValueForRequiredParameterNotProvidedWarning
.withArguments(parameter.name),
arguments.fileOffset,
fasta.noLength);
+ } else {
+ return fasta.templateValueForRequiredParameterNotProvidedError
+ .withArguments(parameter.name)
+ .withLocation(uri, arguments.fileOffset, fasta.noLength);
}
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart b/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart
index fb3b432..835d628 100644
--- a/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/class_hierarchy_builder.dart
@@ -1304,9 +1304,6 @@
localMembers.sort(compareDeclarations);
localSetters.sort(compareDeclarations);
- // Add implied setters from fields in [localMembers].
- localSetters = mergeAccessors(localMembers, localSetters);
-
/// Members (excluding setters) declared in [cls] or its superclasses. This
/// includes static methods of [cls], but not its superclasses.
List<ClassMember> classMembers;
@@ -1670,54 +1667,6 @@
return input.single;
}
- /// Merge [and check] accessors. This entails copying mutable fields to
- /// setters to simulate implied setters, and checking that setters don't
- /// override regular methods.
- List<ClassMember> mergeAccessors(
- List<ClassMember> members, List<ClassMember> setters) {
- final List<ClassMember> mergedSetters = new List<ClassMember>.filled(
- members.length + setters.length, null,
- growable: true);
- int storeIndex = 0;
- int i = 0;
- int j = 0;
- while (i < members.length && j < setters.length) {
- final ClassMember member = members[i];
- final ClassMember setter = setters[j];
- final int compare = compareDeclarations(member, setter);
- if (compare == 0) {
- mergedSetters[storeIndex++] = setter;
- i++;
- j++;
- } else if (compare < 0) {
- if (member.isAssignable) {
- mergedSetters[storeIndex++] = member;
- }
- i++;
- } else {
- mergedSetters[storeIndex++] = setters[j];
- j++;
- }
- }
- while (i < members.length) {
- final ClassMember member = members[i];
- if (member.isAssignable) {
- mergedSetters[storeIndex++] = member;
- }
- i++;
- }
- while (j < setters.length) {
- mergedSetters[storeIndex++] = setters[j];
- j++;
- }
-
- if (storeIndex == j) {
- return setters;
- } else {
- return mergedSetters..length = storeIndex;
- }
- }
-
void reportMissingMembers() {
Map<String, LocatedMessage> contextMap = <String, LocatedMessage>{};
for (int i = 0; i < abstractMembers.length; i++) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_collection_builders.dart b/pkg/front_end/lib/src/fasta/kernel/constant_collection_builders.dart
index d948589..28f549f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_collection_builders.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_collection_builders.dart
@@ -104,6 +104,7 @@
class SetConstantBuilder extends _ListOrSetConstantBuilder<SetLiteral> {
final Set<Constant> seen = new Set<Constant>.identity();
+ final Set<Constant> weakSeen = new Set<Constant>.identity();
SetConstantBuilder(
Expression original, DartType elementType, ConstantEvaluator evaluator)
@@ -121,12 +122,21 @@
templateConstEvalElementImplementsEqual.withArguments(
constant, evaluator.isNonNullableByDefault));
}
- if (!seen.add(constant)) {
+ bool unseen = seen.add(constant);
+ if (!unseen) {
evaluator.report(
context,
templateConstEvalDuplicateElement.withArguments(
constant, evaluator.isNonNullableByDefault));
}
+ if (evaluator.evaluationMode == EvaluationMode.agnostic) {
+ Constant weakConstant =
+ evaluator._weakener.visitConstant(constant) ?? constant;
+ bool weakUnseen = weakSeen.add(weakConstant);
+ if (unseen != weakUnseen) {
+ evaluator.report(context, messageNonAgnosticConstant);
+ }
+ }
List<Constant> lastPart;
if (parts.last is List<Constant>) {
@@ -190,6 +200,7 @@
List<Object> parts = <Object>[<ConstantMapEntry>[]];
final Set<Constant> seenKeys = new Set<Constant>.identity();
+ final Set<Constant> weakSeenKeys = new Set<Constant>.identity();
MapConstantBuilder(
this.original, this.keyType, this.valueType, this.evaluator);
@@ -247,12 +258,20 @@
templateConstEvalKeyImplementsEqual.withArguments(
key, evaluator.isNonNullableByDefault));
}
- if (!seenKeys.add(key)) {
+ bool unseenKey = seenKeys.add(key);
+ if (!unseenKey) {
evaluator.report(
keyContext,
templateConstEvalDuplicateKey.withArguments(
key, evaluator.isNonNullableByDefault));
}
+ if (evaluator.evaluationMode == EvaluationMode.agnostic) {
+ Constant weakKey = evaluator._weakener.visitConstant(key) ?? key;
+ bool weakUnseenKey = weakSeenKeys.add(weakKey);
+ if (unseenKey != weakUnseenKey) {
+ evaluator.report(keyContext, messageNonAgnosticConstant);
+ }
+ }
lastPart.add(new ConstantMapEntry(
evaluator.ensureIsSubtype(key, keyType, keyContext),
evaluator.ensureIsSubtype(value, valueType, valueContext)));
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index 430c3df..7a764d6 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -45,7 +45,9 @@
messageConstEvalNullValue,
messageConstEvalStartingPoint,
messageConstEvalUnevaluated,
+ messageNonAgnosticConstant,
noLength,
+ templateConstEvalCaseImplementsEqual,
templateConstEvalDeferredLibrary,
templateConstEvalDuplicateElement,
templateConstEvalDuplicateKey,
@@ -128,9 +130,163 @@
enum EvaluationMode {
legacy,
weak,
+ agnostic,
strong,
}
+class ConstantWeakener extends ComputeOnceConstantVisitor<Constant> {
+ ConstantEvaluator _evaluator;
+
+ ConstantWeakener(this._evaluator);
+
+ CoreTypes get _coreTypes => _evaluator.coreTypes;
+
+ Constant processValue(Constant node, Constant value) {
+ if (value != null) {
+ value = _evaluator.canonicalize(value);
+ }
+ return value;
+ }
+
+ @override
+ Constant defaultConstant(Constant node) => throw new UnsupportedError(
+ "Unhandled constant ${node} (${node.runtimeType})");
+
+ @override
+ Constant visitNullConstant(NullConstant node) => null;
+
+ @override
+ Constant visitBoolConstant(BoolConstant node) => null;
+
+ @override
+ Constant visitIntConstant(IntConstant node) => null;
+
+ @override
+ Constant visitDoubleConstant(DoubleConstant node) => null;
+
+ @override
+ Constant visitStringConstant(StringConstant node) => null;
+
+ @override
+ Constant visitSymbolConstant(SymbolConstant node) => null;
+
+ @override
+ Constant visitMapConstant(MapConstant node) {
+ DartType keyType = rawLegacyErasure(_coreTypes, node.keyType);
+ DartType valueType = rawLegacyErasure(_coreTypes, node.valueType);
+ List<ConstantMapEntry> entries;
+ for (int index = 0; index < node.entries.length; index++) {
+ ConstantMapEntry entry = node.entries[index];
+ Constant key = visitConstant(entry.key);
+ Constant value = visitConstant(entry.value);
+ if (key != null || value != null) {
+ entries ??= node.entries.toList(growable: false);
+ entries[index] =
+ new ConstantMapEntry(key ?? entry.key, value ?? entry.value);
+ }
+ }
+ if (keyType != null || valueType != null || entries != null) {
+ return new MapConstant(keyType ?? node.keyType,
+ valueType ?? node.valueType, entries ?? node.entries);
+ }
+ return null;
+ }
+
+ @override
+ Constant visitListConstant(ListConstant node) {
+ DartType typeArgument = rawLegacyErasure(_coreTypes, node.typeArgument);
+ List<Constant> entries;
+ for (int index = 0; index < node.entries.length; index++) {
+ Constant entry = visitConstant(node.entries[index]);
+ if (entry != null) {
+ entries ??= node.entries.toList(growable: false);
+ entries[index] = entry;
+ }
+ }
+ if (typeArgument != null || entries != null) {
+ return new ListConstant(
+ typeArgument ?? node.typeArgument, entries ?? node.entries);
+ }
+ return null;
+ }
+
+ @override
+ Constant visitSetConstant(SetConstant node) {
+ DartType typeArgument = rawLegacyErasure(_coreTypes, node.typeArgument);
+ List<Constant> entries;
+ for (int index = 0; index < node.entries.length; index++) {
+ Constant entry = visitConstant(node.entries[index]);
+ if (entry != null) {
+ entries ??= node.entries.toList(growable: false);
+ entries[index] = entry;
+ }
+ }
+ if (typeArgument != null || entries != null) {
+ return new SetConstant(
+ typeArgument ?? node.typeArgument, entries ?? node.entries);
+ }
+ return null;
+ }
+
+ @override
+ Constant visitInstanceConstant(InstanceConstant node) {
+ List<DartType> typeArguments;
+ for (int index = 0; index < node.typeArguments.length; index++) {
+ DartType typeArgument =
+ rawLegacyErasure(_coreTypes, node.typeArguments[index]);
+ if (typeArgument != null) {
+ typeArguments ??= node.typeArguments.toList(growable: false);
+ typeArguments[index] = typeArgument;
+ }
+ }
+ Map<Reference, Constant> fieldValues;
+ for (Reference reference in node.fieldValues.keys) {
+ Constant value = visitConstant(node.fieldValues[reference]);
+ if (value != null) {
+ fieldValues ??= new Map<Reference, Constant>.from(node.fieldValues);
+ fieldValues[reference] = value;
+ }
+ }
+ if (typeArguments != null || fieldValues != null) {
+ return new InstanceConstant(node.classReference,
+ typeArguments ?? node.typeArguments, fieldValues ?? node.fieldValues);
+ }
+ return null;
+ }
+
+ @override
+ Constant visitPartialInstantiationConstant(
+ PartialInstantiationConstant node) {
+ List<DartType> types;
+ for (int index = 0; index < node.types.length; index++) {
+ DartType type = rawLegacyErasure(_coreTypes, node.types[index]);
+ if (type != null) {
+ types ??= node.types.toList(growable: false);
+ types[index] = type;
+ }
+ }
+ if (types != null) {
+ return new PartialInstantiationConstant(node.tearOffConstant, types);
+ }
+ return null;
+ }
+
+ @override
+ Constant visitTearOffConstant(TearOffConstant node) => null;
+
+ @override
+ Constant visitTypeLiteralConstant(TypeLiteralConstant node) {
+ DartType type = rawLegacyErasure(_coreTypes, node.type);
+ if (type != null) {
+ return new TypeLiteralConstant(type);
+ }
+ return null;
+ }
+
+ @override
+ Constant visitUnevaluatedConstant(UnevaluatedConstant node) => null;
+}
+
class ConstantsTransformer extends Transformer {
final ConstantsBackend backend;
final ConstantEvaluator constantEvaluator;
@@ -391,9 +547,12 @@
final Member target = node.target;
if (target is Field && target.isConst) {
// Make sure the initializer is evaluated first.
+ StaticTypeContext oldStaticTypeContext = _staticTypeContext;
+ _staticTypeContext = new StaticTypeContext(target, typeEnvironment);
target.initializer =
evaluateAndTransformWithContext(target, target.initializer)
..parent = target;
+ _staticTypeContext = oldStaticTypeContext;
if (shouldInline(target.initializer)) {
return evaluateAndTransformWithContext(node, node);
}
@@ -410,6 +569,36 @@
}
@override
+ SwitchStatement visitSwitchStatement(SwitchStatement node) {
+ SwitchStatement result = super.visitSwitchStatement(node);
+ Library library = constantEvaluator.libraryOf(node);
+ if (library != null &&
+ library.isNonNullableByDefault &&
+ constantEvaluator.errorReporter.performNnbdChecks) {
+ for (SwitchCase switchCase in node.cases) {
+ for (Expression caseExpression in switchCase.expressions) {
+ if (caseExpression is ConstantExpression) {
+ if (!constantEvaluator.hasPrimitiveEqual(caseExpression.constant)) {
+ Uri uri = constantEvaluator.getFileUri(caseExpression);
+ int offset = constantEvaluator.getFileOffset(uri, caseExpression);
+ constantEvaluator.errorReporter.report(
+ templateConstEvalCaseImplementsEqual
+ .withArguments(caseExpression.constant,
+ constantEvaluator.isNonNullableByDefault)
+ .withLocation(uri, offset, noLength),
+ null);
+ }
+ } else {
+ // If caseExpression is not ConstantExpression, an error is reported
+ // elsewhere.
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ @override
Expression visitVariableGet(VariableGet node) {
final VariableDeclaration variable = node.variable;
if (variable.isConst) {
@@ -570,6 +759,8 @@
bool get isNonNullableByDefault =>
_staticTypeContext.nonNullable == Nullability.nonNullable;
+ ConstantWeakener _weakener;
+
ConstantEvaluator(this.backend, this.environmentDefines, this.typeEnvironment,
this.errorReporter,
{this.desugarSets = false,
@@ -605,12 +796,14 @@
coreTypes.symbolClass: true,
coreTypes.typeClass: true,
};
+ _weakener = new ConstantWeakener(this);
}
DartType convertType(DartType type) {
switch (evaluationMode) {
case EvaluationMode.legacy:
case EvaluationMode.strong:
+ case EvaluationMode.agnostic:
return type;
case EvaluationMode.weak:
return legacyErasure(coreTypes, type);
@@ -623,6 +816,7 @@
switch (evaluationMode) {
case EvaluationMode.legacy:
case EvaluationMode.strong:
+ case EvaluationMode.agnostic:
return types;
case EvaluationMode.weak:
return types
@@ -1657,9 +1851,19 @@
final Member target = node.target;
if (target is Field) {
if (target.isConst) {
- return runInsideContext(target, () {
- return _evaluateSubexpression(target.initializer);
+ StaticTypeContext oldStaticTypeContext = _staticTypeContext;
+ _staticTypeContext = new StaticTypeContext(target, typeEnvironment);
+ Constant constant = runInsideContext(target, () {
+ Constant constant = _evaluateSubexpression(target.initializer);
+ if (_staticTypeContext.nonNullableByDefaultCompiledMode ==
+ NonNullableByDefaultCompiledMode.Agnostic &&
+ evaluationMode == EvaluationMode.weak) {
+ constant = _weakener.visitConstant(constant) ?? constant;
+ }
+ return constant;
});
+ _staticTypeContext = oldStaticTypeContext;
+ return constant;
}
return report(
node,
@@ -1804,16 +2008,30 @@
final Constant left = positionals[0];
final Constant right = positionals[1];
+ Constant evaluateIdentical() {
+ // Since we canonicalize constants during the evaluation, we can use
+ // identical here.
+ Constant result = makeBoolConstant(identical(left, right));
+ if (evaluationMode == EvaluationMode.agnostic) {
+ Constant weakLeft = _weakener.visitConstant(left);
+ Constant weakRight = _weakener.visitConstant(right);
+ if (weakLeft != null || weakRight != null) {
+ Constant weakResult = makeBoolConstant(
+ identical(weakLeft ?? left, weakRight ?? right));
+ if (!identical(result, weakResult)) {
+ report(node, messageNonAgnosticConstant);
+ }
+ }
+ }
+ return result;
+ }
+
if (targetingJavaScript) {
// In JavaScript, we lower [identical] to `===`, so we need to take
// the double special cases into account.
- return doubleSpecialCases(left, right) ??
- makeBoolConstant(identical(left, right));
+ return doubleSpecialCases(left, right) ?? evaluateIdentical();
}
-
- // Since we canonicalize constants during the evaluation, we can use
- // identical here.
- return makeBoolConstant(identical(left, right));
+ return evaluateIdentical();
}
} else if (target.isExtensionMember) {
return report(node, messageConstEvalExtension);
@@ -2270,13 +2488,20 @@
abstract class ErrorReporter {
const ErrorReporter();
+ // TODO(johnniwinther,dmitryas): Remove the getter when the NNBD error
+ // reporting is enabled by default.
+ bool get performNnbdChecks;
+
void report(LocatedMessage message, List<LocatedMessage> context);
void reportInvalidExpression(InvalidExpression node);
}
class SimpleErrorReporter implements ErrorReporter {
- const SimpleErrorReporter();
+ @override
+ final bool performNnbdChecks;
+
+ const SimpleErrorReporter(this.performNnbdChecks);
@override
void report(LocatedMessage message, List<LocatedMessage> context) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
index 1a91dba..a9bf4c6 100644
--- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
@@ -8,6 +8,8 @@
import 'package:kernel/ast.dart';
+import 'package:kernel/src/future_or.dart';
+
import 'package:kernel/type_algebra.dart' show Substitution;
import 'package:kernel/type_environment.dart';
@@ -18,6 +20,8 @@
InstrumentationValueForType,
InstrumentationValueForTypeArgs;
+import '../../base/nnbd_mode.dart';
+
import '../fasta_codes.dart';
import '../names.dart';
@@ -733,12 +737,12 @@
}
if (inferrer.isNonNullableByDefault && inferrer.performNnbdChecks) {
if (node.target == inferrer.coreTypes.listDefaultConstructor) {
- if (inferrer.nnbdStrongMode) {
- resultNode = inferrer.helper.wrapInProblem(
- node, messageDefaultListConstructorError, noLength);
- } else {
+ if (inferrer.nnbdMode == NnbdMode.Weak) {
inferrer.library.addProblem(messageDefaultListConstructorWarning,
node.fileOffset, noLength, inferrer.helper.uri);
+ } else {
+ resultNode = inferrer.helper.wrapInProblem(
+ node, messageDefaultListConstructorError, noLength);
}
}
}
@@ -2342,7 +2346,13 @@
if (receiverType is! DynamicType &&
receiverType is! InvalidType &&
receiverType.isPotentiallyNullable) {
- if (inferrer.nnbdStrongMode) {
+ if (inferrer.nnbdMode == NnbdMode.Weak) {
+ inferrer.helper.addProblem(
+ templateNullableExpressionCallWarning.withArguments(
+ receiverType, inferrer.isNonNullableByDefault),
+ node.fileOffset,
+ noLength);
+ } else {
return new ExpressionInferenceResult(
invocationResult.inferredType,
inferrer.helper.wrapInProblem(
@@ -2350,12 +2360,6 @@
templateNullableExpressionCallError.withArguments(
receiverType, inferrer.isNonNullableByDefault),
noLength));
- } else {
- inferrer.helper.addProblem(
- templateNullableExpressionCallWarning.withArguments(
- receiverType, inferrer.isNonNullableByDefault),
- node.fileOffset,
- noLength);
}
}
}
@@ -3582,7 +3586,13 @@
}
if (inferrer.isNonNullableByDefault && inferrer.performNnbdChecks) {
if (leftType is! DynamicType && leftType.isPotentiallyNullable) {
- if (inferrer.nnbdStrongMode) {
+ if (inferrer.nnbdMode == NnbdMode.Weak) {
+ inferrer.helper.addProblem(
+ templateNullableOperatorCallWarning.withArguments(
+ binaryName.name, leftType, inferrer.isNonNullableByDefault),
+ binary.fileOffset,
+ binaryName.name.length);
+ } else {
return new ExpressionInferenceResult(
binaryType,
inferrer.helper.wrapInProblem(
@@ -3592,12 +3602,6 @@
leftType,
inferrer.isNonNullableByDefault),
binaryName.name.length));
- } else {
- inferrer.helper.addProblem(
- templateNullableOperatorCallWarning.withArguments(
- binaryName.name, leftType, inferrer.isNonNullableByDefault),
- binary.fileOffset,
- binaryName.name.length);
}
}
}
@@ -3672,7 +3676,13 @@
expressionType.isPotentiallyNullable) {
// TODO(johnniwinther): Special case 'unary-' in messages. It should
// probably be referred to as "Unary operator '-' ...".
- if (inferrer.nnbdStrongMode) {
+ if (inferrer.nnbdMode == NnbdMode.Weak) {
+ inferrer.helper.addProblem(
+ templateNullableOperatorCallWarning.withArguments(unaryName.name,
+ expressionType, inferrer.isNonNullableByDefault),
+ unary.fileOffset,
+ unaryName == unaryMinusName ? 1 : unaryName.name.length);
+ } else {
return new ExpressionInferenceResult(
unaryType,
inferrer.helper.wrapInProblem(
@@ -3682,12 +3692,6 @@
expressionType,
inferrer.isNonNullableByDefault),
unaryName == unaryMinusName ? 1 : unaryName.name.length));
- } else {
- inferrer.helper.addProblem(
- templateNullableOperatorCallWarning.withArguments(unaryName.name,
- expressionType, inferrer.isNonNullableByDefault),
- unary.fileOffset,
- unaryName == unaryMinusName ? 1 : unaryName.name.length);
}
}
}
@@ -3750,7 +3754,15 @@
if (receiverType is! DynamicType &&
receiverType is! InvalidType &&
receiverType.isPotentiallyNullable) {
- if (inferrer.nnbdStrongMode) {
+ if (inferrer.nnbdMode == NnbdMode.Weak) {
+ inferrer.helper.addProblem(
+ templateNullableOperatorCallWarning.withArguments(
+ indexGetName.name,
+ receiverType,
+ inferrer.isNonNullableByDefault),
+ read.fileOffset,
+ noLength);
+ } else {
return new ExpressionInferenceResult(
readType,
inferrer.helper.wrapInProblem(
@@ -3760,14 +3772,6 @@
receiverType,
inferrer.isNonNullableByDefault),
noLength));
- } else {
- inferrer.helper.addProblem(
- templateNullableOperatorCallWarning.withArguments(
- indexGetName.name,
- receiverType,
- inferrer.isNonNullableByDefault),
- read.fileOffset,
- noLength);
}
}
}
@@ -3810,13 +3814,7 @@
}
if (inferrer.isNonNullableByDefault && inferrer.performNnbdChecks) {
if (receiverType is! DynamicType && receiverType.isPotentiallyNullable) {
- if (inferrer.nnbdStrongMode) {
- return inferrer.helper.wrapInProblem(
- write,
- templateNullableOperatorCallError.withArguments(indexSetName.name,
- receiverType, inferrer.isNonNullableByDefault),
- noLength);
- } else {
+ if (inferrer.nnbdMode == NnbdMode.Weak) {
inferrer.helper.addProblem(
templateNullableOperatorCallWarning.withArguments(
indexSetName.name,
@@ -3824,6 +3822,12 @@
inferrer.isNonNullableByDefault),
write.fileOffset,
noLength);
+ } else {
+ return inferrer.helper.wrapInProblem(
+ write,
+ templateNullableOperatorCallError.withArguments(indexSetName.name,
+ receiverType, inferrer.isNonNullableByDefault),
+ noLength);
}
}
}
@@ -3934,7 +3938,15 @@
receiverType.isPotentiallyNullable &&
!inferrer.matchesObjectMemberCall(
propertyName, const [], const [], const [])) {
- if (inferrer.nnbdStrongMode) {
+ if (inferrer.nnbdMode == NnbdMode.Weak) {
+ inferrer.helper.addProblem(
+ templateNullablePropertyAccessWarning.withArguments(
+ propertyName.name,
+ receiverType,
+ inferrer.isNonNullableByDefault),
+ read.fileOffset,
+ propertyName.name.length);
+ } else {
return new ExpressionInferenceResult(
readType,
inferrer.helper.wrapInProblem(
@@ -3944,14 +3956,6 @@
receiverType,
inferrer.isNonNullableByDefault),
propertyName.name.length));
- } else {
- inferrer.helper.addProblem(
- templateNullablePropertyAccessWarning.withArguments(
- propertyName.name,
- receiverType,
- inferrer.isNonNullableByDefault),
- read.fileOffset,
- propertyName.name.length);
}
}
}
@@ -4015,15 +4019,7 @@
}
if (inferrer.isNonNullableByDefault && inferrer.performNnbdChecks) {
if (receiverType is! DynamicType && receiverType.isPotentiallyNullable) {
- if (inferrer.nnbdStrongMode) {
- return inferrer.helper.wrapInProblem(
- write,
- templateNullablePropertyAccessError.withArguments(
- propertyName.name,
- receiverType,
- inferrer.isNonNullableByDefault),
- propertyName.name.length);
- } else {
+ if (inferrer.nnbdMode == NnbdMode.Weak) {
inferrer.helper.addProblem(
templateNullablePropertyAccessWarning.withArguments(
propertyName.name,
@@ -4031,6 +4027,14 @@
inferrer.isNonNullableByDefault),
write.fileOffset,
propertyName.name.length);
+ } else {
+ return inferrer.helper.wrapInProblem(
+ write,
+ templateNullablePropertyAccessError.withArguments(
+ propertyName.name,
+ receiverType,
+ inferrer.isNonNullableByDefault),
+ propertyName.name.length);
}
}
}
@@ -5237,7 +5241,13 @@
inferrer.typeSchemaEnvironment.objectNonNullableRawType,
expressionResult.inferredType,
isStrongNullabilityMode: true)) {
- if (inferrer.nnbdStrongMode) {
+ if (inferrer.nnbdMode == NnbdMode.Weak) {
+ inferrer.helper.addProblem(
+ templateThrowingNotAssignableToObjectWarning.withArguments(
+ expressionResult.inferredType, true),
+ node.expression.fileOffset,
+ noLength);
+ } else {
return new ExpressionInferenceResult(
const DynamicType(),
inferrer.helper.buildProblem(
@@ -5245,12 +5255,6 @@
expressionResult.inferredType, true),
node.expression.fileOffset,
noLength));
- } else {
- inferrer.helper.addProblem(
- templateThrowingNotAssignableToObjectWarning.withArguments(
- expressionResult.inferredType, true),
- node.expression.fileOffset,
- noLength);
}
}
}
@@ -5516,9 +5520,17 @@
if (variable.name != null &&
!variable.isLocalFunction &&
variable.type is! InvalidType &&
- variable.type.isPotentiallyNonNullable &&
+ isPotentiallyNonNullable(
+ variable.type, inferrer.coreTypes.futureOrClass) &&
!variable.isLate) {
- if (inferrer.nnbdStrongMode) {
+ if (inferrer.nnbdMode == NnbdMode.Weak) {
+ inferrer.library.addProblem(
+ templateNonNullableNotAssignedWarning
+ .withArguments(node.variable.name),
+ node.fileOffset,
+ node.variable.name.length,
+ inferrer.helper.uri);
+ } else {
return new ExpressionInferenceResult(
new InvalidType(),
inferrer.helper.wrapInProblem(
@@ -5526,13 +5538,6 @@
templateNonNullableNotAssignedError
.withArguments(node.variable.name),
node.variable.name.length));
- } else {
- inferrer.library.addProblem(
- templateNonNullableNotAssignedWarning
- .withArguments(node.variable.name),
- node.fileOffset,
- node.variable.name.length,
- inferrer.helper.uri);
}
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_constants.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_constants.dart
index 61f54880..e42aa40 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_constants.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_constants.dart
@@ -10,6 +10,8 @@
import '../loader.dart' show Loader;
+import '../source/source_loader.dart';
+
import 'constant_evaluator.dart' show ErrorReporter;
class KernelConstantErrorReporter extends ErrorReporter {
@@ -17,6 +19,11 @@
KernelConstantErrorReporter(this.loader);
+ bool get performNnbdChecks {
+ Loader loader = this.loader;
+ return loader is SourceLoader && loader.performNnbdChecks;
+ }
+
@override
void report(LocatedMessage message, List<LocatedMessage> context) {
loader.addProblem(
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index d1d0fe0..e98ecd7 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -45,15 +45,18 @@
import 'package:kernel/reference_from_index.dart' show IndexedClass;
+import 'package:kernel/src/future_or.dart';
import 'package:kernel/type_algebra.dart' show substitute;
import 'package:kernel/target/changed_structure_notifier.dart'
show ChangedStructureNotifier;
import 'package:kernel/target/targets.dart' show DiagnosticReporter;
import 'package:kernel/type_environment.dart' show TypeEnvironment;
import 'package:kernel/verifier.dart' show verifyGetStaticType;
+
import 'package:package_config/package_config.dart';
import '../../api_prototype/file_system.dart' show FileSystem;
+import '../../base/nnbd_mode.dart';
import '../builder/builder.dart';
import '../builder/class_builder.dart';
@@ -830,16 +833,7 @@
if (library.isNonNullableByDefault &&
library.loader.performNnbdChecks) {
if (constructor.isConst && lateFinalFields.isNotEmpty) {
- if (library.loader.nnbdStrongMode) {
- builder.addProblem(messageConstConstructorLateFinalFieldError,
- constructor.fileOffset, noLength,
- context: lateFinalFields
- .map((field) => messageConstConstructorLateFinalFieldCause
- .withLocation(
- field.fileUri, field.charOffset, noLength))
- .toList());
- lateFinalFields.clear();
- } else {
+ if (library.loader.nnbdMode == NnbdMode.Weak) {
builder.addProblem(messageConstConstructorLateFinalFieldWarning,
constructor.fileOffset, noLength,
context: lateFinalFields
@@ -847,8 +841,16 @@
.withLocation(
field.fileUri, field.charOffset, noLength))
.toList());
- lateFinalFields.clear();
+ } else {
+ builder.addProblem(messageConstConstructorLateFinalFieldError,
+ constructor.fileOffset, noLength,
+ context: lateFinalFields
+ .map((field) => messageConstConstructorLateFinalFieldCause
+ .withLocation(
+ field.fileUri, field.charOffset, noLength))
+ .toList());
}
+ lateFinalFields.clear();
}
}
}
@@ -888,27 +890,28 @@
field.fileUri);
}
} else if (field.type is! InvalidType &&
- field.type.isPotentiallyNonNullable &&
+ isPotentiallyNonNullable(
+ field.type, loader.coreTypes.futureOrClass) &&
(cls.constructors.isNotEmpty || cls.isMixinDeclaration)) {
SourceLibraryBuilder library = builder.library;
if (library.isNonNullableByDefault &&
library.loader.performNnbdChecks) {
- if (library.loader.nnbdStrongMode) {
- library.addProblem(
- templateFieldNonNullableWithoutInitializerError
- .withArguments(field.name.name, field.type,
- library.isNonNullableByDefault),
- field.fileOffset,
- field.name.name.length,
- library.fileUri);
- } else {
+ if (library.loader.nnbdMode == NnbdMode.Weak) {
library.addProblem(
templateFieldNonNullableWithoutInitializerWarning
.withArguments(field.name.name, field.type,
library.isNonNullableByDefault),
field.fileOffset,
field.name.name.length,
- library.fileUri);
+ field.fileUri);
+ } else {
+ library.addProblem(
+ templateFieldNonNullableWithoutInitializerError
+ .withArguments(field.name.name, field.type,
+ library.isNonNullableByDefault),
+ field.fileOffset,
+ field.name.name.length,
+ field.fileUri);
}
}
}
@@ -941,21 +944,22 @@
field.name.name.length)
]);
} else if (field.type is! InvalidType &&
- field.type.isPotentiallyNonNullable) {
+ isPotentiallyNonNullable(
+ field.type, loader.coreTypes.futureOrClass)) {
SourceLibraryBuilder library = builder.library;
if (library.isNonNullableByDefault &&
library.loader.performNnbdChecks) {
- if (library.loader.nnbdStrongMode) {
+ if (library.loader.nnbdMode == NnbdMode.Weak) {
library.addProblem(
- templateFieldNonNullableNotInitializedByConstructorError
+ templateFieldNonNullableNotInitializedByConstructorWarning
.withArguments(field.name.name, field.type,
library.isNonNullableByDefault),
field.fileOffset,
field.name.name.length,
- library.fileUri);
+ field.fileUri);
} else {
library.addProblem(
- templateFieldNonNullableNotInitializedByConstructorWarning
+ templateFieldNonNullableNotInitializedByConstructorError
.withArguments(field.name.name, field.type,
library.isNonNullableByDefault),
field.fileOffset,
@@ -983,10 +987,16 @@
new TypeEnvironment(loader.coreTypes, loader.hierarchy);
constants.EvaluationMode evaluationMode;
if (enableNonNullable) {
- if (loader.nnbdStrongMode) {
- evaluationMode = constants.EvaluationMode.strong;
- } else {
- evaluationMode = constants.EvaluationMode.weak;
+ switch (loader.nnbdMode) {
+ case NnbdMode.Weak:
+ evaluationMode = constants.EvaluationMode.weak;
+ break;
+ case NnbdMode.Strong:
+ evaluationMode = constants.EvaluationMode.strong;
+ break;
+ case NnbdMode.Agnostic:
+ evaluationMode = constants.EvaluationMode.agnostic;
+ break;
}
} else {
evaluationMode = constants.EvaluationMode.legacy;
diff --git a/pkg/front_end/lib/src/fasta/loader.dart b/pkg/front_end/lib/src/fasta/loader.dart
index eda53cc..0ab9f32 100644
--- a/pkg/front_end/lib/src/fasta/loader.dart
+++ b/pkg/front_end/lib/src/fasta/loader.dart
@@ -126,7 +126,12 @@
new Uri(
scheme: untranslatableUriScheme,
path: Uri.encodeComponent("$uri"));
- packageForLanguageVersion = target.uriTranslator.getPackage(uri);
+ if (uri.scheme == "package") {
+ packageForLanguageVersion = target.uriTranslator.getPackage(uri);
+ } else {
+ packageForLanguageVersion =
+ target.uriTranslator.packages.packageOf(fileUri);
+ }
break;
default:
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 ae16b95..43d0792 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -26,6 +26,8 @@
import 'package:kernel/ast.dart'
show InvalidType, Nullability, ProcedureKind, Variance;
+import '../../base/nnbd_mode.dart';
+
import '../builder/constructor_reference_builder.dart';
import '../builder/enum_builder.dart';
import '../builder/fixed_type_builder.dart';
@@ -584,16 +586,16 @@
if (supertypeForErrors != null) {
if (supertypeForErrors.nullabilityBuilder.build(libraryBuilder) ==
Nullability.nullable) {
- if (libraryBuilder.loader.nnbdStrongMode) {
+ if (libraryBuilder.loader.nnbdMode == NnbdMode.Weak) {
libraryBuilder.addProblem(
- templateNullableSuperclassError
+ templateNullableSuperclassWarning
.withArguments(supertypeForErrors.fullNameForErrors),
nameOffset,
classNameForErrors.length,
uri);
} else {
libraryBuilder.addProblem(
- templateNullableSuperclassWarning
+ templateNullableSuperclassError
.withArguments(supertypeForErrors.fullNameForErrors),
nameOffset,
classNameForErrors.length,
@@ -605,16 +607,16 @@
for (TypeBuilder mixin in mixins) {
if (mixin.nullabilityBuilder.build(libraryBuilder) ==
Nullability.nullable) {
- if (libraryBuilder.loader.nnbdStrongMode) {
+ if (libraryBuilder.loader.nnbdMode == NnbdMode.Weak) {
libraryBuilder.addProblem(
- templateNullableMixinError
+ templateNullableMixinWarning
.withArguments(mixin.fullNameForErrors),
nameOffset,
classNameForErrors.length,
uri);
} else {
libraryBuilder.addProblem(
- templateNullableMixinWarning
+ templateNullableMixinError
.withArguments(mixin.fullNameForErrors),
nameOffset,
classNameForErrors.length,
@@ -627,16 +629,16 @@
for (TypeBuilder interface in interfaces) {
if (interface.nullabilityBuilder.build(libraryBuilder) ==
Nullability.nullable) {
- if (libraryBuilder.loader.nnbdStrongMode) {
+ if (libraryBuilder.loader.nnbdMode == NnbdMode.Weak) {
libraryBuilder.addProblem(
- templateNullableInterfaceError
+ templateNullableInterfaceWarning
.withArguments(interface.fullNameForErrors),
nameOffset,
classNameForErrors.length,
uri);
} else {
libraryBuilder.addProblem(
- templateNullableInterfaceWarning
+ templateNullableInterfaceError
.withArguments(interface.fullNameForErrors),
nameOffset,
classNameForErrors.length,
@@ -702,16 +704,16 @@
for (TypeBuilder supertype in supertypeConstraints) {
if (supertype.nullabilityBuilder.build(libraryBuilder) ==
Nullability.nullable) {
- if (libraryBuilder.loader.nnbdStrongMode) {
+ if (libraryBuilder.loader.nnbdMode == NnbdMode.Weak) {
libraryBuilder.addProblem(
- templateNullableSuperclassError
+ templateNullableSuperclassWarning
.withArguments(supertype.fullNameForErrors),
nameOffset,
classNameForErrors.length,
uri);
} else {
libraryBuilder.addProblem(
- templateNullableSuperclassWarning
+ templateNullableSuperclassError
.withArguments(supertype.fullNameForErrors),
nameOffset,
classNameForErrors.length,
@@ -724,16 +726,16 @@
for (TypeBuilder interface in interfaces) {
if (interface.nullabilityBuilder.build(libraryBuilder) ==
Nullability.nullable) {
- if (libraryBuilder.loader.nnbdStrongMode) {
+ if (libraryBuilder.loader.nnbdMode == NnbdMode.Weak) {
libraryBuilder.addProblem(
- templateNullableInterfaceError
+ templateNullableInterfaceWarning
.withArguments(interface.fullNameForErrors),
nameOffset,
classNameForErrors.length,
uri);
} else {
libraryBuilder.addProblem(
- templateNullableInterfaceWarning
+ templateNullableInterfaceError
.withArguments(interface.fullNameForErrors),
nameOffset,
classNameForErrors.length,
@@ -1242,16 +1244,16 @@
if (supertype != null && supertype is! MixinApplicationBuilder) {
if (supertype.nullabilityBuilder.build(libraryBuilder) ==
Nullability.nullable) {
- if (libraryBuilder.loader.nnbdStrongMode) {
+ if (libraryBuilder.loader.nnbdMode == NnbdMode.Weak) {
libraryBuilder.addProblem(
- templateNullableSuperclassError
+ templateNullableSuperclassWarning
.withArguments(supertype.fullNameForErrors),
charOffset,
classNameForErrors.length,
uri);
} else {
libraryBuilder.addProblem(
- templateNullableSuperclassWarning
+ templateNullableSuperclassError
.withArguments(supertype.fullNameForErrors),
charOffset,
classNameForErrors.length,
@@ -1262,16 +1264,16 @@
for (TypeBuilder mixin in mixins) {
if (mixin.nullabilityBuilder.build(libraryBuilder) ==
Nullability.nullable) {
- if (libraryBuilder.loader.nnbdStrongMode) {
+ if (libraryBuilder.loader.nnbdMode == NnbdMode.Weak) {
libraryBuilder.addProblem(
- templateNullableMixinError
+ templateNullableMixinWarning
.withArguments(mixin.fullNameForErrors),
charOffset,
classNameForErrors.length,
uri);
} else {
libraryBuilder.addProblem(
- templateNullableMixinWarning
+ templateNullableMixinError
.withArguments(mixin.fullNameForErrors),
charOffset,
classNameForErrors.length,
@@ -1283,16 +1285,16 @@
for (TypeBuilder interface in interfaces) {
if (interface.nullabilityBuilder.build(libraryBuilder) ==
Nullability.nullable) {
- if (libraryBuilder.loader.nnbdStrongMode) {
+ if (libraryBuilder.loader.nnbdMode == NnbdMode.Weak) {
libraryBuilder.addProblem(
- templateNullableInterfaceError
+ templateNullableInterfaceWarning
.withArguments(interface.fullNameForErrors),
charOffset,
classNameForErrors.length,
uri);
} else {
libraryBuilder.addProblem(
- templateNullableInterfaceWarning
+ templateNullableInterfaceError
.withArguments(interface.fullNameForErrors),
charOffset,
classNameForErrors.length,
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index ace7e55..51842c7 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -65,11 +65,15 @@
findTypeArgumentIssuesForInvocation,
getGenericTypeName;
+import 'package:kernel/src/future_or.dart';
+
import 'package:kernel/type_algebra.dart' show substitute;
import 'package:kernel/type_environment.dart'
show SubtypeCheckMode, TypeEnvironment;
+import '../../base/nnbd_mode.dart';
+
import '../builder/builder.dart';
import '../builder/builtin_type_builder.dart';
import '../builder/class_builder.dart';
@@ -311,12 +315,30 @@
referencesFrom == null ? null : new IndexedLibrary(referencesFrom),
super(
fileUri, libraryDeclaration.toScope(importScope), new Scope.top()) {
+ updateLibraryNNBDSettings();
+ }
+
+ void updateLibraryNNBDSettings() {
library.isNonNullableByDefault = isNonNullableByDefault;
- library.nonNullableByDefaultCompiledMode = loader.target.enableNonNullable
- ? (loader.nnbdStrongMode
- ? NonNullableByDefaultCompiledMode.Strong
- : NonNullableByDefaultCompiledMode.Weak)
- : NonNullableByDefaultCompiledMode.Disabled;
+ if (loader.target.enableNonNullable) {
+ switch (loader.nnbdMode) {
+ case NnbdMode.Weak:
+ library.nonNullableByDefaultCompiledMode =
+ NonNullableByDefaultCompiledMode.Weak;
+ break;
+ case NnbdMode.Strong:
+ library.nonNullableByDefaultCompiledMode =
+ NonNullableByDefaultCompiledMode.Strong;
+ break;
+ case NnbdMode.Agnostic:
+ library.nonNullableByDefaultCompiledMode =
+ NonNullableByDefaultCompiledMode.Agnostic;
+ break;
+ }
+ } else {
+ library.nonNullableByDefaultCompiledMode =
+ NonNullableByDefaultCompiledMode.Disabled;
+ }
}
SourceLibraryBuilder(
@@ -368,6 +390,7 @@
bool isOptOutPackage(Uri uri) {
if (!uri.isScheme('package')) return false;
+ if (uri.pathSegments.isEmpty) return false;
String packageName = uri.pathSegments.first;
return optOutPackages.contains(packageName);
}
@@ -517,12 +540,12 @@
void setLanguageVersion(int major, int minor,
{int offset: 0, int length: noLength, bool explicit: false}) {
if (languageVersion.isExplicit) return;
- _languageVersion =
- new LanguageVersion(major, minor, fileUri, offset, length, explicit);
if (major == null || minor == null) {
addPostponedProblem(
messageLanguageVersionInvalidInDotPackages, offset, length, fileUri);
+ _languageVersion =
+ new InvalidLanguageVersion(fileUri, offset, length, explicit);
return;
}
@@ -538,8 +561,13 @@
offset,
length,
fileUri);
+ _languageVersion =
+ new InvalidLanguageVersion(fileUri, offset, length, explicit);
return;
}
+
+ _languageVersion =
+ new LanguageVersion(major, minor, fileUri, offset, length, explicit);
library.setLanguageVersion(major, minor);
}
@@ -964,14 +992,8 @@
reference: referenceFrom?.reference));
}
- library.isNonNullableByDefault = isNonNullableByDefault;
// TODO(CFE Team): Is this really needed in two places?
- library.nonNullableByDefaultCompiledMode = loader.target.enableNonNullable
- ? (loader.nnbdStrongMode
- ? NonNullableByDefaultCompiledMode.Strong
- : NonNullableByDefaultCompiledMode.Weak)
- : NonNullableByDefaultCompiledMode.Disabled;
-
+ updateLibraryNNBDSettings();
return library;
}
@@ -1095,8 +1117,11 @@
return false;
}
- // Language versions have to match.
- if (languageVersion != part.languageVersion) {
+ // Language versions have to match. Except if (at least) one of them is
+ // invalid in which case we've already gotten an error about this.
+ if (languageVersion != part.languageVersion &&
+ languageVersion.valid &&
+ part.languageVersion.valid) {
// This is an error, but the part is not removed from the list of
// parts, so that metadata annotations can be associated with it.
List<LocatedMessage> context = <LocatedMessage>[];
@@ -2449,7 +2474,7 @@
modifiers |= initializingFormalMask;
}
FormalParameterBuilder formal = new FormalParameterBuilder(
- metadata, modifiers, type, name, this, charOffset, importUri)
+ metadata, modifiers, type, name, this, charOffset, fileUri)
..initializerToken = initializerToken
..hasDeclaredInitializer = (initializerToken != null);
return formal;
@@ -3128,11 +3153,11 @@
if (!fieldBuilder.isDeclarationInstanceMember &&
!fieldBuilder.field.isLate &&
fieldType is! InvalidType &&
- fieldType.isPotentiallyNonNullable &&
+ isPotentiallyNonNullable(fieldType, typeEnvironment.futureOrClass) &&
!fieldBuilder.hasInitializer) {
- if (loader.nnbdStrongMode) {
+ if (loader.nnbdMode == NnbdMode.Weak) {
addProblem(
- templateFieldNonNullableWithoutInitializerError.withArguments(
+ templateFieldNonNullableWithoutInitializerWarning.withArguments(
fieldBuilder.name,
fieldBuilder.field.type,
isNonNullableByDefault),
@@ -3141,7 +3166,7 @@
fileUri);
} else {
addProblem(
- templateFieldNonNullableWithoutInitializerWarning.withArguments(
+ templateFieldNonNullableWithoutInitializerError.withArguments(
fieldBuilder.name,
fieldBuilder.field.type,
isNonNullableByDefault),
@@ -3153,7 +3178,8 @@
}
}
- void checkInitializersInFormals(List<FormalParameterBuilder> formals) {
+ void checkInitializersInFormals(
+ List<FormalParameterBuilder> formals, TypeEnvironment typeEnvironment) {
bool performInitializerChecks =
isNonNullableByDefault && loader.performNnbdChecks;
if (!performInitializerChecks) return;
@@ -3163,23 +3189,24 @@
bool isOptionalNamed = !formal.isNamedRequired && formal.isNamed;
bool isOptional = isOptionalPositional || isOptionalNamed;
if (isOptional &&
- formal.variable.type.isPotentiallyNonNullable &&
+ isPotentiallyNonNullable(
+ formal.variable.type, typeEnvironment.futureOrClass) &&
!formal.hasDeclaredInitializer) {
- if (loader.nnbdStrongMode) {
- addProblem(
- templateOptionalNonNullableWithoutInitializerError.withArguments(
- formal.name, formal.variable.type, isNonNullableByDefault),
- formal.charOffset,
- formal.name.length,
- fileUri);
- } else {
+ if (loader.nnbdMode == NnbdMode.Weak) {
addProblem(
templateOptionalNonNullableWithoutInitializerWarning
.withArguments(formal.name, formal.variable.type,
isNonNullableByDefault),
formal.charOffset,
formal.name.length,
- fileUri);
+ formal.fileUri);
+ } else {
+ addProblem(
+ templateOptionalNonNullableWithoutInitializerError.withArguments(
+ formal.name, formal.variable.type, isNonNullableByDefault),
+ formal.charOffset,
+ formal.name.length,
+ formal.fileUri);
}
}
}
@@ -3265,7 +3292,8 @@
}
nnbdIssues ??= const {};
- if (nnbdIssues.contains(issue) && !loader.nnbdStrongMode) {
+ if (nnbdIssues.contains(issue) &&
+ loader.nnbdMode == NnbdMode.Weak) {
reportProblem(templateIncorrectTypeArgumentInReturnTypeWarning);
} else {
reportProblem(templateIncorrectTypeArgumentInReturnType);
@@ -3332,10 +3360,11 @@
}
if (nnbdIssues != null) {
if (legacyIssues != null) {
- nnbdIssues = nnbdIssues.where((issue) => !legacyIssues.contains(issue));
+ nnbdIssues =
+ nnbdIssues.where((issue) => !legacyIssues.contains(issue)).toSet();
}
reportTypeArgumentIssues(nnbdIssues, fileUri, offset,
- inferred: inferred, areWarnings: !loader.nnbdStrongMode);
+ inferred: inferred, areWarnings: loader.nnbdMode == NnbdMode.Weak);
}
}
@@ -3426,7 +3455,7 @@
typeArgumentsInfo: typeArgumentsInfo,
targetReceiver: targetReceiver,
targetName: targetName,
- areWarnings: !loader.nnbdStrongMode);
+ areWarnings: loader.nnbdMode == NnbdMode.Weak);
}
}
@@ -3509,7 +3538,7 @@
typeArgumentsInfo: getTypeArgumentsInfo(arguments),
targetReceiver: receiverType,
targetName: name.name,
- areWarnings: !loader.nnbdStrongMode);
+ areWarnings: loader.nnbdMode == NnbdMode.Weak);
}
}
@@ -3523,7 +3552,7 @@
checkBoundsInFunctionNode(declaration.procedure.function,
typeEnvironment, declaration.fileUri);
if (declaration.formals != null) {
- checkInitializersInFormals(declaration.formals);
+ checkInitializersInFormals(declaration.formals, typeEnvironment);
}
} else if (declaration is ClassBuilder) {
declaration.checkTypesInOutline(typeEnvironment);
@@ -3900,6 +3929,8 @@
LanguageVersion(this.major, this.minor, this.fileUri, this.charOffset,
this.charCount, this.isExplicit);
+ bool get valid => true;
+
int get hashCode =>
major.hashCode * 13 + minor.hashCode * 17 + isExplicit.hashCode * 19;
@@ -3917,6 +3948,37 @@
}
}
+class InvalidLanguageVersion implements LanguageVersion {
+ final Uri fileUri;
+ final int charOffset;
+ final int charCount;
+ final bool isExplicit;
+
+ InvalidLanguageVersion(
+ this.fileUri, this.charOffset, this.charCount, this.isExplicit);
+
+ @override
+ int get major => Library.defaultLanguageVersionMajor;
+
+ @override
+ int get minor => Library.defaultLanguageVersionMinor;
+
+ @override
+ bool get valid => false;
+
+ int get hashCode => isExplicit.hashCode * 19;
+
+ bool operator ==(Object other) {
+ if (identical(this, other)) return true;
+ return other is InvalidLanguageVersion && isExplicit == other.isExplicit;
+ }
+
+ String toString() {
+ return 'InvalidLanguageVersion(isExplicit=$isExplicit,'
+ 'fileUri=$fileUri,charOffset=$charOffset,charCount=$charCount)';
+ }
+}
+
class ImplicitLanguageVersion implements LanguageVersion {
const ImplicitLanguageVersion();
@@ -3927,6 +3989,9 @@
int get minor => Library.defaultLanguageVersionMinor;
@override
+ bool get valid => true;
+
+ @override
Uri get fileUri => null;
@override
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 9d3b7d3..c823d27 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -57,6 +57,8 @@
import '../../base/instrumentation.dart' show Instrumentation;
+import '../../base/nnbd_mode.dart';
+
import '../blacklisted_classes.dart' show blacklistedCoreClasses;
import '../builder/builder.dart';
@@ -188,7 +190,7 @@
retainDataForTesting ? new SourceLoaderDataForTesting() : null,
super(target);
- bool get nnbdStrongMode => target.context.options.nnbdStrongMode;
+ NnbdMode get nnbdMode => target.context.options.nnbdMode;
bool get performNnbdChecks => target.context.options.performNnbdChecks;
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 5eefe76..23f77b1 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
@@ -23,6 +23,8 @@
import 'package:kernel/src/bounds_checks.dart' show calculateBounds;
+import 'package:kernel/src/future_or.dart';
+
import '../../base/instrumentation.dart'
show
Instrumentation,
@@ -30,6 +32,8 @@
InstrumentationValueForType,
InstrumentationValueForTypeArgs;
+import '../../base/nnbd_mode.dart';
+
import '../builder/constructor_builder.dart';
import '../builder/extension_builder.dart';
import '../builder/member_builder.dart';
@@ -520,7 +524,7 @@
bool get isNonNullableByDefault => library.isNonNullableByDefault;
- bool get nnbdStrongMode => library.loader.nnbdStrongMode;
+ NnbdMode get nnbdMode => library.loader.nnbdMode;
bool get performNnbdChecks {
return !isTopLevel &&
@@ -625,7 +629,8 @@
bool isAssignable(DartType contextType, DartType expressionType,
{bool isStrongNullabilityMode}) {
- isStrongNullabilityMode ??= isNonNullableByDefault && nnbdStrongMode;
+ isStrongNullabilityMode ??=
+ isNonNullableByDefault && nnbdMode != NnbdMode.Weak;
if (isStrongNullabilityMode) {
if (expressionType is DynamicType) return true;
return typeSchemaEnvironment
@@ -693,8 +698,9 @@
preciseTypeErrorTemplate = _getPreciseTypeErrorTemplate(expression);
AssignabilityKind kind = _computeAssignabilityKind(
contextType, expressionType,
- isStrongNullabilityMode:
- isNonNullableByDefault && performNnbdChecks && nnbdStrongMode,
+ isStrongNullabilityMode: isNonNullableByDefault &&
+ performNnbdChecks &&
+ nnbdMode != NnbdMode.Weak,
isVoidAllowed: isVoidAllowed,
isExpressionTypePrecise: preciseTypeErrorTemplate != null);
@@ -752,7 +758,9 @@
// of code generation, and the inability to tear off from a
// potentially nullable receiver shouldn't arise as an issue in any
// mode other than the strong mode.
- assert(isNonNullableByDefault && performNnbdChecks && nnbdStrongMode);
+ assert(isNonNullableByDefault &&
+ performNnbdChecks &&
+ nnbdMode != NnbdMode.Weak);
result = _wrapTearoffErrorExpression(
expression, contextType, templateNullableTearoffError);
@@ -762,7 +770,9 @@
}
// Report warnings in weak mode.
- if (isNonNullableByDefault && performNnbdChecks && !nnbdStrongMode) {
+ if (isNonNullableByDefault &&
+ performNnbdChecks &&
+ nnbdMode == NnbdMode.Weak) {
AssignabilityKind weakKind = _computeAssignabilityKind(
contextType, expressionType,
isStrongNullabilityMode: true,
@@ -807,7 +817,7 @@
// The first handling of the error should have happened in the strong
// mode.
- assert(!nnbdStrongMode);
+ assert(nnbdMode == NnbdMode.Weak);
if (contextType is! InvalidType && expressionType is! InvalidType) {
TypedTearoff typedTearoff =
@@ -826,7 +836,7 @@
// The first handling of the error should have happened in the strong
// mode.
- assert(!nnbdStrongMode);
+ assert(nnbdMode == NnbdMode.Weak);
if (isNonNullableByDefault && performNnbdChecks) {
result = _wrapTearoffErrorExpression(
@@ -2418,19 +2428,19 @@
// Use length 1 for .call -- in most cases its name is skipped.
int errorSpanLength =
targetName == callName ? noLength : targetName.name.length;
- if (nnbdStrongMode) {
+ if (nnbdMode == NnbdMode.Weak) {
+ helper.addProblem(
+ templateNullableMethodCallWarning.withArguments(
+ targetName.name, receiverType, isNonNullableByDefault),
+ offset,
+ errorSpanLength);
+ } else {
return new WrapInProblemInferenceResult(
inferredType,
templateNullableMethodCallError.withArguments(
targetName.name, receiverType, isNonNullableByDefault),
errorSpanLength,
helper);
- } else {
- helper.addProblem(
- templateNullableMethodCallWarning.withArguments(
- targetName.name, receiverType, isNonNullableByDefault),
- offset,
- errorSpanLength);
}
}
}
@@ -2553,11 +2563,11 @@
bool isOptionalNamed =
i >= function.positionalParameters.length && !formal.isRequired;
if ((isOptionalPositional || isOptionalNamed) &&
- formal.type.isPotentiallyNonNullable &&
+ isPotentiallyNonNullable(formal.type, coreTypes.futureOrClass) &&
!formal.hasDeclaredInitializer) {
- if (nnbdStrongMode) {
+ if (nnbdMode == NnbdMode.Weak) {
library.addProblem(
- templateOptionalNonNullableWithoutInitializerError
+ templateOptionalNonNullableWithoutInitializerWarning
.withArguments(
formal.name, formal.type, isNonNullableByDefault),
formal.fileOffset,
@@ -2565,7 +2575,7 @@
library.importUri);
} else {
library.addProblem(
- templateOptionalNonNullableWithoutInitializerWarning
+ templateOptionalNonNullableWithoutInitializerError
.withArguments(
formal.name, formal.type, isNonNullableByDefault),
formal.fileOffset,
@@ -2580,16 +2590,16 @@
for (VariableDeclarationImpl formal in function.namedParameters) {
// Required named parameters shouldn't have initializers.
if (formal.isRequired && formal.hasDeclaredInitializer) {
- if (nnbdStrongMode) {
+ if (nnbdMode == NnbdMode.Weak) {
library.addProblem(
- templateRequiredNamedParameterHasDefaultValueError
+ templateRequiredNamedParameterHasDefaultValueWarning
.withArguments(formal.name),
formal.fileOffset,
formal.name.length,
library.importUri);
} else {
library.addProblem(
- templateRequiredNamedParameterHasDefaultValueWarning
+ templateRequiredNamedParameterHasDefaultValueError
.withArguments(formal.name),
formal.fileOffset,
formal.name.length,
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart b/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
index ada372b..da733e7 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
@@ -348,9 +348,9 @@
}
@override
- bool isSubtypeOf(
- DartType subtype, DartType supertype, SubtypeCheckMode mode) {
- if (subtype is UnknownType) return true;
+ IsSubtypeOf performNullabilityAwareSubtypeCheck(
+ DartType subtype, DartType supertype) {
+ if (subtype is UnknownType) return const IsSubtypeOf.always();
DartType unwrappedSupertype = supertype;
while (unwrappedSupertype is InterfaceType &&
unwrappedSupertype.classNode == futureOrClass) {
@@ -358,9 +358,9 @@
(unwrappedSupertype as InterfaceType).typeArguments.single;
}
if (subtype == coreTypes.nullType && unwrappedSupertype is UnknownType) {
- return true;
+ return const IsSubtypeOf.always();
}
- return super.isSubtypeOf(subtype, supertype, mode);
+ return super.performNullabilityAwareSubtypeCheck(subtype, supertype);
}
bool isEmptyContext(DartType context) {
diff --git a/pkg/front_end/lib/src/fasta/util/textual_outline.dart b/pkg/front_end/lib/src/fasta/util/textual_outline.dart
index 7cb4916..5ff9bc4 100644
--- a/pkg/front_end/lib/src/fasta/util/textual_outline.dart
+++ b/pkg/front_end/lib/src/fasta/util/textual_outline.dart
@@ -88,7 +88,12 @@
main(List<String> args) {
File f = new File(args[0]);
- print(textualOutline(f.readAsBytesSync(), makeMoreReadable: true));
+ String outline = textualOutline(f.readAsBytesSync(), makeMoreReadable: true);
+ if (args.length > 1 && args[1] == "--overwrite") {
+ f.writeAsStringSync(outline);
+ } else {
+ print(outline);
+ }
}
class EndOffsetListener extends DirectiveListener {
diff --git a/pkg/front_end/lib/src/testing/id_testing_helper.dart b/pkg/front_end/lib/src/testing/id_testing_helper.dart
index f1ccd16..17be137 100644
--- a/pkg/front_end/lib/src/testing/id_testing_helper.dart
+++ b/pkg/front_end/lib/src/testing/id_testing_helper.dart
@@ -235,6 +235,13 @@
void onFailure(String message),
Map<String, List<String>> skipMap,
Uri nullUri}) async {
+ for (TestConfig config in testedConfigs) {
+ if (!testData.expectedMaps.containsKey(config.marker)) {
+ throw new ArgumentError("Unexpected test marker '${config.marker}'. "
+ "Supported markers: ${testData.expectedMaps.keys}.");
+ }
+ }
+
Map<String, TestResult<T>> results = {};
for (TestConfig config in testedConfigs) {
if (skipForConfig(testData.name, config.marker, skipMap)) {
diff --git a/pkg/front_end/lib/src/testing/id_testing_utils.dart b/pkg/front_end/lib/src/testing/id_testing_utils.dart
index b399707..09a048d 100644
--- a/pkg/front_end/lib/src/testing/id_testing_utils.dart
+++ b/pkg/front_end/lib/src/testing/id_testing_utils.dart
@@ -243,8 +243,9 @@
enum TypeRepresentation {
legacy,
explicit,
- implicitUndetermined,
- nonNullableByDefault,
+ // The type representation is made match the non-nullable-by-default type
+ // display string from the analyzer.
+ analyzerNonNullableByDefault,
}
/// Returns a textual representation of the type [node] to be used in
@@ -421,6 +422,14 @@
DartTypeToTextVisitor(this.sb, this.typeRepresentation);
+ String get commaText {
+ if (typeRepresentation == TypeRepresentation.analyzerNonNullableByDefault) {
+ return ', ';
+ } else {
+ return ',';
+ }
+ }
+
void visit(DartType node) => node.accept(this);
void visitList(Iterable<DartType> nodes) {
@@ -428,7 +437,7 @@
for (DartType node in nodes) {
sb.write(comma);
visit(node);
- comma = ',';
+ comma = commaText;
}
}
@@ -475,6 +484,10 @@
for (int i = 0; i < node.typeParameters.length; i++) {
if (i > 0) {
sb.write(',');
+ if (typeRepresentation ==
+ TypeRepresentation.analyzerNonNullableByDefault) {
+ sb.write(' ');
+ }
}
TypeParameter typeParameter = node.typeParameters[i];
sb.write(typeParameter.name);
@@ -490,14 +503,14 @@
String comma = '';
visitList(node.positionalParameters.take(node.requiredParameterCount));
if (node.requiredParameterCount > 0) {
- comma = ',';
+ comma = commaText;
}
if (node.requiredParameterCount < node.positionalParameters.length) {
sb.write(comma);
sb.write('[');
visitList(node.positionalParameters.skip(node.requiredParameterCount));
sb.write(']');
- comma = ',';
+ comma = commaText;
}
if (node.namedParameters.isNotEmpty) {
sb.write(comma);
@@ -511,7 +524,7 @@
visit(namedParameter.type);
sb.write(' ');
sb.write(namedParameter.name);
- comma = ',';
+ comma = commaText;
}
sb.write('}');
}
@@ -656,9 +669,8 @@
switch (typeRepresentation) {
case TypeRepresentation.explicit:
case TypeRepresentation.legacy:
- case TypeRepresentation.implicitUndetermined:
return '!';
- case TypeRepresentation.nonNullableByDefault:
+ case TypeRepresentation.analyzerNonNullableByDefault:
return '';
}
break;
@@ -666,7 +678,7 @@
return '?';
case Nullability.undetermined:
switch (typeRepresentation) {
- case TypeRepresentation.implicitUndetermined:
+ case TypeRepresentation.analyzerNonNullableByDefault:
return '';
default:
return '%';
@@ -677,8 +689,7 @@
case TypeRepresentation.legacy:
return '';
case TypeRepresentation.explicit:
- case TypeRepresentation.nonNullableByDefault:
- case TypeRepresentation.implicitUndetermined:
+ case TypeRepresentation.analyzerNonNullableByDefault:
return '*';
}
break;
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 278d439..f3c7e88 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -78,6 +78,8 @@
ConstConstructorLateFinalFieldWarning/example: Fail
ConstConstructorNonFinalField/example: Fail
ConstConstructorRedirectionToNonConst/analyzerCode: Fail # The analyzer doesn't report this error.
+ConstEvalCaseImplementsEqual/analyzerCode: Fail
+ConstEvalCaseImplementsEqual/example: Fail
ConstEvalCircularity/example: Fail
ConstEvalContext/analyzerCode: Fail # This is just used for displaying the context.
ConstEvalContext/example: Fail # This is just used for displaying the context.
@@ -466,6 +468,8 @@
NoSuchNamedParameter/example: Fail
NoUnnamedConstructorInObject/analyzerCode: Fail
NoUnnamedConstructorInObject/example: Fail
+NonAgnosticConstant/analyzerCode: Fail
+NonAgnosticConstant/example: Fail
NonAsciiIdentifier/expression: Fail
NonAsciiIdentifier/part_wrapped_expression: Fail
NonConstConstructor/example: Fail
@@ -528,9 +532,7 @@
OperatorWithOptionalFormals/analyzerCode: Fail
OperatorWithOptionalFormals/example: Fail
OptionalNonNullableWithoutInitializerError/analyzerCode: Fail
-OptionalNonNullableWithoutInitializerError/example: Fail
OptionalNonNullableWithoutInitializerWarning/analyzerCode: Fail
-OptionalNonNullableWithoutInitializerWarning/example: Fail
OverrideFewerNamedArguments/example: Fail
OverrideFewerPositionalArguments/example: Fail
OverrideMismatchNamedParameter/example: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 7ccfc86..ae93971 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -110,6 +110,9 @@
template: "The key '#constant' does not have a primitive operator '=='."
analyzerCode: CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS
+ConstEvalCaseImplementsEqual:
+ template: "Case expression '#constant' does not have a primitive operator '=='."
+
ConstEvalInvalidType:
template: "Expected constant '#constant' to be of type '#type', but was of type '#type2'."
@@ -3933,10 +3936,18 @@
OptionalNonNullableWithoutInitializerError:
template: "Optional parameter '#name' should have a default value because its type '#type' doesn't allow null."
+ configuration: nnbd-strong
+ script:
+ - method1({int a}) {}
+ - method2([int a]) {}
OptionalNonNullableWithoutInitializerWarning:
template: "Optional parameter '#name' doesn't have a default value and its type '#type' doesn't allow null."
+ configuration: nnbd-weak
severity: WARNING
+ script:
+ - method1({int a}) {}
+ - method2([int a]) {}
FieldNonNullableWithoutInitializerError:
template: "Field '#name' should be initialized because its type '#type' doesn't allow null."
@@ -4007,3 +4018,6 @@
NonNullableNotAssignedWarning:
template: "Non-nullable variable '#name' is used before it's assigned."
severity: WARNING
+
+NonAgnosticConstant:
+ template: "Constant value is not strong/weak mode agnostic."
diff --git a/pkg/front_end/parser_testcases/error_recovery/empty_await_for.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/empty_await_for.dart.intertwined.expect
index 5b35362..2cccc1b 100644
--- a/pkg/front_end/parser_testcases/error_recovery/empty_await_for.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/empty_await_for.dart.intertwined.expect
@@ -44,6 +44,7 @@
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., null, {token: )}], ), ))
rewriter()
listener: handleIdentifier(, expression)
+ parseBangBeforeTypeArguments()
listener: handleNoTypeArguments())
parseArgumentsOpt()
listener: handleNoArguments())
@@ -66,6 +67,7 @@
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., null, {token: )}], ), ))
rewriter()
listener: handleIdentifier(, expression)
+ parseBangBeforeTypeArguments()
listener: handleNoTypeArguments())
parseArgumentsOpt()
listener: handleNoArguments())
diff --git a/pkg/front_end/parser_testcases/error_recovery/empty_for.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/empty_for.dart.intertwined.expect
index 96c0c6e..fb95168 100644
--- a/pkg/front_end/parser_testcases/error_recovery/empty_for.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/empty_for.dart.intertwined.expect
@@ -44,6 +44,7 @@
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., null, {token: )}], ), ))
rewriter()
listener: handleIdentifier(, expression)
+ parseBangBeforeTypeArguments()
listener: handleNoTypeArguments())
parseArgumentsOpt()
listener: handleNoArguments())
@@ -66,6 +67,7 @@
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ')'., null, {token: )}], ), ))
rewriter()
listener: handleIdentifier(, expression)
+ parseBangBeforeTypeArguments()
listener: handleNoTypeArguments())
parseArgumentsOpt()
listener: handleNoArguments())
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_38415.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_38415.crash_dart.intertwined.expect
index de44d61b..27829c9 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_38415.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_38415.crash_dart.intertwined.expect
@@ -40,6 +40,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(m, expression)
+ parseBangBeforeTypeArguments(m)
listener: handleNoTypeArguments(()
parseArgumentsOpt(m)
parseArguments(m)
@@ -53,6 +54,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(T, expression)
+ parseBangBeforeTypeArguments(T)
listener: handleNoTypeArguments(<)
parseArgumentsOpt(T)
listener: handleNoArguments(<)
@@ -66,6 +68,7 @@
parseSend(<, expression)
ensureIdentifier(<, expression)
listener: handleIdentifier(R, expression)
+ parseBangBeforeTypeArguments(R)
listener: handleNoTypeArguments(()
parseArgumentsOpt(R)
parseArguments(R)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_39202.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_39202.crash_dart.intertwined.expect
index 7698ac7..9d28fa4 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_39202.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_39202.crash_dart.intertwined.expect
@@ -56,6 +56,7 @@
parseSend(=>, expression)
ensureIdentifier(=>, expression)
listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
listener: handleNoTypeArguments(b)
parseArgumentsOpt(a)
listener: handleNoArguments(b)
diff --git a/pkg/front_end/parser_testcases/general/assignment.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/assignment.dart.intertwined.expect
index 2eb06c2..50f9ec1 100644
--- a/pkg/front_end/parser_testcases/general/assignment.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/assignment.dart.intertwined.expect
@@ -39,6 +39,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(=)
parseArgumentsOpt(foo)
listener: handleNoArguments(=)
diff --git a/pkg/front_end/parser_testcases/general/for.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/for.dart.intertwined.expect
index 871903b..8135998 100644
--- a/pkg/front_end/parser_testcases/general/for.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/for.dart.intertwined.expect
@@ -69,6 +69,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(i, expression)
+ parseBangBeforeTypeArguments(i)
listener: handleNoTypeArguments(<)
parseArgumentsOpt(i)
listener: handleNoArguments(<)
@@ -90,6 +91,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(i, expression)
+ parseBangBeforeTypeArguments(i)
listener: handleNoTypeArguments(++)
parseArgumentsOpt(i)
listener: handleNoArguments(++)
diff --git a/pkg/front_end/parser_testcases/general/for_in.dart.parser.expect b/pkg/front_end/parser_testcases/general/for_in.dart.parser.expect
index 894374e..df1c59c 100644
--- a/pkg/front_end/parser_testcases/general/for_in.dart.parser.expect
+++ b/pkg/front_end/parser_testcases/general/for_in.dart.parser.expect
@@ -1,3 +1,5 @@
+NOTICE: Stream was rewritten by parser!
+
main() {
for (var i in []) {}
}
diff --git a/pkg/front_end/parser_testcases/general/for_in_no_decl.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/for_in_no_decl.dart.intertwined.expect
index 04c39fb..4290e34 100644
--- a/pkg/front_end/parser_testcases/general/for_in_no_decl.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/for_in_no_decl.dart.intertwined.expect
@@ -61,6 +61,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(i, expression)
+ parseBangBeforeTypeArguments(i)
listener: handleNoTypeArguments(in)
parseArgumentsOpt(i)
listener: handleNoArguments(in)
diff --git a/pkg/front_end/parser_testcases/general/for_in_no_decl.dart.parser.expect b/pkg/front_end/parser_testcases/general/for_in_no_decl.dart.parser.expect
index b64fd37..c9261c2 100644
--- a/pkg/front_end/parser_testcases/general/for_in_no_decl.dart.parser.expect
+++ b/pkg/front_end/parser_testcases/general/for_in_no_decl.dart.parser.expect
@@ -1,3 +1,5 @@
+NOTICE: Stream was rewritten by parser!
+
main() {
var i;
for (i in []) {}
diff --git a/pkg/front_end/parser_testcases/general/for_no_decl.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/for_no_decl.dart.intertwined.expect
index b1cc14f..d564828 100644
--- a/pkg/front_end/parser_testcases/general/for_no_decl.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/for_no_decl.dart.intertwined.expect
@@ -63,6 +63,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(i, expression)
+ parseBangBeforeTypeArguments(i)
listener: handleNoTypeArguments(=)
parseArgumentsOpt(i)
listener: handleNoArguments(=)
@@ -86,6 +87,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(i, expression)
+ parseBangBeforeTypeArguments(i)
listener: handleNoTypeArguments(<)
parseArgumentsOpt(i)
listener: handleNoArguments(<)
@@ -107,6 +109,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(i, expression)
+ parseBangBeforeTypeArguments(i)
listener: handleNoTypeArguments(++)
parseArgumentsOpt(i)
listener: handleNoArguments(++)
diff --git a/pkg/front_end/parser_testcases/general/missing_end_bracket.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/missing_end_bracket.dart.intertwined.expect
index 6d5f4a8..cc49ff3 100644
--- a/pkg/front_end/parser_testcases/general/missing_end_bracket.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/missing_end_bracket.dart.intertwined.expect
@@ -40,6 +40,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(print, expression)
+ parseBangBeforeTypeArguments(print)
listener: handleNoTypeArguments(()
parseArgumentsOpt(print)
parseArguments(print)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39286.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39286.dart.intertwined.expect
index f60f894..a9bd0d8 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39286.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39286.dart.intertwined.expect
@@ -51,6 +51,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(x, expression)
+ parseBangBeforeTypeArguments(x)
listener: handleNoTypeArguments(..)
parseArgumentsOpt(x)
listener: handleNoArguments(..)
@@ -60,6 +61,7 @@
parseSend(.., expressionContinuation)
ensureIdentifier(.., expressionContinuation)
listener: handleIdentifier(f, expressionContinuation)
+ parseBangBeforeTypeArguments(f)
listener: handleNoTypeArguments(()
parseArgumentsOpt(f)
parseArguments(f)
@@ -69,10 +71,11 @@
listener: handleSend(f, !)
listener: endBinaryExpression(..)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(g, expressionContinuation)
+ parseBangBeforeTypeArguments(g)
listener: handleNoTypeArguments(()
parseArgumentsOpt(g)
parseArguments(g)
@@ -81,14 +84,15 @@
listener: endArguments(0, (, ))
listener: handleSend(g, ..)
listener: endBinaryExpression(.)
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
listener: endCascade()
parseCascadeExpression())
listener: beginCascade(..)
parseSend(.., expressionContinuation)
ensureIdentifier(.., expressionContinuation)
listener: handleIdentifier(h, expressionContinuation)
+ parseBangBeforeTypeArguments(h)
listener: handleNoTypeArguments(()
parseArgumentsOpt(h)
parseArguments(h)
@@ -97,7 +101,7 @@
listener: endArguments(0, (, ))
listener: handleSend(h, ;)
listener: endBinaryExpression(..)
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
listener: endCascade()
ensureSemicolon())
listener: handleExpressionStatement(;)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39286_2.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_39286_2.dart.expect
index a71a466..97bfef3 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39286_2.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39286_2.dart.expect
@@ -39,7 +39,7 @@
endBinaryExpression(.)
beginLiteralString('Hi!')
endLiteralString(0, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleNonNullAssertExpression(!)
endCascade()
beginCascade(..)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39286_2.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39286_2.dart.intertwined.expect
index 8f51899..e1a2a4e 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39286_2.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39286_2.dart.intertwined.expect
@@ -51,6 +51,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(x, expression)
+ parseBangBeforeTypeArguments(x)
listener: handleNoTypeArguments(..)
parseArgumentsOpt(x)
listener: handleNoArguments(..)
@@ -60,6 +61,7 @@
parseSend(.., expressionContinuation)
ensureIdentifier(.., expressionContinuation)
listener: handleIdentifier(f, expressionContinuation)
+ parseBangBeforeTypeArguments(f)
listener: handleNoTypeArguments(()
parseArgumentsOpt(f)
parseArguments(f)
@@ -69,10 +71,11 @@
listener: handleSend(f, !)
listener: endBinaryExpression(..)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(g, expressionContinuation)
+ parseBangBeforeTypeArguments(g)
listener: handleNoTypeArguments(()
parseArgumentsOpt(g)
parseArguments(g)
@@ -81,7 +84,7 @@
listener: endArguments(0, (, ))
listener: handleSend(g, [)
listener: endBinaryExpression(.)
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -90,16 +93,17 @@
parseSingleLiteralString([)
listener: beginLiteralString('Hi!')
listener: endLiteralString(0, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
listener: endCascade()
parseCascadeExpression(!)
listener: beginCascade(..)
parseSend(.., expressionContinuation)
ensureIdentifier(.., expressionContinuation)
listener: handleIdentifier(h, expressionContinuation)
+ parseBangBeforeTypeArguments(h)
listener: handleNoTypeArguments(()
parseArgumentsOpt(h)
parseArguments(h)
@@ -109,17 +113,18 @@
listener: handleSend(h, !)
listener: endBinaryExpression(..)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(y, expressionContinuation)
+ parseBangBeforeTypeArguments(y)
listener: handleNoTypeArguments(=)
parseArgumentsOpt(y)
listener: handleNoArguments(=)
listener: handleSend(y, =)
listener: endBinaryExpression(.)
- parseArgumentOrIndexStar(y, Instance of 'NoTypeParamOrArg')
- parseArgumentOrIndexStar(y, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(y, Instance of 'NoTypeParamOrArg', false)
+ parseArgumentOrIndexStar(y, Instance of 'NoTypeParamOrArg', false)
parseExpressionWithoutCascade(=)
parsePrecedenceExpression(=, 1, false)
parseUnaryExpression(=, false)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39286_2_prime.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_39286_2_prime.dart.expect
index 9af77f2..6e34b83 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39286_2_prime.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39286_2_prime.dart.expect
@@ -38,7 +38,7 @@
endBinaryExpression(.)
beginLiteralString('Hi!')
endLiteralString(0, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
endCascade()
beginCascade(..)
handleIdentifier(h, expressionContinuation)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39286_2_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39286_2_prime.dart.intertwined.expect
index 7e37571..6fd94d2 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39286_2_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39286_2_prime.dart.intertwined.expect
@@ -51,6 +51,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(x, expression)
+ parseBangBeforeTypeArguments(x)
listener: handleNoTypeArguments(..)
parseArgumentsOpt(x)
listener: handleNoArguments(..)
@@ -60,6 +61,7 @@
parseSend(.., expressionContinuation)
ensureIdentifier(.., expressionContinuation)
listener: handleIdentifier(f, expressionContinuation)
+ parseBangBeforeTypeArguments(f)
listener: handleNoTypeArguments(()
parseArgumentsOpt(f)
parseArguments(f)
@@ -71,6 +73,7 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(g, expressionContinuation)
+ parseBangBeforeTypeArguments(g)
listener: handleNoTypeArguments(()
parseArgumentsOpt(g)
parseArguments(g)
@@ -79,7 +82,7 @@
listener: endArguments(0, (, ))
listener: handleSend(g, [)
listener: endBinaryExpression(.)
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -88,14 +91,15 @@
parseSingleLiteralString([)
listener: beginLiteralString('Hi!')
listener: endLiteralString(0, ])
- listener: handleIndexedExpression([, ])
- parseArgumentOrIndexStar(], Instance of 'NoTypeParamOrArg')
+ listener: handleIndexedExpression(null, [, ])
+ parseArgumentOrIndexStar(], Instance of 'NoTypeParamOrArg', false)
listener: endCascade()
parseCascadeExpression(])
listener: beginCascade(..)
parseSend(.., expressionContinuation)
ensureIdentifier(.., expressionContinuation)
listener: handleIdentifier(h, expressionContinuation)
+ parseBangBeforeTypeArguments(h)
listener: handleNoTypeArguments(()
parseArgumentsOpt(h)
parseArguments(h)
@@ -107,13 +111,14 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(y, expressionContinuation)
+ parseBangBeforeTypeArguments(y)
listener: handleNoTypeArguments(=)
parseArgumentsOpt(y)
listener: handleNoArguments(=)
listener: handleSend(y, =)
listener: endBinaryExpression(.)
- parseArgumentOrIndexStar(y, Instance of 'NoTypeParamOrArg')
- parseArgumentOrIndexStar(y, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(y, Instance of 'NoTypeParamOrArg', false)
+ parseArgumentOrIndexStar(y, Instance of 'NoTypeParamOrArg', false)
parseExpressionWithoutCascade(=)
parsePrecedenceExpression(=, 1, false)
parseUnaryExpression(=, false)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39286_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39286_prime.dart.intertwined.expect
index 478a8f6..1418a34 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39286_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39286_prime.dart.intertwined.expect
@@ -51,6 +51,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(x, expression)
+ parseBangBeforeTypeArguments(x)
listener: handleNoTypeArguments(..)
parseArgumentsOpt(x)
listener: handleNoArguments(..)
@@ -60,6 +61,7 @@
parseSend(.., expressionContinuation)
ensureIdentifier(.., expressionContinuation)
listener: handleIdentifier(f, expressionContinuation)
+ parseBangBeforeTypeArguments(f)
listener: handleNoTypeArguments(()
parseArgumentsOpt(f)
parseArguments(f)
@@ -71,6 +73,7 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(g, expressionContinuation)
+ parseBangBeforeTypeArguments(g)
listener: handleNoTypeArguments(()
parseArgumentsOpt(g)
parseArguments(g)
@@ -79,14 +82,15 @@
listener: endArguments(0, (, ))
listener: handleSend(g, ..)
listener: endBinaryExpression(.)
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
listener: endCascade()
parseCascadeExpression())
listener: beginCascade(..)
parseSend(.., expressionContinuation)
ensureIdentifier(.., expressionContinuation)
listener: handleIdentifier(h, expressionContinuation)
+ parseBangBeforeTypeArguments(h)
listener: handleNoTypeArguments(()
parseArgumentsOpt(h)
parseArguments(h)
@@ -95,7 +99,7 @@
listener: endArguments(0, (, ))
listener: handleSend(h, ;)
listener: endBinaryExpression(..)
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
listener: endCascade()
ensureSemicolon())
listener: handleExpressionStatement(;)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39326.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_39326.dart.expect
index 6a23a5b..235826c 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39326.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39326.dart.expect
@@ -24,7 +24,7 @@
handleNoArguments(?.[)
handleSend(c, ?.[)
handleLiteralInt(1)
- handleIndexedExpression(?.[, ])
+ handleIndexedExpression(null, ?.[, ])
handleLiteralInt(42)
handleAssignmentExpression(=)
handleExpressionStatement(;)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39326.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39326.dart.intertwined.expect
index 337ef55..f13816b 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39326.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39326.dart.intertwined.expect
@@ -58,18 +58,19 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
listener: handleNoTypeArguments(?.[)
parseArgumentsOpt(c)
listener: handleNoArguments(?.[)
listener: handleSend(c, ?.[)
- parseArgumentOrIndexStar(c, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(c, Instance of 'NoTypeParamOrArg', false)
parseExpression(?.[)
parsePrecedenceExpression(?.[, 1, true)
parseUnaryExpression(?.[, true)
parsePrimary(?.[, expression)
parseLiteralInt(?.[)
listener: handleLiteralInt(1)
- listener: handleIndexedExpression(?.[, ])
+ listener: handleIndexedExpression(null, ?.[, ])
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39697.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_39697.dart.expect
index 302e329..f5e1258 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39697.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39697.dart.expect
@@ -23,7 +23,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(logKey, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleIdentifier(Logger, typeReference)
handleNoTypeArguments(?)
handleType(Logger, ?)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39697.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39697.dart.intertwined.expect
index 5cc8fb6..25167ca 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39697.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39697.dart.intertwined.expect
@@ -32,6 +32,7 @@
parseSend(=>, expression)
ensureIdentifier(=>, expression)
listener: handleIdentifier(Zone, expression)
+ parseBangBeforeTypeArguments(Zone)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(Zone)
listener: handleNoArguments(.)
@@ -41,12 +42,13 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(current, expressionContinuation)
+ parseBangBeforeTypeArguments(current)
listener: handleNoTypeArguments([)
parseArgumentsOpt(current)
listener: handleNoArguments([)
listener: handleSend(current, [)
listener: endBinaryExpression(.)
- parseArgumentOrIndexStar(current, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(current, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -55,11 +57,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(logKey, expression)
+ parseBangBeforeTypeArguments(logKey)
listener: handleNoTypeArguments(])
parseArgumentsOpt(logKey)
listener: handleNoArguments(])
listener: handleSend(logKey, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
parseAsOperatorRest(])
computeTypeAfterIsOrAs(as)
listener: handleIdentifier(Logger, typeReference)
@@ -75,6 +78,7 @@
parseSend(??, expression)
ensureIdentifier(??, expression)
listener: handleIdentifier(_default, expression)
+ parseBangBeforeTypeArguments(_default)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(_default)
listener: handleNoArguments(;)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39697_prime.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_39697_prime.dart.expect
index d0b4c13..61aca28 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39697_prime.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39697_prime.dart.expect
@@ -23,7 +23,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(logKey, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleIdentifier(Logger, typeReference)
handleNoTypeArguments(?)
handleType(Logger, ?)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39697_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39697_prime.dart.intertwined.expect
index 99db19d..e15e414 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39697_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39697_prime.dart.intertwined.expect
@@ -40,6 +40,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(Zone, expression)
+ parseBangBeforeTypeArguments(Zone)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(Zone)
listener: handleNoArguments(.)
@@ -49,12 +50,13 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(current, expressionContinuation)
+ parseBangBeforeTypeArguments(current)
listener: handleNoTypeArguments([)
parseArgumentsOpt(current)
listener: handleNoArguments([)
listener: handleSend(current, [)
listener: endBinaryExpression(.)
- parseArgumentOrIndexStar(current, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(current, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -63,11 +65,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(logKey, expression)
+ parseBangBeforeTypeArguments(logKey)
listener: handleNoTypeArguments(])
parseArgumentsOpt(logKey)
listener: handleNoArguments(])
listener: handleSend(logKey, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
parseAsOperatorRest(])
computeTypeAfterIsOrAs(as)
listener: handleIdentifier(Logger, typeReference)
@@ -85,6 +88,7 @@
parseSend(??, expression)
ensureIdentifier(??, expression)
listener: handleIdentifier(_default, expression)
+ parseBangBeforeTypeArguments(_default)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(_default)
listener: handleNoArguments(;)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.expect
index 370a459..1b49856 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.expect
@@ -83,7 +83,7 @@
handleSend(a, !)
handleNonNullAssertExpression(!)
handleLiteralInt(42)
- handleIndexedExpression(?.[, ])
+ handleIndexedExpression(null, ?.[, ])
handleExpressionStatement(;)
endBlockFunctionBody(3, {, })
endTopLevelMethod(main, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.intertwined.expect
index 5509e51..fb20267 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.intertwined.expect
@@ -72,6 +72,7 @@
parseSend(=>, expression)
ensureIdentifier(=>, expression)
listener: handleIdentifier(index, expression)
+ parseBangBeforeTypeArguments(index)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(index)
listener: handleNoArguments(;)
@@ -155,6 +156,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(a)
listener: handleNoArguments(!)
@@ -166,6 +168,7 @@
parseSend(?., expressionContinuation)
ensureIdentifier(?., expressionContinuation)
listener: handleIdentifier(toString, expressionContinuation)
+ parseBangBeforeTypeArguments(toString)
listener: handleNoTypeArguments(()
parseArgumentsOpt(toString)
parseArguments(toString)
@@ -190,19 +193,20 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(a)
listener: handleNoArguments(!)
listener: handleSend(a, !)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression(?.[)
parsePrecedenceExpression(?.[, 1, true)
parseUnaryExpression(?.[, true)
parsePrimary(?.[, expression)
parseLiteralInt(?.[)
listener: handleLiteralInt(42)
- listener: handleIndexedExpression(?.[, ])
+ listener: handleIndexedExpression(null, ?.[, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.expect
index 110c278..c8e0647 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.expect
@@ -85,7 +85,7 @@
handleNonNullAssertExpression(!)
handleParenthesizedExpression(()
handleLiteralInt(42)
- handleIndexedExpression(?.[, ])
+ handleIndexedExpression(null, ?.[, ])
handleExpressionStatement(;)
endBlockFunctionBody(3, {, })
endTopLevelMethod(main, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.intertwined.expect
index a4e96c0..7603c18 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.intertwined.expect
@@ -72,6 +72,7 @@
parseSend(=>, expression)
ensureIdentifier(=>, expression)
listener: handleIdentifier(index, expression)
+ parseBangBeforeTypeArguments(index)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(index)
listener: handleNoArguments(;)
@@ -164,6 +165,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(a)
listener: handleNoArguments(!)
@@ -177,6 +179,7 @@
parseSend(?., expressionContinuation)
ensureIdentifier(?., expressionContinuation)
listener: handleIdentifier(toString, expressionContinuation)
+ parseBangBeforeTypeArguments(toString)
listener: handleNoTypeArguments(()
parseArgumentsOpt(toString)
parseArguments(toString)
@@ -210,6 +213,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(a)
listener: handleNoArguments(!)
@@ -217,14 +221,14 @@
listener: handleNonNullAssertExpression(!)
ensureCloseParen(!, ()
listener: handleParenthesizedExpression(()
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression(?.[)
parsePrecedenceExpression(?.[, 1, true)
parseUnaryExpression(?.[, true)
parsePrimary(?.[, expression)
parseLiteralInt(?.[)
listener: handleLiteralInt(42)
- listener: handleIndexedExpression(?.[, ])
+ listener: handleIndexedExpression(null, ?.[, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39776.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39776.dart.intertwined.expect
index 3f3083a..f06b044 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39776.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39776.dart.intertwined.expect
@@ -144,6 +144,7 @@
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
ensureIdentifier(=, expression)
+ parseBangBeforeTypeArguments(foo)
parseArgumentsOpt(foo)
listener: beginMetadataStar(Function)
listener: endMetadataStar(0)
@@ -166,6 +167,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(foo)
listener: handleNoArguments(;)
@@ -188,12 +190,13 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(f1, expression)
+ parseBangBeforeTypeArguments(f1)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(f1)
listener: handleNoArguments(!)
listener: handleSend(f1, !)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
listener: handleNoTypeArguments(()
parseArguments(!)
parseArgumentsRest(()
@@ -235,6 +238,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(bar, expression)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(bar)
listener: handleNoArguments(;)
@@ -257,7 +261,8 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(f2, expression)
- listener: handleNonNullAssertExpression(!)
+ parseBangBeforeTypeArguments(f2)
+ listener: handleNonNullAssertExpression(!)
listener: beginTypeArguments(<)
listener: handleIdentifier(int, typeReference)
listener: handleNoTypeArguments(>)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39776_prime1.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39776_prime1.dart.intertwined.expect
index 2fb237b..c6f5b61 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39776_prime1.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39776_prime1.dart.intertwined.expect
@@ -144,6 +144,7 @@
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
ensureIdentifier(=, expression)
+ parseBangBeforeTypeArguments(foo)
parseArgumentsOpt(foo)
listener: beginMetadataStar(Function)
listener: endMetadataStar(0)
@@ -166,6 +167,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(foo)
listener: handleNoArguments(;)
@@ -188,12 +190,13 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(f1, expression)
+ parseBangBeforeTypeArguments(f1)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(f1)
listener: handleNoArguments(!)
listener: handleSend(f1, !)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
listener: handleNoTypeArguments(()
parseArguments(!)
parseArgumentsRest(()
@@ -235,6 +238,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(bar, expression)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(bar)
listener: handleNoArguments(;)
@@ -258,6 +262,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(f2, expression)
+ parseBangBeforeTypeArguments(f2)
listener: beginTypeArguments(<)
listener: handleIdentifier(int, typeReference)
listener: handleNoTypeArguments(>)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39776_prime2.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39776_prime2.dart.intertwined.expect
index 1b497087..129da5d 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39776_prime2.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39776_prime2.dart.intertwined.expect
@@ -144,6 +144,7 @@
parseSendOrFunctionLiteral(=, expression)
parseSend(=, expression)
ensureIdentifier(=, expression)
+ parseBangBeforeTypeArguments(foo)
parseArgumentsOpt(foo)
listener: beginMetadataStar(Function)
listener: endMetadataStar(0)
@@ -166,6 +167,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(foo)
listener: handleNoArguments(;)
@@ -188,12 +190,13 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(f1, expression)
+ parseBangBeforeTypeArguments(f1)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(f1)
listener: handleNoArguments(!)
listener: handleSend(f1, !)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
listener: handleNoTypeArguments(()
parseArguments(!)
parseArgumentsRest(()
@@ -235,6 +238,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(bar, expression)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(bar)
listener: handleNoArguments(;)
@@ -266,6 +270,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(f2, expression)
+ parseBangBeforeTypeArguments(f2)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(f2)
listener: handleNoArguments(!)
@@ -278,7 +283,7 @@
listener: handleNoTypeArguments(>)
listener: handleType(int, null)
listener: endTypeArguments(1, <, >)
- parseArgumentOrIndexStar(>, Instance of 'SimpleTypeArgument1')
+ parseArgumentOrIndexStar(>, Instance of 'SimpleTypeArgument1', false)
parseArguments(>)
parseArgumentsRest(()
listener: beginArguments(()
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39776_prime3.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39776_prime3.dart.intertwined.expect
index a565c35..f824c59 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39776_prime3.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39776_prime3.dart.intertwined.expect
@@ -130,6 +130,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(bar, expression)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(bar)
listener: handleNoArguments(;)
@@ -152,7 +153,8 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(f2, expression)
- listener: handleNonNullAssertExpression(!)
+ parseBangBeforeTypeArguments(f2)
+ listener: handleNonNullAssertExpression(!)
listener: beginTypeArguments(<)
listener: handleIdentifier(int, typeReference)
listener: handleNoTypeArguments(,)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39776_prime4.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39776_prime4.dart.intertwined.expect
index 4e8a043..01a5d25 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39776_prime4.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39776_prime4.dart.intertwined.expect
@@ -130,6 +130,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(bar, expression)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(bar)
listener: handleNoArguments(;)
@@ -153,6 +154,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(f2, expression)
+ parseBangBeforeTypeArguments(f2)
listener: beginTypeArguments(<)
listener: handleIdentifier(int, typeReference)
listener: handleNoTypeArguments(,)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart
new file mode 100644
index 0000000..8658825
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart
@@ -0,0 +1,6 @@
+main() {
+ switch(a) {
+ // Parse as conditional expression.
+ case b ? [c] : d: e;
+ }
+}
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.expect
new file mode 100644
index 0000000..2237904
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.expect
@@ -0,0 +1,52 @@
+beginCompilationUnit(main)
+ beginMetadataStar(main)
+ endMetadataStar(0)
+ beginTopLevelMember(main)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(main, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginSwitchStatement(switch)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(a, ))
+ handleParenthesizedCondition(()
+ beginSwitchBlock({)
+ beginCaseExpression(case)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(b, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(c, ])
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ handleIdentifier(d, expression)
+ handleNoTypeArguments(:)
+ handleNoArguments(:)
+ handleSend(d, :)
+ endConditionalExpression(?, :)
+ endCaseExpression(:)
+ handleCaseMatch(case, :)
+ beginSwitchCase(0, 1, case)
+ handleIdentifier(e, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(e, ;)
+ handleExpressionStatement(;)
+ endSwitchCase(0, 1, null, null, 1, case, })
+ endSwitchBlock(1, {, })
+ endSwitchStatement(switch, })
+ endBlockFunctionBody(1, {, })
+ endTopLevelMethod(main, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.intertwined.expect
new file mode 100644
index 0000000..7179984
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.intertwined.expect
@@ -0,0 +1,168 @@
+parseUnit(main)
+ skipErrorTokens(main)
+ listener: beginCompilationUnit(main)
+ syntheticPreviousToken(main)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(main)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(main)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, main)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(main, topLevelFunctionDeclaration)
+ parseMethodTypeVar(main)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(main, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, switch)
+ parseStatement({)
+ parseStatementX({)
+ parseSwitchStatement({)
+ listener: beginSwitchStatement(switch)
+ ensureParenthesizedCondition(switch)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt(a)
+ listener: handleNoArguments())
+ listener: handleSend(a, ))
+ ensureCloseParen(a, ()
+ listener: handleParenthesizedCondition(()
+ parseSwitchBlock())
+ ensureBlock(), null, switch statement)
+ listener: beginSwitchBlock({)
+ notEofOrValue(}, case)
+ peekPastLabels(case)
+ listener: beginCaseExpression(case)
+ parseExpression(case)
+ parsePrecedenceExpression(case, 1, true)
+ parseUnaryExpression(case, true)
+ parsePrimary(case, expression)
+ parseSendOrFunctionLiteral(case, expression)
+ parseSend(case, expression)
+ ensureIdentifier(case, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(?)
+ listener: handleSend(b, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(b, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ parseBangBeforeTypeArguments(d)
+ parseArgumentsOpt(d)
+ parseConditionalExpressionRest(b)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(])
+ listener: handleSend(c, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(d, expression)
+ parseBangBeforeTypeArguments(d)
+ listener: handleNoTypeArguments(:)
+ parseArgumentsOpt(d)
+ listener: handleNoArguments(:)
+ listener: handleSend(d, :)
+ listener: endConditionalExpression(?, :)
+ ensureColon(d)
+ listener: endCaseExpression(:)
+ listener: handleCaseMatch(case, :)
+ peekPastLabels(e)
+ parseStatementsInSwitchCase(:, e, case, 0, 1, null, null)
+ listener: beginSwitchCase(0, 1, case)
+ parseStatement(:)
+ parseStatementX(:)
+ parseExpressionStatementOrDeclarationAfterModifiers(:, :, null, null, null, false)
+ looksLikeLocalFunction(e)
+ parseExpressionStatement(:)
+ parseExpression(:)
+ parsePrecedenceExpression(:, 1, true)
+ parseUnaryExpression(:, true)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(e, expression)
+ parseBangBeforeTypeArguments(e)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(e)
+ listener: handleNoArguments(;)
+ listener: handleSend(e, ;)
+ ensureSemicolon(e)
+ listener: handleExpressionStatement(;)
+ peekPastLabels(})
+ listener: endSwitchCase(0, 1, null, null, 1, case, })
+ notEofOrValue(}, })
+ listener: endSwitchBlock(1, {, })
+ listener: endSwitchStatement(switch, })
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endTopLevelMethod(main, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(main)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.parser.expect
new file mode 100644
index 0000000..8fa4fa9
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.parser.expect
@@ -0,0 +1,15 @@
+main() {
+switch(a) {
+
+case b ? [c] : d: e;
+}
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+switch[KeywordToken]([BeginToken]a[StringToken])[SimpleToken] {[BeginToken]
+
+case[KeywordToken] b[StringToken] ?[SimpleToken] [[BeginToken]c[StringToken]][SimpleToken] :[SimpleToken] d[StringToken]:[SimpleToken] e[StringToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.scanner.expect
new file mode 100644
index 0000000..8fa4fa9
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_01.dart.scanner.expect
@@ -0,0 +1,15 @@
+main() {
+switch(a) {
+
+case b ? [c] : d: e;
+}
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+switch[KeywordToken]([BeginToken]a[StringToken])[SimpleToken] {[BeginToken]
+
+case[KeywordToken] b[StringToken] ?[SimpleToken] [[BeginToken]c[StringToken]][SimpleToken] :[SimpleToken] d[StringToken]:[SimpleToken] e[StringToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart
new file mode 100644
index 0000000..064552e
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart
@@ -0,0 +1,6 @@
+main() {
+ switch(a) {
+ // Parse as null aware index.
+ case b?[c] : {{break;}}
+ }
+}
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.expect
new file mode 100644
index 0000000..2661638
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.expect
@@ -0,0 +1,44 @@
+beginCompilationUnit(main)
+ beginMetadataStar(main)
+ endMetadataStar(0)
+ beginTopLevelMember(main)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(main, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginSwitchStatement(switch)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(a, ))
+ handleParenthesizedCondition(()
+ beginSwitchBlock({)
+ beginCaseExpression(case)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(b, ?)
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(c, ])
+ handleIndexedExpression(?, [, ])
+ endCaseExpression(:)
+ handleCaseMatch(case, :)
+ beginSwitchCase(0, 1, case)
+ beginBlock({, BlockKind(statement))
+ beginBlock({, BlockKind(statement))
+ handleBreakStatement(false, break, ;)
+ endBlock(1, {, }, BlockKind(statement))
+ endBlock(1, {, }, BlockKind(statement))
+ endSwitchCase(0, 1, null, null, 1, case, })
+ endSwitchBlock(1, {, })
+ endSwitchStatement(switch, })
+ endBlockFunctionBody(1, {, })
+ endTopLevelMethod(main, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.intertwined.expect
new file mode 100644
index 0000000..01f0cfd
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.intertwined.expect
@@ -0,0 +1,160 @@
+parseUnit(main)
+ skipErrorTokens(main)
+ listener: beginCompilationUnit(main)
+ syntheticPreviousToken(main)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(main)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(main)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, main)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(main, topLevelFunctionDeclaration)
+ parseMethodTypeVar(main)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(main, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, switch)
+ parseStatement({)
+ parseStatementX({)
+ parseSwitchStatement({)
+ listener: beginSwitchStatement(switch)
+ ensureParenthesizedCondition(switch)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt(a)
+ listener: handleNoArguments())
+ listener: handleSend(a, ))
+ ensureCloseParen(a, ()
+ listener: handleParenthesizedCondition(()
+ parseSwitchBlock())
+ ensureBlock(), null, switch statement)
+ listener: beginSwitchBlock({)
+ notEofOrValue(}, case)
+ peekPastLabels(case)
+ listener: beginCaseExpression(case)
+ parseExpression(case)
+ parsePrecedenceExpression(case, 1, true)
+ parseUnaryExpression(case, true)
+ parsePrimary(case, expression)
+ parseSendOrFunctionLiteral(case, expression)
+ parseSend(case, expression)
+ ensureIdentifier(case, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(?)
+ listener: handleSend(b, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(b, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralSetOrMapSuffix(:, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseLiteralSetOrMapSuffix({, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ inPlainSync()
+ parseSend({, expression)
+ ensureIdentifier({, expression)
+ reportRecoverableErrorWithToken(break, Instance of 'Template<(Token) => Message>')
+ rewriter()
+ parseBangBeforeTypeArguments()
+ parseArgumentsOpt()
+ reportRecoverableError(break, Message[ExpectedButGot, Expected '}' before this., null, {string: }}])
+ parseArgumentOrIndexStar(b, Instance of 'NoTypeParamOrArg', true)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(])
+ listener: handleSend(c, ])
+ listener: handleIndexedExpression(?, [, ])
+ ensureColon(])
+ listener: endCaseExpression(:)
+ listener: handleCaseMatch(case, :)
+ peekPastLabels({)
+ parseStatementsInSwitchCase(:, {, case, 0, 1, null, null)
+ listener: beginSwitchCase(0, 1, case)
+ parseStatement(:)
+ parseStatementX(:)
+ parseBlock(:, BlockKind(statement))
+ ensureBlock(:, null, null)
+ listener: beginBlock({, BlockKind(statement))
+ notEofOrValue(}, {)
+ parseStatement({)
+ parseStatementX({)
+ parseBlock({, BlockKind(statement))
+ ensureBlock({, null, null)
+ listener: beginBlock({, BlockKind(statement))
+ notEofOrValue(}, break)
+ parseStatement({)
+ parseStatementX({)
+ parseBreakStatement({)
+ isBreakAllowed()
+ ensureSemicolon(break)
+ listener: handleBreakStatement(false, break, ;)
+ notEofOrValue(}, })
+ listener: endBlock(1, {, }, BlockKind(statement))
+ notEofOrValue(}, })
+ listener: endBlock(1, {, }, BlockKind(statement))
+ peekPastLabels(})
+ listener: endSwitchCase(0, 1, null, null, 1, case, })
+ notEofOrValue(}, })
+ listener: endSwitchBlock(1, {, })
+ listener: endSwitchStatement(switch, })
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endTopLevelMethod(main, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(main)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.parser.expect
new file mode 100644
index 0000000..476f425
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.parser.expect
@@ -0,0 +1,15 @@
+main() {
+switch(a) {
+
+case b?[c] : {{break;}}
+}
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+switch[KeywordToken]([BeginToken]a[StringToken])[SimpleToken] {[BeginToken]
+
+case[KeywordToken] b[StringToken]?[SimpleToken][[BeginToken]c[StringToken]][SimpleToken] :[SimpleToken] {[BeginToken]{[BeginToken]break[KeywordToken];[SimpleToken]}[SimpleToken]}[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.scanner.expect
new file mode 100644
index 0000000..476f425
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_02.dart.scanner.expect
@@ -0,0 +1,15 @@
+main() {
+switch(a) {
+
+case b?[c] : {{break;}}
+}
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+switch[KeywordToken]([BeginToken]a[StringToken])[SimpleToken] {[BeginToken]
+
+case[KeywordToken] b[StringToken]?[SimpleToken][[BeginToken]c[StringToken]][SimpleToken] :[SimpleToken] {[BeginToken]{[BeginToken]break[KeywordToken];[SimpleToken]}[SimpleToken]}[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart
new file mode 100644
index 0000000..4bbdfc0
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart
@@ -0,0 +1,6 @@
+main() {
+ switch(a) {
+ // Parse as conditional.
+ case x?[4]:baz:break; // as case (x?[4]:baz): break;
+ }
+}
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.expect
new file mode 100644
index 0000000..8fdf15f
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.expect
@@ -0,0 +1,45 @@
+beginCompilationUnit(main)
+ beginMetadataStar(main)
+ endMetadataStar(0)
+ beginTopLevelMember(main)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(main, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginSwitchStatement(switch)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(a, ))
+ handleParenthesizedCondition(()
+ beginSwitchBlock({)
+ beginCaseExpression(case)
+ handleIdentifier(x, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(x, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleLiteralInt(4)
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ handleIdentifier(baz, expression)
+ handleNoTypeArguments(:)
+ handleNoArguments(:)
+ handleSend(baz, :)
+ endConditionalExpression(?, :)
+ endCaseExpression(:)
+ handleCaseMatch(case, :)
+ beginSwitchCase(0, 1, case)
+ handleBreakStatement(false, break, ;)
+ endSwitchCase(0, 1, null, null, 1, case, })
+ endSwitchBlock(1, {, })
+ endSwitchStatement(switch, })
+ endBlockFunctionBody(1, {, })
+ endTopLevelMethod(main, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.intertwined.expect
new file mode 100644
index 0000000..36fa967
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.intertwined.expect
@@ -0,0 +1,143 @@
+parseUnit(main)
+ skipErrorTokens(main)
+ listener: beginCompilationUnit(main)
+ syntheticPreviousToken(main)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(main)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(main)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, main)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(main, topLevelFunctionDeclaration)
+ parseMethodTypeVar(main)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(main, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, switch)
+ parseStatement({)
+ parseStatementX({)
+ parseSwitchStatement({)
+ listener: beginSwitchStatement(switch)
+ ensureParenthesizedCondition(switch)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt(a)
+ listener: handleNoArguments())
+ listener: handleSend(a, ))
+ ensureCloseParen(a, ()
+ listener: handleParenthesizedCondition(()
+ parseSwitchBlock())
+ ensureBlock(), null, switch statement)
+ listener: beginSwitchBlock({)
+ notEofOrValue(}, case)
+ peekPastLabels(case)
+ listener: beginCaseExpression(case)
+ parseExpression(case)
+ parsePrecedenceExpression(case, 1, true)
+ parseUnaryExpression(case, true)
+ parsePrimary(case, expression)
+ parseSendOrFunctionLiteral(case, expression)
+ parseSend(case, expression)
+ ensureIdentifier(case, expression)
+ listener: handleIdentifier(x, expression)
+ parseBangBeforeTypeArguments(x)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(x)
+ listener: handleNoArguments(?)
+ listener: handleSend(x, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(x, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ parseBangBeforeTypeArguments(baz)
+ parseArgumentsOpt(baz)
+ parseConditionalExpressionRest(x)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ listener: handleLiteralInt(4)
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(baz, expression)
+ parseBangBeforeTypeArguments(baz)
+ listener: handleNoTypeArguments(:)
+ parseArgumentsOpt(baz)
+ listener: handleNoArguments(:)
+ listener: handleSend(baz, :)
+ listener: endConditionalExpression(?, :)
+ ensureColon(baz)
+ listener: endCaseExpression(:)
+ listener: handleCaseMatch(case, :)
+ peekPastLabels(break)
+ parseStatementsInSwitchCase(:, break, case, 0, 1, null, null)
+ listener: beginSwitchCase(0, 1, case)
+ parseStatement(:)
+ parseStatementX(:)
+ parseBreakStatement(:)
+ isBreakAllowed()
+ ensureSemicolon(break)
+ listener: handleBreakStatement(false, break, ;)
+ peekPastLabels(})
+ listener: endSwitchCase(0, 1, null, null, 1, case, })
+ notEofOrValue(}, })
+ listener: endSwitchBlock(1, {, })
+ listener: endSwitchStatement(switch, })
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endTopLevelMethod(main, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(main)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.parser.expect
new file mode 100644
index 0000000..d6b9978
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.parser.expect
@@ -0,0 +1,15 @@
+main() {
+switch(a) {
+
+case x?[4]:baz:break;
+}
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+switch[KeywordToken]([BeginToken]a[StringToken])[SimpleToken] {[BeginToken]
+
+case[KeywordToken] x[StringToken]?[SimpleToken][[BeginToken]4[StringToken]][SimpleToken]:[SimpleToken]baz[StringToken]:[SimpleToken]break[KeywordToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.scanner.expect
new file mode 100644
index 0000000..d6b9978
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_03.dart.scanner.expect
@@ -0,0 +1,15 @@
+main() {
+switch(a) {
+
+case x?[4]:baz:break;
+}
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+switch[KeywordToken]([BeginToken]a[StringToken])[SimpleToken] {[BeginToken]
+
+case[KeywordToken] x[StringToken]?[SimpleToken][[BeginToken]4[StringToken]][SimpleToken]:[SimpleToken]baz[StringToken]:[SimpleToken]break[KeywordToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart
new file mode 100644
index 0000000..beb586c
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart
@@ -0,0 +1,6 @@
+main() {
+ switch(a) {
+ // Parse as conditional (with missing colon for the case).
+ case x?[4]:{{{2}}}; // as case (x?[4]:{{{2}}}) [missing :]
+ }
+}
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.expect
new file mode 100644
index 0000000..005915d
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.expect
@@ -0,0 +1,55 @@
+Problems reported:
+
+parser/nnbd/issue_40267_case_04:4:23: Expected ':' before this.
+ case x?[4]:{{{2}}}; // as case (x?[4]:{{{2}}}) [missing :]
+ ^
+
+beginCompilationUnit(main)
+ beginMetadataStar(main)
+ endMetadataStar(0)
+ beginTopLevelMember(main)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(main, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginSwitchStatement(switch)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(a, ))
+ handleParenthesizedCondition(()
+ beginSwitchBlock({)
+ beginCaseExpression(case)
+ handleIdentifier(x, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(x, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleLiteralInt(4)
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ handleNoTypeArguments({)
+ handleNoTypeArguments({)
+ handleNoTypeArguments({)
+ handleLiteralInt(2)
+ handleLiteralSetOrMap(1, {, null, }, true)
+ handleLiteralSetOrMap(1, {, null, }, true)
+ handleLiteralSetOrMap(1, {, null, }, true)
+ endConditionalExpression(?, :)
+ handleRecoverableError(Message[ExpectedButGot, Expected ':' before this., null, {string: :}], ;, ;)
+ endCaseExpression(:)
+ handleCaseMatch(case, :)
+ beginSwitchCase(0, 1, case)
+ handleEmptyStatement(;)
+ endSwitchCase(0, 1, null, null, 1, case, })
+ endSwitchBlock(1, {, })
+ endSwitchStatement(switch, })
+ endBlockFunctionBody(1, {, })
+ endTopLevelMethod(main, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.intertwined.expect
new file mode 100644
index 0000000..57d200c
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.intertwined.expect
@@ -0,0 +1,170 @@
+parseUnit(main)
+ skipErrorTokens(main)
+ listener: beginCompilationUnit(main)
+ syntheticPreviousToken(main)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(main)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(main)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, main)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(main, topLevelFunctionDeclaration)
+ parseMethodTypeVar(main)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(main, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, switch)
+ parseStatement({)
+ parseStatementX({)
+ parseSwitchStatement({)
+ listener: beginSwitchStatement(switch)
+ ensureParenthesizedCondition(switch)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt(a)
+ listener: handleNoArguments())
+ listener: handleSend(a, ))
+ ensureCloseParen(a, ()
+ listener: handleParenthesizedCondition(()
+ parseSwitchBlock())
+ ensureBlock(), null, switch statement)
+ listener: beginSwitchBlock({)
+ notEofOrValue(}, case)
+ peekPastLabels(case)
+ listener: beginCaseExpression(case)
+ parseExpression(case)
+ parsePrecedenceExpression(case, 1, true)
+ parseUnaryExpression(case, true)
+ parsePrimary(case, expression)
+ parseSendOrFunctionLiteral(case, expression)
+ parseSend(case, expression)
+ ensureIdentifier(case, expression)
+ listener: handleIdentifier(x, expression)
+ parseBangBeforeTypeArguments(x)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(x)
+ listener: handleNoArguments(?)
+ listener: handleSend(x, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(x, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralSetOrMapSuffix(:, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseLiteralSetOrMapSuffix({, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseLiteralSetOrMapSuffix({, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseLiteralInt({)
+ parseConditionalExpressionRest(x)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ listener: handleLiteralInt(4)
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ listener: handleNoTypeArguments({)
+ parseLiteralSetOrMapSuffix(:, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ listener: handleNoTypeArguments({)
+ parseLiteralSetOrMapSuffix({, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ listener: handleNoTypeArguments({)
+ parseLiteralSetOrMapSuffix({, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseLiteralInt({)
+ listener: handleLiteralInt(2)
+ listener: handleLiteralSetOrMap(1, {, null, }, true)
+ listener: handleLiteralSetOrMap(1, {, null, }, true)
+ listener: handleLiteralSetOrMap(1, {, null, }, true)
+ listener: endConditionalExpression(?, :)
+ ensureColon(})
+ rewriteAndRecover(}, Message[ExpectedButGot, Expected ':' before this., null, {string: :}], :)
+ reportRecoverableError(;, Message[ExpectedButGot, Expected ':' before this., null, {string: :}])
+ listener: handleRecoverableError(Message[ExpectedButGot, Expected ':' before this., null, {string: :}], ;, ;)
+ rewriter()
+ listener: endCaseExpression(:)
+ listener: handleCaseMatch(case, :)
+ peekPastLabels(;)
+ parseStatementsInSwitchCase(:, ;, case, 0, 1, null, null)
+ listener: beginSwitchCase(0, 1, case)
+ parseStatement(:)
+ parseStatementX(:)
+ parseEmptyStatement(:)
+ listener: handleEmptyStatement(;)
+ peekPastLabels(})
+ listener: endSwitchCase(0, 1, null, null, 1, case, })
+ notEofOrValue(}, })
+ listener: endSwitchBlock(1, {, })
+ listener: endSwitchStatement(switch, })
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endTopLevelMethod(main, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(main)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.parser.expect
new file mode 100644
index 0000000..b515f0d
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.parser.expect
@@ -0,0 +1,17 @@
+NOTICE: Stream was rewritten by parser!
+
+main() {
+switch(a) {
+
+case x?[4]:{{{2}}}:;
+}
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+switch[KeywordToken]([BeginToken]a[StringToken])[SimpleToken] {[BeginToken]
+
+case[KeywordToken] x[StringToken]?[SimpleToken][[BeginToken]4[StringToken]][SimpleToken]:[SimpleToken]{[BeginToken]{[BeginToken]{[BeginToken]2[StringToken]}[SimpleToken]}[SimpleToken]}[SimpleToken]:[SyntheticToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.scanner.expect
new file mode 100644
index 0000000..621a525
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_04.dart.scanner.expect
@@ -0,0 +1,15 @@
+main() {
+switch(a) {
+
+case x?[4]:{{{2}}};
+}
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+switch[KeywordToken]([BeginToken]a[StringToken])[SimpleToken] {[BeginToken]
+
+case[KeywordToken] x[StringToken]?[SimpleToken][[BeginToken]4[StringToken]][SimpleToken]:[SimpleToken]{[BeginToken]{[BeginToken]{[BeginToken]2[StringToken]}[SimpleToken]}[SimpleToken]}[SimpleToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart
new file mode 100644
index 0000000..783900d
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart
@@ -0,0 +1,6 @@
+main() {
+ switch(a) {
+ // Parse as null aware index.
+ case x?[4]:{{{2;}}}; // as case (x?[4]):{{{2;}}}
+ }
+}
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.expect
new file mode 100644
index 0000000..f9990c4
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.expect
@@ -0,0 +1,45 @@
+beginCompilationUnit(main)
+ beginMetadataStar(main)
+ endMetadataStar(0)
+ beginTopLevelMember(main)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(main, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginSwitchStatement(switch)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(a, ))
+ handleParenthesizedCondition(()
+ beginSwitchBlock({)
+ beginCaseExpression(case)
+ handleIdentifier(x, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(x, ?)
+ handleLiteralInt(4)
+ handleIndexedExpression(?, [, ])
+ endCaseExpression(:)
+ handleCaseMatch(case, :)
+ beginSwitchCase(0, 1, case)
+ beginBlock({, BlockKind(statement))
+ beginBlock({, BlockKind(statement))
+ beginBlock({, BlockKind(statement))
+ handleLiteralInt(2)
+ handleExpressionStatement(;)
+ endBlock(1, {, }, BlockKind(statement))
+ endBlock(1, {, }, BlockKind(statement))
+ endBlock(1, {, }, BlockKind(statement))
+ handleEmptyStatement(;)
+ endSwitchCase(0, 1, null, null, 2, case, })
+ endSwitchBlock(1, {, })
+ endSwitchStatement(switch, })
+ endBlockFunctionBody(1, {, })
+ endTopLevelMethod(main, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.intertwined.expect
new file mode 100644
index 0000000..1be5375
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.intertwined.expect
@@ -0,0 +1,169 @@
+parseUnit(main)
+ skipErrorTokens(main)
+ listener: beginCompilationUnit(main)
+ syntheticPreviousToken(main)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(main)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(main)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, main)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(main, topLevelFunctionDeclaration)
+ parseMethodTypeVar(main)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(main, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, switch)
+ parseStatement({)
+ parseStatementX({)
+ parseSwitchStatement({)
+ listener: beginSwitchStatement(switch)
+ ensureParenthesizedCondition(switch)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt(a)
+ listener: handleNoArguments())
+ listener: handleSend(a, ))
+ ensureCloseParen(a, ()
+ listener: handleParenthesizedCondition(()
+ parseSwitchBlock())
+ ensureBlock(), null, switch statement)
+ listener: beginSwitchBlock({)
+ notEofOrValue(}, case)
+ peekPastLabels(case)
+ listener: beginCaseExpression(case)
+ parseExpression(case)
+ parsePrecedenceExpression(case, 1, true)
+ parseUnaryExpression(case, true)
+ parsePrimary(case, expression)
+ parseSendOrFunctionLiteral(case, expression)
+ parseSend(case, expression)
+ ensureIdentifier(case, expression)
+ listener: handleIdentifier(x, expression)
+ parseBangBeforeTypeArguments(x)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(x)
+ listener: handleNoArguments(?)
+ listener: handleSend(x, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(x, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralSetOrMapSuffix(:, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseLiteralSetOrMapSuffix({, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseLiteralSetOrMapSuffix({, null)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseLiteralInt({)
+ reportRecoverableError(;, Message[ExpectedButGot, Expected '}' before this., null, {string: }}])
+ parseArgumentOrIndexStar(x, Instance of 'NoTypeParamOrArg', true)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseLiteralInt([)
+ listener: handleLiteralInt(4)
+ listener: handleIndexedExpression(?, [, ])
+ ensureColon(])
+ listener: endCaseExpression(:)
+ listener: handleCaseMatch(case, :)
+ peekPastLabels({)
+ parseStatementsInSwitchCase(:, {, case, 0, 1, null, null)
+ listener: beginSwitchCase(0, 1, case)
+ parseStatement(:)
+ parseStatementX(:)
+ parseBlock(:, BlockKind(statement))
+ ensureBlock(:, null, null)
+ listener: beginBlock({, BlockKind(statement))
+ notEofOrValue(}, {)
+ parseStatement({)
+ parseStatementX({)
+ parseBlock({, BlockKind(statement))
+ ensureBlock({, null, null)
+ listener: beginBlock({, BlockKind(statement))
+ notEofOrValue(}, {)
+ parseStatement({)
+ parseStatementX({)
+ parseBlock({, BlockKind(statement))
+ ensureBlock({, null, null)
+ listener: beginBlock({, BlockKind(statement))
+ notEofOrValue(}, 2)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, false)
+ looksLikeLocalFunction(2)
+ parseExpressionStatement({)
+ parseExpression({)
+ parsePrecedenceExpression({, 1, true)
+ parseUnaryExpression({, true)
+ parsePrimary({, expression)
+ parseLiteralInt({)
+ listener: handleLiteralInt(2)
+ ensureSemicolon(2)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlock(1, {, }, BlockKind(statement))
+ notEofOrValue(}, })
+ listener: endBlock(1, {, }, BlockKind(statement))
+ notEofOrValue(}, })
+ listener: endBlock(1, {, }, BlockKind(statement))
+ peekPastLabels(;)
+ parseStatement(})
+ parseStatementX(})
+ parseEmptyStatement(})
+ listener: handleEmptyStatement(;)
+ peekPastLabels(})
+ listener: endSwitchCase(0, 1, null, null, 2, case, })
+ notEofOrValue(}, })
+ listener: endSwitchBlock(1, {, })
+ listener: endSwitchStatement(switch, })
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endTopLevelMethod(main, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(main)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.parser.expect
new file mode 100644
index 0000000..8335b2f
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.parser.expect
@@ -0,0 +1,15 @@
+main() {
+switch(a) {
+
+case x?[4]:{{{2;}}};
+}
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+switch[KeywordToken]([BeginToken]a[StringToken])[SimpleToken] {[BeginToken]
+
+case[KeywordToken] x[StringToken]?[SimpleToken][[BeginToken]4[StringToken]][SimpleToken]:[SimpleToken]{[BeginToken]{[BeginToken]{[BeginToken]2[StringToken];[SimpleToken]}[SimpleToken]}[SimpleToken]}[SimpleToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.scanner.expect
new file mode 100644
index 0000000..8335b2f
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_case_05.dart.scanner.expect
@@ -0,0 +1,15 @@
+main() {
+switch(a) {
+
+case x?[4]:{{{2;}}};
+}
+}
+
+
+main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+switch[KeywordToken]([BeginToken]a[StringToken])[SimpleToken] {[BeginToken]
+
+case[KeywordToken] x[StringToken]?[SimpleToken][[BeginToken]4[StringToken]][SimpleToken]:[SimpleToken]{[BeginToken]{[BeginToken]{[BeginToken]2[StringToken];[SimpleToken]}[SimpleToken]}[SimpleToken]}[SimpleToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart
new file mode 100644
index 0000000..eb60f9f
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart
@@ -0,0 +1,11 @@
+f() {
+ var a, b, c;
+
+ a?[b]:c;
+ a ? [b] : c;
+ a?[b].toString() : c;
+ a ? [b].toString() : c;
+
+ a ? <dynamic>[b] : <dynamic>[c];
+ a ? ([b]) : ([c]);
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.expect
new file mode 100644
index 0000000..da12b95
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.expect
@@ -0,0 +1,167 @@
+beginCompilationUnit(f)
+ beginMetadataStar(f)
+ endMetadataStar(0)
+ beginTopLevelMember(f)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(f, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ handleNoType(var)
+ beginVariablesDeclaration(a, null, var)
+ handleIdentifier(a, localVariableDeclaration)
+ beginInitializedIdentifier(a)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(a)
+ handleIdentifier(b, localVariableDeclaration)
+ beginInitializedIdentifier(b)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(b)
+ handleIdentifier(c, localVariableDeclaration)
+ beginInitializedIdentifier(c)
+ handleNoVariableInitializer(;)
+ endInitializedIdentifier(c)
+ endVariablesDeclaration(3, ;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(c, ;)
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(c, ;)
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleIdentifier(toString, expressionContinuation)
+ handleNoTypeArguments(()
+ beginArguments(()
+ endArguments(0, (, ))
+ handleSend(toString, :)
+ endBinaryExpression(.)
+ handleConditionalExpressionColon()
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(c, ;)
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleIdentifier(toString, expressionContinuation)
+ handleNoTypeArguments(()
+ beginArguments(()
+ endArguments(0, (, ))
+ handleSend(toString, :)
+ endBinaryExpression(.)
+ handleConditionalExpressionColon()
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(c, ;)
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ beginTypeArguments(<)
+ handleIdentifier(dynamic, typeReference)
+ handleNoTypeArguments(>)
+ handleType(dynamic, null)
+ endTypeArguments(1, <, >)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ beginTypeArguments(<)
+ handleIdentifier(dynamic, typeReference)
+ handleNoTypeArguments(>)
+ handleType(dynamic, null)
+ endTypeArguments(1, <, >)
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(c, ])
+ handleLiteralList(1, [, null, ])
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleParenthesizedExpression(()
+ handleConditionalExpressionColon()
+ handleNoTypeArguments([)
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(c, ])
+ handleLiteralList(1, [, null, ])
+ handleParenthesizedExpression(()
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(7, {, })
+endTopLevelMethod(f, null, })
+endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.intertwined.expect
new file mode 100644
index 0000000..1f972aa
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.intertwined.expect
@@ -0,0 +1,612 @@
+parseUnit(f)
+ skipErrorTokens(f)
+ listener: beginCompilationUnit(f)
+ syntheticPreviousToken(f)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(f)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(f)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, f)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(f, topLevelFunctionDeclaration)
+ parseMethodTypeVar(f)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(f, f, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(f, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, var)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
+ looksLikeLocalFunction(a)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ listener: handleNoType(var)
+ listener: beginVariablesDeclaration(a, null, var)
+ parseVariablesDeclarationRest(var, true)
+ parseOptionallyInitializedIdentifier(var)
+ ensureIdentifier(var, localVariableDeclaration)
+ listener: handleIdentifier(a, localVariableDeclaration)
+ listener: beginInitializedIdentifier(a)
+ parseVariableInitializerOpt(a)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(a)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(b, localVariableDeclaration)
+ listener: beginInitializedIdentifier(b)
+ parseVariableInitializerOpt(b)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(b)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(c, localVariableDeclaration)
+ listener: beginInitializedIdentifier(c)
+ parseVariableInitializerOpt(c)
+ listener: handleNoVariableInitializer(;)
+ listener: endInitializedIdentifier(c)
+ ensureSemicolon(c)
+ listener: endVariablesDeclaration(3, ;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(;)
+ listener: handleSend(c, ;)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(c)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(;)
+ listener: handleSend(c, ;)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(c)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parsePrimary(., expressionContinuation)
+ parseSendOrFunctionLiteral(., expressionContinuation)
+ looksLikeFunctionBody(:)
+ parseSend(., expressionContinuation)
+ ensureIdentifier(., expressionContinuation)
+ parseBangBeforeTypeArguments(toString)
+ parseArgumentsOpt(toString)
+ parseArguments(toString)
+ parseArgumentsRest(()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ parsePrimary(., expressionContinuation)
+ parseSendOrFunctionLiteral(., expressionContinuation)
+ looksLikeFunctionBody(:)
+ parseSend(., expressionContinuation)
+ ensureIdentifier(., expressionContinuation)
+ listener: handleIdentifier(toString, expressionContinuation)
+ parseBangBeforeTypeArguments(toString)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(toString)
+ parseArguments(toString)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ listener: endArguments(0, (, ))
+ listener: handleSend(toString, :)
+ listener: endBinaryExpression(.)
+ ensureColon())
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(;)
+ listener: handleSend(c, ;)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(c)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parsePrimary(., expressionContinuation)
+ parseSendOrFunctionLiteral(., expressionContinuation)
+ looksLikeFunctionBody(:)
+ parseSend(., expressionContinuation)
+ ensureIdentifier(., expressionContinuation)
+ parseBangBeforeTypeArguments(toString)
+ parseArgumentsOpt(toString)
+ parseArguments(toString)
+ parseArgumentsRest(()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ parsePrimary(., expressionContinuation)
+ parseSendOrFunctionLiteral(., expressionContinuation)
+ looksLikeFunctionBody(:)
+ parseSend(., expressionContinuation)
+ ensureIdentifier(., expressionContinuation)
+ listener: handleIdentifier(toString, expressionContinuation)
+ parseBangBeforeTypeArguments(toString)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(toString)
+ parseArguments(toString)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ listener: endArguments(0, (, ))
+ listener: handleSend(toString, :)
+ listener: endBinaryExpression(.)
+ ensureColon())
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(;)
+ listener: handleSend(c, ;)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(c)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSetMapOrFunction(?, null)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(dynamic, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(dynamic, null)
+ listener: endTypeArguments(1, <, >)
+ parseLiteralListSuffix(>, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralListSetMapOrFunction(:, null)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(dynamic, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(dynamic, null)
+ listener: endTypeArguments(1, <, >)
+ parseLiteralListSuffix(>, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(])
+ listener: handleSend(c, ])
+ listener: handleLiteralList(1, [, null, ])
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(])
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseParenthesizedExpressionOrFunctionLiteral(?)
+ parseParenthesizedExpression(?)
+ parseExpressionInParenthesis(?)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix((, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureCloseParen(], ()
+ listener: handleParenthesizedExpression(()
+ ensureColon())
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseParenthesizedExpressionOrFunctionLiteral(:)
+ parseParenthesizedExpression(:)
+ parseExpressionInParenthesis(:)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix((, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(])
+ listener: handleSend(c, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureCloseParen(], ()
+ listener: handleParenthesizedExpression(()
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(7, {, })
+ listener: endTopLevelMethod(f, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(f)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.parser.expect
new file mode 100644
index 0000000..0804398
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.parser.expect
@@ -0,0 +1,23 @@
+f() {
+var a, b, c;
+
+a?[b]:c;
+a ? [b] : c;
+a?[b].toString() : c;
+a ? [b].toString() : c;
+
+a ? <dynamic>[b] : <dynamic>[c];
+a ? ([b]) : ([c]);
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken],[SimpleToken] c[StringToken];[SimpleToken]
+
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken]:[SimpleToken]c[StringToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] [[BeginToken]b[StringToken]][SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken].[SimpleToken]toString[StringToken]([BeginToken])[SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] [[BeginToken]b[StringToken]][SimpleToken].[SimpleToken]toString[StringToken]([BeginToken])[SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+
+a[StringToken] ?[SimpleToken] <[BeginToken]dynamic[KeywordToken]>[SimpleToken][[BeginToken]b[StringToken]][SimpleToken] :[SimpleToken] <[BeginToken]dynamic[KeywordToken]>[SimpleToken][[BeginToken]c[StringToken]][SimpleToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] ([BeginToken][[BeginToken]b[StringToken]][SimpleToken])[SimpleToken] :[SimpleToken] ([BeginToken][[BeginToken]c[StringToken]][SimpleToken])[SimpleToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.scanner.expect
new file mode 100644
index 0000000..0804398
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional.dart.scanner.expect
@@ -0,0 +1,23 @@
+f() {
+var a, b, c;
+
+a?[b]:c;
+a ? [b] : c;
+a?[b].toString() : c;
+a ? [b].toString() : c;
+
+a ? <dynamic>[b] : <dynamic>[c];
+a ? ([b]) : ([c]);
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken],[SimpleToken] c[StringToken];[SimpleToken]
+
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken]:[SimpleToken]c[StringToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] [[BeginToken]b[StringToken]][SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken].[SimpleToken]toString[StringToken]([BeginToken])[SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] [[BeginToken]b[StringToken]][SimpleToken].[SimpleToken]toString[StringToken]([BeginToken])[SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+
+a[StringToken] ?[SimpleToken] <[BeginToken]dynamic[KeywordToken]>[SimpleToken][[BeginToken]b[StringToken]][SimpleToken] :[SimpleToken] <[BeginToken]dynamic[KeywordToken]>[SimpleToken][[BeginToken]c[StringToken]][SimpleToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] ([BeginToken][[BeginToken]b[StringToken]][SimpleToken])[SimpleToken] :[SimpleToken] ([BeginToken][[BeginToken]c[StringToken]][SimpleToken])[SimpleToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart
new file mode 100644
index 0000000..c95be6d
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart
@@ -0,0 +1,8 @@
+f() {
+ var a, b;
+ return a
+ ? [
+ b([])
+ ]
+ : null;
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.expect
new file mode 100644
index 0000000..6acafe8
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.expect
@@ -0,0 +1,48 @@
+beginCompilationUnit(f)
+ beginMetadataStar(f)
+ endMetadataStar(0)
+ beginTopLevelMember(f)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(f, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ handleNoType(var)
+ beginVariablesDeclaration(a, null, var)
+ handleIdentifier(a, localVariableDeclaration)
+ beginInitializedIdentifier(a)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(a)
+ handleIdentifier(b, localVariableDeclaration)
+ beginInitializedIdentifier(b)
+ handleNoVariableInitializer(;)
+ endInitializedIdentifier(b)
+ endVariablesDeclaration(2, ;)
+ beginReturnStatement(return)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ handleNoTypeArguments([])
+ handleLiteralList(0, [, null, ])
+ endArguments(1, (, ))
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ handleLiteralNull(null)
+ endConditionalExpression(?, :)
+ endReturnStatement(true, return, ;)
+ endBlockFunctionBody(2, {, })
+ endTopLevelMethod(f, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.intertwined.expect
new file mode 100644
index 0000000..71628a3
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.intertwined.expect
@@ -0,0 +1,157 @@
+parseUnit(f)
+ skipErrorTokens(f)
+ listener: beginCompilationUnit(f)
+ syntheticPreviousToken(f)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(f)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(f)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, f)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(f, topLevelFunctionDeclaration)
+ parseMethodTypeVar(f)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(f, f, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(f, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, var)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
+ looksLikeLocalFunction(a)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ listener: handleNoType(var)
+ listener: beginVariablesDeclaration(a, null, var)
+ parseVariablesDeclarationRest(var, true)
+ parseOptionallyInitializedIdentifier(var)
+ ensureIdentifier(var, localVariableDeclaration)
+ listener: handleIdentifier(a, localVariableDeclaration)
+ listener: beginInitializedIdentifier(a)
+ parseVariableInitializerOpt(a)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(a)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(b, localVariableDeclaration)
+ listener: beginInitializedIdentifier(b)
+ parseVariableInitializerOpt(b)
+ listener: handleNoVariableInitializer(;)
+ listener: endInitializedIdentifier(b)
+ ensureSemicolon(b)
+ listener: endVariablesDeclaration(2, ;)
+ notEofOrValue(}, return)
+ parseStatement(;)
+ parseStatementX(;)
+ parseReturnStatement(;)
+ listener: beginReturnStatement(return)
+ parseExpression(return)
+ parsePrecedenceExpression(return, 1, true)
+ parseUnaryExpression(return, true)
+ parsePrimary(return, expression)
+ parseSendOrFunctionLiteral(return, expression)
+ parseSend(return, expression)
+ ensureIdentifier(return, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ looksLikeFunctionBody(])
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parseArguments(b)
+ parseArgumentsRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseLiteralListSuffix((, null)
+ rewriteSquareBrackets(()
+ link([, ])
+ rewriter()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralNull(:)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ looksLikeFunctionBody(])
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(b)
+ parseArguments(b)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ listener: handleNoTypeArguments([])
+ parseLiteralListSuffix((, null)
+ rewriteSquareBrackets(()
+ link([, ])
+ rewriter()
+ listener: handleLiteralList(0, [, null, ])
+ listener: endArguments(1, (, ))
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralNull(:)
+ listener: handleLiteralNull(null)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(null)
+ listener: endReturnStatement(true, return, ;)
+ inGenerator()
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(2, {, })
+ listener: endTopLevelMethod(f, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(f)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.parser.expect
new file mode 100644
index 0000000..42dbfbe
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.parser.expect
@@ -0,0 +1,19 @@
+NOTICE: Stream was rewritten by parser!
+
+f() {
+var a, b;
+return a
+? [
+b([])
+]
+: null;
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken];[SimpleToken]
+return[KeywordToken] a[StringToken]
+?[SimpleToken] [[BeginToken]
+b[StringToken]([BeginToken][[BeginToken]][SimpleToken])[SimpleToken]
+][SimpleToken]
+:[SimpleToken] null[KeywordToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.scanner.expect
new file mode 100644
index 0000000..b22dada
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_conditional_2.dart.scanner.expect
@@ -0,0 +1,17 @@
+f() {
+var a, b;
+return a
+? [
+b([])
+]
+: null;
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken];[SimpleToken]
+return[KeywordToken] a[StringToken]
+?[SimpleToken] [[BeginToken]
+b[StringToken]([BeginToken][][SimpleToken])[SimpleToken]
+][SimpleToken]
+:[SimpleToken] null[KeywordToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart
new file mode 100644
index 0000000..047f2d2
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart
@@ -0,0 +1,5 @@
+f() {
+ var a, b;
+ a?.[b];
+ a?[b];
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.expect
new file mode 100644
index 0000000..b2e3729
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.expect
@@ -0,0 +1,49 @@
+beginCompilationUnit(f)
+ beginMetadataStar(f)
+ endMetadataStar(0)
+ beginTopLevelMember(f)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(f, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ handleNoType(var)
+ beginVariablesDeclaration(a, null, var)
+ handleIdentifier(a, localVariableDeclaration)
+ beginInitializedIdentifier(a)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(a)
+ handleIdentifier(b, localVariableDeclaration)
+ beginInitializedIdentifier(b)
+ handleNoVariableInitializer(;)
+ endInitializedIdentifier(b)
+ endVariablesDeclaration(2, ;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?.[)
+ handleNoArguments(?.[)
+ handleSend(a, ?.[)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleIndexedExpression(null, ?.[, ])
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleIndexedExpression(?, [, ])
+ handleExpressionStatement(;)
+ endBlockFunctionBody(3, {, })
+ endTopLevelMethod(f, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.intertwined.expect
new file mode 100644
index 0000000..c80bf87
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.intertwined.expect
@@ -0,0 +1,147 @@
+parseUnit(f)
+ skipErrorTokens(f)
+ listener: beginCompilationUnit(f)
+ syntheticPreviousToken(f)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(f)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(f)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, f)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(f, topLevelFunctionDeclaration)
+ parseMethodTypeVar(f)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(f, f, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(f, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, var)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
+ looksLikeLocalFunction(a)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ listener: handleNoType(var)
+ listener: beginVariablesDeclaration(a, null, var)
+ parseVariablesDeclarationRest(var, true)
+ parseOptionallyInitializedIdentifier(var)
+ ensureIdentifier(var, localVariableDeclaration)
+ listener: handleIdentifier(a, localVariableDeclaration)
+ listener: beginInitializedIdentifier(a)
+ parseVariableInitializerOpt(a)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(a)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(b, localVariableDeclaration)
+ listener: beginInitializedIdentifier(b)
+ parseVariableInitializerOpt(b)
+ listener: handleNoVariableInitializer(;)
+ listener: endInitializedIdentifier(b)
+ ensureSemicolon(b)
+ listener: endVariablesDeclaration(2, ;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?.[)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?.[)
+ listener: handleSend(a, ?.[)
+ parseArgumentOrIndexStar(a, Instance of 'NoTypeParamOrArg', false)
+ parseExpression(?.[)
+ parsePrecedenceExpression(?.[, 1, true)
+ parseUnaryExpression(?.[, true)
+ parsePrimary(?.[, expression)
+ parseSendOrFunctionLiteral(?.[, expression)
+ parseSend(?.[, expression)
+ ensureIdentifier(?.[, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleIndexedExpression(null, ?.[, ])
+ ensureSemicolon(])
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parseArgumentOrIndexStar(a, Instance of 'NoTypeParamOrArg', true)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleIndexedExpression(?, [, ])
+ ensureSemicolon(])
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(3, {, })
+ listener: endTopLevelMethod(f, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(f)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.parser.expect
new file mode 100644
index 0000000..8504155
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.parser.expect
@@ -0,0 +1,11 @@
+f() {
+var a, b;
+a?.[b];
+a?[b];
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken];[SimpleToken]
+a[StringToken]?.[[BeginToken]b[StringToken]][SimpleToken];[SimpleToken]
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.scanner.expect
new file mode 100644
index 0000000..8504155
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_access.dart.scanner.expect
@@ -0,0 +1,11 @@
+f() {
+var a, b;
+a?.[b];
+a?[b];
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken];[SimpleToken]
+a[StringToken]?.[[BeginToken]b[StringToken]][SimpleToken];[SimpleToken]
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart
new file mode 100644
index 0000000..a067938
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart
@@ -0,0 +1,5 @@
+f() {
+ var a, b, c;
+ a?.[b] = c;
+ a?[b] = c;
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.expect
new file mode 100644
index 0000000..a4ed432
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.expect
@@ -0,0 +1,63 @@
+beginCompilationUnit(f)
+ beginMetadataStar(f)
+ endMetadataStar(0)
+ beginTopLevelMember(f)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(f, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ handleNoType(var)
+ beginVariablesDeclaration(a, null, var)
+ handleIdentifier(a, localVariableDeclaration)
+ beginInitializedIdentifier(a)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(a)
+ handleIdentifier(b, localVariableDeclaration)
+ beginInitializedIdentifier(b)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(b)
+ handleIdentifier(c, localVariableDeclaration)
+ beginInitializedIdentifier(c)
+ handleNoVariableInitializer(;)
+ endInitializedIdentifier(c)
+ endVariablesDeclaration(3, ;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?.[)
+ handleNoArguments(?.[)
+ handleSend(a, ?.[)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleIndexedExpression(null, ?.[, ])
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(c, ;)
+ handleAssignmentExpression(=)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleIndexedExpression(?, [, ])
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(c, ;)
+ handleAssignmentExpression(=)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(3, {, })
+ endTopLevelMethod(f, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.intertwined.expect
new file mode 100644
index 0000000..f4a87dc
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.intertwined.expect
@@ -0,0 +1,188 @@
+parseUnit(f)
+ skipErrorTokens(f)
+ listener: beginCompilationUnit(f)
+ syntheticPreviousToken(f)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(f)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(f)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, f)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(f, topLevelFunctionDeclaration)
+ parseMethodTypeVar(f)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(f, f, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(f, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, var)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
+ looksLikeLocalFunction(a)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ listener: handleNoType(var)
+ listener: beginVariablesDeclaration(a, null, var)
+ parseVariablesDeclarationRest(var, true)
+ parseOptionallyInitializedIdentifier(var)
+ ensureIdentifier(var, localVariableDeclaration)
+ listener: handleIdentifier(a, localVariableDeclaration)
+ listener: beginInitializedIdentifier(a)
+ parseVariableInitializerOpt(a)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(a)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(b, localVariableDeclaration)
+ listener: beginInitializedIdentifier(b)
+ parseVariableInitializerOpt(b)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(b)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(c, localVariableDeclaration)
+ listener: beginInitializedIdentifier(c)
+ parseVariableInitializerOpt(c)
+ listener: handleNoVariableInitializer(;)
+ listener: endInitializedIdentifier(c)
+ ensureSemicolon(c)
+ listener: endVariablesDeclaration(3, ;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?.[)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?.[)
+ listener: handleSend(a, ?.[)
+ parseArgumentOrIndexStar(a, Instance of 'NoTypeParamOrArg', false)
+ parseExpression(?.[)
+ parsePrecedenceExpression(?.[, 1, true)
+ parseUnaryExpression(?.[, true)
+ parsePrimary(?.[, expression)
+ parseSendOrFunctionLiteral(?.[, expression)
+ parseSend(?.[, expression)
+ ensureIdentifier(?.[, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleIndexedExpression(null, ?.[, ])
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ ensureIdentifier(=, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(;)
+ listener: handleSend(c, ;)
+ listener: handleAssignmentExpression(=)
+ ensureSemicolon(c)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parsePrecedenceExpression(=, 1, false)
+ parseUnaryExpression(=, false)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ ensureIdentifier(=, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseArgumentOrIndexStar(a, Instance of 'NoTypeParamOrArg', true)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleIndexedExpression(?, [, ])
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ ensureIdentifier(=, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(;)
+ listener: handleSend(c, ;)
+ listener: handleAssignmentExpression(=)
+ ensureSemicolon(c)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(3, {, })
+ listener: endTopLevelMethod(f, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(f)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.parser.expect
new file mode 100644
index 0000000..f8e7918
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.parser.expect
@@ -0,0 +1,11 @@
+f() {
+var a, b, c;
+a?.[b] = c;
+a?[b] = c;
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken],[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken]?.[[BeginToken]b[StringToken]][SimpleToken] =[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken] =[SimpleToken] c[StringToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.scanner.expect
new file mode 100644
index 0000000..f8e7918
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_index_set.dart.scanner.expect
@@ -0,0 +1,11 @@
+f() {
+var a, b, c;
+a?.[b] = c;
+a?[b] = c;
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken],[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken]?.[[BeginToken]b[StringToken]][SimpleToken] =[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken] =[SimpleToken] c[StringToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart
new file mode 100644
index 0000000..2809058
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart
@@ -0,0 +1,6 @@
+f() {
+ var a, b;
+
+ a?.call(b);
+ a?(b);
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.expect
new file mode 100644
index 0000000..4ecef51
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.expect
@@ -0,0 +1,73 @@
+Problems reported:
+
+parser/nnbd/issue_40267_method_call_no_type_arguments:5:8: Expected ':' before this.
+ a?(b);
+ ^
+
+parser/nnbd/issue_40267_method_call_no_type_arguments:5:8: Expected an identifier, but got ';'.
+ a?(b);
+ ^
+
+beginCompilationUnit(f)
+ beginMetadataStar(f)
+ endMetadataStar(0)
+ beginTopLevelMember(f)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(f, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ handleNoType(var)
+ beginVariablesDeclaration(a, null, var)
+ handleIdentifier(a, localVariableDeclaration)
+ beginInitializedIdentifier(a)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(a)
+ handleIdentifier(b, localVariableDeclaration)
+ beginInitializedIdentifier(b)
+ handleNoVariableInitializer(;)
+ endInitializedIdentifier(b)
+ endVariablesDeclaration(2, ;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?.)
+ handleNoArguments(?.)
+ handleSend(a, ?.)
+ handleIdentifier(call, expressionContinuation)
+ handleNoTypeArguments(()
+ beginArguments(()
+ handleIdentifier(b, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(b, ))
+ endArguments(1, (, ))
+ handleSend(call, ;)
+ endBinaryExpression(?.)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(b, ))
+ handleParenthesizedExpression(()
+ handleRecoverableError(Message[ExpectedButGot, Expected ':' before this., null, {string: :}], ;, ;)
+ handleConditionalExpressionColon()
+ handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ';'., null, {token: ;}], ;, ;)
+ handleIdentifier(, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(, ;)
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(3, {, })
+ endTopLevelMethod(f, null, })
+endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.intertwined.expect
new file mode 100644
index 0000000..cd6889e
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.intertwined.expect
@@ -0,0 +1,176 @@
+parseUnit(f)
+ skipErrorTokens(f)
+ listener: beginCompilationUnit(f)
+ syntheticPreviousToken(f)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(f)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(f)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, f)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(f, topLevelFunctionDeclaration)
+ parseMethodTypeVar(f)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(f, f, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(f, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, var)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
+ looksLikeLocalFunction(a)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ listener: handleNoType(var)
+ listener: beginVariablesDeclaration(a, null, var)
+ parseVariablesDeclarationRest(var, true)
+ parseOptionallyInitializedIdentifier(var)
+ ensureIdentifier(var, localVariableDeclaration)
+ listener: handleIdentifier(a, localVariableDeclaration)
+ listener: beginInitializedIdentifier(a)
+ parseVariableInitializerOpt(a)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(a)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(b, localVariableDeclaration)
+ listener: beginInitializedIdentifier(b)
+ parseVariableInitializerOpt(b)
+ listener: handleNoVariableInitializer(;)
+ listener: endInitializedIdentifier(b)
+ ensureSemicolon(b)
+ listener: endVariablesDeclaration(2, ;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?.)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?.)
+ listener: handleSend(a, ?.)
+ parsePrimary(?., expressionContinuation)
+ parseSendOrFunctionLiteral(?., expressionContinuation)
+ looksLikeFunctionBody(;)
+ parseSend(?., expressionContinuation)
+ ensureIdentifier(?., expressionContinuation)
+ listener: handleIdentifier(call, expressionContinuation)
+ parseBangBeforeTypeArguments(call)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(call)
+ parseArguments(call)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt(b)
+ listener: handleNoArguments())
+ listener: handleSend(b, ))
+ listener: endArguments(1, (, ))
+ listener: handleSend(call, ;)
+ listener: endBinaryExpression(?.)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseParenthesizedExpressionOrFunctionLiteral(?)
+ parseParenthesizedExpression(?)
+ parseExpressionInParenthesis(?)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt(b)
+ listener: handleNoArguments())
+ listener: handleSend(b, ))
+ ensureCloseParen(b, ()
+ listener: handleParenthesizedExpression(()
+ ensureColon())
+ rewriteAndRecover(), Message[ExpectedButGot, Expected ':' before this., null, {string: :}], :)
+ reportRecoverableError(;, Message[ExpectedButGot, Expected ':' before this., null, {string: :}])
+ listener: handleRecoverableError(Message[ExpectedButGot, Expected ':' before this., null, {string: :}], ;, ;)
+ rewriter()
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ reportRecoverableErrorWithToken(;, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got ';'., null, {token: ;}], ;, ;)
+ rewriter()
+ listener: handleIdentifier(, expression)
+ parseBangBeforeTypeArguments()
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt()
+ listener: handleNoArguments(;)
+ listener: handleSend(, ;)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon()
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(3, {, })
+ listener: endTopLevelMethod(f, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(f)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.parser.expect
new file mode 100644
index 0000000..028eb60
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.parser.expect
@@ -0,0 +1,15 @@
+NOTICE: Stream was rewritten by parser!
+
+f() {
+var a, b;
+
+a?.call(b);
+a?(b):;
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken];[SimpleToken]
+
+a[StringToken]?.[SimpleToken]call[StringToken]([BeginToken]b[StringToken])[SimpleToken];[SimpleToken]
+a[StringToken]?[SimpleToken]([BeginToken]b[StringToken])[SimpleToken]:[SyntheticToken][SyntheticStringToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.scanner.expect
new file mode 100644
index 0000000..b24e527
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_no_type_arguments.dart.scanner.expect
@@ -0,0 +1,13 @@
+f() {
+var a, b;
+
+a?.call(b);
+a?(b);
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken];[SimpleToken]
+
+a[StringToken]?.[SimpleToken]call[StringToken]([BeginToken]b[StringToken])[SimpleToken];[SimpleToken]
+a[StringToken]?[SimpleToken]([BeginToken]b[StringToken])[SimpleToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart
new file mode 100644
index 0000000..72c87c6
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart
@@ -0,0 +1,6 @@
+f() {
+ var a, b;
+
+ a?.call<Foo>(b);
+ a?<Foo>(b);
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.expect
new file mode 100644
index 0000000..4a614ea
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.expect
@@ -0,0 +1,109 @@
+Problems reported:
+
+parser/nnbd/issue_40267_method_call_with_type_arguments:5:13: Unexpected token ';'.
+ a?<Foo>(b);
+ ^
+
+parser/nnbd/issue_40267_method_call_with_type_arguments:5:13: Expected a function body or '=>'.
+ a?<Foo>(b);
+ ^
+
+parser/nnbd/issue_40267_method_call_with_type_arguments:6:1: Expected ':' before this.
+}
+^
+
+parser/nnbd/issue_40267_method_call_with_type_arguments:6:1: Expected an identifier, but got '}'.
+}
+^
+
+parser/nnbd/issue_40267_method_call_with_type_arguments:6:1: Expected ';' after this.
+}
+^
+
+beginCompilationUnit(f)
+ beginMetadataStar(f)
+ endMetadataStar(0)
+ beginTopLevelMember(f)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(f, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ handleNoType(var)
+ beginVariablesDeclaration(a, null, var)
+ handleIdentifier(a, localVariableDeclaration)
+ beginInitializedIdentifier(a)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(a)
+ handleIdentifier(b, localVariableDeclaration)
+ beginInitializedIdentifier(b)
+ handleNoVariableInitializer(;)
+ endInitializedIdentifier(b)
+ endVariablesDeclaration(2, ;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?.)
+ handleNoArguments(?.)
+ handleSend(a, ?.)
+ handleIdentifier(call, expressionContinuation)
+ beginTypeArguments(<)
+ handleIdentifier(Foo, typeReference)
+ handleNoTypeArguments(>)
+ handleType(Foo, null)
+ endTypeArguments(1, <, >)
+ beginArguments(()
+ handleIdentifier(b, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(b, ))
+ endArguments(1, (, ))
+ handleSend(call, ;)
+ endBinaryExpression(?.)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ beginTypeVariables(<)
+ beginMetadataStar(Foo)
+ endMetadataStar(0)
+ handleIdentifier(Foo, typeVariableDeclaration)
+ beginTypeVariable(Foo)
+ handleTypeVariablesDefined(Foo, 1)
+ handleNoType(Foo)
+ endTypeVariable(>, 0, null, null)
+ endTypeVariables(<, >)
+ handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {token: ;}], ;, ;)
+ beginFunctionExpression(()
+ beginFormalParameters((, MemberKind.Local)
+ beginMetadataStar(b)
+ endMetadataStar(0)
+ beginFormalParameter(b, MemberKind.Local, null, null, null)
+ handleNoType(()
+ handleIdentifier(b, formalParameterDeclaration)
+ handleFormalParameterWithoutValue())
+ endFormalParameter(null, null, b, null, null, FormalParameterKind.mandatory, MemberKind.Local)
+ endFormalParameters(1, (, ), MemberKind.Local)
+ handleAsyncModifier(null, null)
+ handleRecoverableError(ExpectedBody, ;, ;)
+ handleEmptyFunctionBody(;)
+ endFunctionExpression((, })
+ handleRecoverableError(Message[ExpectedButGot, Expected ':' before this., null, {string: :}], }, })
+ handleConditionalExpressionColon()
+ handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '}'., null, {token: }}], }, })
+ handleIdentifier(, expression)
+ handleNoTypeArguments(})
+ handleNoArguments(})
+ handleSend(, })
+ endConditionalExpression(?, :)
+ handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], }, })
+ handleExpressionStatement(;)
+ endBlockFunctionBody(3, {, })
+ endTopLevelMethod(f, null, })
+endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.intertwined.expect
new file mode 100644
index 0000000..05b28d6
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.intertwined.expect
@@ -0,0 +1,202 @@
+parseUnit(f)
+ skipErrorTokens(f)
+ listener: beginCompilationUnit(f)
+ syntheticPreviousToken(f)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(f)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(f)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, f)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(f, topLevelFunctionDeclaration)
+ parseMethodTypeVar(f)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(f, f, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(f, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, var)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
+ looksLikeLocalFunction(a)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ listener: handleNoType(var)
+ listener: beginVariablesDeclaration(a, null, var)
+ parseVariablesDeclarationRest(var, true)
+ parseOptionallyInitializedIdentifier(var)
+ ensureIdentifier(var, localVariableDeclaration)
+ listener: handleIdentifier(a, localVariableDeclaration)
+ listener: beginInitializedIdentifier(a)
+ parseVariableInitializerOpt(a)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(a)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(b, localVariableDeclaration)
+ listener: beginInitializedIdentifier(b)
+ parseVariableInitializerOpt(b)
+ listener: handleNoVariableInitializer(;)
+ listener: endInitializedIdentifier(b)
+ ensureSemicolon(b)
+ listener: endVariablesDeclaration(2, ;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?.)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?.)
+ listener: handleSend(a, ?.)
+ parsePrimary(?., expressionContinuation)
+ parseSendOrFunctionLiteral(?., expressionContinuation)
+ looksLikeFunctionBody(;)
+ parseSend(?., expressionContinuation)
+ ensureIdentifier(?., expressionContinuation)
+ listener: handleIdentifier(call, expressionContinuation)
+ parseBangBeforeTypeArguments(call)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(Foo, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(Foo, null)
+ listener: endTypeArguments(1, <, >)
+ parseArgumentsOpt(>)
+ parseArguments(>)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt(b)
+ listener: handleNoArguments())
+ listener: handleSend(b, ))
+ listener: endArguments(1, (, ))
+ listener: handleSend(call, ;)
+ listener: endBinaryExpression(?.)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSetMapOrFunction(?, null)
+ listener: beginTypeVariables(<)
+ listener: beginMetadataStar(Foo)
+ listener: endMetadataStar(0)
+ listener: handleIdentifier(Foo, typeVariableDeclaration)
+ listener: beginTypeVariable(Foo)
+ listener: handleTypeVariablesDefined(Foo, 1)
+ listener: handleNoType(Foo)
+ listener: endTypeVariable(>, 0, null, null)
+ listener: endTypeVariables(<, >)
+ parseLiteralFunctionSuffix(>)
+ reportRecoverableErrorWithToken(;, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {token: ;}], ;, ;)
+ parseFunctionExpression(>)
+ listener: beginFunctionExpression(()
+ parseFormalParametersRequiredOpt(>, MemberKind.Local)
+ parseFormalParametersRest((, MemberKind.Local)
+ listener: beginFormalParameters((, MemberKind.Local)
+ parseFormalParameter((, FormalParameterKind.mandatory, MemberKind.Local)
+ parseMetadataStar(()
+ listener: beginMetadataStar(b)
+ listener: endMetadataStar(0)
+ listener: beginFormalParameter(b, MemberKind.Local, null, null, null)
+ listener: handleNoType(()
+ ensureIdentifier((, formalParameterDeclaration)
+ listener: handleIdentifier(b, formalParameterDeclaration)
+ listener: handleFormalParameterWithoutValue())
+ listener: endFormalParameter(null, null, b, null, null, FormalParameterKind.mandatory, MemberKind.Local)
+ listener: endFormalParameters(1, (, ), MemberKind.Local)
+ parseAsyncOptBody(), true, false)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), true, false)
+ reportRecoverableError(;, ExpectedBody)
+ listener: handleRecoverableError(ExpectedBody, ;, ;)
+ listener: handleEmptyFunctionBody(;)
+ listener: endFunctionExpression((, })
+ ensureColon(;)
+ rewriteAndRecover(;, Message[ExpectedButGot, Expected ':' before this., null, {string: :}], :)
+ reportRecoverableError(}, Message[ExpectedButGot, Expected ':' before this., null, {string: :}])
+ listener: handleRecoverableError(Message[ExpectedButGot, Expected ':' before this., null, {string: :}], }, })
+ rewriter()
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ reportRecoverableErrorWithToken(}, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '}'., null, {token: }}], }, })
+ rewriter()
+ listener: handleIdentifier(, expression)
+ parseBangBeforeTypeArguments()
+ listener: handleNoTypeArguments(})
+ parseArgumentsOpt()
+ listener: handleNoArguments(})
+ listener: handleSend(, })
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon()
+ reportRecoverableError(, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
+ listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], }, })
+ rewriter()
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(3, {, })
+ listener: endTopLevelMethod(f, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(f)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.parser.expect
new file mode 100644
index 0000000..69c6d67
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.parser.expect
@@ -0,0 +1,15 @@
+NOTICE: Stream was rewritten by parser!
+
+f() {
+var a, b;
+
+a?.call<Foo>(b);
+a?<Foo>(b);
+:;}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken];[SimpleToken]
+
+a[StringToken]?.[SimpleToken]call[StringToken]<[BeginToken]Foo[StringToken]>[SimpleToken]([BeginToken]b[StringToken])[SimpleToken];[SimpleToken]
+a[StringToken]?[SimpleToken]<[BeginToken]Foo[StringToken]>[SimpleToken]([BeginToken]b[StringToken])[SimpleToken];[SimpleToken]
+:[SyntheticToken][SyntheticStringToken];[SyntheticToken]}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.scanner.expect
new file mode 100644
index 0000000..b754003
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40267_method_call_with_type_arguments.dart.scanner.expect
@@ -0,0 +1,13 @@
+f() {
+var a, b;
+
+a?.call<Foo>(b);
+a?<Foo>(b);
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken];[SimpleToken]
+
+a[StringToken]?.[SimpleToken]call[StringToken]<[BeginToken]Foo[StringToken]>[SimpleToken]([BeginToken]b[StringToken])[SimpleToken];[SimpleToken]
+a[StringToken]?[SimpleToken]<[BeginToken]Foo[StringToken]>[SimpleToken]([BeginToken]b[StringToken])[SimpleToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/late_member.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/late_member.dart.intertwined.expect
index d385dd5..c97319d 100644
--- a/pkg/front_end/parser_testcases/nnbd/late_member.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/late_member.dart.intertwined.expect
@@ -91,6 +91,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(foo)
listener: handleNoArguments(.)
@@ -102,6 +103,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(late, expressionContinuation)
+ parseBangBeforeTypeArguments(late)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(late)
listener: handleNoArguments(;)
@@ -129,6 +131,7 @@
ensureIdentifier(;, expression)
inPlainSync()
listener: handleIdentifier(late, expression)
+ parseBangBeforeTypeArguments(late)
listener: handleNoTypeArguments(()
parseArgumentsOpt(late)
parseArguments(late)
@@ -153,6 +156,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(bar, expression)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(()
parseArgumentsOpt(bar)
parseArguments(bar)
@@ -196,6 +200,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(late, expressionContinuation)
+ parseBangBeforeTypeArguments(late)
listener: handleNoTypeArguments(()
parseArgumentsOpt(late)
parseArguments(late)
@@ -239,6 +244,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(late, expressionContinuation)
+ parseBangBeforeTypeArguments(late)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(late)
listener: handleNoArguments(;)
@@ -288,6 +294,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(print, expression)
+ parseBangBeforeTypeArguments(print)
listener: handleNoTypeArguments(()
parseArgumentsOpt(print)
parseArguments(print)
@@ -375,6 +382,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(print, expression)
+ parseBangBeforeTypeArguments(print)
listener: handleNoTypeArguments(()
parseArgumentsOpt(print)
parseArguments(print)
diff --git a/pkg/front_end/parser_testcases/nnbd/late_modifier.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/late_modifier.dart.intertwined.expect
index 15d91f6..6c2e4d2 100644
--- a/pkg/front_end/parser_testcases/nnbd/late_modifier.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/late_modifier.dart.intertwined.expect
@@ -91,6 +91,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(foo)
listener: handleNoArguments(.)
@@ -102,6 +103,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(late, expressionContinuation)
+ parseBangBeforeTypeArguments(late)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(late)
listener: handleNoArguments(;)
@@ -129,6 +131,7 @@
ensureIdentifier(;, expression)
inPlainSync()
listener: handleIdentifier(late, expression)
+ parseBangBeforeTypeArguments(late)
listener: handleNoTypeArguments(()
parseArgumentsOpt(late)
parseArguments(late)
@@ -153,6 +156,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(bar, expression)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(()
parseArgumentsOpt(bar)
parseArguments(bar)
@@ -196,6 +200,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(late, expressionContinuation)
+ parseBangBeforeTypeArguments(late)
listener: handleNoTypeArguments(()
parseArgumentsOpt(late)
parseArguments(late)
@@ -239,6 +244,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(late, expressionContinuation)
+ parseBangBeforeTypeArguments(late)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(late)
listener: handleNoArguments(;)
@@ -282,6 +288,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(=)
parseArgumentsOpt(foo)
listener: handleNoArguments(=)
@@ -336,6 +343,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(print, expression)
+ parseBangBeforeTypeArguments(print)
listener: handleNoTypeArguments(()
parseArgumentsOpt(print)
parseArguments(print)
@@ -423,6 +431,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(print, expression)
+ parseBangBeforeTypeArguments(print)
listener: handleNoTypeArguments(()
parseArgumentsOpt(print)
parseArguments(print)
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex.dart.expect
index 9ddb2a0..1561431 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex.dart.expect
@@ -29,7 +29,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex.dart.intertwined.expect
index 7bf2cde..5291223 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex.dart.intertwined.expect
@@ -39,6 +39,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(foo)
listener: handleNoArguments(.)
@@ -48,6 +49,7 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(bar, expressionContinuation)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(bar)
listener: handleNoArguments(!)
@@ -59,12 +61,13 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(baz, expressionContinuation)
+ parseBangBeforeTypeArguments(baz)
listener: handleNoTypeArguments([)
parseArgumentsOpt(baz)
listener: handleNoArguments([)
listener: handleSend(baz, [)
listener: endBinaryExpression(.)
- parseArgumentOrIndexStar(baz, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(baz, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -73,11 +76,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex_with_parens.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex_with_parens.dart.expect
index d10dfba..8288d05 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex_with_parens.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex_with_parens.dart.expect
@@ -30,7 +30,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex_with_parens.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex_with_parens.dart.intertwined.expect
index 69fcc2c..6b735e6 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex_with_parens.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckBeforeIndex_with_parens.dart.intertwined.expect
@@ -48,6 +48,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(foo)
listener: handleNoArguments(.)
@@ -57,6 +58,7 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(bar, expressionContinuation)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments())
parseArgumentsOpt(bar)
listener: handleNoArguments())
@@ -70,12 +72,13 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(baz, expressionContinuation)
+ parseBangBeforeTypeArguments(baz)
listener: handleNoTypeArguments([)
parseArgumentsOpt(baz)
listener: handleNoArguments([)
listener: handleSend(baz, [)
listener: endBinaryExpression(.)
- parseArgumentOrIndexStar(baz, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(baz, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -84,11 +87,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex.dart.expect
index 92b9ac2..24f6535 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex.dart.expect
@@ -19,7 +19,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex.dart.intertwined.expect
index 109f304..e5d14b1 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex.dart.intertwined.expect
@@ -39,12 +39,13 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(obj, expression)
+ parseBangBeforeTypeArguments(obj)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(obj)
listener: handleNoArguments(!)
listener: handleSend(obj, !)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -53,11 +54,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2.dart.expect
index f6e7d35..43511af 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2.dart.expect
@@ -19,13 +19,13 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleNonNullAssertExpression(!)
handleIdentifier(arg2, expression)
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg2, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2.dart.intertwined.expect
index 0b43b40..1f71bd5 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2.dart.intertwined.expect
@@ -39,12 +39,13 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(obj, expression)
+ parseBangBeforeTypeArguments(obj)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(obj)
listener: handleNoArguments(!)
listener: handleSend(obj, !)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -53,13 +54,14 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -68,11 +70,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg2, expression)
+ parseBangBeforeTypeArguments(arg2)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg2)
listener: handleNoArguments(])
listener: handleSend(arg2, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2_with_parens.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2_with_parens.dart.expect
index e1cdb65..419aa04 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2_with_parens.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2_with_parens.dart.expect
@@ -20,7 +20,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleParenthesizedExpression(()
handleNonNullAssertExpression(!)
handleParenthesizedExpression(()
@@ -28,7 +28,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg2, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2_with_parens.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2_with_parens.dart.intertwined.expect
index 6c15e07..1d9af4a 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2_with_parens.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex2_with_parens.dart.intertwined.expect
@@ -64,6 +64,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(obj, expression)
+ parseBangBeforeTypeArguments(obj)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(obj)
listener: handleNoArguments(!)
@@ -71,7 +72,7 @@
listener: handleNonNullAssertExpression(!)
ensureCloseParen(!, ()
listener: handleParenthesizedExpression(()
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -80,17 +81,18 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureCloseParen(], ()
listener: handleParenthesizedExpression(()
listener: handleNonNullAssertExpression(!)
ensureCloseParen(!, ()
listener: handleParenthesizedExpression(()
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -99,11 +101,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg2, expression)
+ parseBangBeforeTypeArguments(arg2)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg2)
listener: handleNoArguments(])
listener: handleSend(arg2, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3.dart.expect
index fbda0ef..498669b 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3.dart.expect
@@ -24,7 +24,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3.dart.intertwined.expect
index f3b48e4..a693413 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3.dart.intertwined.expect
@@ -39,6 +39,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(foo)
listener: handleNoArguments(.)
@@ -48,13 +49,14 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(bar, expressionContinuation)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(bar)
listener: handleNoArguments(!)
listener: handleSend(bar, !)
listener: endBinaryExpression(.)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -63,11 +65,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3_with_parens.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3_with_parens.dart.expect
index e014b78..bdac363 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3_with_parens.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3_with_parens.dart.expect
@@ -25,7 +25,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3_with_parens.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3_with_parens.dart.intertwined.expect
index c349f09..a732156 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3_with_parens.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex3_with_parens.dart.intertwined.expect
@@ -48,6 +48,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(foo)
listener: handleNoArguments(.)
@@ -57,6 +58,7 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(bar, expressionContinuation)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments())
parseArgumentsOpt(bar)
listener: handleNoArguments())
@@ -65,7 +67,7 @@
ensureCloseParen(bar, ()
listener: handleParenthesizedExpression(()
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -74,11 +76,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4.dart.expect
index 2fc33bb..38c46b3 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4.dart.expect
@@ -25,7 +25,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4.dart.intertwined.expect
index 89095e5..ce2c71a 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4.dart.intertwined.expect
@@ -39,6 +39,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(foo)
listener: handleNoArguments(!)
@@ -49,13 +50,14 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(bar, expressionContinuation)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(bar)
listener: handleNoArguments(!)
listener: handleSend(bar, !)
listener: endBinaryExpression(.)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -64,11 +66,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4_with_parens.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4_with_parens.dart.expect
index 2aa6ce6..08871b3 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4_with_parens.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4_with_parens.dart.expect
@@ -27,7 +27,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4_with_parens.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4_with_parens.dart.intertwined.expect
index 4e8d872..216c8d9 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4_with_parens.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex4_with_parens.dart.intertwined.expect
@@ -56,6 +56,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(foo)
listener: handleNoArguments(!)
@@ -68,6 +69,7 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(bar, expressionContinuation)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(bar)
listener: handleNoArguments(!)
@@ -76,7 +78,7 @@
listener: handleNonNullAssertExpression(!)
ensureCloseParen(!, ()
listener: handleParenthesizedExpression(()
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -85,11 +87,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5.dart.expect
index 2d56362..8bf4e12 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5.dart.expect
@@ -24,13 +24,13 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleNonNullAssertExpression(!)
handleIdentifier(arg2, expression)
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg2, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5.dart.intertwined.expect
index c6b3abd..ed52048 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5.dart.intertwined.expect
@@ -39,6 +39,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(foo)
listener: handleNoArguments(.)
@@ -48,13 +49,14 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(bar, expressionContinuation)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(bar)
listener: handleNoArguments(!)
listener: handleSend(bar, !)
listener: endBinaryExpression(.)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -63,13 +65,14 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -78,11 +81,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg2, expression)
+ parseBangBeforeTypeArguments(arg2)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg2)
listener: handleNoArguments(])
listener: handleSend(arg2, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5_with_parens.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5_with_parens.dart.expect
index f93cac9..e816183 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5_with_parens.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5_with_parens.dart.expect
@@ -25,7 +25,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleParenthesizedExpression(()
handleNonNullAssertExpression(!)
handleParenthesizedExpression(()
@@ -33,7 +33,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg2, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5_with_parens.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5_with_parens.dart.intertwined.expect
index 1f1f0bf..32871e7 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5_with_parens.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex5_with_parens.dart.intertwined.expect
@@ -64,6 +64,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(foo)
listener: handleNoArguments(.)
@@ -73,6 +74,7 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(bar, expressionContinuation)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(bar)
listener: handleNoArguments(!)
@@ -81,7 +83,7 @@
listener: handleNonNullAssertExpression(!)
ensureCloseParen(!, ()
listener: handleParenthesizedExpression(()
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -90,17 +92,18 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureCloseParen(], ()
listener: handleParenthesizedExpression(()
listener: handleNonNullAssertExpression(!)
ensureCloseParen(!, ()
listener: handleParenthesizedExpression(()
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -109,11 +112,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg2, expression)
+ parseBangBeforeTypeArguments(arg2)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg2)
listener: handleNoArguments(])
listener: handleSend(arg2, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6.dart.expect
index ee55e8f..4515902 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6.dart.expect
@@ -25,13 +25,13 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleNonNullAssertExpression(!)
handleIdentifier(arg2, expression)
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg2, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6.dart.intertwined.expect
index 795f82d..863fc57 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6.dart.intertwined.expect
@@ -39,6 +39,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(foo)
listener: handleNoArguments(!)
@@ -49,13 +50,14 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(bar, expressionContinuation)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(bar)
listener: handleNoArguments(!)
listener: handleSend(bar, !)
listener: endBinaryExpression(.)
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -64,13 +66,14 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
listener: handleNonNullAssertExpression(!)
- parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(!, Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -79,11 +82,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg2, expression)
+ parseBangBeforeTypeArguments(arg2)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg2)
listener: handleNoArguments(])
listener: handleSend(arg2, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6_with_parens.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6_with_parens.dart.expect
index d1a1044..899e180c 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6_with_parens.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6_with_parens.dart.expect
@@ -27,7 +27,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleParenthesizedExpression(()
handleNonNullAssertExpression(!)
handleParenthesizedExpression(()
@@ -35,7 +35,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg2, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6_with_parens.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6_with_parens.dart.intertwined.expect
index 41a6cb6..2447074 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6_with_parens.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex6_with_parens.dart.intertwined.expect
@@ -72,6 +72,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(foo)
listener: handleNoArguments(!)
@@ -84,6 +85,7 @@
parseSend(., expressionContinuation)
ensureIdentifier(., expressionContinuation)
listener: handleIdentifier(bar, expressionContinuation)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(bar)
listener: handleNoArguments(!)
@@ -92,7 +94,7 @@
listener: handleNonNullAssertExpression(!)
ensureCloseParen(!, ()
listener: handleParenthesizedExpression(()
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -101,17 +103,18 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureCloseParen(], ()
listener: handleParenthesizedExpression(()
listener: handleNonNullAssertExpression(!)
ensureCloseParen(!, ()
listener: handleParenthesizedExpression(()
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -120,11 +123,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg2, expression)
+ parseBangBeforeTypeArguments(arg2)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg2)
listener: handleNoArguments(])
listener: handleSend(arg2, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex_with_parens.dart.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex_with_parens.dart.expect
index 40baa37..69104ba 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex_with_parens.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex_with_parens.dart.expect
@@ -20,7 +20,7 @@
handleNoTypeArguments(])
handleNoArguments(])
handleSend(arg, ])
- handleIndexedExpression([, ])
+ handleIndexedExpression(null, [, ])
handleExpressionStatement(;)
endBlockFunctionBody(1, {, })
endTopLevelMethod(f, null, })
diff --git a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex_with_parens.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex_with_parens.dart.intertwined.expect
index 0f8729a..1fedf58 100644
--- a/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex_with_parens.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/nullCheckOnIndex_with_parens.dart.intertwined.expect
@@ -48,6 +48,7 @@
parseSend((, expression)
ensureIdentifier((, expression)
listener: handleIdentifier(obj, expression)
+ parseBangBeforeTypeArguments(obj)
listener: handleNoTypeArguments(!)
parseArgumentsOpt(obj)
listener: handleNoArguments(!)
@@ -55,7 +56,7 @@
listener: handleNonNullAssertExpression(!)
ensureCloseParen(!, ()
listener: handleParenthesizedExpression(()
- parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
parseExpression([)
parsePrecedenceExpression([, 1, true)
parseUnaryExpression([, true)
@@ -64,11 +65,12 @@
parseSend([, expression)
ensureIdentifier([, expression)
listener: handleIdentifier(arg, expression)
+ parseBangBeforeTypeArguments(arg)
listener: handleNoTypeArguments(])
parseArgumentsOpt(arg)
listener: handleNoArguments(])
listener: handleSend(arg, ])
- listener: handleIndexedExpression([, ])
+ listener: handleIndexedExpression(null, [, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, })
diff --git a/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.expect b/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.expect
index 6e54c69..6774f62 100644
--- a/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.expect
+++ b/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.expect
@@ -103,14 +103,14 @@
handleNoArguments(?.[)
handleSend(c1, ?.[)
handleLiteralInt(0)
- handleIndexedExpression(?.[, ])
+ handleIndexedExpression(null, ?.[, ])
handleExpressionStatement(;)
handleIdentifier(c1, expression)
handleNoTypeArguments(?.[)
handleNoArguments(?.[)
handleSend(c1, ?.[)
handleLiteralInt(0)
- handleIndexedExpression(?.[, ])
+ handleIndexedExpression(null, ?.[, ])
handleLiteralInt(1)
handleAssignmentExpression(=)
handleExpressionStatement(;)
diff --git a/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.intertwined.expect
index b22c287..771ba51 100644
--- a/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.intertwined.expect
@@ -74,6 +74,7 @@
parseSend(=>, expression)
ensureIdentifier(=>, expression)
listener: handleIdentifier(index, expression)
+ parseBangBeforeTypeArguments(index)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(index)
listener: handleNoArguments(;)
@@ -199,18 +200,19 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(c1, expression)
+ parseBangBeforeTypeArguments(c1)
listener: handleNoTypeArguments(?.[)
parseArgumentsOpt(c1)
listener: handleNoArguments(?.[)
listener: handleSend(c1, ?.[)
- parseArgumentOrIndexStar(c1, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(c1, Instance of 'NoTypeParamOrArg', false)
parseExpression(?.[)
parsePrecedenceExpression(?.[, 1, true)
parseUnaryExpression(?.[, true)
parsePrimary(?.[, expression)
parseLiteralInt(?.[)
listener: handleLiteralInt(0)
- listener: handleIndexedExpression(?.[, ])
+ listener: handleIndexedExpression(null, ?.[, ])
ensureSemicolon(])
listener: handleExpressionStatement(;)
notEofOrValue(}, c1)
@@ -227,18 +229,19 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(c1, expression)
+ parseBangBeforeTypeArguments(c1)
listener: handleNoTypeArguments(?.[)
parseArgumentsOpt(c1)
listener: handleNoArguments(?.[)
listener: handleSend(c1, ?.[)
- parseArgumentOrIndexStar(c1, Instance of 'NoTypeParamOrArg')
+ parseArgumentOrIndexStar(c1, Instance of 'NoTypeParamOrArg', false)
parseExpression(?.[)
parsePrecedenceExpression(?.[, 1, true)
parseUnaryExpression(?.[, true)
parsePrimary(?.[, expression)
parseLiteralInt(?.[)
listener: handleLiteralInt(0)
- listener: handleIndexedExpression(?.[, ])
+ listener: handleIndexedExpression(null, ?.[, ])
parsePrecedenceExpression(=, 1, true)
parseUnaryExpression(=, true)
parsePrimary(=, expression)
diff --git a/pkg/front_end/parser_testcases/nnbd/required_member.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/required_member.dart.intertwined.expect
index 37936b9..5f35664 100644
--- a/pkg/front_end/parser_testcases/nnbd/required_member.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/required_member.dart.intertwined.expect
@@ -91,6 +91,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(foo)
listener: handleNoArguments(.)
@@ -102,6 +103,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(required, expressionContinuation)
+ parseBangBeforeTypeArguments(required)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(required)
listener: handleNoArguments(;)
@@ -129,6 +131,7 @@
ensureIdentifier(;, expression)
inPlainSync()
listener: handleIdentifier(required, expression)
+ parseBangBeforeTypeArguments(required)
listener: handleNoTypeArguments(()
parseArgumentsOpt(required)
parseArguments(required)
@@ -153,6 +156,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(bar, expression)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(()
parseArgumentsOpt(bar)
parseArguments(bar)
@@ -196,6 +200,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(required, expressionContinuation)
+ parseBangBeforeTypeArguments(required)
listener: handleNoTypeArguments(()
parseArgumentsOpt(required)
parseArguments(required)
@@ -239,6 +244,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(required, expressionContinuation)
+ parseBangBeforeTypeArguments(required)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(required)
listener: handleNoArguments(;)
@@ -288,6 +294,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(print, expression)
+ parseBangBeforeTypeArguments(print)
listener: handleNoTypeArguments(()
parseArgumentsOpt(print)
parseArguments(print)
@@ -375,6 +382,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(print, expression)
+ parseBangBeforeTypeArguments(print)
listener: handleNoTypeArguments(()
parseArgumentsOpt(print)
parseArguments(print)
diff --git a/pkg/front_end/parser_testcases/nnbd/required_modifier.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/required_modifier.dart.intertwined.expect
index 831a9fa..9c46206 100644
--- a/pkg/front_end/parser_testcases/nnbd/required_modifier.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/required_modifier.dart.intertwined.expect
@@ -91,6 +91,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(foo, expression)
+ parseBangBeforeTypeArguments(foo)
listener: handleNoTypeArguments(.)
parseArgumentsOpt(foo)
listener: handleNoArguments(.)
@@ -102,6 +103,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(required, expressionContinuation)
+ parseBangBeforeTypeArguments(required)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(required)
listener: handleNoArguments(;)
@@ -129,6 +131,7 @@
ensureIdentifier(;, expression)
inPlainSync()
listener: handleIdentifier(required, expression)
+ parseBangBeforeTypeArguments(required)
listener: handleNoTypeArguments(()
parseArgumentsOpt(required)
parseArguments(required)
@@ -153,6 +156,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(bar, expression)
+ parseBangBeforeTypeArguments(bar)
listener: handleNoTypeArguments(()
parseArgumentsOpt(bar)
parseArguments(bar)
@@ -196,6 +200,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(required, expressionContinuation)
+ parseBangBeforeTypeArguments(required)
listener: handleNoTypeArguments(()
parseArgumentsOpt(required)
parseArguments(required)
@@ -239,6 +244,7 @@
ensureIdentifier(., expressionContinuation)
inPlainSync()
listener: handleIdentifier(required, expressionContinuation)
+ parseBangBeforeTypeArguments(required)
listener: handleNoTypeArguments(;)
parseArgumentsOpt(required)
listener: handleNoArguments(;)
@@ -304,6 +310,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(print, expression)
+ parseBangBeforeTypeArguments(print)
listener: handleNoTypeArguments(()
parseArgumentsOpt(print)
parseArguments(print)
@@ -391,6 +398,7 @@
parseSend({, expression)
ensureIdentifier({, expression)
listener: handleIdentifier(print, expression)
+ parseBangBeforeTypeArguments(print)
listener: handleNoTypeArguments(()
parseArgumentsOpt(print)
parseArguments(print)
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_39326.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_39326.dart.intertwined.expect
index d5b5a6b..774965a 100644
--- a/pkg/front_end/parser_testcases/non-nnbd/issue_39326.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_39326.dart.intertwined.expect
@@ -58,6 +58,7 @@
parseSend(;, expression)
ensureIdentifier(;, expression)
listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
listener: handleNoTypeArguments(?.)
parseArgumentsOpt(c)
listener: handleNoArguments(?.)
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart
new file mode 100644
index 0000000..eb60f9f
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart
@@ -0,0 +1,11 @@
+f() {
+ var a, b, c;
+
+ a?[b]:c;
+ a ? [b] : c;
+ a?[b].toString() : c;
+ a ? [b].toString() : c;
+
+ a ? <dynamic>[b] : <dynamic>[c];
+ a ? ([b]) : ([c]);
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.expect
new file mode 100644
index 0000000..da12b95
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.expect
@@ -0,0 +1,167 @@
+beginCompilationUnit(f)
+ beginMetadataStar(f)
+ endMetadataStar(0)
+ beginTopLevelMember(f)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(f, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ handleNoType(var)
+ beginVariablesDeclaration(a, null, var)
+ handleIdentifier(a, localVariableDeclaration)
+ beginInitializedIdentifier(a)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(a)
+ handleIdentifier(b, localVariableDeclaration)
+ beginInitializedIdentifier(b)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(b)
+ handleIdentifier(c, localVariableDeclaration)
+ beginInitializedIdentifier(c)
+ handleNoVariableInitializer(;)
+ endInitializedIdentifier(c)
+ endVariablesDeclaration(3, ;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(c, ;)
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(c, ;)
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleIdentifier(toString, expressionContinuation)
+ handleNoTypeArguments(()
+ beginArguments(()
+ endArguments(0, (, ))
+ handleSend(toString, :)
+ endBinaryExpression(.)
+ handleConditionalExpressionColon()
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(c, ;)
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleIdentifier(toString, expressionContinuation)
+ handleNoTypeArguments(()
+ beginArguments(()
+ endArguments(0, (, ))
+ handleSend(toString, :)
+ endBinaryExpression(.)
+ handleConditionalExpressionColon()
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(;)
+ handleNoArguments(;)
+ handleSend(c, ;)
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ beginTypeArguments(<)
+ handleIdentifier(dynamic, typeReference)
+ handleNoTypeArguments(>)
+ handleType(dynamic, null)
+ endTypeArguments(1, <, >)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ beginTypeArguments(<)
+ handleIdentifier(dynamic, typeReference)
+ handleNoTypeArguments(>)
+ handleType(dynamic, null)
+ endTypeArguments(1, <, >)
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(c, ])
+ handleLiteralList(1, [, null, ])
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleParenthesizedExpression(()
+ handleConditionalExpressionColon()
+ handleNoTypeArguments([)
+ handleIdentifier(c, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(c, ])
+ handleLiteralList(1, [, null, ])
+ handleParenthesizedExpression(()
+ endConditionalExpression(?, :)
+ handleExpressionStatement(;)
+ endBlockFunctionBody(7, {, })
+endTopLevelMethod(f, null, })
+endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.intertwined.expect
new file mode 100644
index 0000000..1f972aa
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.intertwined.expect
@@ -0,0 +1,612 @@
+parseUnit(f)
+ skipErrorTokens(f)
+ listener: beginCompilationUnit(f)
+ syntheticPreviousToken(f)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(f)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(f)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, f)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(f, topLevelFunctionDeclaration)
+ parseMethodTypeVar(f)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(f, f, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(f, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, var)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
+ looksLikeLocalFunction(a)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ listener: handleNoType(var)
+ listener: beginVariablesDeclaration(a, null, var)
+ parseVariablesDeclarationRest(var, true)
+ parseOptionallyInitializedIdentifier(var)
+ ensureIdentifier(var, localVariableDeclaration)
+ listener: handleIdentifier(a, localVariableDeclaration)
+ listener: beginInitializedIdentifier(a)
+ parseVariableInitializerOpt(a)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(a)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(b, localVariableDeclaration)
+ listener: beginInitializedIdentifier(b)
+ parseVariableInitializerOpt(b)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(b)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(c, localVariableDeclaration)
+ listener: beginInitializedIdentifier(c)
+ parseVariableInitializerOpt(c)
+ listener: handleNoVariableInitializer(;)
+ listener: endInitializedIdentifier(c)
+ ensureSemicolon(c)
+ listener: endVariablesDeclaration(3, ;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(;)
+ listener: handleSend(c, ;)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(c)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(;)
+ listener: handleSend(c, ;)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(c)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parsePrimary(., expressionContinuation)
+ parseSendOrFunctionLiteral(., expressionContinuation)
+ looksLikeFunctionBody(:)
+ parseSend(., expressionContinuation)
+ ensureIdentifier(., expressionContinuation)
+ parseBangBeforeTypeArguments(toString)
+ parseArgumentsOpt(toString)
+ parseArguments(toString)
+ parseArgumentsRest(()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ parsePrimary(., expressionContinuation)
+ parseSendOrFunctionLiteral(., expressionContinuation)
+ looksLikeFunctionBody(:)
+ parseSend(., expressionContinuation)
+ ensureIdentifier(., expressionContinuation)
+ listener: handleIdentifier(toString, expressionContinuation)
+ parseBangBeforeTypeArguments(toString)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(toString)
+ parseArguments(toString)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ listener: endArguments(0, (, ))
+ listener: handleSend(toString, :)
+ listener: endBinaryExpression(.)
+ ensureColon())
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(;)
+ listener: handleSend(c, ;)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(c)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parsePrimary(., expressionContinuation)
+ parseSendOrFunctionLiteral(., expressionContinuation)
+ looksLikeFunctionBody(:)
+ parseSend(., expressionContinuation)
+ ensureIdentifier(., expressionContinuation)
+ parseBangBeforeTypeArguments(toString)
+ parseArgumentsOpt(toString)
+ parseArguments(toString)
+ parseArgumentsRest(()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ parseBangBeforeTypeArguments(c)
+ parseArgumentsOpt(c)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ parsePrimary(., expressionContinuation)
+ parseSendOrFunctionLiteral(., expressionContinuation)
+ looksLikeFunctionBody(:)
+ parseSend(., expressionContinuation)
+ ensureIdentifier(., expressionContinuation)
+ listener: handleIdentifier(toString, expressionContinuation)
+ parseBangBeforeTypeArguments(toString)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(toString)
+ parseArguments(toString)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ listener: endArguments(0, (, ))
+ listener: handleSend(toString, :)
+ listener: endBinaryExpression(.)
+ ensureColon())
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseSendOrFunctionLiteral(:, expression)
+ parseSend(:, expression)
+ ensureIdentifier(:, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(;)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(;)
+ listener: handleSend(c, ;)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(c)
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSetMapOrFunction(?, null)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(dynamic, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(dynamic, null)
+ listener: endTypeArguments(1, <, >)
+ parseLiteralListSuffix(>, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralListSetMapOrFunction(:, null)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(dynamic, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(dynamic, null)
+ listener: endTypeArguments(1, <, >)
+ parseLiteralListSuffix(>, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(])
+ listener: handleSend(c, ])
+ listener: handleLiteralList(1, [, null, ])
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(])
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, a)
+ parseStatement(;)
+ parseStatementX(;)
+ parseExpressionStatementOrDeclarationAfterModifiers(;, ;, null, null, null, false)
+ looksLikeLocalFunction(a)
+ parseExpressionStatement(;)
+ parseExpression(;)
+ parsePrecedenceExpression(;, 1, true)
+ parseUnaryExpression(;, true)
+ parsePrimary(;, expression)
+ parseSendOrFunctionLiteral(;, expression)
+ parseSend(;, expression)
+ ensureIdentifier(;, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseParenthesizedExpressionOrFunctionLiteral(?)
+ parseParenthesizedExpression(?)
+ parseExpressionInParenthesis(?)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix((, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(])
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureCloseParen(], ()
+ listener: handleParenthesizedExpression(()
+ ensureColon())
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseParenthesizedExpressionOrFunctionLiteral(:)
+ parseParenthesizedExpression(:)
+ parseExpressionInParenthesis(:)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix((, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(c)
+ listener: handleNoArguments(])
+ listener: handleSend(c, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureCloseParen(], ()
+ listener: handleParenthesizedExpression(()
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon())
+ listener: handleExpressionStatement(;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(7, {, })
+ listener: endTopLevelMethod(f, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(f)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.parser.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.parser.expect
new file mode 100644
index 0000000..0804398
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.parser.expect
@@ -0,0 +1,23 @@
+f() {
+var a, b, c;
+
+a?[b]:c;
+a ? [b] : c;
+a?[b].toString() : c;
+a ? [b].toString() : c;
+
+a ? <dynamic>[b] : <dynamic>[c];
+a ? ([b]) : ([c]);
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken],[SimpleToken] c[StringToken];[SimpleToken]
+
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken]:[SimpleToken]c[StringToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] [[BeginToken]b[StringToken]][SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken].[SimpleToken]toString[StringToken]([BeginToken])[SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] [[BeginToken]b[StringToken]][SimpleToken].[SimpleToken]toString[StringToken]([BeginToken])[SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+
+a[StringToken] ?[SimpleToken] <[BeginToken]dynamic[KeywordToken]>[SimpleToken][[BeginToken]b[StringToken]][SimpleToken] :[SimpleToken] <[BeginToken]dynamic[KeywordToken]>[SimpleToken][[BeginToken]c[StringToken]][SimpleToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] ([BeginToken][[BeginToken]b[StringToken]][SimpleToken])[SimpleToken] :[SimpleToken] ([BeginToken][[BeginToken]c[StringToken]][SimpleToken])[SimpleToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.scanner.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.scanner.expect
new file mode 100644
index 0000000..0804398
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional.dart.scanner.expect
@@ -0,0 +1,23 @@
+f() {
+var a, b, c;
+
+a?[b]:c;
+a ? [b] : c;
+a?[b].toString() : c;
+a ? [b].toString() : c;
+
+a ? <dynamic>[b] : <dynamic>[c];
+a ? ([b]) : ([c]);
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken],[SimpleToken] c[StringToken];[SimpleToken]
+
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken]:[SimpleToken]c[StringToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] [[BeginToken]b[StringToken]][SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken]?[SimpleToken][[BeginToken]b[StringToken]][SimpleToken].[SimpleToken]toString[StringToken]([BeginToken])[SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] [[BeginToken]b[StringToken]][SimpleToken].[SimpleToken]toString[StringToken]([BeginToken])[SimpleToken] :[SimpleToken] c[StringToken];[SimpleToken]
+
+a[StringToken] ?[SimpleToken] <[BeginToken]dynamic[KeywordToken]>[SimpleToken][[BeginToken]b[StringToken]][SimpleToken] :[SimpleToken] <[BeginToken]dynamic[KeywordToken]>[SimpleToken][[BeginToken]c[StringToken]][SimpleToken];[SimpleToken]
+a[StringToken] ?[SimpleToken] ([BeginToken][[BeginToken]b[StringToken]][SimpleToken])[SimpleToken] :[SimpleToken] ([BeginToken][[BeginToken]c[StringToken]][SimpleToken])[SimpleToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart
new file mode 100644
index 0000000..c95be6d
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart
@@ -0,0 +1,8 @@
+f() {
+ var a, b;
+ return a
+ ? [
+ b([])
+ ]
+ : null;
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.expect
new file mode 100644
index 0000000..6acafe8
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.expect
@@ -0,0 +1,48 @@
+beginCompilationUnit(f)
+ beginMetadataStar(f)
+ endMetadataStar(0)
+ beginTopLevelMember(f)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(f, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ handleNoType(var)
+ beginVariablesDeclaration(a, null, var)
+ handleIdentifier(a, localVariableDeclaration)
+ beginInitializedIdentifier(a)
+ handleNoVariableInitializer(,)
+ endInitializedIdentifier(a)
+ handleIdentifier(b, localVariableDeclaration)
+ beginInitializedIdentifier(b)
+ handleNoVariableInitializer(;)
+ endInitializedIdentifier(b)
+ endVariablesDeclaration(2, ;)
+ beginReturnStatement(return)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(?)
+ handleNoArguments(?)
+ handleSend(a, ?)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ handleNoTypeArguments([])
+ handleLiteralList(0, [, null, ])
+ endArguments(1, (, ))
+ handleSend(b, ])
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ handleLiteralNull(null)
+ endConditionalExpression(?, :)
+ endReturnStatement(true, return, ;)
+ endBlockFunctionBody(2, {, })
+ endTopLevelMethod(f, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.intertwined.expect
new file mode 100644
index 0000000..71628a3
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.intertwined.expect
@@ -0,0 +1,157 @@
+parseUnit(f)
+ skipErrorTokens(f)
+ listener: beginCompilationUnit(f)
+ syntheticPreviousToken(f)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(f)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(f)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, f)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(f, topLevelFunctionDeclaration)
+ parseMethodTypeVar(f)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(f, f, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(f, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, var)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
+ looksLikeLocalFunction(a)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ listener: handleNoType(var)
+ listener: beginVariablesDeclaration(a, null, var)
+ parseVariablesDeclarationRest(var, true)
+ parseOptionallyInitializedIdentifier(var)
+ ensureIdentifier(var, localVariableDeclaration)
+ listener: handleIdentifier(a, localVariableDeclaration)
+ listener: beginInitializedIdentifier(a)
+ parseVariableInitializerOpt(a)
+ listener: handleNoVariableInitializer(,)
+ listener: endInitializedIdentifier(a)
+ parseOptionallyInitializedIdentifier(,)
+ ensureIdentifier(,, localVariableDeclaration)
+ listener: handleIdentifier(b, localVariableDeclaration)
+ listener: beginInitializedIdentifier(b)
+ parseVariableInitializerOpt(b)
+ listener: handleNoVariableInitializer(;)
+ listener: endInitializedIdentifier(b)
+ ensureSemicolon(b)
+ listener: endVariablesDeclaration(2, ;)
+ notEofOrValue(}, return)
+ parseStatement(;)
+ parseStatementX(;)
+ parseReturnStatement(;)
+ listener: beginReturnStatement(return)
+ parseExpression(return)
+ parsePrecedenceExpression(return, 1, true)
+ parseUnaryExpression(return, true)
+ parsePrimary(return, expression)
+ parseSendOrFunctionLiteral(return, expression)
+ parseSend(return, expression)
+ ensureIdentifier(return, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(?)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(?)
+ listener: handleSend(a, ?)
+ parseNullAwareBracketOrConditionalExpressionRest(a, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ looksLikeFunctionBody(])
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(b)
+ parseArgumentsOpt(b)
+ parseArguments(b)
+ parseArgumentsRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseLiteralListSuffix((, null)
+ rewriteSquareBrackets(()
+ link([, ])
+ rewriter()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralNull(:)
+ parseConditionalExpressionRest(a)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ looksLikeFunctionBody(])
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(b)
+ parseArguments(b)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ listener: handleNoTypeArguments([])
+ parseLiteralListSuffix((, null)
+ rewriteSquareBrackets(()
+ link([, ])
+ rewriter()
+ listener: handleLiteralList(0, [, null, ])
+ listener: endArguments(1, (, ))
+ listener: handleSend(b, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralNull(:)
+ listener: handleLiteralNull(null)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(null)
+ listener: endReturnStatement(true, return, ;)
+ inGenerator()
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(2, {, })
+ listener: endTopLevelMethod(f, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(f)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.parser.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.parser.expect
new file mode 100644
index 0000000..42dbfbe
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.parser.expect
@@ -0,0 +1,19 @@
+NOTICE: Stream was rewritten by parser!
+
+f() {
+var a, b;
+return a
+? [
+b([])
+]
+: null;
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken];[SimpleToken]
+return[KeywordToken] a[StringToken]
+?[SimpleToken] [[BeginToken]
+b[StringToken]([BeginToken][[BeginToken]][SimpleToken])[SimpleToken]
+][SimpleToken]
+:[SimpleToken] null[KeywordToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.scanner.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.scanner.expect
new file mode 100644
index 0000000..b22dada
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_2.dart.scanner.expect
@@ -0,0 +1,17 @@
+f() {
+var a, b;
+return a
+? [
+b([])
+]
+: null;
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken];[SimpleToken]
+return[KeywordToken] a[StringToken]
+?[SimpleToken] [[BeginToken]
+b[StringToken]([BeginToken][][SimpleToken])[SimpleToken]
+][SimpleToken]
+:[SimpleToken] null[KeywordToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart
new file mode 100644
index 0000000..86225c5
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart
@@ -0,0 +1,4 @@
+f() {
+ var a;
+ return a != null ? [a] : const [];
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.expect
new file mode 100644
index 0000000..80b0fca
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.expect
@@ -0,0 +1,47 @@
+beginCompilationUnit(f)
+ beginMetadataStar(f)
+ endMetadataStar(0)
+ beginTopLevelMember(f)
+ beginTopLevelMethod(, null)
+ handleNoType()
+ handleIdentifier(f, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ handleNoType(var)
+ beginVariablesDeclaration(a, null, var)
+ handleIdentifier(a, localVariableDeclaration)
+ beginInitializedIdentifier(a)
+ handleNoVariableInitializer(;)
+ endInitializedIdentifier(a)
+ endVariablesDeclaration(1, ;)
+ beginReturnStatement(return)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(!=)
+ handleNoArguments(!=)
+ handleSend(a, !=)
+ beginBinaryExpression(!=)
+ handleLiteralNull(null)
+ endBinaryExpression(!=)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(a, ])
+ handleLiteralList(1, [, null, ])
+ handleConditionalExpressionColon()
+ beginConstLiteral([])
+ handleNoTypeArguments([])
+ handleLiteralList(0, [, const, ])
+ endConstLiteral(;)
+ endConditionalExpression(?, :)
+ endReturnStatement(true, return, ;)
+ endBlockFunctionBody(2, {, })
+ endTopLevelMethod(f, null, })
+ endTopLevelDeclaration()
+endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.intertwined.expect
new file mode 100644
index 0000000..9c4d473
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.intertwined.expect
@@ -0,0 +1,143 @@
+parseUnit(f)
+ skipErrorTokens(f)
+ listener: beginCompilationUnit(f)
+ syntheticPreviousToken(f)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(f)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(f)
+ parseTopLevelMethod(, null, , Instance of 'NoType', null, f)
+ listener: beginTopLevelMethod(, null)
+ listener: handleNoType()
+ ensureIdentifier(, topLevelFunctionDeclaration)
+ listener: handleIdentifier(f, topLevelFunctionDeclaration)
+ parseMethodTypeVar(f)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(f, f, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(f, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, var)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclarationAfterModifiers(var, {, null, var, null, false)
+ looksLikeLocalFunction(a)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ listener: handleNoType(var)
+ listener: beginVariablesDeclaration(a, null, var)
+ parseVariablesDeclarationRest(var, true)
+ parseOptionallyInitializedIdentifier(var)
+ ensureIdentifier(var, localVariableDeclaration)
+ listener: handleIdentifier(a, localVariableDeclaration)
+ listener: beginInitializedIdentifier(a)
+ parseVariableInitializerOpt(a)
+ listener: handleNoVariableInitializer(;)
+ listener: endInitializedIdentifier(a)
+ ensureSemicolon(a)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, return)
+ parseStatement(;)
+ parseStatementX(;)
+ parseReturnStatement(;)
+ listener: beginReturnStatement(return)
+ parseExpression(return)
+ parsePrecedenceExpression(return, 1, true)
+ parseUnaryExpression(return, true)
+ parsePrimary(return, expression)
+ parseSendOrFunctionLiteral(return, expression)
+ parseSend(return, expression)
+ ensureIdentifier(return, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(!=)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(!=)
+ listener: handleSend(a, !=)
+ listener: beginBinaryExpression(!=)
+ parsePrecedenceExpression(!=, 8, true)
+ parseUnaryExpression(!=, true)
+ parsePrimary(!=, expression)
+ parseLiteralNull(!=)
+ listener: handleLiteralNull(null)
+ listener: endBinaryExpression(!=)
+ parseNullAwareBracketOrConditionalExpressionRest(null, Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(a)
+ parseArgumentsOpt(a)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseConstExpression(:)
+ parseLiteralListSuffix(const, const)
+ rewriteSquareBrackets(const)
+ link([, ])
+ rewriter()
+ parseConditionalExpressionRest(null)
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(])
+ listener: handleSend(a, ])
+ listener: handleLiteralList(1, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseConstExpression(:)
+ listener: beginConstLiteral([])
+ listener: handleNoTypeArguments([])
+ parseLiteralListSuffix(const, const)
+ rewriteSquareBrackets(const)
+ link([, ])
+ rewriter()
+ listener: handleLiteralList(0, [, const, ])
+ listener: endConstLiteral(;)
+ listener: endConditionalExpression(?, :)
+ ensureSemicolon(])
+ listener: endReturnStatement(true, return, ;)
+ inGenerator()
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(2, {, })
+ listener: endTopLevelMethod(f, null, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(f)
+ listener: endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.parser.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.parser.expect
new file mode 100644
index 0000000..e8c0a10
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.parser.expect
@@ -0,0 +1,11 @@
+NOTICE: Stream was rewritten by parser!
+
+f() {
+var a;
+return a != null ? [a] : const [];
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken];[SimpleToken]
+return[KeywordToken] a[StringToken] !=[SimpleToken] null[KeywordToken] ?[SimpleToken] [[BeginToken]a[StringToken]][SimpleToken] :[SimpleToken] const[KeywordToken] [[BeginToken]][SimpleToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.scanner.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.scanner.expect
new file mode 100644
index 0000000..f43c25e
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_3.dart.scanner.expect
@@ -0,0 +1,9 @@
+f() {
+var a;
+return a != null ? [a] : const [];
+}
+
+f[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+var[KeywordToken] a[StringToken];[SimpleToken]
+return[KeywordToken] a[StringToken] !=[SimpleToken] null[KeywordToken] ?[SimpleToken] [[BeginToken]a[StringToken]][SimpleToken] :[SimpleToken] const[KeywordToken] [][SimpleToken];[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart
new file mode 100644
index 0000000..a804f15
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart
@@ -0,0 +1,5 @@
+var a, b, c, d, e;
+List get f => a
+ ..addAll(!b && c[d]
+ ? [a, e(f)]
+ : [a]);
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.expect
new file mode 100644
index 0000000..e2a4d63
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.expect
@@ -0,0 +1,84 @@
+beginCompilationUnit(var)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ beginTopLevelMember(var)
+ handleNoType(var)
+ handleIdentifier(a, topLevelVariableDeclaration)
+ handleNoFieldInitializer(,)
+ handleIdentifier(b, topLevelVariableDeclaration)
+ handleNoFieldInitializer(,)
+ handleIdentifier(c, topLevelVariableDeclaration)
+ handleNoFieldInitializer(,)
+ handleIdentifier(d, topLevelVariableDeclaration)
+ handleNoFieldInitializer(,)
+ handleIdentifier(e, topLevelVariableDeclaration)
+ handleNoFieldInitializer(;)
+ endTopLevelFields(null, null, null, var, 5, var, ;)
+endTopLevelDeclaration(List)
+beginMetadataStar(List)
+endMetadataStar(0)
+beginTopLevelMember(List)
+ beginTopLevelMethod(;, null)
+ handleIdentifier(List, typeReference)
+ handleNoTypeArguments(get)
+ handleType(List, null)
+ handleIdentifier(f, topLevelFunctionDeclaration)
+ handleNoTypeVariables(=>)
+ handleNoFormalParameters(=>, MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(..)
+ handleNoArguments(..)
+ handleSend(a, ..)
+ beginCascade(..)
+ handleIdentifier(addAll, expressionContinuation)
+ handleNoTypeArguments(()
+ beginArguments(()
+ handleIdentifier(b, expression)
+ handleNoTypeArguments(&&)
+ handleNoArguments(&&)
+ handleSend(b, &&)
+ handleUnaryPrefixExpression(!)
+ beginBinaryExpression(&&)
+ handleIdentifier(c, expression)
+ handleNoTypeArguments([)
+ handleNoArguments([)
+ handleSend(c, [)
+ handleIdentifier(d, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(d, ])
+ handleIndexedExpression(null, [, ])
+ endBinaryExpression(&&)
+ beginConditionalExpression(?)
+ handleNoTypeArguments([)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(,)
+ handleNoArguments(,)
+ handleSend(a, ,)
+ handleIdentifier(e, expression)
+ handleNoTypeArguments(()
+ beginArguments(()
+ handleIdentifier(f, expression)
+ handleNoTypeArguments())
+ handleNoArguments())
+ handleSend(f, ))
+ endArguments(1, (, ))
+ handleSend(e, ])
+ handleLiteralList(2, [, null, ])
+ handleConditionalExpressionColon()
+ handleNoTypeArguments([)
+ handleIdentifier(a, expression)
+ handleNoTypeArguments(])
+ handleNoArguments(])
+ handleSend(a, ])
+ handleLiteralList(1, [, null, ])
+ endConditionalExpression(?, :)
+ endArguments(1, (, ))
+ handleSend(addAll, ;)
+ endBinaryExpression(..)
+ endCascade()
+ handleExpressionFunctionBody(=>, ;)
+endTopLevelMethod(List, get, ;)
+endTopLevelDeclaration()
+endCompilationUnit(2, )
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.intertwined.expect
new file mode 100644
index 0000000..d9afd54
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.intertwined.expect
@@ -0,0 +1,313 @@
+parseUnit(var)
+ skipErrorTokens(var)
+ listener: beginCompilationUnit(var)
+ syntheticPreviousToken(var)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(var)
+ parseFields(, null, null, null, null, var, var, Instance of 'NoType', a, DeclarationKind.TopLevel)
+ listener: handleNoType(var)
+ ensureIdentifier(var, topLevelVariableDeclaration)
+ listener: handleIdentifier(a, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(a, a, null, var, DeclarationKind.TopLevel)
+ listener: handleNoFieldInitializer(,)
+ ensureIdentifier(,, topLevelVariableDeclaration)
+ listener: handleIdentifier(b, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(b, b, null, var, DeclarationKind.TopLevel)
+ listener: handleNoFieldInitializer(,)
+ ensureIdentifier(,, topLevelVariableDeclaration)
+ listener: handleIdentifier(c, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(c, c, null, var, DeclarationKind.TopLevel)
+ listener: handleNoFieldInitializer(,)
+ ensureIdentifier(,, topLevelVariableDeclaration)
+ listener: handleIdentifier(d, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(d, d, null, var, DeclarationKind.TopLevel)
+ listener: handleNoFieldInitializer(,)
+ ensureIdentifier(,, topLevelVariableDeclaration)
+ listener: handleIdentifier(e, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(e, e, null, var, DeclarationKind.TopLevel)
+ listener: handleNoFieldInitializer(;)
+ listener: endTopLevelFields(null, null, null, var, 5, var, ;)
+ listener: endTopLevelDeclaration(List)
+ parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+ parseMetadataStar(;)
+ listener: beginMetadataStar(List)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(;)
+ listener: beginTopLevelMember(List)
+ parseTopLevelMethod(;, null, ;, Instance of 'SimpleType', get, f)
+ listener: beginTopLevelMethod(;, null)
+ listener: handleIdentifier(List, typeReference)
+ listener: handleNoTypeArguments(get)
+ listener: handleType(List, null)
+ ensureIdentifier(get, topLevelFunctionDeclaration)
+ listener: handleIdentifier(f, topLevelFunctionDeclaration)
+ listener: handleNoTypeVariables(=>)
+ parseGetterOrFormalParameters(f, f, true, MemberKind.TopLevelMethod)
+ listener: handleNoFormalParameters(=>, MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt(f)
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(f, false, false)
+ parseExpressionFunctionBody(=>, false)
+ parseExpression(=>)
+ parsePrecedenceExpression(=>, 1, true)
+ parseUnaryExpression(=>, true)
+ parsePrimary(=>, expression)
+ parseSendOrFunctionLiteral(=>, expression)
+ parseSend(=>, expression)
+ ensureIdentifier(=>, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(..)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(..)
+ listener: handleSend(a, ..)
+ parseCascadeExpression(a)
+ listener: beginCascade(..)
+ parseSend(.., expressionContinuation)
+ ensureIdentifier(.., expressionContinuation)
+ listener: handleIdentifier(addAll, expressionContinuation)
+ parseBangBeforeTypeArguments(addAll)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(addAll)
+ parseArguments(addAll)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrecedenceExpression(!, 16, true)
+ parseUnaryExpression(!, true)
+ parsePrimary(!, expression)
+ parseSendOrFunctionLiteral(!, expression)
+ parseSend(!, expression)
+ ensureIdentifier(!, expression)
+ listener: handleIdentifier(b, expression)
+ parseBangBeforeTypeArguments(b)
+ listener: handleNoTypeArguments(&&)
+ parseArgumentsOpt(b)
+ listener: handleNoArguments(&&)
+ listener: handleSend(b, &&)
+ listener: handleUnaryPrefixExpression(!)
+ listener: beginBinaryExpression(&&)
+ parsePrecedenceExpression(&&, 7, true)
+ parseUnaryExpression(&&, true)
+ parsePrimary(&&, expression)
+ parseSendOrFunctionLiteral(&&, expression)
+ parseSend(&&, expression)
+ ensureIdentifier(&&, expression)
+ listener: handleIdentifier(c, expression)
+ parseBangBeforeTypeArguments(c)
+ listener: handleNoTypeArguments([)
+ parseArgumentsOpt(c)
+ listener: handleNoArguments([)
+ listener: handleSend(c, [)
+ parseArgumentOrIndexStar(c, Instance of 'NoTypeParamOrArg', false)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(d, expression)
+ parseBangBeforeTypeArguments(d)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(d)
+ listener: handleNoArguments(])
+ listener: handleSend(d, ])
+ listener: handleIndexedExpression(null, [, ])
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(a)
+ parseArgumentsOpt(a)
+ parseExpression(,)
+ parsePrecedenceExpression(,, 1, true)
+ parseUnaryExpression(,, true)
+ parsePrimary(,, expression)
+ parseSendOrFunctionLiteral(,, expression)
+ looksLikeFunctionBody(])
+ parseSend(,, expression)
+ ensureIdentifier(,, expression)
+ parseBangBeforeTypeArguments(e)
+ parseArgumentsOpt(e)
+ parseArguments(e)
+ parseArgumentsRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ parseBangBeforeTypeArguments(f)
+ parseArgumentsOpt(f)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralListSuffix(:, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(a)
+ parseArgumentsOpt(a)
+ listener: endBinaryExpression(&&)
+ parseNullAwareBracketOrConditionalExpressionRest(], Instance of 'NoTypeParamOrArg')
+ canParseAsConditional(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(a)
+ parseArgumentsOpt(a)
+ parseExpression(,)
+ parsePrecedenceExpression(,, 1, true)
+ parseUnaryExpression(,, true)
+ parsePrimary(,, expression)
+ parseSendOrFunctionLiteral(,, expression)
+ looksLikeFunctionBody(])
+ parseSend(,, expression)
+ ensureIdentifier(,, expression)
+ parseBangBeforeTypeArguments(e)
+ parseArgumentsOpt(e)
+ parseArguments(e)
+ parseArgumentsRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ parseBangBeforeTypeArguments(f)
+ parseArgumentsOpt(f)
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ parseLiteralListSuffix(:, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ parseBangBeforeTypeArguments(a)
+ parseArgumentsOpt(a)
+ parseConditionalExpressionRest(])
+ listener: beginConditionalExpression(?)
+ parseExpressionWithoutCascade(?)
+ parsePrecedenceExpression(?, 1, false)
+ parseUnaryExpression(?, false)
+ parsePrimary(?, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(?, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(,)
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(,)
+ listener: handleSend(a, ,)
+ parseExpression(,)
+ parsePrecedenceExpression(,, 1, true)
+ parseUnaryExpression(,, true)
+ parsePrimary(,, expression)
+ parseSendOrFunctionLiteral(,, expression)
+ looksLikeFunctionBody(])
+ parseSend(,, expression)
+ ensureIdentifier(,, expression)
+ listener: handleIdentifier(e, expression)
+ parseBangBeforeTypeArguments(e)
+ listener: handleNoTypeArguments(()
+ parseArgumentsOpt(e)
+ parseArguments(e)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(f, expression)
+ parseBangBeforeTypeArguments(f)
+ listener: handleNoTypeArguments())
+ parseArgumentsOpt(f)
+ listener: handleNoArguments())
+ listener: handleSend(f, ))
+ listener: endArguments(1, (, ))
+ listener: handleSend(e, ])
+ listener: handleLiteralList(2, [, null, ])
+ ensureColon(])
+ listener: handleConditionalExpressionColon()
+ parseExpressionWithoutCascade(:)
+ parsePrecedenceExpression(:, 1, false)
+ parseUnaryExpression(:, false)
+ parsePrimary(:, expression)
+ listener: handleNoTypeArguments([)
+ parseLiteralListSuffix(:, null)
+ parseExpression([)
+ parsePrecedenceExpression([, 1, true)
+ parseUnaryExpression([, true)
+ parsePrimary([, expression)
+ parseSendOrFunctionLiteral([, expression)
+ parseSend([, expression)
+ ensureIdentifier([, expression)
+ listener: handleIdentifier(a, expression)
+ parseBangBeforeTypeArguments(a)
+ listener: handleNoTypeArguments(])
+ parseArgumentsOpt(a)
+ listener: handleNoArguments(])
+ listener: handleSend(a, ])
+ listener: handleLiteralList(1, [, null, ])
+ listener: endConditionalExpression(?, :)
+ listener: endArguments(1, (, ))
+ listener: handleSend(addAll, ;)
+ listener: endBinaryExpression(..)
+ parseArgumentOrIndexStar(), Instance of 'NoTypeParamOrArg', false)
+ listener: endCascade()
+ ensureSemicolon())
+ listener: handleExpressionFunctionBody(=>, ;)
+ inGenerator()
+ listener: endTopLevelMethod(List, get, ;)
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(var)
+ listener: endCompilationUnit(2, )
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.parser.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.parser.expect
new file mode 100644
index 0000000..a59f9a5
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.parser.expect
@@ -0,0 +1,11 @@
+var a, b, c, d, e;
+List get f => a
+..addAll(!b && c[d]
+? [a, e(f)]
+: [a]);
+
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken],[SimpleToken] c[StringToken],[SimpleToken] d[StringToken],[SimpleToken] e[StringToken];[SimpleToken]
+List[StringToken] get[KeywordToken] f[StringToken] =>[SimpleToken] a[StringToken]
+..[SimpleToken]addAll[StringToken]([BeginToken]![SimpleToken]b[StringToken] &&[SimpleToken] c[StringToken][[BeginToken]d[StringToken]][SimpleToken]
+?[SimpleToken] [[BeginToken]a[StringToken],[SimpleToken] e[StringToken]([BeginToken]f[StringToken])[SimpleToken]][SimpleToken]
+:[SimpleToken] [[BeginToken]a[StringToken]][SimpleToken])[SimpleToken];[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.scanner.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.scanner.expect
new file mode 100644
index 0000000..a59f9a5
--- /dev/null
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40267_conditional_4.dart.scanner.expect
@@ -0,0 +1,11 @@
+var a, b, c, d, e;
+List get f => a
+..addAll(!b && c[d]
+? [a, e(f)]
+: [a]);
+
+var[KeywordToken] a[StringToken],[SimpleToken] b[StringToken],[SimpleToken] c[StringToken],[SimpleToken] d[StringToken],[SimpleToken] e[StringToken];[SimpleToken]
+List[StringToken] get[KeywordToken] f[StringToken] =>[SimpleToken] a[StringToken]
+..[SimpleToken]addAll[StringToken]([BeginToken]![SimpleToken]b[StringToken] &&[SimpleToken] c[StringToken][[BeginToken]d[StringToken]][SimpleToken]
+?[SimpleToken] [[BeginToken]a[StringToken],[SimpleToken] e[StringToken]([BeginToken]f[StringToken])[SimpleToken]][SimpleToken]
+:[SimpleToken] [[BeginToken]a[StringToken]][SimpleToken])[SimpleToken];[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40288.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40288.dart.intertwined.expect
index ceb712e..8f37fb8 100644
--- a/pkg/front_end/parser_testcases/non-nnbd/issue_40288.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40288.dart.intertwined.expect
@@ -177,6 +177,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(late, expression)
+ parseBangBeforeTypeArguments(late)
listener: handleNoTypeArguments(()
parseArgumentsOpt(late)
parseArguments(late)
@@ -210,6 +211,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(required, expression)
+ parseBangBeforeTypeArguments(required)
listener: handleNoTypeArguments(()
parseArgumentsOpt(required)
parseArguments(required)
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40288_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40288_prime.dart.intertwined.expect
index 319b1ae..d597030 100644
--- a/pkg/front_end/parser_testcases/non-nnbd/issue_40288_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40288_prime.dart.intertwined.expect
@@ -177,6 +177,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(Xlate, expression)
+ parseBangBeforeTypeArguments(Xlate)
listener: handleNoTypeArguments(()
parseArgumentsOpt(Xlate)
parseArguments(Xlate)
@@ -210,6 +211,7 @@
parseSend(=, expression)
ensureIdentifier(=, expression)
listener: handleIdentifier(Xrequired, expression)
+ parseBangBeforeTypeArguments(Xrequired)
listener: handleNoTypeArguments(()
parseArgumentsOpt(Xrequired)
parseArguments(Xrequired)
diff --git a/pkg/front_end/test/covariance_check/covariance_check_test.dart b/pkg/front_end/test/covariance_check/covariance_check_test.dart
index 397169f..99dcbbc 100644
--- a/pkg/front_end/test/covariance_check/covariance_check_test.dart
+++ b/pkg/front_end/test/covariance_check/covariance_check_test.dart
@@ -15,7 +15,6 @@
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
await runTests<String>(dataDir,
args: args,
- supportedMarkers: [cfeMarker],
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest:
diff --git a/pkg/front_end/test/covariance_check/data/marker.options b/pkg/front_end/test/covariance_check/data/marker.options
new file mode 100644
index 0000000..b2053ba
--- /dev/null
+++ b/pkg/front_end/test/covariance_check/data/marker.options
@@ -0,0 +1 @@
+cfe=pkg/front_end/test/covariance_check/covariance_check_test.dart
\ No newline at end of file
diff --git a/pkg/front_end/test/deps_test.dart b/pkg/front_end/test/deps_test.dart
index 849074a..31c05e9 100644
--- a/pkg/front_end/test/deps_test.dart
+++ b/pkg/front_end/test/deps_test.dart
@@ -117,6 +117,7 @@
// Remove white-listed non-dart files.
otherNonDartUris.remove(dotPackagesUri);
otherNonDartUris.remove(repoDir.resolve("sdk/lib/libraries.json"));
+ otherNonDartUris.remove(repoDir.resolve(".dart_tool/package_config.json"));
// Remove white-listed dart files.
for (String s in whitelistedExternalDartFiles) {
diff --git a/pkg/front_end/test/extensions/data/marker.options b/pkg/front_end/test/extensions/data/marker.options
new file mode 100644
index 0000000..a6b1094
--- /dev/null
+++ b/pkg/front_end/test/extensions/data/marker.options
@@ -0,0 +1 @@
+cfe=pkg/front_end/test/extensions/extensions_test.dart
diff --git a/pkg/front_end/test/extensions/extensions_test.dart b/pkg/front_end/test/extensions/extensions_test.dart
index f4b0f2e..27e21fc 100644
--- a/pkg/front_end/test/extensions/extensions_test.dart
+++ b/pkg/front_end/test/extensions/extensions_test.dart
@@ -24,7 +24,6 @@
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
await runTests<Features>(dataDir,
args: args,
- supportedMarkers: [cfeMarker],
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(const ExtensionsDataComputer(), [
diff --git a/pkg/front_end/test/fasta/messages_suite.dart b/pkg/front_end/test/fasta/messages_suite.dart
index 299e1da..03da9f6 100644
--- a/pkg/front_end/test/fasta/messages_suite.dart
+++ b/pkg/front_end/test/fasta/messages_suite.dart
@@ -30,9 +30,14 @@
import 'package:front_end/src/api_prototype/compiler_options.dart'
show CompilerOptions;
+import 'package:front_end/src/api_prototype/experimental_flags.dart'
+ show ExperimentalFlag;
+
import 'package:front_end/src/api_prototype/memory_file_system.dart'
show MemoryFileSystem;
+import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
+
import 'package:front_end/src/compute_platform_binaries_location.dart'
show computePlatformBinariesLocation;
@@ -65,6 +70,23 @@
this.example, this.problem);
}
+class Configuration {
+ final NnbdMode nnbdMode;
+
+ const Configuration(this.nnbdMode);
+
+ CompilerOptions apply(CompilerOptions options) {
+ if (nnbdMode != null) {
+ options.experimentalFlags[ExperimentalFlag.nonNullable] = true;
+ options.performNnbdChecks = true;
+ options.nnbdMode = nnbdMode;
+ }
+ return options;
+ }
+
+ static const Configuration defaultConfiguration = const Configuration(null);
+}
+
class MessageTestSuite extends ChainContext {
final List<Step> steps = const <Step>[
const Validate(),
@@ -119,6 +141,7 @@
const String spellingPostMessage = "\nIf the word(s) look okay, update "
"'spell_checking_list_messages.txt' or "
"'spell_checking_list_common.txt'.";
+ Configuration configuration;
Source source;
List<String> formatSpellingMistakes(
@@ -285,6 +308,16 @@
}
break;
+ case "configuration":
+ if (value == "nnbd-weak") {
+ configuration = const Configuration(NnbdMode.Weak);
+ } else if (value == "nnbd-strong") {
+ configuration = const Configuration(NnbdMode.Strong);
+ } else {
+ throw new ArgumentError("Unknown configuration '$value'.");
+ }
+ break;
+
default:
unknownKeys.add(key);
}
@@ -296,6 +329,10 @@
example.allowMoreCodes = exampleAllowMoreCodes;
}
}
+ for (Example example in examples) {
+ example.configuration =
+ configuration ?? Configuration.defaultConfiguration;
+ }
MessageTestDescription createDescription(
String subName, Example example, String problem,
@@ -434,6 +471,8 @@
bool allowMoreCodes = false;
+ Configuration configuration;
+
Example(this.name, this.expectedCode);
YamlNode get node;
@@ -559,8 +598,11 @@
final Example example;
@override
final bool allowMoreCodes;
+
PartWrapExample(String name, String code, this.allowMoreCodes, this.example)
- : super(name, code);
+ : super(name, code) {
+ configuration = example.configuration;
+ }
@override
Uint8List get bytes => throw "Unsupported: PartWrapExample.bytes";
@@ -650,14 +692,14 @@
List<DiagnosticMessage> messages = <DiagnosticMessage>[];
await suite.compiler.batchCompile(
- new CompilerOptions()
+ example.configuration.apply(new CompilerOptions()
..sdkSummary = computePlatformBinariesLocation(forceBuildDir: true)
.resolve("vm_platform_strong.dill")
..target = new VmTarget(new TargetFlags())
..fileSystem = new HybridFileSystem(suite.fileSystem)
..packagesFileUri = dotPackagesUri
..onDiagnostic = messages.add
- ..environmentDefines = const {},
+ ..environmentDefines = const {}),
main,
output);
diff --git a/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart b/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart
index edca490..a3abfd1 100644
--- a/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart
+++ b/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart
@@ -27,7 +27,7 @@
var a = _makeToken(0, 'a');
var b = _makeToken(1, 'b');
var eof = _link([a, b]);
- var rewriter = new TokenStreamRewriter();
+ var rewriter = new TokenStreamRewriterImpl();
var openParen = rewriter.insertParens(a, false);
var closeParen = openParen.next;
@@ -48,7 +48,7 @@
var a = _makeToken(0, 'a');
var b = _makeToken(1, 'b');
var eof = _link([a, b]);
- var rewriter = new TokenStreamRewriter();
+ var rewriter = new TokenStreamRewriterImpl();
var openParen = rewriter.insertParens(a, true);
var identifier = openParen.next;
var closeParen = identifier.next;
@@ -74,7 +74,7 @@
var a = _makeToken(0, 'a');
var b = _makeToken(1, 'b');
var eof = _link([a, b]);
- var rewriter = new TokenStreamRewriter();
+ var rewriter = new TokenStreamRewriterImpl();
var identifier = rewriter.insertSyntheticIdentifier(a);
expect(identifier.lexeme, '');
@@ -92,7 +92,7 @@
var a = _makeToken(0, 'a');
var b = _makeToken(1, 'b');
var eof = _link([a]);
- var rewriter = new TokenStreamRewriter();
+ var rewriter = new TokenStreamRewriterImpl();
expect(rewriter.insertToken(a, b), same(b));
expect(a.next, same(b));
expect(b.next, same(eof));
@@ -105,7 +105,7 @@
var b = _makeToken(1, 'b');
var c = _makeToken(2, 'c');
_link([a, c]);
- var rewriter = new TokenStreamRewriter();
+ var rewriter = new TokenStreamRewriterImpl();
rewriter.insertToken(a, b);
expect(a.next, same(b));
expect(b.next, same(c));
@@ -118,7 +118,7 @@
var d = _makeToken(3, 'd');
var e = _makeToken(4, 'e');
_link([a, c, e]);
- var rewriter = new TokenStreamRewriter();
+ var rewriter = new TokenStreamRewriterImpl();
rewriter.insertToken(c, d);
expect(c.next, same(d));
expect(d.next, same(e));
@@ -137,7 +137,7 @@
Token close = open.endGroup;
expect(close.isSynthetic, isTrue);
expect(close.next.isEof, isTrue);
- var rewriter = new TokenStreamRewriter();
+ var rewriter = new TokenStreamRewriterImpl();
Token result = rewriter.moveSynthetic(open.next, close);
expect(result, close);
@@ -155,7 +155,7 @@
var f = _makeToken(5, 'f');
_link([a, b, e, f]);
_link([c, d]);
- var rewriter = new TokenStreamRewriter();
+ var rewriter = new TokenStreamRewriterImpl();
rewriter.replaceTokenFollowing(b, c);
expect(a.next, same(b));
expect(b.next, same(c));
@@ -169,7 +169,7 @@
var c = _makeToken(2, 'c');
var d = _makeToken(3, 'd');
_link([a, b, d]);
- var rewriter = new TokenStreamRewriter();
+ var rewriter = new TokenStreamRewriterImpl();
rewriter.replaceTokenFollowing(a, c);
expect(a.next, same(c));
expect(c.next, same(d));
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index 093d089..ce31947 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -39,6 +39,8 @@
import 'package:front_end/src/base/command_line_options.dart';
+import 'package:front_end/src/base/nnbd_mode.dart';
+
import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
@@ -71,7 +73,7 @@
show ChangedStructureNotifier;
import 'package:kernel/target/targets.dart'
- show TargetFlags, DiagnosticReporter;
+ show NoneTarget, Target, TargetFlags, DiagnosticReporter;
import 'package:testing/testing.dart'
show
@@ -152,14 +154,20 @@
final bool forceLateLowering;
final bool forceNnbdChecks;
final bool forceNoExplicitGetterCalls;
+ final bool nnbdAgnosticMode;
+ final String target;
TestOptions(this.experimentalFlags,
{this.forceLateLowering: false,
this.forceNnbdChecks: false,
- this.forceNoExplicitGetterCalls: false})
+ this.forceNoExplicitGetterCalls: false,
+ this.nnbdAgnosticMode: false,
+ this.target: "vm"})
: assert(forceLateLowering != null),
assert(forceNnbdChecks != null),
- assert(forceNoExplicitGetterCalls != null);
+ assert(forceNoExplicitGetterCalls != null),
+ assert(nnbdAgnosticMode != null),
+ assert(target != null);
Map<ExperimentalFlag, bool> computeExperimentalFlags(
Map<ExperimentalFlag, bool> forcedExperimentalFlags) {
@@ -171,10 +179,13 @@
class LinkDependenciesOptions {
final Set<Uri> content;
+ final bool nnbdAgnosticMode;
Component component;
String errors;
- LinkDependenciesOptions(this.content) : assert(content != null);
+ LinkDependenciesOptions(this.content, {this.nnbdAgnosticMode})
+ : assert(content != null),
+ assert(nnbdAgnosticMode != null);
}
class FastaContext extends ChainContext with MatchContext {
@@ -277,18 +288,22 @@
TestOptions _computeTestOptionsForDirectory(Directory directory) {
TestOptions testOptions = _testOptions[directory.uri];
if (testOptions == null) {
+ bool forceLateLowering = false;
+ bool forceNnbdChecks = false;
+ bool forceNoExplicitGetterCalls = false;
+ bool nnbdAgnosticMode = false;
+ String target = "vm";
if (directory.uri == baseUri) {
testOptions = new TestOptions({},
- forceLateLowering: false,
- forceNnbdChecks: false,
- forceNoExplicitGetterCalls: false);
+ forceLateLowering: forceLateLowering,
+ forceNnbdChecks: forceNnbdChecks,
+ forceNoExplicitGetterCalls: forceNoExplicitGetterCalls,
+ nnbdAgnosticMode: nnbdAgnosticMode,
+ target: target);
} else {
File optionsFile =
new File.fromUri(directory.uri.resolve('test.options'));
if (optionsFile.existsSync()) {
- bool forceLateLowering = false;
- bool forceNnbdChecks = false;
- bool forceNoExplicitGetterCalls = false;
List<String> experimentalFlagsArguments = [];
for (String line in optionsFile.readAsStringSync().split('\n')) {
line = line.trim();
@@ -301,6 +316,13 @@
forceNnbdChecks = true;
} else if (line.startsWith(Flags.forceNoExplicitGetterCalls)) {
forceNoExplicitGetterCalls = true;
+ } else if (line.startsWith(Flags.forceNoExplicitGetterCalls)) {
+ forceNoExplicitGetterCalls = true;
+ } else if (line.startsWith(Flags.nnbdAgnosticMode)) {
+ nnbdAgnosticMode = true;
+ } else if (line.startsWith(Flags.target) &&
+ line.indexOf('=') == Flags.target.length) {
+ target = line.substring(Flags.target.length + 1);
} else if (line.isNotEmpty) {
throw new UnsupportedError("Unsupported test option '$line'");
}
@@ -314,7 +336,9 @@
throw new ArgumentError(message)),
forceLateLowering: forceLateLowering,
forceNnbdChecks: forceNnbdChecks,
- forceNoExplicitGetterCalls: forceNoExplicitGetterCalls);
+ forceNoExplicitGetterCalls: forceNoExplicitGetterCalls,
+ nnbdAgnosticMode: nnbdAgnosticMode,
+ target: target);
} else {
testOptions = _computeTestOptionsForDirectory(directory.parent);
}
@@ -352,7 +376,11 @@
..environmentDefines = {}
..experimentalFlags =
testOptions.computeExperimentalFlags(experimentalFlags)
- ..nnbdStrongMode = !weak
+ ..nnbdMode = weak
+ ? NnbdMode.Weak
+ : (testOptions.nnbdAgnosticMode
+ ? NnbdMode.Agnostic
+ : NnbdMode.Strong)
..librariesSpecificationUri = librariesSpecificationUri);
uriTranslator = await options.getUriTranslator();
_uriTranslators[librariesSpecificationUri] = uriTranslator;
@@ -370,18 +398,24 @@
File optionsFile =
new File.fromUri(directory.uri.resolve('link.options'));
Set<Uri> content = new Set<Uri>();
+ bool nnbdAgnosticMode = false;
if (optionsFile.existsSync()) {
for (String line in optionsFile.readAsStringSync().split('\n')) {
line = line.trim();
if (line.isEmpty) continue;
- File f = new File.fromUri(description.uri.resolve(line));
- if (!f.existsSync()) {
- throw new UnsupportedError("No file found: $f ($line)");
+ if (line.startsWith(Flags.nnbdAgnosticMode)) {
+ nnbdAgnosticMode = true;
+ } else {
+ File f = new File.fromUri(description.uri.resolve(line));
+ if (!f.existsSync()) {
+ throw new UnsupportedError("No file found: $f ($line)");
+ }
+ content.add(f.uri);
}
- content.add(f.uri);
}
}
- linkDependenciesOptions = new LinkDependenciesOptions(content);
+ linkDependenciesOptions = new LinkDependenciesOptions(content,
+ nnbdAgnosticMode: nnbdAgnosticMode);
_linkDependencies[directory.uri] = linkDependenciesOptions;
}
return linkDependenciesOptions;
@@ -490,7 +524,7 @@
}
}
-class Run extends Step<Uri, int, FastaContext> {
+class Run extends Step<ComponentResult, int, FastaContext> {
const Run();
String get name => "run";
@@ -499,21 +533,30 @@
bool get isRuntime => true;
- Future<Result<int>> run(Uri uri, FastaContext context) async {
- if (context.platformUri == null) {
- throw "Executed `Run` step before initializing the context.";
+ Future<Result<int>> run(ComponentResult result, FastaContext context) async {
+ TestOptions testOptions = context.computeTestOptions(result.description);
+ switch (testOptions.target) {
+ case "vm":
+ if (context.platformUri == null) {
+ throw "Executed `Run` step before initializing the context.";
+ }
+ File generated = new File.fromUri(result.outputUri);
+ StdioProcess process;
+ try {
+ var args = <String>[];
+ args.add(generated.path);
+ process = await StdioProcess.run(context.vm.toFilePath(), args);
+ print(process.output);
+ } finally {
+ await generated.parent.delete(recursive: true);
+ }
+ return process.toResult();
+ case "none":
+ return pass(0);
+ default:
+ throw new ArgumentError(
+ "Unsupported run target '${testOptions.target}'.");
}
- File generated = new File.fromUri(uri);
- StdioProcess process;
- try {
- var args = <String>[];
- args.add(generated.path);
- process = await StdioProcess.run(context.vm.toFilePath(), args);
- print(process.output);
- } finally {
- await generated.parent.delete(recursive: true);
- }
- return process.toResult();
}
}
@@ -539,30 +582,44 @@
LinkDependenciesOptions linkDependenciesOptions =
context.computeLinkDependenciesOptions(description);
TestOptions testOptions = context.computeTestOptions(description);
- ProcessedOptions options = new ProcessedOptions(
- options: new CompilerOptions()
- ..onDiagnostic = (DiagnosticMessage message) {
- if (errors.isNotEmpty) {
- errors.write("\n\n");
+ Map<ExperimentalFlag, bool> experimentalFlags =
+ testOptions.computeExperimentalFlags(context.experimentalFlags);
+ NnbdMode nnbdMode = context.weak
+ ? NnbdMode.Weak
+ : (testOptions.nnbdAgnosticMode ? NnbdMode.Agnostic : NnbdMode.Strong);
+ List<Uri> inputs = <Uri>[description.uri];
+
+ ProcessedOptions createProcessedOptions(NnbdMode nnbdMode) {
+ return new ProcessedOptions(
+ options: new CompilerOptions()
+ ..onDiagnostic = (DiagnosticMessage message) {
+ if (errors.isNotEmpty) {
+ errors.write("\n\n");
+ }
+ errors.writeAll(message.plainTextFormatted, "\n");
}
- errors.writeAll(message.plainTextFormatted, "\n");
- }
- ..environmentDefines = {}
- ..experimentalFlags =
- testOptions.computeExperimentalFlags(context.experimentalFlags)
- ..performNnbdChecks = testOptions.forceNnbdChecks
- ..nnbdStrongMode = !context.weak
- ..librariesSpecificationUri = librariesSpecificationUri,
- inputs: <Uri>[description.uri]);
+ ..environmentDefines = {}
+ ..experimentalFlags = experimentalFlags
+ ..performNnbdChecks = testOptions.forceNnbdChecks
+ ..nnbdMode = nnbdMode
+ ..librariesSpecificationUri = librariesSpecificationUri,
+ inputs: inputs);
+ }
// Disable colors to ensure that expectation files are the same across
// platforms and independent of stdin/stderr.
colors.enableColors = false;
+ ProcessedOptions options = createProcessedOptions(nnbdMode);
+
if (linkDependenciesOptions.content.isNotEmpty &&
linkDependenciesOptions.component == null) {
// Compile linked dependency.
- await CompilerContext.runWithOptions(options, (_) async {
+ ProcessedOptions linkOptions = options;
+ if (linkDependenciesOptions.nnbdAgnosticMode) {
+ linkOptions = createProcessedOptions(NnbdMode.Agnostic);
+ }
+ await CompilerContext.runWithOptions(linkOptions, (_) async {
KernelTarget sourceTarget = await outlineInitialization(context,
description, testOptions, linkDependenciesOptions.content.toList());
if (linkDependenciesOptions.errors != null) {
@@ -618,14 +675,14 @@
await instrumentation.fixSource(description.uri, false);
} else {
return new Result<ComponentResult>(
- new ComponentResult(p, userLibraries),
+ new ComponentResult(description, p, userLibraries),
context.expectationSet["InstrumentationMismatch"],
instrumentation.problemsAsString,
null);
}
}
}
- return pass(new ComponentResult(p, userLibraries));
+ return pass(new ComponentResult(description, p, userLibraries));
});
}
@@ -639,13 +696,26 @@
Ticker ticker = new Ticker();
UriTranslator uriTranslator =
await context.computeUriTranslator(description);
+ TargetFlags targetFlags = new TargetFlags(
+ forceLateLoweringForTesting: testOptions.forceLateLowering,
+ forceNoExplicitGetterCallsForTesting:
+ testOptions.forceNoExplicitGetterCalls);
+ Target target;
+ switch (testOptions.target) {
+ case "vm":
+ target = new TestVmTarget(targetFlags);
+ break;
+ case "none":
+ target = new NoneTarget(targetFlags);
+ break;
+ default:
+ throw new ArgumentError(
+ "Unsupported test target '${testOptions.target}'.");
+ }
DillTarget dillTarget = new DillTarget(
ticker,
uriTranslator,
- new TestVmTarget(new TargetFlags(
- forceLateLoweringForTesting: testOptions.forceLateLowering,
- forceNoExplicitGetterCallsForTesting:
- testOptions.forceNoExplicitGetterCalls)),
+ target,
);
dillTarget.loader.appendLibraries(platform);
if (alsoAppend != null) {
@@ -670,14 +740,18 @@
Component component = result.component;
KernelTarget sourceTarget = context.componentToTarget[component];
context.componentToTarget.remove(component);
- TestVmTarget backendTarget = sourceTarget.backendTarget;
- backendTarget.enabled = true;
+ Target backendTarget = sourceTarget.backendTarget;
+ if (backendTarget is TestVmTarget) {
+ backendTarget.enabled = true;
+ }
try {
if (sourceTarget.loader.coreTypes != null) {
sourceTarget.runBuildTransformations();
}
} finally {
- backendTarget.enabled = false;
+ if (backendTarget is TestVmTarget) {
+ backendTarget.enabled = false;
+ }
}
List<String> errors = VerifyTransformed.verify(component);
if (errors.isNotEmpty) {
diff --git a/pkg/front_end/test/fasta/type_inference/type_schema_environment_nnbd_test.dart b/pkg/front_end/test/fasta/type_inference/type_schema_environment_nnbd_test.dart
index 2efcb99..bf27d78 100644
--- a/pkg/front_end/test/fasta/type_inference/type_schema_environment_nnbd_test.dart
+++ b/pkg/front_end/test/fasta/type_inference/type_schema_environment_nnbd_test.dart
@@ -1196,12 +1196,22 @@
}
void test_unknown_at_top() {
- _initialize("class A;");
+ const String testSdk = """
+ class A;
+ class Pair<X, Y>;
+ """;
+ _initialize(testSdk);
expect(
env.isSubtypeOf(toType("A*"), new UnknownType(),
SubtypeCheckMode.ignoringNullabilities),
isTrue);
+ expect(
+ env.isSubtypeOf(
+ toType("Pair<A*, Null>*"),
+ toType("Pair<unknown, unknown>*"),
+ SubtypeCheckMode.withNullabilities),
+ isTrue);
}
DartType _list(DartType elementType) {
diff --git a/pkg/front_end/test/fasta/type_inference/type_schema_environment_test.dart b/pkg/front_end/test/fasta/type_inference/type_schema_environment_test.dart
index 2b1387b..485fe51 100644
--- a/pkg/front_end/test/fasta/type_inference/type_schema_environment_test.dart
+++ b/pkg/front_end/test/fasta/type_inference/type_schema_environment_test.dart
@@ -778,6 +778,10 @@
expect(
env.isSubtypeOf(A, unknownType, SubtypeCheckMode.ignoringNullabilities),
isTrue);
+ expect(
+ env.isSubtypeOf(_map(A, A), _map(unknownType, unknownType),
+ SubtypeCheckMode.ignoringNullabilities),
+ isTrue);
}
Class _addClass(Class c) {
diff --git a/pkg/front_end/test/id_testing/data/marker.options b/pkg/front_end/test/id_testing/data/marker.options
new file mode 100644
index 0000000..bb35ae5
--- /dev/null
+++ b/pkg/front_end/test/id_testing/data/marker.options
@@ -0,0 +1,2 @@
+cfe=pkg/front_end/test/id_testing/id_testing_test.dart
+dart2js=tests/compiler/dart2js/equivalence/id_testing_test.dart
diff --git a/pkg/front_end/test/id_testing/id_testing_test.dart b/pkg/front_end/test/id_testing/id_testing_test.dart
index 248223c..6de53f5 100644
--- a/pkg/front_end/test/id_testing/id_testing_test.dart
+++ b/pkg/front_end/test/id_testing/id_testing_test.dart
@@ -32,7 +32,6 @@
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
await runTests<String>(dataDir,
args: args,
- supportedMarkers: [cfeMarker, dart2jsMarker],
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(const IdTestingDataComputer(), [defaultCfeConfig]));
diff --git a/pkg/front_end/test/id_tests/assigned_variables_test.dart b/pkg/front_end/test/id_tests/assigned_variables_test.dart
index 31fe46c..cdff0ce 100644
--- a/pkg/front_end/test/id_tests/assigned_variables_test.dart
+++ b/pkg/front_end/test/id_tests/assigned_variables_test.dart
@@ -23,7 +23,6 @@
'data'));
await runTests<_Data>(dataDir,
args: args,
- supportedMarkers: cfeAnalyzerMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor<_Data>(
diff --git a/pkg/front_end/test/id_tests/constant_test.dart b/pkg/front_end/test/id_tests/constant_test.dart
index 7c83a40..8de3c2e 100644
--- a/pkg/front_end/test/id_tests/constant_test.dart
+++ b/pkg/front_end/test/id_tests/constant_test.dart
@@ -27,7 +27,6 @@
.resolve('../../../_fe_analyzer_shared/test/constants/data'));
await runTests<String>(dataDir,
args: args,
- supportedMarkers: sharedMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(const ConstantsDataComputer(), [defaultCfeConfig]));
diff --git a/pkg/front_end/test/id_tests/definite_assignment_test.dart b/pkg/front_end/test/id_tests/definite_assignment_test.dart
index 3a69242..02067af 100644
--- a/pkg/front_end/test/id_tests/definite_assignment_test.dart
+++ b/pkg/front_end/test/id_tests/definite_assignment_test.dart
@@ -20,7 +20,6 @@
'data'));
await runTests<String>(dataDir,
args: args,
- supportedMarkers: cfeAnalyzerMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(
diff --git a/pkg/front_end/test/id_tests/inheritance_test.dart b/pkg/front_end/test/id_tests/inheritance_test.dart
index 98389b7..fa0b755 100644
--- a/pkg/front_end/test/id_tests/inheritance_test.dart
+++ b/pkg/front_end/test/id_tests/inheritance_test.dart
@@ -3,14 +3,15 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:io' show Directory, Platform;
+
import 'package:_fe_analyzer_shared/src/testing/id.dart';
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:front_end/src/api_prototype/experimental_flags.dart';
import 'package:front_end/src/fasta/kernel/class_hierarchy_builder.dart';
import 'package:front_end/src/fasta/kernel/kernel_api.dart';
+import 'package:front_end/src/testing/id_extractor.dart';
import 'package:front_end/src/testing/id_testing_helper.dart';
import 'package:front_end/src/testing/id_testing_utils.dart';
-import 'package:front_end/src/testing/id_extractor.dart';
import 'package:kernel/ast.dart';
const String cfeFromBuilderMarker = 'cfe:builder';
@@ -20,7 +21,6 @@
.resolve('../../../_fe_analyzer_shared/test/inheritance/data'));
await runTests<String>(dataDir,
args: args,
- supportedMarkers: [cfeMarker, cfeFromBuilderMarker],
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(const InheritanceDataComputer(), [
@@ -84,7 +84,9 @@
: super(_compilerResult, actualMap);
ClassHierarchy get _hierarchy => _compilerResult.classHierarchy;
+
CoreTypes get _coreTypes => _compilerResult.coreTypes;
+
ClassHierarchyBuilder get _classHierarchyBuilder =>
_compilerResult.kernelTargetForTesting.loader.builderHierarchy;
@@ -96,6 +98,7 @@
@override
void computeForClass(Class node) {
super.computeForClass(node);
+ if (node.isAnonymousMixin) return;
// TODO(johnniwinther): Also compute member data from builders.
Set<Name> getters = _hierarchy
.getInterfaceMembers(node)
@@ -104,12 +107,14 @@
Set<Name> setters = _hierarchy
.getInterfaceMembers(node, setters: true)
.where((Member member) =>
- member is Procedure && member.kind == ProcedureKind.Setter)
+ member is Procedure && member.kind == ProcedureKind.Setter ||
+ member is Field && member.hasSetter)
.map((Member member) => member.name)
.toSet();
- void addMember(Name name, {bool setter}) {
- Member member = _hierarchy.getInterfaceMember(node, name, setter: setter);
+ void addMember(Name name, {bool isSetter}) {
+ Member member =
+ _hierarchy.getInterfaceMember(node, name, setter: isSetter);
if (member.enclosingClass == _coreTypes.objectClass) {
return;
}
@@ -138,7 +143,7 @@
}
String memberName = name.name;
- if (member is Procedure && member.kind == ProcedureKind.Setter) {
+ if (isSetter) {
memberName += '=';
}
MemberId id = new MemberId.internal(memberName, className: node.name);
@@ -154,29 +159,31 @@
nodeWithOffset?.location?.file,
nodeWithOffset?.fileOffset,
id,
- typeToText(type, TypeRepresentation.implicitUndetermined),
+ typeToText(type, TypeRepresentation.analyzerNonNullableByDefault),
member);
}
for (Name name in getters) {
- addMember(name, setter: false);
+ addMember(name, isSetter: false);
}
for (Name name in setters) {
- addMember(name, setter: true);
+ addMember(name, isSetter: true);
}
}
@override
String computeClassValue(Id id, Class node) {
+ if (node.isAnonymousMixin) return null;
if (_config.marker == cfeMarker) {
List<String> supertypes = <String>[];
for (Class superclass in computeAllSuperclasses(node)) {
Supertype supertype = _hierarchy.getClassAsInstanceOf(node, superclass);
+ if (supertype.classNode.isAnonymousMixin) continue;
assert(
supertype != null, "No instance of $superclass found for $node.");
supertypes.add(supertypeToText(
- supertype, TypeRepresentation.implicitUndetermined));
+ supertype, TypeRepresentation.analyzerNonNullableByDefault));
}
supertypes.sort();
return supertypes.join(',');
@@ -186,10 +193,11 @@
Set<String> supertypes = <String>{};
void addDartType(DartType type) {
if (type is InterfaceType) {
+ if (type.classNode.isAnonymousMixin) return;
Supertype supertype =
new Supertype(type.classNode, type.typeArguments);
supertypes.add(supertypeToText(
- supertype, TypeRepresentation.implicitUndetermined));
+ supertype, TypeRepresentation.analyzerNonNullableByDefault));
}
}
diff --git a/pkg/front_end/test/id_tests/nullability_test.dart b/pkg/front_end/test/id_tests/nullability_test.dart
index b22dd52..7b1e603 100644
--- a/pkg/front_end/test/id_tests/nullability_test.dart
+++ b/pkg/front_end/test/id_tests/nullability_test.dart
@@ -15,7 +15,6 @@
'../../../_fe_analyzer_shared/test/flow_analysis/nullability/data'));
await runTests<String>(dataDir,
args: args,
- supportedMarkers: cfeAnalyzerMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(
diff --git a/pkg/front_end/test/id_tests/reachability_test.dart b/pkg/front_end/test/id_tests/reachability_test.dart
index 442be6c..6c469fa 100644
--- a/pkg/front_end/test/id_tests/reachability_test.dart
+++ b/pkg/front_end/test/id_tests/reachability_test.dart
@@ -19,7 +19,6 @@
'../../../_fe_analyzer_shared/test/flow_analysis/reachability/data'));
await runTests<Set<_ReachabilityAssertion>>(dataDir,
args: args,
- supportedMarkers: cfeAnalyzerMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(
diff --git a/pkg/front_end/test/id_tests/type_promotion_test.dart b/pkg/front_end/test/id_tests/type_promotion_test.dart
index 5d64352..58dd40f 100644
--- a/pkg/front_end/test/id_tests/type_promotion_test.dart
+++ b/pkg/front_end/test/id_tests/type_promotion_test.dart
@@ -17,7 +17,6 @@
'data'));
await runTests<DartType>(dataDir,
args: args,
- supportedMarkers: cfeAnalyzerMarkers,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(
@@ -63,7 +62,7 @@
@override
String getText(DartType actualData) =>
- typeToText(actualData, TypeRepresentation.nonNullableByDefault);
+ typeToText(actualData, TypeRepresentation.analyzerNonNullableByDefault);
@override
String isAsExpected(DartType actualData, String expectedData) {
diff --git a/pkg/front_end/test/incremental_compiler_leak_test.dart b/pkg/front_end/test/incremental_compiler_leak_test.dart
new file mode 100644
index 0000000..03f68dd
--- /dev/null
+++ b/pkg/front_end/test/incremental_compiler_leak_test.dart
@@ -0,0 +1,251 @@
+import 'dart:async';
+import 'dart:io';
+
+import "package:vm_service/vm_service.dart" as vmService;
+import "package:vm_service/vm_service_io.dart" as vmService;
+
+import "vm_service_heap_helper.dart" as helper;
+import "simple_stats.dart";
+
+const int limit = 10;
+
+main(List<String> args) async {
+ LeakFinder heapHelper = new LeakFinder();
+
+ heapHelper.start([
+ "--enable-asserts",
+ Platform.script.resolve("incremental_dart2js_tester.dart").toString(),
+ "--addDebugBreaks",
+ "--fast",
+ "--limit=$limit",
+ ]);
+}
+
+class LeakFinder extends helper.LaunchingVMServiceHeapHelper {
+ @override
+ Future<void> run() async {
+ vmService.VM vm = await serviceClient.getVM();
+ if (vm.isolates.length != 1) {
+ throw "Expected 1 isolate, got ${vm.isolates.length}";
+ }
+ vmService.IsolateRef isolateRef = vm.isolates.single;
+ await waitUntilIsolateIsRunnable(isolateRef.id);
+ await serviceClient.resume(isolateRef.id);
+
+ Map<vmService.ClassRef, List<int>> instanceCounts =
+ new Map<vmService.ClassRef, List<int>>();
+ Map<vmService.ClassRef, vmService.Class> classInfo =
+ new Map<vmService.ClassRef, vmService.Class>();
+
+ Completer<String> cTimeout = new Completer();
+ Timer timer = new Timer(new Duration(minutes: 4), () {
+ cTimeout.complete("Timeout");
+ killProcess();
+ });
+
+ Completer<String> cRunDone = new Completer();
+ // ignore: unawaited_futures
+ runInternal(isolateRef, classInfo, instanceCounts,
+ () => cTimeout.isCompleted || cProcessExited.isCompleted).then((value) {
+ cRunDone.complete("Done");
+ });
+
+ await Future.any([cRunDone.future, cTimeout.future, cProcessExited.future]);
+ timer.cancel();
+
+ print("\n\n======================\n\n");
+
+ findPossibleLeaks(instanceCounts, classInfo);
+ }
+
+ void findPossibleLeaks(Map<vmService.ClassRef, List<int>> instanceCounts,
+ Map<vmService.ClassRef, vmService.Class> classInfo) {
+ bool foundLeak = false;
+ for (vmService.ClassRef c in instanceCounts.keys) {
+ List<int> listOfInstanceCounts = instanceCounts[c];
+
+ // Ignore VM internal stuff like "PatchClass", "PcDescriptors" etc.
+ // (they don't have a url).
+ vmService.Class classDetails = classInfo[c];
+ String uriString = classDetails.location?.script?.uri;
+ if (uriString == null) continue;
+
+ // For now ignore anything not in package:kernel or package:front_end.
+ if (ignoredClass(classDetails)) continue;
+
+ // If they're all equal there's nothing to talk about.
+ bool same = true;
+ for (int i = 1; i < listOfInstanceCounts.length; i++) {
+ if (listOfInstanceCounts[i] != listOfInstanceCounts[0]) {
+ same = false;
+ break;
+ }
+ }
+ if (same) continue;
+
+ int midPoint = listOfInstanceCounts.length ~/ 2;
+ List<int> firstHalf = listOfInstanceCounts.sublist(0, midPoint);
+ List<int> secondHalf = listOfInstanceCounts.sublist(midPoint);
+ TTestResult ttestResult = SimpleTTestStat.ttest(secondHalf, firstHalf);
+
+ if (!strictClass(classDetails)) {
+ if (!ttestResult.significant) continue;
+
+ // TODO(jensj): We could possibly also ignore if it's less (i.e. a
+ // negative change), or if the change is < 1%, or the change minus the
+ // confidence is < 1% etc.
+ }
+ print("Differences on ${c.name} (${uriString}): "
+ "$listOfInstanceCounts ($ttestResult)");
+ foundLeak = true;
+ }
+
+ print("\n\n");
+
+ if (foundLeak) {
+ print("Possible leak(s) found.");
+ print("(Note that this doesn't guarantee that there are any!)");
+ exitCode = 1;
+ } else {
+ print("Didn't identify any leaks.");
+ print("(Note that this doesn't guarantee that there are none!)");
+ exitCode = 0;
+ }
+ }
+
+ Future<void> runInternal(
+ vmService.IsolateRef isolateRef,
+ Map<vmService.ClassRef, vmService.Class> classInfo,
+ Map<vmService.ClassRef, List<int>> instanceCounts,
+ bool Function() shouldBail) async {
+ int iterationNumber = 1;
+ try {
+ while (true) {
+ if (shouldBail()) break;
+ if (!await waitUntilPaused(isolateRef.id)) break;
+ print("\n\n====================\n\nIteration #$iterationNumber");
+ iterationNumber++;
+ vmService.AllocationProfile allocationProfile =
+ await forceGC(isolateRef.id);
+ for (vmService.ClassHeapStats member in allocationProfile.members) {
+ if (!classInfo.containsKey(member.classRef)) {
+ vmService.Class c = await serviceClient.getObject(
+ isolateRef.id, member.classRef.id);
+ classInfo[member.classRef] = c;
+ }
+ List<int> listOfInstanceCounts = instanceCounts[member.classRef];
+ if (listOfInstanceCounts == null) {
+ listOfInstanceCounts =
+ instanceCounts[member.classRef] = new List<int>();
+ }
+ while (listOfInstanceCounts.length < iterationNumber - 2) {
+ listOfInstanceCounts.add(0);
+ }
+ listOfInstanceCounts.add(member.instancesCurrent);
+ if (listOfInstanceCounts.length != iterationNumber - 1) {
+ throw "Unexpected length";
+ }
+ }
+ await serviceClient.resume(isolateRef.id);
+ }
+ } catch (e) {
+ print("Got error: $e");
+ }
+ }
+
+ Completer<String> cProcessExited = new Completer();
+ void processExited(int exitCode) {
+ cProcessExited.complete("Exit");
+ }
+
+ bool ignoredClass(vmService.Class classDetails) {
+ String uriString = classDetails.location?.script?.uri;
+ if (uriString == null) return true;
+ if (uriString.startsWith("package:front_end/")) {
+ // Classes used for lazy initialization will naturally fluctuate.
+ if (classDetails.name == "DillClassBuilder") return true;
+ if (classDetails.name == "DillExtensionBuilder") return true;
+ if (classDetails.name == "DillExtensionMemberBuilder") return true;
+ if (classDetails.name == "DillMemberBuilder") return true;
+ if (classDetails.name == "DillTypeAliasBuilder") return true;
+
+ // These classes have proved to fluctuate, although the reason is less
+ // clear.
+ if (classDetails.name == "InheritedImplementationInterfaceConflict") {
+ return true;
+ }
+ if (classDetails.name == "AbstractMemberOverridingImplementation") {
+ return true;
+ }
+ if (classDetails.name == "VoidTypeBuilder") return true;
+ if (classDetails.name == "NamedTypeBuilder") return true;
+ if (classDetails.name == "DillClassMember") return true;
+ if (classDetails.name == "Scope") return true;
+ if (classDetails.name == "ConstructorScope") return true;
+ if (classDetails.name == "ScopeBuilder") return true;
+ if (classDetails.name == "ConstructorScopeBuilder") return true;
+
+ return false;
+ } else if (uriString.startsWith("package:kernel/")) {
+ // DirtifyingList is used for lazy stuff and naturally change in numbers.
+ if (classDetails.name == "DirtifyingList") return true;
+
+ // Constants are canonicalized in their compilation run and will thus
+ // naturally increase, e.g. we can get 2 more booleans every time (up to
+ // a maximum of 2 per library or however many would have been there if we
+ // didn't canonicalize at all).
+ if (classDetails.name.endsWith("Constant")) return true;
+
+ // These classes have proved to fluctuate, although the reason is less
+ // clear.
+ if (classDetails.name == "InterfaceType") return true;
+
+ return false;
+ }
+ return true;
+ }
+
+ // I have commented out the lazy ones below.
+ Set<String> frontEndStrictClasses = {
+ // "DillClassBuilder",
+ // "DillExtensionBuilder",
+ // "DillExtensionMemberBuilder",
+ "DillLibraryBuilder",
+ "DillLoader",
+ // "DillMemberBuilder",
+ "DillTarget",
+ // "DillTypeAliasBuilder",
+ "SourceClassBuilder",
+ "SourceExtensionBuilder",
+ "SourceLibraryBuilder",
+ "SourceLoader",
+ };
+
+ Set<String> kernelAstStrictClasses = {
+ "Class",
+ "Constructor",
+ "Extension",
+ "Field",
+ "Library",
+ "Procedure",
+ "RedirectingFactoryConstructor",
+ "Typedef",
+ };
+
+ bool strictClass(vmService.Class classDetails) {
+ if (!kernelAstStrictClasses.contains(classDetails.name) &&
+ !frontEndStrictClasses.contains(classDetails.name)) return false;
+
+ if (kernelAstStrictClasses.contains(classDetails.name) &&
+ classDetails.location?.script?.uri == "package:kernel/ast.dart") {
+ return true;
+ }
+ if (frontEndStrictClasses.contains(classDetails.name) &&
+ classDetails.location?.script?.uri?.startsWith("package:front_end/") ==
+ true) {
+ return true;
+ }
+
+ throw "$classDetails: ${classDetails.name} --- ${classDetails.location}";
+ }
+}
diff --git a/pkg/front_end/test/incremental_dart2js_test.dart b/pkg/front_end/test/incremental_dart2js_test.dart
new file mode 100644
index 0000000..1ea9b17
--- /dev/null
+++ b/pkg/front_end/test/incremental_dart2js_test.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2020, 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 "incremental_dart2js_tester.dart";
+
+main(List<String> args) async {
+ bool fast = true;
+ bool useExperimentalInvalidation = true;
+ bool addDebugBreaks = false;
+ int limit = -1;
+
+ Dart2jsTester dart2jsTester = new Dart2jsTester(
+ useExperimentalInvalidation, fast, addDebugBreaks, limit);
+ await dart2jsTester.test();
+}
diff --git a/pkg/front_end/test/incremental_dart2js_tester.dart b/pkg/front_end/test/incremental_dart2js_tester.dart
index b8f8b47..8a5401c 100644
--- a/pkg/front_end/test/incremental_dart2js_tester.dart
+++ b/pkg/front_end/test/incremental_dart2js_tester.dart
@@ -19,6 +19,7 @@
bool fast = false;
bool useExperimentalInvalidation = false;
bool addDebugBreaks = false;
+ int limit = -1;
for (String arg in args) {
if (arg == "--fast") {
fast = true;
@@ -26,13 +27,15 @@
useExperimentalInvalidation = true;
} else if (arg == "--addDebugBreaks") {
addDebugBreaks = true;
+ } else if (arg.startsWith("--limit=")) {
+ limit = int.parse(arg.substring("--limit=".length));
} else {
throw "Unsupported argument: $arg";
}
}
- Dart2jsTester dart2jsTester =
- new Dart2jsTester(useExperimentalInvalidation, fast, addDebugBreaks);
+ Dart2jsTester dart2jsTester = new Dart2jsTester(
+ useExperimentalInvalidation, fast, addDebugBreaks, limit);
await dart2jsTester.test();
}
@@ -40,6 +43,7 @@
final bool useExperimentalInvalidation;
final bool fast;
final bool addDebugBreaks;
+ final int limit;
Stopwatch stopwatch = new Stopwatch();
List<int> firstCompileData;
@@ -49,17 +53,23 @@
List<Uri> diffs = new List<Uri>();
Set<Uri> componentUris = new Set<Uri>();
- Dart2jsTester(
- this.useExperimentalInvalidation, this.fast, this.addDebugBreaks);
+ Dart2jsTester(this.useExperimentalInvalidation, this.fast,
+ this.addDebugBreaks, this.limit);
void test() async {
helper.TestIncrementalCompiler compiler = await setup();
+ if (addDebugBreaks) {
+ debugger();
+ }
diffs = new List<Uri>();
componentUris = new Set<Uri>();
Stopwatch localStopwatch = new Stopwatch()..start();
+ int recompiles = 0;
for (int i = 0; i < uris.length; i++) {
+ if (limit >= 0 && limit < i) break;
+ recompiles++;
Uri uri = uris[i];
await step(uri, i, compiler, localStopwatch);
}
@@ -69,7 +79,7 @@
print(" - $uri");
}
- print("Done after ${uris.length} recompiles in "
+ print("Done after ${recompiles} recompiles in "
"${stopwatch.elapsedMilliseconds} ms");
}
diff --git a/pkg/front_end/test/language_versioning/data/marker.options b/pkg/front_end/test/language_versioning/data/marker.options
new file mode 100644
index 0000000..0b24526
--- /dev/null
+++ b/pkg/front_end/test/language_versioning/data/marker.options
@@ -0,0 +1 @@
+cfe=pkg/front_end/test/language_versioning/language_versioning_test.dart
diff --git a/pkg/front_end/test/language_versioning/language_versioning_test.dart b/pkg/front_end/test/language_versioning/language_versioning_test.dart
index 7833f20..8b4b12b 100644
--- a/pkg/front_end/test/language_versioning/language_versioning_test.dart
+++ b/pkg/front_end/test/language_versioning/language_versioning_test.dart
@@ -29,7 +29,6 @@
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
await runTests<String>(dataDir,
args: args,
- supportedMarkers: [cfeMarker],
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(const LanguageVersioningDataComputer(), [cfeConfig]),
diff --git a/pkg/front_end/test/parser_suite.dart b/pkg/front_end/test/parser_suite.dart
index 4fec65a..8defcdc 100644
--- a/pkg/front_end/test/parser_suite.dart
+++ b/pkg/front_end/test/parser_suite.dart
@@ -209,7 +209,8 @@
StringBuffer afterParserWithTypes =
tokenStreamToString(firstToken, lineStarts, addTypes: true);
- bool rewritten = beforeParser.toString() != afterParser.toString();
+ bool rewritten =
+ beforeParserWithTypes.toString() != afterParserWithTypes.toString();
String rewrittenString =
rewritten ? "NOTICE: Stream was rewritten by parser!\n\n" : "";
diff --git a/pkg/front_end/test/parser_test_listener.dart b/pkg/front_end/test/parser_test_listener.dart
index 27ce478..e246375 100644
--- a/pkg/front_end/test/parser_test_listener.dart
+++ b/pkg/front_end/test/parser_test_listener.dart
@@ -14,6 +14,12 @@
import 'package:front_end/src/fasta/messages.dart';
// THIS FILE IS AUTO GENERATED BY 'test/parser_test_listener_creator.dart'
+// Run e.g.
+/*
+ out/ReleaseX64/dart \
+ pkg/front_end/test/parser_test_listener_creator.dart \
+ > pkg/front_end/test/parser_test_listener.dart
+*/
class ParserTestListener implements Listener {
int indent = 0;
@@ -835,7 +841,7 @@
}
void handleStringJuxtaposition(Token startToken, int literalCount) {
- doPrint('handleStringJuxtaposition(' '$literalCount)');
+ doPrint('handleStringJuxtaposition(' '$startToken, ' '$literalCount)');
}
void beginMember() {
@@ -1171,18 +1177,6 @@
doPrint('handleNonNullAssertExpression(' '$bang)');
}
- void reportErrorIfNullableType(Token questionMark) {
- doPrint('reportErrorIfNullableType(' '$questionMark)');
- }
-
- void reportNonNullableModifierError(Token modifierToken) {
- doPrint('reportNonNullableModifierError(' '$modifierToken)');
- }
-
- void reportNonNullAssertExpressionNotEnabled(Token bang) {
- doPrint('reportNonNullAssertExpressionNotEnabled(' '$bang)');
- }
-
void handleNoName(Token token) {
doPrint('handleNoName(' '$token)');
}
@@ -1382,8 +1376,9 @@
}
void handleIndexedExpression(
- Token openSquareBracket, Token closeSquareBracket) {
+ Token question, Token openSquareBracket, Token closeSquareBracket) {
doPrint('handleIndexedExpression('
+ '$question, '
'$openSquareBracket, '
'$closeSquareBracket)');
}
diff --git a/pkg/front_end/test/parser_test_listener_creator.dart b/pkg/front_end/test/parser_test_listener_creator.dart
index 3607a44..4c30fd4 100644
--- a/pkg/front_end/test/parser_test_listener_creator.dart
+++ b/pkg/front_end/test/parser_test_listener_creator.dart
@@ -22,8 +22,8 @@
out = new StringBuffer();
}
- File f = new File.fromUri(
- Platform.script.resolve("../lib/src/fasta/parser/listener.dart"));
+ File f = new File.fromUri(Platform.script
+ .resolve("../../_fe_analyzer_shared/lib/src/parser/listener.dart"));
List<int> rawBytes = f.readAsBytesSync();
Uint8List bytes = new Uint8List(rawBytes.length + 1);
@@ -49,6 +49,12 @@
import 'package:front_end/src/fasta/messages.dart';
// THIS FILE IS AUTO GENERATED BY 'test/parser_test_listener_creator.dart'
+// Run e.g.
+/*
+ out/ReleaseX64/dart \
+ pkg/front_end/test/parser_test_listener_creator.dart \
+ > pkg/front_end/test/parser_test_listener.dart
+*/
class ParserTestListener implements Listener {
int indent = 0;
diff --git a/pkg/front_end/test/parser_test_parser.dart b/pkg/front_end/test/parser_test_parser.dart
index 745be079..b9043b5 100644
--- a/pkg/front_end/test/parser_test_parser.dart
+++ b/pkg/front_end/test/parser_test_parser.dart
@@ -18,6 +18,12 @@
import 'package:front_end/src/fasta/fasta_codes.dart';
// THIS FILE IS AUTO GENERATED BY 'test/parser_test_parser_creator.dart'
+// Run e.g.
+/*
+ out/ReleaseX64/dart \
+ pkg/front_end/test/parser_test_parser_creator.dart \
+ > pkg/front_end/test/parser_test_parser.dart
+*/
class TestParser extends Parser {
int indent = 0;
@@ -1204,6 +1210,26 @@
return result;
}
+ bool canParseAsConditional(Token question) {
+ doPrint('canParseAsConditional(' '$question)');
+ indent++;
+ var result = super.canParseAsConditional(question);
+ indent--;
+ return result;
+ }
+
+ Token parseNullAwareBracketOrConditionalExpressionRest(
+ Token token, TypeParamOrArgInfo typeArg) {
+ doPrint('parseNullAwareBracketOrConditionalExpressionRest('
+ '$token, '
+ '$typeArg)');
+ indent++;
+ var result =
+ super.parseNullAwareBracketOrConditionalExpressionRest(token, typeArg);
+ indent--;
+ return result;
+ }
+
Token parseConditionalExpressionRest(Token token) {
doPrint('parseConditionalExpressionRest(' '$token)');
indent++;
@@ -1241,10 +1267,15 @@
return result;
}
- Token parseArgumentOrIndexStar(Token token, TypeParamOrArgInfo typeArg) {
- doPrint('parseArgumentOrIndexStar(' '$token, ' '$typeArg)');
+ Token parseArgumentOrIndexStar(
+ Token token, TypeParamOrArgInfo typeArg, bool checkedNullAware) {
+ doPrint('parseArgumentOrIndexStar('
+ '$token, '
+ '$typeArg, '
+ '$checkedNullAware)');
indent++;
- var result = super.parseArgumentOrIndexStar(token, typeArg);
+ var result =
+ super.parseArgumentOrIndexStar(token, typeArg, checkedNullAware);
indent--;
return result;
}
@@ -1467,6 +1498,14 @@
return result;
}
+ Token parseBangBeforeTypeArguments(Token token) {
+ doPrint('parseBangBeforeTypeArguments(' '$token)');
+ indent++;
+ var result = super.parseBangBeforeTypeArguments(token);
+ indent--;
+ return result;
+ }
+
Token parseSend(Token token, IdentifierContext context) {
doPrint('parseSend(' '$token, ' '$context)');
indent++;
diff --git a/pkg/front_end/test/parser_test_parser_creator.dart b/pkg/front_end/test/parser_test_parser_creator.dart
index 002bf61..47ac23a 100644
--- a/pkg/front_end/test/parser_test_parser_creator.dart
+++ b/pkg/front_end/test/parser_test_parser_creator.dart
@@ -52,6 +52,12 @@
import 'package:front_end/src/fasta/fasta_codes.dart';
// THIS FILE IS AUTO GENERATED BY 'test/parser_test_parser_creator.dart'
+// Run e.g.
+/*
+ out/ReleaseX64/dart \
+ pkg/front_end/test/parser_test_parser_creator.dart \
+ > pkg/front_end/test/parser_test_parser.dart
+*/
class TestParser extends Parser {
int indent = 0;
diff --git a/pkg/front_end/test/patching/data/marker.options b/pkg/front_end/test/patching/data/marker.options
new file mode 100644
index 0000000..3811799
--- /dev/null
+++ b/pkg/front_end/test/patching/data/marker.options
@@ -0,0 +1,2 @@
+cfe=pkg/front_end/test/patching/patching_test.dart
+cfe:nnbd=pkg/front_end/test/patching/patching_test.dart
diff --git a/pkg/front_end/test/patching/patching_test.dart b/pkg/front_end/test/patching/patching_test.dart
index 9562068..5e9b0a4 100644
--- a/pkg/front_end/test/patching/patching_test.dart
+++ b/pkg/front_end/test/patching/patching_test.dart
@@ -22,7 +22,6 @@
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
await runTests<Features>(dataDir,
args: args,
- supportedMarkers: [cfeMarker, cfeWithNnbdMarker],
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(const PatchingDataComputer(), [
diff --git a/pkg/front_end/test/simple_stats.dart b/pkg/front_end/test/simple_stats.dart
new file mode 100644
index 0000000..c8ef59e
--- /dev/null
+++ b/pkg/front_end/test/simple_stats.dart
@@ -0,0 +1,108 @@
+import 'dart:math' as math;
+
+class SimpleTTestStat {
+ static TTestResult ttest(List<int> a, List<int> b) {
+ int aSum = a.reduce((value, element) => (value + element));
+ int bSum = b.reduce((value, element) => (value + element));
+ int aCount = a.length;
+ int bCount = b.length;
+ double aMean = aSum / aCount;
+ double bMean = bSum / bCount;
+ double aVariance = variance(a);
+ double bVariance = variance(b);
+ double pooledStandardDeviation = math.sqrt((aVariance + bVariance) / 2);
+ double pooledSampleStandardError =
+ pooledStandardDeviation * math.sqrt(1 / aCount + 1 / bCount);
+ double diffMean = aMean - bMean;
+
+ // Difference in population mean with confidence interval:
+ // μ1 - μ2 = (M1 - M2) ± t * standardError
+ double confidence =
+ tTableTwoTails_0_05(aCount + bCount - 2) * pooledSampleStandardError;
+
+ if (confidence < diffMean.abs()) {
+ double percentDiff = diffMean * 100 / bMean;
+ double percentDiffConfidence = confidence * 100 / bMean;
+ return new TTestResult(true, percentDiff, percentDiffConfidence);
+ } else {
+ return new TTestResult(false, 0, 0);
+ }
+ }
+
+ static double variance(List<int> data) {
+ int sum = data.reduce((value, element) => (value + element));
+ int count = data.length;
+ double average = sum / count;
+
+ double diffSquareSum = 0;
+ for (int value in data) {
+ double diff = value - average;
+ double squared = diff * diff;
+ diffSquareSum += squared;
+ }
+
+ double variance = diffSquareSum / (count - 1);
+ return variance;
+ }
+
+ static double tTableTwoTails_0_05(int value) {
+ // TODO: Maybe actually calculate this? I haven't looked that up.
+ // These numbers are from google sheets "=TINV(0.05, value)"
+ if (value < 1) throw "value has to be > 0";
+ if (value == 1) return 12.70620474;
+ if (value == 2) return 4.30265273;
+ if (value == 3) return 3.182446305;
+ if (value == 4) return 2.776445105;
+ if (value == 5) return 2.570581836;
+ if (value == 6) return 2.446911851;
+ if (value == 7) return 2.364624252;
+ if (value == 8) return 2.306004135;
+ if (value == 9) return 2.262157163;
+ if (value == 10) return 2.228138852;
+ if (value == 11) return 2.20098516;
+ if (value == 12) return 2.17881283;
+ if (value == 13) return 2.160368656;
+ if (value == 14) return 2.144786688;
+ if (value == 15) return 2.131449546;
+ if (value == 16) return 2.119905299;
+ if (value == 17) return 2.109815578;
+ if (value == 18) return 2.10092204;
+ if (value == 19) return 2.093024054;
+ if (value == 20) return 2.085963447;
+ if (value <= 30) return 2.042272456;
+ if (value <= 40) return 2.02107539;
+ if (value <= 50) return 2.008559112;
+ if (value <= 60) return 2.000297822;
+ if (value <= 70) return 1.994437112;
+ if (value <= 80) return 1.990063421;
+ if (value <= 80) return 1.990063421;
+ if (value <= 90) return 1.986674541;
+ if (value <= 100) return 1.983971519;
+ if (value <= 150) return 1.975905331;
+ if (value <= 200) return 1.971896224;
+ if (value <= 250) return 1.969498393;
+ if (value <= 500) return 1.964719837;
+ if (value <= 1000) return 1.962339081;
+ if (value <= 10000) return 1.96020124;
+ if (value <= 100000) return 1.959987708;
+ if (value <= 1000000) return 1.959966357;
+ return 1.959964228;
+ }
+}
+
+class TTestResult {
+ final bool significant;
+ final double percentDiff;
+ final double percentDiffConfidence;
+
+ TTestResult(this.significant, this.percentDiff, this.percentDiffConfidence);
+
+ String toString() {
+ if (significant) {
+ return "TTestResult[significant: "
+ "$percentDiff% +/- $percentDiffConfidence%]";
+ } else {
+ return "TTestResult[not significant]";
+ }
+ }
+}
diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt
index cc5c7df..6431b7c 100644
--- a/pkg/front_end/test/spell_checking_list_code.txt
+++ b/pkg/front_end/test/spell_checking_list_code.txt
@@ -472,6 +472,7 @@
importantly
inc
incomparable
+inconsistency
incremented
independently
indexer
@@ -726,6 +727,7 @@
pedantic
per
perf
+permanently
permit
pi
picking
@@ -949,6 +951,7 @@
statics
stderr
stdin
+stdio
stdout
stmt
str
@@ -1015,6 +1018,7 @@
terminator
test
tester
+testers
testing
tex
tflite
@@ -1084,6 +1088,8 @@
unconditionally
unconstrained
undeclare
+undo
+undoable
unequal
unescape
unexact
@@ -1108,6 +1114,7 @@
unparsed
unpleasant
unreachable
+unseen
unshadowed
unwraps
unzip
@@ -1150,6 +1157,7 @@
watcher
wb
wc
+weakener
weird
weren't
werror
diff --git a/pkg/front_end/test/spell_checking_list_common.txt b/pkg/front_end/test/spell_checking_list_common.txt
index 34b1a92..1f32f08 100644
--- a/pkg/front_end/test/spell_checking_list_common.txt
+++ b/pkg/front_end/test/spell_checking_list_common.txt
@@ -85,6 +85,7 @@
against
aggregate
aggressively
+agnostic
ahead
algebra
algorithm
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index 55c745c..7f38ea6 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -40,6 +40,7 @@
ba
baba
backed
+bail
bailout
bash
bat
@@ -86,6 +87,7 @@
coded
codepath
collisions
+commented
commit
companion
comparator
@@ -95,6 +97,7 @@
compiler's
complement
completers
+confidence
confirm
consecutive
considering
@@ -123,11 +126,13 @@
depended
depfile
desc
+descriptors
detector
deviation
dfast
dictionaries
dictionary
+differences
differs
dijkstra
dijkstras
@@ -184,10 +189,12 @@
fetched
fibonacci
filesystem
+filler
finder
fisk
five
floor
+fluctuate
foos
forbidden
forces
@@ -205,6 +212,7 @@
generators
git
goo
+google
greeting
gtgt
gulp
@@ -248,9 +256,11 @@
joo
jumped
kernels
+kill
ko
koo
la
+launching
lc
ld
le
@@ -278,6 +288,7 @@
metrics
mf
micro
+minutes
mismatched
miss
misspelled
@@ -287,6 +298,7 @@
moo
mx
mysdk
+naturally
negatable
newest
newworld
@@ -306,6 +318,7 @@
party
pause
paused
+pc
periodic
periodically
person
@@ -314,6 +327,8 @@
places
pointed
policy
+pooled
+population
portions
pp
preliminary
@@ -325,6 +340,7 @@
promotes
propagated
protected
+proved
provider
pseudocode
pubspec
@@ -358,6 +374,8 @@
resource
respected
response
+retaining
+retainingpath
retains
rev
risky
@@ -370,6 +388,7 @@
secondary
segment
severe
+sheets
shipped
shortest
shot
@@ -386,7 +405,9 @@
splay
splitting
sqrt
+squared
sssp
+stat
stats
std
stdio
@@ -405,6 +426,8 @@
supermixin
supplement
suspension
+tails
+talk
templates
thereof
thing
@@ -413,6 +436,7 @@
timer
timing
timings
+tinv
title
tpt
transitively
@@ -426,6 +450,7 @@
trivially
truncated
tt
+ttest
txt
typeargs
typeparam
diff --git a/pkg/front_end/test/static_types/data/constant_from_opt_in/main.dart b/pkg/front_end/test/static_types/data/constant_from_opt_in/main.dart
new file mode 100644
index 0000000..ef82bbf
--- /dev/null
+++ b/pkg/front_end/test/static_types/data/constant_from_opt_in/main.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2019, 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.
+
+// @dart=2.5
+
+/*library: nnbd=false*/
+
+import 'opt_in.dart';
+
+main() {
+ /*cfe:nnbd.bool!*/ f;
+ /*cfe:nnbd.bool!*/ c;
+}
diff --git a/pkg/front_end/test/static_types/data/constant_from_opt_in/opt_in.dart b/pkg/front_end/test/static_types/data/constant_from_opt_in/opt_in.dart
new file mode 100644
index 0000000..88af700
--- /dev/null
+++ b/pkg/front_end/test/static_types/data/constant_from_opt_in/opt_in.dart
@@ -0,0 +1,8 @@
+// Copyright (c) 2019, 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: nnbd=true*/
+
+final f = /*cfe:nnbd.bool!*/ true;
+const c = /*cfe:nnbd.bool!*/ true;
diff --git a/pkg/front_end/test/static_types/data/constant_from_opt_out/main.dart b/pkg/front_end/test/static_types/data/constant_from_opt_out/main.dart
new file mode 100644
index 0000000..ad20e96
--- /dev/null
+++ b/pkg/front_end/test/static_types/data/constant_from_opt_out/main.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2019, 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: nnbd=true*/
+
+import 'opt_out.dart';
+
+main() {
+ /*cfe:nnbd.bool*/ f;
+ /*cfe:nnbd.bool*/ c;
+}
diff --git a/pkg/front_end/test/static_types/data/constant_from_opt_out/opt_out.dart b/pkg/front_end/test/static_types/data/constant_from_opt_out/opt_out.dart
new file mode 100644
index 0000000..3498514
--- /dev/null
+++ b/pkg/front_end/test/static_types/data/constant_from_opt_out/opt_out.dart
@@ -0,0 +1,10 @@
+// Copyright (c) 2019, 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.
+
+// @dart=2.5
+
+/*library: nnbd=false*/
+
+final f = /*cfe:nnbd.bool*/ true;
+const c = /*cfe:nnbd.bool*/ true;
diff --git a/pkg/front_end/test/static_types/data/marker.options b/pkg/front_end/test/static_types/data/marker.options
new file mode 100644
index 0000000..b28ef48
--- /dev/null
+++ b/pkg/front_end/test/static_types/data/marker.options
@@ -0,0 +1,2 @@
+cfe=pkg/front_end/test/static_types/static_type_test.dart
+cfe:nnbd=pkg/front_end/test/static_types/static_type_test.dart
diff --git a/pkg/front_end/test/static_types/static_type_test.dart b/pkg/front_end/test/static_types/static_type_test.dart
index 3f64311f..4287b41 100644
--- a/pkg/front_end/test/static_types/static_type_test.dart
+++ b/pkg/front_end/test/static_types/static_type_test.dart
@@ -17,7 +17,6 @@
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
await runTests<String>(dataDir,
args: args,
- supportedMarkers: cfeMarkersWithNnbd,
createUriForFileName: createUriForFileName,
onFailure: onFailure,
runTest: runTestFor(const StaticTypeDataComputer(),
@@ -25,6 +24,8 @@
skipMap: {
defaultCfeConfig.marker: [
// NNBD-only tests.
+ 'constant_from_opt_in',
+ 'constant_from_opt_out',
'from_opt_in',
'from_opt_out',
'if_null.dart',
diff --git a/pkg/front_end/test/utils/kernel_chain.dart b/pkg/front_end/test/utils/kernel_chain.dart
index da0ab76..643ffcb 100644
--- a/pkg/front_end/test/utils/kernel_chain.dart
+++ b/pkg/front_end/test/utils/kernel_chain.dart
@@ -56,7 +56,14 @@
TextSerializationVerifier;
import 'package:testing/testing.dart'
- show ChainContext, Expectation, ExpectationSet, Result, StdioProcess, Step;
+ show
+ ChainContext,
+ Expectation,
+ ExpectationSet,
+ Result,
+ StdioProcess,
+ Step,
+ TestDescription;
final Uri platformBinariesLocation = computePlatformBinariesLocation();
@@ -362,26 +369,28 @@
}
}
-class WriteDill extends Step<ComponentResult, Uri, ChainContext> {
+class WriteDill extends Step<ComponentResult, ComponentResult, ChainContext> {
const WriteDill();
String get name => "write .dill";
- Future<Result<Uri>> run(ComponentResult result, _) async {
+ Future<Result<ComponentResult>> run(ComponentResult result, _) async {
Component component = result.component;
Directory tmp = await Directory.systemTemp.createTemp();
Uri uri = tmp.uri.resolve("generated.dill");
File generated = new File.fromUri(uri);
IOSink sink = generated.openWrite();
+ result = new ComponentResult(
+ result.description, result.component, result.userLibraries, uri);
try {
new BinaryPrinter(sink).writeComponentFile(component);
} catch (e, s) {
- return fail(uri, e, s);
+ return fail(result, e, s);
} finally {
print("Wrote `${generated.path}`");
await sink.close();
}
- return pass(uri);
+ return pass(result);
}
}
@@ -464,10 +473,13 @@
}
class ComponentResult {
+ final TestDescription description;
final Component component;
final Set<Uri> userLibraries;
+ final Uri outputUri;
- ComponentResult(this.component, this.userLibraries);
+ ComponentResult(this.description, this.component, this.userLibraries,
+ [this.outputUri]);
bool isUserLibrary(Library library) {
return userLibraries.contains(library.importUri);
diff --git a/pkg/front_end/test/vm_service_for_leak_detection.dart b/pkg/front_end/test/vm_service_for_leak_detection.dart
index 040e1d5..efead40 100644
--- a/pkg/front_end/test/vm_service_for_leak_detection.dart
+++ b/pkg/front_end/test/vm_service_for_leak_detection.dart
@@ -16,33 +16,39 @@
["_extension"]));
interests.add(new helper.Interest(
Uri.parse("package:kernel/ast.dart"), "Library", ["fileUri"]));
- helper.VMServiceHeapHelper heapHelper = new helper.VMServiceHeapHelper(
- interests,
- [
- new helper.Interest(
- Uri.parse(
- "package:front_end/src/fasta/source/source_extension_builder.dart"),
- "SourceExtensionBuilder",
- ["_extension"]),
- new helper.Interest(Uri.parse("package:kernel/ast.dart"), "Extension",
- ["name", "fileUri"]),
- new helper.Interest(Uri.parse("package:kernel/ast.dart"), "Library",
- ["fileUri", "_libraryIdString"]),
- ],
- true);
+ helper.VMServiceHeapHelperSpecificExactLeakFinder heapHelper =
+ new helper.VMServiceHeapHelperSpecificExactLeakFinder(
+ interests,
+ [
+ new helper.Interest(
+ Uri.parse(
+ "package:front_end/src/fasta/source/source_extension_builder.dart"),
+ "SourceExtensionBuilder",
+ ["_extension"]),
+ new helper.Interest(Uri.parse("package:kernel/ast.dart"),
+ "Extension", ["name", "fileUri"]),
+ new helper.Interest(Uri.parse("package:kernel/ast.dart"), "Library",
+ ["fileUri", "_libraryIdString"]),
+ ],
+ true);
- // heapHelper.start([
- // "--enable-asserts",
- // Platform.script.resolve("incremental_dart2js_tester.dart").toString(),
- // "--addDebugBreaks",
- // "--fast",
- // "--experimental",
- // ]);
- heapHelper.start([
- "--enable-asserts",
- Platform.script.resolve("incremental_load_from_dill_suite.dart").toString(),
- "-DaddDebugBreaks=true",
- // "--",
- // "incremental_load_from_dill/no_outline_change_...",
- ]);
+ if (args.length > 0 && args[0] == "--dart2js") {
+ heapHelper.start([
+ "--enable-asserts",
+ Platform.script.resolve("incremental_dart2js_tester.dart").toString(),
+ "--addDebugBreaks",
+ "--fast",
+ "--experimental",
+ ]);
+ } else {
+ heapHelper.start([
+ "--enable-asserts",
+ Platform.script
+ .resolve("incremental_load_from_dill_suite.dart")
+ .toString(),
+ "-DaddDebugBreaks=true",
+ "--",
+ "incremental_load_from_dill/no_outline_change_38",
+ ]);
+ }
}
diff --git a/pkg/front_end/test/vm_service_heap_finder.dart b/pkg/front_end/test/vm_service_heap_finder.dart
index f199b1e..6535c13 100644
--- a/pkg/front_end/test/vm_service_heap_finder.dart
+++ b/pkg/front_end/test/vm_service_heap_finder.dart
@@ -8,27 +8,46 @@
Foo(this.x, this.y);
}
-main() async {
+main(List<String> args) async {
+ String connectTo;
+ String classToFind;
+ String whatToDo;
+ for (String arg in args) {
+ if (arg.startsWith("--url=")) {
+ connectTo = arg.substring("--url=".length);
+ } else if (arg.startsWith("--find=")) {
+ classToFind = arg.substring("--find=".length);
+ } else if (arg.startsWith("--action=")) {
+ whatToDo = arg.substring("--action=".length);
+ }
+ }
List<Foo> foos = [];
foos.add(new Foo("hello", 42));
foos.add(new Foo("world", 43));
foos.add(new Foo("!", 44));
- String connectTo = ask("Connect to");
- VMServiceHeapHelperBase vm = VMServiceHeapHelperBase();
- await vm.connect(Uri.parse(connectTo));
- String isolateId = await vm.getIsolateId();
- String classToFind = ask("Find what class");
- await vm.printAllocationProfile(isolateId, filter: classToFind);
- String fieldToFilter = ask("Filter on what field");
- Set<String> fieldValues = {};
- while (true) {
- String fieldValue = ask("Look for value in field (empty to stop)");
- if (fieldValue == "") break;
- fieldValues.add(fieldValue);
- }
- await vm.filterAndPrintInstances(
- isolateId, classToFind, fieldToFilter, fieldValues);
+ if (connectTo == null) connectTo = ask("Connect to");
+ VMServiceHeapHelperBase vm = VMServiceHeapHelperBase();
+ await vm.connect(Uri.parse(connectTo.trim()));
+ String isolateId = await vm.getIsolateId();
+ if (classToFind == null) classToFind = ask("Find what class");
+
+ if (whatToDo == null) whatToDo = ask("What to do? (filter/retainingpath)");
+ if (whatToDo == "retainingpath") {
+ await vm.printRetainingPaths(isolateId, classToFind);
+ } else {
+ await vm.printAllocationProfile(isolateId, filter: classToFind);
+ String fieldToFilter = ask("Filter on what field");
+ Set<String> fieldValues = {};
+ while (true) {
+ String fieldValue = ask("Look for value in field (empty to stop)");
+ if (fieldValue == "") break;
+ fieldValues.add(fieldValue);
+ }
+
+ await vm.filterAndPrintInstances(
+ isolateId, classToFind, fieldToFilter, fieldValues);
+ }
await vm.disconnect();
print("Disconnect done!");
diff --git a/pkg/front_end/test/vm_service_heap_helper.dart b/pkg/front_end/test/vm_service_heap_helper.dart
index e23bdbd..de7cde8 100644
--- a/pkg/front_end/test/vm_service_heap_helper.dart
+++ b/pkg/front_end/test/vm_service_heap_helper.dart
@@ -9,12 +9,14 @@
class VMServiceHeapHelperBase {
vmService.VmService _serviceClient;
+ vmService.VmService get serviceClient => _serviceClient;
VMServiceHeapHelperBase();
Future connect(Uri observatoryUri) async {
- String wsUriString =
- 'ws://${observatoryUri.authority}${observatoryUri.path}ws';
+ String path = observatoryUri.path;
+ if (!path.endsWith("/")) path += "/";
+ String wsUriString = 'ws://${observatoryUri.authority}${path}ws';
_serviceClient = await vmService.vmServiceConnectUri(wsUriString,
log: const StdOutLog());
}
@@ -23,7 +25,7 @@
await _serviceClient.dispose();
}
- Future<void> _waitUntilPaused(String isolateId) async {
+ Future<bool> waitUntilPaused(String isolateId) async {
int nulls = 0;
while (true) {
bool result = await _isPaused(isolateId);
@@ -32,10 +34,10 @@
if (nulls > 5) {
// We've now asked for the isolate 5 times and in all cases gotten
// `Sentinel`. Most likely things aren't working for whatever reason.
- return;
+ return false;
}
} else if (result) {
- return;
+ return true;
} else {
await Future.delayed(const Duration(milliseconds: 100));
}
@@ -61,20 +63,26 @@
return false;
}
- Future<void> _forceGC(String isolateId) async {
- await _waitUntilIsolateIsRunnable(isolateId);
+ Future<vmService.AllocationProfile> forceGC(String isolateId) async {
+ await waitUntilIsolateIsRunnable(isolateId);
int expectGcAfter = new DateTime.now().millisecondsSinceEpoch;
while (true) {
- vmService.AllocationProfile allocationProfile =
- await _serviceClient.getAllocationProfile(isolateId, gc: true);
+ vmService.AllocationProfile allocationProfile;
+ try {
+ allocationProfile =
+ await _serviceClient.getAllocationProfile(isolateId, gc: true);
+ } catch (e) {
+ print(e.runtimeType);
+ rethrow;
+ }
if (allocationProfile.dateLastServiceGC != null &&
allocationProfile.dateLastServiceGC >= expectGcAfter) {
- return;
+ return allocationProfile;
}
}
}
- Future<bool> _isIsolateRunnable(String isolateId) async {
+ Future<bool> isIsolateRunnable(String isolateId) async {
dynamic tmp = await _serviceClient.getIsolate(isolateId);
if (tmp is vmService.Isolate) {
vmService.Isolate isolate = tmp;
@@ -83,10 +91,10 @@
return null;
}
- Future<void> _waitUntilIsolateIsRunnable(String isolateId) async {
+ Future<void> waitUntilIsolateIsRunnable(String isolateId) async {
int nulls = 0;
while (true) {
- bool result = await _isIsolateRunnable(isolateId);
+ bool result = await isIsolateRunnable(isolateId);
if (result == null) {
nulls++;
if (nulls > 5) {
@@ -103,7 +111,7 @@
}
Future<void> printAllocationProfile(String isolateId, {String filter}) async {
- await _waitUntilIsolateIsRunnable(isolateId);
+ await waitUntilIsolateIsRunnable(isolateId);
vmService.AllocationProfile allocationProfile =
await _serviceClient.getAllocationProfile(isolateId);
for (vmService.ClassHeapStats member in allocationProfile.members) {
@@ -122,7 +130,7 @@
Future<void> filterAndPrintInstances(String isolateId, String filter,
String fieldName, Set<String> fieldValues) async {
- await _waitUntilIsolateIsRunnable(isolateId);
+ await waitUntilIsolateIsRunnable(isolateId);
vmService.AllocationProfile allocationProfile =
await _serviceClient.getAllocationProfile(isolateId);
for (vmService.ClassHeapStats member in allocationProfile.members) {
@@ -159,6 +167,41 @@
print("Done!");
}
+ Future<void> printRetainingPaths(String isolateId, String filter) async {
+ await waitUntilIsolateIsRunnable(isolateId);
+ vmService.AllocationProfile allocationProfile =
+ await _serviceClient.getAllocationProfile(isolateId);
+ for (vmService.ClassHeapStats member in allocationProfile.members) {
+ if (member.classRef.name != filter) continue;
+ vmService.Class c =
+ await _serviceClient.getObject(isolateId, member.classRef.id);
+ print("Found ${c.name} (location: ${c.location})");
+ print("${member.classRef.name}: "
+ "(instancesCurrent: ${member.instancesCurrent})");
+ print("");
+
+ vmService.InstanceSet instances = await _serviceClient.getInstances(
+ isolateId, member.classRef.id, 10000);
+ print(" => Got ${instances.instances.length} instances");
+ print("");
+
+ for (vmService.ObjRef instance in instances.instances) {
+ var receivedObject =
+ await _serviceClient.getObject(isolateId, instance.id);
+ print("Instance: $receivedObject");
+ vmService.RetainingPath retainingPath =
+ await _serviceClient.getRetainingPath(isolateId, instance.id, 1000);
+ print("Retaining path: (length ${retainingPath.length}");
+ for (int i = 0; i < retainingPath.elements.length; i++) {
+ print(" [$i] = ${retainingPath.elements[i]}");
+ }
+
+ print("");
+ }
+ }
+ print("Done!");
+ }
+
Future<String> getIsolateId() async {
vmService.VM vm = await _serviceClient.getVM();
if (vm.isolates.length != 1) {
@@ -169,18 +212,66 @@
}
}
-class VMServiceHeapHelper extends VMServiceHeapHelperBase {
+abstract class LaunchingVMServiceHeapHelper extends VMServiceHeapHelperBase {
Process _process;
bool _started = false;
+
+ void start(List<String> scriptAndArgs) async {
+ if (_started) throw "Already started";
+ _started = true;
+ _process = await Process.start(
+ Platform.resolvedExecutable,
+ ["--pause_isolates_on_start", "--enable-vm-service=0"]
+ ..addAll(scriptAndArgs));
+ _process.stdout
+ .transform(utf8.decoder)
+ .transform(new LineSplitter())
+ .listen((line) {
+ const kObservatoryListening = 'Observatory listening on ';
+ if (line.startsWith(kObservatoryListening)) {
+ Uri observatoryUri =
+ Uri.parse(line.substring(kObservatoryListening.length));
+ _setupAndRun(observatoryUri);
+ }
+ stdout.writeln("> $line");
+ });
+ _process.stderr
+ .transform(utf8.decoder)
+ .transform(new LineSplitter())
+ .listen((line) {
+ stderr.writeln("> $line");
+ });
+ // ignore: unawaited_futures
+ _process.exitCode.then((value) {
+ processExited(value);
+ });
+ }
+
+ void processExited(int exitCode) {}
+
+ void killProcess() {
+ _process.kill();
+ }
+
+ void _setupAndRun(Uri observatoryUri) async {
+ await connect(observatoryUri);
+ await run();
+ }
+
+ Future<void> run();
+}
+
+class VMServiceHeapHelperSpecificExactLeakFinder
+ extends LaunchingVMServiceHeapHelper {
final Map<Uri, Map<String, List<String>>> _interests =
new Map<Uri, Map<String, List<String>>>();
final Map<Uri, Map<String, List<String>>> _prettyPrints =
new Map<Uri, Map<String, List<String>>>();
final bool throwOnPossibleLeak;
- VMServiceHeapHelper(List<Interest> interests, List<Interest> prettyPrints,
- this.throwOnPossibleLeak) {
+ VMServiceHeapHelperSpecificExactLeakFinder(List<Interest> interests,
+ List<Interest> prettyPrints, this.throwOnPossibleLeak) {
if (interests.isEmpty) throw "Empty list of interests given";
for (Interest interest in interests) {
Map<String, List<String>> classToFields = _interests[interest.uri];
@@ -210,55 +301,24 @@
}
}
- void start(List<String> scriptAndArgs) async {
- if (_started) throw "Already started";
- _started = true;
- _process = await Process.start(
- Platform.resolvedExecutable,
- ["--pause_isolates_on_start", "--enable-vm-service=0"]
- ..addAll(scriptAndArgs));
- _process.stdout
- .transform(utf8.decoder)
- .transform(new LineSplitter())
- .listen((line) {
- const kObservatoryListening = 'Observatory listening on ';
- if (line.startsWith(kObservatoryListening)) {
- Uri observatoryUri =
- Uri.parse(line.substring(kObservatoryListening.length));
- _setupAndRun(observatoryUri);
- }
- stdout.writeln("> $line");
- });
- _process.stderr
- .transform(utf8.decoder)
- .transform(new LineSplitter())
- .listen((line) {
- stderr.writeln("> $line");
- });
- }
-
- void _setupAndRun(Uri observatoryUri) async {
- await connect(observatoryUri);
- await _run();
- }
-
- void _run() async {
+ @override
+ Future<void> run() async {
vmService.VM vm = await _serviceClient.getVM();
if (vm.isolates.length != 1) {
throw "Expected 1 isolate, got ${vm.isolates.length}";
}
vmService.IsolateRef isolateRef = vm.isolates.single;
- await _forceGC(isolateRef.id);
+ await forceGC(isolateRef.id);
assert(await _isPausedAtStart(isolateRef.id));
await _serviceClient.resume(isolateRef.id);
int iterationNumber = 1;
while (true) {
- await _waitUntilPaused(isolateRef.id);
+ await waitUntilPaused(isolateRef.id);
print("Iteration: #$iterationNumber");
iterationNumber++;
- await _forceGC(isolateRef.id);
+ await forceGC(isolateRef.id);
vmService.HeapSnapshotGraph heapSnapshotGraph =
await vmService.HeapSnapshotGraph.getSnapshot(
@@ -273,7 +333,7 @@
if (interests != null && interests.isNotEmpty) {
List<String> fieldsToUse = interests[c.name];
if (fieldsToUse != null && fieldsToUse.isNotEmpty) {
- for (HeapGraphElement instance in c.instances) {
+ for (HeapGraphElement instance in c.getInstances(graph)) {
StringBuffer sb = new StringBuffer();
sb.writeln("Instance: ${instance}");
if (instance is HeapGraphElementActual) {
@@ -450,17 +510,19 @@
HeapGraph convertHeapGraph(vmService.HeapSnapshotGraph graph) {
HeapGraphClassSentinel classSentinel = new HeapGraphClassSentinel();
- List<HeapGraphClassActual> classes = [];
+ List<HeapGraphClassActual> classes =
+ new List<HeapGraphClassActual>(graph.classes.length);
for (int i = 0; i < graph.classes.length; i++) {
vmService.HeapSnapshotClass c = graph.classes[i];
- classes.add(new HeapGraphClassActual(c));
+ classes[i] = new HeapGraphClassActual(c);
}
HeapGraphElementSentinel elementSentinel = new HeapGraphElementSentinel();
- List<HeapGraphElementActual> elements = [];
+ List<HeapGraphElementActual> elements =
+ new List<HeapGraphElementActual>(graph.objects.length);
for (int i = 0; i < graph.objects.length; i++) {
vmService.HeapSnapshotObject o = graph.objects[i];
- elements.add(new HeapGraphElementActual(o));
+ elements[i] = new HeapGraphElementActual(o);
}
for (int i = 0; i < graph.objects.length; i++) {
@@ -471,17 +533,17 @@
} else {
converted.class_ = classes[o.classId - 1];
}
- converted.class_.instances.add(converted);
- for (int refId in o.references) {
- HeapGraphElement ref;
- if (refId == 0) {
- ref = elementSentinel;
- } else {
- ref = elements[refId - 1];
+ converted.referencesFiller = () {
+ for (int refId in o.references) {
+ HeapGraphElement ref;
+ if (refId == 0) {
+ ref = elementSentinel;
+ } else {
+ ref = elements[refId - 1];
+ }
+ converted.references.add(ref);
}
- converted.references.add(ref);
- ref.referenced.add(converted);
- }
+ };
}
return new HeapGraph(classSentinel, classes, elementSentinel, elements);
@@ -499,10 +561,15 @@
abstract class HeapGraphElement {
/// Outbound references, i.e. this element points to elements in this list.
- List<HeapGraphElement> references = [];
-
- /// Inbound references, i.e. this element is pointed to by these elements.
- Set<HeapGraphElement> referenced = {};
+ List<HeapGraphElement> _references;
+ void Function() referencesFiller;
+ List<HeapGraphElement> get references {
+ if (_references == null && referencesFiller != null) {
+ _references = new List<HeapGraphElement>();
+ referencesFiller();
+ }
+ return _references;
+ }
String getPrettyPrint(Map<Uri, Map<String, List<String>>> prettyPrints) {
if (this is HeapGraphElementActual) {
@@ -527,7 +594,7 @@
return "${c.name}[" +
fields.map((field) {
return "$field: "
- "${me.getField(field).getPrettyPrint(prettyPrints)}";
+ "${me.getField(field)?.getPrettyPrint(prettyPrints)}";
}).join(", ") +
"]";
}
@@ -584,7 +651,19 @@
}
abstract class HeapGraphClass {
- List<HeapGraphElement> instances = [];
+ List<HeapGraphElement> _instances;
+ List<HeapGraphElement> getInstances(HeapGraph graph) {
+ if (_instances == null) {
+ _instances = new List<HeapGraphElement>();
+ for (int i = 0; i < graph.elements.length; i++) {
+ HeapGraphElementActual converted = graph.elements[i];
+ if (converted.class_ == this) {
+ _instances.add(converted);
+ }
+ }
+ }
+ return _instances;
+ }
}
class HeapGraphClassSentinel extends HeapGraphClass {
diff --git a/pkg/front_end/testcases/agnostic/identical.dart b/pkg/front_end/testcases/agnostic/identical.dart
new file mode 100644
index 0000000..a51ea1e
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/identical.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2020, 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.
+
+const a = <int>[];
+const b = <int?>[];
+const c = identical(a, b);
+
+main() {}
diff --git a/pkg/front_end/testcases/agnostic/identical.dart.outline.expect b/pkg/front_end/testcases/agnostic/identical.dart.outline.expect
new file mode 100644
index 0000000..3163945
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/identical.dart.outline.expect
@@ -0,0 +1,9 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = const <core::int>[];
+static const field core::List<core::int?> b = const <core::int?>[];
+static const field core::bool c = core::identical(self::a, self::b);
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/agnostic/identical.dart.strong.expect b/pkg/front_end/testcases/agnostic/identical.dart.strong.expect
new file mode 100644
index 0000000..c195846
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/identical.dart.strong.expect
@@ -0,0 +1,26 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/agnostic/identical.dart:7:11: Error: Constant evaluation error:
+// const c = identical(a, b);
+// ^
+// pkg/front_end/testcases/agnostic/identical.dart:7:11: Context: Constant value is not strong/weak mode agnostic.
+// const c = identical(a, b);
+// ^
+// pkg/front_end/testcases/agnostic/identical.dart:7:7: Context: While analyzing:
+// const c = identical(a, b);
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C2;
+static const field core::bool c = invalid-expression "Constant value is not strong/weak mode agnostic.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int>[]
+ #C2 = <core::int?>[]
+}
diff --git a/pkg/front_end/testcases/agnostic/identical.dart.strong.transformed.expect b/pkg/front_end/testcases/agnostic/identical.dart.strong.transformed.expect
new file mode 100644
index 0000000..c195846
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/identical.dart.strong.transformed.expect
@@ -0,0 +1,26 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/agnostic/identical.dart:7:11: Error: Constant evaluation error:
+// const c = identical(a, b);
+// ^
+// pkg/front_end/testcases/agnostic/identical.dart:7:11: Context: Constant value is not strong/weak mode agnostic.
+// const c = identical(a, b);
+// ^
+// pkg/front_end/testcases/agnostic/identical.dart:7:7: Context: While analyzing:
+// const c = identical(a, b);
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C2;
+static const field core::bool c = invalid-expression "Constant value is not strong/weak mode agnostic.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int>[]
+ #C2 = <core::int?>[]
+}
diff --git a/pkg/front_end/testcases/agnostic/identical.dart.weak.expect b/pkg/front_end/testcases/agnostic/identical.dart.weak.expect
new file mode 100644
index 0000000..4a31c8f
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/identical.dart.weak.expect
@@ -0,0 +1,13 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C1;
+static const field core::bool c = #C2;
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int*>[]
+ #C2 = true
+}
diff --git a/pkg/front_end/testcases/agnostic/identical.dart.weak.transformed.expect b/pkg/front_end/testcases/agnostic/identical.dart.weak.transformed.expect
new file mode 100644
index 0000000..4a31c8f
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/identical.dart.weak.transformed.expect
@@ -0,0 +1,13 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C1;
+static const field core::bool c = #C2;
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int*>[]
+ #C2 = true
+}
diff --git a/pkg/front_end/testcases/agnostic/map.dart b/pkg/front_end/testcases/agnostic/map.dart
new file mode 100644
index 0000000..1847bf5
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/map.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2020, 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.
+
+const a = <int>[];
+const b = <int?>[];
+const c = {a: 0, b: 1};
+
+main() {}
diff --git a/pkg/front_end/testcases/agnostic/map.dart.outline.expect b/pkg/front_end/testcases/agnostic/map.dart.outline.expect
new file mode 100644
index 0000000..958bfdc
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/map.dart.outline.expect
@@ -0,0 +1,9 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = const <core::int>[];
+static const field core::List<core::int?> b = const <core::int?>[];
+static const field core::Map<core::List<core::int?>, core::int> c = const <core::List<core::int?>, core::int>{self::a: 0, self::b: 1};
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/agnostic/map.dart.strong.expect b/pkg/front_end/testcases/agnostic/map.dart.strong.expect
new file mode 100644
index 0000000..e976e83
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/map.dart.strong.expect
@@ -0,0 +1,26 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/agnostic/map.dart:7:11: Error: Constant evaluation error:
+// const c = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/agnostic/map.dart:7:18: Context: Constant value is not strong/weak mode agnostic.
+// const c = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/agnostic/map.dart:7:7: Context: While analyzing:
+// const c = {a: 0, b: 1};
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C2;
+static const field core::Map<core::List<core::int?>, core::int> c = invalid-expression "Constant value is not strong/weak mode agnostic.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int>[]
+ #C2 = <core::int?>[]
+}
diff --git a/pkg/front_end/testcases/agnostic/map.dart.strong.transformed.expect b/pkg/front_end/testcases/agnostic/map.dart.strong.transformed.expect
new file mode 100644
index 0000000..e976e83
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/map.dart.strong.transformed.expect
@@ -0,0 +1,26 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/agnostic/map.dart:7:11: Error: Constant evaluation error:
+// const c = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/agnostic/map.dart:7:18: Context: Constant value is not strong/weak mode agnostic.
+// const c = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/agnostic/map.dart:7:7: Context: While analyzing:
+// const c = {a: 0, b: 1};
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C2;
+static const field core::Map<core::List<core::int?>, core::int> c = invalid-expression "Constant value is not strong/weak mode agnostic.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int>[]
+ #C2 = <core::int?>[]
+}
diff --git a/pkg/front_end/testcases/agnostic/map.dart.weak.expect b/pkg/front_end/testcases/agnostic/map.dart.weak.expect
new file mode 100644
index 0000000..8b33ddc
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/map.dart.weak.expect
@@ -0,0 +1,25 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/agnostic/map.dart:7:11: Error: Constant evaluation error:
+// const c = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/agnostic/map.dart:7:18: Context: The key '<int>[]' conflicts with another existing key in the map.
+// const c = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/agnostic/map.dart:7:7: Context: While analyzing:
+// const c = {a: 0, b: 1};
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C1;
+static const field core::Map<core::List<core::int?>, core::int> c = invalid-expression "The key '<int>[]' conflicts with another existing key in the map.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int*>[]
+}
diff --git a/pkg/front_end/testcases/agnostic/map.dart.weak.transformed.expect b/pkg/front_end/testcases/agnostic/map.dart.weak.transformed.expect
new file mode 100644
index 0000000..8b33ddc
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/map.dart.weak.transformed.expect
@@ -0,0 +1,25 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/agnostic/map.dart:7:11: Error: Constant evaluation error:
+// const c = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/agnostic/map.dart:7:18: Context: The key '<int>[]' conflicts with another existing key in the map.
+// const c = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/agnostic/map.dart:7:7: Context: While analyzing:
+// const c = {a: 0, b: 1};
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C1;
+static const field core::Map<core::List<core::int?>, core::int> c = invalid-expression "The key '<int>[]' conflicts with another existing key in the map.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int*>[]
+}
diff --git a/pkg/front_end/testcases/agnostic/set.dart b/pkg/front_end/testcases/agnostic/set.dart
new file mode 100644
index 0000000..972aa29
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/set.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2020, 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.
+
+const a = <int>[];
+const b = <int?>[];
+const c = {a, b};
+
+main() {}
diff --git a/pkg/front_end/testcases/agnostic/set.dart.outline.expect b/pkg/front_end/testcases/agnostic/set.dart.outline.expect
new file mode 100644
index 0000000..da68e96
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/set.dart.outline.expect
@@ -0,0 +1,9 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = const <core::int>[];
+static const field core::List<core::int?> b = const <core::int?>[];
+static const field core::Set<core::List<core::int?>> c = const <core::List<core::int?>>{self::a, self::b};
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/agnostic/set.dart.strong.expect b/pkg/front_end/testcases/agnostic/set.dart.strong.expect
new file mode 100644
index 0000000..b92b78e
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/set.dart.strong.expect
@@ -0,0 +1,26 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/agnostic/set.dart:7:11: Error: Constant evaluation error:
+// const c = {a, b};
+// ^
+// pkg/front_end/testcases/agnostic/set.dart:7:15: Context: Constant value is not strong/weak mode agnostic.
+// const c = {a, b};
+// ^
+// pkg/front_end/testcases/agnostic/set.dart:7:7: Context: While analyzing:
+// const c = {a, b};
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C2;
+static const field core::Set<core::List<core::int?>> c = invalid-expression "Constant value is not strong/weak mode agnostic.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int>[]
+ #C2 = <core::int?>[]
+}
diff --git a/pkg/front_end/testcases/agnostic/set.dart.strong.transformed.expect b/pkg/front_end/testcases/agnostic/set.dart.strong.transformed.expect
new file mode 100644
index 0000000..b92b78e
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/set.dart.strong.transformed.expect
@@ -0,0 +1,26 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/agnostic/set.dart:7:11: Error: Constant evaluation error:
+// const c = {a, b};
+// ^
+// pkg/front_end/testcases/agnostic/set.dart:7:15: Context: Constant value is not strong/weak mode agnostic.
+// const c = {a, b};
+// ^
+// pkg/front_end/testcases/agnostic/set.dart:7:7: Context: While analyzing:
+// const c = {a, b};
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C2;
+static const field core::Set<core::List<core::int?>> c = invalid-expression "Constant value is not strong/weak mode agnostic.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int>[]
+ #C2 = <core::int?>[]
+}
diff --git a/pkg/front_end/testcases/agnostic/set.dart.weak.expect b/pkg/front_end/testcases/agnostic/set.dart.weak.expect
new file mode 100644
index 0000000..9864f71
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/set.dart.weak.expect
@@ -0,0 +1,25 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/agnostic/set.dart:7:11: Error: Constant evaluation error:
+// const c = {a, b};
+// ^
+// pkg/front_end/testcases/agnostic/set.dart:7:15: Context: The element '<int>[]' conflicts with another existing element in the set.
+// const c = {a, b};
+// ^
+// pkg/front_end/testcases/agnostic/set.dart:7:7: Context: While analyzing:
+// const c = {a, b};
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C1;
+static const field core::Set<core::List<core::int?>> c = invalid-expression "The element '<int>[]' conflicts with another existing element in the set.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int*>[]
+}
diff --git a/pkg/front_end/testcases/agnostic/set.dart.weak.transformed.expect b/pkg/front_end/testcases/agnostic/set.dart.weak.transformed.expect
new file mode 100644
index 0000000..9864f71
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/set.dart.weak.transformed.expect
@@ -0,0 +1,25 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/agnostic/set.dart:7:11: Error: Constant evaluation error:
+// const c = {a, b};
+// ^
+// pkg/front_end/testcases/agnostic/set.dart:7:15: Context: The element '<int>[]' conflicts with another existing element in the set.
+// const c = {a, b};
+// ^
+// pkg/front_end/testcases/agnostic/set.dart:7:7: Context: While analyzing:
+// const c = {a, b};
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C1;
+static const field core::List<core::int?> b = #C1;
+static const field core::Set<core::List<core::int?>> c = invalid-expression "The element '<int>[]' conflicts with another existing element in the set.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = <core::int*>[]
+}
diff --git a/pkg/front_end/testcases/agnostic/test.options b/pkg/front_end/testcases/agnostic/test.options
new file mode 100644
index 0000000..d9c0d26
--- /dev/null
+++ b/pkg/front_end/testcases/agnostic/test.options
@@ -0,0 +1,3 @@
+--enable-experiment=non-nullable
+--force-nnbd-checks
+--nnbd-agnostic
\ No newline at end of file
diff --git a/pkg/front_end/testcases/general/issue40662.dart b/pkg/front_end/testcases/general/issue40662.dart
new file mode 100644
index 0000000..8123df8
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue40662.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2020, 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.
+//
+// Regression test for https://github.com/dart-lang/sdk/issues/40662.
+
+bar(int a, List<int> b) {
+ expect(-1, a);
+ expect(-1, (b[0] - 2));
+}
+
+foo(int x) async => bar(x - 1, x != null ? [x + 1, x + 2, await null] : null);
+
+void main() async => await foo(0);
+
+expect(expected, actual) {
+ if (expected != actual) throw "Expected $expected, actual $actual";
+}
diff --git a/pkg/front_end/testcases/general/issue40662.dart.outline.expect b/pkg/front_end/testcases/general/issue40662.dart.outline.expect
new file mode 100644
index 0000000..4bf75b4
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue40662.dart.outline.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method bar(core::int* a, core::List<core::int*>* b) → dynamic
+ ;
+static method foo(core::int* x) → dynamic
+ ;
+static method main() → void
+ ;
+static method expect(dynamic expected, dynamic actual) → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/issue40662.dart.strong.expect b/pkg/front_end/testcases/general/issue40662.dart.strong.expect
new file mode 100644
index 0000000..d0d2fa1
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue40662.dart.strong.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method bar(core::int* a, core::List<core::int*>* b) → dynamic {
+ self::expect(1.{core::int::unary-}(), a);
+ self::expect(1.{core::int::unary-}(), b.{core::List::[]}(0).{core::num::-}(2));
+}
+static method foo(core::int* x) → dynamic async
+ return self::bar(x.{core::num::-}(1), !x.{core::num::==}(null) ?{core::List<core::int*>*} <core::int*>[x.{core::num::+}(1), x.{core::num::+}(2), await null] : null);
+static method main() → void async
+ return await self::foo(0);
+static method expect(dynamic expected, dynamic actual) → dynamic {
+ if(!expected.{core::Object::==}(actual))
+ throw "Expected ${expected}, actual ${actual}";
+}
diff --git a/pkg/front_end/testcases/general/issue40662.dart.strong.transformed.expect b/pkg/front_end/testcases/general/issue40662.dart.strong.transformed.expect
new file mode 100644
index 0000000..afe0a4f
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue40662.dart.strong.transformed.expect
@@ -0,0 +1,85 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+import "dart:_internal" as _in;
+
+static method bar(core::int* a, core::List<core::int*>* b) → dynamic {
+ self::expect(1.{core::int::unary-}(), a);
+ self::expect(1.{core::int::unary-}(), b.{core::List::[]}(0).{core::num::-}(2));
+}
+static method foo(core::int* x) → dynamic /* originally async */ {
+ final asy::_AsyncAwaitCompleter<dynamic>* :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>();
+ asy::FutureOr<dynamic>* :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ core::int* :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ core::int* :async_temporary_0;
+ core::int* :async_temporary_1;
+ core::List<core::int*>* :async_temporary_2;
+ core::int* :async_temporary_3;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ :async_temporary_3 = x.{core::num::-}(1);
+ if(!x.{core::num::==}(null)) {
+ :async_temporary_1 = x.{core::num::+}(1);
+ :async_temporary_0 = x.{core::num::+}(2);
+ [yield] let dynamic #t1 = asy::_awaitHelper(null, :async_op_then, :async_op_error, :async_op) in null;
+ :async_temporary_2 = <core::int*>[:async_temporary_1, :async_temporary_0, _in::unsafeCast<core::Null?>(:result)];
+ }
+ else {
+ :async_temporary_2 = null;
+ }
+ :return_value = self::bar(:async_temporary_3, :async_temporary_2);
+ break #L1;
+ }
+ asy::_completeOnAsyncReturn(:async_completer, :return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :async_completer.start(:async_op);
+ return :async_completer.{asy::Completer::future};
+}
+static method main() → void /* originally async */ {
+ final asy::_AsyncAwaitCompleter<dynamic>* :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>();
+ asy::FutureOr<dynamic>* :return_value;
+ dynamic :async_stack_trace;
+ dynamic :async_op_then;
+ dynamic :async_op_error;
+ core::int* :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ dynamic :saved_try_context_var0;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L2:
+ {
+ [yield] let dynamic #t2 = asy::_awaitHelper(self::foo(0), :async_op_then, :async_op_error, :async_op) in null;
+ :return_value = :result;
+ break #L2;
+ }
+ asy::_completeOnAsyncReturn(:async_completer, :return_value);
+ return;
+ }
+ on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+ :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+ }
+ :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :async_completer.start(:async_op);
+ return :async_completer.{asy::Completer::future};
+}
+static method expect(dynamic expected, dynamic actual) → dynamic {
+ if(!expected.{core::Object::==}(actual))
+ throw "Expected ${expected}, actual ${actual}";
+}
diff --git a/pkg/front_end/testcases/general/issue40744.dart b/pkg/front_end/testcases/general/issue40744.dart
new file mode 100644
index 0000000..3d0dbc4
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue40744.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2020, 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.
+
+const generatorConfigDefaultJson = <String, dynamic>{'a': 1};
+
+void helper(Map<String, dynamic> input) {
+ print(input);
+}
+
+void main() {
+ final nullValueMap = Map.fromEntries(
+ generatorConfigDefaultJson.entries.map((e) => MapEntry(e.key, null)));
+ helper(nullValueMap);
+}
diff --git a/pkg/front_end/testcases/general/issue40744.dart.outline.expect b/pkg/front_end/testcases/general/issue40744.dart.outline.expect
new file mode 100644
index 0000000..373527d
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue40744.dart.outline.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::Map<core::String*, dynamic>* generatorConfigDefaultJson = const <core::String*, dynamic>{"a": 1};
+static method helper(core::Map<core::String*, dynamic>* input) → void
+ ;
+static method main() → void
+ ;
diff --git a/pkg/front_end/testcases/general/issue40744.dart.strong.expect b/pkg/front_end/testcases/general/issue40744.dart.strong.expect
new file mode 100644
index 0000000..fe38c65
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue40744.dart.strong.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::Map<core::String*, dynamic>* generatorConfigDefaultJson = #C4;
+static method helper(core::Map<core::String*, dynamic>* input) → void {
+ core::print(input);
+}
+static method main() → void {
+ final core::Map<core::String*, core::Null?>* nullValueMap = core::Map::fromEntries<core::String*, core::Null?>((#C4).{core::Map::entries}.{core::Iterable::map}<core::MapEntry<core::String*, core::Null?>*>((core::MapEntry<core::String*, dynamic>* e) → core::MapEntry<core::String*, core::Null?>* => new core::MapEntry::_<core::String*, core::Null?>(e.{core::MapEntry::key}, null)));
+ self::helper(nullValueMap);
+}
+
+constants {
+ #C1 = "a"
+ #C2 = 1
+ #C3 = <dynamic>[#C1, #C2]
+ #C4 = core::_ImmutableMap<core::String*, dynamic> {_kvPairs:#C3}
+}
diff --git a/pkg/front_end/testcases/general/issue40744.dart.strong.transformed.expect b/pkg/front_end/testcases/general/issue40744.dart.strong.transformed.expect
new file mode 100644
index 0000000..fe38c65
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue40744.dart.strong.transformed.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::Map<core::String*, dynamic>* generatorConfigDefaultJson = #C4;
+static method helper(core::Map<core::String*, dynamic>* input) → void {
+ core::print(input);
+}
+static method main() → void {
+ final core::Map<core::String*, core::Null?>* nullValueMap = core::Map::fromEntries<core::String*, core::Null?>((#C4).{core::Map::entries}.{core::Iterable::map}<core::MapEntry<core::String*, core::Null?>*>((core::MapEntry<core::String*, dynamic>* e) → core::MapEntry<core::String*, core::Null?>* => new core::MapEntry::_<core::String*, core::Null?>(e.{core::MapEntry::key}, null)));
+ self::helper(nullValueMap);
+}
+
+constants {
+ #C1 = "a"
+ #C2 = 1
+ #C3 = <dynamic>[#C1, #C2]
+ #C4 = core::_ImmutableMap<core::String*, dynamic> {_kvPairs:#C3}
+}
diff --git a/pkg/front_end/testcases/implicit_getter_calls/test.options b/pkg/front_end/testcases/implicit_getter_calls/test.options
index 94b4d97..fe39d71 100644
--- a/pkg/front_end/testcases/implicit_getter_calls/test.options
+++ b/pkg/front_end/testcases/implicit_getter_calls/test.options
@@ -1 +1,2 @@
--force-no-explicit-getter-calls
+--target=none
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_30.yaml.world.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_30.yaml.world.1.expect
index 1e3c1a2..2d01211 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_30.yaml.world.1.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_30.yaml.world.1.expect
@@ -5,7 +5,7 @@
late field dart.core::int? field5 = 42;
late field dart.core::int? field6;
late final field dart.core::int? field7 = 42;
- late final field dart.core::int? field8;
+ late final [setter] field dart.core::int? field8;
late static field dart.core::int? field9 = 42;
late static field dart.core::int? field10;
late static final field dart.core::int? field11 = 42;
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_30.yaml.world.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_30.yaml.world.2.expect
index b72bd25..65977cb 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_30.yaml.world.2.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_30.yaml.world.2.expect
@@ -5,7 +5,7 @@
late field dart.core::int? field5 = 42;
late field dart.core::int? field6;
late final field dart.core::int? field7 = 42;
- late final field dart.core::int? field8;
+ late final [setter] field dart.core::int? field8;
late static field dart.core::int? field9 = 42;
late static field dart.core::int? field10;
late static final field dart.core::int? field11 = 42;
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml
new file mode 100644
index 0000000..7b04eeb
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml
@@ -0,0 +1,53 @@
+# Copyright (c) 2020, 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.md file.
+
+# Reproduce a crash.
+
+type: newworld
+worlds:
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ sources:
+ main.dart: |
+ import 'file1.dart';
+
+ class Class1 extends Class2 {}
+ file1.dart: |
+ import 'file2.dart';
+
+ class Class2 extends Class3 {
+ Class3 foo;
+ }
+ file2.dart: |
+ abstract class Class3 {
+ Class3 foo;
+ }
+ expectedLibraryCount: 3
+
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - main.dart
+ expectedLibraryCount: 3
+ expectsRebuildBodiesOnly: true
+
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - file2.dart
+ expectedLibraryCount: 3
+ expectsRebuildBodiesOnly: true
+
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - main.dart
+ expectedLibraryCount: 3
+ expectsRebuildBodiesOnly: true
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.1.expect
new file mode 100644
index 0000000..f1a33bd
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.1.expect
@@ -0,0 +1,31 @@
+main = <No Member>;
+library from "org-dartlang-test:///file1.dart" as fil {
+
+ import "org-dartlang-test:///file2.dart";
+
+ class Class2 extends fil2::Class3 {
+ field fil2::Class3* foo = null;
+ synthetic constructor •() → fil::Class2*
+ : super fil2::Class3::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///file2.dart" as fil2 {
+
+ abstract class Class3 extends dart.core::Object {
+ field fil2::Class3* foo = null;
+ synthetic constructor •() → fil2::Class3*
+ : super dart.core::Object::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///file1.dart";
+
+ class Class1 extends fil::Class2 {
+ synthetic constructor •() → main::Class1*
+ : super fil::Class2::•()
+ ;
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.2.expect
new file mode 100644
index 0000000..f1a33bd
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.2.expect
@@ -0,0 +1,31 @@
+main = <No Member>;
+library from "org-dartlang-test:///file1.dart" as fil {
+
+ import "org-dartlang-test:///file2.dart";
+
+ class Class2 extends fil2::Class3 {
+ field fil2::Class3* foo = null;
+ synthetic constructor •() → fil::Class2*
+ : super fil2::Class3::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///file2.dart" as fil2 {
+
+ abstract class Class3 extends dart.core::Object {
+ field fil2::Class3* foo = null;
+ synthetic constructor •() → fil2::Class3*
+ : super dart.core::Object::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///file1.dart";
+
+ class Class1 extends fil::Class2 {
+ synthetic constructor •() → main::Class1*
+ : super fil::Class2::•()
+ ;
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.3.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.3.expect
new file mode 100644
index 0000000..f1a33bd
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.3.expect
@@ -0,0 +1,31 @@
+main = <No Member>;
+library from "org-dartlang-test:///file1.dart" as fil {
+
+ import "org-dartlang-test:///file2.dart";
+
+ class Class2 extends fil2::Class3 {
+ field fil2::Class3* foo = null;
+ synthetic constructor •() → fil::Class2*
+ : super fil2::Class3::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///file2.dart" as fil2 {
+
+ abstract class Class3 extends dart.core::Object {
+ field fil2::Class3* foo = null;
+ synthetic constructor •() → fil2::Class3*
+ : super dart.core::Object::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///file1.dart";
+
+ class Class1 extends fil::Class2 {
+ synthetic constructor •() → main::Class1*
+ : super fil::Class2::•()
+ ;
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.4.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.4.expect
new file mode 100644
index 0000000..f1a33bd
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_36.yaml.world.4.expect
@@ -0,0 +1,31 @@
+main = <No Member>;
+library from "org-dartlang-test:///file1.dart" as fil {
+
+ import "org-dartlang-test:///file2.dart";
+
+ class Class2 extends fil2::Class3 {
+ field fil2::Class3* foo = null;
+ synthetic constructor •() → fil::Class2*
+ : super fil2::Class3::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///file2.dart" as fil2 {
+
+ abstract class Class3 extends dart.core::Object {
+ field fil2::Class3* foo = null;
+ synthetic constructor •() → fil2::Class3*
+ : super dart.core::Object::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///file1.dart";
+
+ class Class1 extends fil::Class2 {
+ synthetic constructor •() → main::Class1*
+ : super fil::Class2::•()
+ ;
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml
new file mode 100644
index 0000000..a91a0c1
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml
@@ -0,0 +1,52 @@
+# Copyright (c) 2020, 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.md file.
+
+# Reproduce a crash.
+
+type: newworld
+worlds:
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ sources:
+ main.dart: |
+ import 'file2.dart';
+ class A extends B implements C {}
+ file1.dart: |
+ class D {
+ D parent;
+ }
+ file2.dart: |
+ import 'file1.dart';
+ abstract class C implements D {}
+ class B extends D {
+ D parent;
+ }
+ expectedLibraryCount: 3
+
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - main.dart
+ expectedLibraryCount: 3
+ expectsRebuildBodiesOnly: true
+
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - file1.dart
+ expectedLibraryCount: 3
+ expectsRebuildBodiesOnly: true
+
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - main.dart
+ expectedLibraryCount: 3
+ expectsRebuildBodiesOnly: true
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.1.expect
new file mode 100644
index 0000000..24f144f
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.1.expect
@@ -0,0 +1,36 @@
+main = <No Member>;
+library from "org-dartlang-test:///file1.dart" as fil {
+
+ class D extends dart.core::Object {
+ field fil::D* parent = null;
+ synthetic constructor •() → fil::D*
+ : super dart.core::Object::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///file2.dart" as fil2 {
+
+ import "org-dartlang-test:///file1.dart";
+
+ abstract class C extends dart.core::Object implements fil::D {
+ synthetic constructor •() → fil2::C*
+ : super dart.core::Object::•()
+ ;
+ }
+ class B extends fil::D {
+ field fil::D* parent = null;
+ synthetic constructor •() → fil2::B*
+ : super fil::D::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///file2.dart";
+
+ class A extends fil2::B implements fil2::C {
+ synthetic constructor •() → main::A*
+ : super fil2::B::•()
+ ;
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.2.expect
new file mode 100644
index 0000000..24f144f
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.2.expect
@@ -0,0 +1,36 @@
+main = <No Member>;
+library from "org-dartlang-test:///file1.dart" as fil {
+
+ class D extends dart.core::Object {
+ field fil::D* parent = null;
+ synthetic constructor •() → fil::D*
+ : super dart.core::Object::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///file2.dart" as fil2 {
+
+ import "org-dartlang-test:///file1.dart";
+
+ abstract class C extends dart.core::Object implements fil::D {
+ synthetic constructor •() → fil2::C*
+ : super dart.core::Object::•()
+ ;
+ }
+ class B extends fil::D {
+ field fil::D* parent = null;
+ synthetic constructor •() → fil2::B*
+ : super fil::D::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///file2.dart";
+
+ class A extends fil2::B implements fil2::C {
+ synthetic constructor •() → main::A*
+ : super fil2::B::•()
+ ;
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.3.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.3.expect
new file mode 100644
index 0000000..24f144f
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.3.expect
@@ -0,0 +1,36 @@
+main = <No Member>;
+library from "org-dartlang-test:///file1.dart" as fil {
+
+ class D extends dart.core::Object {
+ field fil::D* parent = null;
+ synthetic constructor •() → fil::D*
+ : super dart.core::Object::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///file2.dart" as fil2 {
+
+ import "org-dartlang-test:///file1.dart";
+
+ abstract class C extends dart.core::Object implements fil::D {
+ synthetic constructor •() → fil2::C*
+ : super dart.core::Object::•()
+ ;
+ }
+ class B extends fil::D {
+ field fil::D* parent = null;
+ synthetic constructor •() → fil2::B*
+ : super fil::D::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///file2.dart";
+
+ class A extends fil2::B implements fil2::C {
+ synthetic constructor •() → main::A*
+ : super fil2::B::•()
+ ;
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.4.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.4.expect
new file mode 100644
index 0000000..24f144f
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_37.yaml.world.4.expect
@@ -0,0 +1,36 @@
+main = <No Member>;
+library from "org-dartlang-test:///file1.dart" as fil {
+
+ class D extends dart.core::Object {
+ field fil::D* parent = null;
+ synthetic constructor •() → fil::D*
+ : super dart.core::Object::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///file2.dart" as fil2 {
+
+ import "org-dartlang-test:///file1.dart";
+
+ abstract class C extends dart.core::Object implements fil::D {
+ synthetic constructor •() → fil2::C*
+ : super dart.core::Object::•()
+ ;
+ }
+ class B extends fil::D {
+ field fil::D* parent = null;
+ synthetic constructor •() → fil2::B*
+ : super fil::D::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///file2.dart";
+
+ class A extends fil2::B implements fil2::C {
+ synthetic constructor •() → main::A*
+ : super fil2::B::•()
+ ;
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml
new file mode 100644
index 0000000..28d788d
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml
@@ -0,0 +1,41 @@
+# Copyright (c) 2020, 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.md file.
+
+# Reproduce a crash.
+
+type: newworld
+worlds:
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ sources:
+ main.dart: |
+ import 'lib.dart';
+ class X {}
+ int foo(X x) {
+ return x is Y ? x.foo : null;
+ }
+ lib.dart: |
+ import 'main.dart';
+ class Y implements X {
+ int get foo => 42;
+ }
+ expectedLibraryCount: 2
+
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - main.dart
+ expectedLibraryCount: 2
+ expectsRebuildBodiesOnly: true
+
+ - entry: main.dart
+ useExperimentalInvalidation: true
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - lib.dart
+ expectedLibraryCount: 2
+ expectsRebuildBodiesOnly: true
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml.world.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml.world.1.expect
new file mode 100644
index 0000000..dac9f11
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml.world.1.expect
@@ -0,0 +1,26 @@
+main = <No Member>;
+library from "org-dartlang-test:///lib.dart" as lib {
+
+ import "org-dartlang-test:///main.dart";
+
+ class Y extends dart.core::Object implements main::X {
+ synthetic constructor •() → lib::Y*
+ : super dart.core::Object::•()
+ ;
+ get foo() → dart.core::int*
+ return 42;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///lib.dart";
+
+ class X extends dart.core::Object {
+ synthetic constructor •() → main::X*
+ : super dart.core::Object::•()
+ ;
+ }
+ static method foo(main::X* x) → dart.core::int* {
+ return x is lib::Y* ?{dart.core::int*} x{lib::Y*}.{lib::Y::foo} : null;
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml.world.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml.world.2.expect
new file mode 100644
index 0000000..dac9f11
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml.world.2.expect
@@ -0,0 +1,26 @@
+main = <No Member>;
+library from "org-dartlang-test:///lib.dart" as lib {
+
+ import "org-dartlang-test:///main.dart";
+
+ class Y extends dart.core::Object implements main::X {
+ synthetic constructor •() → lib::Y*
+ : super dart.core::Object::•()
+ ;
+ get foo() → dart.core::int*
+ return 42;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///lib.dart";
+
+ class X extends dart.core::Object {
+ synthetic constructor •() → main::X*
+ : super dart.core::Object::•()
+ ;
+ }
+ static method foo(main::X* x) → dart.core::int* {
+ return x is lib::Y* ?{dart.core::int*} x{lib::Y*}.{lib::Y::foo} : null;
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml.world.3.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml.world.3.expect
new file mode 100644
index 0000000..dac9f11
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_38.yaml.world.3.expect
@@ -0,0 +1,26 @@
+main = <No Member>;
+library from "org-dartlang-test:///lib.dart" as lib {
+
+ import "org-dartlang-test:///main.dart";
+
+ class Y extends dart.core::Object implements main::X {
+ synthetic constructor •() → lib::Y*
+ : super dart.core::Object::•()
+ ;
+ get foo() → dart.core::int*
+ return 42;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///lib.dart";
+
+ class X extends dart.core::Object {
+ synthetic constructor •() → main::X*
+ : super dart.core::Object::•()
+ ;
+ }
+ static method foo(main::X* x) → dart.core::int* {
+ return x is lib::Y* ?{dart.core::int*} x{lib::Y*}.{lib::Y::foo} : null;
+ }
+}
diff --git a/pkg/front_end/testcases/late_lowering/issue40373.dart.outline.expect b/pkg/front_end/testcases/late_lowering/issue40373.dart.outline.expect
index ec71902..d398301 100644
--- a/pkg/front_end/testcases/late_lowering/issue40373.dart.outline.expect
+++ b/pkg/front_end/testcases/late_lowering/issue40373.dart.outline.expect
@@ -6,7 +6,7 @@
field core::num pi;
field core::num? _#C#p1;
field core::num? _#C#p2;
- field dynamic _#C#p2#isSet;
+ field core::bool _#C#p2#isSet;
synthetic constructor •() → self::C
;
get p1() → core::num;
diff --git a/pkg/front_end/testcases/late_lowering/issue40373.dart.strong.expect b/pkg/front_end/testcases/late_lowering/issue40373.dart.strong.expect
index 10090e4..ecf82f3 100644
--- a/pkg/front_end/testcases/late_lowering/issue40373.dart.strong.expect
+++ b/pkg/front_end/testcases/late_lowering/issue40373.dart.strong.expect
@@ -7,7 +7,7 @@
field core::num pi = 3.14;
field core::num? _#C#p1 = null;
field core::num? _#C#p2 = null;
- field dynamic _#C#p2#isSet = null;
+ field core::bool _#C#p2#isSet = false;
synthetic constructor •() → self::C
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/late_lowering/issue40373.dart.strong.transformed.expect b/pkg/front_end/testcases/late_lowering/issue40373.dart.strong.transformed.expect
index 10090e4..ecf82f3 100644
--- a/pkg/front_end/testcases/late_lowering/issue40373.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/late_lowering/issue40373.dart.strong.transformed.expect
@@ -7,7 +7,7 @@
field core::num pi = 3.14;
field core::num? _#C#p1 = null;
field core::num? _#C#p2 = null;
- field dynamic _#C#p2#isSet = null;
+ field core::bool _#C#p2#isSet = false;
synthetic constructor •() → self::C
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/late_lowering/issue40373.dart.weak.expect b/pkg/front_end/testcases/late_lowering/issue40373.dart.weak.expect
index 10090e4..ecf82f3 100644
--- a/pkg/front_end/testcases/late_lowering/issue40373.dart.weak.expect
+++ b/pkg/front_end/testcases/late_lowering/issue40373.dart.weak.expect
@@ -7,7 +7,7 @@
field core::num pi = 3.14;
field core::num? _#C#p1 = null;
field core::num? _#C#p2 = null;
- field dynamic _#C#p2#isSet = null;
+ field core::bool _#C#p2#isSet = false;
synthetic constructor •() → self::C
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/late_lowering/issue40373.dart.weak.transformed.expect b/pkg/front_end/testcases/late_lowering/issue40373.dart.weak.transformed.expect
index 10090e4..ecf82f3 100644
--- a/pkg/front_end/testcases/late_lowering/issue40373.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/late_lowering/issue40373.dart.weak.transformed.expect
@@ -7,7 +7,7 @@
field core::num pi = 3.14;
field core::num? _#C#p1 = null;
field core::num? _#C#p2 = null;
- field dynamic _#C#p2#isSet = null;
+ field core::bool _#C#p2#isSet = false;
synthetic constructor •() → self::C
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/late_lowering/late_field_inference.dart b/pkg/front_end/testcases/late_lowering/late_field_inference.dart
new file mode 100644
index 0000000..51ae594
--- /dev/null
+++ b/pkg/front_end/testcases/late_lowering/late_field_inference.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2020, 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.
+
+int? method() => null;
+
+late var nonNullableTopLevelField = 0;
+late var nullableTopLevelField = method();
+
+class A {
+ late var nonNullableInstanceField = 0;
+ late var nullableInstanceField = method();
+
+ static late var nonNullableStaticField = 0;
+ static late var nullableStaticField = method();
+}
+
+class B extends A {
+ get nonNullableInstanceField => 0;
+ set nonNullableInstanceField(value) {}
+
+ get nullableInstanceField => 0;
+ set nullableInstanceField(value) {}
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/late_lowering/late_field_inference.dart.outline.expect b/pkg/front_end/testcases/late_lowering/late_field_inference.dart.outline.expect
new file mode 100644
index 0000000..11774df
--- /dev/null
+++ b/pkg/front_end/testcases/late_lowering/late_field_inference.dart.outline.expect
@@ -0,0 +1,48 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field core::int? _#A#nonNullableInstanceField;
+ field core::bool _#A#nonNullableInstanceField#isSet;
+ field core::int? _#A#nullableInstanceField;
+ field core::bool _#A#nullableInstanceField#isSet;
+ static field core::int? _#nonNullableStaticField;
+ static field core::bool _#nonNullableStaticField#isSet;
+ static field core::int? _#nullableStaticField;
+ static field core::bool _#nullableStaticField#isSet;
+ synthetic constructor •() → self::A
+ ;
+ get nonNullableInstanceField() → core::int;
+ set nonNullableInstanceField(core::int #t1) → void;
+ get nullableInstanceField() → core::int?;
+ set nullableInstanceField(core::int? #t2) → void;
+ static get nonNullableStaticField() → core::int;
+ static set nonNullableStaticField(core::int #t3) → void;
+ static get nullableStaticField() → core::int?;
+ static set nullableStaticField(core::int? #t4) → void;
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ ;
+ get nonNullableInstanceField() → core::int
+ ;
+ set nonNullableInstanceField(core::int value) → void
+ ;
+ get nullableInstanceField() → core::int?
+ ;
+ set nullableInstanceField(core::int? value) → void
+ ;
+}
+static field core::int? _#nonNullableTopLevelField;
+static field core::bool _#nonNullableTopLevelField#isSet;
+static field core::int? _#nullableTopLevelField;
+static field core::bool _#nullableTopLevelField#isSet;
+static method method() → core::int?
+ ;
+static get nonNullableTopLevelField() → core::int;
+static set nonNullableTopLevelField(core::int #t5) → void;
+static get nullableTopLevelField() → core::int?;
+static set nullableTopLevelField(core::int? #t6) → void;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/late_lowering/late_field_inference.dart.strong.expect b/pkg/front_end/testcases/late_lowering/late_field_inference.dart.strong.expect
new file mode 100644
index 0000000..9a2d29b
--- /dev/null
+++ b/pkg/front_end/testcases/late_lowering/late_field_inference.dart.strong.expect
@@ -0,0 +1,80 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field core::int? _#A#nonNullableInstanceField = null;
+ field core::bool _#A#nonNullableInstanceField#isSet = false;
+ field core::int? _#A#nullableInstanceField = null;
+ field core::bool _#A#nullableInstanceField#isSet = false;
+ static field core::int? _#nonNullableStaticField = null;
+ static field core::bool _#nonNullableStaticField#isSet = false;
+ static field core::int? _#nullableStaticField = null;
+ static field core::bool _#nullableStaticField#isSet = false;
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ get nonNullableInstanceField() → core::int
+ return let final core::int? #t1 = this.{self::A::_#A#nonNullableInstanceField} in #t1.==(null) ?{core::int} this.{self::A::_#A#nonNullableInstanceField} = 0 : #t1{core::int};
+ set nonNullableInstanceField(core::int #t2) → void
+ this.{self::A::_#A#nonNullableInstanceField} = #t2;
+ get nullableInstanceField() → core::int? {
+ if(!this.{self::A::_#A#nullableInstanceField#isSet}) {
+ this.{self::A::_#A#nullableInstanceField#isSet} = true;
+ this.{self::A::_#A#nullableInstanceField} = self::method();
+ }
+ return this.{self::A::_#A#nullableInstanceField};
+ }
+ set nullableInstanceField(core::int? #t3) → void {
+ this.{self::A::_#A#nullableInstanceField#isSet} = true;
+ this.{self::A::_#A#nullableInstanceField} = #t3;
+ }
+ static get nonNullableStaticField() → core::int
+ return let final core::int? #t4 = self::A::_#nonNullableStaticField in #t4.==(null) ?{core::int} self::A::_#nonNullableStaticField = 0 : #t4{core::int};
+ static set nonNullableStaticField(core::int #t5) → void
+ self::A::_#nonNullableStaticField = #t5;
+ static get nullableStaticField() → core::int? {
+ if(!self::A::_#nullableStaticField#isSet) {
+ self::A::_#nullableStaticField#isSet = true;
+ self::A::_#nullableStaticField = self::method();
+ }
+ return self::A::_#nullableStaticField;
+ }
+ static set nullableStaticField(core::int? #t6) → void {
+ self::A::_#nullableStaticField#isSet = true;
+ self::A::_#nullableStaticField = #t6;
+ }
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ get nonNullableInstanceField() → core::int
+ return 0;
+ set nonNullableInstanceField(core::int value) → void {}
+ get nullableInstanceField() → core::int?
+ return 0;
+ set nullableInstanceField(core::int? value) → void {}
+}
+static field core::int? _#nonNullableTopLevelField = null;
+static field core::bool _#nonNullableTopLevelField#isSet = false;
+static field core::int? _#nullableTopLevelField = null;
+static field core::bool _#nullableTopLevelField#isSet = false;
+static method method() → core::int?
+ return null;
+static get nonNullableTopLevelField() → core::int
+ return let final core::int? #t7 = self::_#nonNullableTopLevelField in #t7.==(null) ?{core::int} self::_#nonNullableTopLevelField = 0 : #t7{core::int};
+static set nonNullableTopLevelField(core::int #t8) → void
+ self::_#nonNullableTopLevelField = #t8;
+static get nullableTopLevelField() → core::int? {
+ if(!self::_#nullableTopLevelField#isSet) {
+ self::_#nullableTopLevelField#isSet = true;
+ self::_#nullableTopLevelField = self::method();
+ }
+ return self::_#nullableTopLevelField;
+}
+static set nullableTopLevelField(core::int? #t9) → void {
+ self::_#nullableTopLevelField#isSet = true;
+ self::_#nullableTopLevelField = #t9;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/late_lowering/late_field_inference.dart.strong.transformed.expect b/pkg/front_end/testcases/late_lowering/late_field_inference.dart.strong.transformed.expect
new file mode 100644
index 0000000..9a2d29b
--- /dev/null
+++ b/pkg/front_end/testcases/late_lowering/late_field_inference.dart.strong.transformed.expect
@@ -0,0 +1,80 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field core::int? _#A#nonNullableInstanceField = null;
+ field core::bool _#A#nonNullableInstanceField#isSet = false;
+ field core::int? _#A#nullableInstanceField = null;
+ field core::bool _#A#nullableInstanceField#isSet = false;
+ static field core::int? _#nonNullableStaticField = null;
+ static field core::bool _#nonNullableStaticField#isSet = false;
+ static field core::int? _#nullableStaticField = null;
+ static field core::bool _#nullableStaticField#isSet = false;
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ get nonNullableInstanceField() → core::int
+ return let final core::int? #t1 = this.{self::A::_#A#nonNullableInstanceField} in #t1.==(null) ?{core::int} this.{self::A::_#A#nonNullableInstanceField} = 0 : #t1{core::int};
+ set nonNullableInstanceField(core::int #t2) → void
+ this.{self::A::_#A#nonNullableInstanceField} = #t2;
+ get nullableInstanceField() → core::int? {
+ if(!this.{self::A::_#A#nullableInstanceField#isSet}) {
+ this.{self::A::_#A#nullableInstanceField#isSet} = true;
+ this.{self::A::_#A#nullableInstanceField} = self::method();
+ }
+ return this.{self::A::_#A#nullableInstanceField};
+ }
+ set nullableInstanceField(core::int? #t3) → void {
+ this.{self::A::_#A#nullableInstanceField#isSet} = true;
+ this.{self::A::_#A#nullableInstanceField} = #t3;
+ }
+ static get nonNullableStaticField() → core::int
+ return let final core::int? #t4 = self::A::_#nonNullableStaticField in #t4.==(null) ?{core::int} self::A::_#nonNullableStaticField = 0 : #t4{core::int};
+ static set nonNullableStaticField(core::int #t5) → void
+ self::A::_#nonNullableStaticField = #t5;
+ static get nullableStaticField() → core::int? {
+ if(!self::A::_#nullableStaticField#isSet) {
+ self::A::_#nullableStaticField#isSet = true;
+ self::A::_#nullableStaticField = self::method();
+ }
+ return self::A::_#nullableStaticField;
+ }
+ static set nullableStaticField(core::int? #t6) → void {
+ self::A::_#nullableStaticField#isSet = true;
+ self::A::_#nullableStaticField = #t6;
+ }
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ get nonNullableInstanceField() → core::int
+ return 0;
+ set nonNullableInstanceField(core::int value) → void {}
+ get nullableInstanceField() → core::int?
+ return 0;
+ set nullableInstanceField(core::int? value) → void {}
+}
+static field core::int? _#nonNullableTopLevelField = null;
+static field core::bool _#nonNullableTopLevelField#isSet = false;
+static field core::int? _#nullableTopLevelField = null;
+static field core::bool _#nullableTopLevelField#isSet = false;
+static method method() → core::int?
+ return null;
+static get nonNullableTopLevelField() → core::int
+ return let final core::int? #t7 = self::_#nonNullableTopLevelField in #t7.==(null) ?{core::int} self::_#nonNullableTopLevelField = 0 : #t7{core::int};
+static set nonNullableTopLevelField(core::int #t8) → void
+ self::_#nonNullableTopLevelField = #t8;
+static get nullableTopLevelField() → core::int? {
+ if(!self::_#nullableTopLevelField#isSet) {
+ self::_#nullableTopLevelField#isSet = true;
+ self::_#nullableTopLevelField = self::method();
+ }
+ return self::_#nullableTopLevelField;
+}
+static set nullableTopLevelField(core::int? #t9) → void {
+ self::_#nullableTopLevelField#isSet = true;
+ self::_#nullableTopLevelField = #t9;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/late_lowering/late_field_inference.dart.weak.expect b/pkg/front_end/testcases/late_lowering/late_field_inference.dart.weak.expect
new file mode 100644
index 0000000..9a2d29b
--- /dev/null
+++ b/pkg/front_end/testcases/late_lowering/late_field_inference.dart.weak.expect
@@ -0,0 +1,80 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field core::int? _#A#nonNullableInstanceField = null;
+ field core::bool _#A#nonNullableInstanceField#isSet = false;
+ field core::int? _#A#nullableInstanceField = null;
+ field core::bool _#A#nullableInstanceField#isSet = false;
+ static field core::int? _#nonNullableStaticField = null;
+ static field core::bool _#nonNullableStaticField#isSet = false;
+ static field core::int? _#nullableStaticField = null;
+ static field core::bool _#nullableStaticField#isSet = false;
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ get nonNullableInstanceField() → core::int
+ return let final core::int? #t1 = this.{self::A::_#A#nonNullableInstanceField} in #t1.==(null) ?{core::int} this.{self::A::_#A#nonNullableInstanceField} = 0 : #t1{core::int};
+ set nonNullableInstanceField(core::int #t2) → void
+ this.{self::A::_#A#nonNullableInstanceField} = #t2;
+ get nullableInstanceField() → core::int? {
+ if(!this.{self::A::_#A#nullableInstanceField#isSet}) {
+ this.{self::A::_#A#nullableInstanceField#isSet} = true;
+ this.{self::A::_#A#nullableInstanceField} = self::method();
+ }
+ return this.{self::A::_#A#nullableInstanceField};
+ }
+ set nullableInstanceField(core::int? #t3) → void {
+ this.{self::A::_#A#nullableInstanceField#isSet} = true;
+ this.{self::A::_#A#nullableInstanceField} = #t3;
+ }
+ static get nonNullableStaticField() → core::int
+ return let final core::int? #t4 = self::A::_#nonNullableStaticField in #t4.==(null) ?{core::int} self::A::_#nonNullableStaticField = 0 : #t4{core::int};
+ static set nonNullableStaticField(core::int #t5) → void
+ self::A::_#nonNullableStaticField = #t5;
+ static get nullableStaticField() → core::int? {
+ if(!self::A::_#nullableStaticField#isSet) {
+ self::A::_#nullableStaticField#isSet = true;
+ self::A::_#nullableStaticField = self::method();
+ }
+ return self::A::_#nullableStaticField;
+ }
+ static set nullableStaticField(core::int? #t6) → void {
+ self::A::_#nullableStaticField#isSet = true;
+ self::A::_#nullableStaticField = #t6;
+ }
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ get nonNullableInstanceField() → core::int
+ return 0;
+ set nonNullableInstanceField(core::int value) → void {}
+ get nullableInstanceField() → core::int?
+ return 0;
+ set nullableInstanceField(core::int? value) → void {}
+}
+static field core::int? _#nonNullableTopLevelField = null;
+static field core::bool _#nonNullableTopLevelField#isSet = false;
+static field core::int? _#nullableTopLevelField = null;
+static field core::bool _#nullableTopLevelField#isSet = false;
+static method method() → core::int?
+ return null;
+static get nonNullableTopLevelField() → core::int
+ return let final core::int? #t7 = self::_#nonNullableTopLevelField in #t7.==(null) ?{core::int} self::_#nonNullableTopLevelField = 0 : #t7{core::int};
+static set nonNullableTopLevelField(core::int #t8) → void
+ self::_#nonNullableTopLevelField = #t8;
+static get nullableTopLevelField() → core::int? {
+ if(!self::_#nullableTopLevelField#isSet) {
+ self::_#nullableTopLevelField#isSet = true;
+ self::_#nullableTopLevelField = self::method();
+ }
+ return self::_#nullableTopLevelField;
+}
+static set nullableTopLevelField(core::int? #t9) → void {
+ self::_#nullableTopLevelField#isSet = true;
+ self::_#nullableTopLevelField = #t9;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/late_lowering/late_field_inference.dart.weak.transformed.expect b/pkg/front_end/testcases/late_lowering/late_field_inference.dart.weak.transformed.expect
new file mode 100644
index 0000000..9a2d29b
--- /dev/null
+++ b/pkg/front_end/testcases/late_lowering/late_field_inference.dart.weak.transformed.expect
@@ -0,0 +1,80 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ field core::int? _#A#nonNullableInstanceField = null;
+ field core::bool _#A#nonNullableInstanceField#isSet = false;
+ field core::int? _#A#nullableInstanceField = null;
+ field core::bool _#A#nullableInstanceField#isSet = false;
+ static field core::int? _#nonNullableStaticField = null;
+ static field core::bool _#nonNullableStaticField#isSet = false;
+ static field core::int? _#nullableStaticField = null;
+ static field core::bool _#nullableStaticField#isSet = false;
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ get nonNullableInstanceField() → core::int
+ return let final core::int? #t1 = this.{self::A::_#A#nonNullableInstanceField} in #t1.==(null) ?{core::int} this.{self::A::_#A#nonNullableInstanceField} = 0 : #t1{core::int};
+ set nonNullableInstanceField(core::int #t2) → void
+ this.{self::A::_#A#nonNullableInstanceField} = #t2;
+ get nullableInstanceField() → core::int? {
+ if(!this.{self::A::_#A#nullableInstanceField#isSet}) {
+ this.{self::A::_#A#nullableInstanceField#isSet} = true;
+ this.{self::A::_#A#nullableInstanceField} = self::method();
+ }
+ return this.{self::A::_#A#nullableInstanceField};
+ }
+ set nullableInstanceField(core::int? #t3) → void {
+ this.{self::A::_#A#nullableInstanceField#isSet} = true;
+ this.{self::A::_#A#nullableInstanceField} = #t3;
+ }
+ static get nonNullableStaticField() → core::int
+ return let final core::int? #t4 = self::A::_#nonNullableStaticField in #t4.==(null) ?{core::int} self::A::_#nonNullableStaticField = 0 : #t4{core::int};
+ static set nonNullableStaticField(core::int #t5) → void
+ self::A::_#nonNullableStaticField = #t5;
+ static get nullableStaticField() → core::int? {
+ if(!self::A::_#nullableStaticField#isSet) {
+ self::A::_#nullableStaticField#isSet = true;
+ self::A::_#nullableStaticField = self::method();
+ }
+ return self::A::_#nullableStaticField;
+ }
+ static set nullableStaticField(core::int? #t6) → void {
+ self::A::_#nullableStaticField#isSet = true;
+ self::A::_#nullableStaticField = #t6;
+ }
+}
+class B extends self::A {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ get nonNullableInstanceField() → core::int
+ return 0;
+ set nonNullableInstanceField(core::int value) → void {}
+ get nullableInstanceField() → core::int?
+ return 0;
+ set nullableInstanceField(core::int? value) → void {}
+}
+static field core::int? _#nonNullableTopLevelField = null;
+static field core::bool _#nonNullableTopLevelField#isSet = false;
+static field core::int? _#nullableTopLevelField = null;
+static field core::bool _#nullableTopLevelField#isSet = false;
+static method method() → core::int?
+ return null;
+static get nonNullableTopLevelField() → core::int
+ return let final core::int? #t7 = self::_#nonNullableTopLevelField in #t7.==(null) ?{core::int} self::_#nonNullableTopLevelField = 0 : #t7{core::int};
+static set nonNullableTopLevelField(core::int #t8) → void
+ self::_#nonNullableTopLevelField = #t8;
+static get nullableTopLevelField() → core::int? {
+ if(!self::_#nullableTopLevelField#isSet) {
+ self::_#nullableTopLevelField#isSet = true;
+ self::_#nullableTopLevelField = self::method();
+ }
+ return self::_#nullableTopLevelField;
+}
+static set nullableTopLevelField(core::int? #t9) → void {
+ self::_#nullableTopLevelField#isSet = true;
+ self::_#nullableTopLevelField = #t9;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart
new file mode 100644
index 0000000..bf2442b
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2020, 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 'from_agnostic_lib.dart';
+
+const c1 = identical(a, b);
+const c2 = {a: 0, b: 1};
+const c3 = {a, b};
+const c4 = a;
+const c5 = b;
+
+main() {
+ a;
+ b;
+}
diff --git a/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart
new file mode 100644
index 0000000..6427cd2
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart
@@ -0,0 +1,6 @@
+// Copyright (c) 2020, 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.
+
+const a = <int>[];
+const b = <int?>[];
diff --git a/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.outline.expect b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.outline.expect
new file mode 100644
index 0000000..9aa640b
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.outline.expect
@@ -0,0 +1,21 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "from_agnostic_lib.dart" as fro;
+
+import "org-dartlang-testcase:///from_agnostic_lib.dart";
+
+static const field core::bool c1 = core::identical(fro::a, fro::b);
+static const field core::Map<core::List<core::int?>, core::int> c2 = const <core::List<core::int?>, core::int>{fro::a: 0, fro::b: 1};
+static const field core::Set<core::List<core::int?>> c3 = const <core::List<core::int?>>{fro::a, fro::b};
+static const field core::List<core::int> c4 = fro::a;
+static const field core::List<core::int?> c5 = fro::b;
+static method main() → dynamic
+ ;
+
+library /*isNonNullableByDefault*/;
+import self as fro;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = const <core::int>[];
+static const field core::List<core::int?> b = const <core::int?>[];
diff --git a/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.strong.expect b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.strong.expect
new file mode 100644
index 0000000..ef5caf7
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.strong.expect
@@ -0,0 +1,36 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///from_agnostic_lib.dart";
+
+static const field core::bool c1 = #C1;
+static const field core::Map<core::List<core::int?>, core::int> c2 = #C7;
+static const field core::Set<core::List<core::int?>> c3 = #C11;
+static const field core::List<core::int> c4 = #C2;
+static const field core::List<core::int?> c5 = #C4;
+static method main() → dynamic {
+ #C2;
+ #C4;
+}
+
+library /*isNonNullableByDefault*/;
+import self as self2;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C2;
+static const field core::List<core::int?> b = #C4;
+
+constants {
+ #C1 = false
+ #C2 = <core::int>[]
+ #C3 = 0
+ #C4 = <core::int?>[]
+ #C5 = 1
+ #C6 = <dynamic>[#C2, #C3, #C4, #C5]
+ #C7 = core::_ImmutableMap<core::List<core::int?>, core::int> {_kvPairs:#C6}
+ #C8 = null
+ #C9 = <dynamic>[#C2, #C8, #C4, #C8]
+ #C10 = core::_ImmutableMap<core::List<core::int?>, core::Null?> {_kvPairs:#C9}
+ #C11 = col::_UnmodifiableSet<core::List<core::int?>> {_map:#C10}
+}
diff --git a/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.strong.transformed.expect
new file mode 100644
index 0000000..ef5caf7
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.strong.transformed.expect
@@ -0,0 +1,36 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///from_agnostic_lib.dart";
+
+static const field core::bool c1 = #C1;
+static const field core::Map<core::List<core::int?>, core::int> c2 = #C7;
+static const field core::Set<core::List<core::int?>> c3 = #C11;
+static const field core::List<core::int> c4 = #C2;
+static const field core::List<core::int?> c5 = #C4;
+static method main() → dynamic {
+ #C2;
+ #C4;
+}
+
+library /*isNonNullableByDefault*/;
+import self as self2;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C2;
+static const field core::List<core::int?> b = #C4;
+
+constants {
+ #C1 = false
+ #C2 = <core::int>[]
+ #C3 = 0
+ #C4 = <core::int?>[]
+ #C5 = 1
+ #C6 = <dynamic>[#C2, #C3, #C4, #C5]
+ #C7 = core::_ImmutableMap<core::List<core::int?>, core::int> {_kvPairs:#C6}
+ #C8 = null
+ #C9 = <dynamic>[#C2, #C8, #C4, #C8]
+ #C10 = core::_ImmutableMap<core::List<core::int?>, core::Null?> {_kvPairs:#C9}
+ #C11 = col::_UnmodifiableSet<core::List<core::int?>> {_map:#C10}
+}
diff --git a/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.weak.expect b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.weak.expect
new file mode 100644
index 0000000..7ede780
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.weak.expect
@@ -0,0 +1,52 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:8:12: Error: Constant evaluation error:
+// const c2 = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:8:19: Context: The key '<int>[]' conflicts with another existing key in the map.
+// const c2 = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:8:7: Context: While analyzing:
+// const c2 = {a: 0, b: 1};
+// ^
+//
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:9:12: Error: Constant evaluation error:
+// const c3 = {a, b};
+// ^
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:9:16: Context: The element '<int>[]' conflicts with another existing element in the set.
+// const c3 = {a, b};
+// ^
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:9:7: Context: While analyzing:
+// const c3 = {a, b};
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///from_agnostic_lib.dart";
+
+static const field core::bool c1 = #C1;
+static const field core::Map<core::List<core::int?>, core::int> c2 = invalid-expression "The key '<int>[]' conflicts with another existing key in the map.";
+static const field core::Set<core::List<core::int?>> c3 = invalid-expression "The element '<int>[]' conflicts with another existing element in the set.";
+static const field core::List<core::int> c4 = #C2;
+static const field core::List<core::int?> c5 = #C2;
+static method main() → dynamic {
+ #C2;
+ #C2;
+}
+
+library /*isNonNullableByDefault*/;
+import self as self2;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C3;
+static const field core::List<core::int?> b = #C4;
+
+constants {
+ #C1 = true
+ #C2 = <core::int*>[]
+ #C3 = <core::int>[]
+ #C4 = <core::int?>[]
+}
diff --git a/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.weak.transformed.expect
new file mode 100644
index 0000000..7ede780
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic_lib.dart.weak.transformed.expect
@@ -0,0 +1,52 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:8:12: Error: Constant evaluation error:
+// const c2 = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:8:19: Context: The key '<int>[]' conflicts with another existing key in the map.
+// const c2 = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:8:7: Context: While analyzing:
+// const c2 = {a: 0, b: 1};
+// ^
+//
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:9:12: Error: Constant evaluation error:
+// const c3 = {a, b};
+// ^
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:9:16: Context: The element '<int>[]' conflicts with another existing element in the set.
+// const c3 = {a, b};
+// ^
+// pkg/front_end/testcases/nnbd/from_agnostic/from_agnostic.dart:9:7: Context: While analyzing:
+// const c3 = {a, b};
+// ^
+//
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///from_agnostic_lib.dart";
+
+static const field core::bool c1 = #C1;
+static const field core::Map<core::List<core::int?>, core::int> c2 = invalid-expression "The key '<int>[]' conflicts with another existing key in the map.";
+static const field core::Set<core::List<core::int?>> c3 = invalid-expression "The element '<int>[]' conflicts with another existing element in the set.";
+static const field core::List<core::int> c4 = #C2;
+static const field core::List<core::int?> c5 = #C2;
+static method main() → dynamic {
+ #C2;
+ #C2;
+}
+
+library /*isNonNullableByDefault*/;
+import self as self2;
+import "dart:core" as core;
+
+static const field core::List<core::int> a = #C3;
+static const field core::List<core::int?> b = #C4;
+
+constants {
+ #C1 = true
+ #C2 = <core::int*>[]
+ #C3 = <core::int>[]
+ #C4 = <core::int?>[]
+}
diff --git a/pkg/front_end/testcases/nnbd/from_agnostic/link.options b/pkg/front_end/testcases/nnbd/from_agnostic/link.options
new file mode 100644
index 0000000..88923b6
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/from_agnostic/link.options
@@ -0,0 +1,2 @@
+--nnbd-agnostic
+from_agnostic_lib.dart
\ No newline at end of file
diff --git a/pkg/front_end/testcases/nnbd/future_or_variables.dart b/pkg/front_end/testcases/nnbd/future_or_variables.dart
new file mode 100644
index 0000000..e101e6d
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/future_or_variables.dart
@@ -0,0 +1,80 @@
+// Copyright (c) 2020, 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:async';
+
+FutureOr topLevelField1;
+FutureOr<int?> topLevelField2;
+FutureOr<FutureOr> topLevelField3;
+
+void toplevelMethod1(
+ [FutureOr parameter1,
+ FutureOr<int?> parameter2,
+ FutureOr<FutureOr> parameter3]) {}
+
+void toplevelMethod2(
+ {FutureOr parameter1,
+ FutureOr<int?> parameter2,
+ FutureOr<FutureOr> parameter3}) {}
+
+class Class1 {
+ FutureOr instanceField1;
+ FutureOr<int?> instanceField2;
+ FutureOr<FutureOr> instanceField3;
+
+ static FutureOr staticField1;
+ static FutureOr<int?> staticField2;
+ static FutureOr<FutureOr> staticField3;
+
+ void instanceMethod1(
+ [FutureOr parameter1,
+ FutureOr<int?> parameter2,
+ FutureOr<FutureOr> parameter3]) {}
+
+ void instanceMethod2(
+ {FutureOr parameter1,
+ FutureOr<int?> parameter2,
+ FutureOr<FutureOr> parameter3}) {}
+
+ static void staticMethod1(
+ [FutureOr parameter1,
+ FutureOr<int?> parameter2,
+ FutureOr<FutureOr> parameter3]) {}
+
+ static void staticMethod2(
+ {FutureOr parameter1,
+ FutureOr<int?> parameter2,
+ FutureOr<FutureOr> parameter3}) {}
+}
+
+class Class2 {
+ FutureOr instanceField1;
+ FutureOr<int?> instanceField2;
+ FutureOr<FutureOr> instanceField3;
+
+ Class2.constructor1(
+ this.instanceField1, this.instanceField2, this.instanceField3);
+
+ Class2.constructor2();
+}
+
+main() {
+ FutureOr local1;
+ FutureOr<int?> local2;
+ FutureOr<FutureOr> local3;
+
+ print(local1);
+ print(local2);
+ print(local3);
+
+ void localFunction1(
+ [FutureOr parameter1,
+ FutureOr<int?> parameter2,
+ FutureOr<FutureOr> parameter3]) {}
+
+ void localFunction2(
+ {FutureOr parameter1,
+ FutureOr<int?> parameter2,
+ FutureOr<FutureOr> parameter3}) {}
+}
diff --git a/pkg/front_end/testcases/nnbd/future_or_variables.dart.outline.expect b/pkg/front_end/testcases/nnbd/future_or_variables.dart.outline.expect
new file mode 100644
index 0000000..7b9faa0
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/future_or_variables.dart.outline.expect
@@ -0,0 +1,43 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+import "dart:async";
+
+class Class1 extends core::Object {
+ field asy::FutureOr<dynamic> instanceField1;
+ field asy::FutureOr<core::int?> instanceField2;
+ field asy::FutureOr<asy::FutureOr<dynamic>> instanceField3;
+ static field asy::FutureOr<dynamic> staticField1;
+ static field asy::FutureOr<core::int?> staticField2;
+ static field asy::FutureOr<asy::FutureOr<dynamic>> staticField3;
+ synthetic constructor •() → self::Class1
+ ;
+ method instanceMethod1([asy::FutureOr<dynamic> parameter1, asy::FutureOr<core::int?> parameter2, asy::FutureOr<asy::FutureOr<dynamic>> parameter3]) → void
+ ;
+ method instanceMethod2({asy::FutureOr<dynamic> parameter1, asy::FutureOr<core::int?> parameter2, asy::FutureOr<asy::FutureOr<dynamic>> parameter3}) → void
+ ;
+ static method staticMethod1([asy::FutureOr<dynamic> parameter1, asy::FutureOr<core::int?> parameter2, asy::FutureOr<asy::FutureOr<dynamic>> parameter3]) → void
+ ;
+ static method staticMethod2({asy::FutureOr<dynamic> parameter1, asy::FutureOr<core::int?> parameter2, asy::FutureOr<asy::FutureOr<dynamic>> parameter3}) → void
+ ;
+}
+class Class2 extends core::Object {
+ field asy::FutureOr<dynamic> instanceField1;
+ field asy::FutureOr<core::int?> instanceField2;
+ field asy::FutureOr<asy::FutureOr<dynamic>> instanceField3;
+ constructor constructor1(asy::FutureOr<dynamic> instanceField1, asy::FutureOr<core::int?> instanceField2, asy::FutureOr<asy::FutureOr<dynamic>> instanceField3) → self::Class2
+ ;
+ constructor constructor2() → self::Class2
+ ;
+}
+static field asy::FutureOr<dynamic> topLevelField1;
+static field asy::FutureOr<core::int?> topLevelField2;
+static field asy::FutureOr<asy::FutureOr<dynamic>> topLevelField3;
+static method toplevelMethod1([asy::FutureOr<dynamic> parameter1, asy::FutureOr<core::int?> parameter2, asy::FutureOr<asy::FutureOr<dynamic>> parameter3]) → void
+ ;
+static method toplevelMethod2({asy::FutureOr<dynamic> parameter1, asy::FutureOr<core::int?> parameter2, asy::FutureOr<asy::FutureOr<dynamic>> parameter3}) → void
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/nnbd/future_or_variables.dart.strong.expect b/pkg/front_end/testcases/nnbd/future_or_variables.dart.strong.expect
new file mode 100644
index 0000000..1a70453
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/future_or_variables.dart.strong.expect
@@ -0,0 +1,52 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+import "dart:async";
+
+class Class1 extends core::Object {
+ field asy::FutureOr<dynamic> instanceField1 = null;
+ field asy::FutureOr<core::int?> instanceField2 = null;
+ field asy::FutureOr<asy::FutureOr<dynamic>> instanceField3 = null;
+ static field asy::FutureOr<dynamic> staticField1 = null;
+ static field asy::FutureOr<core::int?> staticField2 = null;
+ static field asy::FutureOr<asy::FutureOr<dynamic>> staticField3 = null;
+ synthetic constructor •() → self::Class1
+ : super core::Object::•()
+ ;
+ method instanceMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ method instanceMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+ static method staticMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ static method staticMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+}
+class Class2 extends core::Object {
+ field asy::FutureOr<dynamic> instanceField1;
+ field asy::FutureOr<core::int?> instanceField2;
+ field asy::FutureOr<asy::FutureOr<dynamic>> instanceField3;
+ constructor constructor1(asy::FutureOr<dynamic> instanceField1, asy::FutureOr<core::int?> instanceField2, asy::FutureOr<asy::FutureOr<dynamic>> instanceField3) → self::Class2
+ : self::Class2::instanceField1 = instanceField1, self::Class2::instanceField2 = instanceField2, self::Class2::instanceField3 = instanceField3, super core::Object::•()
+ ;
+ constructor constructor2() → self::Class2
+ : self::Class2::instanceField3 = null, self::Class2::instanceField2 = null, self::Class2::instanceField1 = null, super core::Object::•()
+ ;
+}
+static field asy::FutureOr<dynamic> topLevelField1;
+static field asy::FutureOr<core::int?> topLevelField2;
+static field asy::FutureOr<asy::FutureOr<dynamic>> topLevelField3;
+static method toplevelMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+static method toplevelMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+static method main() → dynamic {
+ asy::FutureOr<dynamic> local1;
+ asy::FutureOr<core::int?> local2;
+ asy::FutureOr<asy::FutureOr<dynamic>> local3;
+ core::print(local1);
+ core::print(local2);
+ core::print(local3);
+ function localFunction1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ function localFunction2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/future_or_variables.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/future_or_variables.dart.strong.transformed.expect
new file mode 100644
index 0000000..1a70453
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/future_or_variables.dart.strong.transformed.expect
@@ -0,0 +1,52 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+import "dart:async";
+
+class Class1 extends core::Object {
+ field asy::FutureOr<dynamic> instanceField1 = null;
+ field asy::FutureOr<core::int?> instanceField2 = null;
+ field asy::FutureOr<asy::FutureOr<dynamic>> instanceField3 = null;
+ static field asy::FutureOr<dynamic> staticField1 = null;
+ static field asy::FutureOr<core::int?> staticField2 = null;
+ static field asy::FutureOr<asy::FutureOr<dynamic>> staticField3 = null;
+ synthetic constructor •() → self::Class1
+ : super core::Object::•()
+ ;
+ method instanceMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ method instanceMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+ static method staticMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ static method staticMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+}
+class Class2 extends core::Object {
+ field asy::FutureOr<dynamic> instanceField1;
+ field asy::FutureOr<core::int?> instanceField2;
+ field asy::FutureOr<asy::FutureOr<dynamic>> instanceField3;
+ constructor constructor1(asy::FutureOr<dynamic> instanceField1, asy::FutureOr<core::int?> instanceField2, asy::FutureOr<asy::FutureOr<dynamic>> instanceField3) → self::Class2
+ : self::Class2::instanceField1 = instanceField1, self::Class2::instanceField2 = instanceField2, self::Class2::instanceField3 = instanceField3, super core::Object::•()
+ ;
+ constructor constructor2() → self::Class2
+ : self::Class2::instanceField3 = null, self::Class2::instanceField2 = null, self::Class2::instanceField1 = null, super core::Object::•()
+ ;
+}
+static field asy::FutureOr<dynamic> topLevelField1;
+static field asy::FutureOr<core::int?> topLevelField2;
+static field asy::FutureOr<asy::FutureOr<dynamic>> topLevelField3;
+static method toplevelMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+static method toplevelMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+static method main() → dynamic {
+ asy::FutureOr<dynamic> local1;
+ asy::FutureOr<core::int?> local2;
+ asy::FutureOr<asy::FutureOr<dynamic>> local3;
+ core::print(local1);
+ core::print(local2);
+ core::print(local3);
+ function localFunction1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ function localFunction2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/future_or_variables.dart.weak.expect b/pkg/front_end/testcases/nnbd/future_or_variables.dart.weak.expect
new file mode 100644
index 0000000..1a70453
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/future_or_variables.dart.weak.expect
@@ -0,0 +1,52 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+import "dart:async";
+
+class Class1 extends core::Object {
+ field asy::FutureOr<dynamic> instanceField1 = null;
+ field asy::FutureOr<core::int?> instanceField2 = null;
+ field asy::FutureOr<asy::FutureOr<dynamic>> instanceField3 = null;
+ static field asy::FutureOr<dynamic> staticField1 = null;
+ static field asy::FutureOr<core::int?> staticField2 = null;
+ static field asy::FutureOr<asy::FutureOr<dynamic>> staticField3 = null;
+ synthetic constructor •() → self::Class1
+ : super core::Object::•()
+ ;
+ method instanceMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ method instanceMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+ static method staticMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ static method staticMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+}
+class Class2 extends core::Object {
+ field asy::FutureOr<dynamic> instanceField1;
+ field asy::FutureOr<core::int?> instanceField2;
+ field asy::FutureOr<asy::FutureOr<dynamic>> instanceField3;
+ constructor constructor1(asy::FutureOr<dynamic> instanceField1, asy::FutureOr<core::int?> instanceField2, asy::FutureOr<asy::FutureOr<dynamic>> instanceField3) → self::Class2
+ : self::Class2::instanceField1 = instanceField1, self::Class2::instanceField2 = instanceField2, self::Class2::instanceField3 = instanceField3, super core::Object::•()
+ ;
+ constructor constructor2() → self::Class2
+ : self::Class2::instanceField3 = null, self::Class2::instanceField2 = null, self::Class2::instanceField1 = null, super core::Object::•()
+ ;
+}
+static field asy::FutureOr<dynamic> topLevelField1;
+static field asy::FutureOr<core::int?> topLevelField2;
+static field asy::FutureOr<asy::FutureOr<dynamic>> topLevelField3;
+static method toplevelMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+static method toplevelMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+static method main() → dynamic {
+ asy::FutureOr<dynamic> local1;
+ asy::FutureOr<core::int?> local2;
+ asy::FutureOr<asy::FutureOr<dynamic>> local3;
+ core::print(local1);
+ core::print(local2);
+ core::print(local3);
+ function localFunction1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ function localFunction2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/future_or_variables.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/future_or_variables.dart.weak.transformed.expect
new file mode 100644
index 0000000..1a70453
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/future_or_variables.dart.weak.transformed.expect
@@ -0,0 +1,52 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+import "dart:async";
+
+class Class1 extends core::Object {
+ field asy::FutureOr<dynamic> instanceField1 = null;
+ field asy::FutureOr<core::int?> instanceField2 = null;
+ field asy::FutureOr<asy::FutureOr<dynamic>> instanceField3 = null;
+ static field asy::FutureOr<dynamic> staticField1 = null;
+ static field asy::FutureOr<core::int?> staticField2 = null;
+ static field asy::FutureOr<asy::FutureOr<dynamic>> staticField3 = null;
+ synthetic constructor •() → self::Class1
+ : super core::Object::•()
+ ;
+ method instanceMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ method instanceMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+ static method staticMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ static method staticMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+}
+class Class2 extends core::Object {
+ field asy::FutureOr<dynamic> instanceField1;
+ field asy::FutureOr<core::int?> instanceField2;
+ field asy::FutureOr<asy::FutureOr<dynamic>> instanceField3;
+ constructor constructor1(asy::FutureOr<dynamic> instanceField1, asy::FutureOr<core::int?> instanceField2, asy::FutureOr<asy::FutureOr<dynamic>> instanceField3) → self::Class2
+ : self::Class2::instanceField1 = instanceField1, self::Class2::instanceField2 = instanceField2, self::Class2::instanceField3 = instanceField3, super core::Object::•()
+ ;
+ constructor constructor2() → self::Class2
+ : self::Class2::instanceField3 = null, self::Class2::instanceField2 = null, self::Class2::instanceField1 = null, super core::Object::•()
+ ;
+}
+static field asy::FutureOr<dynamic> topLevelField1;
+static field asy::FutureOr<core::int?> topLevelField2;
+static field asy::FutureOr<asy::FutureOr<dynamic>> topLevelField3;
+static method toplevelMethod1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+static method toplevelMethod2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+static method main() → dynamic {
+ asy::FutureOr<dynamic> local1;
+ asy::FutureOr<core::int?> local2;
+ asy::FutureOr<asy::FutureOr<dynamic>> local3;
+ core::print(local1);
+ core::print(local2);
+ core::print(local3);
+ function localFunction1([asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1]) → void {}
+ function localFunction2({asy::FutureOr<dynamic> parameter1 = #C1, asy::FutureOr<core::int?> parameter2 = #C1, asy::FutureOr<asy::FutureOr<dynamic>> parameter3 = #C1}) → void {}
+}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/issue40512/issue40512.dart b/pkg/front_end/testcases/nnbd/issue40512/issue40512.dart
new file mode 100644
index 0000000..3b3ec1f
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue40512/issue40512.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2020, 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.
+
+// @dart = 2.6
+import 'issue40512_lib.dart';
+
+class C extends Object with A, B {}
+
+void main() {
+ print(B());
+ print(C());
+}
diff --git a/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart
new file mode 100644
index 0000000..6cec1ea
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2020, 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.
+
+// @dart = 2.6
+library baz2;
+
+mixin A {
+ String toString({String s = "hello"}) => s;
+}
+
+class B extends Object {}
diff --git a/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.outline.expect b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.outline.expect
new file mode 100644
index 0000000..33cec59
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.outline.expect
@@ -0,0 +1,36 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "issue40512_lib.dart" as baz2;
+
+import "org-dartlang-testcase:///issue40512_lib.dart";
+
+abstract class _C&Object&A = core::Object with baz2::A /*isAnonymousMixin*/ {
+ const synthetic constructor •() → self::_C&Object&A*
+ : super core::Object::•()
+ ;
+}
+abstract class _C&Object&A&B = self::_C&Object&A with baz2::B /*isAnonymousMixin*/ {
+ const synthetic constructor •() → self::_C&Object&A&B*
+ : super self::_C&Object&A::•()
+ ;
+}
+class C extends self::_C&Object&A&B {
+ synthetic constructor •() → self::C*
+ ;
+}
+static method main() → void
+ ;
+
+library baz2;
+import self as baz2;
+import "dart:core" as core;
+
+abstract class A extends core::Object /*isMixinDeclaration*/ {
+ method toString({core::String* s = "hello"}) → core::String*
+ ;
+}
+class B extends core::Object {
+ synthetic constructor •() → baz2::B*
+ ;
+}
diff --git a/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.strong.expect
new file mode 100644
index 0000000..c6d5ee1
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.strong.expect
@@ -0,0 +1,44 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "issue40512_lib.dart" as baz2;
+
+import "org-dartlang-testcase:///issue40512_lib.dart";
+
+abstract class _C&Object&A = core::Object with baz2::A /*isAnonymousMixin*/ {
+ const synthetic constructor •() → self::_C&Object&A*
+ : super core::Object::•()
+ ;
+}
+abstract class _C&Object&A&B = self::_C&Object&A with baz2::B /*isAnonymousMixin*/ {
+ const synthetic constructor •() → self::_C&Object&A&B*
+ : super self::_C&Object&A::•()
+ ;
+}
+class C extends self::_C&Object&A&B {
+ synthetic constructor •() → self::C*
+ : super self::_C&Object&A&B::•()
+ ;
+}
+static method main() → void {
+ core::print(new baz2::B::•());
+ core::print(new self::C::•());
+}
+
+library baz2;
+import self as baz2;
+import "dart:core" as core;
+
+abstract class A extends core::Object /*isMixinDeclaration*/ {
+ method toString({core::String* s = #C1}) → core::String*
+ return s;
+}
+class B extends core::Object {
+ synthetic constructor •() → baz2::B*
+ : super core::Object::•()
+ ;
+}
+
+constants {
+ #C1 = "hello"
+}
diff --git a/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.strong.transformed.expect
new file mode 100644
index 0000000..d3a7004
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.strong.transformed.expect
@@ -0,0 +1,46 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "issue40512_lib.dart" as baz2;
+
+import "org-dartlang-testcase:///issue40512_lib.dart";
+
+abstract class _C&Object&A extends core::Object implements baz2::A /*isAnonymousMixin,isEliminatedMixin*/ {
+ const synthetic constructor •() → self::_C&Object&A*
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///issue40512_lib.dart */ toString({core::String* s = #C1}) → core::String*
+ return s;
+}
+abstract class _C&Object&A&B extends self::_C&Object&A implements baz2::B /*isAnonymousMixin,isEliminatedMixin*/ {
+ const synthetic constructor •() → self::_C&Object&A&B*
+ : super self::_C&Object&A::•()
+ ;
+}
+class C extends self::_C&Object&A&B {
+ synthetic constructor •() → self::C*
+ : super self::_C&Object&A&B::•()
+ ;
+}
+static method main() → void {
+ core::print(new baz2::B::•());
+ core::print(new self::C::•());
+}
+
+library baz2;
+import self as baz2;
+import "dart:core" as core;
+
+abstract class A extends core::Object /*isMixinDeclaration*/ {
+ method toString({core::String* s = #C1}) → core::String*
+ return s;
+}
+class B extends core::Object {
+ synthetic constructor •() → baz2::B*
+ : super core::Object::•()
+ ;
+}
+
+constants {
+ #C1 = "hello"
+}
diff --git a/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.weak.expect
new file mode 100644
index 0000000..c6d5ee1
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.weak.expect
@@ -0,0 +1,44 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "issue40512_lib.dart" as baz2;
+
+import "org-dartlang-testcase:///issue40512_lib.dart";
+
+abstract class _C&Object&A = core::Object with baz2::A /*isAnonymousMixin*/ {
+ const synthetic constructor •() → self::_C&Object&A*
+ : super core::Object::•()
+ ;
+}
+abstract class _C&Object&A&B = self::_C&Object&A with baz2::B /*isAnonymousMixin*/ {
+ const synthetic constructor •() → self::_C&Object&A&B*
+ : super self::_C&Object&A::•()
+ ;
+}
+class C extends self::_C&Object&A&B {
+ synthetic constructor •() → self::C*
+ : super self::_C&Object&A&B::•()
+ ;
+}
+static method main() → void {
+ core::print(new baz2::B::•());
+ core::print(new self::C::•());
+}
+
+library baz2;
+import self as baz2;
+import "dart:core" as core;
+
+abstract class A extends core::Object /*isMixinDeclaration*/ {
+ method toString({core::String* s = #C1}) → core::String*
+ return s;
+}
+class B extends core::Object {
+ synthetic constructor •() → baz2::B*
+ : super core::Object::•()
+ ;
+}
+
+constants {
+ #C1 = "hello"
+}
diff --git a/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.weak.transformed.expect
new file mode 100644
index 0000000..d3a7004
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue40512/issue40512_lib.dart.weak.transformed.expect
@@ -0,0 +1,46 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "issue40512_lib.dart" as baz2;
+
+import "org-dartlang-testcase:///issue40512_lib.dart";
+
+abstract class _C&Object&A extends core::Object implements baz2::A /*isAnonymousMixin,isEliminatedMixin*/ {
+ const synthetic constructor •() → self::_C&Object&A*
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///issue40512_lib.dart */ toString({core::String* s = #C1}) → core::String*
+ return s;
+}
+abstract class _C&Object&A&B extends self::_C&Object&A implements baz2::B /*isAnonymousMixin,isEliminatedMixin*/ {
+ const synthetic constructor •() → self::_C&Object&A&B*
+ : super self::_C&Object&A::•()
+ ;
+}
+class C extends self::_C&Object&A&B {
+ synthetic constructor •() → self::C*
+ : super self::_C&Object&A&B::•()
+ ;
+}
+static method main() → void {
+ core::print(new baz2::B::•());
+ core::print(new self::C::•());
+}
+
+library baz2;
+import self as baz2;
+import "dart:core" as core;
+
+abstract class A extends core::Object /*isMixinDeclaration*/ {
+ method toString({core::String* s = #C1}) → core::String*
+ return s;
+}
+class B extends core::Object {
+ synthetic constructor •() → baz2::B*
+ : super core::Object::•()
+ ;
+}
+
+constants {
+ #C1 = "hello"
+}
diff --git a/pkg/front_end/testcases/nnbd/issue40512/link.options b/pkg/front_end/testcases/nnbd/issue40512/link.options
new file mode 100644
index 0000000..2405655
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue40512/link.options
@@ -0,0 +1 @@
+issue40512_lib.dart
diff --git a/pkg/front_end/testcases/nnbd/late.dart.outline.expect b/pkg/front_end/testcases/nnbd/late.dart.outline.expect
index afcd786..414a031 100644
--- a/pkg/front_end/testcases/nnbd/late.dart.outline.expect
+++ b/pkg/front_end/testcases/nnbd/late.dart.outline.expect
@@ -4,8 +4,8 @@
class Class extends core::Object {
late field core::int lateInstanceField;
- late final field core::int lateFinalInstanceField1;
- late final field core::int lateFinalInstanceField2;
+ late final [setter] field core::int lateFinalInstanceField1;
+ late final [setter] field core::int lateFinalInstanceField2;
late final field core::int lateFinalInstanceFieldWithInit;
late field self::Class lateInstanceFieldThis;
late final field self::Class lateFinalInstanceFieldThis;
diff --git a/pkg/front_end/testcases/nnbd/late.dart.strong.expect b/pkg/front_end/testcases/nnbd/late.dart.strong.expect
index aa6f48b..ff0896a 100644
--- a/pkg/front_end/testcases/nnbd/late.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/late.dart.strong.expect
@@ -35,8 +35,8 @@
class Class extends core::Object {
late field core::int lateInstanceField;
- late final field core::int lateFinalInstanceField1;
- late final field core::int lateFinalInstanceField2;
+ late final [setter] field core::int lateFinalInstanceField1;
+ late final [setter] field core::int lateFinalInstanceField2;
late final field core::int lateFinalInstanceFieldWithInit = 0;
late field self::Class lateInstanceFieldThis = this;
late final field self::Class lateFinalInstanceFieldThis = this;
diff --git a/pkg/front_end/testcases/nnbd/late.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/late.dart.strong.transformed.expect
index aa6f48b..ff0896a 100644
--- a/pkg/front_end/testcases/nnbd/late.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/late.dart.strong.transformed.expect
@@ -35,8 +35,8 @@
class Class extends core::Object {
late field core::int lateInstanceField;
- late final field core::int lateFinalInstanceField1;
- late final field core::int lateFinalInstanceField2;
+ late final [setter] field core::int lateFinalInstanceField1;
+ late final [setter] field core::int lateFinalInstanceField2;
late final field core::int lateFinalInstanceFieldWithInit = 0;
late field self::Class lateInstanceFieldThis = this;
late final field self::Class lateFinalInstanceFieldThis = this;
diff --git a/pkg/front_end/testcases/nnbd/late.dart.weak.expect b/pkg/front_end/testcases/nnbd/late.dart.weak.expect
index aa6f48b..ff0896a 100644
--- a/pkg/front_end/testcases/nnbd/late.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/late.dart.weak.expect
@@ -35,8 +35,8 @@
class Class extends core::Object {
late field core::int lateInstanceField;
- late final field core::int lateFinalInstanceField1;
- late final field core::int lateFinalInstanceField2;
+ late final [setter] field core::int lateFinalInstanceField1;
+ late final [setter] field core::int lateFinalInstanceField2;
late final field core::int lateFinalInstanceFieldWithInit = 0;
late field self::Class lateInstanceFieldThis = this;
late final field self::Class lateFinalInstanceFieldThis = this;
diff --git a/pkg/front_end/testcases/nnbd/late.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/late.dart.weak.transformed.expect
index aa6f48b..ff0896a 100644
--- a/pkg/front_end/testcases/nnbd/late.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/late.dart.weak.transformed.expect
@@ -35,8 +35,8 @@
class Class extends core::Object {
late field core::int lateInstanceField;
- late final field core::int lateFinalInstanceField1;
- late final field core::int lateFinalInstanceField2;
+ late final [setter] field core::int lateFinalInstanceField1;
+ late final [setter] field core::int lateFinalInstanceField2;
late final field core::int lateFinalInstanceFieldWithInit = 0;
late field self::Class lateInstanceFieldThis = this;
late final field self::Class lateFinalInstanceFieldThis = this;
diff --git a/pkg/front_end/testcases/nnbd/later.dart.outline.expect b/pkg/front_end/testcases/nnbd/later.dart.outline.expect
index 6e60e3f..654662e 100644
--- a/pkg/front_end/testcases/nnbd/later.dart.outline.expect
+++ b/pkg/front_end/testcases/nnbd/later.dart.outline.expect
@@ -30,7 +30,7 @@
;
}
class C extends core::Object {
- late final field core::int x;
+ late final [setter] field core::int x;
synthetic constructor •() → self::C
;
method initVars() → dynamic
diff --git a/pkg/front_end/testcases/nnbd/later.dart.strong.expect b/pkg/front_end/testcases/nnbd/later.dart.strong.expect
index dc130bf..4ea3cb9 100644
--- a/pkg/front_end/testcases/nnbd/later.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/later.dart.strong.expect
@@ -81,7 +81,7 @@
;
}
class C extends core::Object {
- late final field core::int x;
+ late final [setter] field core::int x;
synthetic constructor •() → self::C
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/nnbd/later.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/later.dart.strong.transformed.expect
index b552816..37628df 100644
--- a/pkg/front_end/testcases/nnbd/later.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/later.dart.strong.transformed.expect
@@ -82,7 +82,7 @@
;
}
class C extends core::Object {
- late final field core::int x;
+ late final [setter] field core::int x;
synthetic constructor •() → self::C
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/nnbd/later.dart.weak.expect b/pkg/front_end/testcases/nnbd/later.dart.weak.expect
index ec03818..2ff6a62 100644
--- a/pkg/front_end/testcases/nnbd/later.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/later.dart.weak.expect
@@ -81,7 +81,7 @@
;
}
class C extends core::Object {
- late final field core::int x;
+ late final [setter] field core::int x;
synthetic constructor •() → self::C
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/nnbd/later.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/later.dart.weak.transformed.expect
index 92d0bcf..6f8ab34 100644
--- a/pkg/front_end/testcases/nnbd/later.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/later.dart.weak.transformed.expect
@@ -82,7 +82,7 @@
;
}
class C extends core::Object {
- late final field core::int x;
+ late final [setter] field core::int x;
synthetic constructor •() → self::C
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/nnbd/never_bound.dart b/pkg/front_end/testcases/nnbd/never_bound.dart
new file mode 100644
index 0000000..d581047
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/never_bound.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2020, 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.
+
+class GenericNever<T extends Never> {
+ dynamic getParamType() => T;
+}
+
+errors() {
+ GenericNever<Null>();
+ GenericNever<void>();
+ GenericNever<int>();
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/never_bound.dart.outline.expect b/pkg/front_end/testcases/nnbd/never_bound.dart.outline.expect
new file mode 100644
index 0000000..488d8a3
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/never_bound.dart.outline.expect
@@ -0,0 +1,14 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class GenericNever<T extends Never = Never> extends core::Object {
+ synthetic constructor •() → self::GenericNever<self::GenericNever::T>
+ ;
+ method getParamType() → dynamic
+ ;
+}
+static method errors() → dynamic
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/nnbd/never_bound.dart.strong.expect b/pkg/front_end/testcases/nnbd/never_bound.dart.strong.expect
new file mode 100644
index 0000000..de5b31d
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/never_bound.dart.strong.expect
@@ -0,0 +1,44 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:10:3: Error: Type argument 'Null?' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<Null>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:11:3: Error: Type argument 'void' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<void>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:12:3: Error: Type argument 'int' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<int>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class GenericNever<T extends Never = Never> extends core::Object {
+ synthetic constructor •() → self::GenericNever<self::GenericNever::T>
+ : super core::Object::•()
+ ;
+ method getParamType() → dynamic
+ return self::GenericNever::T;
+}
+static method errors() → dynamic {
+ new self::GenericNever::•<core::Null?>();
+ new self::GenericNever::•<void>();
+ new self::GenericNever::•<core::int>();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/never_bound.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/never_bound.dart.strong.transformed.expect
new file mode 100644
index 0000000..de5b31d
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/never_bound.dart.strong.transformed.expect
@@ -0,0 +1,44 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:10:3: Error: Type argument 'Null?' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<Null>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:11:3: Error: Type argument 'void' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<void>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:12:3: Error: Type argument 'int' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<int>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class GenericNever<T extends Never = Never> extends core::Object {
+ synthetic constructor •() → self::GenericNever<self::GenericNever::T>
+ : super core::Object::•()
+ ;
+ method getParamType() → dynamic
+ return self::GenericNever::T;
+}
+static method errors() → dynamic {
+ new self::GenericNever::•<core::Null?>();
+ new self::GenericNever::•<void>();
+ new self::GenericNever::•<core::int>();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/never_bound.dart.weak.expect b/pkg/front_end/testcases/nnbd/never_bound.dart.weak.expect
new file mode 100644
index 0000000..de5b31d
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/never_bound.dart.weak.expect
@@ -0,0 +1,44 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:10:3: Error: Type argument 'Null?' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<Null>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:11:3: Error: Type argument 'void' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<void>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:12:3: Error: Type argument 'int' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<int>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class GenericNever<T extends Never = Never> extends core::Object {
+ synthetic constructor •() → self::GenericNever<self::GenericNever::T>
+ : super core::Object::•()
+ ;
+ method getParamType() → dynamic
+ return self::GenericNever::T;
+}
+static method errors() → dynamic {
+ new self::GenericNever::•<core::Null?>();
+ new self::GenericNever::•<void>();
+ new self::GenericNever::•<core::int>();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/never_bound.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/never_bound.dart.weak.transformed.expect
new file mode 100644
index 0000000..de5b31d
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/never_bound.dart.weak.transformed.expect
@@ -0,0 +1,44 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:10:3: Error: Type argument 'Null?' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<Null>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:11:3: Error: Type argument 'void' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<void>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+// pkg/front_end/testcases/nnbd/never_bound.dart:12:3: Error: Type argument 'int' doesn't conform to the bound 'Never' of the type variable 'T' on 'GenericNever'.
+// Try changing type arguments so that they conform to the bounds.
+// GenericNever<int>();
+// ^
+// pkg/front_end/testcases/nnbd/never_bound.dart:5:20: Context: This is the type variable whose bound isn't conformed to.
+// class GenericNever<T extends Never> {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class GenericNever<T extends Never = Never> extends core::Object {
+ synthetic constructor •() → self::GenericNever<self::GenericNever::T>
+ : super core::Object::•()
+ ;
+ method getParamType() → dynamic
+ return self::GenericNever::T;
+}
+static method errors() → dynamic {
+ new self::GenericNever::•<core::Null?>();
+ new self::GenericNever::•<void>();
+ new self::GenericNever::•<core::int>();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/non_nullable_optional.dart b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart
new file mode 100644
index 0000000..3152095
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2020, 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 'non_nullable_optional_part.dart';
+
+main() {}
+
+method1({int a}) {}
+
+method2([int a]) {}
diff --git a/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.outline.expect b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.outline.expect
new file mode 100644
index 0000000..f59fb9e
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.outline.expect
@@ -0,0 +1,34 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional.dart:9:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method1({int a}) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional.dart:11:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method2([int a]) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart:7:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method3({int a}) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart:9:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method4([int a]) {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+part non_nullable_optional_part.dart;
+static method main() → dynamic
+ ;
+static method method1({core::int a}) → dynamic
+ ;
+static method method2([core::int a]) → dynamic
+ ;
+static method /* from org-dartlang-testcase:///non_nullable_optional_part.dart */ method3({core::int a}) → dynamic
+ ;
+static method /* from org-dartlang-testcase:///non_nullable_optional_part.dart */ method4([core::int a]) → dynamic
+ ;
diff --git a/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.strong.expect b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.strong.expect
new file mode 100644
index 0000000..d869c59
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.strong.expect
@@ -0,0 +1,33 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional.dart:9:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method1({int a}) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional.dart:11:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method2([int a]) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart:7:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method3({int a}) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart:9:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method4([int a]) {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+part non_nullable_optional_part.dart;
+static method main() → dynamic {}
+static method method1({core::int a = #C1}) → dynamic {}
+static method method2([core::int a = #C1]) → dynamic {}
+static method /* from org-dartlang-testcase:///non_nullable_optional_part.dart */ method3({core::int a = #C1}) → dynamic {}
+static method /* from org-dartlang-testcase:///non_nullable_optional_part.dart */ method4([core::int a = #C1]) → dynamic {}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.strong.transformed.expect
new file mode 100644
index 0000000..d869c59
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.strong.transformed.expect
@@ -0,0 +1,33 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional.dart:9:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method1({int a}) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional.dart:11:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method2([int a]) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart:7:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method3({int a}) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart:9:14: Error: Optional parameter 'a' should have a default value because its type 'int' doesn't allow null.
+// method4([int a]) {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+part non_nullable_optional_part.dart;
+static method main() → dynamic {}
+static method method1({core::int a = #C1}) → dynamic {}
+static method method2([core::int a = #C1]) → dynamic {}
+static method /* from org-dartlang-testcase:///non_nullable_optional_part.dart */ method3({core::int a = #C1}) → dynamic {}
+static method /* from org-dartlang-testcase:///non_nullable_optional_part.dart */ method4([core::int a = #C1]) → dynamic {}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.weak.expect b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.weak.expect
new file mode 100644
index 0000000..e484f3d
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.weak.expect
@@ -0,0 +1,33 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional.dart:9:14: Warning: Optional parameter 'a' doesn't have a default value and its type 'int' doesn't allow null.
+// method1({int a}) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional.dart:11:14: Warning: Optional parameter 'a' doesn't have a default value and its type 'int' doesn't allow null.
+// method2([int a]) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart:7:14: Warning: Optional parameter 'a' doesn't have a default value and its type 'int' doesn't allow null.
+// method3({int a}) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart:9:14: Warning: Optional parameter 'a' doesn't have a default value and its type 'int' doesn't allow null.
+// method4([int a]) {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+part non_nullable_optional_part.dart;
+static method main() → dynamic {}
+static method method1({core::int a = #C1}) → dynamic {}
+static method method2([core::int a = #C1]) → dynamic {}
+static method /* from org-dartlang-testcase:///non_nullable_optional_part.dart */ method3({core::int a = #C1}) → dynamic {}
+static method /* from org-dartlang-testcase:///non_nullable_optional_part.dart */ method4([core::int a = #C1]) → dynamic {}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.weak.transformed.expect
new file mode 100644
index 0000000..e484f3d
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/non_nullable_optional.dart.weak.transformed.expect
@@ -0,0 +1,33 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional.dart:9:14: Warning: Optional parameter 'a' doesn't have a default value and its type 'int' doesn't allow null.
+// method1({int a}) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional.dart:11:14: Warning: Optional parameter 'a' doesn't have a default value and its type 'int' doesn't allow null.
+// method2([int a]) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart:7:14: Warning: Optional parameter 'a' doesn't have a default value and its type 'int' doesn't allow null.
+// method3({int a}) {}
+// ^
+//
+// pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart:9:14: Warning: Optional parameter 'a' doesn't have a default value and its type 'int' doesn't allow null.
+// method4([int a]) {}
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+part non_nullable_optional_part.dart;
+static method main() → dynamic {}
+static method method1({core::int a = #C1}) → dynamic {}
+static method method2([core::int a = #C1]) → dynamic {}
+static method /* from org-dartlang-testcase:///non_nullable_optional_part.dart */ method3({core::int a = #C1}) → dynamic {}
+static method /* from org-dartlang-testcase:///non_nullable_optional_part.dart */ method4([core::int a = #C1]) → dynamic {}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart b/pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart
new file mode 100644
index 0000000..a133e62
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/non_nullable_optional_part.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2020, 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 'non_nullable_optional.dart';
+
+method3({int a}) {}
+
+method4([int a]) {}
diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json
new file mode 100644
index 0000000..154c73c
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json
@@ -0,0 +1,12 @@
+{
+ "none": {
+ "libraries": {
+ "test": {
+ "patches": [
+ "patch_lib.dart"
+ ],
+ "uri": "origin_lib.dart"
+ }
+ }
+ }
+}
diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart
new file mode 100644
index 0000000..f243f6a
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart
@@ -0,0 +1,10 @@
+// Copyright (c) 2020, 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:test';
+
+main() {
+ Class1? c1;
+ Class2? c2;
+}
diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.outline.expect b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.outline.expect
new file mode 100644
index 0000000..0e4e5af
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.outline.expect
@@ -0,0 +1,29 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+
+import "dart:test";
+
+static method main() → dynamic
+ ;
+
+library /*isNonNullableByDefault*/;
+import self as self2;
+import "dart:_internal" as _in;
+import "dart:core" as core;
+
+import "dart:_internal";
+
+@_in::patch
+class Class1 extends core::Object {
+ field core::int field /* from org-dartlang-testcase:///patch_lib.dart */;
+ synthetic constructor •() → self2::Class1
+ ;
+}
+@_in::patch
+class Class2 extends core::Object {
+ field core::int field /* from org-dartlang-testcase:///patch_lib.dart */;
+ constructor constructor2(core::int field) → self2::Class2
+ ;
+ constructor constructor1() → self2::Class2
+ ;
+}
diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.expect b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.expect
new file mode 100644
index 0000000..d823eb3
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.expect
@@ -0,0 +1,50 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:test" as test;
+
+import "dart:test";
+
+static method main() → dynamic {
+ test::Class1? c1;
+ test::Class2? c2;
+}
+
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart:10:7: Error: Field 'field' should be initialized because its type 'int' doesn't allow null.
+// int field;
+// ^^^^^
+//
+// pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart:15:7: Error: This constructor should initialize field 'field' because its type 'int' doesn't allow null.
+// int field;
+// ^^^^^
+//
+import self as test;
+import "dart:_internal" as _in;
+import "dart:core" as core;
+
+import "dart:_internal";
+
+@#C1
+class Class1 extends core::Object {
+ field core::int field = null /* from org-dartlang-testcase:///patch_lib.dart */;
+ synthetic constructor •() → test::Class1
+ : super core::Object::•()
+ ;
+}
+@#C1
+class Class2 extends core::Object {
+ field core::int field /* from org-dartlang-testcase:///patch_lib.dart */;
+ constructor constructor2(core::int field) → test::Class2
+ : test::Class2::field = field, super core::Object::•()
+ ;
+ constructor constructor1() → test::Class2
+ : test::Class2::field = null, super core::Object::•()
+ ;
+}
+
+constants {
+ #C1 = _in::_Patch {}
+}
diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.transformed.expect
new file mode 100644
index 0000000..d823eb3
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.transformed.expect
@@ -0,0 +1,50 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:test" as test;
+
+import "dart:test";
+
+static method main() → dynamic {
+ test::Class1? c1;
+ test::Class2? c2;
+}
+
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart:10:7: Error: Field 'field' should be initialized because its type 'int' doesn't allow null.
+// int field;
+// ^^^^^
+//
+// pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart:15:7: Error: This constructor should initialize field 'field' because its type 'int' doesn't allow null.
+// int field;
+// ^^^^^
+//
+import self as test;
+import "dart:_internal" as _in;
+import "dart:core" as core;
+
+import "dart:_internal";
+
+@#C1
+class Class1 extends core::Object {
+ field core::int field = null /* from org-dartlang-testcase:///patch_lib.dart */;
+ synthetic constructor •() → test::Class1
+ : super core::Object::•()
+ ;
+}
+@#C1
+class Class2 extends core::Object {
+ field core::int field /* from org-dartlang-testcase:///patch_lib.dart */;
+ constructor constructor2(core::int field) → test::Class2
+ : test::Class2::field = field, super core::Object::•()
+ ;
+ constructor constructor1() → test::Class2
+ : test::Class2::field = null, super core::Object::•()
+ ;
+}
+
+constants {
+ #C1 = _in::_Patch {}
+}
diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.weak.expect b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.weak.expect
new file mode 100644
index 0000000..56c3e97
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.weak.expect
@@ -0,0 +1,50 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:test" as test;
+
+import "dart:test";
+
+static method main() → dynamic {
+ test::Class1? c1;
+ test::Class2? c2;
+}
+
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart:10:7: Warning: Field 'field' isn't initialized and its type 'int' doesn't allow null.
+// int field;
+// ^^^^^
+//
+// pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart:15:7: Warning: This constructor doesn't initialize field 'field' and its type 'int' doesn't allow null.
+// int field;
+// ^^^^^
+//
+import self as test;
+import "dart:_internal" as _in;
+import "dart:core" as core;
+
+import "dart:_internal";
+
+@#C1
+class Class1 extends core::Object {
+ field core::int field = null /* from org-dartlang-testcase:///patch_lib.dart */;
+ synthetic constructor •() → test::Class1
+ : super core::Object::•()
+ ;
+}
+@#C1
+class Class2 extends core::Object {
+ field core::int field /* from org-dartlang-testcase:///patch_lib.dart */;
+ constructor constructor2(core::int field) → test::Class2
+ : test::Class2::field = field, super core::Object::•()
+ ;
+ constructor constructor1() → test::Class2
+ : test::Class2::field = null, super core::Object::•()
+ ;
+}
+
+constants {
+ #C1 = _in::_Patch {}
+}
diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.weak.transformed.expect
new file mode 100644
index 0000000..56c3e97
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.weak.transformed.expect
@@ -0,0 +1,50 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:test" as test;
+
+import "dart:test";
+
+static method main() → dynamic {
+ test::Class1? c1;
+ test::Class2? c2;
+}
+
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart:10:7: Warning: Field 'field' isn't initialized and its type 'int' doesn't allow null.
+// int field;
+// ^^^^^
+//
+// pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart:15:7: Warning: This constructor doesn't initialize field 'field' and its type 'int' doesn't allow null.
+// int field;
+// ^^^^^
+//
+import self as test;
+import "dart:_internal" as _in;
+import "dart:core" as core;
+
+import "dart:_internal";
+
+@#C1
+class Class1 extends core::Object {
+ field core::int field = null /* from org-dartlang-testcase:///patch_lib.dart */;
+ synthetic constructor •() → test::Class1
+ : super core::Object::•()
+ ;
+}
+@#C1
+class Class2 extends core::Object {
+ field core::int field /* from org-dartlang-testcase:///patch_lib.dart */;
+ constructor constructor2(core::int field) → test::Class2
+ : test::Class2::field = field, super core::Object::•()
+ ;
+ constructor constructor1() → test::Class2
+ : test::Class2::field = null, super core::Object::•()
+ ;
+}
+
+constants {
+ #C1 = _in::_Patch {}
+}
diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/origin_lib.dart b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/origin_lib.dart
new file mode 100644
index 0000000..db277d5
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/origin_lib.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2020, 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.
+
+class Class1 {}
+
+class Class2 {
+ Class2.constructor1();
+}
diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart
new file mode 100644
index 0000000..4a93691
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/patch_lib.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2020, 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.
+
+// ignore: import_internal_library
+import 'dart:_internal';
+
+@patch
+class Class1 {
+ int field;
+}
+
+@patch
+class Class2 {
+ int field;
+
+ Class2.constructor2(this.field);
+}
diff --git a/pkg/front_end/testcases/nnbd/switch_redesign_types.dart b/pkg/front_end/testcases/nnbd/switch_redesign_types.dart
index 31cfb68..dae5c81 100644
--- a/pkg/front_end/testcases/nnbd/switch_redesign_types.dart
+++ b/pkg/front_end/testcases/nnbd/switch_redesign_types.dart
@@ -26,6 +26,7 @@
}
bar(B b) {
+ const dynamic x = const D(123);
switch (b) {
case const B(42):
break;
@@ -35,6 +36,8 @@
break;
case const D(42): // Error: D has custom operator ==.
break;
+ case x: // Error: D has custom operator ==.
+ break;
default:
}
}
diff --git a/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.strong.expect b/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.strong.expect
index 7d21d18..bd7eee5 100644
--- a/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.strong.expect
@@ -1,13 +1,34 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:37:16: Error: Case expression 'D {}' does not have a primitive operator '=='.
+// - 'D' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case const D(42): // Error: D has custom operator ==.
+// ^
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:39:10: Error: Case expression 'D {}' does not have a primitive operator '=='.
+// - 'D' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case x: // Error: D has custom operator ==.
+// ^
+//
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
-// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:34:16: Error: Type 'A' of the case expression is not a subtype of type 'B' of this switch expression.
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:35:16: Error: Type 'A' of the case expression is not a subtype of type 'B' of this switch expression.
// - 'A' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
// - 'B' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
// case const A(42): // Error: not a subtype of B.
// ^
-// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:29:11: Context: The switch expression is here.
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:30:11: Context: The switch expression is here.
+// switch (b) {
+// ^
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:39:10: Error: Type 'dynamic' of the case expression is not a subtype of type 'B' of this switch expression.
+// - 'B' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case x: // Error: D has custom operator ==.
+// ^
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:30:11: Context: The switch expression is here.
// switch (b) {
// ^
//
@@ -61,6 +82,11 @@
break #L1;
}
#L6:
+ case #C7:
+ {
+ break #L1;
+ }
+ #L7:
default:
{}
}
@@ -73,4 +99,6 @@
#C3 = self::C {foo:#C1}
#C4 = self::A {foo:#C1}
#C5 = self::D {foo:#C1}
+ #C6 = 123
+ #C7 = self::D {foo:#C6}
}
diff --git a/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.strong.transformed.expect
index 7d21d18..bd7eee5 100644
--- a/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.strong.transformed.expect
@@ -1,13 +1,34 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:37:16: Error: Case expression 'D {}' does not have a primitive operator '=='.
+// - 'D' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case const D(42): // Error: D has custom operator ==.
+// ^
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:39:10: Error: Case expression 'D {}' does not have a primitive operator '=='.
+// - 'D' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case x: // Error: D has custom operator ==.
+// ^
+//
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
-// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:34:16: Error: Type 'A' of the case expression is not a subtype of type 'B' of this switch expression.
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:35:16: Error: Type 'A' of the case expression is not a subtype of type 'B' of this switch expression.
// - 'A' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
// - 'B' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
// case const A(42): // Error: not a subtype of B.
// ^
-// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:29:11: Context: The switch expression is here.
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:30:11: Context: The switch expression is here.
+// switch (b) {
+// ^
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:39:10: Error: Type 'dynamic' of the case expression is not a subtype of type 'B' of this switch expression.
+// - 'B' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case x: // Error: D has custom operator ==.
+// ^
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:30:11: Context: The switch expression is here.
// switch (b) {
// ^
//
@@ -61,6 +82,11 @@
break #L1;
}
#L6:
+ case #C7:
+ {
+ break #L1;
+ }
+ #L7:
default:
{}
}
@@ -73,4 +99,6 @@
#C3 = self::C {foo:#C1}
#C4 = self::A {foo:#C1}
#C5 = self::D {foo:#C1}
+ #C6 = 123
+ #C7 = self::D {foo:#C6}
}
diff --git a/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.weak.expect b/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.weak.expect
index 7d21d18..bd7eee5 100644
--- a/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.weak.expect
@@ -1,13 +1,34 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:37:16: Error: Case expression 'D {}' does not have a primitive operator '=='.
+// - 'D' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case const D(42): // Error: D has custom operator ==.
+// ^
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:39:10: Error: Case expression 'D {}' does not have a primitive operator '=='.
+// - 'D' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case x: // Error: D has custom operator ==.
+// ^
+//
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
-// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:34:16: Error: Type 'A' of the case expression is not a subtype of type 'B' of this switch expression.
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:35:16: Error: Type 'A' of the case expression is not a subtype of type 'B' of this switch expression.
// - 'A' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
// - 'B' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
// case const A(42): // Error: not a subtype of B.
// ^
-// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:29:11: Context: The switch expression is here.
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:30:11: Context: The switch expression is here.
+// switch (b) {
+// ^
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:39:10: Error: Type 'dynamic' of the case expression is not a subtype of type 'B' of this switch expression.
+// - 'B' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case x: // Error: D has custom operator ==.
+// ^
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:30:11: Context: The switch expression is here.
// switch (b) {
// ^
//
@@ -61,6 +82,11 @@
break #L1;
}
#L6:
+ case #C7:
+ {
+ break #L1;
+ }
+ #L7:
default:
{}
}
@@ -73,4 +99,6 @@
#C3 = self::C {foo:#C1}
#C4 = self::A {foo:#C1}
#C5 = self::D {foo:#C1}
+ #C6 = 123
+ #C7 = self::D {foo:#C6}
}
diff --git a/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.weak.transformed.expect
index 7d21d18..bd7eee5 100644
--- a/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/switch_redesign_types.dart.weak.transformed.expect
@@ -1,13 +1,34 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:37:16: Error: Case expression 'D {}' does not have a primitive operator '=='.
+// - 'D' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case const D(42): // Error: D has custom operator ==.
+// ^
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:39:10: Error: Case expression 'D {}' does not have a primitive operator '=='.
+// - 'D' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case x: // Error: D has custom operator ==.
+// ^
+//
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
-// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:34:16: Error: Type 'A' of the case expression is not a subtype of type 'B' of this switch expression.
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:35:16: Error: Type 'A' of the case expression is not a subtype of type 'B' of this switch expression.
// - 'A' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
// - 'B' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
// case const A(42): // Error: not a subtype of B.
// ^
-// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:29:11: Context: The switch expression is here.
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:30:11: Context: The switch expression is here.
+// switch (b) {
+// ^
+//
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:39:10: Error: Type 'dynamic' of the case expression is not a subtype of type 'B' of this switch expression.
+// - 'B' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'.
+// case x: // Error: D has custom operator ==.
+// ^
+// pkg/front_end/testcases/nnbd/switch_redesign_types.dart:30:11: Context: The switch expression is here.
// switch (b) {
// ^
//
@@ -61,6 +82,11 @@
break #L1;
}
#L6:
+ case #C7:
+ {
+ break #L1;
+ }
+ #L7:
default:
{}
}
@@ -73,4 +99,6 @@
#C3 = self::C {foo:#C1}
#C4 = self::A {foo:#C1}
#C5 = self::D {foo:#C1}
+ #C6 = 123
+ #C7 = self::D {foo:#C6}
}
diff --git a/pkg/front_end/testcases/text_serialization.status b/pkg/front_end/testcases/text_serialization.status
index 1ca9f66..dedd5cc 100644
--- a/pkg/front_end/testcases/text_serialization.status
+++ b/pkg/front_end/testcases/text_serialization.status
@@ -6,6 +6,9 @@
# the round trip for Kernel textual serialization where the initial binary
# Kernel files are produced by compiling Dart code via Fasta.
+agnostic/identical: TextSerializationFailure
+agnostic/map: TextSerializationFailure
+agnostic/set: TextSerializationFailure
expression/eval: TextSerializationFailure # Was: Pass
expression/main: TextSerializationFailure # Was: Pass
extensions/annotations: TextSerializationFailure
@@ -233,6 +236,8 @@
general/issue39421: TextSerializationFailure
general/issue39817: TextSerializationFailure
general/issue40428: TextSerializationFailure
+general/issue40662: TextSerializationFailure
+general/issue40744: TextSerializationFailure
general/literals: TextSerializationFailure # Was: Pass
general/local_generic_function: TextSerializationFailure # Was: Pass
general/long_chain_of_typedefs: TextSerializationFailure
@@ -1200,6 +1205,7 @@
late_lowering/issue40093: TextSerializationFailure
late_lowering/issue40373: TextSerializationFailure
late_lowering/issue40373b: TextSerializationFailure
+late_lowering/late_field_inference: TextSerializationFailure
late_lowering/late_field_with_initializer: TextSerializationFailure
late_lowering/late_field_without_initializer: TextSerializationFailure
late_lowering/late_final_field_with_initializer: TextSerializationFailure
@@ -1231,7 +1237,9 @@
nnbd/demote_closure_types: TextSerializationFailure
nnbd/forbidden_supers: TextSerializationFailure
nnbd/forin: TextSerializationFailure
+nnbd/from_agnostic/from_agnostic: TextSerializationFailure
nnbd/function_types: TextSerializationFailure
+nnbd/future_or_variables: TextSerializationFailure
nnbd/generic_override: TextSerializationFailure
nnbd/infer_from_opt_in: TextSerializationFailure
nnbd/infer_from_opt_out: TextSerializationFailure
@@ -1244,6 +1252,7 @@
nnbd/issue39822: TextSerializationFailure
nnbd/issue40093: TextSerializationFailure
nnbd/issue40134: TextSerializationFailure
+nnbd/issue40512/issue40512: TextSerializationFailure
nnbd/issue40600: TextSerializationFailure
nnbd/issue_39286: TextSerializationFailure
nnbd/issue_39286_2: TextSerializationFailure
@@ -1259,6 +1268,7 @@
nnbd/mixed_mode_hierarchy_generic_methods: TextSerializationFailure
nnbd/mixin_from_opt_in: TextSerializationFailure
nnbd/mixin_from_opt_out: TextSerializationFailure
+nnbd/never_bound: TextSerializationFailure
nnbd/never_opt_out: TypeCheckError
nnbd/never_receiver: TextSerializationFailure
nnbd/nnbd_opt_out_language_version: TextSerializationFailure
@@ -1267,6 +1277,7 @@
nnbd/no_null_shorting_explicit_extension: TextSerializationFailure
nnbd/no_null_shorting_extension: TextSerializationFailure
nnbd/non_nullable_field_initialization: TextSerializationFailure
+nnbd/non_nullable_optional: TextSerializationFailure
nnbd/not_definitely_unassigned_late_local_variables: TextSerializationFailure
nnbd/nsm_from_opt_in: TextSerializationFailure
nnbd/null_access: TextSerializationFailure
@@ -1285,6 +1296,7 @@
nnbd/opt_out: TextSerializationFailure
nnbd/override_checks: TextSerializationFailure
nnbd/platform_definite_assignment/main: TextSerializationFailure
+nnbd/platform_nonnullable_fields/main: TextSerializationFailure
nnbd/platform_optional_parameters/main: TextSerializationFailure
nnbd/potentially_non_nullable_field: TextSerializationFailure
nnbd/regress_null_aware: TextSerializationFailure
diff --git a/pkg/front_end/tool/_fasta/command_line.dart b/pkg/front_end/tool/_fasta/command_line.dart
index 5d8a639..5a38138 100644
--- a/pkg/front_end/tool/_fasta/command_line.dart
+++ b/pkg/front_end/tool/_fasta/command_line.dart
@@ -24,6 +24,7 @@
import 'package:front_end/src/api_prototype/standard_file_system.dart'
show StandardFileSystem;
+import 'package:front_end/src/base/nnbd_mode.dart';
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
@@ -268,8 +269,9 @@
"--single-root-base": Uri,
"--single-root-scheme": String,
Flags.nnbdStrongMode: false,
+ Flags.nnbdAgnosticMode: false,
"--supermixin": true,
- "--target": String,
+ Flags.target: String,
"--enable-asserts": false,
"--verbose": false,
"--verify": false,
@@ -360,6 +362,18 @@
final bool nnbdStrongMode = options[Flags.nnbdStrongMode];
+ final bool nnbdAgnosticMode = options[Flags.nnbdAgnosticMode];
+
+ final NnbdMode nnbdMode = nnbdAgnosticMode
+ ? NnbdMode.Agnostic
+ : (nnbdStrongMode ? NnbdMode.Strong : NnbdMode.Weak);
+
+ if (nnbdStrongMode && nnbdAgnosticMode) {
+ return throw new CommandLineProblem.deprecated(
+ "Can't specify both '${Flags.nnbdStrongMode}' and "
+ "'${Flags.nnbdAgnosticMode}'.");
+ }
+
final bool forceNnbdChecks = options[Flags.forceNnbdChecks];
FileSystem fileSystem = StandardFileSystem.instance;
@@ -408,7 +422,7 @@
..bytecode = bytecode
..experimentalFlags = experimentalFlags
..environmentDefines = noDefines ? null : parsedArguments.defines
- ..nnbdStrongMode = nnbdStrongMode
+ ..nnbdMode = nnbdMode
..performNnbdChecks = forceNnbdChecks,
inputs: <Uri>[Uri.parse(arguments[0])],
output: resolveInputUri(arguments[3]));
@@ -466,7 +480,7 @@
..verify = verify
..experimentalFlags = experimentalFlags
..environmentDefines = noDefines ? null : parsedArguments.defines
- ..nnbdStrongMode = nnbdStrongMode
+ ..nnbdMode = nnbdMode
..performNnbdChecks = forceNnbdChecks;
// TODO(ahe): What about chase dependencies?
diff --git a/pkg/front_end/tool/fasta_perf.dart b/pkg/front_end/tool/fasta_perf.dart
index 2037866..986fc83 100644
--- a/pkg/front_end/tool/fasta_perf.dart
+++ b/pkg/front_end/tool/fasta_perf.dart
@@ -218,7 +218,7 @@
// bodies. So this listener is not feature complete.
class _PartialAstBuilder extends AstBuilder {
_PartialAstBuilder(Uri uri)
- : super(null, null, true, FeatureSet.fromEnableFlags([]), uri);
+ : super(null, null, true, null, FeatureSet.fromEnableFlags([]), uri);
}
// Invoke the fasta kernel generator for the program starting in [entryUri]
diff --git a/pkg/front_end/tool/perf.dart b/pkg/front_end/tool/perf.dart
index edec99c..2c18e45 100644
--- a/pkg/front_end/tool/perf.dart
+++ b/pkg/front_end/tool/perf.dart
@@ -100,9 +100,12 @@
/// Uses the diet-parser to parse only directives in [source].
CompilationUnit parseDirectives(Source source) {
var token = tokenize(source);
- var featureSet = FeatureSet.fromEnableFlags([]);
- var parser = new Parser(source, AnalysisErrorListener.NULL_LISTENER,
- featureSet: featureSet);
+ var parser = new Parser(
+ source,
+ AnalysisErrorListener.NULL_LISTENER,
+ languageVersion: null,
+ featureSet: FeatureSet.fromEnableFlags([]),
+ );
return parser.parseDirectives(token);
}
@@ -122,9 +125,12 @@
CompilationUnit parseFull(Source source) {
var token = tokenize(source);
parseTimer.start();
- var featureSet = FeatureSet.fromEnableFlags([]);
- var parser = new Parser(source, AnalysisErrorListener.NULL_LISTENER,
- featureSet: featureSet);
+ var parser = new Parser(
+ source,
+ AnalysisErrorListener.NULL_LISTENER,
+ languageVersion: null,
+ featureSet: FeatureSet.fromEnableFlags([]),
+ );
var unit = parser.parseCompilationUnit(token);
parseTimer.stop();
return unit;
diff --git a/pkg/frontend_server/lib/frontend_server.dart b/pkg/frontend_server/lib/frontend_server.dart
index 748fd72..80d72c3 100644
--- a/pkg/frontend_server/lib/frontend_server.dart
+++ b/pkg/frontend_server/lib/frontend_server.dart
@@ -145,6 +145,10 @@
help: 'Include only bytecode into the output file', defaultsTo: true)
..addFlag('enable-asserts',
help: 'Whether asserts will be enabled.', defaultsTo: false)
+ ..addFlag('null-safety',
+ help:
+ 'Respect the nullability of types at runtime in casts and instance checks.',
+ defaultsTo: false)
..addMultiOption('enable-experiment',
help: 'Comma separated list of experimental features, eg set-literals.',
hide: true)
@@ -155,7 +159,9 @@
..addOption('component-name', help: 'Name of the Fuchsia component')
..addOption('data-dir',
help: 'Name of the subdirectory of //data for output files')
- ..addOption('far-manifest', help: 'Path to output Fuchsia package manifest');
+ ..addOption('far-manifest', help: 'Path to output Fuchsia package manifest')
+ ..addOption('libraries-spec',
+ help: 'A path or uri to the libraries specification JSON file');
String usage = '''
Usage: server [options] [input.dart]
@@ -369,6 +375,7 @@
..experimentalFlags = parseExperimentalFlags(
parseExperimentalArguments(options['enable-experiment']),
onError: (msg) => errors.add(msg))
+ ..nnbdMode = options['null-safety'] ? NnbdMode.Strong : NnbdMode.Weak
..onDiagnostic = (DiagnosticMessage message) {
bool printMessage;
switch (message.severity) {
@@ -389,6 +396,11 @@
}
};
+ if (options.wasParsed('libraries-spec')) {
+ compilerOptions.librariesSpecificationUri =
+ resolveInputUri(options['libraries-spec']);
+ }
+
if (options.wasParsed('filesystem-root')) {
if (_options['output-dill'] == null) {
print('When --filesystem-root is specified it is required to specify'
diff --git a/pkg/js/README.md b/pkg/js/README.md
index 9ea9884..e5563a1 100644
--- a/pkg/js/README.md
+++ b/pkg/js/README.md
@@ -5,7 +5,7 @@
The Dart-to-JavaScript compilers — dartdevc and dart2js — recognize these
annotations, using them to connect your Dart code with JavaScript.
-**Important:** This library supercedes `dart:js`, so don't import `dart:js`.
+**Important:** This library supersedes `dart:js`, so don't import `dart:js`.
Instead, import `package:js/js.dart`.
A second library in this package, `js_util`, provides low-level utilities
@@ -104,8 +104,6 @@
If you pass a Dart function to a JavaScript API as an argument,
wrap the Dart function using `allowInterop()` or `allowInteropCaptureThis()`.
-**Warning:** Although dart2js requires `allowInterop()`, dartdevc does not.
-
To make a Dart function callable from JavaScript _by name_, use a setter
annotated with `@JS()`.
@@ -151,25 +149,6 @@
JavaScript interop. There are currently some known differences in behavior and
bugs in one or both compilers.
-#### allowInterop is required in dart2js, optional in dartdevc
-
-DDC uses the same calling conventions as JavaScript and so Dart functions passed
-as callbacks can be invoked without modification. In dart2js the calling
-conventions are different and so `allowInterop()` or `allowInteropCaptureThis()`
-must be used for any callback.
-
-**Workaround:**: Always use `allowInterop()` even when not required in dartdevc.
-
-#### Callbacks allow extra ignored arguments in DDC
-
-In JavaScript a caller may pass any number of "extra" arguments to a function
-and they will be ignored. dartdevc follows this behavior, dart2js will have a runtime
-error if a function is invoked with more arguments than expected.
-
-**Workaround:** Write functions that take the same number of arguments as will
-be passed from JavaScript. If the number is variable use optional positional
-arguments.
-
#### Dartdevc and dart2js have different representation for Maps
Passing a `Map<String, String>` as an argument to a JavaScript function will
@@ -210,8 +189,9 @@
inspecting each one. At runtime a check like `result is List` may succeed, while
`result is List<String>` will always fail.
-**Workaround:** Use a `.cast<String>().toList()` call to get a `List` with the
-expected reified type at runtime.
+**Workaround:** Use `.cast()` or construct a new `List` to get an instance with
+the expected reified type. For instance if you want a `List<String>` use
+`.cast<String>()` or `List<String>.from`.
#### The `JsObject` type from `dart:js` can't be used with `@JS()` annotation
diff --git a/pkg/kernel/bin/transform.dart b/pkg/kernel/bin/transform.dart
index c0b9d02..40064fd 100755
--- a/pkg/kernel/bin/transform.dart
+++ b/pkg/kernel/bin/transform.dart
@@ -104,7 +104,7 @@
component,
backend,
defines,
- const constants.SimpleErrorReporter(),
+ const constants.SimpleErrorReporter(false),
constants.EvaluationMode.legacy);
break;
case 'empty':
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 072b58c..aa2408c 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -1637,7 +1637,10 @@
this.isStatic = isStatic;
this.isLate = isLate;
this.hasImplicitGetter = hasImplicitGetter ?? !isStatic;
- this.hasImplicitSetter = hasImplicitSetter ?? (!isStatic && !isFinal);
+ this.hasImplicitSetter = hasImplicitSetter ??
+ (!isStatic &&
+ !isConst &&
+ (!isFinal || (isLate && initializer == null)));
this.transformerFlags = transformerFlags;
}
diff --git a/pkg/kernel/lib/src/future_or.dart b/pkg/kernel/lib/src/future_or.dart
index 51f35cf..f655959 100644
--- a/pkg/kernel/lib/src/future_or.dart
+++ b/pkg/kernel/lib/src/future_or.dart
@@ -65,3 +65,15 @@
}
return type.nullability;
}
+
+bool isPotentiallyNullable(DartType type, Class futureOrClass) {
+ Nullability nullability = computeNullability(type, futureOrClass);
+ return nullability == Nullability.nullable ||
+ nullability == Nullability.undetermined;
+}
+
+bool isPotentiallyNonNullable(DartType type, Class futureOrClass) {
+ Nullability nullability = computeNullability(type, futureOrClass);
+ return nullability == Nullability.nonNullable ||
+ nullability == Nullability.undetermined;
+}
diff --git a/pkg/kernel/lib/src/legacy_erasure.dart b/pkg/kernel/lib/src/legacy_erasure.dart
index bd47475..b7fa3e5 100644
--- a/pkg/kernel/lib/src/legacy_erasure.dart
+++ b/pkg/kernel/lib/src/legacy_erasure.dart
@@ -11,7 +11,16 @@
/// nullabilities have been replaced with legacy nullability, and all required
/// named parameters are not required.
DartType legacyErasure(CoreTypes coreTypes, DartType type) {
- return type.accept(new _LegacyErasure(coreTypes)) ?? type;
+ return rawLegacyErasure(coreTypes, type) ?? type;
+}
+
+/// Returns legacy erasure of [type], that is, the type in which all nnbd
+/// nullabilities have been replaced with legacy nullability, and all required
+/// named parameters are not required.
+///
+/// Returns `null` if the type wasn't changed.
+DartType rawLegacyErasure(CoreTypes coreTypes, DartType type) {
+ return type.accept(new _LegacyErasure(coreTypes));
}
/// Returns legacy erasure of [supertype], that is, the type in which all nnbd
diff --git a/pkg/kernel/lib/transformations/async.dart b/pkg/kernel/lib/transformations/async.dart
index ee85e03..88188f5 100644
--- a/pkg/kernel/lib/transformations/async.dart
+++ b/pkg/kernel/lib/transformations/async.dart
@@ -108,11 +108,9 @@
// Perform an action with a given list of statements so that it cannot emit
// statements into the 'outer' list.
Expression delimit(Expression action(), List<Statement> inner) {
- var index = nameIndex;
var outer = statements;
statements = inner;
Expression result = action();
- nameIndex = index;
statements = outer;
return result;
}
@@ -373,12 +371,17 @@
// evaluated.
var shouldName = seenAwait;
+ final savedNameIndex = nameIndex;
+
var thenStatements = <Statement>[];
seenAwait = false;
expr.then = delimit(() => expr.then.accept<TreeNode>(this), thenStatements)
..parent = expr;
var thenAwait = seenAwait;
+ final thenNameIndex = nameIndex;
+ nameIndex = savedNameIndex;
+
var otherwiseStatements = <Statement>[];
seenAwait = false;
expr.otherwise = delimit(
@@ -386,6 +389,12 @@
..parent = expr;
var otherwiseAwait = seenAwait;
+ // Only one side of this branch will get executed at a time, so just make
+ // sure we have enough temps for either, not both at the same time.
+ if (thenNameIndex > nameIndex) {
+ nameIndex = thenNameIndex;
+ }
+
if (thenStatements.isEmpty && otherwiseStatements.isEmpty) {
// Easy case: neither then nor otherwise emitted any statements.
seenAwait = shouldName;
diff --git a/pkg/kernel/lib/type_environment.dart b/pkg/kernel/lib/type_environment.dart
index 1fa812e..b80d616 100644
--- a/pkg/kernel/lib/type_environment.dart
+++ b/pkg/kernel/lib/type_environment.dart
@@ -781,6 +781,10 @@
/// Return `true` if the current library is opted in to non-nullable by
/// default.
bool get isNonNullableByDefault => _library.isNonNullableByDefault;
+
+ /// Returns the mode under which the current library was compiled.
+ NonNullableByDefaultCompiledMode get nonNullableByDefaultCompiledMode =>
+ _library.nonNullableByDefaultCompiledMode;
}
/// Implementation of [StaticTypeContext] that update its state when entering
@@ -862,6 +866,10 @@
@override
bool get isNonNullableByDefault => _library.isNonNullableByDefault;
+ @override
+ NonNullableByDefaultCompiledMode get nonNullableByDefaultCompiledMode =>
+ _library.nonNullableByDefaultCompiledMode;
+
/// Updates the [nonNullable] and [thisType] to match static type context for
/// the member [node].
///
@@ -949,6 +957,10 @@
@override
bool get isNonNullableByDefault => _library?.isNonNullableByDefault;
+ @override
+ NonNullableByDefaultCompiledMode get nonNullableByDefaultCompiledMode =>
+ _library.nonNullableByDefaultCompiledMode;
+
/// Updates the [library] and [thisType] to match static type context for
/// the member [node].
///
diff --git a/pkg/kernel/lib/visitor.dart b/pkg/kernel/lib/visitor.dart
index f9683d9..978882b 100644
--- a/pkg/kernel/lib/visitor.dart
+++ b/pkg/kernel/lib/visitor.dart
@@ -423,7 +423,14 @@
/// Call this method to compute values for subnodes recursively, while only
/// visiting each subnode once.
R visitConstant(Constant node) {
- return cache[node] ??= node.accept(_visitor);
+ return cache[node] ??= processValue(node, node.accept(_visitor));
+ }
+
+ /// Returns the computed [value] for [node].
+ ///
+ /// Override this method to process the computed value before caching.
+ R processValue(Constant node, R value) {
+ return value;
}
R defaultConstant(Constant node) => null;
diff --git a/pkg/kernel/test/regression_40662_test.dart b/pkg/kernel/test/regression_40662_test.dart
new file mode 100644
index 0000000..140d34c
--- /dev/null
+++ b/pkg/kernel/test/regression_40662_test.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2020, 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.
+//
+// Regression test for https://github.com/dart-lang/sdk/issues/40662.
+
+import "package:expect/expect.dart" show Expect;
+
+bar(int a, List<int> b) {
+ Expect.equals(-1, a);
+ Expect.equals(-1, (b[0] - 2));
+}
+
+foo(int x) async => bar(x - 1, x != null ? [x + 1, x + 2, await null] : null);
+
+void main() async => await foo(0);
diff --git a/pkg/nnbd_migration/bin/steamroll_ecosystem.dart b/pkg/nnbd_migration/bin/steamroll_ecosystem.dart
index 52222e3..35a443d 100644
--- a/pkg/nnbd_migration/bin/steamroll_ecosystem.dart
+++ b/pkg/nnbd_migration/bin/steamroll_ecosystem.dart
@@ -14,12 +14,38 @@
final parser = ArgParser()
..addMultiOption('extra-packages', abbr: 'e', splitCommas: true)
..addOption('package-name', abbr: 'p')
- ..addFlag('allow-update', defaultsTo: false, negatable: true)
+ ..addFlag('allow-update',
+ defaultsTo: false,
+ negatable: true,
+ help:
+ 'Try to update an existing repository in place. Does not work for unclean repositories.')
..addFlag('analysis-options-hack', defaultsTo: true, negatable: true)
..addFlag('strip-sdk-constraint-hack', defaultsTo: true, negatable: true)
- ..addFlag('force-migrate-deps', defaultsTo: true, negatable: true)
- ..addFlag('force-migrate-package', defaultsTo: false, negatable: true)
- ..addFlag('force-migrate-extras', defaultsTo: true, negatable: true)
+ ..addFlag('force-migrate-deps',
+ defaultsTo: false,
+ negatable: true,
+ help:
+ 'Use dartfix to force-update all dependencies (lib/ directory only).')
+ ..addFlag('force-migrate-package',
+ defaultsTo: false,
+ negatable: true,
+ help: 'Use dartfix to force-update the base package (from root).')
+ ..addFlag('force-migrate-extras',
+ defaultsTo: false,
+ negatable: true,
+ help: 'Use dartfix to force-update extra packages (from root).')
+ ..addOption('sdk',
+ help:
+ 'Use the given path to a NNBD-compliant sdk. Required for any --force options.')
+ ..addOption('analyze-results',
+ defaultsTo: 'full',
+ allowed: ['full', 'none', 'all'],
+ allowedHelp: {
+ 'full': 'Analyze only fully migrated packages',
+ 'none': 'Do not analyze migrated packages',
+ 'all': 'Analyze fully and partially migrated packages'
+ },
+ help: 'Use the command line analyzer to analyze migrated packages.')
..addFlag('help', abbr: 'h');
Future<void> main(List<String> args) async {
@@ -59,14 +85,64 @@
]);
}
- if (results['strip-sdk-constraint-hack'] as bool) {
- stderr.writeln('warning: sdk constraint hack not implemented');
- }
+ Set<FantasySubPackage> upgradedSubPackages = {};
+ Set<FantasySubPackage> upgradedSubPackagesLibOnly = {};
if (results['force-migrate-deps'] as bool ||
results['force-migrate-package'] as bool ||
results['force-migrate-extras'] as bool) {
- stderr.writeln('warning: auto-migration not implemented');
+ if (results['force-migrate-package'] as bool) {
+ upgradedSubPackages.addAll(
+ workspace.subPackages.values.where((s) => s.name == packageName));
+ }
+
+ if (results['force-migrate-extras'] as bool) {
+ upgradedSubPackages.addAll(workspace.subPackages.values
+ .where((s) => extraPackages.contains(s.name)));
+ }
+
+ if (results['force-migrate-deps'] as bool) {
+ upgradedSubPackagesLibOnly.addAll(workspace.subPackages.values.where(
+ (s) => s.name != packageName && !extraPackages.contains(s.name)));
+ }
+
+ if (results['sdk'] as String == null) {
+ _showHelp('error: --sdk required with force-migrate options');
+ exit(1);
+ }
+ if (!await workspace.forceMigratePackages(upgradedSubPackages,
+ upgradedSubPackagesLibOnly, results['sdk'] as String, [
+ Platform.resolvedExecutable,
+ path.normalize(path.join(Platform.script.toFilePath(), '..', '..', '..',
+ 'dartfix', 'bin', 'dartfix.dart'))
+ ])) {
+ stderr.writeln('//// Everything already upgraded.');
+ }
+ }
+
+ if (results['strip-sdk-constraint-hack'] as bool) {
+ await Future.wait([
+ for (FantasySubPackage p
+ in upgradedSubPackages.followedBy(upgradedSubPackagesLibOnly))
+ () async {
+ await p.removeSdkConstraintHack();
+ await workspace.rewritePackageConfigWith(p);
+ }()
+ ]);
+ }
+
+ if (results['analyze-results'] != 'none') {
+ Iterable<FantasySubPackage> subPackages = upgradedSubPackages;
+ Iterable<FantasySubPackage> subPackagesLibOnly = [];
+ if (results['analyze-results'] == 'all') {
+ subPackagesLibOnly = upgradedSubPackagesLibOnly;
+ }
+ await workspace.analyzePackages(
+ subPackages, subPackagesLibOnly, results['sdk'] as String, [
+ Platform.resolvedExecutable,
+ path.normalize(path.join(Platform.script.toFilePath(), '..', '..', '..',
+ 'analyzer_cli', 'bin', 'analyzer.dart'))
+ ]);
}
}
diff --git a/pkg/nnbd_migration/lib/instrumentation.dart b/pkg/nnbd_migration/lib/instrumentation.dart
index beda680..594be67 100644
--- a/pkg/nnbd_migration/lib/instrumentation.dart
+++ b/pkg/nnbd_migration/lib/instrumentation.dart
@@ -136,6 +136,9 @@
greatestLowerBound,
ifNull,
implicitMixinSuperCall,
+ implicitNullInitializer,
+ implicitNullReturn,
+ inferredTypeParameterInstantiation,
initializerInference,
instanceCreation,
instantiateToBounds,
@@ -156,6 +159,7 @@
thisOrSuper,
throw_,
typedefReference,
+ typeParameterInstantiation,
uninitializedRead,
}
diff --git a/pkg/nnbd_migration/lib/src/decorated_type.dart b/pkg/nnbd_migration/lib/src/decorated_type.dart
index 25a202a..3a5b782 100644
--- a/pkg/nnbd_migration/lib/src/decorated_type.dart
+++ b/pkg/nnbd_migration/lib/src/decorated_type.dart
@@ -272,6 +272,29 @@
@override
DecoratedTypeInfo positionalParameter(int i) => positionalParameters[i];
+ /// Updates the [roles] map with information about the nullability nodes
+ /// pointed to by this decorated type.
+ ///
+ /// Each entry stored in [roles] maps the role of the node to the node itself.
+ /// Roles look like pathnames, where each path component is an integer to
+ /// represent a type argument (or a positional parameter type, in the case of
+ /// a function type), an name to represent a named parameter type, or `@r` to
+ /// represent a return type.
+ void recordRoles(Map<String, NullabilityNode> roles,
+ {String rolePrefix = ''}) {
+ roles[rolePrefix] = node;
+ returnType?.recordRoles(roles, rolePrefix: '$rolePrefix/@r');
+ for (int i = 0; i < positionalParameters.length; i++) {
+ positionalParameters[i].recordRoles(roles, rolePrefix: '$rolePrefix/$i');
+ }
+ for (var entry in namedParameters.entries) {
+ entry.value.recordRoles(roles, rolePrefix: '$rolePrefix/${entry.key}');
+ }
+ for (int i = 0; i < typeArguments.length; i++) {
+ typeArguments[i].recordRoles(roles, rolePrefix: '$rolePrefix/$i');
+ }
+ }
+
/// Apply the given [substitution] to this type.
///
/// [undecoratedResult] is the result of the substitution, as determined by
@@ -355,6 +378,15 @@
namedParameters: namedParameters,
typeArguments: typeArguments);
+ /// Creates a shallow copy of `this`, replacing the nullability node and the
+ /// type.
+ DecoratedType withNodeAndType(NullabilityNode node, DartType type) =>
+ DecoratedType(type, node,
+ returnType: returnType,
+ positionalParameters: positionalParameters,
+ namedParameters: namedParameters,
+ typeArguments: typeArguments);
+
/// Internal implementation of [_substitute], used as a recursion target.
DecoratedType _substitute(
Map<TypeParameterElement, DecoratedType> substitution,
@@ -381,8 +413,8 @@
var typeFormal = typeFormals[i];
var oldDecoratedBound =
DecoratedTypeParameterBounds.current.get(typeFormal);
- var newDecoratedBound = oldDecoratedBound._substitute(
- substitution, typeFormal.bound ?? oldDecoratedBound.type);
+ var newDecoratedBound = oldDecoratedBound._substitute(substitution,
+ undecoratedResult.typeFormals[i].bound ?? oldDecoratedBound.type);
if (identical(typeFormal, undecoratedResult.typeFormals[i])) {
assert(oldDecoratedBound == newDecoratedBound);
} else {
@@ -405,8 +437,9 @@
if (inner == null) {
return this;
} else {
- return inner
- .withNode(NullabilityNode.forSubstitution(inner.node, node));
+ return inner.withNodeAndType(
+ NullabilityNode.forSubstitution(inner.node, node),
+ undecoratedResult);
}
} else if (type.isVoid || type.isDynamic) {
return this;
diff --git a/pkg/nnbd_migration/lib/src/edge_builder.dart b/pkg/nnbd_migration/lib/src/edge_builder.dart
index c3664e5..9b55b96 100644
--- a/pkg/nnbd_migration/lib/src/edge_builder.dart
+++ b/pkg/nnbd_migration/lib/src/edge_builder.dart
@@ -499,7 +499,7 @@
for (var member in members)
if (member is FieldDeclaration)
for (var field in member.fields.variables)
- if (field.initializer == null)
+ if (!field.declaredElement.isStatic && field.initializer == null)
field.declaredElement as FieldElement
};
if (_currentClassOrExtension is ClassElement &&
@@ -889,12 +889,16 @@
Iterable<DartType> typeArgumentTypes;
List<DecoratedType> decoratedTypeArguments;
var typeArguments = node.constructorName.type.typeArguments;
+ List<EdgeOrigin> parameterEdgeOrigins;
if (typeArguments != null) {
typeArguments.accept(this);
typeArgumentTypes = typeArguments.arguments.map((t) => t.type);
decoratedTypeArguments = typeArguments.arguments
.map((t) => _variables.decoratedTypeAnnotation(source, t))
.toList();
+ parameterEdgeOrigins = typeArguments.arguments
+ .map((typeAnn) => TypeParameterInstantiationOrigin(source, typeAnn))
+ .toList();
} else {
var staticType = node.staticType;
if (staticType is InterfaceType) {
@@ -905,6 +909,8 @@
.toList();
instrumentation?.implicitTypeArguments(
source, node, decoratedTypeArguments);
+ parameterEdgeOrigins = List.filled(typeArgumentTypes.length,
+ InferredTypeParameterInstantiationOrigin(source, node));
} else {
// Note: this could happen if the code being migrated has errors.
typeArgumentTypes = const [];
@@ -926,7 +932,7 @@
typeArguments: decoratedTypeArguments);
var calleeType = getOrComputeElementType(callee, targetType: createdType);
for (var i = 0; i < decoratedTypeArguments.length; ++i) {
- _checkAssignment(null,
+ _checkAssignment(parameterEdgeOrigins?.elementAt(i),
source: decoratedTypeArguments[i],
destination:
_variables.decoratedTypeParameterBound(typeParameters[i]),
@@ -1228,7 +1234,7 @@
offset: node.offset);
_graph.makeNullable(
implicitNullType.node, AlwaysNullableTypeOrigin(source, node));
- _checkAssignment(null,
+ _checkAssignment(ImplicitNullReturnOrigin(source, node),
source: isAsync
? _futureOf(implicitNullType, offset: node.offset)
: implicitNullType,
@@ -1523,7 +1529,11 @@
final decoratedType = typedefType.substitute(substitutions);
final origin = TypedefReferenceOrigin(source, typeName);
- _linkDecoratedTypes(decoratedType, typeNameType, origin, isUnion: true);
+ _linkDecoratedTypeParameters(decoratedType, typeNameType, origin,
+ isUnion: true);
+ _linkDecoratedTypes(
+ decoratedType.returnType, typeNameType.returnType, origin,
+ isUnion: true);
} else if (element is TypeParameterizedElement) {
if (typeArguments == null) {
var instantiatedType =
@@ -1552,8 +1562,11 @@
_unimplemented(typeName,
'No decorated type for type argument ${typeArguments[i]} ($i)');
}
- _checkAssignment(null,
- source: argumentType, destination: bound, hard: true);
+ _checkAssignment(
+ TypeParameterInstantiationOrigin(source, typeArguments[i]),
+ source: argumentType,
+ destination: bound,
+ hard: true);
}
}
}
@@ -1580,7 +1593,19 @@
assert(_flowAnalysis != null);
}
try {
- if (initializer != null) {
+ if (initializer == null) {
+ // For top level variables and static fields, we have to generate an
+ // implicit assignment of `null`. For instance fields, this is done
+ // when processing constructors. For local variables, this is done
+ // when processing variable reads (only if flow analysis indicates
+ // the variable isn't definitely assigned).
+ if (isTopLevel &&
+ !(declaredElement is FieldElement && !declaredElement.isStatic)) {
+ var type = _variables.decoratedElementType(declaredElement);
+ _graph.makeNullable(
+ type.node, ImplicitNullInitializerOrigin(source, node));
+ }
+ } else {
if (declaredElement is PromotableElement) {
_flowAnalysis.initialize(declaredElement);
}
@@ -2227,10 +2252,10 @@
/// Instantiate [type] with [argumentTypes], assigning [argumentTypes] to
/// [bounds].
- DecoratedType _handleInstantiation(
- DecoratedType type, List<DecoratedType> argumentTypes) {
+ DecoratedType _handleInstantiation(DecoratedType type,
+ List<DecoratedType> argumentTypes, List<EdgeOrigin> edgeOrigins) {
for (var i = 0; i < argumentTypes.length; ++i) {
- _checkAssignment(null,
+ _checkAssignment(edgeOrigins?.elementAt(i),
source: argumentTypes[i],
destination: DecoratedTypeParameterBounds.current
.get((type.type as FunctionType).typeFormals[i]),
@@ -2262,12 +2287,16 @@
var argumentTypes = typeArguments.arguments
.map((t) => _variables.decoratedTypeAnnotation(source, t))
.toList();
+ var origins = typeArguments.arguments
+ .map((typeAnnotation) =>
+ TypeParameterInstantiationOrigin(source, typeAnnotation))
+ .toList();
if (constructorTypeParameters != null) {
calleeType = calleeType.substitute(
Map<TypeParameterElement, DecoratedType>.fromIterables(
constructorTypeParameters, argumentTypes));
} else {
- calleeType = _handleInstantiation(calleeType, argumentTypes);
+ calleeType = _handleInstantiation(calleeType, argumentTypes, origins);
}
} else {
if (invokeType is FunctionType) {
@@ -2277,7 +2306,11 @@
offset: node.offset))
.toList();
instrumentation?.implicitTypeArguments(source, node, argumentTypes);
- calleeType = _handleInstantiation(calleeType, argumentTypes);
+ calleeType = _handleInstantiation(
+ calleeType,
+ argumentTypes,
+ List.filled(argumentTypes.length,
+ InferredTypeParameterInstantiationOrigin(source, node)));
} else if (constructorTypeParameters != null) {
// No need to instantiate; caller has already substituted in the
// correct type arguments.
@@ -2601,6 +2634,7 @@
@required bool hard,
bool checkable = true,
bool sourceIsFunctionLiteral = false}) {
+ assert(origin != null);
var sourceType = source.type;
var destinationType = destination.type;
if (!_typeSystem.isSubtypeOf(sourceType, destinationType)) {
diff --git a/pkg/nnbd_migration/lib/src/edge_origin.dart b/pkg/nnbd_migration/lib/src/edge_origin.dart
index 57ac8eb..ed76f68 100644
--- a/pkg/nnbd_migration/lib/src/edge_origin.dart
+++ b/pkg/nnbd_migration/lib/src/edge_origin.dart
@@ -192,6 +192,39 @@
EdgeOriginKind get kind => EdgeOriginKind.implicitMixinSuperCall;
}
+/// Edge origin resulting from the implicit assignment of `null` to a top level
+/// variable or field that lacks an initializer.
+class ImplicitNullInitializerOrigin extends EdgeOrigin {
+ ImplicitNullInitializerOrigin(Source source, AstNode node)
+ : super(source, node);
+
+ @override
+ EdgeOriginKind get kind => EdgeOriginKind.implicitNullInitializer;
+}
+
+/// Edge origin resulting from a `return;` statement which implicitly returns
+/// `null`.
+class ImplicitNullReturnOrigin extends EdgeOrigin {
+ ImplicitNullReturnOrigin(Source source, ReturnStatement node)
+ : super(source, node);
+
+ @override
+ EdgeOriginKind get kind => EdgeOriginKind.implicitNullReturn;
+
+ @override
+ ReturnStatement get node => super.node as ReturnStatement;
+}
+
+/// Edge origin resulting from the inference of a type parameter, which
+/// can affects the nullability of that type parameter's bound.
+class InferredTypeParameterInstantiationOrigin extends EdgeOrigin {
+ InferredTypeParameterInstantiationOrigin(Source source, AstNode node)
+ : super(source, node);
+
+ @override
+ EdgeOriginKind get kind => EdgeOriginKind.inferredTypeParameterInstantiation;
+}
+
/// Edge origin resulting from a type that is inferred from its initializer.
class InitializerInferenceOrigin extends EdgeOrigin {
InitializerInferenceOrigin(Source source, VariableDeclaration node)
@@ -225,19 +258,6 @@
EdgeOriginKind get kind => EdgeOriginKind.instantiateToBounds;
}
-/// Edge origin resulting from a usage of a typedef.
-///
-/// Since typedefs require multiple phases to resolve, they are represented by
-/// a set of inferred nodes. In the secondary phases of graph build, those get
-/// unioned with references to the nodes referring to source code. The origin of
-/// those union edges will be [TypedefReferenceOrigin].
-class TypedefReferenceOrigin extends EdgeOrigin {
- TypedefReferenceOrigin(Source source, TypeName node) : super(source, node);
-
- @override
- EdgeOriginKind get kind => EdgeOriginKind.typedefReference;
-}
-
/// Edge origin resulting from the use of a type as the main type in an 'is'
/// check.
///
@@ -411,6 +431,32 @@
EdgeOriginKind get kind => EdgeOriginKind.throw_;
}
+/// Edge origin resulting from a usage of a typedef.
+///
+/// Since typedefs require multiple phases to resolve, they are represented by
+/// a set of inferred nodes. In the secondary phases of graph build, those get
+/// unioned with references to the nodes referring to source code. The origin of
+/// those union edges will be [TypedefReferenceOrigin].
+class TypedefReferenceOrigin extends EdgeOrigin {
+ TypedefReferenceOrigin(Source source, TypeName node) : super(source, node);
+
+ @override
+ EdgeOriginKind get kind => EdgeOriginKind.typedefReference;
+}
+
+/// Edge origin resulting from the instantiation of a type parameter, which
+/// affects the nullability of that type parameter's bound.
+class TypeParameterInstantiationOrigin extends EdgeOrigin {
+ TypeParameterInstantiationOrigin(Source source, TypeAnnotation node)
+ : super(source, node);
+
+ @override
+ EdgeOriginKind get kind => EdgeOriginKind.typeParameterInstantiation;
+
+ @override
+ TypeAnnotation get node => super.node as TypeAnnotation;
+}
+
/// Edge origin resulting from the read of a variable that has not been
/// definitely assigned a value.
class UninitializedReadOrigin extends EdgeOrigin {
diff --git a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo.dart b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo.dart
index bd32f26..7c1e43b 100644
--- a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo.dart
+++ b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo.dart
@@ -19,9 +19,12 @@
'node-interop': FantasyRepoSettings(
'node-interop', '$githubHost:pulyaevskiy/node-interop.git'),
'node_preamble': FantasyRepoSettings(
- 'package_config', '$githubHost:mbullington/node_preamble.dart.git'),
- 'package_config': FantasyRepoSettings('package_config',
- '$githubHost:dart-lang/package_config', 'master', '1.1.0'),
+ 'node_preamble', '$githubHost:mbullington/node_preamble.dart.git'),
+ 'package_config': FantasyRepoSettings(
+ 'package_config',
+ '$githubHost:dart-lang/package_config',
+ 'master',
+ '3401e2897b3cf46e64966e2ba19ed7032501cf41'),
'source_gen_test': FantasyRepoSettings(
'source_gen_test', '$githubHost:kevmoo/source_gen_test.git'),
'quiver-dart':
diff --git a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo_impl.dart b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo_impl.dart
index 7c30ba6..9f96d5e 100644
--- a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo_impl.dart
+++ b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo_impl.dart
@@ -74,7 +74,9 @@
Future<void> _clone(SubprocessLauncher launcher) async {
assert(_isInitialized == false);
repoRoot.parent.create();
- await launcher.runStreamed('git', ['init', repoRoot.path]);
+ String instance = repoSettings.name;
+ await launcher.runStreamed('git', ['init', repoRoot.path],
+ instance: instance);
await launcher.runStreamed(
'git',
[
@@ -85,20 +87,21 @@
repoSettings.branch,
repoSettings.clone
],
- workingDirectory: repoRoot.path);
+ workingDirectory: repoRoot.path,
+ instance: instance);
String cloneHttp =
repoSettings.clone.replaceFirst('$githubHost:', '$_httpGithub/');
await launcher.runStreamed('git',
['remote', 'add', 'originHTTP', '-t', repoSettings.branch, cloneHttp],
- workingDirectory: repoRoot.path);
+ workingDirectory: repoRoot.path, instance: instance);
// Do not get the working directory wrong on this command or it could
// alter a user's repository config based on the CWD, which is bad. Other
// commands in [FantasyRepo] will not fail silently with permanent,
// confusing results, but this one can.
await launcher.runStreamed('git', ['config', 'core.sparsecheckout', 'true'],
- workingDirectory: repoRoot.path);
+ workingDirectory: repoRoot.path, instance: instance);
File sparseCheckout = _external.resourceProvider.getFile(_external
.resourceProvider.pathContext
@@ -109,9 +112,13 @@
'!**/pubspec.lock\n',
'!**/.dart_tool/package_config.json\n'
].join());
- await launcher.runStreamed(
- 'git', ['pull', '--depth=1', '--rebase', 'originHTTP'],
- workingDirectory: repoRoot.path, retries: 5);
+ List<String> args = ['pull'];
+ if (repoSettings.revision == 'master') {
+ args.add('--depth=1');
+ }
+ args.addAll(['--rebase', 'originHTTP', repoSettings.revision]);
+ await launcher.runStreamed('git', args,
+ workingDirectory: repoRoot.path, retries: 5, instance: instance);
}
Future<void> _update(SubprocessLauncher launcher) async {
@@ -119,7 +126,9 @@
try {
await launcher.runStreamed(
'git', ['pull', '--rebase', 'originHTTP', repoSettings.revision],
- workingDirectory: repoRoot.path, retries: 5);
+ workingDirectory: repoRoot.path,
+ retries: 5,
+ instance: repoSettings.name);
} catch (e) {
if (e is ProcessException) {
throw FantasyRepoUpdateException(
diff --git a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_sub_package.dart b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_sub_package.dart
index 46f2e3d..0d67e57 100644
--- a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_sub_package.dart
+++ b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_sub_package.dart
@@ -6,11 +6,14 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
+import 'package:analyzer/src/hint/sdk_constraint_extractor.dart';
import 'package:analyzer/src/lint/pub.dart';
import 'package:analyzer/src/task/options.dart';
import 'package:nnbd_migration/src/fantasyland/fantasy_repo.dart';
import 'package:nnbd_migration/src/fantasyland/fantasy_workspace_impl.dart';
import 'package:path/path.dart' as path;
+import 'package:pub/src/package_config.dart';
+import 'package:pub_semver/pub_semver.dart';
import 'package:source_span/source_span.dart';
import 'package:yaml/yaml.dart';
@@ -260,10 +263,18 @@
resourceProvider.pathContext.normalize(resourceProvider.pathContext
.join(containingRepo.repoRoot.path, packageSettings.subDir)));
+ String get languageVersion => extractLanguageVersion(versionConstraint);
+
+ VersionConstraint _versionConstraint;
+ VersionConstraint get versionConstraint =>
+ _versionConstraint ??= SdkConstraintExtractor(pubspecYaml).constraint();
+
+ File _pubspecYaml;
+ File get pubspecYaml => _pubspecYaml ??= resourceProvider.getFile(
+ resourceProvider.pathContext.join(packageRoot.path, 'pubspec.yaml'));
+
Future<void> _acceptPubspecVisitor<T>(
PubspecVisitor<T> pubspecVisitor) async {
- File pubspecYaml = resourceProvider.getFile(
- resourceProvider.pathContext.join(packageRoot.path, 'pubspec.yaml'));
if (!pubspecYaml.exists) return;
Pubspec pubspec = Pubspec.parse(pubspecYaml.readAsStringSync(),
sourceUrl: resourceProvider.pathContext.toUri(pubspecYaml.path));
@@ -300,6 +311,18 @@
// TODO(jcollins-g): implement
}
+ static final RegExp _sdkConstraint = RegExp(r'^\s+sdk:\s+.*');
+
+ Future<void> removeSdkConstraintHack() async {
+ if (pubspecYaml.exists) {
+ List<String> lines = pubspecYaml.readAsStringSync().split('\n');
+ lines = lines.where((l) => !_sdkConstraint.hasMatch(l)).toList();
+ pubspecYaml.writeAsStringSync(lines.join('\n'));
+ }
+ _pubspecYaml = null;
+ _versionConstraint = null;
+ }
+
/// Modify all analysis_options.yaml file to include the nullability
/// experiment.
Future<void> enableExperimentHack() async {
@@ -308,7 +331,8 @@
// TODO(jcollins-g): Remove this hack once no longer needed.
File optionsFile =
packageRoot.getChildAssumingFile('analysis_options.yaml');
- SourceChange sourceChange = SourceChange('fantasy_sub_package-$name');
+ SourceChange sourceChange =
+ SourceChange('fantasy_sub_package-experimenthack-$name');
String optionsContent;
YamlNode optionsMap;
if (optionsFile.exists) {
diff --git a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace.dart b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace.dart
index 6c55141..e9aa2ae 100644
--- a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace.dart
+++ b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace.dart
@@ -21,6 +21,29 @@
/// version.
Future<FantasySubPackage> addPackageToWorkspace(
FantasySubPackageSettings packageSettings, bool allowUpdate);
+
+ /// Run the dart analyzer over these packages.
+ ///
+ /// Assumes they have been migrated.
+ Future<void> analyzePackages(
+ Iterable<FantasySubPackage> subPackages,
+ Iterable<FantasySubPackage> subPackagesLibOnly,
+ String sdkPath,
+ List<String> dartanalyzerExec);
+
+ /// Force-migrate these packages.
+ ///
+ /// All [subPackages] must be part of this workspace. Returned future
+ /// completes when all [subPackages] have been migrated. Completes with
+ /// `true` if packages needed to be migrated, `false` if skipped.
+ Future<bool> forceMigratePackages(
+ Iterable<FantasySubPackage> subPackages,
+ Iterable<FantasySubPackage> subPackagesLibOnly,
+ String sdkPath,
+ List<String> dartfixExec);
+
+ /// Rewrite the package_config.json and/or .packages for this package.
+ Future<void> rewritePackageConfigWith(FantasySubPackage subPackage);
}
/// Build a "fantasyland"-style repository structure suitable for applying
diff --git a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace_impl.dart b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace_impl.dart
index 0659bfd..a760781 100644
--- a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace_impl.dart
+++ b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace_impl.dart
@@ -2,6 +2,9 @@
// 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:convert';
+import 'dart:io';
+
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:nnbd_migration/src/fantasyland/fantasy_repo.dart';
@@ -10,7 +13,6 @@
import 'package:nnbd_migration/src/fantasyland/fantasy_workspace.dart';
import 'package:nnbd_migration/src/utilities/multi_future_tracker.dart';
import 'package:nnbd_migration/src/utilities/subprocess_launcher.dart';
-import 'package:package_config/packages_file.dart' as packages_file;
class FantasyWorkspaceError extends Error {
final String message;
@@ -32,10 +34,11 @@
SubprocessLauncher launcher,
Future<FantasyRepo> Function(FantasyRepoSettings, String, bool,
{FantasyRepoDependencies fantasyRepoDependencies})
- buildGitRepoFrom})
+ buildGitRepoFrom,
+ List<String> dartfixExec})
: resourceProvider =
resourceProvider ?? PhysicalResourceProvider.INSTANCE,
- launcher = launcher, // Pass through to FantasyRepoDependencies.
+ launcher = launcher ?? SubprocessLauncher('fantasy-workspace'),
buildGitRepoFrom = buildGitRepoFrom ?? FantasyRepo.buildGitRepoFrom;
}
@@ -68,9 +71,31 @@
_external.resourceProvider.pathContext
.join(workspaceRootPath, '.packages'));
- // TODO(jcollins-g): use package_config when pub package is updated, or
- // implement writing for the analyzer version ourselves.
- File get packageConfigJson => throw UnimplementedError();
+ File _packageConfigJson;
+ File get packageConfigJson => _packageConfigJson ??=
+ _external.resourceProvider.getFile(_external.resourceProvider.pathContext
+ .join(workspaceRootPath, '.dart_tool', 'package_config.json'));
+
+ File _migratedPackagesFile;
+ // TODO(jcollins-g): Remove this hack once a good way of determining whether
+ // a package is already migrated is available. (and our front-end implements it)
+ File get migratedPackagesFile => _migratedPackagesFile ??=
+ _external.resourceProvider.getFile(_external.resourceProvider.pathContext
+ .join(workspaceRootPath, '.steamroller_already_migrated'));
+
+ Set<String> _migratedPackagePaths;
+ Set<String> get migratedPackagePaths =>
+ _migratedPackagePaths ??= migratedPackagesFile.exists
+ ? migratedPackagesFile.readAsStringSync().split('\n').toSet()
+ : Set();
+
+ /// Call this after migration has completed successfully for [packages].
+ void packagesMigrated(Iterable<FantasySubPackage> packages) {
+ // TODO(jcollins-g): Remove this hack once a reliable way of determining whether
+ // a package is already migrated is available (and our front-end implements it)
+ _migratedPackagePaths.addAll(packages.map((p) => p.packageRoot.path));
+ migratedPackagesFile.writeAsStringSync(_migratedPackagePaths.join('\n'));
+ }
/// The returned future should complete only when this package's repository
/// is:
@@ -99,6 +124,73 @@
return fantasySubPackage;
}
+ @override
+ Future<bool> forceMigratePackages(
+ Iterable<FantasySubPackage> subPackages,
+ Iterable<FantasySubPackage> subPackagesLibOnly,
+ String sdkPath,
+ List<String> dartfixExec) async {
+ String dartfix_bin = dartfixExec.first;
+ List<String> args = dartfixExec.sublist(1);
+ args.addAll(
+ ['upgrade', 'sdk', '--no-preview', '--force', '--sdk=$sdkPath']);
+ bool migrationNecessary = false;
+ // TODO(jcollins-g): consider using the package graph to break up and
+ // parallelize dartfix runs
+ for (FantasySubPackage subPackage in subPackages) {
+ if (!migratedPackagePaths.contains(subPackage.packageRoot.path)) {
+ args.add(subPackage.packageRoot.path);
+ migrationNecessary = true;
+ }
+ }
+ for (FantasySubPackage subPackage in subPackagesLibOnly) {
+ if (!migratedPackagePaths.contains(subPackage.packageRoot.path)) {
+ args.add(subPackage.packageRoot.getChildAssumingFolder('lib').path);
+ migrationNecessary = true;
+ }
+ }
+ if (migrationNecessary) {
+ await _external.launcher
+ .runStreamed(dartfix_bin, args, instance: 'dartfix');
+ }
+ // Update the file once we're sure it has completed successfully.
+ packagesMigrated(subPackages);
+ packagesMigrated(subPackagesLibOnly);
+ return migrationNecessary;
+ }
+
+ @override
+ Future<void> analyzePackages(
+ Iterable<FantasySubPackage> subPackages,
+ Iterable<FantasySubPackage> subPackagesLibOnly,
+ String sdkPath,
+ List<String> dartanalyzerExec) async {
+ var analyzers = <Future>[];
+ String dartanalyzer_bin = dartanalyzerExec.first;
+ List<String> baseArgs = dartanalyzerExec.sublist(1);
+ baseArgs
+ .addAll(['--enable-experiment=non-nullable', '--dart-sdk=$sdkPath']);
+
+ Future<void> _spawn(
+ FantasySubPackage subPackage, List<String> allArgs) async {
+ return _external.launcher.runStreamed(dartanalyzer_bin, allArgs,
+ workingDirectory: subPackage.packageRoot.path,
+ instance: subPackage.name,
+ allowNonzeroExit: true);
+ }
+
+ for (FantasySubPackage subPackage in subPackages) {
+ List<String> allArgs = baseArgs.followedBy(['.']).toList();
+ analyzers.add(_spawn(subPackage, allArgs));
+ }
+
+ for (FantasySubPackage subPackage in subPackagesLibOnly) {
+ List<String> allArgs = baseArgs.followedBy(['lib']).toList();
+ analyzers.add(_spawn(subPackage, allArgs));
+ }
+ return Future.wait(analyzers);
+ }
+
static const _repoSubDir = '_repo';
/// Add one repository to the workspace.
@@ -121,6 +213,7 @@
return _repos[repoSettings.name];
}
+ @override
Future<void> rewritePackageConfigWith(FantasySubPackage subPackage) async {
return _packageConfigLock.runFutureFromClosure(
() async => _rewritePackageConfigWith(subPackage));
@@ -129,20 +222,55 @@
// Only one [_rewritePackageConfigWith] should be running at a time
// per workspace.
Future<void> _rewritePackageConfigWith(FantasySubPackage subPackage) async {
- Map<String, Uri> uriMap = {};
if (packagesFile.exists) {
- var uri = packagesFile.toUri();
- var content = packagesFile.readAsBytesSync();
- uriMap = packages_file.parse(content, uri);
+ // A rogue .packages file can signal to tools the absence of a
+ // [FantasySubPackage.languageVersion]. This paradoxically will mean
+ // to our tools that all language features, including NNBD, are enabled,
+ // which is not necessarily what we want. It is safer to delete this to
+ // prevent it from being used accidentally.
+ packagesFile.delete();
}
- uriMap[subPackage.name] =
- subPackage.packageRoot.getChildAssumingFolder('lib').toUri();
- StringBuffer buffer = StringBuffer();
- packages_file.write(buffer, uriMap);
- // TODO(jcollins-g): Consider accumulating rewrites rather than doing
- // this once per package.
- // TODO(jcollins-g): support package_config.json.
- return packagesFile.writeAsStringSync(buffer.toString());
+ Map<String, Object> packageConfigMap = {
+ "configVersion": 2,
+ "packages": <Map<String, String>>[],
+ };
+ if (packageConfigJson.exists) {
+ packageConfigMap = jsonDecode(packageConfigJson.readAsStringSync())
+ as Map<String, Object>;
+ }
+
+ packageConfigMap['generated'] = DateTime.now().toIso8601String();
+ packageConfigMap['generator'] = 'fantasyland';
+ // TODO(jcollins-g): analyzer seems to depend on this and ignore some versions
+ packageConfigMap['generatorVersion'] = "2.8.0-dev.9999.0";
+
+ var packages = packageConfigMap['packages'] as List;
+ var rewriteMe =
+ packages.firstWhere((p) => p['name'] == subPackage.name, orElse: () {
+ Map<String, String> newMap = {};
+ packages.add(newMap);
+ return newMap;
+ });
+
+ rewriteMe['name'] = subPackage.name;
+ String subPackageRootUriString =
+ subPackage.packageRoot.toUri().normalizePath().toString();
+ if (subPackageRootUriString.endsWith('/')) {
+ subPackageRootUriString = subPackageRootUriString.substring(
+ 0, subPackageRootUriString.length - 1);
+ }
+ rewriteMe['rootUri'] = subPackageRootUriString;
+ // TODO(jcollins-g): is this ever anything different?
+ rewriteMe['packageUri'] = 'lib/';
+ if (subPackage.languageVersion != null) {
+ rewriteMe['languageVersion'] = subPackage.languageVersion;
+ } else {
+ rewriteMe.remove('languageVersion');
+ }
+
+ packageConfigJson.parent.create();
+ JsonEncoder encoder = new JsonEncoder.withIndent(" ");
+ packageConfigJson.writeAsStringSync(encoder.convert(packageConfigMap));
}
}
diff --git a/pkg/nnbd_migration/lib/src/node_builder.dart b/pkg/nnbd_migration/lib/src/node_builder.dart
index 23624f6..81abf14 100644
--- a/pkg/nnbd_migration/lib/src/node_builder.dart
+++ b/pkg/nnbd_migration/lib/src/node_builder.dart
@@ -145,6 +145,7 @@
@override
DecoratedType visitCompilationUnit(CompilationUnit node) {
_graph.migrating(node.declaredElement.library.source);
+ _graph.migrating(node.declaredElement.source);
return super.visitCompilationUnit(node);
}
@@ -429,7 +430,8 @@
parent is ImplementsClause ||
parent is WithClause ||
parent is OnClause ||
- parent is ClassTypeAlias) {
+ parent is ClassTypeAlias ||
+ parent is GenericTypeAlias) {
nullabilityNode = _graph.never;
} else {
nullabilityNode = NullabilityNode.forTypeAnnotation(node.end);
diff --git a/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart b/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart
index e272eab..5de2365 100644
--- a/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart
+++ b/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart
@@ -126,7 +126,8 @@
void prepareInput(ResolvedUnitResult result) {
if (_variables == null) {
_variables = Variables(_graph, result.typeProvider,
- instrumentation: _instrumentation);
+ instrumentation: _instrumentation,
+ postmortemFileWriter: _postmortemFileWriter);
_decoratedClassHierarchy = DecoratedClassHierarchy(_variables, _graph);
}
var unit = result.unit;
diff --git a/pkg/nnbd_migration/lib/src/nullability_node.dart b/pkg/nnbd_migration/lib/src/nullability_node.dart
index bd109c6..76456fe 100644
--- a/pkg/nnbd_migration/lib/src/nullability_node.dart
+++ b/pkg/nnbd_migration/lib/src/nullability_node.dart
@@ -1112,9 +1112,10 @@
if (edge.isUnion && edge.destinationNode == _never) {
// If a node is unioned with "never" then it's considered to have
// direct non-null intent.
- node._nonNullIntent = NonNullIntent.direct;
+ _setNonNullIntent(node, NonNullIntent.direct, causeEdge: edge);
} else {
- node._nonNullIntent = oldNonNullIntent.addIndirect();
+ _setNonNullIntent(node, oldNonNullIntent.addIndirect(),
+ causeEdge: edge);
}
if (!oldNonNullIntent.isPresent) {
// We did not previously have non-null intent, so we need to
@@ -1131,7 +1132,8 @@
continue;
}
var oldNonNullIntent = node._nonNullIntent;
- node._nonNullIntent = oldNonNullIntent.addIndirect();
+ _setNonNullIntent(node, oldNonNullIntent.addIndirect(),
+ causeNode: pendingNode);
if (!oldNonNullIntent.isPresent) {
// We did not previously have non-null intent, so we need to
// propagate.
@@ -1205,6 +1207,15 @@
}
}
+ void _setNonNullIntent(
+ NullabilityNodeMutable node, NonNullIntent newNonNullIntent,
+ {NullabilityNode causeNode, NullabilityEdge causeEdge}) {
+ node._nonNullIntent = newNonNullIntent;
+ _postmortemFileWriter?.upstreamPropagationSteps?.add(
+ UpstreamPropagationStep(node, newNonNullIntent,
+ causeNode: causeNode, causeEdge: causeEdge));
+ }
+
Nullability _setNullable(NullabilityNodeMutable node, Nullability newState,
{NullabilityNode causeNode, NullabilityEdge causeEdge}) {
var oldState = node._nullability;
diff --git a/pkg/nnbd_migration/lib/src/postmortem_file.dart b/pkg/nnbd_migration/lib/src/postmortem_file.dart
index 9b9f95cc7..2b5b32b 100644
--- a/pkg/nnbd_migration/lib/src/postmortem_file.dart
+++ b/pkg/nnbd_migration/lib/src/postmortem_file.dart
@@ -6,15 +6,142 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:nnbd_migration/nullability_state.dart';
+import 'package:nnbd_migration/src/decorated_type.dart';
import 'package:nnbd_migration/src/nullability_node.dart';
+import 'package:nnbd_migration/src/variables.dart';
/// Representation of a single step in the downstream propagation algorithm.
-class DownstreamPropagationStep {
+class DownstreamPropagationStep extends PropagationStep<Nullability> {
+ DownstreamPropagationStep(NullabilityNode node, Nullability newState,
+ {NullabilityNode causeNode, NullabilityEdge causeEdge})
+ : super(node, newState, causeNode: causeNode, causeEdge: causeEdge);
+
+ DownstreamPropagationStep.fromJson(
+ dynamic json, NullabilityGraphDeserializer deserializer)
+ : super.fromJson(
+ json, deserializer, (json) => Nullability.fromJson(json));
+
+ Map<String, Object> toJson(NullabilityGraphSerializer serializer) =>
+ toJsonInternal(serializer, (state) => state.toJson());
+}
+
+/// Helper class for reading a postmortem file.
+class PostmortemFileReader {
+ final NullabilityGraphDeserializer deserializer;
+
+ final NullabilityGraph graph;
+
+ final List<UpstreamPropagationStep> upstreamPropagationSteps;
+
+ final List<DownstreamPropagationStep> downstreamPropagationSteps;
+
+ final Map<String, Map<int, Map<String, NullabilityNode>>> fileDecorations;
+
+ factory PostmortemFileReader.read(File file) {
+ var json = convert.json.decode(file.readAsStringSync());
+ var deserializer = NullabilityGraphDeserializer(
+ json['graph']['nodes'] as List<dynamic>,
+ json['graph']['edges'] as List<dynamic>);
+ return PostmortemFileReader._(json, deserializer);
+ }
+
+ PostmortemFileReader._(dynamic json, this.deserializer)
+ : graph = NullabilityGraph.fromJson(json['graph'], deserializer),
+ upstreamPropagationSteps = [
+ for (var step in json['upstreamPropagationSteps'])
+ UpstreamPropagationStep.fromJson(step, deserializer)
+ ],
+ downstreamPropagationSteps = [
+ for (var step in json['downstreamPropagationSteps'])
+ DownstreamPropagationStep.fromJson(step, deserializer)
+ ],
+ fileDecorations = {
+ for (var fileEntry
+ in (json['fileDecorations'] as Map<String, dynamic>).entries)
+ fileEntry.key: {
+ for (var decorationEntry
+ in (fileEntry.value as Map<String, dynamic>).entries)
+ int.parse(decorationEntry.key): {
+ for (var roleEntry
+ in (decorationEntry.value as Map<String, dynamic>)
+ .entries)
+ roleEntry.key:
+ deserializer.nodeForId(roleEntry.value as int)
+ }
+ }
+ };
+
+ NodeToIdMapper get idMapper => deserializer;
+
+ void findDecorationsByNode(NullabilityNode node,
+ void Function(String path, OffsetEndPair span, String role) callback) {
+ for (var fileEntry in fileDecorations.entries) {
+ for (var decorationEntry in fileEntry.value.entries) {
+ for (var roleEntry in decorationEntry.value.entries) {
+ if (identical(roleEntry.value, node)) {
+ callback(
+ fileEntry.key,
+ Variables.spanForUniqueIdentifier(decorationEntry.key),
+ roleEntry.key);
+ }
+ }
+ }
+ }
+ }
+}
+
+/// Helper class for writing to a postmortem file.
+class PostmortemFileWriter {
+ final File file;
+
+ NullabilityGraph graph;
+
+ final List<DownstreamPropagationStep> downstreamPropagationSteps = [];
+
+ final List<UpstreamPropagationStep> upstreamPropagationSteps = [];
+
+ final Map<String, Map<int, Map<String, NullabilityNode>>> _fileDecorations =
+ {};
+
+ PostmortemFileWriter(this.file);
+
+ void storeFileDecorations(
+ String path, int location, DecoratedType decoratedType) {
+ var roles = <String, NullabilityNode>{};
+ decoratedType.recordRoles(roles);
+ (_fileDecorations[path] ??= {})[location] = roles;
+ }
+
+ void write() {
+ var json = <String, Object>{};
+ var serializer = NullabilityGraphSerializer();
+ json['graph'] = graph.toJson(serializer);
+ json['upstreamPropagationSteps'] = [
+ for (var step in upstreamPropagationSteps) step.toJson(serializer)
+ ];
+ json['downstreamPropagationSteps'] = [
+ for (var step in downstreamPropagationSteps) step.toJson(serializer)
+ ];
+ json['fileDecorations'] = {
+ for (var fileEntry in _fileDecorations.entries)
+ fileEntry.key: {
+ for (var decorationEntry in (fileEntry.value).entries)
+ decorationEntry.key.toString(): {
+ for (var roleEntry in (decorationEntry.value).entries)
+ roleEntry.key: serializer.idForNode(roleEntry.value)
+ }
+ }
+ };
+ file.writeAsStringSync(convert.json.encode(json));
+ }
+}
+
+class PropagationStep<State> {
/// The node whose state was changed.
final NullabilityNode node;
/// The new state.
- final Nullability newState;
+ final State newState;
/// The cause of the state change (if the cause was a node), otherwise `null`.
final NullabilityNode causeNode;
@@ -23,13 +150,14 @@
/// `null`.
final NullabilityEdge causeEdge;
- DownstreamPropagationStep(this.node, this.newState,
- {this.causeNode, this.causeEdge});
+ PropagationStep(this.node, this.newState, {this.causeNode, this.causeEdge});
- DownstreamPropagationStep.fromJson(
- dynamic json, NullabilityGraphDeserializer deserializer)
+ PropagationStep.fromJson(
+ dynamic json,
+ NullabilityGraphDeserializer deserializer,
+ State Function(dynamic) deserializeState)
: node = deserializer.nodeForId(json['node'] as int),
- newState = Nullability.fromJson(json['newState']),
+ newState = deserializeState(json['newState']),
causeNode = json['causeNode'] == null
? null
: deserializer.nodeForId(json['causeNode'] as int),
@@ -37,10 +165,11 @@
? null
: deserializer.edgeForId(json['causeEdge'] as int);
- Map<String, Object> toJson(NullabilityGraphSerializer serializer) {
+ Map<String, Object> toJsonInternal(NullabilityGraphSerializer serializer,
+ String Function(State) serializeState) {
var json = <String, Object>{};
json['node'] = serializer.idForNode(node);
- json['newState'] = newState.toJson();
+ json['newState'] = serializeState(newState);
if (causeNode != null) {
json['causeNode'] = serializer.idForNode(causeNode);
}
@@ -68,49 +197,17 @@
}
}
-/// Helper class for reading a postmortem file.
-class PostmortemFileReader {
- final NullabilityGraphDeserializer deserializer;
+/// Representation of a single step in the upstream propagation algorithm.
+class UpstreamPropagationStep extends PropagationStep<NonNullIntent> {
+ UpstreamPropagationStep(NullabilityNode node, NonNullIntent newState,
+ {NullabilityNode causeNode, NullabilityEdge causeEdge})
+ : super(node, newState, causeNode: causeNode, causeEdge: causeEdge);
- final NullabilityGraph graph;
+ UpstreamPropagationStep.fromJson(
+ dynamic json, NullabilityGraphDeserializer deserializer)
+ : super.fromJson(
+ json, deserializer, (json) => NonNullIntent.fromJson(json));
- final List<DownstreamPropagationStep> downstreamPropagationSteps;
-
- factory PostmortemFileReader.read(File file) {
- var json = convert.json.decode(file.readAsStringSync());
- var deserializer = NullabilityGraphDeserializer(
- json['graph']['nodes'] as List<dynamic>,
- json['graph']['edges'] as List<dynamic>);
- return PostmortemFileReader._(json, deserializer);
- }
-
- PostmortemFileReader._(dynamic json, this.deserializer)
- : graph = NullabilityGraph.fromJson(json['graph'], deserializer),
- downstreamPropagationSteps = [
- for (var step in json['downstreamPropagationSteps'])
- DownstreamPropagationStep.fromJson(step, deserializer)
- ];
-
- NodeToIdMapper get idMapper => deserializer;
-}
-
-/// Helper class for writing to a postmortem file.
-class PostmortemFileWriter {
- final File file;
-
- NullabilityGraph graph;
-
- final List<DownstreamPropagationStep> downstreamPropagationSteps = [];
-
- PostmortemFileWriter(this.file);
-
- void write() {
- var json = <String, Object>{};
- var serializer = NullabilityGraphSerializer();
- json['graph'] = graph.toJson(serializer);
- json['downstreamPropagationSteps'] = [
- for (var step in downstreamPropagationSteps) step.toJson(serializer)
- ];
- file.writeAsStringSync(convert.json.encode(json));
- }
+ Map<String, Object> toJson(NullabilityGraphSerializer serializer) =>
+ toJsonInternal(serializer, (state) => state.toJson());
}
diff --git a/pkg/nnbd_migration/lib/src/utilities/multi_future_tracker.dart b/pkg/nnbd_migration/lib/src/utilities/multi_future_tracker.dart
index 9f3a13d..e8fdb4d 100644
--- a/pkg/nnbd_migration/lib/src/utilities/multi_future_tracker.dart
+++ b/pkg/nnbd_migration/lib/src/utilities/multi_future_tracker.dart
@@ -23,7 +23,7 @@
if (retries > 0) {
return await Future.sync(closure).catchError(handleError);
} else {
- return await Future.sync(closure);
+ return closure();
}
}
diff --git a/pkg/nnbd_migration/lib/src/utilities/subprocess_launcher.dart b/pkg/nnbd_migration/lib/src/utilities/subprocess_launcher.dart
index 8bd599a..8147996 100644
--- a/pkg/nnbd_migration/lib/src/utilities/subprocess_launcher.dart
+++ b/pkg/nnbd_migration/lib/src/utilities/subprocess_launcher.dart
@@ -20,7 +20,7 @@
/// Maximum number of parallel subprocesses. Use this to to avoid overloading
/// your CPU.
final MultiFutureTracker maxParallel =
- MultiFutureTracker(Platform.numberOfProcessors * 2);
+ MultiFutureTracker(Platform.numberOfProcessors);
/// Route all executions of pub through this [MultiFutureTracker] to avoid
/// parallel executions of the pub command.
@@ -36,8 +36,6 @@
final String context;
final Map<String, String> environmentDefaults;
- String get prefix => context.isNotEmpty ? '$context: ' : '';
-
/// From flutter:dev/tools/dartdoc.dart, modified.
static Future<void> _printStream(Stream<List<int>> stream, Stdout output,
{String prefix = '', Iterable<String> Function(String line) filter}) {
@@ -63,18 +61,26 @@
///
/// This essentially implements a 'make -j N' limit for all subcommands.
Future<Iterable<Map>> runStreamed(String executable, List<String> arguments,
+ // TODO(jcollins-g): Fix primitive obsession: consolidate parameters into
+ // another object.
{String workingDirectory,
Map<String, String> environment,
bool includeParentEnvironment = true,
void Function(String) perLine,
- int retries = 0}) async {
+ int retries = 0,
+ String instance,
+ bool allowNonzeroExit = false}) async {
+ // TODO(jcollins-g): The closure wrapping we've done has made it impossible
+ // to catch exceptions when calling runStreamed. Fix this.
return maxParallel.runFutureFromClosure(() async {
return retryClosure(
() async => await runStreamedImmediate(executable, arguments,
workingDirectory: workingDirectory,
environment: environment,
includeParentEnvironment: includeParentEnvironment,
- perLine: perLine),
+ perLine: perLine,
+ instance: instance,
+ allowNonzeroExit: allowNonzeroExit),
retries: retries);
});
}
@@ -94,7 +100,17 @@
{String workingDirectory,
Map<String, String> environment,
bool includeParentEnvironment = true,
- void Function(String) perLine}) async {
+ void Function(String) perLine,
+ // A tag added to [context] to construct the line prefix.
+ // Use this to indicate the process or processes with the tag
+ // share something in common, like a hostname, a package, or a
+ // multi-step procedure.
+ String instance,
+ bool allowNonzeroExit = false}) async {
+ String prefix = context.isNotEmpty
+ ? '$context${instance != null ? "-$instance" : ""}: '
+ : '';
+
environment ??= {};
environment.addAll(environmentDefaults);
List<Map> jsonObjects;
@@ -177,7 +193,7 @@
await Future.wait([stderrFuture, stdoutFuture, process.exitCode]);
int exitCode = await process.exitCode;
- if (exitCode != 0) {
+ if (exitCode != 0 && !allowNonzeroExit) {
throw ProcessException(executable, arguments,
"SubprocessLauncher got non-zero exitCode: $exitCode", exitCode);
}
diff --git a/pkg/nnbd_migration/lib/src/variables.dart b/pkg/nnbd_migration/lib/src/variables.dart
index f984f17..3782d3b 100644
--- a/pkg/nnbd_migration/lib/src/variables.dart
+++ b/pkg/nnbd_migration/lib/src/variables.dart
@@ -25,6 +25,7 @@
import 'package:nnbd_migration/src/fix_builder.dart';
import 'package:nnbd_migration/src/node_builder.dart';
import 'package:nnbd_migration/src/nullability_node.dart';
+import 'package:nnbd_migration/src/postmortem_file.dart';
import 'package:nnbd_migration/src/potential_modification.dart';
/// Data structure used by [Variables.spanForUniqueIdentifier] to return an
@@ -35,6 +36,9 @@
final int end;
OffsetEndPair(this.offset, this.end);
+
+ @override
+ String toString() => '$offset-$end';
}
class Variables implements VariableRecorder, VariableRepository {
@@ -61,7 +65,10 @@
final NullabilityMigrationInstrumentation /*?*/ instrumentation;
- Variables(this._graph, this._typeProvider, {this.instrumentation})
+ final PostmortemFileWriter postmortemFileWriter;
+
+ Variables(this._graph, this._typeProvider,
+ {this.instrumentation, this.postmortemFileWriter})
: _alreadyMigratedCodeDecorator =
AlreadyMigratedCodeDecorator(_graph, _typeProvider);
@@ -187,8 +194,9 @@
instrumentation?.explicitTypeNullability(source, node, type.node);
if (potentialModification != null)
_addPotentialModification(source, potentialModification);
- (_decoratedTypeAnnotations[source] ??=
- {})[uniqueIdentifierForSpan(node.offset, node.end)] = type;
+ var id = uniqueIdentifierForSpan(node.offset, node.end);
+ (_decoratedTypeAnnotations[source] ??= {})[id] = type;
+ postmortemFileWriter?.storeFileDecorations(source.fullName, id, type);
}
@override
@@ -352,7 +360,6 @@
/// Inverts the logic of [uniqueIdentifierForSpan], producing an (offset, end)
/// pair.
- @visibleForTesting
static OffsetEndPair spanForUniqueIdentifier(int span) {
// The formula for uniqueIdentifierForSpan was:
// span = end*(end + 1) / 2 + offset
diff --git a/pkg/nnbd_migration/test/api_test.dart b/pkg/nnbd_migration/test/api_test.dart
index e995a92..30d4a8e 100644
--- a/pkg/nnbd_migration/test/api_test.dart
+++ b/pkg/nnbd_migration/test/api_test.dart
@@ -52,15 +52,27 @@
var migration = NullabilityMigration(listener,
permissive: _usePermissiveMode, removeViaComments: removeViaComments);
for (var path in input.keys) {
- migration.prepareInput(await session.getResolvedUnit(path));
+ if (!(await session.getFile(path)).isPart) {
+ for (var unit in (await session.getResolvedLibrary(path)).units) {
+ migration.prepareInput(unit);
+ }
+ }
}
_betweenStages();
for (var path in input.keys) {
- migration.processInput(await session.getResolvedUnit(path));
+ if (!(await session.getFile(path)).isPart) {
+ for (var unit in (await session.getResolvedLibrary(path)).units) {
+ migration.processInput(unit);
+ }
+ }
}
_betweenStages();
for (var path in input.keys) {
- migration.finalizeInput(await session.getResolvedUnit(path));
+ if (!(await session.getFile(path)).isPart) {
+ for (var unit in (await session.getResolvedLibrary(path)).units) {
+ migration.finalizeInput(unit);
+ }
+ }
}
migration.finish();
var sourceEdits = <String, List<SourceEdit>>{};
@@ -1619,7 +1631,7 @@
class C<T> {
T Function(String)? f;
}
-int Function(String) f1; // should not have a nullable return
+int Function(String)? f1; // should not have a nullable return
void main() {
C<int?> c;
c.f = f1;
@@ -1643,11 +1655,11 @@
''';
var expected = '''
typedef F<T> = int Function(T);
-F<String?> f1;
+F<String?>? f1;
void main() {
- f1(null); // induce exact nullability
- int Function(String) f2 = f1; // shouldn't have a nullable arg
+ f1!(null); // induce exact nullability
+ int Function(String)? f2 = f1; // shouldn't have a nullable arg
}
''';
await _checkSingleFileChanges(content, expected);
@@ -1666,9 +1678,9 @@
''';
var expected = '''
typedef F<T> = T Function(String);
-int Function(String) f1; // should not have a nullable return
+int Function(String)? f1; // should not have a nullable return
void main() {
- F<int?> f2 = f1;
+ F<int?>? f2 = f1;
f2 = (_) => null; // exact nullability induced here
}
''';
@@ -2948,6 +2960,34 @@
{path2: file2, path1: file1}, {path1: expected1, path2: expected2});
}
+ Future<void> test_libraryWithParts_add_questions() async {
+ var root = '/home/test/lib';
+ var path1 = convertPath('$root/lib.dart');
+ var file1 = '''
+part 'src/foo/part.dart';
+
+int f() => null;
+''';
+ var expected1 = '''
+part 'src/foo/part.dart';
+
+int? f() => null;
+''';
+ var path2 = convertPath('$root/src/foo/part.dart');
+ var file2 = '''
+part of '../../lib.dart';
+
+int g() => null;
+''';
+ var expected2 = '''
+part of '../../lib.dart';
+
+int? g() => null;
+''';
+ await _checkMultipleFileChanges(
+ {path2: file2, path1: file1}, {path1: expected1, path2: expected2});
+ }
+
Future<void> test_literals_maintain_nullability() async {
// See #40590. Without exact nullability, this would migrate to
// `List<int?> list = <int>[1, 2]`. While the function of exact nullability
@@ -3700,6 +3740,24 @@
await _checkSingleFileChanges(content, expected);
}
+ Future<void> test_nullable_use_of_typedef() async {
+ var content = '''
+typedef F<T> = int Function(T);
+F<String> f = null;
+void main() {
+ f('foo');
+}
+''';
+ var expected = '''
+typedef F<T> = int Function(T);
+F<String>? f = null;
+void main() {
+ f!('foo');
+}
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
Future<void> test_operator_eq_with_inferred_parameter_type() async {
var content = '''
class C {
@@ -4327,6 +4385,31 @@
await _checkSingleFileChanges(content, expected);
}
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/40728')
+ Future<void> test_soft_edge_for_assigned_variable() async {
+ var content = '''
+void f(int i) {
+ print(i + 1);
+ i = null;
+ print(i);
+}
+main() {
+ f(0);
+}
+''';
+ var expected = '''
+void f(int? i) {
+ print(i! + 1);
+ i = null;
+ print(i);
+}
+main() {
+ f(0);
+}
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
Future<void> test_tearoff_parameter_matching_named() async {
var content = '''
void f(int x, void Function({int x}) callback) {
@@ -5174,6 +5257,62 @@
await _checkSingleFileChanges(content, expected);
}
+ Future<void> test_uninitialized_instance_field_is_nullable() async {
+ var content = '''
+class C {
+ int i;
+ f() {
+ print(i == null);
+ }
+}
+''';
+ var expected = '''
+class C {
+ int? i;
+ f() {
+ print(i == null);
+ }
+}
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
+ Future<void> test_uninitialized_static_field_is_nullable() async {
+ var content = '''
+class C {
+ static int i;
+ f() {
+ print(i == null);
+ }
+}
+''';
+ var expected = '''
+class C {
+ static int? i;
+ f() {
+ print(i == null);
+ }
+}
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
+ Future<void> test_uninitialized_toplevel_var_is_nullable() async {
+ var content = '''
+int i;
+f() {
+ print(i == null);
+}
+''';
+ var expected = '''
+int? i;
+f() {
+ print(i == null);
+}
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
Future<void> test_unnecessary_cast_remove() async {
var content = '''
_f(Object x) {
diff --git a/pkg/nnbd_migration/test/edge_builder_test.dart b/pkg/nnbd_migration/test/edge_builder_test.dart
index ef99ab0..1ca217b 100644
--- a/pkg/nnbd_migration/test/edge_builder_test.dart
+++ b/pkg/nnbd_migration/test/edge_builder_test.dart
@@ -2657,6 +2657,18 @@
// metadata was visited.
}
+ Future<void> test_field_initialized_in_constructor() async {
+ await analyze('''
+class C {
+ int i;
+ C() : i = 0;
+}
+''');
+ // There is no edge from always to the type of i, because it is initialized
+ // in the constructor.
+ assertNoEdge(always, decoratedTypeAnnotation('int').node);
+ }
+
Future<void> test_field_metadata() async {
await analyze('''
class A {
@@ -2671,6 +2683,15 @@
// metadata was visited.
}
+ Future<void> test_field_static_implicitInitializer() async {
+ await analyze('''
+class C {
+ static int i;
+}
+''');
+ assertEdge(always, decoratedTypeAnnotation('int').node, hard: false);
+ }
+
Future<void> test_field_type_inferred() async {
await analyze('''
int f() => 1;
@@ -4054,6 +4075,17 @@
assertEdge(decoratedTypeAnnotation('int').node, xType.node, hard: false);
}
+ Future<void> test_localVariable_unused() async {
+ await analyze('''
+main() {
+ int i;
+}
+''');
+ // There is no edge from always to the type of `i`, because `i` is never
+ // used, so it's ok that it's not initialized.
+ assertNoEdge(always, decoratedTypeAnnotation('int').node);
+ }
+
Future<void> test_method_parameterType_inferred() async {
await analyze('''
class B {
@@ -6759,6 +6791,11 @@
assertEdge(inSet(alwaysPlus), setXType.node, hard: false);
}
+ Future<void> test_topLevelVar_implicitInitializer() async {
+ await analyze('int i;');
+ assertEdge(always, decoratedTypeAnnotation('int').node, hard: false);
+ }
+
Future<void> test_topLevelVar_metadata() async {
await analyze('''
class A {
@@ -6910,6 +6947,16 @@
hard: true);
}
+ Future<void> test_typedef_rhs_not_linked_to_usage() async {
+ await analyze('''
+typedef F = void Function();
+F f;
+''');
+ var rhs = decoratedGenericFunctionTypeAnnotation('void Function()');
+ var usage = decoratedTypeAnnotation('F f');
+ assertNoEdge(rhs.node, usage.node);
+ }
+
Future<void> test_typeName_class() async {
await analyze('''
class C {}
diff --git a/pkg/nnbd_migration/test/fantasyland/fantasy_repo_test.dart b/pkg/nnbd_migration/test/fantasyland/fantasy_repo_test.dart
index 7a32dfb..3d9e580 100644
--- a/pkg/nnbd_migration/test/fantasyland/fantasy_repo_test.dart
+++ b/pkg/nnbd_migration/test/fantasyland/fantasy_repo_test.dart
@@ -192,7 +192,8 @@
'master',
'git@github.com:dart-lang/defaultCase.git'
],
- workingDirectory: repoPath));
+ workingDirectory: repoPath,
+ instance: 'defaultCase'));
verify(mockLauncher.runStreamed(
'git',
[
@@ -203,13 +204,14 @@
'master',
'https://github.com/dart-lang/defaultCase.git'
],
- workingDirectory: repoPath));
+ workingDirectory: repoPath,
+ instance: 'defaultCase'));
}
test_verifyWorkingDirectoryForGitConfig() async {
await _setUpNewClone('defaultCase');
verify(mockLauncher.runStreamed(
'git', ['config', 'core.sparsecheckout', 'true'],
- workingDirectory: repoPath));
+ workingDirectory: repoPath, instance: 'defaultCase'));
}
}
diff --git a/pkg/nnbd_migration/test/fantasyland/fantasy_sub_package_test.dart b/pkg/nnbd_migration/test/fantasyland/fantasy_sub_package_test.dart
index 1d348f0..aace8a5 100644
--- a/pkg/nnbd_migration/test/fantasyland/fantasy_sub_package_test.dart
+++ b/pkg/nnbd_migration/test/fantasyland/fantasy_sub_package_test.dart
@@ -90,6 +90,23 @@
join(repoRootPath, 'unreal_package_dir', 'analysis_options.yaml'));
}
+ test_removeSdkConstraintHack() async {
+ pubspecYaml.writeAsStringSync('''
+ name: unreal_package
+ version: 1.2.3
+ environment:
+ sdk: '>=2.2.0 <3.0.0'
+ ''');
+ expect(fantasySubPackage.languageVersion, equals('2.2'));
+ await fantasySubPackage.removeSdkConstraintHack();
+ expect(fantasySubPackage.languageVersion, isNull);
+ expect(pubspecYaml.readAsStringSync(), equals('''
+ name: unreal_package
+ version: 1.2.3
+ environment:
+ '''));
+ }
+
test_recognizeAllDependencies() async {
pubspecYaml.writeAsStringSync('''
name: unreal_package
diff --git a/pkg/nnbd_migration/test/fantasyland/fantasy_workspace_test.dart b/pkg/nnbd_migration/test/fantasyland/fantasy_workspace_test.dart
index 5fb3a9b..e60f7c5 100644
--- a/pkg/nnbd_migration/test/fantasyland/fantasy_workspace_test.dart
+++ b/pkg/nnbd_migration/test/fantasyland/fantasy_workspace_test.dart
@@ -22,6 +22,47 @@
setUp() async {
super.setUp();
}
+
+ test_fantasyWorkspaceAnalyze() async {
+ FantasyWorkspace testWorkspace =
+ await FantasyWorkspaceTopLevelDevDepsImpl.buildFor(
+ 'test_package',
+ ['extra_package_1', 'extra_package_2'],
+ convertPath('/fantasyland'),
+ true,
+ workspaceDependencies: workspaceDependencies);
+ await testWorkspace.analyzePackages(
+ testWorkspace.subPackages.values.where((p) => p.name == 'test_package'),
+ // We are forcing extra_package_1 to be treated as migrated with 'lib_only'
+ // for the purpose of testing. This would not be the case in normal
+ // steamroll_ecosystem.dart runs.
+ testWorkspace.subPackages.values
+ .where((p) => p.name == 'extra_package_1'),
+ convertPath('/path/to/a/sdk'),
+ ['dart', 'really_the_analyzer.dart']);
+ verify(mockLauncher.runStreamed(
+ 'dart',
+ [
+ 'really_the_analyzer.dart',
+ '--enable-experiment=non-nullable',
+ '--dart-sdk=${convertPath("/path/to/a/sdk")}',
+ '.'
+ ],
+ workingDirectory: convertPath('/fantasyland/_repo/test_package'),
+ instance: 'test_package',
+ allowNonzeroExit: true));
+ verify(mockLauncher.runStreamed(
+ 'dart',
+ [
+ 'really_the_analyzer.dart',
+ '--enable-experiment=non-nullable',
+ '--dart-sdk=${convertPath("/path/to/a/sdk")}',
+ 'lib'
+ ],
+ workingDirectory: convertPath('/fantasyland/_repo/extra_package_1'),
+ instance: 'extra_package_1',
+ allowNonzeroExit: true));
+ }
}
@reflectiveTest
@@ -53,7 +94,8 @@
'master',
'git@github.com:dart-lang/$n.git'
],
- workingDirectory: repoPath));
+ workingDirectory: repoPath,
+ instance: n));
}
}
}
diff --git a/pkg/nnbd_migration/test/fix_builder_test.dart b/pkg/nnbd_migration/test/fix_builder_test.dart
index 47a1a5e..4750c47 100644
--- a/pkg/nnbd_migration/test/fix_builder_test.dart
+++ b/pkg/nnbd_migration/test/fix_builder_test.dart
@@ -2253,6 +2253,7 @@
visitSubexpression(findNode.propertyAccess('c?.hashCode'), 'int?');
}
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/40475')
Future<void> test_propertyAccess_nullAware_object_tearoff() async {
await analyze('''
class _C {}
diff --git a/pkg/nnbd_migration/test/node_builder_test.dart b/pkg/nnbd_migration/test/node_builder_test.dart
index 1972fae..149cee4 100644
--- a/pkg/nnbd_migration/test/node_builder_test.dart
+++ b/pkg/nnbd_migration/test/node_builder_test.dart
@@ -1610,6 +1610,14 @@
isNot(same(typedefDecoratedType.positionalParameters[0].node)));
}
+ Future<void> test_typedef_rhs_nullability() async {
+ await analyze('''
+typedef F = void Function();
+''');
+ var decorated = decoratedGenericFunctionTypeAnnotation('void Function()');
+ expect(decorated.node, same(never));
+ }
+
Future<void> test_variableDeclaration_type_simple() async {
await analyze('''
main() {
diff --git a/pkg/nnbd_migration/tool/postmortem.dart b/pkg/nnbd_migration/tool/postmortem.dart
index 109a104..0d05416 100644
--- a/pkg/nnbd_migration/tool/postmortem.dart
+++ b/pkg/nnbd_migration/tool/postmortem.dart
@@ -7,7 +7,9 @@
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:args/args.dart';
import 'package:meta/meta.dart';
+import 'package:nnbd_migration/src/nullability_node.dart';
import 'package:nnbd_migration/src/postmortem_file.dart';
+import 'package:nnbd_migration/src/variables.dart';
main(List<String> args) {
ArgParser argParser = ArgParser();
@@ -25,6 +27,19 @@
Subcommand(name: 'help', help: 'Print usage info', argParser: ArgParser()),
Subcommand(
name: 'steps', help: 'Print propagation steps', argParser: ArgParser()),
+ Subcommand(
+ name: 'files', help: 'Print input file paths', argParser: ArgParser()),
+ Subcommand(
+ name: 'decorations',
+ suffix: '<path>',
+ help: 'Print decorations for a file',
+ argParser: ArgParser()),
+ Subcommand(
+ name: 'node',
+ suffix: '<id>',
+ help: 'Print details about a node',
+ argParser: ArgParser(),
+ )
];
for (var subcommand in subcommands) {
@@ -42,7 +57,8 @@
print(argParser.usage);
for (var subcommand in subcommands) {
print('');
- print('Subcommand ${subcommand.name}: ${subcommand.help}');
+ var suffix = subcommand.suffix == null ? '' : ' ${subcommand.suffix}';
+ print('Subcommand ${subcommand.name}$suffix: ${subcommand.help}');
print(subcommand.argParser.usage);
}
exit(0);
@@ -59,10 +75,64 @@
reader.graph.debugDump();
break;
case 'steps':
+ for (var step in reader.upstreamPropagationSteps) {
+ print(step.toString(idMapper: reader.idMapper));
+ }
for (var step in reader.downstreamPropagationSteps) {
print(step.toString(idMapper: reader.idMapper));
}
break;
+ case 'files':
+ for (var entry in reader.fileDecorations.keys) {
+ print(entry);
+ }
+ break;
+ case 'decorations':
+ var paths = command.rest;
+ if (paths.length != 1) {
+ print('Must specify exactly one path after "decorations"');
+ exit(1);
+ }
+ var path = paths[0];
+ var decorations = reader.fileDecorations[path];
+ if (decorations == null) {
+ print('Path not found: $path');
+ exit(1);
+ }
+ for (var decorationEntry in decorations.entries) {
+ for (var roleEntry in decorationEntry.value.entries) {
+ var span = Variables.spanForUniqueIdentifier(decorationEntry.key);
+ var nodeId = reader.idMapper.idForNode(roleEntry.value);
+ print('${span.offset}-${span.end}${roleEntry.key}: $nodeId');
+ }
+ }
+ break;
+ case 'node':
+ var nodes = command.rest;
+ if (nodes.length != 1) {
+ print('Must specify exactly one node id after "node"');
+ exit(1);
+ }
+ var id = int.parse(nodes[0]);
+ var node = reader.deserializer.nodeForId(id);
+ print('Node $id: $node');
+ print('Decorations:');
+ reader.findDecorationsByNode(node, (path, span, role) {
+ print(' $path:$span$role');
+ });
+ print('Upstream edges:');
+ for (var edge in node.upstreamEdges) {
+ var description =
+ (edge as NullabilityEdge).toString(idMapper: reader.idMapper);
+ print(' $description');
+ }
+ print('Downstream edges:');
+ for (var edge in node.downstreamEdges) {
+ var description =
+ (edge as NullabilityEdge).toString(idMapper: reader.idMapper);
+ print(' $description');
+ }
+ break;
default:
throw StateError('Unrecognized command: $command');
}
@@ -70,9 +140,13 @@
class Subcommand {
final String name;
+ final String suffix;
final String help;
final ArgParser argParser;
Subcommand(
- {@required this.name, @required this.help, @required this.argParser});
+ {@required this.name,
+ this.suffix,
+ @required this.help,
+ @required this.argParser});
}
diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart
index fd48df2..de8e90f2 100644
--- a/pkg/test_runner/lib/src/compiler_configuration.dart
+++ b/pkg/test_runner/lib/src/compiler_configuration.dart
@@ -1183,7 +1183,11 @@
var arguments = [
...testFile.sharedOptions,
..._configuration.sharedOptions,
- ..._experimentsArgument(_configuration, testFile)
+ ..._experimentsArgument(_configuration, testFile),
+ if (_configuration.configuration.nnbdMode == NnbdMode.strong) ...[
+ "--force-nnbd-checks",
+ "--nnbd-strong"
+ ]
];
for (var argument in args) {
if (argument == "--ignore-unrecognized-flags") continue;
diff --git a/pkg/test_runner/lib/src/options.dart b/pkg/test_runner/lib/src/options.dart
index 95f9217..eae5f49 100644
--- a/pkg/test_runner/lib/src/options.dart
+++ b/pkg/test_runner/lib/src/options.dart
@@ -7,6 +7,7 @@
import 'package:smith/smith.dart';
import 'package:test_runner/src/test_configurations.dart';
+import 'package:path/path.dart' as path;
import 'configuration.dart';
import 'path.dart';
@@ -92,26 +93,27 @@
class OptionsParser {
static final List<_Option> _options = [
_Option('mode', 'Mode in which to run the tests.',
- abbr: 'm', values: ['all']..addAll(Mode.names)),
- _Option('sanitizer', 'Sanitizer in which to run the tests.',
- defaultsTo: Sanitizer.none.name,
- values: ['all']..addAll(Sanitizer.names)),
+ abbr: 'm', values: ['all', ...Mode.names]),
_Option(
'compiler',
'''How the Dart code should be compiled or statically processed.
+none: Do not compile the Dart code.
+dart2js: Compile to JavaScript using dart2js.
+dart2analyzer: Perform static analysis on Dart code using the analyzer.
+compare_analyzer_cfe: Compare analyzer and common front end representations.
+dartdevc: Compile to JavaScript using dart2js.
+dartdevk: Compile to JavaScript using dartdevk.
+app_jitk: Compile the Dart code into Kernel and then into an app
+ snapshot.
+dartk: Compile the Dart code into Kernel before running test.
+dartkb: Compile the Dart code into Kernel with bytecode before
+ running test.
+dartkp: Compile the Dart code into Kernel and then Kernel into
+ AOT snapshot before running the test.
+spec_parser: Parse Dart code using the specification parser.
-none: Do not compile the Dart code.
-precompiler: Compile into AOT snapshot before running the test.
-dart2js: Compile to JavaScript using dart2js.
-dart2analyzer: Perform static analysis on Dart code using the analyzer.
-compareAnalyzerCfe: Compare analyzer and common front end representations.
-app_jit: Compile the Dart code into an app snapshot.
-app_jitk: Compile the Dart code into Kernel and then into an app snapshot.
-dartk: Compile the Dart code into Kernel before running test.
-dartkb: Compile the Dart code into Kernel with bytecode before running test.
-dartkp: Compile the Dart code into Kernel and then Kernel into AOT
- snapshot before running the test.
-spec_parser: Parse Dart code using the specification parser.''',
+fasta: Compile using CFE for errors, but do not run.
+''',
abbr: 'c',
values: Compiler.names),
_Option(
@@ -148,7 +150,7 @@
arm, armv6, arm64,
simarm, simarmv6, simarm64, arm_x64''',
abbr: 'a',
- values: ['all']..addAll(Architecture.names),
+ values: ['all', ...Architecture.names],
defaultsTo: Architecture.x64.name,
hide: true),
_Option('system', 'The operating system to run tests on.',
@@ -156,6 +158,8 @@
values: System.names,
defaultsTo: Platform.operatingSystem,
hide: true),
+ _Option('sanitizer', 'Sanitizer in which to run the tests.',
+ defaultsTo: Sanitizer.none.name, values: ['all', ...Sanitizer.names]),
_Option(
'named_configuration',
'''The named test configuration that supplies the values for all
@@ -674,16 +678,14 @@
}
var runtimeNames = data["runtime"] as String;
- var runtimes = <Runtime>[];
- if (runtimeNames != null) {
- runtimes.addAll(runtimeNames.split(",").map(Runtime.find));
- }
+ var runtimes = [
+ if (runtimeNames != null) ...runtimeNames.split(",").map(Runtime.find)
+ ];
var compilerNames = data["compiler"] as String;
- var compilers = <Compiler>[];
- if (compilerNames != null) {
- compilers.addAll(compilerNames.split(",").map(Compiler.find));
- }
+ var compilers = [
+ if (compilerNames != null) ...compilerNames.split(",").map(Compiler.find)
+ ];
// Pick default compilers or runtimes if only one or the other is provided.
if (runtimes.isEmpty) {
@@ -993,3 +995,23 @@
void _fail(String message) {
throw OptionParseException(message);
}
+
+// Returns a map of environment variables to be used with sanitizers.
+final Map<String, String> sanitizerEnvironmentVariables = (() {
+ final environment = <String, String>{};
+ final testMatrixFile = "tools/bots/test_matrix.json";
+ final config = json.decode(File(testMatrixFile).readAsStringSync());
+ config['sanitizer_options'].forEach((String key, dynamic value) {
+ environment[key] = value as String;
+ });
+ var symbolizerPath =
+ config['sanitizer_symbolizer'][Platform.operatingSystem] as String;
+ if (symbolizerPath != null) {
+ symbolizerPath = path.join(Directory.current.path, symbolizerPath);
+ environment['ASAN_SYMBOLIZER_PATH'] = symbolizerPath;
+ environment['MSAN_SYMBOLIZER_PATH'] = symbolizerPath;
+ environment['TSAN_SYMBOLIZER_PATH'] = symbolizerPath;
+ }
+
+ return environment;
+})();
diff --git a/pkg/test_runner/lib/src/test_case.dart b/pkg/test_runner/lib/src/test_case.dart
index c5e278a..264d73d 100644
--- a/pkg/test_runner/lib/src/test_case.dart
+++ b/pkg/test_runner/lib/src/test_case.dart
@@ -12,6 +12,7 @@
import 'command.dart';
import 'command_output.dart';
import 'configuration.dart';
+import 'options.dart';
import 'output_log.dart';
import 'process_queue.dart';
import 'test_file.dart';
@@ -381,8 +382,8 @@
}
Map<String, String> _createProcessEnvironment() {
- var environment = Map<String, String>.from(io.Platform.environment);
-
+ final environment = Map<String, String>.from(io.Platform.environment);
+ environment.addAll(sanitizerEnvironmentVariables);
if (command.environmentOverrides != null) {
for (var key in command.environmentOverrides.keys) {
environment[key] = command.environmentOverrides[key];
diff --git a/pkg/test_runner/tool/update_static_error_tests.dart b/pkg/test_runner/tool/update_static_error_tests.dart
index c851a06..56ad830 100644
--- a/pkg/test_runner/tool/update_static_error_tests.dart
+++ b/pkg/test_runner/tool/update_static_error_tests.dart
@@ -59,6 +59,11 @@
parser.addFlag("update-cfe",
help: "Replace CFE error expectations.", negatable: false);
+ parser.addSeparator("Other flags:");
+ parser.addFlag("nnbd",
+ help: "Analyze with the 'non-nullable' experiment enabled.",
+ negatable: false);
+
var results = parser.parse(args);
if (results["help"] as bool) {
@@ -91,6 +96,8 @@
results["update-cfe"] as bool ||
results["update"] as bool;
+ var nnbd = results["nnbd"] as bool;
+
if (!removeAnalyzer && !removeCfe && !insertAnalyzer && !insertCfe) {
_usageError(
parser, "Must provide at least one flag for an operation to perform.");
@@ -120,7 +127,8 @@
removeAnalyzer: removeAnalyzer,
removeCfe: removeCfe,
insertAnalyzer: insertAnalyzer,
- insertCfe: insertCfe);
+ insertCfe: insertCfe,
+ nnbd: nnbd);
}
}
}
@@ -138,15 +146,21 @@
bool removeAnalyzer,
bool removeCfe,
bool insertAnalyzer,
- bool insertCfe}) async {
+ bool insertCfe,
+ bool nnbd}) async {
stdout.write("${file.path}...");
var source = file.readAsStringSync();
var testFile = TestFile.parse(Path("."), file.absolute.path, source);
- var options = testFile.sharedOptions.toList();
- if (testFile.experiments.isNotEmpty) {
- options.add("--enable-experiment=${testFile.experiments.join(',')}");
- }
+ var experiments = [
+ if (nnbd) "non-nullable",
+ if (testFile.experiments.isNotEmpty) ...testFile.experiments
+ ];
+
+ var options = [
+ ...testFile.sharedOptions,
+ if (experiments.isNotEmpty) "--enable-experiment=${experiments.join(',')}"
+ ];
var errors = <StaticError>[];
if (insertAnalyzer) {
diff --git a/pkg/vm/bin/kernel_service.dart b/pkg/vm/bin/kernel_service.dart
index 99141fa..fe0e4da 100644
--- a/pkg/vm/bin/kernel_service.dart
+++ b/pkg/vm/bin/kernel_service.dart
@@ -80,6 +80,7 @@
final Uri platformKernelPath;
final bool suppressWarnings;
final bool enableAsserts;
+ final bool nullSafety;
final List<String> experimentalFlags;
final bool bytecode;
final String packageConfig;
@@ -96,6 +97,7 @@
Compiler(this.isolateId, this.fileSystem, this.platformKernelPath,
{this.suppressWarnings: false,
this.enableAsserts: false,
+ this.nullSafety: false,
this.experimentalFlags: null,
this.bytecode: false,
this.supportCodeCoverage: false,
@@ -135,6 +137,7 @@
onError: (msg) => errors.add(msg))
..environmentDefines = new EnvironmentMap()
..enableAsserts = enableAsserts
+ ..nnbdMode = nullSafety ? NnbdMode.Strong : NnbdMode.Weak
..onDiagnostic = (DiagnosticMessage message) {
bool printMessage;
switch (message.severity) {
@@ -281,12 +284,14 @@
int isolateId, FileSystem fileSystem, Uri platformKernelPath,
{bool suppressWarnings: false,
bool enableAsserts: false,
+ bool nullSafety: false,
List<String> experimentalFlags: null,
bool bytecode: false,
String packageConfig: null})
: super(isolateId, fileSystem, platformKernelPath,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
+ nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
bytecode: bytecode,
supportHotReload: true,
@@ -312,6 +317,7 @@
isolateId, fileSystem, platformKernelPath,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
+ nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
bytecode: bytecode,
packageConfig: packageConfig);
@@ -342,12 +348,14 @@
{this.requireMain: false,
bool suppressWarnings: false,
bool enableAsserts: false,
+ bool nullSafety: false,
List<String> experimentalFlags: null,
bool bytecode: false,
String packageConfig: null})
: super(isolateId, fileSystem, platformKernelPath,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
+ nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
bytecode: bytecode,
packageConfig: packageConfig);
@@ -380,6 +388,7 @@
List sourceFiles, Uri platformKernelPath, List<int> platformKernel,
{bool suppressWarnings: false,
bool enableAsserts: false,
+ bool nullSafety: false,
List<String> experimentalFlags: null,
bool bytecode: false,
String packageConfig: null,
@@ -411,6 +420,7 @@
isolateId, fileSystem, platformKernelPath,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
+ nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
bytecode: bytecode,
packageConfig: packageConfig);
@@ -613,7 +623,8 @@
final String inputFileUri = request[2];
final Uri script =
inputFileUri != null ? Uri.base.resolve(inputFileUri) : null;
- bool incremental = request[4];
+ final bool incremental = request[4];
+ final bool nullSafety = request[5];
final int isolateId = request[6];
final List sourceFiles = request[7];
final bool suppressWarnings = request[8];
@@ -680,6 +691,7 @@
isolateId, sourceFiles, platformKernelPath, platformKernel,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
+ nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
bytecode: bytecode,
packageConfig: packageConfig,
@@ -693,6 +705,7 @@
requireMain: false,
suppressWarnings: suppressWarnings,
enableAsserts: enableAsserts,
+ nullSafety: nullSafety,
experimentalFlags: experimentalFlags,
bytecode: bytecode,
packageConfig: packageConfig);
@@ -841,7 +854,7 @@
scriptUri,
platformKernelPath,
false /* incremental */,
- true /* strong */,
+ false /* null safety */,
1 /* isolateId chosen randomly */,
[] /* source files */,
false /* suppress warnings */,
diff --git a/pkg/vm/lib/kernel_front_end.dart b/pkg/vm/lib/kernel_front_end.dart
index ba7435f..9199fa9 100644
--- a/pkg/vm/lib/kernel_front_end.dart
+++ b/pkg/vm/lib/kernel_front_end.dart
@@ -25,6 +25,7 @@
FileSystem,
FileSystemEntity,
FileSystemException,
+ NnbdMode,
ProcessedOptions,
Severity,
StandardFileSystem,
@@ -103,6 +104,10 @@
help: 'The values for the environment constants (e.g. -Dkey=value).');
args.addFlag('enable-asserts',
help: 'Whether asserts will be enabled.', defaultsTo: false);
+ args.addFlag('null-safety',
+ help:
+ 'Respect the nullability of types at runtime in casts and instance checks.',
+ defaultsTo: false);
args.addFlag('split-output-by-packages',
help:
'Split resulting kernel file into multiple files (one per package).',
@@ -161,6 +166,7 @@
final bool genBytecode = options['gen-bytecode'];
final bool dropAST = options['drop-ast'];
final bool enableAsserts = options['enable-asserts'];
+ final bool nullSafety = options['null-safety'];
final bool useProtobufTreeShaker = options['protobuf-tree-shaker'];
final bool splitOutputByPackages = options['split-output-by-packages'];
final List<String> experimentalFlags = options['enable-experiment'];
@@ -223,6 +229,7 @@
..experimentalFlags = parseExperimentalFlags(
parseExperimentalArguments(experimentalFlags),
onError: print)
+ ..nnbdMode = nullSafety ? NnbdMode.Strong : NnbdMode.Weak
..onDiagnostic = (DiagnosticMessage m) {
errorDetector(m);
}
diff --git a/pkg/vm/lib/transformations/type_flow/summary_collector.dart b/pkg/vm/lib/transformations/type_flow/summary_collector.dart
index 395901f..ad3ec7b 100644
--- a/pkg/vm/lib/transformations/type_flow/summary_collector.dart
+++ b/pkg/vm/lib/transformations/type_flow/summary_collector.dart
@@ -1071,6 +1071,21 @@
return narrow;
}
+ // Narrow type of [arg] after successful 'is' test against [type].
+ TypeExpr _makeNarrowAfterSuccessfulIsCheck(TypeExpr arg, DartType type) {
+ // 'x is type' can succeed for null if type is
+ // - a top type (dynamic, void, Object? or Object*)
+ // - nullable (including Null)
+ // - a type parameter (it can be instantiated with Null)
+ // - legacy Never
+ final nullability = type.nullability;
+ final bool canBeNull = _environment.isTop(type) ||
+ nullability == Nullability.nullable ||
+ type is TypeParameterType ||
+ (type is NeverType && nullability == Nullability.legacy);
+ return _makeNarrow(arg, _typesBuilder.fromStaticType(type, canBeNull));
+ }
+
// Add an artificial use of given expression in order to make it possible to
// infer its type even if it is not used in a summary.
void _addUse(TypeExpr arg) {
@@ -1303,8 +1318,8 @@
_addUse(_visit(operand));
final int varIndex = _variablesInfo.varIndex[operand.variable];
if (_variableCells[varIndex] == null) {
- trueState[varIndex] = _makeNarrow(
- _visit(operand), _typesBuilder.fromStaticType(node.type, false));
+ trueState[varIndex] =
+ _makeNarrowAfterSuccessfulIsCheck(_visit(operand), node.type);
}
_variableValues = null;
return;
@@ -1805,8 +1820,7 @@
if ((node.promotedType != null) &&
(node.promotedType != const DynamicType())) {
- return _makeNarrow(
- v, _typesBuilder.fromStaticType(node.promotedType, false));
+ return _makeNarrowAfterSuccessfulIsCheck(v, node.promotedType);
}
return v;
diff --git a/pkg/vm/tool/precompiler2 b/pkg/vm/tool/precompiler2
index f3fc83e..4998476 100755
--- a/pkg/vm/tool/precompiler2
+++ b/pkg/vm/tool/precompiler2
@@ -32,6 +32,8 @@
;;
--tfa | \
--no-tfa | \
+ --null-safety | \
+ --no-null-safety | \
--gen-bytecode | \
--no-gen-bytecode | \
-D* )
@@ -40,6 +42,9 @@
--build-assembly)
BUILD_ASM=1
;;
+ -v*)
+ set -x
+ ;;
--*)
OPTIONS+=("$arg")
;;
diff --git a/pkg/vm_service/CHANGELOG.md b/pkg/vm_service/CHANGELOG.md
index 13403c7..2041a96 100644
--- a/pkg/vm_service/CHANGELOG.md
+++ b/pkg/vm_service/CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog
+## 3.0.0
+**breaking**: RPCs which have an isolateId parameter now return
+ `Future<dynamic>` as a `Sentinel` can be returned if the target isolate no
+ longer exists.
+
+## 2.3.3
+- Classes now implement their corresponding reference types to handle cases
+ where the service returns a more specific type than promised.
+
## 2.3.2
- Added `getClientName`, `setClientName`, and `requireResumePermission` methods.
- Added `ClientName` class.
diff --git a/pkg/vm_service/example/vm_service_assert.dart b/pkg/vm_service/example/vm_service_assert.dart
index 0c3217b..de481b9 100644
--- a/pkg/vm_service/example/vm_service_assert.dart
+++ b/pkg/vm_service/example/vm_service_assert.dart
@@ -618,6 +618,8 @@
} else {
throw "Unexpected value: ${obj.owner}";
}
+ assertBool(obj.isStatic);
+ assertBool(obj.isConst);
return obj;
}
diff --git a/pkg/vm_service/java/.gitignore b/pkg/vm_service/java/.gitignore
index 6bbfbb4..ae0cc5a 100644
--- a/pkg/vm_service/java/.gitignore
+++ b/pkg/vm_service/java/.gitignore
@@ -1,27 +1,38 @@
# This is a generated file.
src/org/dartlang/vm/service/VmService.java
-src/org/dartlang/vm/service/consumer/AllocationProfileConsumer.java
-src/org/dartlang/vm/service/consumer/BreakpointConsumer.java
+src/org/dartlang/vm/service/consumer/AddBreakpointAtEntryConsumer.java
+src/org/dartlang/vm/service/consumer/AddBreakpointConsumer.java
+src/org/dartlang/vm/service/consumer/AddBreakpointWithScriptUriConsumer.java
+src/org/dartlang/vm/service/consumer/ClearCpuSamplesConsumer.java
src/org/dartlang/vm/service/consumer/ClientNameConsumer.java
-src/org/dartlang/vm/service/consumer/CpuSamplesConsumer.java
src/org/dartlang/vm/service/consumer/EvaluateConsumer.java
src/org/dartlang/vm/service/consumer/EvaluateInFrameConsumer.java
src/org/dartlang/vm/service/consumer/FlagListConsumer.java
+src/org/dartlang/vm/service/consumer/GetAllocationProfileConsumer.java
+src/org/dartlang/vm/service/consumer/GetCpuSamplesConsumer.java
src/org/dartlang/vm/service/consumer/GetInboundReferencesConsumer.java
+src/org/dartlang/vm/service/consumer/GetInstancesConsumer.java
src/org/dartlang/vm/service/consumer/GetIsolateConsumer.java
src/org/dartlang/vm/service/consumer/GetIsolateGroupConsumer.java
src/org/dartlang/vm/service/consumer/GetIsolateGroupMemoryUsageConsumer.java
src/org/dartlang/vm/service/consumer/GetMemoryUsageConsumer.java
src/org/dartlang/vm/service/consumer/GetObjectConsumer.java
-src/org/dartlang/vm/service/consumer/InstanceSetConsumer.java
+src/org/dartlang/vm/service/consumer/GetRetainingPathConsumer.java
+src/org/dartlang/vm/service/consumer/GetScriptsConsumer.java
+src/org/dartlang/vm/service/consumer/GetSourceReportConsumer.java
+src/org/dartlang/vm/service/consumer/GetStackConsumer.java
src/org/dartlang/vm/service/consumer/InvokeConsumer.java
-src/org/dartlang/vm/service/consumer/ReloadReportConsumer.java
-src/org/dartlang/vm/service/consumer/RetainingPathConsumer.java
-src/org/dartlang/vm/service/consumer/ScriptListConsumer.java
+src/org/dartlang/vm/service/consumer/KillConsumer.java
+src/org/dartlang/vm/service/consumer/PauseConsumer.java
+src/org/dartlang/vm/service/consumer/ReloadSourcesConsumer.java
+src/org/dartlang/vm/service/consumer/RemoveBreakpointConsumer.java
+src/org/dartlang/vm/service/consumer/RequestHeapSnapshotConsumer.java
+src/org/dartlang/vm/service/consumer/ResumeConsumer.java
+src/org/dartlang/vm/service/consumer/SetExceptionPauseModeConsumer.java
src/org/dartlang/vm/service/consumer/SetFlagConsumer.java
-src/org/dartlang/vm/service/consumer/SourceReportConsumer.java
-src/org/dartlang/vm/service/consumer/StackConsumer.java
+src/org/dartlang/vm/service/consumer/SetLibraryDebuggableConsumer.java
+src/org/dartlang/vm/service/consumer/SetNameConsumer.java
src/org/dartlang/vm/service/consumer/SuccessConsumer.java
src/org/dartlang/vm/service/consumer/TimelineConsumer.java
src/org/dartlang/vm/service/consumer/TimelineFlagsConsumer.java
diff --git a/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/AllocationProfileConsumer.java b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/AllocationProfileConsumer.java
new file mode 100644
index 0000000..d3bbc7a
--- /dev/null
+++ b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/AllocationProfileConsumer.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.dartlang.vm.service.consumer;
+
+// This is a generated file.
+
+import org.dartlang.vm.service.element.AllocationProfile;
+
+@SuppressWarnings({"WeakerAccess", "unused"})
+public interface AllocationProfileConsumer extends Consumer {
+
+ void received(AllocationProfile response);
+}
diff --git a/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/BreakpointConsumer.java b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/BreakpointConsumer.java
new file mode 100644
index 0000000..7fdc2dd
--- /dev/null
+++ b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/BreakpointConsumer.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.dartlang.vm.service.consumer;
+
+// This is a generated file.
+
+import org.dartlang.vm.service.element.Breakpoint;
+
+@SuppressWarnings({"WeakerAccess", "unused"})
+public interface BreakpointConsumer extends Consumer {
+
+ void received(Breakpoint response);
+}
diff --git a/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/CpuSamplesConsumer.java b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/CpuSamplesConsumer.java
new file mode 100644
index 0000000..6bc5e2f
--- /dev/null
+++ b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/CpuSamplesConsumer.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.dartlang.vm.service.consumer;
+
+// This is a generated file.
+
+import org.dartlang.vm.service.element.CpuSamples;
+
+@SuppressWarnings({"WeakerAccess", "unused"})
+public interface CpuSamplesConsumer extends Consumer {
+
+ void received(CpuSamples response);
+}
diff --git a/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/InstanceSetConsumer.java b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/InstanceSetConsumer.java
new file mode 100644
index 0000000..951ba0e
--- /dev/null
+++ b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/InstanceSetConsumer.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.dartlang.vm.service.consumer;
+
+// This is a generated file.
+
+import org.dartlang.vm.service.element.InstanceSet;
+
+@SuppressWarnings({"WeakerAccess", "unused"})
+public interface InstanceSetConsumer extends Consumer {
+
+ void received(InstanceSet response);
+}
diff --git a/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/ReloadReportConsumer.java b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/ReloadReportConsumer.java
new file mode 100644
index 0000000..ca1c319
--- /dev/null
+++ b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/ReloadReportConsumer.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.dartlang.vm.service.consumer;
+
+// This is a generated file.
+
+import org.dartlang.vm.service.element.ReloadReport;
+
+@SuppressWarnings({"WeakerAccess", "unused"})
+public interface ReloadReportConsumer extends Consumer {
+
+ void received(ReloadReport response);
+}
diff --git a/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/RetainingPathConsumer.java b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/RetainingPathConsumer.java
new file mode 100644
index 0000000..304aaf6
--- /dev/null
+++ b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/RetainingPathConsumer.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.dartlang.vm.service.consumer;
+
+// This is a generated file.
+
+import org.dartlang.vm.service.element.RetainingPath;
+
+@SuppressWarnings({"WeakerAccess", "unused"})
+public interface RetainingPathConsumer extends Consumer {
+
+ void received(RetainingPath response);
+}
diff --git a/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/ScriptListConsumer.java b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/ScriptListConsumer.java
new file mode 100644
index 0000000..0a5fb29
--- /dev/null
+++ b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/ScriptListConsumer.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.dartlang.vm.service.consumer;
+
+// This is a generated file.
+
+import org.dartlang.vm.service.element.ScriptList;
+
+@SuppressWarnings({"WeakerAccess", "unused"})
+public interface ScriptListConsumer extends Consumer {
+
+ void received(ScriptList response);
+}
diff --git a/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/SourceReportConsumer.java b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/SourceReportConsumer.java
new file mode 100644
index 0000000..0a9fd1f
--- /dev/null
+++ b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/SourceReportConsumer.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.dartlang.vm.service.consumer;
+
+// This is a generated file.
+
+import org.dartlang.vm.service.element.SourceReport;
+
+@SuppressWarnings({"WeakerAccess", "unused"})
+public interface SourceReportConsumer extends Consumer {
+
+ void received(SourceReport response);
+}
diff --git a/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/StackConsumer.java b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/StackConsumer.java
new file mode 100644
index 0000000..d82bd0e
--- /dev/null
+++ b/pkg/vm_service/java/src/org/dartlang/vm/service/consumer/StackConsumer.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.dartlang.vm.service.consumer;
+
+// This is a generated file.
+
+import org.dartlang.vm.service.element.Stack;
+
+@SuppressWarnings({"WeakerAccess", "unused"})
+public interface StackConsumer extends Consumer {
+
+ void received(Stack response);
+}
diff --git a/pkg/vm_service/java/version.properties b/pkg/vm_service/java/version.properties
index f56be80..4394db5 100644
--- a/pkg/vm_service/java/version.properties
+++ b/pkg/vm_service/java/version.properties
@@ -1 +1 @@
-version=3.29
+version=3.30
diff --git a/pkg/vm_service/lib/src/vm_service.dart b/pkg/vm_service/lib/src/vm_service.dart
index 1cb3174..563d826d 100644
--- a/pkg/vm_service/lib/src/vm_service.dart
+++ b/pkg/vm_service/lib/src/vm_service.dart
@@ -28,7 +28,7 @@
HeapSnapshotObjectNoData,
HeapSnapshotObjectNullData;
-const String vmServiceVersion = '3.29.0';
+const String vmServiceVersion = '3.30.0';
/// @optional
const String optional = 'optional';
@@ -187,47 +187,47 @@
};
Map<String, List<String>> _methodReturnTypes = {
- 'addBreakpoint': const ['Breakpoint'],
- 'addBreakpointWithScriptUri': const ['Breakpoint'],
- 'addBreakpointAtEntry': const ['Breakpoint'],
- 'clearCpuSamples': const ['Success'],
+ 'addBreakpoint': const ['Breakpoint', 'Sentinel'],
+ 'addBreakpointWithScriptUri': const ['Breakpoint', 'Sentinel'],
+ 'addBreakpointAtEntry': const ['Breakpoint', 'Sentinel'],
+ 'clearCpuSamples': const ['Success', 'Sentinel'],
'clearVMTimeline': const ['Success'],
'invoke': const ['InstanceRef', 'ErrorRef', 'Sentinel'],
'evaluate': const ['InstanceRef', 'ErrorRef', 'Sentinel'],
'evaluateInFrame': const ['InstanceRef', 'ErrorRef', 'Sentinel'],
- 'getAllocationProfile': const ['AllocationProfile'],
+ 'getAllocationProfile': const ['AllocationProfile', 'Sentinel'],
'getClientName': const ['ClientName'],
- 'getCpuSamples': const ['CpuSamples'],
+ 'getCpuSamples': const ['CpuSamples', 'Sentinel'],
'getFlagList': const ['FlagList'],
'getInboundReferences': const ['InboundReferences', 'Sentinel'],
- 'getInstances': const ['InstanceSet'],
+ 'getInstances': const ['InstanceSet', 'Sentinel'],
'getIsolate': const ['Isolate', 'Sentinel'],
'getIsolateGroup': const ['IsolateGroup', 'Sentinel'],
'getMemoryUsage': const ['MemoryUsage', 'Sentinel'],
'getIsolateGroupMemoryUsage': const ['MemoryUsage', 'Sentinel'],
- 'getScripts': const ['ScriptList'],
+ 'getScripts': const ['ScriptList', 'Sentinel'],
'getObject': const ['Obj', 'Sentinel'],
- 'getRetainingPath': const ['RetainingPath'],
- 'getStack': const ['Stack'],
- 'getSourceReport': const ['SourceReport'],
+ 'getRetainingPath': const ['RetainingPath', 'Sentinel'],
+ 'getStack': const ['Stack', 'Sentinel'],
+ 'getSourceReport': const ['SourceReport', 'Sentinel'],
'getVersion': const ['Version'],
'getVM': const ['VM'],
'getVMTimeline': const ['Timeline'],
'getVMTimelineFlags': const ['TimelineFlags'],
'getVMTimelineMicros': const ['Timestamp'],
- 'pause': const ['Success'],
- 'kill': const ['Success'],
+ 'pause': const ['Success', 'Sentinel'],
+ 'kill': const ['Success', 'Sentinel'],
'registerService': const ['Success'],
- 'reloadSources': const ['ReloadReport'],
- 'removeBreakpoint': const ['Success'],
- 'requestHeapSnapshot': const ['Success'],
+ 'reloadSources': const ['ReloadReport', 'Sentinel'],
+ 'removeBreakpoint': const ['Success', 'Sentinel'],
+ 'requestHeapSnapshot': const ['Success', 'Sentinel'],
'requirePermissionToResume': const ['Success'],
- 'resume': const ['Success'],
+ 'resume': const ['Success', 'Sentinel'],
'setClientName': const ['Success'],
- 'setExceptionPauseMode': const ['Success'],
+ 'setExceptionPauseMode': const ['Success', 'Sentinel'],
'setFlag': const ['Success', 'Error'],
- 'setLibraryDebuggable': const ['Success'],
- 'setName': const ['Success'],
+ 'setLibraryDebuggable': const ['Success', 'Sentinel'],
+ 'setName': const ['Success', 'Sentinel'],
'setVMName': const ['Success'],
'setVMTimelineFlags': const ['Success'],
'streamCancel': const ['Success'],
@@ -265,12 +265,17 @@
/// breakpoints.
///
/// If no breakpoint is possible at that line, the `102` (Cannot add
- /// breakpoint) error code is returned.
+ /// breakpoint) [RPC error] code is returned.
///
/// Note that breakpoints are added and removed on a per-isolate basis.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [Breakpoint].
- Future<Breakpoint> addBreakpoint(
+ ///
+ /// The return value can be one of [Breakpoint] or [Sentinel].
+ Future<dynamic> addBreakpoint(
String isolateId,
String scriptId,
int line, {
@@ -296,12 +301,17 @@
/// breakpoints.
///
/// If no breakpoint is possible at that line, the `102` (Cannot add
- /// breakpoint) error code is returned.
+ /// breakpoint) [RPC error] code is returned.
///
/// Note that breakpoints are added and removed on a per-isolate basis.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [Breakpoint].
- Future<Breakpoint> addBreakpointWithScriptUri(
+ ///
+ /// The return value can be one of [Breakpoint] or [Sentinel].
+ Future<dynamic> addBreakpointWithScriptUri(
String isolateId,
String scriptUri,
int line, {
@@ -312,17 +322,27 @@
/// entrypoint of some function.
///
/// If no breakpoint is possible at the function entry, the `102` (Cannot add
- /// breakpoint) error code is returned.
+ /// breakpoint) [RPC error] code is returned.
+ ///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
///
/// See [Breakpoint].
///
/// Note that breakpoints are added and removed on a per-isolate basis.
- Future<Breakpoint> addBreakpointAtEntry(String isolateId, String functionId);
+ ///
+ /// The return value can be one of [Breakpoint] or [Sentinel].
+ Future<dynamic> addBreakpointAtEntry(String isolateId, String functionId);
/// Clears all CPU profiling samples.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [Success].
- Future<Success> clearCpuSamples(String isolateId);
+ ///
+ /// The return value can be one of [Success] or [Sentinel].
+ Future<dynamic> clearCpuSamples(String isolateId);
/// Clears all VM timeline events.
///
@@ -349,10 +369,13 @@
/// has been collected by the VM's garbage collector, then the `Collected`
/// [Sentinel] is returned.
///
- /// If invocation triggers a failed compilation then [rpc error] 113
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
+ /// If invocation triggers a failed compilation then [RPC error] 113
/// "Expression compilation error" is returned.
///
- /// If an runtime error occurs while evaluating the invocation, an [ErrorRef]
+ /// If a runtime error occurs while evaluating the invocation, an [ErrorRef]
/// reference will be returned.
///
/// If the invocation is evaluated successfully, an [InstanceRef] reference
@@ -378,6 +401,9 @@
/// If `targetId` refers to an object which has been collected by the VM's
/// garbage collector, then the `Collected` [Sentinel] is returned.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// If `scope` is provided, it should be a map from identifiers to object ids.
/// These bindings will be added to the scope in which the expression is
/// evaluated, which is a child scope of the class or library for
@@ -389,7 +415,7 @@
/// as a result of this evaluation are ignored. Defaults to false if not
/// provided.
///
- /// If the expression fails to parse and compile, then [rpc error] 113
+ /// If the expression fails to parse and compile, then [RPC error] 113
/// "Expression compilation error" is returned.
///
/// If an error occurs while evaluating the expression, an [ErrorRef]
@@ -421,7 +447,7 @@
/// as a result of this evaluation are ignored. Defaults to false if not
/// provided.
///
- /// If the expression fails to parse and compile, then [rpc error] 113
+ /// If the expression fails to parse and compile, then [RPC error] 113
/// "Expression compilation error" is returned.
///
/// If an error occurs while evaluating the expression, an [ErrorRef]
@@ -430,6 +456,9 @@
/// If the expression is evaluated successfully, an [InstanceRef] reference
/// will be returned.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// The return value can be one of [InstanceRef], [ErrorRef] or [Sentinel].
Future<dynamic> evaluateInFrame(
String isolateId,
@@ -448,8 +477,12 @@
/// If `gc` is provided and is set to true, a garbage collection will be
/// attempted before collecting allocation information. There is no guarantee
/// that a garbage collection will be actually be performed.
- Future<AllocationProfile> getAllocationProfile(String isolateId,
- {bool reset, bool gc});
+ ///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
+ /// The return value can be one of [AllocationProfile] or [Sentinel].
+ Future<dynamic> getAllocationProfile(String isolateId, {bool reset, bool gc});
/// The `getClientName` RPC is used to retrieve the name associated with the
/// currently connected VM service client. If no name was previously set
@@ -462,10 +495,15 @@
/// profiler. Only samples collected in the time range `[timeOriginMicros,
/// timeOriginMicros + timeExtentMicros]` will be reported.
///
- /// If the profiler is disabled, an error response will be returned.
+ /// If the profiler is disabled, an [RPC error] response will be returned.
+ ///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
///
/// See [CpuSamples].
- Future<CpuSamples> getCpuSamples(
+ ///
+ /// The return value can be one of [CpuSamples] or [Sentinel].
+ Future<dynamic> getCpuSamples(
String isolateId, int timeOriginMicros, int timeExtentMicros);
/// The `getFlagList` RPC returns a list of all command line flags in the VM
@@ -494,6 +532,9 @@
/// If `targetId` refers to an object which has been collected by the VM's
/// garbage collector, then the `Collected` [Sentinel] is returned.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [InboundReferences].
///
/// The return value can be one of [InboundReferences] or [Sentinel].
@@ -513,13 +554,17 @@
/// yet been garbage collected.
///
/// `objectId` is the ID of the `Class` to retrieve instances for. `objectId`
- /// must be the ID of a `Class`, otherwise an error is returned.
+ /// must be the ID of a `Class`, otherwise an [RPC error] is returned.
///
/// `limit` is the maximum number of instances to be returned.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [InstanceSet].
- Future<InstanceSet> getInstances(
- String isolateId, String objectId, int limit);
+ ///
+ /// The return value can be one of [InstanceSet] or [Sentinel].
+ Future<dynamic> getInstances(String isolateId, String objectId, int limit);
/// The `getIsolate` RPC is used to lookup an `Isolate` object by its `id`.
///
@@ -571,8 +616,13 @@
/// The `getScripts` RPC is used to retrieve a `ScriptList` containing all
/// scripts for an isolate based on the isolate's `isolateId`.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [ScriptList].
- Future<ScriptList> getScripts(String isolateId);
+ ///
+ /// The return value can be one of [ScriptList] or [Sentinel].
+ Future<dynamic> getScripts(String isolateId);
/// The `getObject` RPC is used to lookup an `object` from some isolate by its
/// `id`.
@@ -580,6 +630,9 @@
/// If `objectId` is a temporary id which has expired, then the `Expired`
/// [Sentinel] is returned.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// If `objectId` refers to a heap object which has been collected by the VM's
/// garbage collector, then the `Collected` [Sentinel] is returned.
///
@@ -607,6 +660,9 @@
/// specified by `targetId` to a GC root (i.e., the object which is preventing
/// this object from being garbage collected).
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// If `targetId` refers to a heap object which has been collected by the VM's
/// garbage collector, then the `Collected` [Sentinel] is returned.
///
@@ -621,14 +677,21 @@
/// truncated at the root end of the path.
///
/// See [RetainingPath].
- Future<RetainingPath> getRetainingPath(
+ ///
+ /// The return value can be one of [RetainingPath] or [Sentinel].
+ Future<dynamic> getRetainingPath(
String isolateId, String targetId, int limit);
/// The `getStack` RPC is used to retrieve the current execution stack and
/// message queue for an isolate. The isolate does not need to be paused.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [Stack].
- Future<Stack> getStack(String isolateId);
+ ///
+ /// The return value can be one of [Stack] or [Sentinel].
+ Future<dynamic> getStack(String isolateId);
/// The `getSourceReport` RPC is used to generate a set of reports tied to
/// source locations in an isolate.
@@ -662,8 +725,13 @@
/// compilation error, which could terminate the running Dart program. If this
/// parameter is not provided, it is considered to have the value `false`.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [SourceReport].
- Future<SourceReport> getSourceReport(
+ ///
+ /// The return value can be one of [SourceReport] or [Sentinel].
+ Future<dynamic> getSourceReport(
String isolateId,
/*List<SourceReportKind>*/
List<String> reports, {
@@ -701,8 +769,9 @@
/// `(timeOriginMicros, timeOriginMicros + timeExtentMicros)`.
///
/// If `getVMTimeline` is invoked while the current recorder is one of Fuchsia
- /// or Macos or Systrace, the `114` error code, invalid timeline request, will
- /// be returned as timeline events are handled by the OS in these modes.
+ /// or Macos or Systrace, an [RPC error] with error code `114`, `invalid
+ /// timeline request`, will be returned as timeline events are handled by the
+ /// OS in these modes.
Future<Timeline> getVMTimeline({int timeOriginMicros, int timeExtentMicros});
/// The `getVMTimelineFlags` RPC returns information about the current VM
@@ -727,16 +796,26 @@
///
/// When the isolate is paused an event will be sent on the `Debug` stream.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [Success].
- Future<Success> pause(String isolateId);
+ ///
+ /// The return value can be one of [Success] or [Sentinel].
+ Future<dynamic> pause(String isolateId);
/// The `kill` RPC is used to kill an isolate as if by dart:isolate's
/// `Isolate.kill(IMMEDIATE)`.
///
/// The isolate is killed regardless of whether it is paused or running.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [Success].
- Future<Success> kill(String isolateId);
+ ///
+ /// The return value can be one of [Success] or [Sentinel].
+ Future<dynamic> kill(String isolateId);
/// Registers a service that can be invoked by other VM service clients, where
/// `service` is the name of the service to advertise and `alias` is an
@@ -762,7 +841,12 @@
///
/// if the `packagesUri` parameter is provided, it indicates the new uri to
/// the Isolate's package map (.packages) file.
- Future<ReloadReport> reloadSources(
+ ///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
+ /// The return value can be one of [ReloadReport] or [Sentinel].
+ Future<dynamic> reloadSources(
String isolateId, {
bool force,
bool pause,
@@ -774,8 +858,13 @@
///
/// Note that breakpoints are added and removed on a per-isolate basis.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [Success].
- Future<Success> removeBreakpoint(String isolateId, String breakpointId);
+ ///
+ /// The return value can be one of [Success] or [Sentinel].
+ Future<dynamic> removeBreakpoint(String isolateId, String breakpointId);
/// Requests a dump of the Dart heap of the given isolate.
///
@@ -784,7 +873,12 @@
/// events, when concatenated together, conforms to the [SnapshotGraph] type.
/// The splitting of the SnapshotGraph into events can happen at any byte
/// offset.
- Future<Success> requestHeapSnapshot(String isolateId);
+ ///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
+ /// The return value can be one of [Success] or [Sentinel].
+ Future<dynamic> requestHeapSnapshot(String isolateId);
/// The `requirePermissionToResume` RPC is used to change the pause/resume
/// behavior of isolates by providing a way for the VM service to wait for
@@ -833,8 +927,13 @@
///
/// If the `frameIndex` parameter is not provided, it defaults to 1.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [Success], [StepOption].
- Future<Success> resume(String isolateId,
+ ///
+ /// The return value can be one of [Success] or [Sentinel].
+ Future<dynamic> resume(String isolateId,
{/*StepOption*/ String step, int frameIndex});
/// The `setClientName` RPC is used to set a name to be associated with the
@@ -854,7 +953,12 @@
/// None | Do not pause isolate on thrown exceptions
/// Unhandled | Pause isolate on unhandled exceptions
/// All | Pause isolate on all thrown exceptions
- Future<Success> setExceptionPauseMode(
+ ///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
+ /// The return value can be one of [Success] or [Sentinel].
+ Future<dynamic> setExceptionPauseMode(
String isolateId, /*ExceptionPauseMode*/ String mode);
/// The `setFlag` RPC is used to set a VM flag at runtime. Returns an error if
@@ -869,14 +973,24 @@
/// The `setLibraryDebuggable` RPC is used to enable or disable whether
/// breakpoints and stepping work for a given library.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [Success].
- Future<Success> setLibraryDebuggable(
+ ///
+ /// The return value can be one of [Success] or [Sentinel].
+ Future<dynamic> setLibraryDebuggable(
String isolateId, String libraryId, bool isDebuggable);
/// The `setName` RPC is used to change the debugging name for an isolate.
///
+ /// If `isolateId` refers to an isolate which has exited, then the `Collected`
+ /// [Sentinel] is returned.
+ ///
/// See [Success].
- Future<Success> setName(String isolateId, String name);
+ ///
+ /// The return value can be one of [Success] or [Sentinel].
+ Future<dynamic> setName(String isolateId, String name);
/// The `setVMName` RPC is used to change the debugging name for the vm.
///
@@ -899,7 +1013,7 @@
/// The `streamCancel` RPC cancels a stream subscription in the VM.
///
/// If the client is not subscribed to the stream, the `104` (Stream not
- /// subscribed) error code is returned.
+ /// subscribed) [RPC error] code is returned.
///
/// See [Success].
Future<Success> streamCancel(String streamId);
@@ -908,7 +1022,7 @@
/// the client will begin receiving events from the stream.
///
/// If the client is already subscribed to the stream, the `103` (Stream
- /// already subscribed) error code is returned.
+ /// already subscribed) [RPC error] code is returned.
///
/// The `streamId` parameter may have the following published values:
///
@@ -1428,7 +1542,7 @@
Stream<Event> get onStderrEvent => _getEventController('Stderr').stream;
@override
- Future<Breakpoint> addBreakpoint(
+ Future<dynamic> addBreakpoint(
String isolateId,
String scriptId,
int line, {
@@ -1442,7 +1556,7 @@
}
@override
- Future<Breakpoint> addBreakpointWithScriptUri(
+ Future<dynamic> addBreakpointWithScriptUri(
String isolateId,
String scriptUri,
int line, {
@@ -1456,13 +1570,13 @@
}
@override
- Future<Breakpoint> addBreakpointAtEntry(String isolateId, String functionId) {
+ Future<dynamic> addBreakpointAtEntry(String isolateId, String functionId) {
return _call('addBreakpointAtEntry',
{'isolateId': isolateId, 'functionId': functionId});
}
@override
- Future<Success> clearCpuSamples(String isolateId) {
+ Future<dynamic> clearCpuSamples(String isolateId) {
return _call('clearCpuSamples', {'isolateId': isolateId});
}
@@ -1534,7 +1648,7 @@
}
@override
- Future<AllocationProfile> getAllocationProfile(String isolateId,
+ Future<dynamic> getAllocationProfile(String isolateId,
{bool reset, bool gc}) {
Map m = {'isolateId': isolateId};
if (reset != null && reset) {
@@ -1550,7 +1664,7 @@
Future<ClientName> getClientName() => _call('getClientName');
@override
- Future<CpuSamples> getCpuSamples(
+ Future<dynamic> getCpuSamples(
String isolateId, int timeOriginMicros, int timeExtentMicros) {
return _call('getCpuSamples', {
'isolateId': isolateId,
@@ -1570,8 +1684,7 @@
}
@override
- Future<InstanceSet> getInstances(
- String isolateId, String objectId, int limit) {
+ Future<dynamic> getInstances(String isolateId, String objectId, int limit) {
return _call('getInstances',
{'isolateId': isolateId, 'objectId': objectId, 'limit': limit});
}
@@ -1598,7 +1711,7 @@
}
@override
- Future<ScriptList> getScripts(String isolateId) {
+ Future<dynamic> getScripts(String isolateId) {
return _call('getScripts', {'isolateId': isolateId});
}
@@ -1620,19 +1733,19 @@
}
@override
- Future<RetainingPath> getRetainingPath(
+ Future<dynamic> getRetainingPath(
String isolateId, String targetId, int limit) {
return _call('getRetainingPath',
{'isolateId': isolateId, 'targetId': targetId, 'limit': limit});
}
@override
- Future<Stack> getStack(String isolateId) {
+ Future<dynamic> getStack(String isolateId) {
return _call('getStack', {'isolateId': isolateId});
}
@override
- Future<SourceReport> getSourceReport(
+ Future<dynamic> getSourceReport(
String isolateId,
/*List<SourceReportKind>*/
List<String> reports, {
@@ -1682,12 +1795,12 @@
Future<Timestamp> getVMTimelineMicros() => _call('getVMTimelineMicros');
@override
- Future<Success> pause(String isolateId) {
+ Future<dynamic> pause(String isolateId) {
return _call('pause', {'isolateId': isolateId});
}
@override
- Future<Success> kill(String isolateId) {
+ Future<dynamic> kill(String isolateId) {
return _call('kill', {'isolateId': isolateId});
}
@@ -1697,7 +1810,7 @@
}
@override
- Future<ReloadReport> reloadSources(
+ Future<dynamic> reloadSources(
String isolateId, {
bool force,
bool pause,
@@ -1721,13 +1834,13 @@
}
@override
- Future<Success> removeBreakpoint(String isolateId, String breakpointId) {
+ Future<dynamic> removeBreakpoint(String isolateId, String breakpointId) {
return _call('removeBreakpoint',
{'isolateId': isolateId, 'breakpointId': breakpointId});
}
@override
- Future<Success> requestHeapSnapshot(String isolateId) {
+ Future<dynamic> requestHeapSnapshot(String isolateId) {
return _call('requestHeapSnapshot', {'isolateId': isolateId});
}
@@ -1748,7 +1861,7 @@
}
@override
- Future<Success> resume(String isolateId,
+ Future<dynamic> resume(String isolateId,
{/*StepOption*/ String step, int frameIndex}) {
Map m = {'isolateId': isolateId};
if (step != null) {
@@ -1766,7 +1879,7 @@
}
@override
- Future<Success> setExceptionPauseMode(
+ Future<dynamic> setExceptionPauseMode(
String isolateId, /*ExceptionPauseMode*/ String mode) {
return _call(
'setExceptionPauseMode', {'isolateId': isolateId, 'mode': mode});
@@ -1778,7 +1891,7 @@
}
@override
- Future<Success> setLibraryDebuggable(
+ Future<dynamic> setLibraryDebuggable(
String isolateId, String libraryId, bool isDebuggable) {
return _call('setLibraryDebuggable', {
'isolateId': isolateId,
@@ -1788,7 +1901,7 @@
}
@override
- Future<Success> setName(String isolateId, String name) {
+ Future<dynamic> setName(String isolateId, String name) {
return _call('setName', {'isolateId': isolateId, 'name': name});
}
@@ -2601,7 +2714,7 @@
}
/// A `Class` provides information about a Dart language class.
-class Class extends Obj {
+class Class extends Obj implements ClassRef {
static Class parse(Map<String, dynamic> json) =>
json == null ? null : Class._fromJson(json);
@@ -2870,7 +2983,7 @@
}
/// A `Code` object represents compiled code in the Dart VM.
-class Code extends ObjRef {
+class Code extends ObjRef implements CodeRef {
static Code parse(Map<String, dynamic> json) =>
json == null ? null : Code._fromJson(json);
@@ -2942,7 +3055,7 @@
/// A `Context` is a data structure which holds the captured variables for some
/// closure.
-class Context extends Obj {
+class Context extends Obj implements ContextRef {
static Context parse(Map<String, dynamic> json) =>
json == null ? null : Context._fromJson(json);
@@ -3208,8 +3321,8 @@
}
/// An `Error` represents a Dart language level error. This is distinct from an
-/// [rpc error].
-class Error extends Obj {
+/// [RPC error].
+class Error extends Obj implements ErrorRef {
static Error parse(Map<String, dynamic> json) =>
json == null ? null : Error._fromJson(json);
@@ -3613,7 +3726,7 @@
}
/// A `Field` provides information about a Dart language field or variable.
-class Field extends Obj {
+class Field extends Obj implements FieldRef {
static Field parse(Map<String, dynamic> json) =>
json == null ? null : Field._fromJson(json);
@@ -3886,7 +3999,7 @@
}
/// A `Func` represents a Dart language function.
-class Func extends Obj {
+class Func extends Obj implements FuncRef {
static Func parse(Map<String, dynamic> json) =>
json == null ? null : Func._fromJson(json);
@@ -3898,6 +4011,12 @@
/// [owner] can be one of [LibraryRef], [ClassRef] or [FuncRef].
dynamic owner;
+ /// Is this function static?
+ bool isStatic;
+
+ /// Is this function const?
+ bool isConst;
+
/// The location of this function in the source code.
@optional
SourceLocation location;
@@ -3909,6 +4028,8 @@
Func({
@required this.name,
@required this.owner,
+ @required this.isStatic,
+ @required this.isConst,
this.location,
this.code,
});
@@ -3916,6 +4037,8 @@
name = json['name'];
owner = createServiceObject(
json['owner'], const ['LibraryRef', 'ClassRef', 'FuncRef']);
+ isStatic = json['static'];
+ isConst = json['const'];
location = createServiceObject(json['location'], const ['SourceLocation']);
code = createServiceObject(json['code'], const ['CodeRef']);
}
@@ -3927,6 +4050,8 @@
json.addAll({
'name': name,
'owner': owner.toJson(),
+ 'static': isStatic,
+ 'const': isConst,
});
_setIfNotNull(json, 'location', location?.toJson());
_setIfNotNull(json, 'code', code?.toJson());
@@ -3937,8 +4062,9 @@
operator ==(other) => other is Func && id == other.id;
- String toString() =>
- '[Func type: ${type}, id: ${id}, name: ${name}, owner: ${owner}]';
+ String toString() => '[Func ' //
+ 'type: ${type}, id: ${id}, name: ${name}, owner: ${owner}, ' //
+ 'isStatic: ${isStatic}, isConst: ${isConst}]';
}
/// `InstanceRef` is a reference to an `Instance`.
@@ -4102,7 +4228,7 @@
}
/// An `Instance` represents an instance of the Dart language class `Obj`.
-class Instance extends Obj {
+class Instance extends Obj implements InstanceRef {
static Instance parse(Map<String, dynamic> json) =>
json == null ? null : Instance._fromJson(json);
@@ -4275,7 +4401,21 @@
/// Provided for instance kinds:
/// - RegExp
@optional
- String pattern;
+ InstanceRef pattern;
+
+ /// The function associated with a Closure instance.
+ ///
+ /// Provided for instance kinds:
+ /// - Closure
+ @optional
+ FuncRef closureFunction;
+
+ /// The context associated with a Closure instance.
+ ///
+ /// Provided for instance kinds:
+ /// - Closure
+ @optional
+ ContextRef closureContext;
/// Whether this regular expression is case sensitive.
///
@@ -4359,6 +4499,8 @@
this.bytes,
this.mirrorReferent,
this.pattern,
+ this.closureFunction,
+ this.closureContext,
this.isCaseSensitive,
this.isMultiLine,
this.propertyKey,
@@ -4395,7 +4537,11 @@
bytes = json['bytes'];
mirrorReferent =
createServiceObject(json['mirrorReferent'], const ['InstanceRef']);
- pattern = json['pattern'];
+ pattern = createServiceObject(json['pattern'], const ['InstanceRef']);
+ closureFunction =
+ createServiceObject(json['closureFunction'], const ['FuncRef']);
+ closureContext =
+ createServiceObject(json['closureContext'], const ['ContextRef']);
isCaseSensitive = json['isCaseSensitive'];
isMultiLine = json['isMultiLine'];
propertyKey =
@@ -4433,7 +4579,9 @@
json, 'associations', associations?.map((f) => f?.toJson())?.toList());
_setIfNotNull(json, 'bytes', bytes);
_setIfNotNull(json, 'mirrorReferent', mirrorReferent?.toJson());
- _setIfNotNull(json, 'pattern', pattern);
+ _setIfNotNull(json, 'pattern', pattern?.toJson());
+ _setIfNotNull(json, 'closureFunction', closureFunction?.toJson());
+ _setIfNotNull(json, 'closureContext', closureContext?.toJson());
_setIfNotNull(json, 'isCaseSensitive', isCaseSensitive);
_setIfNotNull(json, 'isMultiLine', isMultiLine);
_setIfNotNull(json, 'propertyKey', propertyKey?.toJson());
@@ -4499,7 +4647,7 @@
}
/// An `Isolate` object provides information about one isolate in the VM.
-class Isolate extends Response {
+class Isolate extends Response implements IsolateRef {
static Isolate parse(Map<String, dynamic> json) =>
json == null ? null : Isolate._fromJson(json);
@@ -4671,7 +4819,7 @@
}
/// An `Isolate` object provides information about one isolate in the VM.
-class IsolateGroup extends Response {
+class IsolateGroup extends Response implements IsolateGroupRef {
static IsolateGroup parse(Map<String, dynamic> json) =>
json == null ? null : IsolateGroup._fromJson(json);
@@ -4875,7 +5023,7 @@
/// A `Library` provides information about a Dart language library.
///
/// See [setLibraryDebuggable].
-class Library extends Obj {
+class Library extends Obj implements LibraryRef {
static Library parse(Map<String, dynamic> json) =>
json == null ? null : Library._fromJson(json);
@@ -5281,7 +5429,7 @@
}
/// A `NullVal` object represents the Dart language value null.
-class NullVal extends Instance {
+class NullVal extends Instance implements NullValRef {
static NullVal parse(Map<String, dynamic> json) =>
json == null ? null : NullVal._fromJson(json);
@@ -5358,7 +5506,7 @@
}
/// An `Obj` is a persistent object that is owned by some isolate.
-class Obj extends Response {
+class Obj extends Response implements ObjRef {
static Obj parse(Map<String, dynamic> json) =>
json == null ? null : Obj._fromJson(json);
@@ -5732,7 +5880,7 @@
/// 100 | 1 | 5
/// 101 | 1 | 8
/// 102 | 2 | 7
-class Script extends Obj {
+class Script extends Obj implements ScriptRef {
static Script parse(Map<String, dynamic> json) =>
json == null ? null : Script._fromJson(json);
@@ -6311,7 +6459,7 @@
/// A `TypeArguments` object represents the type argument vector for some
/// instantiated generic type.
-class TypeArguments extends Obj {
+class TypeArguments extends Obj implements TypeArgumentsRef {
static TypeArguments parse(Map<String, dynamic> json) =>
json == null ? null : TypeArguments._fromJson(json);
@@ -6487,7 +6635,7 @@
String toString() => '[VMRef type: ${type}, name: ${name}]';
}
-class VM extends Response {
+class VM extends Response implements VMRef {
static VM parse(Map<String, dynamic> json) =>
json == null ? null : VM._fromJson(json);
diff --git a/pkg/vm_service/pubspec.yaml b/pkg/vm_service/pubspec.yaml
index 9c0912e..99a3026 100644
--- a/pkg/vm_service/pubspec.yaml
+++ b/pkg/vm_service/pubspec.yaml
@@ -2,7 +2,7 @@
description: >-
A library to communicate with a service implementing the Dart VM
service protocol.
-version: 2.3.2
+version: 3.0.0+1
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/vm_service
diff --git a/pkg/vm_service/test/http_enable_timeline_logging_service_test.dart b/pkg/vm_service/test/http_enable_timeline_logging_service_test.dart
index 6f1d9af..418b823 100644
--- a/pkg/vm_service/test/http_enable_timeline_logging_service_test.dart
+++ b/pkg/vm_service/test/http_enable_timeline_logging_service_test.dart
@@ -42,5 +42,5 @@
},
];
-main([args = const []]) async =>
+main([args = const <String>[]]) async =>
runIsolateTests(args, tests, testeeBefore: setup);
diff --git a/pkg/vm_service/tool/dart/generate_dart.dart b/pkg/vm_service/tool/dart/generate_dart.dart
index cf14f6c..158e24f 100644
--- a/pkg/vm_service/tool/dart/generate_dart.dart
+++ b/pkg/vm_service/tool/dart/generate_dart.dart
@@ -1341,6 +1341,8 @@
if (docs != null) gen.writeDocs(docs);
gen.write('class ${name} ');
if (superName != null) gen.write('extends ${superName} ');
+ if (parent.getType('${name}Ref') != null)
+ gen.write('implements ${name}Ref ');
gen.writeln('{');
gen.writeln('static ${name} parse(Map<String, dynamic> json) => '
'json == null ? null : ${name}._fromJson(json);');
diff --git a/runtime/bin/dfe.cc b/runtime/bin/dfe.cc
index d2773211..f700d50 100644
--- a/runtime/bin/dfe.cc
+++ b/runtime/bin/dfe.cc
@@ -331,7 +331,7 @@
}
DartUtils::ReadFile(buffer, size, script_file);
DartUtils::CloseFile(script_file);
- if (*size <= 0 || buffer == nullptr) {
+ if (buffer == nullptr) {
return false;
}
return true;
diff --git a/runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc b/runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
index 7ecc222..9ce7d9e 100644
--- a/runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
+++ b/runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
@@ -270,6 +270,34 @@
#endif // defined(TARGET_OS_LINUX)
////////////////////////////////////////////////////////////////////////////////
+// Dynamic linking of dart_native_api.h for the next two samples.
+typedef bool (*Dart_PostCObjectType)(Dart_Port port_id, Dart_CObject* message);
+Dart_PostCObjectType Dart_PostCObject_ = nullptr;
+
+DART_EXPORT void RegisterDart_PostCObject(
+ Dart_PostCObjectType function_pointer) {
+ Dart_PostCObject_ = function_pointer;
+}
+
+typedef Dart_Port (*Dart_NewNativePortType)(const char* name,
+ Dart_NativeMessageHandler handler,
+ bool handle_concurrently);
+Dart_NewNativePortType Dart_NewNativePort_ = nullptr;
+
+DART_EXPORT void RegisterDart_NewNativePort(
+ Dart_NewNativePortType function_pointer) {
+ Dart_NewNativePort_ = function_pointer;
+}
+
+typedef bool (*Dart_CloseNativePortType)(Dart_Port native_port_id);
+Dart_CloseNativePortType Dart_CloseNativePort_ = nullptr;
+
+DART_EXPORT void RegisterDart_CloseNativePort(
+ Dart_CloseNativePortType function_pointer) {
+ Dart_CloseNativePort_ = function_pointer;
+}
+
+////////////////////////////////////////////////////////////////////////////////
// Functions for async callbacks example.
//
// sample_async_callback.dart
@@ -314,7 +342,7 @@
dart_object.type = Dart_CObject_kInt64;
dart_object.value.as_int64 = work_addr;
- const bool result = Dart_PostCObject(send_port, &dart_object);
+ const bool result = Dart_PostCObject_(send_port, &dart_object);
if (!result) {
FATAL("C : Posting message to port failed.");
}
@@ -476,16 +504,16 @@
PendingCall(void** buffer, size_t* length)
: response_buffer_(buffer), response_length_(length) {
receive_port_ =
- Dart_NewNativePort("cpp-response", &PendingCall::HandleResponse,
- /*handle_concurrently=*/false);
+ Dart_NewNativePort_("cpp-response", &PendingCall::HandleResponse,
+ /*handle_concurrently=*/false);
}
- ~PendingCall() { Dart_CloseNativePort(receive_port_); }
+ ~PendingCall() { Dart_CloseNativePort_(receive_port_); }
Dart_Port port() const { return receive_port_; }
void PostAndWait(Dart_Port port, Dart_CObject* object) {
std::unique_lock<std::mutex> lock(mutex);
- const bool success = Dart_PostCObject(send_port_, object);
+ const bool success = Dart_PostCObject_(send_port_, object);
if (!success) FATAL("Failed to send message, invalid port or isolate died");
printf("C : Waiting for result.\n");
@@ -589,7 +617,7 @@
c_request.value.as_array.length =
sizeof(c_request_arr) / sizeof(c_request_arr[0]);
- printf("C : Dart_PostCObject(request: %" Px ", call: %" Px ").\n",
+ printf("C : Dart_PostCObject_(request: %" Px ", call: %" Px ").\n",
reinterpret_cast<intptr_t>(&c_request),
reinterpret_cast<intptr_t>(&c_pending_call));
pending_call.PostAndWait(send_port_, &c_request);
@@ -637,10 +665,10 @@
c_request.value.as_array.length =
sizeof(c_request_arr) / sizeof(c_request_arr[0]);
- printf("C : Dart_PostCObject(request: %" Px ", call: %" Px ").\n",
+ printf("C : Dart_PostCObject_(request: %" Px ", call: %" Px ").\n",
reinterpret_cast<intptr_t>(&c_request),
reinterpret_cast<intptr_t>(&c_pending_call));
- Dart_PostCObject(send_port_, &c_request);
+ Dart_PostCObject_(send_port_, &c_request);
}
// Simulated work for Thread #1.
diff --git a/runtime/bin/io_buffer.cc b/runtime/bin/io_buffer.cc
index b213a85..c0e8066 100644
--- a/runtime/bin/io_buffer.cc
+++ b/runtime/bin/io_buffer.cc
@@ -4,6 +4,8 @@
#include "bin/io_buffer.h"
+#include "platform/memory_sanitizer.h"
+
namespace dart {
namespace bin {
@@ -26,7 +28,7 @@
}
uint8_t* IOBuffer::Allocate(intptr_t size) {
- return reinterpret_cast<uint8_t*>(malloc(size));
+ return reinterpret_cast<uint8_t*>(calloc(size, sizeof(uint8_t)));
}
} // namespace bin
diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc
index 6e003c3..6868012 100644
--- a/runtime/bin/loader.cc
+++ b/runtime/bin/loader.cc
@@ -85,6 +85,7 @@
const char* path = DartUtils::RemoveScheme(url_string);
if (!File::IsAbsolutePath(path) && PathContainsSeparator(path)) {
+ free(lib_path);
return DartUtils::NewError(
"Native extension path must be absolute, or simply the file name: %s",
path);
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 98d5974..6624a4e 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -267,14 +267,6 @@
if (Dart_IsError(result)) goto failed;
}
- if (Options::gen_snapshot_kind() == kAppJIT) {
- // If we sort, we must do it for all isolates, not just the main isolate,
- // otherwise isolates related by spawnFunction will disagree on CIDs and
- // cannot correctly send each other messages.
- result = Dart_SortClasses();
- if (Dart_IsError(result)) goto failed;
- }
-
// Make the isolate runnable so that it is ready to handle messages.
Dart_ExitScope();
Dart_ExitIsolate();
diff --git a/runtime/bin/process_android.cc b/runtime/bin/process_android.cc
index bd539e8..44df4d6 100644
--- a/runtime/bin/process_android.cc
+++ b/runtime/bin/process_android.cc
@@ -1027,9 +1027,6 @@
}
void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) {
- // Either the port is illegal or there is no current isolate, but not both.
- ASSERT((port != ILLEGAL_PORT) || (Dart_CurrentIsolate() == NULL));
- ASSERT((port == ILLEGAL_PORT) || (Dart_CurrentIsolate() != NULL));
ThreadSignalBlocker blocker(kSignalsCount, kSignals);
MutexLocker lock(signal_mutex);
SignalInfo* handler = signal_handlers;
diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc
index f6ec06d..5d82e1b 100644
--- a/runtime/bin/process_linux.cc
+++ b/runtime/bin/process_linux.cc
@@ -1023,9 +1023,6 @@
}
void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) {
- // Either the port is illegal or there is no current isolate, but not both.
- ASSERT((port != ILLEGAL_PORT) || (Dart_CurrentIsolate() == NULL));
- ASSERT((port == ILLEGAL_PORT) || (Dart_CurrentIsolate() != NULL));
ThreadSignalBlocker blocker(kSignalsCount, kSignals);
MutexLocker lock(signal_mutex);
SignalInfo* handler = signal_handlers;
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc
index 0f9287b..536b1b3 100644
--- a/runtime/bin/process_macos.cc
+++ b/runtime/bin/process_macos.cc
@@ -1055,9 +1055,6 @@
}
void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) {
- // Either the port is illegal or there is no current isolate, but not both.
- ASSERT((port != ILLEGAL_PORT) || (Dart_CurrentIsolate() == NULL));
- ASSERT((port == ILLEGAL_PORT) || (Dart_CurrentIsolate() != NULL));
signal = SignalMap(signal);
if (signal == -1) {
return;
diff --git a/runtime/bin/secure_socket_filter.cc b/runtime/bin/secure_socket_filter.cc
index bcb9bee..d61c5cb 100644
--- a/runtime/bin/secure_socket_filter.cc
+++ b/runtime/bin/secure_socket_filter.cc
@@ -375,6 +375,7 @@
int size = IsBufferEncrypted(i) ? encrypted_buffer_size_ : buffer_size_;
buffers_[i] = new uint8_t[size];
ASSERT(buffers_[i] != NULL);
+ memset(buffers_[i], 0, size);
dart_buffer_objects_[i] = NULL;
}
diff --git a/runtime/lib/ffi.cc b/runtime/lib/ffi.cc
index ad933c8..f96a125 100644
--- a/runtime/lib/ffi.cc
+++ b/runtime/lib/ffi.cc
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
#include "include/dart_api.h"
+#include "include/dart_native_api.h"
#include "platform/globals.h"
#include "vm/bootstrap_natives.h"
#include "vm/class_finalizer.h"
@@ -492,4 +493,21 @@
return Pointer::New(type_arg, entry_point);
}
+DEFINE_NATIVE_ENTRY(NativeApiFunctionPointer, 0, 1) {
+ GET_NON_NULL_NATIVE_ARGUMENT(String, name_dart, arguments->NativeArgAt(0));
+ const char* name = name_dart.ToCString();
+
+ if (strcmp(name, "Dart_PostCObject") == 0) {
+ return Integer::New(reinterpret_cast<int64_t>(Dart_PostCObject));
+ } else if (strcmp(name, "Dart_NewNativePort") == 0) {
+ return Integer::New(reinterpret_cast<int64_t>(Dart_NewNativePort));
+ } else if (strcmp(name, "Dart_CloseNativePort") == 0) {
+ return Integer::New(reinterpret_cast<int64_t>(Dart_CloseNativePort));
+ }
+
+ const String& error = String::Handle(
+ String::NewFormatted("Unknown dart_native_api.h symbol: %s.", name));
+ Exceptions::ThrowArgumentError(error);
+}
+
} // namespace dart
diff --git a/runtime/observatory/lib/src/app/page.dart b/runtime/observatory/lib/src/app/page.dart
index d55dc86..5018e02 100644
--- a/runtime/observatory/lib/src/app/page.dart
+++ b/runtime/observatory/lib/src/app/page.dart
@@ -172,8 +172,14 @@
app.vm.reload().then((serviceObject) {
VM vm = serviceObject;
container.children = <Element>[
- new VMViewElement(vm, _vmrepository, app.events, app.notifications,
- new IsolateRepository(app.vm), _scriptRepository,
+ new VMViewElement(
+ vm,
+ _vmrepository,
+ app.events,
+ app.notifications,
+ new IsolateRepository(app.vm),
+ new IsolateGroupRepository(app.vm),
+ _scriptRepository,
queue: app.queue)
.element
];
diff --git a/runtime/observatory/lib/src/elements/css/shared.css b/runtime/observatory/lib/src/elements/css/shared.css
index da445fe..255ea65 100644
--- a/runtime/observatory/lib/src/elements/css/shared.css
+++ b/runtime/observatory/lib/src/elements/css/shared.css
@@ -145,6 +145,20 @@
flex-wrap: wrap;
}
+.flex-row-wrap-right {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: flex-end;
+}
+
+.flex-row-spaced {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ flex-wrap: wrap;
+}
+
.inline-flex-row {
display: inline-flex;
flex-direction: row;
@@ -283,6 +297,12 @@
flex-basis: 90%;
}
+.flex-item-even {
+ flex-grow: 1;
+ flex-shrink: 0;
+ padding: 5px;
+}
+
.indent {
margin-left: 1.5em;
font: 400 14px 'Montserrat', sans-serif;
@@ -1506,11 +1526,12 @@
.isolate-ref-container {
overflow: hidden;
text-overflow: ellipsis;
+ padding: 5px;
+ font-weight: bolder;
}
.isolate-state-container {
display: inline-block;
- min-width: 18ex;
}
.isolate-shared-summary > .summary {
diff --git a/runtime/observatory/lib/src/elements/isolate/shared_summary.dart b/runtime/observatory/lib/src/elements/isolate/shared_summary.dart
index 652c96c..89be826 100644
--- a/runtime/observatory/lib/src/elements/isolate/shared_summary.dart
+++ b/runtime/observatory/lib/src/elements/isolate/shared_summary.dart
@@ -91,7 +91,8 @@
new DivElement()
..children = <Element>[
new SpanElement()..text = 'see ',
- new AnchorElement(href: Uris.debugger(_isolate))..text = 'debug'
+ new AnchorElement(href: Uris.debugger(_isolate))
+ ..text = 'debugger'
],
new DivElement()
..children = <Element>[
diff --git a/runtime/observatory/lib/src/elements/isolate/summary.dart b/runtime/observatory/lib/src/elements/isolate/summary.dart
index 88c91a0..1ecd032 100644
--- a/runtime/observatory/lib/src/elements/isolate/summary.dart
+++ b/runtime/observatory/lib/src/elements/isolate/summary.dart
@@ -5,6 +5,7 @@
import 'dart:html';
import 'dart:async';
import 'package:observatory/models.dart' as M;
+import 'package:observatory/utils.dart';
import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
import 'package:observatory/src/elements/helpers/tag.dart';
import 'package:observatory/src/elements/helpers/uris.dart';
@@ -75,37 +76,111 @@
];
} else {
children = <Element>[
- new DivElement()
- ..classes = ['flex-row']
- ..children = <Element>[
- new DivElement()
- ..classes = ['isolate-ref-container']
- ..children = <Element>[
- new IsolateRefElement(_isolate, _events, queue: _r.queue)
- .element
- ],
- new DivElement()..style.flex = '1',
- new DivElement()
- ..classes = ['flex-row', 'isolate-state-container']
- ..children = <Element>[
- new IsolateRunStateElement(_isolate, _events, queue: _r.queue)
- .element,
- new IsolateLocationElement(_isolate, _events, _scripts,
- queue: _r.queue)
- .element,
- new SpanElement()..text = ' [',
- new AnchorElement(href: Uris.debugger(_isolate))
- ..text = 'debug',
- new SpanElement()..text = ']'
- ]
- ],
+ linkAndStatusRow(),
new BRElement(),
- new IsolateSharedSummaryElement(_isolate, _events, queue: _r.queue)
- .element
+ memoryRow(),
+ new BRElement(),
+ toolsRow(),
];
}
}
+ Element linkAndStatusRow() {
+ return new DivElement()
+ ..classes = ['flex-row-wrap']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['isolate-ref-container']
+ ..children = <Element>[
+ new IsolateRefElement(_isolate, _events, queue: _r.queue).element
+ ],
+ new DivElement()..style.flex = '1',
+ new DivElement()
+ ..classes = ['flex-row', 'isolate-state-container']
+ ..children = <Element>[
+ new IsolateRunStateElement(_isolate, _events, queue: _r.queue)
+ .element,
+ new IsolateLocationElement(_isolate, _events, _scripts,
+ queue: _r.queue)
+ .element,
+ new SpanElement()..text = ' [',
+ new AnchorElement(href: Uris.debugger(_isolate))..text = 'debug',
+ new SpanElement()..text = ']'
+ ]
+ ];
+ }
+
+ Element memoryRow() {
+ final isolate = _isolate as M.Isolate;
+ final newHeapUsed = Utils.formatSize(isolate.newSpace.used);
+ final newHeapCapacity = Utils.formatSize(isolate.newSpace.capacity);
+ final oldHeapUsed = Utils.formatSize(isolate.oldSpace.used);
+ final oldHeapCapacity = Utils.formatSize(isolate.oldSpace.capacity);
+ final heapUsed =
+ Utils.formatSize(isolate.newSpace.used + isolate.oldSpace.used);
+ final heapCapacity =
+ Utils.formatSize(isolate.newSpace.capacity + isolate.oldSpace.capacity);
+ return new DivElement()
+ ..classes = ['flex-row-wrap-right']
+ ..children = <Element>[
+ new DivElement()
+ ..style.padding = '5px'
+ ..text = 'new-space $newHeapUsed of $newHeapCapacity',
+ new DivElement()
+ ..style.padding = '5px'
+ ..text = '/',
+ new DivElement()
+ ..style.padding = '5px'
+ ..text = 'old-space $oldHeapUsed of $oldHeapCapacity',
+ new DivElement()
+ ..style.padding = '5px'
+ ..text = '/',
+ new DivElement()
+ ..style.padding = '5px'
+ ..text = 'heap $heapUsed of $heapCapacity',
+ ];
+ }
+
+ Element toolsRow() {
+ return new DivElement()
+ ..classes = ['flex-row-spaced']
+ ..children = <Element>[
+ new AnchorElement(href: Uris.debugger(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'debugger',
+ new AnchorElement(href: Uris.classTree(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'class hierarchy',
+ new AnchorElement(href: Uris.cpuProfiler(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'cpu profile',
+ new AnchorElement(href: Uris.cpuProfilerTable(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'cpu profile (table)',
+ new AnchorElement(href: Uris.allocationProfiler(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'allocation profile',
+ new AnchorElement(href: Uris.heapSnapshot(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'heap snapshot',
+ new AnchorElement(href: Uris.heapMap(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'heap map',
+ new AnchorElement(href: Uris.metrics(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'metrics',
+ new AnchorElement(href: Uris.persistentHandles(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'persistent handles',
+ new AnchorElement(href: Uris.ports(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'ports',
+ new AnchorElement(href: Uris.logging(_isolate))
+ ..classes = ['flex-item-even']
+ ..text = 'logging',
+ ];
+ }
+
Future _load() async {
_loadedIsolate = await _isolates.get(_isolate);
_r.dirty();
diff --git a/runtime/observatory/lib/src/elements/vm_view.dart b/runtime/observatory/lib/src/elements/vm_view.dart
index f5f5609..100d0b9 100644
--- a/runtime/observatory/lib/src/elements/vm_view.dart
+++ b/runtime/observatory/lib/src/elements/vm_view.dart
@@ -38,6 +38,7 @@
M.EventRepository _events;
M.NotificationRepository _notifications;
M.IsolateRepository _isolates;
+ M.IsolateGroupRepository _isolateGroups;
M.ScriptRepository _scripts;
StreamSubscription _vmSubscription;
StreamSubscription _startSubscription;
@@ -52,6 +53,7 @@
M.EventRepository events,
M.NotificationRepository notifications,
M.IsolateRepository isolates,
+ M.IsolateGroupRepository isolateGroups,
M.ScriptRepository scripts,
{RenderingQueue queue}) {
assert(vm != null);
@@ -67,6 +69,7 @@
e._events = events;
e._notifications = notifications;
e._isolates = isolates;
+ e._isolateGroups = isolateGroups;
e._scripts = scripts;
return e;
}
@@ -83,6 +86,7 @@
});
_startSubscription = _events.onIsolateStart.listen((_) => _r.dirty());
_exitSubscription = _events.onIsolateExit.listen((_) => _r.dirty());
+ _loadExtraData();
}
@override
@@ -95,9 +99,14 @@
_exitSubscription.cancel();
}
+ Future _loadExtraData() async {
+ for (var group in _vm.isolateGroups) {
+ await _isolateGroups.get(group);
+ }
+ _r.dirty();
+ }
+
void render() {
- final uptime = new DateTime.now().difference(_vm.startTime);
- final isolates = _vm.isolates.toList();
children = <Element>[
navBar(<Element>[
new NavTopMenuElement(queue: _r.queue).element,
@@ -106,201 +115,223 @@
..onRefresh.listen((e) async {
e.element.disabled = true;
_vm = await _vms.get(_vm);
+ _loadExtraData();
_r.dirty();
}))
.element,
new NavNotifyElement(_notifications, queue: _r.queue).element
]),
- new DivElement()
- ..classes = ['content-centered-big']
- ..children = <HtmlElement>[
- new HeadingElement.h1()..text = 'VM',
- new HRElement(),
- new DivElement()
- ..classes = ['memberList']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'name',
- new DivElement()
- ..classes = ['memberValue']
- ..text = _vm.displayName
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'version',
- new DivElement()
- ..classes = ['memberValue']
- ..text = _vm.version
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'embedder',
- new DivElement()
- ..classes = ['memberValue']
- ..text = _vm.embedder ?? "UNKNOWN"
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'started at',
- new DivElement()
- ..classes = ['memberValue']
- ..text = '${_vm.startTime}'
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'uptime',
- new DivElement()
- ..classes = ['memberValue']
- ..text = '$uptime'
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'refreshed at',
- new DivElement()
- ..classes = ['memberValue']
- ..text = '${new DateTime.now()}'
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'pid',
- new DivElement()
- ..classes = ['memberValue']
- ..text = '${_vm.pid}'
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'peak memory',
- new DivElement()
- ..classes = ['memberValue']
- ..text = _vm.maxRSS != null
- ? Utils.formatSize(_vm.maxRSS)
- : "unavailable"
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'current memory',
- new DivElement()
- ..classes = ['memberValue']
- ..text = _vm.currentRSS != null
- ? Utils.formatSize(_vm.currentRSS)
- : "unavailable"
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'native zone memory',
- new DivElement()
- ..classes = ['memberValue']
- ..text = Utils.formatSize(_vm.nativeZoneMemoryUsage)
- ..title = '${_vm.nativeZoneMemoryUsage} bytes'
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'native heap memory',
- new DivElement()
- ..classes = ['memberValue']
- ..text = _vm.heapAllocatedMemoryUsage != null
- ? Utils.formatSize(_vm.heapAllocatedMemoryUsage)
- : 'unavailable'
- ..title = _vm.heapAllocatedMemoryUsage != null
- ? '${_vm.heapAllocatedMemoryUsage} bytes'
- : null
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..text = 'native heap allocation count',
- new DivElement()
- ..classes = ['memberValue']
- ..text = _vm.heapAllocationCount != null
- ? '${_vm.heapAllocationCount}'
- : 'unavailable'
- ],
- new BRElement(),
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..children = <Element>[
- new SpanElement()..text = 'see ',
- new AnchorElement(href: Uris.flags())..text = 'flags'
- ],
- new DivElement()
- ..classes = ['memberValue']
- ..children = <Element>[
- new SpanElement()..text = 'view ',
- new AnchorElement(href: Uris.timeline())
- ..text = 'timeline'
- ]
- ],
- new DivElement()
- ..classes = ['memberItem']
- ..children = <Element>[
- new DivElement()
- ..classes = ['memberName']
- ..children = <Element>[
- new SpanElement()..text = 'view ',
- new AnchorElement(href: Uris.nativeMemory())
- ..text = 'native memory profile'
- ]
- ]
- ],
- new BRElement(),
- new HeadingElement.h1()..text = 'Isolates (${isolates.length})',
- new HRElement(),
- new UListElement()
- ..classes = ['list-group']
- ..children = isolates
- .expand((i) => <Element>[
- new LIElement()
- ..classes = ['list-group-item']
- ..children = <Element>[
- new IsolateSummaryElement(
- i, _isolates, _events, _scripts,
- queue: _r.queue)
- .element
- ],
- new HRElement()
- ])
- .toList(),
- new ViewFooterElement(queue: _r.queue).element
- ]
+ describeVM(),
+ describeIsolateGroups(),
+ new ViewFooterElement(queue: _r.queue).element
];
}
+
+ Element describeVM() {
+ final uptime = new DateTime.now().difference(_vm.startTime);
+ return new DivElement()
+ ..classes = ['content-centered-big']
+ ..children = <HtmlElement>[
+ new HeadingElement.h1()..text = 'VM',
+ new DivElement()
+ ..classes = ['memberList']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'name',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = _vm.displayName
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'version',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = _vm.version
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'embedder',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = _vm.embedder ?? "UNKNOWN"
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'started at',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = '${_vm.startTime}'
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'uptime',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = '$uptime'
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'refreshed at',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = '${new DateTime.now()}'
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'pid',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = '${_vm.pid}'
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'peak memory',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = _vm.maxRSS != null
+ ? Utils.formatSize(_vm.maxRSS)
+ : "unavailable"
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'current memory',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = _vm.currentRSS != null
+ ? Utils.formatSize(_vm.currentRSS)
+ : "unavailable"
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'native zone memory',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = Utils.formatSize(_vm.nativeZoneMemoryUsage)
+ ..title = '${_vm.nativeZoneMemoryUsage} bytes'
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'native heap memory',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = _vm.heapAllocatedMemoryUsage != null
+ ? Utils.formatSize(_vm.heapAllocatedMemoryUsage)
+ : 'unavailable'
+ ..title = _vm.heapAllocatedMemoryUsage != null
+ ? '${_vm.heapAllocatedMemoryUsage} bytes'
+ : null
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..text = 'native heap allocation count',
+ new DivElement()
+ ..classes = ['memberValue']
+ ..text = _vm.heapAllocationCount != null
+ ? '${_vm.heapAllocationCount}'
+ : 'unavailable'
+ ],
+ new BRElement(),
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..children = <Element>[
+ new SpanElement()..text = 'see ',
+ new AnchorElement(href: Uris.flags())..text = 'flags'
+ ],
+ new DivElement()
+ ..classes = ['memberValue']
+ ..children = <Element>[
+ new SpanElement()..text = 'view ',
+ new AnchorElement(href: Uris.timeline())..text = 'timeline'
+ ]
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = <Element>[
+ new DivElement()
+ ..classes = ['memberName']
+ ..children = <Element>[
+ new SpanElement()..text = 'view ',
+ new AnchorElement(href: Uris.nativeMemory())
+ ..text = 'native memory profile'
+ ]
+ ]
+ ],
+ new BRElement(),
+ ];
+ }
+
+ Element describeIsolateGroups() {
+ final isolateGroups = _vm.isolateGroups.toList();
+ return new DivElement()
+ ..children = isolateGroups.map(describeIsolateGroup).toList();
+ }
+
+ Element describeIsolateGroup(M.IsolateGroupRef group) {
+ final isolates = (group as M.IsolateGroup).isolates;
+ return new DivElement()
+ ..classes = ['content-centered-big']
+ ..children = <Element>[
+ new HRElement(),
+ new HeadingElement.h1()
+ ..text = "Isolate Group ${group.number} (${group.name})",
+ new LIElement()
+ ..classes = ['list-group-item']
+ ..children = <Element>[
+ new UListElement()
+ ..classes = ['list-group']
+ ..children = isolates.map(describeIsolate).toList(),
+ ],
+ ];
+ }
+
+ Element describeIsolate(M.IsolateRef isolate) {
+ return new LIElement()
+ ..classes = ['list-group-item']
+ ..children = <Element>[
+ new IsolateSummaryElement(isolate, _isolates, _events, _scripts,
+ queue: _r.queue)
+ .element
+ ];
+ }
}
diff --git a/runtime/observatory/lib/src/repositories/timeline_base.dart b/runtime/observatory/lib/src/repositories/timeline_base.dart
index 8fde0d7..6f12bc0 100644
--- a/runtime/observatory/lib/src/repositories/timeline_base.dart
+++ b/runtime/observatory/lib/src/repositories/timeline_base.dart
@@ -14,11 +14,11 @@
static const kTimeOriginMicros = 'timeOriginMicros';
static const kTimeExtentMicros = 'timeExtentMicros';
- Future<void> _formatSamples(
- M.Isolate isolate, Map traceObject, S.ServiceMap cpuSamples) async {
+ Future<void> _formatSamples(M.Isolate isolate, Map traceObject,
+ Future<S.ServiceObject> cpuSamples) async {
const kRootFrameId = 0;
final profile = SampleProfile();
- await profile.load(isolate as S.ServiceObjectOwner, cpuSamples);
+ await profile.load(isolate as S.ServiceObjectOwner, await cpuSamples);
final trie = profile.loadFunctionTree(M.ProfileTreeDirection.inclusive);
final root = trie.root;
int nextId = kRootFrameId;
@@ -66,24 +66,20 @@
Future<Map> getCpuProfileTimeline(M.VMRef ref,
{int timeOriginMicros, int timeExtentMicros}) async {
final S.VM vm = ref as S.VM;
- final sampleRequests = <Future>[];
-
- for (final isolate in vm.isolates) {
- sampleRequests.add(vm.invokeRpc('getCpuSamples', {
- 'isolateId': isolate.id,
- if (timeOriginMicros != null) kTimeOriginMicros: timeOriginMicros,
- if (timeExtentMicros != null) kTimeExtentMicros: timeExtentMicros,
- }));
- }
-
- final completed = await Future.wait(sampleRequests);
final traceObject = <String, dynamic>{
_kStackFrames: {},
_kTraceEvents: [],
};
- for (int i = 0; i < vm.isolates.length; ++i) {
- await _formatSamples(vm.isolates[i], traceObject, completed[i]);
- }
+
+ await Future.wait(vm.isolates.map((isolate) {
+ final samples = vm.invokeRpc('getCpuSamples', {
+ 'isolateId': isolate.id,
+ if (timeOriginMicros != null) kTimeOriginMicros: timeOriginMicros,
+ if (timeExtentMicros != null) kTimeExtentMicros: timeExtentMicros,
+ });
+ return _formatSamples(isolate, traceObject, samples);
+ }));
+
return traceObject;
}
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index eea85a8..dcbe861 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -1291,6 +1291,7 @@
@override
void _update(Map map, bool mapIsRef) {
+ _upgradeCollection(map, vm);
name = map['name'];
vmName = map.containsKey('_vmName') ? map['_vmName'] : name;
number = int.tryParse(map['number']);
@@ -1299,7 +1300,9 @@
}
_loaded = true;
isolates.clear();
- isolates.addAll(map['isolates'] as List<Isolate>);
+ for (var isolate in map['isolates']) {
+ isolates.add(isolate);
+ }
isolates.sort(ServiceObject.LexicalSortName);
vm._buildIsolateGroupList();
}
diff --git a/runtime/observatory/tests/service/get_version_rpc_test.dart b/runtime/observatory/tests/service/get_version_rpc_test.dart
index 889c1b0..4503f6e 100644
--- a/runtime/observatory/tests/service/get_version_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_version_rpc_test.dart
@@ -12,7 +12,7 @@
var result = await vm.invokeRpcNoUpgrade('getVersion', {});
expect(result['type'], equals('Version'));
expect(result['major'], equals(3));
- expect(result['minor'], equals(29));
+ expect(result['minor'], equals(30));
expect(result['_privateMajor'], equals(0));
expect(result['_privateMinor'], equals(0));
},
diff --git a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
index a5fec01..f68010b 100644
--- a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
@@ -110,7 +110,10 @@
}
Map arguments = event['args'];
expect(arguments, new isInstanceOf<Map>());
- expect(arguments['isolateId'], new isInstanceOf<String>());
+ expect(arguments['isolateGroupId'], new isInstanceOf<String>());
+ if (event['cat'] != 'GC') {
+ expect(arguments['isolateId'], new isInstanceOf<String>());
+ }
}
}
diff --git a/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart b/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart
index ef499e1..d4d5467 100644
--- a/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart
@@ -12,7 +12,7 @@
isInstanceOf<int> isInt = new isInstanceOf<int>();
// Just iterate over all the isolates to confirm they have
// the correct fields needed to examine zone memory usage.
- for (Isolate isolate in vm.isolates) {
+ for (Isolate isolate in new List.from(vm.isolates)) {
await isolate.reload();
expect(isolate.zoneHighWatermark, isInt);
expect(isolate.threads, isNotNull);
diff --git a/runtime/platform/assert.h b/runtime/platform/assert.h
index d8bd4a4..6b5d634 100644
--- a/runtime/platform/assert.h
+++ b/runtime/platform/assert.h
@@ -64,14 +64,11 @@
template <typename E, typename A, typename T>
void FloatEquals(const E& expected, const A& actual, const T& tol);
- template <typename E, typename A>
- void StringEquals(const E& expected, const A& actual);
+ void StringEquals(const char* expected, const char* actual);
- template <typename E, typename A>
- void IsSubstring(const E& needle, const A& haystack);
+ void IsSubstring(const char* needle, const char* haystack);
- template <typename E, typename A>
- void IsNotSubstring(const E& needle, const A& haystack);
+ void IsNotSubstring(const char* needle, const char* haystack);
template <typename E, typename A>
void LessThan(const E& left, const A& right);
@@ -141,39 +138,19 @@
tols.c_str());
}
-template <typename E, typename A>
-NO_SANITIZE_MEMORY void Expect::StringEquals(const E& expected,
- const A& actual) {
- std::ostringstream ess, ass;
- ess << expected;
- ass << actual;
- std::string es = ess.str(), as = ass.str();
- if (as == es) return;
- Fail("expected:\n<\"%s\">\nbut was:\n<\"%s\">", es.c_str(), as.c_str());
+inline void Expect::StringEquals(const char* expected, const char* actual) {
+ if (strcmp(expected, actual) == 0) return;
+ Fail("expected:\n<\"%s\">\nbut was:\n<\"%s\">", expected, actual);
}
-template <typename E, typename A>
-NO_SANITIZE_MEMORY void Expect::IsSubstring(const E& needle,
- const A& haystack) {
- std::ostringstream ess, ass;
- ess << needle;
- ass << haystack;
- std::string es = ess.str(), as = ass.str();
- if (as.find(es) != std::string::npos) return;
- Fail("expected <\"%s\"> to be a substring of <\"%s\">", es.c_str(),
- as.c_str());
+inline void Expect::IsSubstring(const char* needle, const char* haystack) {
+ if (strstr(haystack, needle) != nullptr) return;
+ Fail("expected <\"%s\"> to be a substring of <\"%s\">", needle, haystack);
}
-template <typename E, typename A>
-NO_SANITIZE_MEMORY void Expect::IsNotSubstring(const E& needle,
- const A& haystack) {
- std::ostringstream ess, ass;
- ess << needle;
- ass << haystack;
- std::string es = ess.str(), as = ass.str();
- if (as.find(es) == std::string::npos) return;
- Fail("expected <\"%s\"> to not be a substring of <\"%s\">", es.c_str(),
- as.c_str());
+inline void Expect::IsNotSubstring(const char* needle, const char* haystack) {
+ if (strstr(haystack, needle) == nullptr) return;
+ Fail("expected <\"%s\"> to not be a substring of <\"%s\">", needle, haystack);
}
template <typename E, typename A>
diff --git a/runtime/platform/memory_sanitizer.h b/runtime/platform/memory_sanitizer.h
index 402bdcb..ee2633f 100644
--- a/runtime/platform/memory_sanitizer.h
+++ b/runtime/platform/memory_sanitizer.h
@@ -13,8 +13,11 @@
#if __has_feature(memory_sanitizer)
extern "C" void __msan_poison(const volatile void*, size_t);
extern "C" void __msan_unpoison(const volatile void*, size_t);
+extern "C" void __msan_check_mem_is_initialized(const volatile void*, size_t);
#define MSAN_POISON(ptr, len) __msan_poison(ptr, len)
#define MSAN_UNPOISON(ptr, len) __msan_unpoison(ptr, len)
+#define MSAN_CHECK_INITIALIZED(ptr, len) \
+ __msan_check_mem_is_initialized(ptr, len)
#define NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory")))
#else // __has_feature(memory_sanitizer)
#define MSAN_POISON(ptr, len) \
@@ -23,6 +26,9 @@
#define MSAN_UNPOISON(ptr, len) \
do { \
} while (false && (ptr) == 0 && (len) == 0)
+#define MSAN_CHECK_INITIALIZED(ptr, len) \
+ do { \
+ } while (false && (ptr) == 0 && (len) == 0)
#define NO_SANITIZE_MEMORY
#endif // __has_feature(memory_sanitizer)
#else // defined(__has_feature)
@@ -32,6 +38,9 @@
#define MSAN_UNPOISON(ptr, len) \
do { \
} while (false && (ptr) == 0 && (len) == 0)
+#define MSAN_CHECK_INITIALIZED(ptr, len) \
+ do { \
+ } while (false && (ptr) == 0 && (len) == 0)
#define NO_SANITIZE_MEMORY
#endif // defined(__has_feature)
diff --git a/runtime/tests/vm/dart/data_uri_spawn_test.dart b/runtime/tests/vm/dart/data_uri_spawn_test.dart
index 4d2d023..3e045a9 100644
--- a/runtime/tests/vm/dart/data_uri_spawn_test.dart
+++ b/runtime/tests/vm/dart/data_uri_spawn_test.dart
@@ -3,7 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
import "dart:isolate";
-import "package:unittest/unittest.dart";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
Uri toDartDataUri(String source) {
return Uri.parse("data:application/dart;charset=utf-8,"
@@ -11,19 +13,19 @@
}
main() {
- test('Simple response', () {
- String source = """
+ String source = """
import "dart:isolate";
main(List args, SendPort replyPort) {
- replyPort.send(42);
+replyPort.send(42);
}
""";
- RawReceivePort receivePort;
- receivePort = new RawReceivePort(expectAsync((message) {
- expect(message, equals(42));
- receivePort.close();
- }));
- Isolate.spawnUri(toDartDataUri(source), [], receivePort.sendPort);
+ RawReceivePort receivePort;
+ asyncStart();
+ receivePort = new RawReceivePort((message) {
+ Expect.equals(message, 42);
+ receivePort.close();
+ asyncEnd();
});
+ Isolate.spawnUri(toDartDataUri(source), [], receivePort.sendPort);
}
diff --git a/runtime/tests/vm/dart/regress_40462_test.dart b/runtime/tests/vm/dart/regress_40462_test.dart
new file mode 100644
index 0000000..d4e9122
--- /dev/null
+++ b/runtime/tests/vm/dart/regress_40462_test.dart
@@ -0,0 +1,1300 @@
+// Copyright (c) 2020, 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.
+
+// Regression test for https://github.com/dart-lang/sdk/issues/40462
+// VMOptions=--deoptimize_every=140 --optimization_level=3 --use-slow-path --old_gen_heap_size=128
+
+import 'dart:async';
+import 'dart:cli';
+import 'dart:collection';
+import 'dart:convert';
+import 'dart:core';
+import 'dart:io';
+import 'dart:isolate';
+import 'dart:math';
+import 'dart:typed_data';
+
+Map<int, bool> var0 = {
+ 33: false,
+ 6: true,
+ -9223372028264841217: true,
+ -77: true,
+ -6: false,
+ 2147483649: false
+};
+MapEntry<String, bool> var1 = MapEntry<String, bool>('&8\u{1f600}Z', true);
+Map<int, bool> var2 = {18: true, 16: false, -30: false, -30: true, 41: false};
+Endian var3 = (Endian.host);
+ByteData var4 = ByteData(9);
+Int8List var5 = Int8List(4);
+Uint8List var6 = Uint8List.fromList(
+ Uint8ClampedList.fromList(Int64List.fromList(Uint8List(45))));
+Uint8ClampedList var7 = Uint8ClampedList(4);
+Int16List var8 = Int16List.fromList([-11]);
+Uint16List var9 = Uint16List.fromList(Uint16List.fromList(Uint8List(45)));
+Int32List var10 = Int32List.fromList(Uint16List(14));
+Uint32List var11 = Uint32List.fromList(Int64List.fromList([-8, -95]));
+Int64List var12 = Int64List.fromList(Uint32List(3));
+Uint64List var13 = Uint64List(2);
+Int32x4List var14 = Int32x4List(2);
+Int32x4 var15 = Int32x4.bool(false, true, true, true);
+Deprecated var16 = Deprecated('G');
+Provisional var17 = Provisional();
+bool var18 = bool.fromEnvironment(' 9');
+Duration var19 = new Duration();
+Error var20 = Error();
+AssertionError var21 = AssertionError(49);
+TypeError var22 = TypeError();
+CastError var23 = CastError();
+NullThrownError var24 = new NullThrownError();
+ArgumentError var25 = ArgumentError.value(27, '', 18);
+RangeError var26 = RangeError.index(1, 42, '+m', 'JjY', 46);
+IndexError var27 = IndexError(38, 29, 'R1Z', 'VnR7', 13);
+FallThroughError var28 = new FallThroughError();
+AbstractClassInstantiationError var29 = AbstractClassInstantiationError('Sq');
+UnsupportedError var30 = UnsupportedError('(OXv');
+UnimplementedError var31 = UnimplementedError('Dt)F@\u2665');
+StateError var32 = StateError('y');
+ConcurrentModificationError var33 = ConcurrentModificationError(18);
+OutOfMemoryError var34 = OutOfMemoryError();
+StackOverflowError var35 = StackOverflowError();
+CyclicInitializationError var36 = CyclicInitializationError('0');
+Exception var37 = new Exception(6);
+FormatException var38 = FormatException('w8q', 36, 17);
+IntegerDivisionByZeroException var39 = IntegerDivisionByZeroException();
+int var40 = -97;
+Null var41 = null;
+num var42 = -64;
+RegExp var43 = RegExp('Dr6eaNw');
+String var44 = 'Zgm83P\u2665';
+Runes var45 = Runes('RJ ');
+RuneIterator var46 = RuneIterator.at('\u2665q', 17);
+StringBuffer var47 = StringBuffer(40);
+Symbol var48 = Symbol('sA8');
+Expando<bool> var49 = Expando<bool>('1\u2665&');
+Expando<int> var50 = Expando<int>('6lfPf+');
+Expando<String> var51 = Expando<String>(')L9b7#');
+List<bool> var52 = [false];
+List<int> var53 = [
+ 49,
+ -14,
+ 31,
+ -80,
+ ...[9223372034707292160, 44, 6, 3, -42]
+];
+List<String> var54 = [
+ 'X#',
+ 'DP',
+ 'A\u2665-s4mF',
+ 'l',
+ '9',
+ 'W6\u{1f600}d\u{1f600}'
+];
+Set<bool> var55 = {false, false};
+Set<int> var56 = {-2147483649};
+Set<String> var57 = {
+ '',
+ 'shf!r',
+ '\u{1f600}XCBW6',
+ '\u{1f600}',
+ '1\u{1f600}7FS',
+ 'w@'
+};
+Map<bool, bool> var58 = {
+ false: false,
+ false: true,
+ true: false,
+ true: true,
+ false: false,
+ false: false
+};
+Map<bool, int> var59 = {true: -82, true: -23, false: 22};
+Map<bool, String> var60 = {false: 'nC\u2665', true: '', true: '8+E2G'};
+Map<int, bool> var61 = {22: false, -35: false, 38: false, 2: false};
+Map<int, int> var62 = {38: 48, -3: 45, 47: -9223372032559808511, 2: -73};
+Map<int, String> var63 = {
+ ...{-47: 'Sizqs\u2665', -91: 'd'}
+};
+Map<String, bool> var64 = {
+ '': false,
+ '\u{1f600}\u2665UJe!': true,
+ 'o!n': false,
+ 'Jw\u{1f600}\u{1f600}L': true,
+ 'UL\u2665g-E': true,
+ 'g\u{1f600}Q@': false
+};
+Map<String, int> var65 = {
+ 'TnC2(o': -86,
+ '': 17,
+ '+!\u{1f600}54!6': -62,
+ '': 42,
+ 'm': -54,
+ 'sk&EU\u{1f600}n': 23
+};
+Map<String, String> var66 = {'aTVZDv': '6x\u{1f600}w'};
+MapEntry<bool, bool> var67 = MapEntry<bool, bool>(false, true);
+MapEntry<bool, int> var68 = MapEntry<bool, int>(true, 23);
+MapEntry<bool, String> var69 = new MapEntry<bool, String>(true, '');
+MapEntry<int, bool> var70 = MapEntry<int, bool>(40, false);
+MapEntry<int, int> var71 = MapEntry<int, int>(8, 46);
+MapEntry<int, String> var72 = MapEntry<int, String>(49, 'Ke');
+MapEntry<String, bool> var73 = MapEntry<String, bool>('7p', false);
+MapEntry<String, int> var74 = new MapEntry<String, int>('+&u', 33);
+MapEntry<String, String> var75 = MapEntry<String, String>('1(etj', '@##4jr');
+
+Error foo0(int par1) {
+ if (par1 >= 41) {
+ return var22;
+ }
+ var66.forEach((loc0, loc1) {
+ var32 ??= var32;
+ });
+ {
+ int loc0 = 2;
+ while (--loc0 > 0) {
+ break;
+ }
+ }
+ return new RangeError(47);
+}
+
+Endian foo1(Runes par1, FallThroughError par2, Uint16List par3) {
+ return (Endian.little);
+}
+
+Uint32List foo2(Null par1, String par2, int par3) {
+ if (par3 >= 30) {
+ return (false ? Uint32List.fromList(new Uint32List(30)) : var11);
+ }
+ ((StringBuffer(18)).clear());
+ (RangeError.checkValueInInterval(
+ (true ? (--var40) : 42),
+ (-58 ?? (Float32x4.wxwy as int)),
+ (-((Uint8ClampedList.bytesPerElement as int))),
+ ((var63[26]).substring(30, -4)),
+ var44));
+ return (Uint32List.fromList((List<int>.filled(34, var40))));
+}
+
+extension fooE0 on Runes {
+ Exception foo0_Extension0(
+ Set<String> par1, Expando<int> par2, List<int> par3, int par4) {
+ if (par4 >= 44) {
+ return Exception(35);
+ }
+ {
+ int loc0 = 0;
+ do {
+ if (var18) {
+ return ((!((var58[true]
+ ? var58[((!(((RegExp('F\u2665R')).isDotAll))) || (!(var18)))]
+ : true)))
+ ? ((false ? (var52[(--var40)] ? true : var18) : true)
+ ? FormatException('y5\u{1f600}1XPZ', 45, 39)
+ : Exception(29))
+ : fooE0(var45).foo0_Extension0(
+ {
+ ((true ? var18 : (var64['Xpa'] ? false : var52[var40]))
+ ? ''
+ : 'NDjj\u{1f600}w\u{1f600}'),
+ ('mCOwFm' ?? 'v')
+ },
+ var50,
+ (var6 ??
+ (false ? Uint8List.fromList([(-1 ^ var10[36])]) : var13)),
+ par4 + 1));
+ }
+ } while (++loc0 < 4);
+ }
+
+ for (int loc0 = 0; loc0 < 21; loc0++) {
+ print(MapEntry<bool, bool>(true, true));
+ {
+ int loc1 = 4;
+ while (--loc1 > 0) {
+ var74 ??= MapEntry<String, int>(' ', 35);
+ }
+ }
+ }
+ return fooE0(var45).foo0_Extension0({
+ (var18
+ ? (var64[var54[var7[6]]]
+ ? (var61[6442450945]
+ ? '5zKk&\u{1f600}L'
+ : ('\u2665PpeyDs' ?? 'DSwK\u{1f600}'))
+ : '\u2665iOel1')
+ : 'KF\u{1f600}'),
+ '6x!',
+ var60[(!((false ?? (!(true)))))]
+ }, var50, var9, par4 + 1);
+ }
+}
+
+extension fooE1 on CyclicInitializationError {
+ List<String> foo1_Extension0(
+ FormatException par1, Duration par2, num par3, int par4) {
+ if (par4 >= 41) {
+ return var54;
+ }
+ throw (((!((false ? false : var49[(++var40)])))
+ ? (!(true))
+ : (false
+ ? var52[(var40--)]
+ : (((RegExp('BQ7TD8@')).isCaseSensitive) && true)))
+ ? ((true && var18) ? Symbol('mfQ6U') : Symbol('yr@'))
+ : Symbol('J1'));
+ }
+
+ String foo1_Extension1(StringBuffer par1, Int16List par2, int par3) {
+ if (par3 >= 14) {
+ return var63[var50[
+ ((((false ? {var50[-61]} : var56)).add(par3)) ? 8589934591 : 15)]];
+ }
+ try {
+ return fooE1(var36).foo1_Extension1(par1, par2, par3 + 1);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ switch ((-17 ~/ (true ? (-(var40)) : (-(var42))))) {
+ case 3680904311:
+ {
+ throw (((true || true)
+ ? ([(((var60[var18]).trim()) * 27)] ==
+ ArgumentError.value(37, 'G+cy&', 37))
+ : (!((((var54[(--var40)]).trimRight()) == Provisional()))))
+ ? fooE1(var36).foo1_Extension0(
+ FormatException('y', 31, 49), var19, -4294967296, 0)
+ : var54);
+ break;
+ }
+ case 3680904315:
+ {
+ var51 ??= var51;
+ break;
+ }
+ default:
+ {
+ var66.forEach((loc0, loc1) {
+ var52 = ((!((var42 > var40)))
+ ? var52
+ : [
+ (((var18
+ ? Int32x4.bool(false, false, true, false)
+ : (true ? new Int32x4(13, 16, 20, 25) : var15)))
+ .flagW),
+ var18
+ ]);
+ });
+ break;
+ }
+ }
+ }
+ {
+ int loc0 = 43;
+ while (--loc0 > 0) {
+ (((true
+ ? (true
+ ? {
+ 40: 'nbk',
+ 38: fooE1(var36).foo1_Extension1(var47, var8, par3 + 1)
+ }
+ : var63)
+ : var63))
+ .addAll(var63));
+ try {
+ var58.forEach((loc1, loc2) {
+ /// Single-line documentation comment.
+ throw var68;
+ });
+ {
+ int loc1 = 0;
+ do {
+ var12 = Int64List.fromList(Int8List.fromList(Int64List.fromList(
+ Uint8ClampedList.fromList([var59[true]]))));
+ } while (++loc1 < 3);
+ }
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ return '3';
+ } finally {
+ var24 ??= NullThrownError();
+ }
+ }
+ }
+ return var63[(Int32x4.xxxz as int)];
+ }
+}
+
+extension fooE2 on TypeError {
+ StateError foo2_Extension0(List<String> par1) {
+ var47 = var47;
+ if ((!(var49[((false ? var18 : ((Duration() > var19) ? true : false))
+ ? -25
+ : var40)]))) {
+ if (var49[43]) {
+ var63 = ((((!(true)) ? (8589934591 >= (6442450945 % -14)) : var18) ^
+ (var18
+ ? (((false
+ ? var14[(true ? -9 : var40)]
+ : Int32x4.bool(false, true, true, true)))
+ .flagW)
+ : false))
+ ? (var64['1']
+ ? {
+ (--var40): 'h\u{1f600}E(S@r',
+ (var40++): var63[var6[36]],
+ (--var40): var60[true]
+ }
+ : {
+ ((({((~(var40)) ?? var40): 'dU\u2665nE'}).isNotEmpty)
+ ? -45
+ : var40):
+ var63[(true
+ ? 36
+ : ((var61[var40] ? false : false)
+ ? var40
+ : (~((var40--)))))],
+ (~((Int32x4.zzwz as int))): (true
+ ? var44
+ : (fooE1(var36).foo1_Extension1(var47, var8, 0) +
+ var36.foo1_Extension1(var47, Int16List(18), 0))),
+ (((var6 == Symbol('\u2665uarCSV')) &&
+ (var18 ? var18 : var18))
+ ? (var40++)
+ : 25):
+ (((((!(((RegExp('t')).isMultiLine))) ? var18 : false)
+ ? var8[((true ? -65 : (3 % -99)) ~/ 30)]
+ : var40))
+ .toStringAsExponential((Int32x4.wxxz as int)))
+ })
+ : {
+ (-9223372032559808513 ~/ (-(4294967297))):
+ var36.foo1_Extension1(StringBuffer(24), var8, 0),
+ if ((!((var18 ^ false))))
+ (var0[(var42 ~/ var40)] ? -39 : -96): 'BuzKc'
+ else
+ (Int32x4.yxyy as int): (false ? 'Rxpx2T' : '(xEVAx'),
+ (Int32x4.xxxw as int): var54[(Float32x4.zyyw as int)],
+ (~(-7)): ('' * 8)
+ });
+ } else {
+ var60 = {
+ (!(var18)): fooE1(var36).foo1_Extension1(
+ StringBuffer(0), Int16List.fromList(Uint64List(6)), 0),
+ var18: ('U6o5y' * 31),
+ ((((RegExp('')).isCaseSensitive) &&
+ (false ||
+ var58[(({var40}).add(var12[(-9223372030412324863 ??
+ var65[((var18).toString())])]))])) ||
+ ((new Duration() * (false ? var40 : var40)) <=
+ (-((var19 ?? var19))))): 'HZIfq',
+ var64[var44]: var44,
+ var52[(var5[-0] | ((++var40) >> var40))]: ((var18
+ ? false
+ : (true
+ ? var2[-91]
+ : var58[
+ ((((var15).shuffleMix(Int32x4(3, 6, 11, 16), var40)))
+ .flagX)]))
+ ? var54[12]
+ : var54[(-((var18 ? var40 : var40)))]),
+ var2[(~(-87))]: 'LxD'
+ };
+ var20 ??= ((((var18 ? RegExp('S#lVaW(') : var43)).isUnicode)
+ ? FallThroughError()
+ : foo0(0));
+ }
+ }
+ return StateError('99');
+ }
+
+ Int64List foo2_Extension1(
+ Exception par1, Int16List par2, List<String> par3, int par4) {
+ if (par4 >= 5) {
+ return ((!(((new RegExp('I!'))
+ .hasMatch((false ? 'A\u{1f600}\u26656' : ('F4xY' ?? var51[0]))))))
+ ? Int64List(30)
+ : var12);
+ } // Single-line comment.
+ if ((((bool.fromEnvironment((((-(var40))).toString()))) & false) ||
+ var58[var49[-4294967295]])) {
+ try {
+ var2 = var2;
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ (({27: '7BxmY'}).clear());
+ }
+ }
+ var13 = var13;
+ return (var22).foo2_Extension1(
+ var38,
+ par2,
+ var36.foo1_Extension0(
+ (var58[true]
+ ? FormatException('2IWwRf', 3, 34)
+ : new FormatException('d!B', 4, 28)),
+ Duration(),
+ 45,
+ 0),
+ par4 + 1);
+ }
+
+ NullThrownError foo2_Extension2(Exception par1,
+ IntegerDivisionByZeroException par2, FormatException par3) {
+ var42 = 30;
+ var1 = MapEntry<String, bool>('abGhTN', true);
+ return var24;
+ }
+}
+
+extension fooE3 on Null {
+ Int32x4 foo3_Extension0(int par1) {
+ if (par1 >= 6) {
+ return (((Int32x4(12, 1, 48, 9)).withX((22 ?? ((8 | par1) >> 41)))) ^
+ var15);
+ }
+ ((((((var5).sublist(((!((!(false)))) ? -87 : -9223372030412324865),
+ (--var40))) +
+ var12) +
+ (var8 ?? var8)))
+ .fillRange(-9223372036854775807, -2147483649, (Float32x4.xwyw as int)));
+ return Int32x4.bool(true, true, false, false);
+ }
+}
+
+extension fooE4 on Duration {
+ MapEntry<int, String> foo4_Extension0(Exception par1, Int32x4 par2) {
+ (({
+ ...{
+ (false ? -22 : (var18 ? var13[var40] : (++var40))),
+ var40,
+ -9223372030412324864,
+ (var64[var44] ? 27 : var40),
+ (Float32x4.wyyx as int)
+ },
+ ...{-94, (var40--)},
+ (~(var40)),
+ for (int loc0 in {(DateTime.april as int)}) (var40++)
+ }).clear());
+ return MapEntry<int, String>(15, 'Y3U');
+ }
+
+ CyclicInitializationError foo4_Extension1(bool par1, Int32x4List par2) {
+ {
+ int loc0 = 12;
+ while (--loc0 > 0) {
+ {
+ UnsupportedError loc1 = var31;
+ {
+ int loc2 = 48;
+ while (--loc2 > 0) {
+ var50 ??= (false ? new Expando<int>('N') : var50);
+ }
+ }
+ }
+ return (true
+ ? (false ? CyclicInitializationError('pbsl\u2665B)') : var36)
+ : CyclicInitializationError('SY8K'));
+ }
+ }
+ return CyclicInitializationError('x');
+ }
+}
+
+class X0 {
+ Int32x4 fld0_0 = Int32x4(4, 17, 25, 21);
+ FallThroughError fld0_1 = new FallThroughError();
+ Int16List fld0_2 = Int16List.fromList(Int32List.fromList(Uint32List(21)));
+ MapEntry<String, int> fld0_3 = MapEntry<String, int>('Z)i6o', 1);
+
+ List<bool> foo0_0(Map<String, int> par1) {
+ (({(~((-(var40)))): 'S'}).addAll({
+ for (int loc0 = 0; loc0 < 9; loc0++) -40: var44,
+ (Int32x4.ywzy as int): ((var31).message),
+ if (var58[(!(false))])
+ -45: (String.fromEnvironment(((((true && var49[-9223372036854775807])
+ ? CyclicInitializationError('8DdLh-y')
+ : var36))
+ .toString()))),
+ var40: var54[(var40++)]
+ }));
+ return ([
+ true,
+ (var64[var63[13]]
+ ? (((true
+ ? var15
+ : (var58[var58[false]]
+ ? new Int32x4(18, 23, 13, 30)
+ : Int32x4(49, 44, 37, 37))))
+ .flagW)
+ : (!(var52[(Float32x4.yzyw as int)]))),
+ var18,
+ (!(((var56).add((~(43))))))
+ ] ??
+ var52);
+ }
+
+ NullThrownError foo0_1(int par1) {
+ if (par1 >= 20) {
+ return var22.foo2_Extension2(var38, IntegerDivisionByZeroException(),
+ FormatException('JHGQ-3', 48, 18));
+ }
+ try {
+ var66.forEach((loc0, loc1) {
+ {
+ int loc2 = 0;
+ do {
+ for (int loc3 = 0; loc3 < 10; loc3++) {
+ throw StackOverflowError();
+ }
+ var27 ??= var27;
+ } while (++loc2 < 20);
+ }
+
+ {
+ int loc2 = 28;
+ while (--loc2 > 0) {
+ // Single-line comment.
+ return NullThrownError();
+ }
+ }
+ });
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ /// Single-line documentation comment.
+ throw var23;
+ } finally {
+ // Single-line comment.
+ try {
+ /*
+ * Multi-line
+ * comment.
+ */
+ ((((((var41.foo3_Extension0(0)).flagW) |
+ (((true ? true : var49[(Float32x4.yxxy as int)])
+ ? var18
+ : var58[var64['Zmg\u26656']])
+ ? var64[((true ? '' : ('+TZ' + var44)) + var54[-89])]
+ : true))
+ ? RuneIterator.at('8zi', 34)
+ : (((var52[var40] ? var45 : Runes('M!y'))).iterator)))
+ .reset((Float32x4.xzxx as int)));
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ // Single-line comment.
+ {
+ int loc0 = 0;
+ do {
+ var31 ??= (var18 ? UnimplementedError('') : var31);
+ } while (++loc0 < 19);
+ }
+ } finally {
+ var33 ??= var33;
+ print({
+ 'p',
+ '5',
+ 'nFd',
+ ((('\u2665QJhrGu').substring(
+ (var40 ~/
+ ((false ? true : (!(true)))
+ ? (var40 - 15)
+ : -4294967296)),
+ -52)) *
+ 36),
+ ('aA\u{1f600}' +
+ (var60[((true
+ ? true
+ : (!(((var14[(-(((var52[27] ? 39 : var40) << -35)))])
+ .flagX)))) ^
+ var18)] *
+ 8)),
+ ((var64[var44]).toString())
+ });
+ }
+ }
+ return var24;
+ }
+
+ Int8List foo0_2(Symbol par1, MapEntry<bool, bool> par2,
+ Map<String, String> par3, int par4) {
+ if (par4 >= 40) {
+ return Int8List(9);
+ }
+ var1 ??= MapEntry<String, bool>('B\u{1f600}\u2665v-fx', true);
+ if (false) {
+ if ((var42 >= -64)) {
+ {
+ int loc0 = 0;
+ do {
+ ((var63).addAll({3: ((((var18).toString()) + var44) + 'PIW@')}));
+ var41 = null;
+ } while (++loc0 < 20);
+ }
+ }
+ switch (((Float32x4.yyxy as int) & var40)) {
+ case 2432097039:
+ {
+ if ((!((var18 |
+ ((!((bool.fromEnvironment('Doptl\u{1f600}R'))))
+ ? true
+ : var18))))) {
+ return var5;
+ } else {
+ var63 = {
+ (-((true
+ ? var11[fld0_2[(Int32x4.zwzz as int)]]
+ : var11[(var18
+ ? var12[var59[
+ ((Int32x4.bool(true, false, true, false)).flagZ)]]
+ : var40)]))): var44,
+ ...{(-(-0)): '@yx+(O'},
+ ...{
+ (var40 >> -39):
+ (((var18 ? var52[-9223372036854775807] : false)
+ ? var58[var18]
+ : (!((false || false))))
+ ? '\u{1f600}B4hFc'
+ : '33xC'),
+ if ((var19 >= Duration()))
+ (Float32x4.ywyz as int): var44
+ else
+ var5[var50[(var42 ~/ var42)]]: var51[var40],
+ ...{
+ var62[-12]: '@LYD',
+ ((false ? var42 : var40) ~/ -42):
+ (([''] == var47) ? '' : var44)
+ }
+ },
+ (Float32x4.yyyx as int): 'eD0\u2665A',
+ if ((!(var18)))
+ ((var15).x as int):
+ ((!(var58[(!(var64[')']))])) ? var44 : var44)
+ else
+ -88: ((StateError('')).toString()),
+ var13[var40]: var44
+ };
+ }
+ break;
+ }
+ case 2432097049:
+ {
+ var33 ??= ConcurrentModificationError(18);
+ break;
+ }
+ default:
+ {
+ var59 = {
+ false: (~(((~(var40)) >> var40))),
+ (false ? var18 : (!(false))): var40,
+ (false ?? (!((((-49).isInfinite) && var58[var58[var18]])))):
+ (var40--),
+ (!((var54 == NullThrownError()))): -12
+ };
+ break;
+ }
+ }
+ } else {
+ try {
+ if (((34 - 11) >= (-(49)))) {
+ var39 = var39;
+ var56 = var56;
+ }
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ throw StackOverflowError();
+ }
+ if (var18) {
+ print({
+ (var58[true] ? (++var40) : var12[(5 | (Int32x4.wwxx as int))]):
+ (++var40),
+ (Int64List.bytesPerElement as int):
+ var6[(~(var50[var62[var65[par3['Zb']]]]))],
+ (var18 ? (true ? 10 : (++var40)) : -79): (var64['h\u{1f600}X\u2665(']
+ ? (true
+ ? var5[(((((((((33 > (true ? var40 : var42)) ? var43 : var43))
+ .isMultiLine)
+ ? ''
+ : '#'))
+ .endsWith(var51[9223372032559808512]))
+ ? (!(var18))
+ : var49[22])
+ ? var40
+ : var40)]
+ : (33 ~/ 38))
+ : (++var40))
+ });
+ }
+ }
+ return foo0_2(
+ Symbol('y-r3rR'), MapEntry<bool, bool>(true, false), par3, par4 + 1);
+ }
+
+ @override
+ Int32x4List call(int par1) {
+ if (par1 >= 5) {
+ return Int32x4List(5);
+ }
+ if ((true
+ ? var61[(Int32x4.zwyx as int)]
+ : (((Float32x4.ywyy as int)).isInfinite))) {
+ return var14;
+ }
+ }
+
+ void run() {
+ var17 ??= Provisional();
+ }
+}
+
+extension XE0 on X0 {
+ IntegerDivisionByZeroException foo0_Extension0(
+ Map<bool, int> par1, RuneIterator par2, Duration par3) {
+ var64.forEach((loc0, loc1) {
+ {
+ int loc2 = 0;
+ do {
+ fld0_3 ??= MapEntry<String, int>('4T\u2665i', 30);
+ } while (++loc2 < 44);
+ }
+ });
+ return (var52[(Uint32List.bytesPerElement as int)]
+ ? var39
+ : IntegerDivisionByZeroException());
+ }
+
+ List<bool> foo0_Extension1(List<int> par1) {
+ /**
+ ** Multi-line
+ ** documentation comment.
+ */
+ if (false) {
+ switch (((var40++) | -57)) {
+ case 3773120366:
+ {
+ for (int loc0 in foo2(
+ null,
+ (false
+ ? (var36.foo1_Extension1(var47, Int16List(25), 0) ??
+ (Uri.encodeFull(fooE1(var36)
+ .foo1_Extension1(var47, Int16List(8), 0))))
+ : '\u2665Lgd(n'),
+ 0)) {
+ try {
+ var6 = Uint8List(12);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ var20 = foo0(0);
+ var1 = MapEntry<String, bool>('X', true);
+ } finally {
+ try {
+ var41 = (var0[(ZLibOption.strategyHuffmanOnly as int)]
+ ? (provisional)
+ : (((((~(-43)) | (2147483649 ^ var40))).isNaN)
+ ? (var64[(true ? 'TA6\u{1f600}FQT' : 'p\u2665p!-')]
+ ? null
+ : null)
+ : null));
+ var49 ??= var49;
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ try {
+ /*
+ * Multi-line
+ * comment.
+ */
+ var64 = var64;
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ var23 = CastError();
+ for (int loc1 = 0; loc1 < 14; loc1++) {
+ continue;
+ }
+ } finally {
+ var69 = MapEntry<bool, String>(false, 'SemmWM');
+ }
+ var14[(-((~(-54))))] += var14[(--var40)];
+ }
+ for (int loc1 = 0; loc1 < 1; loc1++) {
+ var5 = Int8List(38);
+ var13 = var13;
+ }
+ }
+ }
+ break;
+ }
+ case 3773120375:
+ {
+ var25 = var27;
+ break;
+ }
+ case 3773120384:
+ {
+ try {
+ // Single-line comment.
+ ((Uint8ClampedList(24)).removeRange(
+ (var62[-9223372032559808513] ^ -29), var7[var40]));
+ var4 ??= ByteData(11);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ var13 = Uint64List.fromList(
+ Uint8List.fromList(Uint8ClampedList.fromList([(35 | -41)])));
+ if ((((!(((false ? var0[var40] : var18)
+ ? (false | (SecurityContext.alpnSupported))
+ : true)))
+ ? false
+ : var18)
+ ? true
+ : var18)) {
+ var9 = Uint16List(15);
+ }
+ }
+ break;
+ }
+ }
+ for (int loc0 = 0; loc0 < 22; loc0++) {
+ var14 = X0()(0);
+ throw MapEntry<bool, int>(true, 16);
+ }
+ } else {
+ ((StringBuffer(44)).clear());
+ var39 ??= IntegerDivisionByZeroException();
+ }
+ return [
+ false,
+ (!(var18)),
+ false,
+ var64[
+ var36.foo1_Extension1(StringBuffer(2), Int16List.fromList([-27]), 0)],
+ true,
+ false
+ ];
+ }
+}
+
+class X1 extends X0 {
+ Map<bool, String> fld1_0 = {true: '\u2665SE)b'};
+
+ Map<int, int> foo1_0(Deprecated par1, int par2) {
+ if (par2 >= 22) {
+ return {
+ (var40++): var7[(--var40)],
+ (((-(var59[true])) | ((--var40) ?? var11[var9[-76]])) >> var62[14]):
+ (~((par2--)))
+ };
+ }
+ throw UnimplementedError('O');
+ }
+
+ @override
+ Int32x4List call(int par1) {
+ var26 ??= IndexError(27, 18, '+Qy9', '', 6);
+ {
+ int loc0 = 41;
+ while (--loc0 > 0) {
+ /// Single-line documentation comment.
+ try {
+ fld1_0 = {
+ var52[var10[par1]]:
+ (((var40++)).toStringAsPrecision(var13[(par1--)])),
+ var2[44]: var36.foo1_Extension1(var47,
+ (Int16List.fromList(Uint16List.fromList(Int64List(34)))), 0),
+ ((!(true))
+ ? false
+ : var52[(var18 ? 33 : (true ? var8[var5[par1]] : -27))]):
+ (var36.foo1_Extension1(
+ var47,
+ Int16List.fromList(Uint16List.fromList(Int8List(25))),
+ 0) +
+ '7'),
+ var18: var36.foo1_Extension1(
+ var47, ((var8).sublist(var59[var49[par1]], (par1--))), 0)
+ };
+ var66 = var66;
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ {
+ int loc1 = 33;
+ while (--loc1 > 0) {
+ var52 = (var52 +
+ ((loc0 < (var49[var11[(-((loc1 ?? -57)))]] ? (-(-1)) : par1))
+ ? ((true
+ ? [true, false]
+ : [
+ true,
+ var18,
+ (((((~(37)) << -9223372036854775808) |
+ ((loc0).modInverse(loc1) as int)))
+ .isNegative),
+ ('D\u2665Sp' ==
+ IndexError(14, 12, 'PDTOXf', '&5e', 13))
+ ]) ??
+ [true, (!(false))])
+ : [true]));
+ }
+ }
+ if (var18) {
+ var20 ??= NullThrownError();
+ var14[(Float32x4.zyxw as int)] &= (var41).foo3_Extension0(0);
+ } else {
+ var74 = MapEntry<String, int>('Jwvy&', 9);
+ }
+ }
+ }
+ }
+ return Int32x4List(11);
+ }
+
+ void run() {
+ super.run();
+ var49 ??= var49;
+ }
+}
+
+extension XE1 on X1 {
+ IndexError foo1_Extension0(
+ Runes par1, MapEntry<bool, int> par2, Exception par3, int par4) {
+ if (par4 >= 19) {
+ return var27;
+ }
+ for (int loc0 = 0; loc0 < 19; loc0++) {
+ if (((((var58[var18] && (var19 > Duration()))
+ ? (true ? (~(-43)) : var5[(var40--)])
+ : 2147483647))
+ .isInfinite)) {
+ return var27;
+ } else {
+ var41 = var41;
+ var23 = (var18
+ ? ((var18 ? (false ?? var18) : (false ? ((-38).isEven) : var18))
+ ? CastError()
+ : CastError())
+ : CastError());
+ }
+ }
+ return IndexError(15, 17, 'yw', '', 20);
+ }
+
+ Expando<String> foo1_Extension1() {
+ /// Single-line documentation comment.
+ var59.forEach((loc0, loc1) {
+ throw var68;
+ });
+ return var51;
+ }
+
+ Expando<int> foo1_Extension2(CyclicInitializationError par1, Null par2) {
+ {
+ int loc0 = 0;
+ do {
+ // Single-line comment.
+ var67 ??= (((!((var18 && var58[false])))
+ ? ((((var30).toString())).endsWith(var63[
+ ((true ? loc0 : (var9[11] >> (-(-34)))) <<
+ (Float32x4.zwww as int))]))
+ : var18)
+ ? MapEntry<bool, bool>(false, false)
+ : MapEntry<bool, bool>(true, true));
+ } while (++loc0 < 29);
+ }
+
+ {
+ int loc0 = 25;
+ while (--loc0 > 0) {
+ for (int loc1 = 0; loc1 < 40; loc1++) {
+ throw new Expando<String>('+huc0\u2665');
+ }
+ try {
+ continue;
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (exception, stackTrace) {
+ var66.forEach((loc1, loc2) {
+ if (true) {
+ var5 = Int8List.fromList(
+ Uint8ClampedList.fromList([var50[(-(loc0))]]));
+ }
+ });
+ if ((NetworkInterface.listSupported)) {
+ for (int loc1 = 0; loc1 < 37; loc1++) {
+ var74 ??= var74;
+ {
+ Set<int> loc2 = {
+ 1,
+ (var9[(--var40)] ^
+ (-82 ??
+ (true
+ ? var59[var18]
+ : (var58[var58[(!(false))]] ? (~(loc0)) : 0)))),
+ loc0,
+ ((((var47).isNotEmpty) ??
+ (var52[(Float32x4.xyzw as int)] || (var19 < var19)))
+ ? (var40--)
+ : ((Float32x4.zxzz as int) ^ 48)),
+ ((false | ((var18 ? false : var18) ? (!(var18)) : true))
+ ? (((!(false))
+ ? ((true ? false : var18)
+ ? (!(var18))
+ : (!(var61[var12[44]])))
+ : var18)
+ ? (var40++)
+ : 10)
+ : (--var40))
+ };
+ fld1_0 = ((!(var18))
+ ? ((!((!(var18))))
+ ? fld1_0
+ : {
+ false: (Uri.decodeFull(
+ var66[((Deprecated('uvZ6GU')).toString())]))
+ })
+ : {
+ var18: (true
+ ? ((!(true))
+ ? ''
+ : fooE1(par1)
+ .foo1_Extension1(StringBuffer(49), var8, 0))
+ : ('' + 'qD6Fry')),
+ (((var58[true] ? RegExp('Zp') : RegExp(''))).isDotAll):
+ fooE1(par1)
+ .foo1_Extension1(StringBuffer(38), var8, 0),
+ ((StringBuffer(39)).isEmpty):
+ ((MapEntry<int, String>(41, 'S2lAKd')).toString()),
+ var64[(var18
+ ? (var60[(false
+ ? false
+ : (SecurityContext.alpnSupported))] ??
+ '\u{1f600}lsZ')
+ : 'c4+Ry')]:
+ (Uri.decodeQueryComponent(
+ var63[(var49[(var40--)] ? -66 : (var40++))])),
+ (!(((StringBuffer(41)).isNotEmpty))):
+ ((null).toString())
+ });
+ var66 = var66;
+ }
+ }
+ return Expando<int>('eo');
+ }
+ } finally {
+ print(var27);
+ }
+ }
+ }
+ return Expando<int>('');
+ }
+}
+
+main() {
+ try {
+ foo0(0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('foo0() throws');
+ }
+ try {
+ foo1(
+ (var61[(false ? 1 : var40)]
+ ? (true ? Runes('\u{1f600}\u{1f600}RK') : var45)
+ : ((!(true)) ? ((var63[var40]).runes) : var45)),
+ FallThroughError(),
+ Uint16List(33));
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('foo1() throws');
+ }
+ try {
+ foo2(((9223372036854775807 < -24) ? (true ? null : var41) : var41), '', 0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('foo2() throws');
+ }
+ try {
+ var45.foo0_Extension0(
+ {'udb(R', '\u2665IEp\u{1f600}e', 'DMEbe#g', ''}, var50, var8, 0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('var45.foo0_Extension0() throws');
+ }
+ try {
+ fooE1(var36).foo1_Extension0(
+ FormatException('n', 3, 48), var19, ((var40 % var42) * -2), 0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('fooE1(var36).foo1_Extension0() throws');
+ }
+ try {
+ fooE1(var36).foo1_Extension1(
+ (false ? StringBuffer(36) : StringBuffer(2)), Int16List(25), 0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('fooE1(var36).foo1_Extension1() throws');
+ }
+ try {
+ var22.foo2_Extension0(
+ (var54 + ['\u2665aAaW', 'Wc', '\u2665u- jf\u{1f600}']));
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('var22.foo2_Extension0() throws');
+ }
+ try {
+ (var22).foo2_Extension1(IntegerDivisionByZeroException(), var8, ['OiV'], 0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('(var22).foo2_Extension1() throws');
+ }
+ try {
+ var22.foo2_Extension2(
+ (((var66[((('2S2\u{1f600}Y' * 43))
+ .substring((Float32x4.zyyy as int), var9[34]))])
+ .endsWith(var44))
+ ? ((!(var58[var58[var18]])) ? Exception(9) : var38)
+ : var38),
+ IntegerDivisionByZeroException(),
+ FormatException('T', 23, 36));
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('var22.foo2_Extension2() throws');
+ }
+ try {
+ var41.foo3_Extension0(0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('var41.foo3_Extension0() throws');
+ }
+ try {
+ fooE4(var19).foo4_Extension0(
+ var38,
+ ((((Int32x4(3, 32, 0, 1) - Int32x4(38, 16, 29, 3))).flagX)
+ ? var14[(false ? var40 : (var40++))]
+ : var14[var11[-75]]));
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('fooE4(var19).foo4_Extension0() throws');
+ }
+ try {
+ var19.foo4_Extension1((SecurityContext.alpnSupported), var14);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('var19.foo4_Extension1() throws');
+ }
+
+ try {
+ X0().foo0_0({'i\u2665\u26651': -89, 'YPf': -88, 'k': -62, 'zhny': -65});
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('X0().foo0_0 throws');
+ }
+ try {
+ X0().foo0_1(0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('X0().foo0_1 throws');
+ }
+ try {
+ X0().foo0_2(Symbol('L Cn'), MapEntry<bool, bool>(true, true),
+ {' pP': '', '': '2A\u2665B', '': 'm\u2665b'}, 0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('X0().foo0_2 throws');
+ }
+ try {
+ X0()(0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('X0() throws');
+ }
+ try {
+ X0().foo0_Extension0({false: 29, true: 27}, var46, (-((-(var19)))));
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('X0().foo0_Extension0 throws');
+ }
+ try {
+ (X0()).foo0_Extension1((false
+ ? ([-0, -12] ?? Uint8ClampedList(4))
+ : (List<int>.filled(43, var40))));
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('(X0()).foo0_Extension1 throws');
+ }
+ try {
+ X1().foo1_0(Deprecated('CR4-'), 0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('X1().foo1_0 throws');
+ }
+ try {
+ X1()((Int32x4.xyzz as int));
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('X1() throws');
+ }
+ try {
+ (X1()).foo1_Extension0((('-pjz').runes),
+ (true ? var68 : MapEntry<bool, int>(false, 16)), var39, 0);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('(X1()).foo1_Extension0 throws');
+ }
+ try {
+ (X1()).foo1_Extension1();
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('(X1()).foo1_Extension1 throws');
+ }
+ try {
+ (X1()).foo1_Extension2(var36, var41);
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('(X1()).foo1_Extension2 throws');
+ }
+ try {
+ X1().run();
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('X1().run() throws');
+ }
+ try {
+ print(
+ '$var0\n$var1\n$var2\n$var3\n$var4\n$var5\n$var6\n$var7\n$var8\n$var9\n$var10\n$var11\n$var12\n$var13\n$var14\n$var15\n$var16\n$var17\n$var18\n$var19\n$var20\n$var21\n$var22\n$var23\n$var24\n$var25\n$var26\n$var27\n$var28\n$var29\n$var30\n$var31\n$var32\n$var33\n$var34\n$var35\n$var36\n$var37\n$var38\n$var39\n$var40\n$var41\n$var42\n$var43\n$var44\n$var45\n$var46\n$var47\n$var48\n$var49\n$var50\n$var51\n$var52\n$var53\n$var54\n$var55\n$var56\n$var57\n$var58\n$var59\n$var60\n$var61\n$var62\n$var63\n$var64\n$var65\n$var66\n$var67\n$var68\n$var69\n$var70\n$var71\n$var72\n$var73\n$var74\n$var75\n');
+ } on OutOfMemoryError {
+ exit(254);
+ } catch (e, st) {
+ print('print() throws');
+ }
+}
diff --git a/runtime/tests/vm/dart/regress_40635_test.dart b/runtime/tests/vm/dart/regress_40635_test.dart
new file mode 100644
index 0000000..eeb643f
--- /dev/null
+++ b/runtime/tests/vm/dart/regress_40635_test.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2020, 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 that a basic test still works when instructions are deduplicated.
+// Test body comes from tests/corelib_2/apply2_test.dart, which is one of the
+// tests that were failing when --dedup-instructions was broken in bare payload
+// mode (precompiled + bare instructions).
+//
+// VMOptions=--dedup-instructions
+
+import 'hello_world_test.dart' as other;
+
+main() => other.main();
diff --git a/runtime/tests/vm/dart/regress_40710_test.dart b/runtime/tests/vm/dart/regress_40710_test.dart
new file mode 100644
index 0000000..4c5b560
--- /dev/null
+++ b/runtime/tests/vm/dart/regress_40710_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2020, 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.
+
+// VMOptions=--optimization_counter_threshold=10 --deterministic
+
+// Regression test for https://dartbug.com/40710.
+// Verifies that specialized type testing stub can reject
+// instances with all-dynamic (null) type arguments.
+
+import "package:expect/expect.dart";
+
+class A<T> {
+ @pragma('vm:never-inline')
+ void foo(x) {
+ print(x as T);
+ }
+}
+
+class B<T> {}
+
+main(List<String> args) {
+ for (int i = 0; i < 20; ++i) {
+ final a = new A<B<String>>();
+ a.foo(new B<String>());
+ Expect.throwsCastError(() {
+ a.foo(new B<dynamic>());
+ });
+ }
+}
diff --git a/runtime/tests/vm/dart/regress_flutter51298_test.dart b/runtime/tests/vm/dart/regress_flutter51298_test.dart
new file mode 100644
index 0000000..9e7bb8c
--- /dev/null
+++ b/runtime/tests/vm/dart/regress_flutter51298_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2020, 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.
+
+// VMOptions=--async_igoto_threshold=0 --optimization_counter_threshold=10 --deterministic
+
+// Regression test for https://github.com/flutter/flutter/issues/51298.
+// This would cause a crash due to bad offsets causing entry to hit the pre-code
+// barrier of int3s.
+
+import 'dart:async';
+
+Iterable<bool> state_machine() sync* {
+ bool a = true;
+
+ for (var i = 0; i < 2; i++) {
+ switch (a) {
+ case true:
+ a = false;
+ break;
+ }
+ }
+
+ switch (a) {
+ case false:
+ if (!a) {
+ yield a;
+ }
+ }
+}
+
+void main() {
+ // This would crash due to bad flowgraph entry offsets.
+ for (final _ in state_machine()) {}
+}
diff --git a/runtime/tests/vm/dart/splay_test.dart b/runtime/tests/vm/dart/splay_test.dart
new file mode 100644
index 0000000..a91c853
--- /dev/null
+++ b/runtime/tests/vm/dart/splay_test.dart
@@ -0,0 +1,319 @@
+// 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.
+
+// This benchmark is based on a JavaScript log processing module used
+// by the V8 profiler to generate execution time profiles for runs of
+// JavaScript applications, and it effectively measures how fast the
+// JavaScript engine is at allocating nodes and reclaiming the memory
+// used for old nodes. Because of the way splay trees work, the engine
+// also has to deal with a lot of changes to the large tree object
+// graph.
+
+// VMOptions=
+// VMOptions=--no_concurrent_mark --no_concurrent_sweep
+// VMOptions=--no_concurrent_mark --concurrent_sweep
+// VMOptions=--no_concurrent_mark --use_compactor
+// VMOptions=--no_concurrent_mark --use_compactor --force_evacuation
+// VMOptions=--concurrent_mark --no_concurrent_sweep
+// VMOptions=--concurrent_mark --concurrent_sweep
+// VMOptions=--concurrent_mark --use_compactor
+// VMOptions=--concurrent_mark --use_compactor --force_evacuation
+// VMOptions=--verify_before_gc
+// VMOptions=--verify_after_gc
+// VMOptions=--verify_before_gc --verify_after_gc
+// VMOptions=--verify_store_buffer
+
+import "dart:math";
+import 'package:benchmark_harness/benchmark_harness.dart';
+
+void main() {
+ Splay.main();
+}
+
+class Splay extends BenchmarkBase {
+ const Splay() : super("Splay");
+
+ // Configuration.
+ static final int kTreeSize = 8000;
+ static final int kTreeModifications = 80;
+ static final int kTreePayloadDepth = 5;
+
+ static SplayTree tree;
+
+ static Random rnd = new Random(12345);
+
+ // Insert new node with a unique key.
+ static num insertNewNode() {
+ num key;
+ do {
+ key = rnd.nextDouble();
+ } while (tree.find(key) != null);
+ Payload payload = Payload.generate(kTreePayloadDepth, key.toString());
+ tree.insert(key, payload);
+ return key;
+ }
+
+ static void mysetup() {
+ tree = new SplayTree();
+ for (int i = 0; i < kTreeSize; i++) insertNewNode();
+ }
+
+ static void tearDown() {
+ // Allow the garbage collector to reclaim the memory
+ // used by the splay tree no matter how we exit the
+ // tear down function.
+ List<num> keys = tree.exportKeys();
+ tree = null;
+
+ // Verify that the splay tree has the right size.
+ int length = keys.length;
+ if (length != kTreeSize) throw new Error("Splay tree has wrong size");
+
+ // Verify that the splay tree has sorted, unique keys.
+ for (int i = 0; i < length - 1; i++) {
+ if (keys[i] >= keys[i + 1]) throw new Error("Splay tree not sorted");
+ }
+ }
+
+ void warmup() {
+ exercise();
+ }
+
+ void exercise() {
+ // Replace a few nodes in the splay tree.
+ for (int i = 0; i < kTreeModifications; i++) {
+ num key = insertNewNode();
+ Node greatest = tree.findGreatestLessThan(key);
+ if (greatest == null) tree.remove(key);
+ else tree.remove(greatest.key);
+ }
+ }
+
+ static void main() {
+ mysetup();
+ new Splay().report();
+ tearDown();
+ }
+}
+
+
+class Leaf {
+ Leaf(String tag) {
+ string = "String for key $tag in leaf node";
+ array = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];
+ }
+ String string;
+ List<num> array;
+}
+
+
+class Payload {
+ Payload(this.left, this.right);
+ var left, right;
+
+ static generate(depth, tag) {
+ if (depth == 0) return new Leaf(tag);
+ return new Payload(generate(depth - 1, tag),
+ generate(depth - 1, tag));
+ }
+}
+
+class Error implements Exception {
+ const Error(this.message);
+ final String message;
+}
+
+
+/**
+ * A splay tree is a self-balancing binary search tree with the additional
+ * property that recently accessed elements are quick to access again.
+ * It performs basic operations such as insertion, look-up and removal
+ * in O(log(n)) amortized time.
+ */
+class SplayTree {
+ SplayTree();
+
+ /**
+ * Inserts a node into the tree with the specified [key] and value if
+ * the tree does not already contain a node with the specified key. If
+ * the value is inserted, it becomes the root of the tree.
+ */
+ void insert(num key, value) {
+ if (isEmpty) {
+ root = new Node(key, value);
+ return;
+ }
+ // Splay on the key to move the last node on the search path for
+ // the key to the root of the tree.
+ splay(key);
+ if (root.key == key) return;
+ Node node = new Node(key, value);
+ if (key > root.key) {
+ node.left = root;
+ node.right = root.right;
+ root.right = null;
+ } else {
+ node.right = root;
+ node.left = root.left;
+ root.left = null;
+ }
+ root = node;
+ }
+
+ /**
+ * Removes a node with the specified key from the tree if the tree
+ * contains a node with this key. The removed node is returned. If
+ * [key] is not found, an exception is thrown.
+ */
+ Node remove(num key) {
+ if (isEmpty) throw new Error('Key not found: $key');
+ splay(key);
+ if (root.key != key) throw new Error('Key not found: $key');
+ Node removed = root;
+ if (root.left == null) {
+ root = root.right;
+ } else {
+ Node right = root.right;
+ root = root.left;
+ // Splay to make sure that the new root has an empty right child.
+ splay(key);
+ // Insert the original right child as the right child of the new
+ // root.
+ root.right = right;
+ }
+ return removed;
+ }
+
+ /**
+ * Returns the node having the specified [key] or null if the tree doesn't
+ * contain a node with the specified [key].
+ */
+ Node find(num key) {
+ if (isEmpty) return null;
+ splay(key);
+ return root.key == key ? root : null;
+ }
+
+ /**
+ * Returns the Node having the maximum key value.
+ */
+ Node findMax([Node start]) {
+ if (isEmpty) return null;
+ Node current = null == start ? root : start;
+ while (current.right != null) current = current.right;
+ return current;
+ }
+
+ /**
+ * Returns the Node having the maximum key value that
+ * is less than the specified [key].
+ */
+ Node findGreatestLessThan(num key) {
+ if (isEmpty) return null;
+ // Splay on the key to move the node with the given key or the last
+ // node on the search path to the top of the tree.
+ splay(key);
+ // Now the result is either the root node or the greatest node in
+ // the left subtree.
+ if (root.key < key) return root;
+ if (root.left != null) return findMax(root.left);
+ return null;
+ }
+
+ /**
+ * Perform the splay operation for the given key. Moves the node with
+ * the given key to the top of the tree. If no node has the given
+ * key, the last node on the search path is moved to the top of the
+ * tree. This is the simplified top-down splaying algorithm from:
+ * "Self-adjusting Binary Search Trees" by Sleator and Tarjan
+ */
+ void splay(num key) {
+ if (isEmpty) return;
+ // Create a dummy node. The use of the dummy node is a bit
+ // counter-intuitive: The right child of the dummy node will hold
+ // the L tree of the algorithm. The left child of the dummy node
+ // will hold the R tree of the algorithm. Using a dummy node, left
+ // and right will always be nodes and we avoid special cases.
+ final Node dummy = new Node(null, null);
+ Node left = dummy;
+ Node right = dummy;
+ Node current = root;
+ while (true) {
+ if (key < current.key) {
+ if (current.left == null) break;
+ if (key < current.left.key) {
+ // Rotate right.
+ Node tmp = current.left;
+ current.left = tmp.right;
+ tmp.right = current;
+ current = tmp;
+ if (current.left == null) break;
+ }
+ // Link right.
+ right.left = current;
+ right = current;
+ current = current.left;
+ } else if (key > current.key) {
+ if (current.right == null) break;
+ if (key > current.right.key) {
+ // Rotate left.
+ Node tmp = current.right;
+ current.right = tmp.left;
+ tmp.left = current;
+ current = tmp;
+ if (current.right == null) break;
+ }
+ // Link left.
+ left.right = current;
+ left = current;
+ current = current.right;
+ } else {
+ break;
+ }
+ }
+ // Assemble.
+ left.right = current.left;
+ right.left = current.right;
+ current.left = dummy.right;
+ current.right = dummy.left;
+ root = current;
+ }
+
+ /**
+ * Returns a list with all the keys of the tree.
+ */
+ List<num> exportKeys() {
+ List<num> result = [];
+ if (!isEmpty) root.traverse((Node node) => result.add(node.key));
+ return result;
+ }
+
+ // Tells whether the tree is empty.
+ bool get isEmpty => null == root;
+
+ // Pointer to the root node of the tree.
+ Node root;
+}
+
+
+class Node {
+ Node(this.key, this.value);
+ final num key;
+ final Object value;
+
+ Node left, right;
+
+ /**
+ * Performs an ordered traversal of the subtree starting here.
+ */
+ void traverse(void f(Node n)) {
+ Node current = this;
+ while (current != null) {
+ Node left = current.left;
+ if (left != null) left.traverse(f);
+ f(current);
+ current = current.right;
+ }
+ }
+}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index e2a4f25..72da134 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -269,6 +269,7 @@
dart/slow_path_shared_stub_test: SkipSlow # Too slow with --shared-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/splay_test: SkipSlow
dart/stack_overflow_shared_test: SkipSlow # Too slow with --shared-slow-path-triggers-gc flag and not relevant outside precompiled.
dart/type_feedback_test: Pass, Slow
diff --git a/runtime/tools/dartfuzz/dartfuzz.dart b/runtime/tools/dartfuzz/dartfuzz.dart
index 6a4fcdb..5ea91ef0 100644
--- a/runtime/tools/dartfuzz/dartfuzz.dart
+++ b/runtime/tools/dartfuzz/dartfuzz.dart
@@ -14,7 +14,7 @@
// Version of DartFuzz. Increase this each time changes are made
// to preserve the property that a given version of DartFuzz yields
// the same fuzzed program for a deterministic random seed.
-const String version = '1.87';
+const String version = '1.88';
// Restriction on statements and expressions.
const int stmtDepth = 1;
diff --git a/runtime/tools/dartfuzz/dartfuzz_type_table.dart b/runtime/tools/dartfuzz/dartfuzz_type_table.dart
index f644f94..82c845e 100644
--- a/runtime/tools/dartfuzz/dartfuzz_type_table.dart
+++ b/runtime/tools/dartfuzz/dartfuzz_type_table.dart
@@ -43442,10 +43442,6 @@
INDEXERROR,
RANGEERROR,
},
- ASSERTIONERROR: {
- ASSERTIONERROR,
- TYPEERROR,
- },
BIDIRECTIONALITERATOR_INT: {
RUNEITERATOR,
},
@@ -113524,10 +113520,6 @@
DartType.INDEXERROR,
DartType.RANGEERROR,
},
- DartType.ASSERTIONERROR: {
- DartType.ASSERTIONERROR,
- DartType.TYPEERROR,
- },
DartType.BIDIRECTIONALITERATOR_INT: {
DartType.RUNEITERATOR,
},
@@ -138770,10 +138762,6 @@
DartType.INDEXERROR,
DartType.RANGEERROR,
},
- DartType.ASSERTIONERROR: {
- DartType.ASSERTIONERROR,
- DartType.TYPEERROR,
- },
DartType.BIDIRECTIONALITERATOR_INT: {
DartType.RUNEITERATOR,
},
@@ -141390,10 +141378,6 @@
DartType.INDEXERROR,
DartType.RANGEERROR,
},
- DartType.ASSERTIONERROR: {
- DartType.ASSERTIONERROR,
- DartType.TYPEERROR,
- },
DartType.BIDIRECTIONALITERATOR_INT: {
DartType.RUNEITERATOR,
},
diff --git a/runtime/tools/dartfuzz/gen_util.dart b/runtime/tools/dartfuzz/gen_util.dart
index 3ab635c..d72a797 100644
--- a/runtime/tools/dartfuzz/gen_util.dart
+++ b/runtime/tools/dartfuzz/gen_util.dart
@@ -30,7 +30,7 @@
if (packageRoot == null) {
throw StateError('No environment variable DART_TOP');
}
- final sdkPath = '$packageRoot/tools/sdks/dart-sdk';
+ final sdkPath = '$packageRoot/sdk';
// This does most of the hard work of getting the analyzer configured
// correctly. Typically the included paths are the files and directories
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index 50239a1..bac066b 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -78,9 +78,8 @@
extra_deps += [
# TODO(US-399): Remove time_service specific code when it is no longer
# necessary.
- "//sdk/lib/sys/cpp",
"//sdk/fidl/fuchsia.deprecatedtimezone",
-
+ "//sdk/lib/sys/cpp",
"//zircon/public/lib/fbl",
"//zircon/public/lib/trace-engine",
]
@@ -153,6 +152,7 @@
]
if (use_nnbd) {
args += [ "--enable-experiment=non-nullable" ]
+ args += [ "--nnbd-agnostic" ]
}
if (defined(invoker.exclude_source) && invoker.exclude_source) {
args += [ "--exclude-source" ]
@@ -194,9 +194,7 @@
"..:dart_maybe_product_config",
":libdart_vm_config",
]
- sources = [
- "compiler/offsets_extractor.cc",
- ]
+ sources = [ "compiler/offsets_extractor.cc" ]
include_dirs = [ ".." ]
}
@@ -208,8 +206,6 @@
"..:dart_maybe_product_config",
":libdart_vm_config",
]
- sources = [
- "compiler/offsets_extractor.cc",
- ]
+ sources = [ "compiler/offsets_extractor.cc" ]
include_dirs = [ ".." ]
}
diff --git a/runtime/vm/assert_test.cc b/runtime/vm/assert_test.cc
index 45c24c8..b3b28d3 100644
--- a/runtime/vm/assert_test.cc
+++ b/runtime/vm/assert_test.cc
@@ -23,8 +23,6 @@
EXPECT_EQ(pointer, pointer);
EXPECT_STREQ("Hello", "Hello");
- EXPECT_STREQ(42, 42);
- EXPECT_STREQ(87, "87");
EXPECT_LT(1, 2);
EXPECT_LT(1, 1.5);
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index 79ef871..17371d3 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -406,6 +406,7 @@
V(Ffi_asExternalTypedData, 2) \
V(Ffi_dl_processLibrary, 0) \
V(Ffi_dl_executableLibrary, 0) \
+ V(NativeApiFunctionPointer, 1) \
V(TransferableTypedData_factory, 2) \
V(TransferableTypedData_materialize, 1) \
V(Wasm_initModule, 2) \
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index ae43c7b..e3e423d 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -2,6 +2,9 @@
// 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 <memory>
+#include <utility>
+
#include "vm/class_finalizer.h"
#include "vm/compiler/jit/compiler.h"
@@ -378,11 +381,12 @@
if ((pending_type.raw() != type.raw()) && pending_type.IsType() &&
(pending_type.type_class() == type_cls.raw())) {
pending_arguments = pending_type.arguments();
- // By using TypeEquality::kIgnoreNullability, we throw a wider net and
- // may reject more problematic declarations.
+ // By using TypeEquality::kInSubtypeTest, we throw a wider net than
+ // using canonical or syntactical equality and may reject more
+ // problematic declarations.
if (!pending_arguments.IsSubvectorEquivalent(
arguments, first_type_param, num_type_params,
- TypeEquality::kIgnoreNullability) &&
+ TypeEquality::kInSubtypeTest) &&
!pending_arguments.IsSubvectorInstantiated(first_type_param,
num_type_params)) {
const TypeArguments& instantiated_arguments = TypeArguments::Handle(
@@ -396,11 +400,12 @@
NNBDMode::kLegacyLib, Object::null_type_arguments(),
Object::null_type_arguments(), kNoneFree, NULL,
Heap::kNew));
- // By using TypeEquality::kIgnoreNullability, we throw a wider net and
- // may reject more problematic declarations.
+ // By using TypeEquality::kInSubtypeTest, we throw a wider net than
+ // using canonical or syntactical equality and may reject more
+ // problematic declarations.
if (!instantiated_pending_arguments.IsSubvectorEquivalent(
instantiated_arguments, first_type_param, num_type_params,
- TypeEquality::kIgnoreNullability)) {
+ TypeEquality::kInSubtypeTest)) {
const String& type_name = String::Handle(zone, type.Name());
ReportError(cls, type.token_pos(), "illegal recursive type '%s'",
type_name.ToCString());
@@ -1389,7 +1394,9 @@
ClassTable* table = I->class_table();
intptr_t num_cids = table->NumCids();
- intptr_t* old_to_new_cid = new intptr_t[num_cids];
+
+ std::unique_ptr<intptr_t[]> old_to_new_cid(new intptr_t[num_cids]);
+
for (intptr_t cid = 0; cid < kNumPredefinedCids; cid++) {
old_to_new_cid[cid] = cid; // The predefined classes cannot change cids.
}
@@ -1450,11 +1457,13 @@
}
}
ASSERT(next_new_cid == num_cids);
-
- RemapClassIds(old_to_new_cid);
- delete[] old_to_new_cid;
+ RemapClassIds(old_to_new_cid.get());
RehashTypes(); // Types use cid's as part of their hashes.
I->RehashConstants(); // Const objects use cid's as part of their hashes.
+
+ // Ensure any newly spawned isolate will apply this permutation map right
+ // after kernel loading.
+ I->group()->source()->cid_permutation_map = std::move(old_to_new_cid);
}
class CidRewriteVisitor : public ObjectVisitor {
@@ -1503,31 +1512,45 @@
void ClassFinalizer::RemapClassIds(intptr_t* old_to_new_cid) {
Thread* T = Thread::Current();
- Isolate* I = T->isolate();
+ IsolateGroup* IG = T->isolate_group();
// Code, ICData, allocation stubs have now-invalid cids.
ClearAllCode();
{
+ // The [HeapIterationScope] also safepoints all threads.
HeapIterationScope his(T);
- I->set_remapping_cids(true);
- // Update the class table. Do it before rewriting cids in headers, as the
- // heap walkers load an object's size *after* calling the visitor.
- I->class_table()->Remap(old_to_new_cid);
+ IG->class_table()->Remap(old_to_new_cid);
+ IG->ForEachIsolate(
+ [&](Isolate* I) {
+ I->set_remapping_cids(true);
+
+ // Update the class table. Do it before rewriting cids in headers, as
+ // the heap walkers load an object's size *after* calling the visitor.
+ I->class_table()->Remap(old_to_new_cid);
+ },
+ /*is_at_safepoint=*/true);
// Rewrite cids in headers and cids in Classes, Fields, Types and
// TypeParameters.
{
CidRewriteVisitor visitor(old_to_new_cid);
- I->heap()->VisitObjects(&visitor);
+ IG->heap()->VisitObjects(&visitor);
}
- I->set_remapping_cids(false);
+
+ IG->ForEachIsolate(
+ [&](Isolate* I) {
+ I->set_remapping_cids(false);
+#if defined(DEBUG)
+ I->class_table()->Validate();
+#endif
+ },
+ /*is_at_safepoint=*/true);
}
#if defined(DEBUG)
- I->class_table()->Validate();
- I->heap()->Verify();
+ IG->heap()->Verify();
#endif
}
diff --git a/runtime/vm/class_finalizer.h b/runtime/vm/class_finalizer.h
index 4a82e1c..f580aaf 100644
--- a/runtime/vm/class_finalizer.h
+++ b/runtime/vm/class_finalizer.h
@@ -5,6 +5,8 @@
#ifndef RUNTIME_VM_CLASS_FINALIZER_H_
#define RUNTIME_VM_CLASS_FINALIZER_H_
+#include <memory>
+
#include "vm/allocation.h"
#include "vm/growable_array.h"
#include "vm/object.h"
diff --git a/runtime/vm/class_table.cc b/runtime/vm/class_table.cc
index 929a4b8..583d4ea 100644
--- a/runtime/vm/class_table.cc
+++ b/runtime/vm/class_table.cc
@@ -22,10 +22,7 @@
SharedClassTable::SharedClassTable()
: top_(kNumPredefinedCids),
capacity_(0),
- table_(NULL),
- old_tables_(new MallocGrowableArray<intptr_t*>()),
- unboxed_fields_map_(nullptr),
- old_unboxed_fields_maps_(new MallocGrowableArray<UnboxedFieldBitmap*>()) {
+ old_tables_(new MallocGrowableArray<void*>()) {
if (Dart::vm_isolate() == NULL) {
ASSERT(kInitialCapacity >= kNumPredefinedCids);
capacity_ = kInitialCapacity;
@@ -33,7 +30,7 @@
table_ = static_cast<intptr_t*>(calloc(capacity_, sizeof(intptr_t)));
} else {
// Duplicate the class table from the VM isolate.
- auto vm_shared_class_table = Dart::vm_isolate()->shared_class_table();
+ auto vm_shared_class_table = Dart::vm_isolate()->group()->class_table();
capacity_ = vm_shared_class_table->capacity_;
// Note that [calloc] will zero-initialize the memory.
table_ = static_cast<intptr_t*>(calloc(capacity_, sizeof(RawClass*)));
@@ -52,33 +49,23 @@
table_[kNeverCid] = vm_shared_class_table->SizeAt(kNeverCid);
}
#if defined(SUPPORT_UNBOXED_INSTANCE_FIELDS)
+ // Note that [calloc] will zero-initialize the memory.
unboxed_fields_map_ = static_cast<UnboxedFieldBitmap*>(
- malloc(capacity_ * sizeof(UnboxedFieldBitmap)));
- memset(unboxed_fields_map_, 0, sizeof(UnboxedFieldBitmap) * capacity_);
+ calloc(capacity_, sizeof(UnboxedFieldBitmap)));
#endif // defined(SUPPORT_UNBOXED_INSTANCE_FIELDS)
#ifndef PRODUCT
+ // Note that [calloc] will zero-initialize the memory.
trace_allocation_table_ =
- static_cast<uint8_t*>(malloc(capacity_ * sizeof(uint8_t))); // NOLINT
- for (intptr_t i = 0; i < capacity_; i++) {
- trace_allocation_table_[i] = 0;
- }
+ static_cast<uint8_t*>(calloc(capacity_, sizeof(uint8_t)));
#endif // !PRODUCT
}
SharedClassTable::~SharedClassTable() {
if (old_tables_ != NULL) {
FreeOldTables();
delete old_tables_;
- free(table_);
}
-
- if (old_unboxed_fields_maps_ != nullptr) {
- FreeOldUnboxedFieldsMaps();
- delete old_unboxed_fields_maps_;
- }
-
- if (unboxed_fields_map_ != nullptr) {
- free(unboxed_fields_map_);
- }
+ free(table_);
+ free(unboxed_fields_map_);
NOT_IN_PRODUCT(free(trace_allocation_table_));
}
@@ -114,14 +101,6 @@
}
}
-ClassTable::ClassTable(ClassTable* original,
- SharedClassTable* shared_class_table)
- : top_(original->top_),
- capacity_(original->top_),
- table_(original->table_),
- old_class_tables_(nullptr),
- shared_class_table_(shared_class_table) {}
-
ClassTable::~ClassTable() {
if (old_class_tables_ != nullptr) {
FreeOldTables();
@@ -152,12 +131,6 @@
}
}
-void SharedClassTable::FreeOldUnboxedFieldsMaps() {
- while (old_unboxed_fields_maps_->length() > 0) {
- free(old_unboxed_fields_maps_->RemoveLast());
- }
-}
-
void ClassTable::Register(const Class& cls) {
ASSERT(Thread::Current()->IsMutatorThread());
@@ -237,11 +210,13 @@
auto new_table = static_cast<RawClass**>(
malloc(new_capacity * sizeof(RawClass*))); // NOLINT
- memmove(new_table, table_, top_ * sizeof(RawClass*));
- memset(new_table + top_, 0, (new_capacity - top_) * sizeof(RawClass*));
- capacity_ = new_capacity;
+ memmove(new_table, table_, capacity_ * sizeof(RawClass*));
+ memset(new_table + capacity_, 0,
+ (new_capacity - capacity_) * sizeof(RawClass*));
old_class_tables_->Add(table_);
table_ = new_table; // TODO(koda): This should use atomics.
+
+ capacity_ = new_capacity;
}
void SharedClassTable::AllocateIndex(intptr_t index) {
@@ -265,33 +240,36 @@
intptr_t* new_table = static_cast<intptr_t*>(
malloc(new_capacity * sizeof(intptr_t))); // NOLINT
- memmove(new_table, table_, top_ * sizeof(intptr_t));
- memset(new_table + top_, 0, (new_capacity - top_) * sizeof(intptr_t));
-#ifndef PRODUCT
- auto new_stats_table =
- static_cast<uint8_t*>(realloc(trace_allocation_table_,
- new_capacity * sizeof(uint8_t))); // NOLINT
-#endif
- for (intptr_t i = capacity_; i < new_capacity; i++) {
- new_table[i] = 0;
- NOT_IN_PRODUCT(new_stats_table[i] = 0);
- }
+ memmove(new_table, table_, capacity_ * sizeof(intptr_t));
+ memset(new_table + capacity_, 0,
+ (new_capacity - capacity_) * sizeof(intptr_t));
- capacity_ = new_capacity;
+#if !defined(PRODUCT)
+ auto new_trace_table =
+ static_cast<uint8_t*>(malloc(new_capacity * sizeof(uint8_t))); // NOLINT
+ memmove(new_trace_table, trace_allocation_table_,
+ capacity_ * sizeof(uint8_t));
+ memset(new_trace_table + capacity_, 0,
+ (new_capacity - capacity_) * sizeof(uint8_t));
+#endif
+
old_tables_->Add(table_);
table_ = new_table; // TODO(koda): This should use atomics.
- NOT_IN_PRODUCT(trace_allocation_table_ = new_stats_table);
+ NOT_IN_PRODUCT(old_tables_->Add(trace_allocation_table_));
+ NOT_IN_PRODUCT(trace_allocation_table_ = new_trace_table);
#if defined(SUPPORT_UNBOXED_INSTANCE_FIELDS)
auto new_unboxed_fields_map = static_cast<UnboxedFieldBitmap*>(
malloc(new_capacity * sizeof(UnboxedFieldBitmap)));
memmove(new_unboxed_fields_map, unboxed_fields_map_,
- top_ * sizeof(UnboxedFieldBitmap));
- memset(new_unboxed_fields_map + top_, 0,
- (new_capacity - top_) * sizeof(UnboxedFieldBitmap));
- old_unboxed_fields_maps_->Add(unboxed_fields_map_);
+ capacity_ * sizeof(UnboxedFieldBitmap));
+ memset(new_unboxed_fields_map + capacity_, 0,
+ (new_capacity - capacity_) * sizeof(UnboxedFieldBitmap));
+ old_tables_->Add(unboxed_fields_map_);
unboxed_fields_map_ = new_unboxed_fields_map;
#endif // defined(SUPPORT_UNBOXED_INSTANCE_FIELDS)
+
+ capacity_ = new_capacity;
}
void ClassTable::Unregister(intptr_t index) {
@@ -308,26 +286,23 @@
void ClassTable::Remap(intptr_t* old_to_new_cid) {
ASSERT(Thread::Current()->IsAtSafepoint());
- shared_class_table_->Remap(old_to_new_cid);
-
const intptr_t num_cids = NumCids();
- auto cls_by_old_cid = new RawClass*[num_cids];
- memmove(cls_by_old_cid, table_, sizeof(RawClass*) * num_cids);
+ std::unique_ptr<RawClass*[]> cls_by_old_cid(new RawClass*[num_cids]);
+ memmove(cls_by_old_cid.get(), table_, sizeof(RawClass*) * num_cids);
for (intptr_t i = 0; i < num_cids; i++) {
table_[old_to_new_cid[i]] = cls_by_old_cid[i];
}
- delete[] cls_by_old_cid;
}
void SharedClassTable::Remap(intptr_t* old_to_new_cid) {
ASSERT(Thread::Current()->IsAtSafepoint());
const intptr_t num_cids = NumCids();
- std::unique_ptr<intptr_t[]> cls_by_old_cid(new intptr_t[num_cids]);
+ std::unique_ptr<intptr_t[]> size_by_old_cid(new intptr_t[num_cids]);
for (intptr_t i = 0; i < num_cids; i++) {
- cls_by_old_cid[i] = table_[i];
+ size_by_old_cid[i] = table_[i];
}
for (intptr_t i = 0; i < num_cids; i++) {
- table_[old_to_new_cid[i]] = cls_by_old_cid[i];
+ table_[old_to_new_cid[i]] = size_by_old_cid[i];
}
#if defined(SUPPORT_UNBOXED_INSTANCE_FIELDS)
@@ -428,18 +403,20 @@
void ClassTable::AllocationProfilePrintJSON(JSONStream* stream, bool internal) {
Isolate* isolate = Isolate::Current();
ASSERT(isolate != NULL);
- Heap* heap = isolate->heap();
+ auto isolate_group = isolate->group();
+ Heap* heap = isolate_group->heap();
ASSERT(heap != NULL);
JSONObject obj(stream);
obj.AddProperty("type", "AllocationProfile");
- if (isolate->last_allocationprofile_accumulator_reset_timestamp() != 0) {
+ if (isolate_group->last_allocationprofile_accumulator_reset_timestamp() !=
+ 0) {
obj.AddPropertyF(
"dateLastAccumulatorReset", "%" Pd64 "",
- isolate->last_allocationprofile_accumulator_reset_timestamp());
+ isolate_group->last_allocationprofile_accumulator_reset_timestamp());
}
- if (isolate->last_allocationprofile_gc_timestamp() != 0) {
+ if (isolate_group->last_allocationprofile_gc_timestamp() != 0) {
obj.AddPropertyF("dateLastServiceGC", "%" Pd64 "",
- isolate->last_allocationprofile_gc_timestamp());
+ isolate_group->last_allocationprofile_gc_timestamp());
}
if (internal) {
@@ -458,7 +435,7 @@
{
HeapIterationScope iter(thread);
iter.IterateObjects(&visitor);
- isolate->VisitWeakPersistentHandles(&visitor);
+ isolate->group()->VisitWeakPersistentHandles(&visitor);
}
{
diff --git a/runtime/vm/class_table.h b/runtime/vm/class_table.h
index 62383d3..0ff2912 100644
--- a/runtime/vm/class_table.h
+++ b/runtime/vm/class_table.h
@@ -5,6 +5,8 @@
#ifndef RUNTIME_VM_CLASS_TABLE_H_
#define RUNTIME_VM_CLASS_TABLE_H_
+#include <memory>
+
#include "platform/assert.h"
#include "platform/atomic.h"
#include "platform/utils.h"
@@ -80,6 +82,7 @@
void SetSizeAt(intptr_t index, intptr_t size) {
ASSERT(IsValidIndex(index));
+
// Ensure we never change size for a given cid from one non-zero size to
// another non-zero size.
RELEASE_ASSERT(table_[index] == 0 || table_[index] == size);
@@ -200,6 +203,8 @@
static bool ShouldUpdateSizeForClassId(intptr_t cid);
#ifndef PRODUCT
+ // Copy-on-write is used for trace_allocation_table_, with old copies stored
+ // in old_tables_.
uint8_t* trace_allocation_table_ = nullptr;
#endif // !PRODUCT
@@ -211,8 +216,8 @@
intptr_t capacity_;
// Copy-on-write is used for table_, with old copies stored in old_tables_.
- intptr_t* table_; // Maps the cid to the instance size.
- MallocGrowableArray<intptr_t*>* old_tables_;
+ intptr_t* table_ = nullptr; // Maps the cid to the instance size.
+ MallocGrowableArray<void*>* old_tables_;
IsolateGroupReloadContext* reload_context_ = nullptr;
@@ -221,8 +226,7 @@
// the GC has to scan, a 1 indicates that the word is part of e.g. an unboxed
// double and does not need to be scanned. (see Class::Calculate...() where
// the bitmap is constructed)
- UnboxedFieldBitmap* unboxed_fields_map_;
- MallocGrowableArray<UnboxedFieldBitmap*>* old_unboxed_fields_maps_;
+ UnboxedFieldBitmap* unboxed_fields_map_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(SharedClassTable);
};
@@ -230,10 +234,6 @@
class ClassTable {
public:
explicit ClassTable(SharedClassTable* shared_class_table_);
-
- // Creates a shallow copy of the original class table for some read-only
- // access, without support for stats data.
- ClassTable(ClassTable* original, SharedClassTable* shared_class_table);
~ClassTable();
SharedClassTable* shared_class_table() const { return shared_class_table_; }
@@ -357,6 +357,9 @@
friend class MarkingWeakVisitor;
friend class Scavenger;
friend class ScavengerWeakVisitor;
+ friend Isolate* CreateWithinExistingIsolateGroup(IsolateGroup* group,
+ const char* name,
+ char** error);
static const int kInitialCapacity = SharedClassTable::kInitialCapacity;
static const int kCapacityIncrement = SharedClassTable::kCapacityIncrement;
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index aad57c1..0fc808c 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -31,6 +31,13 @@
namespace dart {
+#if defined(DART_PRECOMPILER)
+DEFINE_FLAG(charp,
+ write_v8_snapshot_profile_to,
+ NULL,
+ "Write a snapshot profile in V8 format to a file.");
+#endif // defined(DART_PRECOMPILER)
+
#if defined(DART_PRECOMPILER) && !defined(TARGET_ARCH_IA32)
static void RelocateCodeObjects(
@@ -206,7 +213,7 @@
UnboxedFieldBitmap CalculateTargetUnboxedFieldsBitmap(Serializer* s,
intptr_t class_id) {
const auto unboxed_fields_bitmap_host =
- s->isolate()->shared_class_table()->GetUnboxedFieldsMapAt(class_id);
+ s->isolate()->group()->class_table()->GetUnboxedFieldsMapAt(class_id);
UnboxedFieldBitmap unboxed_fields_bitmap;
if (unboxed_fields_bitmap_host.IsEmpty() ||
@@ -310,6 +317,7 @@
}
}
+ auto shared_class_table = d->isolate()->group()->class_table();
for (intptr_t id = start_index_; id < stop_index_; id++) {
RawClass* cls = reinterpret_cast<RawClass*>(d->Ref(id));
Deserializer::InitializeHeader(cls, kClassCid, Class::InstanceSize());
@@ -347,8 +355,7 @@
if (FLAG_precompiled_mode) {
const UnboxedFieldBitmap unboxed_fields_map(d->ReadUnsigned64());
- d->isolate()->shared_class_table()->SetUnboxedFieldsMapAt(
- class_id, unboxed_fields_map);
+ shared_class_table->SetUnboxedFieldsMapAt(class_id, unboxed_fields_map);
}
}
}
@@ -1460,7 +1467,9 @@
RawCode* code = Code::RawCast(object);
objects_.Add(code);
- s->Push(code->ptr()->object_pool_);
+ if (!(s->kind() == Snapshot::kFullAOT && FLAG_use_bare_instructions)) {
+ s->Push(code->ptr()->object_pool_);
+ }
s->Push(code->ptr()->owner_);
s->Push(code->ptr()->exception_handlers_);
s->Push(code->ptr()->pc_descriptors_);
@@ -1521,7 +1530,26 @@
active_unchecked_offset, code, i);
}
- WriteField(code, object_pool_);
+ // No need to write object pool out if we are producing full AOT
+ // snapshot with bare instructions.
+ if (!(kind == Snapshot::kFullAOT && FLAG_use_bare_instructions)) {
+ WriteField(code, object_pool_);
+#if defined(DART_PRECOMPILER)
+ } else if (FLAG_write_v8_snapshot_profile_to != nullptr &&
+ code->ptr()->object_pool_ != ObjectPool::null()) {
+ // If we are writing V8 snapshot profile then attribute references
+ // going through the object pool to the code object itself.
+ RawObjectPool* pool = code->ptr()->object_pool_;
+
+ for (intptr_t i = 0; i < pool->ptr()->length_; i++) {
+ uint8_t bits = pool->ptr()->entry_bits()[i];
+ if (ObjectPool::TypeBits::decode(bits) ==
+ ObjectPool::EntryType::kTaggedObject) {
+ s->AttributeElementRef(pool->ptr()->data()[i].raw_obj_, i);
+ }
+ }
+#endif // defined(DART_PRECOMPILER)
+ }
WriteField(code, owner_);
WriteField(code, exception_handlers_);
WriteField(code, pc_descriptors_);
@@ -1604,8 +1632,14 @@
d->ReadInstructions(code, id, start_index_);
- code->ptr()->object_pool_ =
- reinterpret_cast<RawObjectPool*>(d->ReadRef());
+ // There would be a single global pool if this is a full AOT snapshot
+ // with bare instructions.
+ if (!(d->kind() == Snapshot::kFullAOT && FLAG_use_bare_instructions)) {
+ code->ptr()->object_pool_ =
+ reinterpret_cast<RawObjectPool*>(d->ReadRef());
+ } else {
+ code->ptr()->object_pool_ = ObjectPool::null();
+ }
code->ptr()->owner_ = d->ReadRef();
code->ptr()->exception_handlers_ =
reinterpret_cast<RawExceptionHandlers*>(d->ReadRef());
@@ -2802,7 +2836,7 @@
const intptr_t next_field_offset = host_next_field_offset_in_words_
<< kWordSizeLog2;
const auto unboxed_fields_bitmap =
- s->isolate()->shared_class_table()->GetUnboxedFieldsMapAt(cid_);
+ s->isolate()->group()->class_table()->GetUnboxedFieldsMapAt(cid_);
intptr_t offset = Instance::NextFieldOffset();
while (offset < next_field_offset) {
// Skips unboxed fields
@@ -2837,13 +2871,12 @@
intptr_t next_field_offset = host_next_field_offset_in_words_
<< kWordSizeLog2;
const intptr_t count = objects_.length();
- const auto shared_class_table = s->isolate()->shared_class_table();
+ const auto unboxed_fields_bitmap =
+ s->isolate()->group()->class_table()->GetUnboxedFieldsMapAt(cid_);
for (intptr_t i = 0; i < count; i++) {
RawInstance* instance = objects_[i];
AutoTraceObject(instance);
s->Write<bool>(instance->IsCanonical());
- const auto unboxed_fields_bitmap =
- shared_class_table->GetUnboxedFieldsMapAt(cid_);
intptr_t offset = Instance::NextFieldOffset();
while (offset < next_field_offset) {
if (unboxed_fields_bitmap.Get(offset / kWordSize)) {
@@ -2896,14 +2929,13 @@
intptr_t instance_size =
Object::RoundedAllocationSize(instance_size_in_words_ * kWordSize);
- const auto shared_class_table = d->isolate()->shared_class_table();
+ const auto unboxed_fields_bitmap =
+ d->isolate()->group()->class_table()->GetUnboxedFieldsMapAt(cid_);
for (intptr_t id = start_index_; id < stop_index_; id++) {
RawInstance* instance = reinterpret_cast<RawInstance*>(d->Ref(id));
bool is_canonical = d->Read<bool>();
Deserializer::InitializeHeader(instance, cid_, instance_size,
is_canonical);
- const auto unboxed_fields_bitmap =
- shared_class_table->GetUnboxedFieldsMapAt(cid_);
intptr_t offset = Instance::NextFieldOffset();
while (offset < next_field_offset) {
if (unboxed_fields_bitmap.Get(offset / kWordSize)) {
@@ -5114,10 +5146,11 @@
Serialize();
// Write roots.
- WriteRootRef(symbols.raw());
+ WriteRootRef(symbols.raw(), "symbol-table");
if (Snapshot::IncludesCode(kind_)) {
for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
- WriteRootRef(StubCode::EntryAt(i).raw());
+ WriteRootRef(StubCode::EntryAt(i).raw(),
+ zone_->PrintToString("Stub:%s", StubCode::NameAt(i)));
}
}
@@ -5135,6 +5168,13 @@
return next_ref_index_ - 1;
}
+static const char* kObjectStoreFieldNames[] = {
+#define DECLARE_OBJECT_STORE_FIELD(Type, Name) #Name,
+ OBJECT_STORE_FIELD_LIST(DECLARE_OBJECT_STORE_FIELD,
+ DECLARE_OBJECT_STORE_FIELD)
+#undef DECLARE_OBJECT_STORE_FIELD
+};
+
void Serializer::WriteIsolateSnapshot(intptr_t num_base_objects,
ObjectStore* object_store) {
NoSafepointScope no_safepoint;
@@ -5162,7 +5202,7 @@
// Write roots.
for (RawObject** p = from; p <= to; p++) {
- WriteRootRef(*p);
+ WriteRootRef(*p, kObjectStoreFieldNames[p - from]);
}
// Serialize dispatch table.
@@ -5767,12 +5807,6 @@
Bootstrap::SetupNativeResolver();
}
-#if defined(DART_PRECOMPILER)
-DEFINE_FLAG(charp,
- write_v8_snapshot_profile_to,
- NULL,
- "Write a snapshot profile in V8 format to a file.");
-#endif
#if !defined(DART_PRECOMPILED_RUNTIME)
FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind,
@@ -5929,7 +5963,6 @@
size_(snapshot->length()),
data_image_(snapshot->DataImage()),
instructions_image_(instructions_buffer) {
- thread->isolate()->set_compilation_allowed(kind_ != Snapshot::kFullAOT);
}
char* SnapshotHeaderReader::InitializeGlobalVMFlagsFromSnapshot(
diff --git a/runtime/vm/clustered_snapshot.h b/runtime/vm/clustered_snapshot.h
index 919ee4b..d9e2a83 100644
--- a/runtime/vm/clustered_snapshot.h
+++ b/runtime/vm/clustered_snapshot.h
@@ -276,11 +276,11 @@
}
public:
- void WriteRootRef(RawObject* object) {
+ void WriteRootRef(RawObject* object, const char* name = nullptr) {
intptr_t id = WriteRefId(object);
WriteUnsigned(id);
if (profile_writer_ != nullptr) {
- profile_writer_->AddRoot({V8SnapshotProfileWriter::kSnapshot, id});
+ profile_writer_->AddRoot({V8SnapshotProfileWriter::kSnapshot, id}, name);
}
}
@@ -296,6 +296,23 @@
}
}
+ // Record a reference from the currently written object to the given object
+ // without actually writing the reference into the snapshot.
+ // Used to create artificial connection between objects which are not
+ // explicitly connected in the heap, for example an object referenced
+ // by the global object pool is in reality referenced by the code which
+ // caused this reference to be added to the global object pool.
+ void AttributeElementRef(RawObject* object, intptr_t index) {
+ intptr_t id = WriteRefId(object);
+ if (profile_writer_ != nullptr) {
+ profile_writer_->AttributeReferenceTo(
+ {V8SnapshotProfileWriter::kSnapshot, object_currently_writing_.id_},
+ {{V8SnapshotProfileWriter::kSnapshot, id},
+ V8SnapshotProfileWriter::Reference::kElement,
+ index});
+ }
+ }
+
void WritePropertyRef(RawObject* object, const char* property) {
intptr_t id = WriteRefId(object);
WriteUnsigned(id);
diff --git a/runtime/vm/compiler/aot/aot_call_specializer.cc b/runtime/vm/compiler/aot/aot_call_specializer.cc
index 00e1c47..d988c28 100644
--- a/runtime/vm/compiler/aot/aot_call_specializer.cc
+++ b/runtime/vm/compiler/aot/aot_call_specializer.cc
@@ -251,6 +251,10 @@
bool AotCallSpecializer::TryInlineFieldAccess(StaticCallInstr* call) {
if (call->function().IsImplicitGetterFunction()) {
Field& field = Field::ZoneHandle(call->function().accessor_field());
+ if (field.is_late()) {
+ // TODO(dartbug.com/40447): Inline implicit getters for late fields.
+ return false;
+ }
if (should_clone_fields_) {
field = field.CloneFromOriginal();
}
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index 6e88e7d..f0cbab4 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -34,7 +34,6 @@
#include "vm/flags.h"
#include "vm/hash_table.h"
#include "vm/isolate.h"
-#include "vm/kernel_loader.h" // For kernel::ParseStaticFieldInitializer.
#include "vm/log.h"
#include "vm/longjump.h"
#include "vm/object.h"
@@ -195,8 +194,6 @@
}
void Precompiler::DoCompileAll() {
- ASSERT(I->compilation_allowed());
-
{
StackZone stack_zone(T);
zone_ = stack_zone.GetZone();
@@ -391,8 +388,6 @@
}
}
- I->set_compilation_allowed(false);
-
if (FLAG_serialize_flow_graphs_to != nullptr &&
Dart::file_write_callback() != nullptr) {
if (auto file_close = Dart::file_close_callback()) {
@@ -419,7 +414,6 @@
Class& null_class = Class::Handle(Z);
Function& null_function = Function::Handle(Z);
Field& null_field = Field::Handle(Z);
- I->object_store()->set_future_class(null_class);
I->object_store()->set_pragma_class(null_class);
I->object_store()->set_pragma_name(null_field);
I->object_store()->set_pragma_options(null_field);
@@ -947,7 +941,7 @@
class ConstObjectVisitor : public ObjectPointerVisitor {
public:
ConstObjectVisitor(Precompiler* precompiler, Isolate* isolate)
- : ObjectPointerVisitor(isolate),
+ : ObjectPointerVisitor(isolate->group()),
precompiler_(precompiler),
subinstance_(Object::Handle()) {}
@@ -1022,8 +1016,10 @@
Zone* zone = stack_zone.GetZone();
ASSERT(Error::Handle(zone, thread->sticky_error()).IsNull());
+ const Function& initializer_fun =
+ Function::ZoneHandle(zone, field.EnsureInitializerFunction());
ParsedFunction* parsed_function =
- kernel::ParseStaticFieldInitializer(zone, field);
+ new (zone) ParsedFunction(thread, initializer_fun);
DartCompilationPipeline pipeline;
PrecompileParsedFunctionHelper helper(Precompiler::Instance(),
@@ -2142,9 +2138,9 @@
}
}
-void Precompiler::DedupUnlinkedCalls() {
- ASSERT(!I->compilation_allowed());
+DECLARE_FLAG(charp, write_v8_snapshot_profile_to);
+void Precompiler::DedupUnlinkedCalls() {
class UnlinkedCallDeduper {
public:
explicit UnlinkedCallDeduper(Zone* zone)
@@ -2213,7 +2209,16 @@
ASSERT(gop.IsNull() != FLAG_use_bare_instructions);
if (FLAG_use_bare_instructions) {
deduper.DedupPool(gop);
- } else {
+ }
+
+ // Note: in bare instructions mode we can still have object pools attached
+ // to code objects and these pools need to be deduplicated.
+ // We use these pools to carry information about references between code
+ // objects and other objects in the snapshots (these references are otherwise
+ // implicit and go through global object pool). This information is needed
+ // to produce more informative snapshot profile.
+ if (!FLAG_use_bare_instructions ||
+ FLAG_write_v8_snapshot_profile_to != nullptr) {
DedupUnlinkedCallsVisitor visitor(&deduper, Z);
// We need both iterations to ensure we visit all the functions that might
diff --git a/runtime/vm/compiler/asm_intrinsifier_arm.cc b/runtime/vm/compiler/asm_intrinsifier_arm.cc
index f35f80c..3866061 100644
--- a/runtime/vm/compiler/asm_intrinsifier_arm.cc
+++ b/runtime/vm/compiler/asm_intrinsifier_arm.cc
@@ -446,21 +446,21 @@
// ((1 << R0) - 1), shifting it to the left, masking R1, then shifting back.
// high bits = (((1 << R0) - 1) << (32 - R0)) & R1) >> (32 - R0)
// lo bits = R1 << R0
- __ LoadImmediate(NOTFP, 1);
- __ mov(NOTFP, Operand(NOTFP, LSL, R0)); // NOTFP <- 1 << R0
- __ sub(NOTFP, NOTFP, Operand(1)); // NOTFP <- NOTFP - 1
+ __ LoadImmediate(R8, 1);
+ __ mov(R8, Operand(R8, LSL, R0)); // R8 <- 1 << R0
+ __ sub(R8, R8, Operand(1)); // R8 <- R8 - 1
__ rsb(R3, R0, Operand(32)); // R3 <- 32 - R0
- __ mov(NOTFP, Operand(NOTFP, LSL, R3)); // NOTFP <- NOTFP << R3
- __ and_(NOTFP, R1, Operand(NOTFP)); // NOTFP <- NOTFP & R1
- __ mov(NOTFP, Operand(NOTFP, LSR, R3)); // NOTFP <- NOTFP >> R3
- // Now NOTFP has the bits that fall off of R1 on a left shift.
+ __ mov(R8, Operand(R8, LSL, R3)); // R8 <- R8 << R3
+ __ and_(R8, R1, Operand(R8)); // R8 <- R8 & R1
+ __ mov(R8, Operand(R8, LSR, R3)); // R8 <- R8 >> R3
+ // Now R8 has the bits that fall off of R1 on a left shift.
__ mov(R1, Operand(R1, LSL, R0)); // R1 gets the low bits.
const Class& mint_class = MintClass();
__ TryAllocate(mint_class, normal_ir_body, R0, R2);
__ str(R1, FieldAddress(R0, target::Mint::value_offset()));
- __ str(NOTFP,
+ __ str(R8,
FieldAddress(R0, target::Mint::value_offset() + target::kWordSize));
__ Ret();
__ Bind(normal_ir_body);
@@ -532,13 +532,13 @@
// Get left as 64 bit integer.
Get64SmiOrMint(assembler, R3, R2, R1, normal_ir_body);
// Get right as 64 bit integer.
- Get64SmiOrMint(assembler, NOTFP, R8, R0, normal_ir_body);
+ Get64SmiOrMint(assembler, R1, R8, R0, normal_ir_body);
// R3: left high.
// R2: left low.
- // NOTFP: right high.
+ // R1: right high.
// R8: right low.
- __ cmp(R3, Operand(NOTFP)); // Compare left hi, right high.
+ __ cmp(R3, Operand(R1)); // Compare left hi, right high.
__ b(&is_false, hi_false_cond);
__ b(&is_true, hi_true_cond);
__ cmp(R2, Operand(R8)); // Compare left lo, right lo.
@@ -689,12 +689,12 @@
__ Asr(R4, R3, Operand(5));
// R8 = &x_digits[0]
__ add(R8, R1, Operand(target::TypedData::data_offset() - kHeapObjectTag));
- // NOTFP = &x_digits[x_used]
- __ add(NOTFP, R8, Operand(R0, LSL, 1));
// R6 = &r_digits[1]
__ add(R6, R2,
Operand(target::TypedData::data_offset() - kHeapObjectTag +
kBytesPerBigIntDigit));
+ // R2 = &x_digits[x_used]
+ __ add(R2, R8, Operand(R0, LSL, 1));
// R6 = &r_digits[x_used + n ~/ _DIGIT_BITS + 1]
__ add(R4, R4, Operand(R0, ASR, 1));
__ add(R6, R6, Operand(R4, LSL, 2));
@@ -705,11 +705,11 @@
__ mov(R9, Operand(0));
Label loop;
__ Bind(&loop);
- __ ldr(R4, Address(NOTFP, -kBytesPerBigIntDigit, Address::PreIndex));
+ __ ldr(R4, Address(R2, -kBytesPerBigIntDigit, Address::PreIndex));
__ orr(R9, R9, Operand(R4, LSR, R0));
__ str(R9, Address(R6, -kBytesPerBigIntDigit, Address::PreIndex));
__ mov(R9, Operand(R4, LSL, R1));
- __ teq(NOTFP, Operand(R8));
+ __ teq(R2, Operand(R8));
__ b(&loop, NE);
__ str(R9, Address(R6, -kBytesPerBigIntDigit, Address::PreIndex));
__ LoadObject(R0, NullObject());
@@ -729,9 +729,9 @@
__ Asr(R4, R3, Operand(5));
// R6 = &r_digits[0]
__ add(R6, R2, Operand(target::TypedData::data_offset() - kHeapObjectTag));
- // NOTFP = &x_digits[n ~/ _DIGIT_BITS]
- __ add(NOTFP, R1, Operand(target::TypedData::data_offset() - kHeapObjectTag));
- __ add(NOTFP, NOTFP, Operand(R4, LSL, 2));
+ // R2 = &x_digits[n ~/ _DIGIT_BITS]
+ __ add(R2, R1, Operand(target::TypedData::data_offset() - kHeapObjectTag));
+ __ add(R2, R2, Operand(R4, LSL, 2));
// R8 = &r_digits[x_used - n ~/ _DIGIT_BITS - 1]
__ add(R4, R4, Operand(1));
__ rsb(R4, R4, Operand(R0, ASR, 1));
@@ -741,13 +741,13 @@
// R0 = 32 - R1
__ rsb(R0, R1, Operand(32));
// R9 = x_digits[n ~/ _DIGIT_BITS] >> (n % _DIGIT_BITS)
- __ ldr(R9, Address(NOTFP, kBytesPerBigIntDigit, Address::PostIndex));
+ __ ldr(R9, Address(R2, kBytesPerBigIntDigit, Address::PostIndex));
__ mov(R9, Operand(R9, LSR, R1));
Label loop_entry;
__ b(&loop_entry);
Label loop;
__ Bind(&loop);
- __ ldr(R4, Address(NOTFP, kBytesPerBigIntDigit, Address::PostIndex));
+ __ ldr(R4, Address(R2, kBytesPerBigIntDigit, Address::PostIndex));
__ orr(R9, R9, Operand(R4, LSL, R0));
__ str(R9, Address(R6, kBytesPerBigIntDigit, Address::PostIndex));
__ mov(R9, Operand(R4, LSR, R1));
@@ -780,8 +780,8 @@
// R8 = &r_digits[0]
__ add(R8, R8, Operand(target::TypedData::data_offset() - kHeapObjectTag));
- // NOTFP = &digits[a_used >> 1], a_used is Smi.
- __ add(NOTFP, R1, Operand(R2, LSL, 1));
+ // R2 = &digits[a_used >> 1], a_used is Smi.
+ __ add(R2, R1, Operand(R2, LSL, 1));
// R6 = &digits[used >> 1], used is Smi.
__ add(R6, R1, Operand(R0, LSL, 1));
@@ -793,7 +793,7 @@
__ ldr(R4, Address(R1, kBytesPerBigIntDigit, Address::PostIndex));
__ ldr(R9, Address(R3, kBytesPerBigIntDigit, Address::PostIndex));
__ adcs(R4, R4, Operand(R9));
- __ teq(R1, Operand(NOTFP)); // Does not affect carry flag.
+ __ teq(R1, Operand(R2)); // Does not affect carry flag.
__ str(R4, Address(R8, kBytesPerBigIntDigit, Address::PostIndex));
__ b(&add_loop, NE);
@@ -840,8 +840,8 @@
// R8 = &r_digits[0]
__ add(R8, R8, Operand(target::TypedData::data_offset() - kHeapObjectTag));
- // NOTFP = &digits[a_used >> 1], a_used is Smi.
- __ add(NOTFP, R1, Operand(R2, LSL, 1));
+ // R2 = &digits[a_used >> 1], a_used is Smi.
+ __ add(R2, R1, Operand(R2, LSL, 1));
// R6 = &digits[used >> 1], used is Smi.
__ add(R6, R1, Operand(R0, LSL, 1));
@@ -853,7 +853,7 @@
__ ldr(R4, Address(R1, kBytesPerBigIntDigit, Address::PostIndex));
__ ldr(R9, Address(R3, kBytesPerBigIntDigit, Address::PostIndex));
__ sbcs(R4, R4, Operand(R9));
- __ teq(R1, Operand(NOTFP)); // Does not affect carry flag.
+ __ teq(R1, Operand(R2)); // Does not affect carry flag.
__ str(R4, Address(R8, kBytesPerBigIntDigit, Address::PostIndex));
__ b(&sub_loop, NE);
@@ -1005,6 +1005,8 @@
// return 1;
// }
+ // The code has no bailout path, so we can use R6 (CODE_REG) freely.
+
// R4 = xip = &x_digits[i >> 1]
__ ldrd(R2, R3, SP, 2 * target::kWordSize); // R2 = i as Smi, R3 = x_digits
__ add(R3, R3, Operand(R2, LSL, 1));
@@ -1016,18 +1018,18 @@
__ tst(R3, Operand(R3));
__ b(&x_zero, EQ);
- // NOTFP = ajp = &a_digits[i]
+ // R6 = ajp = &a_digits[i]
__ ldr(R1, Address(SP, 1 * target::kWordSize)); // a_digits
__ add(R1, R1, Operand(R2, LSL, 2)); // j == 2*i, i is Smi.
- __ add(NOTFP, R1, Operand(target::TypedData::data_offset() - kHeapObjectTag));
+ __ add(R6, R1, Operand(target::TypedData::data_offset() - kHeapObjectTag));
// R8:R0 = t = x*x + *ajp
- __ ldr(R0, Address(NOTFP, 0));
+ __ ldr(R0, Address(R6, 0));
__ mov(R8, Operand(0));
__ umaal(R0, R8, R3, R3); // R8:R0 = R3*R3 + R8 + R0.
// *ajp++ = low32(t) = R0
- __ str(R0, Address(NOTFP, kBytesPerBigIntDigit, Address::PostIndex));
+ __ str(R0, Address(R6, kBytesPerBigIntDigit, Address::PostIndex));
// R8 = low32(c) = high32(t)
// R9 = high32(c) = 0
@@ -1035,9 +1037,9 @@
// int n = used - i - 1; while (--n >= 0) ...
__ ldr(R0, Address(SP, 0 * target::kWordSize)); // used is Smi
- __ sub(R6, R0, Operand(R2));
+ __ sub(TMP, R0, Operand(R2));
__ mov(R0, Operand(2)); // n = used - i - 2; if (n >= 0) ... while (--n >= 0)
- __ rsbs(R6, R0, Operand(R6, ASR, kSmiTagSize));
+ __ rsbs(TMP, R0, Operand(TMP, ASR, kSmiTagSize));
Label loop, done;
__ b(&done, MI);
@@ -1045,10 +1047,10 @@
__ Bind(&loop);
// x: R3
// xip: R4
- // ajp: NOTFP
+ // ajp: R6
// c: R9:R8
// t: R2:R1:R0 (not live at loop entry)
- // n: R6
+ // n: TMP
// uint32_t xi = *xip++
__ ldr(R2, Address(R4, kBytesPerBigIntDigit, Address::PostIndex));
@@ -1061,22 +1063,22 @@
__ adc(R2, R2, Operand(0)); // R2:R1:R0 = 2*x*xi.
__ adds(R0, R0, Operand(R8));
__ adcs(R1, R1, Operand(R9));
- __ adc(R2, R2, Operand(0)); // R2:R1:R0 = 2*x*xi + c.
- __ ldr(R8, Address(NOTFP, 0)); // R8 = aj = *ajp.
+ __ adc(R2, R2, Operand(0)); // R2:R1:R0 = 2*x*xi + c.
+ __ ldr(R8, Address(R6, 0)); // R8 = aj = *ajp.
__ adds(R0, R0, Operand(R8));
__ adcs(R8, R1, Operand(0));
__ adc(R9, R2, Operand(0)); // R9:R8:R0 = 2*x*xi + c + aj.
// *ajp++ = low32(t) = R0
- __ str(R0, Address(NOTFP, kBytesPerBigIntDigit, Address::PostIndex));
+ __ str(R0, Address(R6, kBytesPerBigIntDigit, Address::PostIndex));
// while (--n >= 0)
- __ subs(R6, R6, Operand(1)); // --n
+ __ subs(TMP, TMP, Operand(1)); // --n
__ b(&loop, PL);
__ Bind(&done);
// uint32_t aj = *ajp
- __ ldr(R0, Address(NOTFP, 0));
+ __ ldr(R0, Address(R6, 0));
// uint64_t t = aj + c
__ adds(R8, R8, Operand(R0));
@@ -1084,7 +1086,7 @@
// *ajp = low32(t) = R8
// *(ajp + 1) = high32(t) = R9
- __ strd(R8, R9, NOTFP, 0);
+ __ strd(R8, R9, R6, 0);
__ Bind(&x_zero);
__ mov(R0, Operand(target::ToRawSmi(1))); // One digit processed.
@@ -1821,11 +1823,11 @@
__ ldrh(R4, Address(R0, 0)); // this.codeUnitAt(i + start)
}
if (other_cid == kOneByteStringCid) {
- __ ldrb(NOTFP, Address(R2, 0)); // other.codeUnitAt(i)
+ __ ldrb(TMP, Address(R2, 0)); // other.codeUnitAt(i)
} else {
- __ ldrh(NOTFP, Address(R2, 0)); // other.codeUnitAt(i)
+ __ ldrh(TMP, Address(R2, 0)); // other.codeUnitAt(i)
}
- __ cmp(R4, Operand(NOTFP));
+ __ cmp(R4, Operand(TMP));
__ b(return_false, NE);
// i++, while (i < len)
@@ -1978,11 +1980,11 @@
// hash_ ^= hash_ >> 6;
// Get one characters (ch).
__ Bind(&loop);
- __ ldrb(NOTFP, Address(R8, 0));
- // NOTFP: ch.
+ __ ldrb(TMP, Address(R8, 0));
+ // TMP: ch.
__ add(R3, R3, Operand(1));
__ add(R8, R8, Operand(1));
- __ add(R0, R0, Operand(NOTFP));
+ __ add(R0, R0, Operand(TMP));
__ add(R0, R0, Operand(R0, LSL, 10));
__ eor(R0, R0, Operand(R0, LSR, 6));
__ cmp(R3, Operand(R2));
@@ -2043,8 +2045,8 @@
// R0: potential new object start.
// R1: potential next object start.
// R2: allocation size.
- __ ldr(NOTFP, Address(THR, target::Thread::end_offset()));
- __ cmp(R1, Operand(NOTFP));
+ __ ldr(TMP, Address(THR, target::Thread::end_offset()));
+ __ cmp(R1, Operand(TMP));
__ b(failure, CS);
// Successfully allocated the object(s), now update top to point to
@@ -2123,20 +2125,19 @@
// R2: Untagged number of bytes to copy.
// R0: Tagged result string.
// R8: Pointer into R3.
- // NOTFP: Pointer into R0.
- // R1: Scratch register.
+ // R1: Pointer into R0.
+ // TMP: Scratch register.
Label loop, done;
__ cmp(R2, Operand(0));
__ b(&done, LE);
__ mov(R8, Operand(R3));
- __ mov(NOTFP, Operand(R0));
+ __ mov(R1, Operand(R0));
__ Bind(&loop);
- __ ldrb(R1, Address(R8, 0));
- __ AddImmediate(R8, 1);
+ __ ldrb(TMP, Address(R8, 1, Address::PostIndex));
__ sub(R2, R2, Operand(1));
__ cmp(R2, Operand(0));
- __ strb(R1, FieldAddress(NOTFP, target::OneByteString::data_offset()));
- __ AddImmediate(NOTFP, 1);
+ __ strb(TMP, FieldAddress(R1, target::OneByteString::data_offset()));
+ __ add(R1, R1, Operand(1));
__ b(&loop, GT);
__ Bind(&done);
diff --git a/runtime/vm/compiler/assembler/assembler_arm.cc b/runtime/vm/compiler/assembler/assembler_arm.cc
index 532818e..b19f66b 100644
--- a/runtime/vm/compiler/assembler/assembler_arm.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm.cc
@@ -1577,12 +1577,17 @@
set_constant_pool_allowed(reg == PP);
}
-void Assembler::LoadIsolate(Register rd) {
- ldr(rd, Address(THR, target::Thread::isolate_offset()));
+void Assembler::SetupGlobalPoolAndDispatchTable() {
+ ASSERT(FLAG_precompiled_mode && FLAG_use_bare_instructions);
+ ldr(PP, Address(THR, target::Thread::global_object_pool_offset()));
+ if (FLAG_use_table_dispatch) {
+ ldr(DISPATCH_TABLE_REG,
+ Address(THR, target::Thread::dispatch_table_array_offset()));
+ }
}
-void Assembler::LoadDispatchTable(Register rd) {
- ldr(rd, Address(THR, target::Thread::dispatch_table_array_offset()));
+void Assembler::LoadIsolate(Register rd) {
+ ldr(rd, Address(THR, target::Thread::isolate_offset()));
}
bool Assembler::CanLoadFromObjectPool(const Object& object) const {
diff --git a/runtime/vm/compiler/assembler/assembler_arm.h b/runtime/vm/compiler/assembler/assembler_arm.h
index cab8e5c..83784e2 100644
--- a/runtime/vm/compiler/assembler/assembler_arm.h
+++ b/runtime/vm/compiler/assembler/assembler_arm.h
@@ -403,6 +403,11 @@
cmp(value, Operand(TMP));
}
+ void CompareTypeNullabilityWith(Register type, int8_t value) {
+ ldrb(TMP, FieldAddress(type, compiler::target::Type::nullability_offset()));
+ cmp(TMP, Operand(value));
+ }
+
// Misc. functionality
bool use_far_branches() const {
return FLAG_use_far_branches || use_far_branches_;
@@ -799,9 +804,9 @@
void RestoreCodePointer();
void LoadPoolPointer(Register reg = PP);
+ void SetupGlobalPoolAndDispatchTable();
void LoadIsolate(Register rd);
- void LoadDispatchTable(Register dst);
// Load word from pool from the given offset using encoding that
// InstructionPattern::DecodeLoadWordFromPool can decode.
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.h b/runtime/vm/compiler/assembler/assembler_arm64.h
index 1749401..4322594 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.h
+++ b/runtime/vm/compiler/assembler/assembler_arm64.h
@@ -482,6 +482,12 @@
cmp(value, Operand(TMP));
}
+ void CompareTypeNullabilityWith(Register type, int8_t value) {
+ ldr(TMP, FieldAddress(type, compiler::target::Type::nullability_offset()),
+ kUnsignedByte);
+ cmp(TMP, Operand(value));
+ }
+
bool use_far_branches() const {
return FLAG_use_far_branches || use_far_branches_;
}
diff --git a/runtime/vm/compiler/assembler/assembler_x64.h b/runtime/vm/compiler/assembler/assembler_x64.h
index 0fe00d3..6253c48 100644
--- a/runtime/vm/compiler/assembler/assembler_x64.h
+++ b/runtime/vm/compiler/assembler/assembler_x64.h
@@ -857,6 +857,11 @@
cmpq(value, address);
}
+ void CompareTypeNullabilityWith(Register type, int8_t value) {
+ cmpb(FieldAddress(type, compiler::target::Type::nullability_offset()),
+ Immediate(value));
+ }
+
void RestoreCodePointer();
void LoadPoolPointer(Register pp = PP);
diff --git a/runtime/vm/compiler/assembler/object_pool_builder.h b/runtime/vm/compiler/assembler/object_pool_builder.h
index 2cf9e41..de9749d 100644
--- a/runtime/vm/compiler/assembler/object_pool_builder.h
+++ b/runtime/vm/compiler/assembler/object_pool_builder.h
@@ -163,10 +163,20 @@
const ExternalLabel* label,
ObjectPoolBuilderEntry::Patchability patchable);
- intptr_t CurrentLength() const { return object_pool_.length(); }
- ObjectPoolBuilderEntry& EntryAt(intptr_t i) { return object_pool_[i]; }
+ intptr_t CurrentLength() const {
+ return object_pool_.length() + used_from_parent_.length();
+ }
+ ObjectPoolBuilderEntry& EntryAt(intptr_t i) {
+ if (i < used_from_parent_.length()) {
+ return parent_->EntryAt(used_from_parent_[i]);
+ }
+ return object_pool_[i - used_from_parent_.length()];
+ }
const ObjectPoolBuilderEntry& EntryAt(intptr_t i) const {
- return object_pool_[i];
+ if (i < used_from_parent_.length()) {
+ return parent_->EntryAt(used_from_parent_[i]);
+ }
+ return object_pool_[i - used_from_parent_.length()];
}
intptr_t AddObject(ObjectPoolBuilderEntry entry);
@@ -176,6 +186,8 @@
// we produced. In this case this function will return false.
bool TryCommitToParent();
+ bool HasParent() const { return parent_ != nullptr; }
+
private:
intptr_t FindObject(ObjectPoolBuilderEntry entry);
@@ -188,6 +200,8 @@
// to detect cases when parent pool grows due to nested code generations.
const intptr_t base_index_;
+ GrowableArray<intptr_t> used_from_parent_;
+
// Objects and jump targets.
GrowableArray<ObjectPoolBuilderEntry> object_pool_;
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.cc b/runtime/vm/compiler/backend/flow_graph_compiler.cc
index 3be2518..f7374e5 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler.cc
@@ -576,7 +576,6 @@
}
}
- entry->set_offset(assembler()->CodeSize());
BeginCodeSourceRange();
ASSERT(pending_deoptimization_env_ == NULL);
pending_deoptimization_env_ = entry->env();
@@ -1735,7 +1734,7 @@
#if defined(DEBUG)
// Allocating a scratch register here may cause stack spilling. Neither the
// source nor destination register should be SP-relative in that case.
- for (const Location loc : {dst, src}) {
+ for (const Location& loc : {dst, src}) {
ASSERT(!temp.DidAllocateTemporary() || !loc.HasStackIndex() ||
loc.base_reg() != SPREG);
}
@@ -2292,8 +2291,6 @@
compiler::Label* done) {
TypeUsageInfo* type_usage_info = thread()->type_usage_info();
- // TODO(regis): Take nnbd_mode() into account and pass it in a register.
-
// If the int type is assignable to [dst_type] we special case it on the
// caller side!
const Type& int_type = Type::Handle(zone(), Type::IntType());
@@ -2311,6 +2308,15 @@
// We can handle certain types very efficiently on the call site (with a
// bailout to the normal stub, which will do a runtime call).
if (dst_type.IsTypeParameter()) {
+ // In NNBD strong mode we need to handle null instance before calling TTS
+ // if type parameter is nullable or legacy because type parameter can be
+ // instantiated with a non-nullable type which rejects null.
+ // In NNBD weak mode or if type parameter is non-nullable or has
+ // undetermined nullability null instance is correctly handled by TTS.
+ if (FLAG_null_safety && (dst_type.IsNullable() || dst_type.IsLegacy())) {
+ __ CompareObject(instance_reg, Object::null_object());
+ __ BranchIf(EQUAL, done);
+ }
const TypeParameter& type_param = TypeParameter::Cast(dst_type);
const Register kTypeArgumentsReg = type_param.IsClassTypeParameter()
? instantiator_type_args_reg
@@ -2338,10 +2344,10 @@
const bool can_use_simple_cid_range_test =
hi->CanUseSubtypeRangeCheckFor(dst_type);
if (can_use_simple_cid_range_test) {
- const CidRangeVector& ranges =
- hi->SubtypeRangesForClass(type_class,
- /*include_abstract=*/false,
- /*exclude_null=*/false);
+ const CidRangeVector& ranges = hi->SubtypeRangesForClass(
+ type_class,
+ /*include_abstract=*/false,
+ /*exclude_null=*/!Instance::NullIsAssignableTo(dst_type));
if (ranges.length() <= kMaxNumberOfCidRangesToTest) {
if (is_non_smi) {
__ LoadClassId(scratch_reg, instance_reg);
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc b/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
index 01f53f9..719765a 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
@@ -368,8 +368,7 @@
// If instance is Smi, check directly.
const Class& smi_class = Class::Handle(zone(), Smi::Class());
if (Class::IsSubtypeOf(NNBDMode::kLegacyLib, smi_class,
- Object::null_type_arguments(), type_class,
- Object::null_type_arguments(), Heap::kOld)) {
+ Object::null_type_arguments(), type, Heap::kOld)) {
// Fast case for type = int/num/top-type.
__ b(is_instance_lbl, EQ);
} else {
@@ -702,8 +701,8 @@
ASSERT(!dst_type.IsNull());
ASSERT(dst_type.IsFinalized());
// Assignable check is skipped in FlowGraphBuilder, not here.
- ASSERT(!dst_type.IsDynamicType() && !dst_type.IsObjectType() &&
- !dst_type.IsVoidType());
+ ASSERT(!dst_type.IsTopTypeForAssignability());
+
const Register kInstantiatorTypeArgumentsReg = R2;
const Register kFunctionTypeArgumentsReg = R1;
@@ -713,9 +712,10 @@
} else {
compiler::Label is_assignable_fast, is_assignable, runtime_call;
- // A null object is always assignable and is returned as result.
- __ CompareObject(R0, Object::null_object());
- __ b(&is_assignable_fast, EQ);
+ if (Instance::NullIsAssignableTo(dst_type)) {
+ __ CompareObject(R0, Object::null_object());
+ __ b(&is_assignable_fast, EQ);
+ }
__ PushList((1 << kInstantiatorTypeArgumentsReg) |
(1 << kFunctionTypeArgumentsReg));
@@ -966,7 +966,7 @@
}
for (intptr_t i = 0; i < indirect_gotos_.length(); ++i) {
- indirect_gotos_[i]->ComputeOffsetTable();
+ indirect_gotos_[i]->ComputeOffsetTable(this);
}
}
@@ -1241,27 +1241,24 @@
Register cid_reg,
int32_t selector_offset,
const Array& arguments_descriptor) {
- const Register table_reg = LR;
- ASSERT(cid_reg != table_reg);
ASSERT(cid_reg != ARGS_DESC_REG);
if (!arguments_descriptor.IsNull()) {
__ LoadObject(ARGS_DESC_REG, arguments_descriptor);
}
intptr_t offset = (selector_offset - DispatchTable::OriginElement()) *
compiler::target::kWordSize;
- __ LoadDispatchTable(table_reg);
if (offset == 0) {
- __ ldr(LR, compiler::Address(table_reg, cid_reg, LSL,
+ __ ldr(LR, compiler::Address(DISPATCH_TABLE_REG, cid_reg, LSL,
compiler::target::kWordSizeLog2));
} else {
- __ add(table_reg, table_reg,
+ __ add(LR, DISPATCH_TABLE_REG,
compiler::Operand(cid_reg, LSL, compiler::target::kWordSizeLog2));
if (!Utils::IsAbsoluteUint(12, offset)) {
const intptr_t adjust = offset & -(1 << 12);
- __ AddImmediate(table_reg, table_reg, adjust);
+ __ AddImmediate(LR, LR, adjust);
offset -= adjust;
}
- __ ldr(LR, compiler::Address(table_reg, offset));
+ __ ldr(LR, compiler::Address(LR, offset));
}
__ blx(LR);
}
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc b/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc
index 62ac55c..0d89756 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc
@@ -353,8 +353,7 @@
// If instance is Smi, check directly.
const Class& smi_class = Class::Handle(zone(), Smi::Class());
if (Class::IsSubtypeOf(NNBDMode::kLegacyLib, smi_class,
- Object::null_type_arguments(), type_class,
- Object::null_type_arguments(), Heap::kOld)) {
+ Object::null_type_arguments(), type, Heap::kOld)) {
// Fast case for type = int/num/top-type.
__ BranchIfSmi(kInstanceReg, is_instance_lbl);
} else {
@@ -679,8 +678,8 @@
ASSERT(!dst_type.IsNull());
ASSERT(dst_type.IsFinalized());
// Assignable check is skipped in FlowGraphBuilder, not here.
- ASSERT(!dst_type.IsDynamicType() && !dst_type.IsObjectType() &&
- !dst_type.IsVoidType());
+ ASSERT(!dst_type.IsTopTypeForAssignability());
+
const Register kInstantiatorTypeArgumentsReg = R1;
const Register kFunctionTypeArgumentsReg = R2;
@@ -690,9 +689,10 @@
} else {
compiler::Label is_assignable_fast, is_assignable, runtime_call;
- // A null object is always assignable and is returned as result.
- __ CompareObject(R0, Object::null_object());
- __ b(&is_assignable_fast, EQ);
+ if (Instance::NullIsAssignableTo(dst_type)) {
+ __ CompareObject(R0, Object::null_object());
+ __ b(&is_assignable_fast, EQ);
+ }
__ PushPair(kFunctionTypeArgumentsReg, kInstantiatorTypeArgumentsReg);
@@ -937,7 +937,7 @@
}
for (intptr_t i = 0; i < indirect_gotos_.length(); ++i) {
- indirect_gotos_[i]->ComputeOffsetTable();
+ indirect_gotos_[i]->ComputeOffsetTable(this);
}
}
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc b/runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc
index a1e6a5a..674f9cb 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc
@@ -344,8 +344,7 @@
// If instance is Smi, check directly.
const Class& smi_class = Class::Handle(zone(), Smi::Class());
if (Class::IsSubtypeOf(NNBDMode::kLegacyLib, smi_class,
- Object::null_type_arguments(), type_class,
- Object::null_type_arguments(), Heap::kOld)) {
+ Object::null_type_arguments(), type, Heap::kOld)) {
// Fast case for type = int/num/top-type.
__ j(ZERO, is_instance_lbl);
} else {
@@ -683,16 +682,18 @@
ASSERT(!dst_type.IsNull());
ASSERT(dst_type.IsFinalized());
// Assignable check is skipped in FlowGraphBuilder, not here.
- ASSERT(!dst_type.IsDynamicType() && !dst_type.IsObjectType() &&
- !dst_type.IsVoidType());
+ ASSERT(!dst_type.IsTopTypeForAssignability());
+
__ pushl(EDX); // Store instantiator type arguments.
__ pushl(ECX); // Store function type arguments.
- // A null object is always assignable and is returned as result.
- const compiler::Immediate& raw_null =
- compiler::Immediate(reinterpret_cast<intptr_t>(Object::null()));
+
compiler::Label is_assignable, runtime_call;
- __ cmpl(EAX, raw_null);
- __ j(EQUAL, &is_assignable);
+ if (Instance::NullIsAssignableTo(dst_type)) {
+ const compiler::Immediate& raw_null =
+ compiler::Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ __ cmpl(EAX, raw_null);
+ __ j(EQUAL, &is_assignable);
+ }
// Generate inline type check, linking to runtime call if not assignable.
SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(zone());
@@ -848,7 +849,7 @@
}
for (intptr_t i = 0; i < indirect_gotos_.length(); ++i) {
- indirect_gotos_[i]->ComputeOffsetTable();
+ indirect_gotos_[i]->ComputeOffsetTable(this);
}
}
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc b/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc
index ff3ac62..b9ab9a5 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc
@@ -369,8 +369,7 @@
// If instance is Smi, check directly.
const Class& smi_class = Class::Handle(zone(), Smi::Class());
if (Class::IsSubtypeOf(NNBDMode::kLegacyLib, smi_class,
- Object::null_type_arguments(), type_class,
- Object::null_type_arguments(), Heap::kOld)) {
+ Object::null_type_arguments(), type, Heap::kOld)) {
// Fast case for type = int/num/top-type.
__ j(ZERO, is_instance_lbl);
} else {
@@ -696,8 +695,7 @@
ASSERT(!dst_type.IsNull());
ASSERT(dst_type.IsFinalized());
// Assignable check is skipped in FlowGraphBuilder, not here.
- ASSERT(!dst_type.IsDynamicType() && !dst_type.IsObjectType() &&
- !dst_type.IsVoidType());
+ ASSERT(!dst_type.IsTopTypeForAssignability());
const Register kInstantiatorTypeArgumentsReg = RDX;
const Register kFunctionTypeArgumentsReg = RCX;
@@ -708,9 +706,10 @@
} else {
compiler::Label is_assignable, runtime_call;
- // A null object is always assignable and is returned as result.
- __ CompareObject(RAX, Object::null_object());
- __ j(EQUAL, &is_assignable);
+ if (Instance::NullIsAssignableTo(dst_type)) {
+ __ CompareObject(RAX, Object::null_object());
+ __ j(EQUAL, &is_assignable);
+ }
// Generate inline type check, linking to runtime call if not assignable.
SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(zone());
@@ -951,7 +950,7 @@
}
for (intptr_t i = 0; i < indirect_gotos_.length(); ++i) {
- indirect_gotos_[i]->ComputeOffsetTable();
+ indirect_gotos_[i]->ComputeOffsetTable(this);
}
}
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index 8cda0eb..52a6d4f 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -115,20 +115,16 @@
bool exclude_null) {
ClassTable* table = thread()->isolate()->class_table();
const intptr_t cid_count = table->NumCids();
- CidRangeVector** cid_ranges = nullptr;
+ std::unique_ptr<CidRangeVector[]>* cid_ranges = nullptr;
if (include_abstract) {
- ASSERT(!exclude_null);
- cid_ranges = &cid_subtype_ranges_abstract_nullable_;
- } else if (exclude_null) {
- ASSERT(!include_abstract);
- cid_ranges = &cid_subtype_ranges_nonnullable_;
+ cid_ranges = exclude_null ? &cid_subtype_ranges_abstract_nonnullable_
+ : &cid_subtype_ranges_abstract_nullable_;
} else {
- ASSERT(!include_abstract);
- ASSERT(!exclude_null);
- cid_ranges = &cid_subtype_ranges_nullable_;
+ cid_ranges = exclude_null ? &cid_subtype_ranges_nonnullable_
+ : &cid_subtype_ranges_nullable_;
}
if (*cid_ranges == nullptr) {
- *cid_ranges = new CidRangeVector[cid_count];
+ cid_ranges->reset(new CidRangeVector[cid_count]);
}
CidRangeVector& ranges = (*cid_ranges)[klass.id()];
if (ranges.length() == 0) {
@@ -147,8 +143,8 @@
const Class& klass) {
ClassTable* table = thread()->isolate()->class_table();
const intptr_t cid_count = table->NumCids();
- if (cid_subclass_ranges_ == NULL) {
- cid_subclass_ranges_ = new CidRangeVector[cid_count];
+ if (cid_subclass_ranges_ == nullptr) {
+ cid_subclass_ranges_.reset(new CidRangeVector[cid_count]);
}
CidRangeVector& ranges = cid_subclass_ranges_[klass.id()];
@@ -270,7 +266,6 @@
exclude_null);
return;
}
- ASSERT(!exclude_null);
Zone* zone = thread()->zone();
GrowableArray<intptr_t> cids;
@@ -2957,7 +2952,7 @@
instantiator_type_arguments()->BindTo(flow_graph->constant_null());
function_type_arguments()->BindTo(flow_graph->constant_null());
- if (new_dst_type.IsDynamicType() || new_dst_type.IsObjectType() ||
+ if (new_dst_type.IsTopTypeForAssignability() ||
(FLAG_eliminate_type_checks &&
value()->Type()->IsAssignableTo(nnbd_mode(), new_dst_type))) {
return value()->definition();
@@ -4019,33 +4014,16 @@
}
}
-void IndirectGotoInstr::ComputeOffsetTable() {
- if (GetBlock()->offset() < 0) {
- // Don't generate a table when contained in an unreachable block.
- return;
- }
+void IndirectGotoInstr::ComputeOffsetTable(FlowGraphCompiler* compiler) {
ASSERT(SuccessorCount() == offsets_.Length());
intptr_t element_size = offsets_.ElementSizeInBytes();
for (intptr_t i = 0; i < SuccessorCount(); i++) {
TargetEntryInstr* target = SuccessorAt(i);
- intptr_t offset = target->offset();
-
- // The intermediate block might be compacted, if so, use the indirect entry.
- if (offset < 0) {
- // Optimizations might have modified the immediate target block, but it
- // must end with a goto to the indirect entry. Also, we can't use
- // last_instruction because 'target' is compacted/unreachable.
- Instruction* last = target->next();
- while (last != nullptr && !last->IsGoto()) {
- last = last->next();
- }
- ASSERT(last);
- const JoinEntryInstr* entry = last->AsGoto()->successor()->AsJoinEntry();
- ASSERT(entry != nullptr);
- offset = entry->offset();
- }
-
- ASSERT(offset > 0);
+ auto* label = compiler->GetJumpLabel(target);
+ RELEASE_ASSERT(label != nullptr);
+ RELEASE_ASSERT(label->IsBound());
+ intptr_t offset = label->Position();
+ RELEASE_ASSERT(offset > 0);
offsets_.SetInt32(i * element_size, offset);
}
}
@@ -5494,11 +5472,7 @@
ASSERT(((1 << CallingConventions::kFirstCalleeSavedCpuReg) &
CallingConventions::kArgumentRegisters) == 0);
-#if defined(TARGET_ARCH_ARM)
- constexpr intptr_t kNumTemps = 3;
-#else
constexpr intptr_t kNumTemps = 2;
-#endif
LocationSummary* summary = new (zone)
LocationSummary(zone, /*num_inputs=*/InputCount(),
@@ -5511,10 +5485,6 @@
CallingConventions::kSecondNonArgumentRegister));
summary->set_temp(1, Location::RegisterLocation(
CallingConventions::kFirstCalleeSavedCpuReg));
-#if defined(TARGET_ARCH_ARM)
- summary->set_temp(2, Location::RegisterLocation(
- CallingConventions::kSecondCalleeSavedCpuReg));
-#endif
summary->set_out(0, marshaller_.LocInFfiCall(compiler::ffi::kResultIndex));
for (intptr_t i = 0, n = marshaller_.num_args(); i < n; ++i) {
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 0b69934..d64041f 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -5,6 +5,7 @@
#ifndef RUNTIME_VM_COMPILER_BACKEND_IL_H_
#define RUNTIME_VM_COMPILER_BACKEND_IL_H_
+#include <memory>
#include <utility>
#include "vm/allocation.h"
@@ -230,27 +231,16 @@
public:
explicit HierarchyInfo(Thread* thread)
: ThreadStackResource(thread),
- cid_subtype_ranges_nullable_(NULL),
- cid_subtype_ranges_abstract_nullable_(NULL),
- cid_subtype_ranges_nonnullable_(NULL),
- cid_subclass_ranges_(NULL) {
+ cid_subtype_ranges_nullable_(),
+ cid_subtype_ranges_abstract_nullable_(),
+ cid_subtype_ranges_nonnullable_(),
+ cid_subtype_ranges_abstract_nonnullable_(),
+ cid_subclass_ranges_() {
thread->set_hierarchy_info(this);
}
~HierarchyInfo() {
thread()->set_hierarchy_info(NULL);
-
- delete[] cid_subtype_ranges_nullable_;
- cid_subtype_ranges_nullable_ = NULL;
-
- delete[] cid_subtype_ranges_abstract_nullable_;
- cid_subtype_ranges_abstract_nullable_ = NULL;
-
- delete[] cid_subtype_ranges_nonnullable_;
- cid_subtype_ranges_nonnullable_ = NULL;
-
- delete[] cid_subclass_ranges_;
- cid_subclass_ranges_ = NULL;
}
const CidRangeVector& SubtypeRangesForClass(const Class& klass,
@@ -302,10 +292,11 @@
bool include_abstract,
bool exclude_null);
- CidRangeVector* cid_subtype_ranges_nullable_;
- CidRangeVector* cid_subtype_ranges_abstract_nullable_;
- CidRangeVector* cid_subtype_ranges_nonnullable_;
- CidRangeVector* cid_subclass_ranges_;
+ std::unique_ptr<CidRangeVector[]> cid_subtype_ranges_nullable_;
+ std::unique_ptr<CidRangeVector[]> cid_subtype_ranges_abstract_nullable_;
+ std::unique_ptr<CidRangeVector[]> cid_subtype_ranges_nonnullable_;
+ std::unique_ptr<CidRangeVector[]> cid_subtype_ranges_abstract_nonnullable_;
+ std::unique_ptr<CidRangeVector[]> cid_subclass_ranges_;
};
// An embedded container with N elements of type T. Used (with partial
@@ -1423,9 +1414,6 @@
void set_block_id(intptr_t block_id) { block_id_ = block_id; }
- intptr_t offset() const { return offset_; }
- void set_offset(intptr_t offset) { offset_ = offset; }
-
// Stack-based IR bookkeeping.
intptr_t stack_depth() const { return stack_depth_; }
void set_stack_depth(intptr_t s) { stack_depth_ = s; }
@@ -1454,7 +1442,6 @@
dominator_(nullptr),
dominated_blocks_(1),
last_instruction_(NULL),
- offset_(-1),
parallel_move_(nullptr),
loop_info_(nullptr) {}
@@ -1489,9 +1476,6 @@
GrowableArray<BlockEntryInstr*> dominated_blocks_;
Instruction* last_instruction_;
- // Offset of this block from the start of the emitted code.
- intptr_t offset_;
-
// Parallel move that will be used by linear scan register allocator to
// connect live ranges at the start of the block.
ParallelMoveInstr* parallel_move_;
@@ -2991,7 +2975,7 @@
virtual bool HasUnknownSideEffects() const { return false; }
Value* offset() const { return inputs_[0]; }
- void ComputeOffsetTable();
+ void ComputeOffsetTable(FlowGraphCompiler* compiler);
PRINT_TO_SUPPORT
diff --git a/runtime/vm/compiler/backend/il_arm.cc b/runtime/vm/compiler/backend/il_arm.cc
index 8ad3543..d7b88fa 100644
--- a/runtime/vm/compiler/backend/il_arm.cc
+++ b/runtime/vm/compiler/backend/il_arm.cc
@@ -1167,16 +1167,17 @@
THR, compiler::target::Thread::
call_native_through_safepoint_entry_point_offset()));
- // Calls R8 in a safepoint and clobbers NOTFP and R4.
- ASSERT(branch == R8 && temp == NOTFP && locs()->temp(2).reg() == R4);
+ // Calls R8 in a safepoint and clobbers R4 and NOTFP.
+ ASSERT(branch == R8 && temp == R4);
+ static_assert((kReservedCpuRegisters & (1 << NOTFP)) != 0,
+ "NOTFP should be a reserved register");
__ blx(TMP);
}
// Restore the global object pool after returning from runtime (old space is
// moving, so the GOP could have been relocated).
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- __ ldr(PP, compiler::Address(
- THR, compiler::target::Thread::global_object_pool_offset()));
+ __ SetupGlobalPoolAndDispatchTable();
}
EmitReturnMoves(compiler);
@@ -1382,8 +1383,7 @@
__ StoreToOffset(kWord, CODE_REG, FPREG,
kPcMarkerSlotFromFp * compiler::target::kWordSize);
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- __ ldr(PP, compiler::Address(
- THR, compiler::target::Thread::global_object_pool_offset()));
+ __ SetupGlobalPoolAndDispatchTable();
} else {
__ LoadImmediate(PP, 0); // GC safe value into PP.
}
diff --git a/runtime/vm/compiler/backend/il_deserializer.cc b/runtime/vm/compiler/backend/il_deserializer.cc
index 5f91cf9..b182ebf 100644
--- a/runtime/vm/compiler/backend/il_deserializer.cc
+++ b/runtime/vm/compiler/backend/il_deserializer.cc
@@ -1432,6 +1432,10 @@
// We'll use the null value in *out as a marker later, so go ahead and exit
// early if we parse one.
if (sym->Equals("null")) return true;
+ if (sym->Equals("sentinel")) {
+ *out = Object::sentinel().raw();
+ return true;
+ }
// The only other symbols that should appear in Dart value position are
// names of constant definitions.
@@ -1662,6 +1666,8 @@
return false;
}
+ ASSERT(cid_sexp->value() != kNullCid); // Must use canonical instances.
+ ASSERT(cid_sexp->value() != kBoolCid); // Must use canonical instances.
instance_class_ = table->At(cid_sexp->value());
*out = Instance::New(instance_class_, Heap::kOld);
auto& instance = Instance::Cast(*out);
diff --git a/runtime/vm/compiler/backend/il_serializer.cc b/runtime/vm/compiler/backend/il_serializer.cc
index b873992..45b7a03 100644
--- a/runtime/vm/compiler/backend/il_serializer.cc
+++ b/runtime/vm/compiler/backend/il_serializer.cc
@@ -670,6 +670,9 @@
if (dartval.IsNull()) {
return new (zone()) SExpSymbol("null");
}
+ if (dartval.raw() == Object::sentinel().raw()) {
+ return new (zone()) SExpSymbol("sentinel");
+ }
if (dartval.IsString()) {
return new (zone()) SExpString(dartval.ToCString());
}
diff --git a/runtime/vm/compiler/backend/slot.cc b/runtime/vm/compiler/backend/slot.cc
index 332b864..5b20762 100644
--- a/runtime/vm/compiler/backend/slot.cc
+++ b/runtime/vm/compiler/backend/slot.cc
@@ -222,6 +222,11 @@
is_nullable = false;
}
+ if (field.is_late()) {
+ // TODO(dartbug.com/40796): Extend CompileType to handle lateness.
+ is_nullable = true;
+ }
+
const Slot& slot = SlotCache::Instance(thread).Canonicalize(Slot(
Kind::kDartField,
IsImmutableBit::encode(field.is_final() || field.is_const()) |
diff --git a/runtime/vm/compiler/backend/type_propagator.cc b/runtime/vm/compiler/backend/type_propagator.cc
index 523b039..a1ef276 100644
--- a/runtime/vm/compiler/backend/type_propagator.cc
+++ b/runtime/vm/compiler/backend/type_propagator.cc
@@ -413,9 +413,11 @@
type = &(instance_of->type());
left = instance_of->value()->definition();
}
- if (!type->IsDynamicType() && !type->IsObjectType()) {
- const bool is_nullable = type->IsNullType() ? CompileType::kNullable
- : CompileType::kNonNullable;
+ if (!type->IsTopType()) {
+ const bool is_nullable = (type->IsNullable() || type->IsTypeParameter() ||
+ (type->IsNeverType() && type->IsLegacy()))
+ ? CompileType::kNullable
+ : CompileType::kNonNullable;
EnsureMoreAccurateRedefinition(
true_successor, left,
CompileType::FromAbstractType(*type, is_nullable));
@@ -814,7 +816,7 @@
}
bool CompileType::IsAssignableTo(NNBDMode mode, const AbstractType& other) {
- if (other.IsTopType()) {
+ if (other.IsTopTypeForAssignability()) {
return true;
}
@@ -824,19 +826,8 @@
// Consider the compile type of the value.
const AbstractType& compile_type = *ToAbstractType();
-
if (compile_type.IsNullType()) {
- if (!FLAG_strong_non_nullable_type_checks) {
- // In weak mode, 'null' is assignable to any type.
- return true;
- }
- // In strong mode, 'null' is assignable to any nullable or legacy type.
- // It is also assignable to FutureOr<T> if it is assignable to T.
- const AbstractType& unwrapped_other =
- AbstractType::Handle(other.UnwrapFutureOr());
- // A nullable or legacy type parameter will still be either nullable or
- // legacy after instantiation.
- return unwrapped_other.IsNullable() || unwrapped_other.IsLegacy();
+ return Instance::NullIsAssignableTo(other);
}
return compile_type.IsSubtypeOf(mode, other, Heap::kOld);
}
@@ -1417,6 +1408,10 @@
DEBUG_ASSERT(Isolate::Current()->HasAttemptedReload());
return CompileType::Dynamic();
}
+ if (field.is_late()) {
+ // TODO(dartbug.com/40796): Extend CompileType to handle lateness.
+ is_nullable = CompileType::kNullable;
+ }
return CompileType(is_nullable, cid, abstract_type);
}
diff --git a/runtime/vm/compiler/call_specializer.cc b/runtime/vm/compiler/call_specializer.cc
index af81cd0..ceefe78 100644
--- a/runtime/vm/compiler/call_specializer.cc
+++ b/runtime/vm/compiler/call_specializer.cc
@@ -858,7 +858,7 @@
// Build an AssertAssignable if necessary.
const AbstractType& dst_type = AbstractType::ZoneHandle(zone(), field.type());
- if (I->argument_type_checks() && !dst_type.IsTopType()) {
+ if (I->argument_type_checks() && !dst_type.IsTopTypeForAssignability()) {
// Compute if we need to type check the value. Always type check if
// at a dynamic invocation.
bool needs_check = true;
@@ -1112,8 +1112,7 @@
(unwrapped_type.IsLegacy() && unwrapped_type.IsNeverType());
} else {
is_subtype = Class::IsSubtypeOf(mode, cls, Object::null_type_arguments(),
- type_class, Object::null_type_arguments(),
- Heap::kOld);
+ type, Heap::kOld);
}
results->Add(cls.id());
results->Add(static_cast<intptr_t>(is_subtype));
@@ -1460,11 +1459,9 @@
const ClassTable& class_table = *Isolate::Current()->class_table();
if ((*results)[0] != kSmiCid) {
const Class& smi_class = Class::Handle(class_table.At(kSmiCid));
- const Class& type_class = Class::Handle(type.type_class());
- // When testing '42 is type', the nullability of type is irrelevant.
- const bool smi_is_subtype = Class::IsSubtypeOf(
- NNBDMode::kLegacyLib, smi_class, Object::null_type_arguments(),
- type_class, Object::null_type_arguments(), Heap::kOld);
+ const bool smi_is_subtype =
+ Class::IsSubtypeOf(NNBDMode::kLegacyLib, smi_class,
+ Object::null_type_arguments(), type, Heap::kOld);
results->Add((*results)[results->length() - 2]);
results->Add((*results)[results->length() - 2]);
for (intptr_t i = results->length() - 3; i > 1; --i) {
diff --git a/runtime/vm/compiler/frontend/bytecode_reader.cc b/runtime/vm/compiler/frontend/bytecode_reader.cc
index 06c8339..5434169 100644
--- a/runtime/vm/compiler/frontend/bytecode_reader.cc
+++ b/runtime/vm/compiler/frontend/bytecode_reader.cc
@@ -418,8 +418,8 @@
const bool has_optional_parameters = function.HasOptionalParameters();
for (intptr_t i = function.NumImplicitParameters(); i < num_params; ++i) {
type = function.ParameterTypeAt(i);
- if (!type.IsTopType() && !is_generic_covariant_impl.Contains(i) &&
- !is_covariant.Contains(i)) {
+ if (!type.IsTopTypeForAssignability() &&
+ !is_generic_covariant_impl.Contains(i) && !is_covariant.Contains(i)) {
name = function.ParameterNameAt(i);
intptr_t index;
if (i >= num_pos_params) {
@@ -624,10 +624,13 @@
ASSERT(num_type_params > 0);
intptr_t offset;
+ NNBDMode nnbd_mode;
if (!parameterized_class.IsNull()) {
offset = parameterized_class.NumTypeArguments() - num_type_params;
+ nnbd_mode = parameterized_class.nnbd_mode();
} else {
offset = parameterized_function.NumParentTypeParameters();
+ nnbd_mode = parameterized_function.nnbd_mode();
}
// First setup the type parameters, so if any of the following code uses it
@@ -679,9 +682,43 @@
// when function subtyping is fixed.
if (bound.IsDynamicType()) {
bound = I->object_store()->object_type();
+ if (nnbd_mode == NNBDMode::kOptedInLib) {
+ parameter =
+ parameter.ToNullability(Nullability::kUndetermined, Heap::kOld);
+ type_parameters.SetTypeAt(i, parameter);
+ }
+ } else {
+ if (nnbd_mode == NNBDMode::kOptedInLib) {
+ parameter = parameter.ToNullability(bound.IsNullable()
+ ? Nullability::kUndetermined
+ : Nullability::kNonNullable,
+ Heap::kOld);
+ type_parameters.SetTypeAt(i, parameter);
+ }
}
parameter.set_bound(bound);
}
+
+ // Fix bounds in all derived type parameters (with different nullabilities).
+ if (active_class_->derived_type_parameters != nullptr) {
+ auto& derived = TypeParameter::Handle(Z);
+ auto& bound = AbstractType::Handle(Z);
+ for (intptr_t i = 0, n = active_class_->derived_type_parameters->Length();
+ i < n; ++i) {
+ derived ^= active_class_->derived_type_parameters->At(i);
+ if (derived.bound() == AbstractType::null() &&
+ ((!parameterized_class.IsNull() &&
+ derived.parameterized_class() == parameterized_class.raw()) ||
+ (!parameterized_function.IsNull() &&
+ derived.parameterized_function() ==
+ parameterized_function.raw()))) {
+ ASSERT(derived.IsFinalized());
+ parameter ^= type_parameters.TypeAt(derived.index() - offset);
+ bound = parameter.bound();
+ derived.set_bound(bound);
+ }
+ }
+ }
}
intptr_t BytecodeReaderHelper::ReadConstantPool(const Function& function,
@@ -1686,6 +1723,13 @@
}
TypeParameter& type_parameter = TypeParameter::Handle(Z);
type_parameter ^= type_parameters.TypeAt(index_in_parent);
+ if (type_parameter.bound() == AbstractType::null()) {
+ AbstractType& derived = AbstractType::Handle(
+ Z, type_parameter.ToNullability(nullability, Heap::kOld));
+ active_class_->RecordDerivedTypeParameter(Z, type_parameter,
+ TypeParameter::Cast(derived));
+ return derived.raw();
+ }
return type_parameter.ToNullability(nullability, Heap::kOld);
}
case kGenericType: {
diff --git a/runtime/vm/compiler/frontend/constant_reader.cc b/runtime/vm/compiler/frontend/constant_reader.cc
index 69a1e73..9706b1a 100644
--- a/runtime/vm/compiler/frontend/constant_reader.cc
+++ b/runtime/vm/compiler/frontend/constant_reader.cc
@@ -182,7 +182,8 @@
const auto& list_class =
Class::Handle(Z, corelib.LookupClassAllowPrivate(Symbols::_List()));
// Build type from the raw bytes (needs temporary translator).
- TypeTranslator type_translator(&reader, active_class_, true);
+ TypeTranslator type_translator(&reader, active_class_, true,
+ active_class_->RequireLegacyErasure());
auto& type_arguments =
TypeArguments::Handle(Z, TypeArguments::New(1, Heap::kOld));
AbstractType& type = type_translator.BuildType();
@@ -223,7 +224,8 @@
ASSERT(klass.is_const());
instance = Instance::New(klass, Heap::kOld);
// Build type from the raw bytes (needs temporary translator).
- TypeTranslator type_translator(&reader, active_class_, true);
+ TypeTranslator type_translator(&reader, active_class_, true,
+ active_class_->RequireLegacyErasure());
const intptr_t number_of_type_arguments = reader.ReadUInt();
if (klass.NumTypeArguments() > 0) {
auto& type_arguments = TypeArguments::Handle(
@@ -265,7 +267,8 @@
ASSERT(!constant.IsNull());
// Build type from the raw bytes (needs temporary translator).
- TypeTranslator type_translator(&reader, active_class_, true);
+ TypeTranslator type_translator(&reader, active_class_, true,
+ active_class_->RequireLegacyErasure());
const intptr_t number_of_type_arguments = reader.ReadUInt();
ASSERT(number_of_type_arguments > 0);
auto& type_arguments = TypeArguments::Handle(
@@ -298,7 +301,8 @@
}
case kTypeLiteralConstant: {
// Build type from the raw bytes (needs temporary translator).
- TypeTranslator type_translator(&reader, active_class_, true);
+ TypeTranslator type_translator(&reader, active_class_, true,
+ active_class_->RequireLegacyErasure());
instance = type_translator.BuildType().raw();
break;
}
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index aaa6163..4165015 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -3685,7 +3685,7 @@
Fragment instructions = BuildExpression(); // read operand.
const AbstractType& type = T.BuildType(); // read type.
- if (type.IsInstantiated() && type.IsTopType()) {
+ if (type.IsInstantiated() && type.IsTopTypeForAssignability()) {
// We already evaluated the operand on the left and just leave it there as
// the result of the `obj as dynamic` expression.
} else {
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index 61c09dd..95aa8e6 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -1589,8 +1589,7 @@
if (!I->should_emit_strong_mode_checks()) {
return Fragment();
}
- if (!dst_type.IsDynamicType() && !dst_type.IsObjectType() &&
- !dst_type.IsVoidType()) {
+ if (!dst_type.IsTopTypeForAssignability()) {
LocalVariable* top_of_stack = MakeTemporary();
instructions += LoadLocal(top_of_stack);
instructions += AssertAssignableLoadTypeArguments(TokenPosition::kNoSource,
@@ -1738,7 +1737,7 @@
&AbstractType::ZoneHandle(Z, forwarding_target->ParameterTypeAt(i));
}
- if (target_type->IsTopType()) continue;
+ if (target_type->IsTopTypeForAssignability()) continue;
const bool is_covariant = param->is_explicit_covariant_parameter();
Fragment* checks = is_covariant ? explicit_checks : implicit_checks;
@@ -2294,8 +2293,7 @@
body += Drop(); // argument count
AbstractType& return_type = AbstractType::Handle(function.result_type());
- if (!return_type.IsDynamicType() && !return_type.IsVoidType() &&
- !return_type.IsObjectType()) {
+ if (!return_type.IsTopTypeForAssignability()) {
body += AssertAssignableLoadTypeArguments(TokenPosition::kNoSource,
return_type, Symbols::Empty());
}
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index c401baf..c741381 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -2778,14 +2778,16 @@
TypeTranslator::TypeTranslator(KernelReaderHelper* helper,
ActiveClass* active_class,
- bool finalize)
+ bool finalize,
+ bool apply_legacy_erasure)
: helper_(helper),
translation_helper_(helper->translation_helper_),
active_class_(active_class),
type_parameter_scope_(NULL),
zone_(translation_helper_.zone()),
result_(AbstractType::Handle(translation_helper_.zone())),
- finalize_(finalize) {}
+ finalize_(finalize),
+ apply_legacy_erasure_(apply_legacy_erasure) {}
AbstractType& TypeTranslator::BuildType() {
BuildTypeInternal();
@@ -2819,6 +2821,9 @@
case kNeverType: {
const Nullability nullability = helper_->ReadNullability();
result_ = Object::never_type().ToNullability(nullability, Heap::kOld);
+ if (apply_legacy_erasure_ && result_.IsNeverType()) {
+ result_ = I->object_store()->null_type();
+ }
break;
}
case kBottomType:
@@ -2852,7 +2857,10 @@
// malformed iff `T` is malformed.
// => We therefore ignore errors in `A` or `B`.
- const Nullability nullability = helper_->ReadNullability();
+ Nullability nullability = helper_->ReadNullability();
+ if (apply_legacy_erasure_) {
+ nullability = Nullability::kLegacy;
+ }
NameIndex klass_name =
helper_->ReadCanonicalNameReference(); // read klass_name.
@@ -2897,7 +2905,10 @@
: Function::Handle(Z),
TokenPosition::kNoSource));
- const Nullability nullability = helper_->ReadNullability();
+ Nullability nullability = helper_->ReadNullability();
+ if (apply_legacy_erasure_) {
+ nullability = Nullability::kLegacy;
+ }
// Suspend finalization of types inside this one. They will be finalized after
// the whole function type is constructed.
@@ -2931,11 +2942,15 @@
all_count = positional_count;
}
+ const intptr_t all_count_with_receiver = all_count + 1;
const Array& parameter_types =
- Array::Handle(Z, Array::New(1 + all_count, Heap::kOld));
+ Array::Handle(Z, Array::New(all_count_with_receiver, Heap::kOld));
signature_function.set_parameter_types(parameter_types);
- const Array& parameter_names =
- Array::Handle(Z, Array::New(1 + all_count, Heap::kOld));
+ const Array& parameter_names = Array::Handle(
+ Z, Array::New(simple ? all_count_with_receiver
+ : Function::NameArrayLengthIncludingFlags(
+ all_count_with_receiver),
+ Heap::kOld));
signature_function.set_parameter_names(parameter_names);
intptr_t pos = 0;
@@ -2960,11 +2975,15 @@
// read string reference (i.e. named_parameters[i].name).
String& name = H.DartSymbolObfuscate(helper_->ReadStringReference());
BuildTypeInternal(); // read named_parameters[i].type.
- // TODO(markov): Store 'required' bit.
- helper_->ReadFlags(); // read flags
+ const uint8_t flags = helper_->ReadFlags(); // read flags
parameter_types.SetAt(pos, result_);
parameter_names.SetAt(pos, name);
+ if (!apply_legacy_erasure_ &&
+ (flags & static_cast<uint8_t>(NamedTypeFlags::kIsRequired)) != 0) {
+ signature_function.SetIsRequiredAt(pos);
+ }
}
+ signature_function.TruncateUnusedParameterFlags();
}
if (!simple) {
@@ -2991,7 +3010,11 @@
}
void TypeTranslator::BuildTypeParameterType() {
- const Nullability nullability = helper_->ReadNullability();
+ Nullability nullability = helper_->ReadNullability();
+ if (apply_legacy_erasure_) {
+ nullability = Nullability::kLegacy;
+ }
+
intptr_t parameter_index = helper_->ReadUInt(); // read parameter index.
helper_->SkipOptionalDartType(); // read bound.
@@ -3303,10 +3326,13 @@
positional_parameter_count - required_parameter_count, true);
}
intptr_t parameter_count = extra_parameters + total_parameter_count;
+
function.set_parameter_types(
Array::Handle(Z, Array::New(parameter_count, Heap::kOld)));
- function.set_parameter_names(
- Array::Handle(Z, Array::New(parameter_count, Heap::kOld)));
+ const Array& parameter_names = Array::Handle(
+ Z, Array::New(Function::NameArrayLengthIncludingFlags(parameter_count),
+ Heap::kOld));
+ function.set_parameter_names(parameter_names);
intptr_t pos = 0;
if (is_method) {
ASSERT(!klass.IsNull());
@@ -3353,7 +3379,11 @@
function.SetParameterTypeAt(pos, type);
function.SetParameterNameAt(pos, H.DartIdentifier(lib, helper.name_index_));
+ if (helper.IsRequired()) {
+ function.SetIsRequiredAt(pos);
+ }
}
+ function.TruncateUnusedParameterFlags();
function_node_helper->SetJustRead(FunctionNodeHelper::kNamedParameters);
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.h b/runtime/vm/compiler/frontend/kernel_translation_helper.h
index 3779497..2ece5ec 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.h
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.h
@@ -767,13 +767,6 @@
kNonNullableByDefaultCompiledModeBit2Strong = 1 << 4,
};
- enum NonNullableByDefaultCompiledMode {
- kDisabled,
- kWeak,
- kStrong,
- kAgnostic
- };
-
explicit LibraryHelper(KernelReaderHelper* helper, uint32_t binary_version)
: helper_(helper), binary_version_(binary_version), next_read_(kFlags) {}
@@ -791,13 +784,13 @@
bool IsNonNullableByDefault() const {
return (flags_ & kIsNonNullableByDefault) != 0;
}
- NonNullableByDefaultCompiledMode GetNonNullableByDefaultCompiledMode() const {
+ NNBDCompiledMode GetNonNullableByDefaultCompiledMode() const {
bool weak = (flags_ & kNonNullableByDefaultCompiledModeBit1Weak) != 0;
bool strong = (flags_ & kNonNullableByDefaultCompiledModeBit2Strong) != 0;
- if (weak && strong) return kAgnostic;
- if (strong) return kStrong;
- if (weak) return kWeak;
- return kDisabled;
+ if (weak && strong) return NNBDCompiledMode::kAgnostic;
+ if (strong) return NNBDCompiledMode::kStrong;
+ if (weak) return NNBDCompiledMode::kWeak;
+ return NNBDCompiledMode::kDisabled;
}
uint8_t flags_ = 0;
@@ -1253,6 +1246,12 @@
return member->IsFactory();
}
+ bool RequireLegacyErasure() const {
+ return klass != nullptr && !FLAG_null_safety &&
+ Library::Handle(klass->library()).nnbd_compiled_mode() ==
+ NNBDCompiledMode::kAgnostic;
+ }
+
intptr_t MemberTypeParameterCount(Zone* zone);
intptr_t ClassNumTypeArguments() {
@@ -1373,7 +1372,8 @@
public:
TypeTranslator(KernelReaderHelper* helper,
ActiveClass* active_class,
- bool finalize = false);
+ bool finalize = false,
+ bool apply_legacy_erasure = false);
AbstractType& BuildType();
AbstractType& BuildTypeWithoutFinalization();
@@ -1436,6 +1436,7 @@
Zone* zone_;
AbstractType& result_;
bool finalize_;
+ const bool apply_legacy_erasure_;
friend class ScopeBuilder;
friend class KernelLoader;
diff --git a/runtime/vm/compiler/jit/compiler.cc b/runtime/vm/compiler/jit/compiler.cc
index c750891..9995ebc 100644
--- a/runtime/vm/compiler/jit/compiler.cc
+++ b/runtime/vm/compiler/jit/compiler.cc
@@ -33,7 +33,6 @@
#include "vm/exceptions.h"
#include "vm/flags.h"
#include "vm/kernel.h"
-#include "vm/kernel_loader.h" // For kernel::ParseStaticFieldInitializer.
#include "vm/longjump.h"
#include "vm/object.h"
#include "vm/object_store.h"
@@ -870,13 +869,12 @@
}
#endif
- Isolate* isolate = thread->isolate();
- if (!isolate->compilation_allowed()) {
- FATAL3("Precompilation missed function %s (%s, %s)\n",
- function.ToLibNamePrefixedQualifiedCString(),
- function.token_pos().ToCString(),
- Function::KindToCString(function.kind()));
- }
+#if defined(DART_PRECOMPILED_RUNTIME)
+ FATAL3("Precompilation missed function %s (%s, %s)\n",
+ function.ToLibNamePrefixedQualifiedCString(),
+ function.token_pos().ToCString(),
+ Function::KindToCString(function.kind()));
+#endif // defined(DART_PRECOMPILED_RUNTIME)
VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId);
#if defined(SUPPORT_TIMELINE)
diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h
index dfa49b8..0c1ebcd 100644
--- a/runtime/vm/compiler/runtime_api.h
+++ b/runtime/vm/compiler/runtime_api.h
@@ -290,6 +290,9 @@
extern const word kPageMask;
static constexpr intptr_t kObjectAlignment = ObjectAlignment::kObjectAlignment;
+static constexpr intptr_t kNumParameterFlagsPerElement = kBitsPerWord / 2;
+static_assert(kNumParameterFlagsPerElement <= kSmiBits,
+ "kNumParameterFlagsPerElement should fit inside a Smi");
inline intptr_t RoundedAllocationSize(intptr_t size) {
return Utils::RoundUp(size, kObjectAlignment);
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index d487eaa..128aa14 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -135,12 +135,12 @@
static constexpr dart::compiler::target::word ICData_state_bits_offset = 28;
static constexpr dart::compiler::target::word
ICData_receivers_static_type_offset = 16;
-static constexpr dart::compiler::target::word Isolate_class_table_offset = 40;
+static constexpr dart::compiler::target::word Isolate_class_table_offset = 36;
static constexpr dart::compiler::target::word Isolate_current_tag_offset = 20;
static constexpr dart::compiler::target::word Isolate_default_tag_offset = 24;
static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 28;
-static constexpr dart::compiler::target::word Isolate_object_store_offset = 36;
-static constexpr dart::compiler::target::word Isolate_single_step_offset = 64;
+static constexpr dart::compiler::target::word Isolate_object_store_offset = 32;
+static constexpr dart::compiler::target::word Isolate_single_step_offset = 60;
static constexpr dart::compiler::target::word Isolate_user_tag_offset = 16;
static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 16;
static constexpr dart::compiler::target::word
@@ -193,9 +193,9 @@
static constexpr dart::compiler::target::word
Thread_AllocateArray_entry_point_offset = 336;
static constexpr dart::compiler::target::word Thread_active_exception_offset =
- 672;
+ 668;
static constexpr dart::compiler::target::word Thread_active_stacktrace_offset =
- 676;
+ 672;
static constexpr dart::compiler::target::word
Thread_array_write_barrier_code_offset = 128;
static constexpr dart::compiler::target::word
@@ -220,7 +220,7 @@
Thread_call_to_runtime_entry_point_offset = 232;
static constexpr dart::compiler::target::word
Thread_call_to_runtime_stub_offset = 148;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 708;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 704;
static constexpr dart::compiler::target::word
Thread_dispatch_table_array_offset = 48;
static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
@@ -238,7 +238,7 @@
static constexpr dart::compiler::target::word
Thread_enter_safepoint_stub_offset = 212;
static constexpr dart::compiler::target::word Thread_execution_state_offset =
- 692;
+ 688;
static constexpr dart::compiler::target::word
Thread_exit_safepoint_stub_offset = 216;
static constexpr dart::compiler::target::word
@@ -258,7 +258,7 @@
static constexpr dart::compiler::target::word
Thread_float_zerow_address_offset = 332;
static constexpr dart::compiler::target::word Thread_global_object_pool_offset =
- 680;
+ 676;
static constexpr dart::compiler::target::word
Thread_interpret_call_entry_point_offset = 300;
static constexpr dart::compiler::target::word
@@ -303,11 +303,11 @@
static constexpr dart::compiler::target::word Thread_object_null_offset = 112;
static constexpr dart::compiler::target::word
Thread_predefined_symbols_address_offset = 304;
-static constexpr dart::compiler::target::word Thread_resume_pc_offset = 684;
+static constexpr dart::compiler::target::word Thread_resume_pc_offset = 680;
static constexpr dart::compiler::target::word
- Thread_saved_shadow_call_stack_offset = 688;
+ Thread_saved_shadow_call_stack_offset = 684;
static constexpr dart::compiler::target::word Thread_safepoint_state_offset =
- 696;
+ 692;
static constexpr dart::compiler::target::word
Thread_slow_type_test_stub_offset = 204;
static constexpr dart::compiler::target::word Thread_stack_limit_offset = 36;
@@ -338,7 +338,7 @@
Thread_write_barrier_entry_point_offset = 224;
static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset =
40;
-static constexpr dart::compiler::target::word Thread_callback_code_offset = 700;
+static constexpr dart::compiler::target::word Thread_callback_code_offset = 696;
static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 8;
static constexpr dart::compiler::target::word TwoByteString_data_offset = 12;
static constexpr dart::compiler::target::word Type_arguments_offset = 16;
@@ -376,8 +376,7 @@
4, 12, 8, 16};
static constexpr dart::compiler::target::word
Thread_write_barrier_wrappers_thread_offset[] = {
- 636, 640, 644, 648, 652, -1, 656, 660,
- 664, 668, -1, -1, -1, -1, -1, -1};
+ 636, 640, 644, 648, 652, -1, 656, -1, 660, 664, -1, -1, -1, -1, -1, -1};
static constexpr dart::compiler::target::word ApiError_InstanceSize = 8;
static constexpr dart::compiler::target::word Array_InstanceSize = 12;
static constexpr dart::compiler::target::word Array_header_size = 12;
@@ -601,12 +600,12 @@
static constexpr dart::compiler::target::word ICData_state_bits_offset = 52;
static constexpr dart::compiler::target::word
ICData_receivers_static_type_offset = 32;
-static constexpr dart::compiler::target::word Isolate_class_table_offset = 80;
+static constexpr dart::compiler::target::word Isolate_class_table_offset = 72;
static constexpr dart::compiler::target::word Isolate_current_tag_offset = 40;
static constexpr dart::compiler::target::word Isolate_default_tag_offset = 48;
static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 56;
-static constexpr dart::compiler::target::word Isolate_object_store_offset = 72;
-static constexpr dart::compiler::target::word Isolate_single_step_offset = 128;
+static constexpr dart::compiler::target::word Isolate_object_store_offset = 64;
+static constexpr dart::compiler::target::word Isolate_single_step_offset = 120;
static constexpr dart::compiler::target::word Isolate_user_tag_offset = 32;
static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 32;
static constexpr dart::compiler::target::word
@@ -1068,12 +1067,12 @@
static constexpr dart::compiler::target::word ICData_state_bits_offset = 28;
static constexpr dart::compiler::target::word
ICData_receivers_static_type_offset = 16;
-static constexpr dart::compiler::target::word Isolate_class_table_offset = 40;
+static constexpr dart::compiler::target::word Isolate_class_table_offset = 36;
static constexpr dart::compiler::target::word Isolate_current_tag_offset = 20;
static constexpr dart::compiler::target::word Isolate_default_tag_offset = 24;
static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 28;
-static constexpr dart::compiler::target::word Isolate_object_store_offset = 36;
-static constexpr dart::compiler::target::word Isolate_single_step_offset = 64;
+static constexpr dart::compiler::target::word Isolate_object_store_offset = 32;
+static constexpr dart::compiler::target::word Isolate_single_step_offset = 60;
static constexpr dart::compiler::target::word Isolate_user_tag_offset = 16;
static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 16;
static constexpr dart::compiler::target::word
@@ -1530,12 +1529,12 @@
static constexpr dart::compiler::target::word ICData_state_bits_offset = 52;
static constexpr dart::compiler::target::word
ICData_receivers_static_type_offset = 32;
-static constexpr dart::compiler::target::word Isolate_class_table_offset = 80;
+static constexpr dart::compiler::target::word Isolate_class_table_offset = 72;
static constexpr dart::compiler::target::word Isolate_current_tag_offset = 40;
static constexpr dart::compiler::target::word Isolate_default_tag_offset = 48;
static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 56;
-static constexpr dart::compiler::target::word Isolate_object_store_offset = 72;
-static constexpr dart::compiler::target::word Isolate_single_step_offset = 128;
+static constexpr dart::compiler::target::word Isolate_object_store_offset = 64;
+static constexpr dart::compiler::target::word Isolate_single_step_offset = 120;
static constexpr dart::compiler::target::word Isolate_user_tag_offset = 32;
static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 32;
static constexpr dart::compiler::target::word
@@ -1998,11 +1997,11 @@
static constexpr dart::compiler::target::word ICData_state_bits_offset = 28;
static constexpr dart::compiler::target::word
ICData_receivers_static_type_offset = 16;
-static constexpr dart::compiler::target::word Isolate_class_table_offset = 40;
+static constexpr dart::compiler::target::word Isolate_class_table_offset = 36;
static constexpr dart::compiler::target::word Isolate_current_tag_offset = 20;
static constexpr dart::compiler::target::word Isolate_default_tag_offset = 24;
static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 28;
-static constexpr dart::compiler::target::word Isolate_object_store_offset = 36;
+static constexpr dart::compiler::target::word Isolate_object_store_offset = 32;
static constexpr dart::compiler::target::word Isolate_user_tag_offset = 16;
static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 16;
static constexpr dart::compiler::target::word
@@ -2055,9 +2054,9 @@
static constexpr dart::compiler::target::word
Thread_AllocateArray_entry_point_offset = 336;
static constexpr dart::compiler::target::word Thread_active_exception_offset =
- 672;
+ 668;
static constexpr dart::compiler::target::word Thread_active_stacktrace_offset =
- 676;
+ 672;
static constexpr dart::compiler::target::word
Thread_array_write_barrier_code_offset = 128;
static constexpr dart::compiler::target::word
@@ -2082,7 +2081,7 @@
Thread_call_to_runtime_entry_point_offset = 232;
static constexpr dart::compiler::target::word
Thread_call_to_runtime_stub_offset = 148;
-static constexpr dart::compiler::target::word Thread_dart_stream_offset = 708;
+static constexpr dart::compiler::target::word Thread_dart_stream_offset = 704;
static constexpr dart::compiler::target::word
Thread_dispatch_table_array_offset = 48;
static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
@@ -2100,7 +2099,7 @@
static constexpr dart::compiler::target::word
Thread_enter_safepoint_stub_offset = 212;
static constexpr dart::compiler::target::word Thread_execution_state_offset =
- 692;
+ 688;
static constexpr dart::compiler::target::word
Thread_exit_safepoint_stub_offset = 216;
static constexpr dart::compiler::target::word
@@ -2120,7 +2119,7 @@
static constexpr dart::compiler::target::word
Thread_float_zerow_address_offset = 332;
static constexpr dart::compiler::target::word Thread_global_object_pool_offset =
- 680;
+ 676;
static constexpr dart::compiler::target::word
Thread_interpret_call_entry_point_offset = 300;
static constexpr dart::compiler::target::word
@@ -2165,11 +2164,11 @@
static constexpr dart::compiler::target::word Thread_object_null_offset = 112;
static constexpr dart::compiler::target::word
Thread_predefined_symbols_address_offset = 304;
-static constexpr dart::compiler::target::word Thread_resume_pc_offset = 684;
+static constexpr dart::compiler::target::word Thread_resume_pc_offset = 680;
static constexpr dart::compiler::target::word
- Thread_saved_shadow_call_stack_offset = 688;
+ Thread_saved_shadow_call_stack_offset = 684;
static constexpr dart::compiler::target::word Thread_safepoint_state_offset =
- 696;
+ 692;
static constexpr dart::compiler::target::word
Thread_slow_type_test_stub_offset = 204;
static constexpr dart::compiler::target::word Thread_stack_limit_offset = 36;
@@ -2200,7 +2199,7 @@
Thread_write_barrier_entry_point_offset = 224;
static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset =
40;
-static constexpr dart::compiler::target::word Thread_callback_code_offset = 700;
+static constexpr dart::compiler::target::word Thread_callback_code_offset = 696;
static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 8;
static constexpr dart::compiler::target::word TwoByteString_data_offset = 12;
static constexpr dart::compiler::target::word Type_arguments_offset = 16;
@@ -2235,8 +2234,7 @@
4, 12, 8, 16};
static constexpr dart::compiler::target::word
Thread_write_barrier_wrappers_thread_offset[] = {
- 636, 640, 644, 648, 652, -1, 656, 660,
- 664, 668, -1, -1, -1, -1, -1, -1};
+ 636, 640, 644, 648, 652, -1, 656, -1, 660, 664, -1, -1, -1, -1, -1, -1};
static constexpr dart::compiler::target::word ApiError_InstanceSize = 8;
static constexpr dart::compiler::target::word Array_InstanceSize = 12;
static constexpr dart::compiler::target::word Array_header_size = 12;
@@ -2458,11 +2456,11 @@
static constexpr dart::compiler::target::word ICData_state_bits_offset = 52;
static constexpr dart::compiler::target::word
ICData_receivers_static_type_offset = 32;
-static constexpr dart::compiler::target::word Isolate_class_table_offset = 80;
+static constexpr dart::compiler::target::word Isolate_class_table_offset = 72;
static constexpr dart::compiler::target::word Isolate_current_tag_offset = 40;
static constexpr dart::compiler::target::word Isolate_default_tag_offset = 48;
static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 56;
-static constexpr dart::compiler::target::word Isolate_object_store_offset = 72;
+static constexpr dart::compiler::target::word Isolate_object_store_offset = 64;
static constexpr dart::compiler::target::word Isolate_user_tag_offset = 32;
static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 32;
static constexpr dart::compiler::target::word
@@ -2919,11 +2917,11 @@
static constexpr dart::compiler::target::word ICData_state_bits_offset = 28;
static constexpr dart::compiler::target::word
ICData_receivers_static_type_offset = 16;
-static constexpr dart::compiler::target::word Isolate_class_table_offset = 40;
+static constexpr dart::compiler::target::word Isolate_class_table_offset = 36;
static constexpr dart::compiler::target::word Isolate_current_tag_offset = 20;
static constexpr dart::compiler::target::word Isolate_default_tag_offset = 24;
static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 28;
-static constexpr dart::compiler::target::word Isolate_object_store_offset = 36;
+static constexpr dart::compiler::target::word Isolate_object_store_offset = 32;
static constexpr dart::compiler::target::word Isolate_user_tag_offset = 16;
static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 16;
static constexpr dart::compiler::target::word
@@ -3375,11 +3373,11 @@
static constexpr dart::compiler::target::word ICData_state_bits_offset = 52;
static constexpr dart::compiler::target::word
ICData_receivers_static_type_offset = 32;
-static constexpr dart::compiler::target::word Isolate_class_table_offset = 80;
+static constexpr dart::compiler::target::word Isolate_class_table_offset = 72;
static constexpr dart::compiler::target::word Isolate_current_tag_offset = 40;
static constexpr dart::compiler::target::word Isolate_default_tag_offset = 48;
static constexpr dart::compiler::target::word Isolate_ic_miss_code_offset = 56;
-static constexpr dart::compiler::target::word Isolate_object_store_offset = 72;
+static constexpr dart::compiler::target::word Isolate_object_store_offset = 64;
static constexpr dart::compiler::target::word Isolate_user_tag_offset = 32;
static constexpr dart::compiler::target::word LinkedHashMap_data_offset = 32;
static constexpr dart::compiler::target::word
@@ -3838,7 +3836,7 @@
AOT_ICData_arguments_descriptor_offset = 12;
static constexpr dart::compiler::target::word AOT_ICData_entries_offset = 4;
static constexpr dart::compiler::target::word AOT_Isolate_class_table_offset =
- 40;
+ 36;
static constexpr dart::compiler::target::word AOT_Isolate_current_tag_offset =
20;
static constexpr dart::compiler::target::word AOT_Isolate_default_tag_offset =
@@ -3846,9 +3844,9 @@
static constexpr dart::compiler::target::word AOT_Isolate_ic_miss_code_offset =
28;
static constexpr dart::compiler::target::word AOT_Isolate_object_store_offset =
- 36;
+ 32;
static constexpr dart::compiler::target::word AOT_Isolate_single_step_offset =
- 64;
+ 60;
static constexpr dart::compiler::target::word AOT_Isolate_user_tag_offset = 16;
static constexpr dart::compiler::target::word AOT_LinkedHashMap_data_offset =
16;
@@ -3912,9 +3910,9 @@
static constexpr dart::compiler::target::word
AOT_Thread_AllocateArray_entry_point_offset = 336;
static constexpr dart::compiler::target::word
- AOT_Thread_active_exception_offset = 672;
+ AOT_Thread_active_exception_offset = 668;
static constexpr dart::compiler::target::word
- AOT_Thread_active_stacktrace_offset = 676;
+ AOT_Thread_active_stacktrace_offset = 672;
static constexpr dart::compiler::target::word
AOT_Thread_array_write_barrier_code_offset = 128;
static constexpr dart::compiler::target::word
@@ -3941,7 +3939,7 @@
static constexpr dart::compiler::target::word
AOT_Thread_call_to_runtime_stub_offset = 148;
static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
- 708;
+ 704;
static constexpr dart::compiler::target::word
AOT_Thread_dispatch_table_array_offset = 48;
static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
@@ -3960,7 +3958,7 @@
static constexpr dart::compiler::target::word
AOT_Thread_enter_safepoint_stub_offset = 212;
static constexpr dart::compiler::target::word
- AOT_Thread_execution_state_offset = 692;
+ AOT_Thread_execution_state_offset = 688;
static constexpr dart::compiler::target::word
AOT_Thread_exit_safepoint_stub_offset = 216;
static constexpr dart::compiler::target::word
@@ -3980,7 +3978,7 @@
static constexpr dart::compiler::target::word
AOT_Thread_float_zerow_address_offset = 332;
static constexpr dart::compiler::target::word
- AOT_Thread_global_object_pool_offset = 680;
+ AOT_Thread_global_object_pool_offset = 676;
static constexpr dart::compiler::target::word
AOT_Thread_interpret_call_entry_point_offset = 300;
static constexpr dart::compiler::target::word
@@ -4026,11 +4024,11 @@
112;
static constexpr dart::compiler::target::word
AOT_Thread_predefined_symbols_address_offset = 304;
-static constexpr dart::compiler::target::word AOT_Thread_resume_pc_offset = 684;
+static constexpr dart::compiler::target::word AOT_Thread_resume_pc_offset = 680;
static constexpr dart::compiler::target::word
- AOT_Thread_saved_shadow_call_stack_offset = 688;
+ AOT_Thread_saved_shadow_call_stack_offset = 684;
static constexpr dart::compiler::target::word
- AOT_Thread_safepoint_state_offset = 696;
+ AOT_Thread_safepoint_state_offset = 692;
static constexpr dart::compiler::target::word
AOT_Thread_slow_type_test_stub_offset = 204;
static constexpr dart::compiler::target::word AOT_Thread_stack_limit_offset =
@@ -4064,7 +4062,7 @@
static constexpr dart::compiler::target::word
AOT_Thread_write_barrier_mask_offset = 40;
static constexpr dart::compiler::target::word AOT_Thread_callback_code_offset =
- 700;
+ 696;
static constexpr dart::compiler::target::word
AOT_TimelineStream_enabled_offset = 8;
static constexpr dart::compiler::target::word AOT_TwoByteString_data_offset =
@@ -4109,8 +4107,7 @@
4, 12, 8, 16};
static constexpr dart::compiler::target::word
AOT_Thread_write_barrier_wrappers_thread_offset[] = {
- 636, 640, 644, 648, 652, -1, 656, 660,
- 664, 668, -1, -1, -1, -1, -1, -1};
+ 636, 640, 644, 648, 652, -1, 656, -1, 660, 664, -1, -1, -1, -1, -1, -1};
static constexpr dart::compiler::target::word AOT_ApiError_InstanceSize = 8;
static constexpr dart::compiler::target::word AOT_Array_InstanceSize = 12;
static constexpr dart::compiler::target::word AOT_Array_header_size = 12;
@@ -4347,7 +4344,7 @@
AOT_ICData_arguments_descriptor_offset = 24;
static constexpr dart::compiler::target::word AOT_ICData_entries_offset = 8;
static constexpr dart::compiler::target::word AOT_Isolate_class_table_offset =
- 80;
+ 72;
static constexpr dart::compiler::target::word AOT_Isolate_current_tag_offset =
40;
static constexpr dart::compiler::target::word AOT_Isolate_default_tag_offset =
@@ -4355,9 +4352,9 @@
static constexpr dart::compiler::target::word AOT_Isolate_ic_miss_code_offset =
56;
static constexpr dart::compiler::target::word AOT_Isolate_object_store_offset =
- 72;
+ 64;
static constexpr dart::compiler::target::word AOT_Isolate_single_step_offset =
- 128;
+ 120;
static constexpr dart::compiler::target::word AOT_Isolate_user_tag_offset = 32;
static constexpr dart::compiler::target::word AOT_LinkedHashMap_data_offset =
32;
@@ -4861,7 +4858,7 @@
AOT_ICData_arguments_descriptor_offset = 24;
static constexpr dart::compiler::target::word AOT_ICData_entries_offset = 8;
static constexpr dart::compiler::target::word AOT_Isolate_class_table_offset =
- 80;
+ 72;
static constexpr dart::compiler::target::word AOT_Isolate_current_tag_offset =
40;
static constexpr dart::compiler::target::word AOT_Isolate_default_tag_offset =
@@ -4869,9 +4866,9 @@
static constexpr dart::compiler::target::word AOT_Isolate_ic_miss_code_offset =
56;
static constexpr dart::compiler::target::word AOT_Isolate_object_store_offset =
- 72;
+ 64;
static constexpr dart::compiler::target::word AOT_Isolate_single_step_offset =
- 128;
+ 120;
static constexpr dart::compiler::target::word AOT_Isolate_user_tag_offset = 32;
static constexpr dart::compiler::target::word AOT_LinkedHashMap_data_offset =
32;
@@ -5373,7 +5370,7 @@
AOT_ICData_arguments_descriptor_offset = 12;
static constexpr dart::compiler::target::word AOT_ICData_entries_offset = 4;
static constexpr dart::compiler::target::word AOT_Isolate_class_table_offset =
- 40;
+ 36;
static constexpr dart::compiler::target::word AOT_Isolate_current_tag_offset =
20;
static constexpr dart::compiler::target::word AOT_Isolate_default_tag_offset =
@@ -5381,7 +5378,7 @@
static constexpr dart::compiler::target::word AOT_Isolate_ic_miss_code_offset =
28;
static constexpr dart::compiler::target::word AOT_Isolate_object_store_offset =
- 36;
+ 32;
static constexpr dart::compiler::target::word AOT_Isolate_user_tag_offset = 16;
static constexpr dart::compiler::target::word AOT_LinkedHashMap_data_offset =
16;
@@ -5445,9 +5442,9 @@
static constexpr dart::compiler::target::word
AOT_Thread_AllocateArray_entry_point_offset = 336;
static constexpr dart::compiler::target::word
- AOT_Thread_active_exception_offset = 672;
+ AOT_Thread_active_exception_offset = 668;
static constexpr dart::compiler::target::word
- AOT_Thread_active_stacktrace_offset = 676;
+ AOT_Thread_active_stacktrace_offset = 672;
static constexpr dart::compiler::target::word
AOT_Thread_array_write_barrier_code_offset = 128;
static constexpr dart::compiler::target::word
@@ -5474,7 +5471,7 @@
static constexpr dart::compiler::target::word
AOT_Thread_call_to_runtime_stub_offset = 148;
static constexpr dart::compiler::target::word AOT_Thread_dart_stream_offset =
- 708;
+ 704;
static constexpr dart::compiler::target::word
AOT_Thread_dispatch_table_array_offset = 48;
static constexpr dart::compiler::target::word AOT_Thread_optimize_entry_offset =
@@ -5493,7 +5490,7 @@
static constexpr dart::compiler::target::word
AOT_Thread_enter_safepoint_stub_offset = 212;
static constexpr dart::compiler::target::word
- AOT_Thread_execution_state_offset = 692;
+ AOT_Thread_execution_state_offset = 688;
static constexpr dart::compiler::target::word
AOT_Thread_exit_safepoint_stub_offset = 216;
static constexpr dart::compiler::target::word
@@ -5513,7 +5510,7 @@
static constexpr dart::compiler::target::word
AOT_Thread_float_zerow_address_offset = 332;
static constexpr dart::compiler::target::word
- AOT_Thread_global_object_pool_offset = 680;
+ AOT_Thread_global_object_pool_offset = 676;
static constexpr dart::compiler::target::word
AOT_Thread_interpret_call_entry_point_offset = 300;
static constexpr dart::compiler::target::word
@@ -5559,11 +5556,11 @@
112;
static constexpr dart::compiler::target::word
AOT_Thread_predefined_symbols_address_offset = 304;
-static constexpr dart::compiler::target::word AOT_Thread_resume_pc_offset = 684;
+static constexpr dart::compiler::target::word AOT_Thread_resume_pc_offset = 680;
static constexpr dart::compiler::target::word
- AOT_Thread_saved_shadow_call_stack_offset = 688;
+ AOT_Thread_saved_shadow_call_stack_offset = 684;
static constexpr dart::compiler::target::word
- AOT_Thread_safepoint_state_offset = 696;
+ AOT_Thread_safepoint_state_offset = 692;
static constexpr dart::compiler::target::word
AOT_Thread_slow_type_test_stub_offset = 204;
static constexpr dart::compiler::target::word AOT_Thread_stack_limit_offset =
@@ -5597,7 +5594,7 @@
static constexpr dart::compiler::target::word
AOT_Thread_write_barrier_mask_offset = 40;
static constexpr dart::compiler::target::word AOT_Thread_callback_code_offset =
- 700;
+ 696;
static constexpr dart::compiler::target::word
AOT_TimelineStream_enabled_offset = 8;
static constexpr dart::compiler::target::word AOT_TwoByteString_data_offset =
@@ -5639,8 +5636,7 @@
4, 12, 8, 16};
static constexpr dart::compiler::target::word
AOT_Thread_write_barrier_wrappers_thread_offset[] = {
- 636, 640, 644, 648, 652, -1, 656, 660,
- 664, 668, -1, -1, -1, -1, -1, -1};
+ 636, 640, 644, 648, 652, -1, 656, -1, 660, 664, -1, -1, -1, -1, -1, -1};
static constexpr dart::compiler::target::word AOT_ApiError_InstanceSize = 8;
static constexpr dart::compiler::target::word AOT_Array_InstanceSize = 12;
static constexpr dart::compiler::target::word AOT_Array_header_size = 12;
@@ -5875,7 +5871,7 @@
AOT_ICData_arguments_descriptor_offset = 24;
static constexpr dart::compiler::target::word AOT_ICData_entries_offset = 8;
static constexpr dart::compiler::target::word AOT_Isolate_class_table_offset =
- 80;
+ 72;
static constexpr dart::compiler::target::word AOT_Isolate_current_tag_offset =
40;
static constexpr dart::compiler::target::word AOT_Isolate_default_tag_offset =
@@ -5883,7 +5879,7 @@
static constexpr dart::compiler::target::word AOT_Isolate_ic_miss_code_offset =
56;
static constexpr dart::compiler::target::word AOT_Isolate_object_store_offset =
- 72;
+ 64;
static constexpr dart::compiler::target::word AOT_Isolate_user_tag_offset = 32;
static constexpr dart::compiler::target::word AOT_LinkedHashMap_data_offset =
32;
@@ -6382,7 +6378,7 @@
AOT_ICData_arguments_descriptor_offset = 24;
static constexpr dart::compiler::target::word AOT_ICData_entries_offset = 8;
static constexpr dart::compiler::target::word AOT_Isolate_class_table_offset =
- 80;
+ 72;
static constexpr dart::compiler::target::word AOT_Isolate_current_tag_offset =
40;
static constexpr dart::compiler::target::word AOT_Isolate_default_tag_offset =
@@ -6390,7 +6386,7 @@
static constexpr dart::compiler::target::word AOT_Isolate_ic_miss_code_offset =
56;
static constexpr dart::compiler::target::word AOT_Isolate_object_store_offset =
- 72;
+ 64;
static constexpr dart::compiler::target::word AOT_Isolate_user_tag_offset = 32;
static constexpr dart::compiler::target::word AOT_LinkedHashMap_data_offset =
32;
diff --git a/runtime/vm/compiler/stub_code_compiler_arm.cc b/runtime/vm/compiler/stub_code_compiler_arm.cc
index 5aa64bc..2e3dd1d 100644
--- a/runtime/vm/compiler/stub_code_compiler_arm.cc
+++ b/runtime/vm/compiler/stub_code_compiler_arm.cc
@@ -142,7 +142,7 @@
// Restore the global object pool after returning from runtime (old space is
// moving, so the GOP could have been relocated).
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- __ ldr(PP, Address(THR, target::Thread::global_object_pool_offset()));
+ __ SetupGlobalPoolAndDispatchTable();
}
__ LeaveStubFrame();
@@ -619,7 +619,7 @@
// Restore the global object pool after returning from runtime (old space is
// moving, so the GOP could have been relocated).
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- __ ldr(PP, Address(THR, target::Thread::global_object_pool_offset()));
+ __ SetupGlobalPoolAndDispatchTable();
}
__ LeaveStubFrame();
@@ -1082,25 +1082,25 @@
// R9: Allocation size.
// Potential new object start.
__ ldr(R0, Address(THR, target::Thread::top_offset()));
- __ adds(NOTFP, R0, Operand(R9)); // Potential next object start.
+ __ adds(R3, R0, Operand(R9)); // Potential next object start.
__ b(&slow_case, CS); // Branch if unsigned overflow.
// Check if the allocation fits into the remaining space.
// R0: potential new object start.
- // NOTFP: potential next object start.
+ // R3: potential next object start.
// R9: allocation size.
- __ ldr(R3, Address(THR, target::Thread::end_offset()));
- __ cmp(NOTFP, Operand(R3));
+ __ ldr(TMP, Address(THR, target::Thread::end_offset()));
+ __ cmp(R3, Operand(TMP));
__ b(&slow_case, CS);
// Successfully allocated the object(s), now update top to point to
// next object start and initialize the object.
- __ str(NOTFP, Address(THR, target::Thread::top_offset()));
+ __ str(R3, Address(THR, target::Thread::top_offset()));
__ add(R0, R0, Operand(kHeapObjectTag));
// Initialize the tags.
// R0: new object start as a tagged pointer.
- // NOTFP: new object end address.
+ // R3: new object end address.
// R9: allocation size.
{
const intptr_t shift = target::RawObject::kTagBitsSizeTagPos -
@@ -1120,7 +1120,7 @@
}
// R0: new object start as a tagged pointer.
- // NOTFP: new object end address.
+ // R3: new object end address.
// Store the type argument field.
__ StoreIntoObjectNoBarrier(
R0, FieldAddress(R0, target::Array::type_arguments_offset()), R1);
@@ -1134,13 +1134,13 @@
// R8, R9: null
// R4: iterator which initially points to the start of the variable
// data area to be initialized.
- // NOTFP: new object end address.
+ // R3: new object end address.
// R9: allocation size.
__ LoadObject(R8, NullObject());
__ mov(R9, Operand(R8));
__ AddImmediate(R4, R0, target::Array::header_size() - kHeapObjectTag);
- __ InitializeFieldsNoBarrier(R0, R4, NOTFP, R8, R9);
+ __ InitializeFieldsNoBarrier(R0, R4, R3, R8, R9);
__ Ret(); // Returns the newly allocated object in R0.
// Unable to allocate the array using the fast inline code, just call
// into the runtime.
@@ -1149,7 +1149,7 @@
// Create a stub frame as we are pushing some objects on the stack before
// calling into the runtime.
__ EnterStubFrame();
- __ LoadImmediate(IP, 0);
+ __ LoadImmediate(TMP, 0);
// Setup space on stack for return value.
// Push array length as Smi and element type.
__ PushList((1 << R1) | (1 << R2) | (1 << IP));
@@ -1295,7 +1295,7 @@
// Call the Dart code entrypoint.
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- __ ldr(PP, Address(THR, target::Thread::global_object_pool_offset()));
+ __ SetupGlobalPoolAndDispatchTable();
} else {
__ LoadImmediate(PP, 0); // GC safe value into PP.
}
@@ -1557,7 +1557,6 @@
// Setup the parent field.
// R0: new object.
- // R1: number of context variables.
// R2: object size.
// R3: next object start.
__ LoadObject(R8, NullObject());
@@ -1567,14 +1566,13 @@
// Initialize the context variables.
// R0: new object.
- // R1: number of context variables.
// R2: object size.
// R3: next object start.
// R8, R9: raw null.
Label loop;
- __ AddImmediate(NOTFP, R0,
+ __ AddImmediate(R1, R0,
target::Context::variable_offset(0) - kHeapObjectTag);
- __ InitializeFieldsNoBarrier(R0, NOTFP, R3, R8, R9);
+ __ InitializeFieldsNoBarrier(R0, R1, R3, R8, R9);
// Done allocating and initializing the context.
// R0: new object.
@@ -1967,11 +1965,9 @@
__ PopList((1 << R9) | (1 << R8)); // Restore.
__ LeaveStubFrame();
}
- __ ldr(NOTFP,
- FieldAddress(func_reg, target::Function::usage_counter_offset()));
- __ add(NOTFP, NOTFP, Operand(1));
- __ str(NOTFP,
- FieldAddress(func_reg, target::Function::usage_counter_offset()));
+ __ ldr(TMP, FieldAddress(func_reg, target::Function::usage_counter_offset()));
+ __ add(TMP, TMP, Operand(1));
+ __ str(TMP, FieldAddress(func_reg, target::Function::usage_counter_offset()));
}
// Loads function into 'temp_reg'.
@@ -1983,10 +1979,10 @@
ASSERT(temp_reg == R8);
__ Comment("Increment function counter");
__ ldr(func_reg, FieldAddress(ic_reg, target::ICData::owner_offset()));
- __ ldr(NOTFP,
+ __ ldr(TMP,
FieldAddress(func_reg, target::Function::usage_counter_offset()));
- __ add(NOTFP, NOTFP, Operand(1));
- __ str(NOTFP,
+ __ add(TMP, TMP, Operand(1));
+ __ str(TMP,
FieldAddress(func_reg, target::Function::usage_counter_offset()));
}
}
@@ -2149,9 +2145,8 @@
__ LoadTaggedClassIdMayBeSmi(R0, R0);
__ ldr(R4, FieldAddress(R9, target::ICData::arguments_descriptor_offset()));
if (num_args == 2) {
- __ ldr(NOTFP,
- FieldAddress(R4, target::ArgumentsDescriptor::count_offset()));
- __ sub(R1, NOTFP, Operand(target::ToRawSmi(2)));
+ __ ldr(R1, FieldAddress(R4, target::ArgumentsDescriptor::count_offset()));
+ __ sub(R1, R1, Operand(target::ToRawSmi(2)));
__ ldr(R1, Address(SP, R1, LSL, 1)); // R1 (argument_count - 2) is Smi.
__ LoadTaggedClassIdMayBeSmi(R1, R1);
}
@@ -2161,17 +2156,15 @@
// Get the receiver's class ID (first read number of arguments from
// arguments descriptor array and then access the receiver from the stack).
- __ ldr(NOTFP,
- FieldAddress(R4, target::ArgumentsDescriptor::count_offset()));
- __ sub(NOTFP, NOTFP, Operand(target::ToRawSmi(1)));
- // NOTFP: argument_count - 1 (smi).
+ __ ldr(R1, FieldAddress(R4, target::ArgumentsDescriptor::count_offset()));
+ __ sub(R1, R1, Operand(target::ToRawSmi(1)));
+ // R1: argument_count - 1 (smi).
- __ ldr(R0,
- Address(SP, NOTFP, LSL, 1)); // NOTFP (argument_count - 1) is Smi.
+ __ ldr(R0, Address(SP, R1, LSL, 1)); // R1 (argument_count - 1) is Smi.
__ LoadTaggedClassIdMayBeSmi(R0, R0);
if (num_args == 2) {
- __ sub(R1, NOTFP, Operand(target::ToRawSmi(1)));
+ __ sub(R1, R1, Operand(target::ToRawSmi(1)));
__ ldr(R1, Address(SP, R1, LSL, 1)); // R1 (argument_count - 2) is Smi.
__ LoadTaggedClassIdMayBeSmi(R1, R1);
}
@@ -2218,11 +2211,11 @@
__ Bind(&miss);
__ Comment("IC miss");
// Compute address of arguments.
- __ ldr(NOTFP, FieldAddress(R4, target::ArgumentsDescriptor::count_offset()));
- __ sub(NOTFP, NOTFP, Operand(target::ToRawSmi(1)));
- // NOTFP: argument_count - 1 (smi).
- __ add(NOTFP, SP, Operand(NOTFP, LSL, 1)); // NOTFP is Smi.
- // NOTFP: address of receiver.
+ __ ldr(R1, FieldAddress(R4, target::ArgumentsDescriptor::count_offset()));
+ __ sub(R1, R1, Operand(target::ToRawSmi(1)));
+ // R1: argument_count - 1 (smi).
+ __ add(R1, SP, Operand(R1, LSL, 1)); // R1 is Smi.
+ // R1: address of receiver.
// Create a stub frame as we are pushing some objects on the stack before
// calling into the runtime.
__ EnterStubFrame();
@@ -2237,8 +2230,8 @@
__ PushList(regs);
// Push call arguments.
for (intptr_t i = 0; i < num_args; i++) {
- __ LoadFromOffset(kWord, IP, NOTFP, -i * target::kWordSize);
- __ Push(IP);
+ __ LoadFromOffset(kWord, TMP, R1, -i * target::kWordSize);
+ __ Push(TMP);
}
// Pass IC data object.
__ Push(R9);
@@ -2662,7 +2655,8 @@
// R1: function type arguments (only if n >= 4, can be raw_null).
// R3: target::SubtypeTestCache.
//
-// Preserves R0/R2
+// Preserves R0/R2.
+// Preserves NOTFP with bare instructions and CODE_REG without.
//
// Result in R1: null -> not found, otherwise result (true or false).
static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) {
@@ -2675,10 +2669,19 @@
const Register kInstanceCidOrFunction = R8;
const Register kInstanceInstantiatorTypeArgumentsReg = R4;
- const Register kInstanceParentFunctionTypeArgumentsReg = CODE_REG;
const Register kInstanceDelayedFunctionTypeArgumentsReg = PP;
- const Register kNullReg = NOTFP;
+ Register kInstanceParentFunctionTypeArgumentsReg;
+ Register kNullReg;
+ if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
+ // NOTFP must be preserved, but CODE_REG can be freely used.
+ kInstanceParentFunctionTypeArgumentsReg = NOTFP;
+ kNullReg = CODE_REG;
+ } else {
+ // CODE_REG must be preserved, but NOTFP can be freely used.
+ kInstanceParentFunctionTypeArgumentsReg = CODE_REG;
+ kNullReg = NOTFP;
+ }
__ LoadObject(kNullReg, NullObject());
@@ -2865,6 +2868,13 @@
// Note of warning: The caller will not populate CODE_REG and we have therefore
// no access to the pool.
void StubCodeCompiler::GenerateDefaultTypeTestStub(Assembler* assembler) {
+ __ ldr(CODE_REG, Address(THR, target::Thread::slow_type_test_stub_offset()));
+ __ Branch(FieldAddress(CODE_REG, target::Code::entry_point_offset()));
+}
+
+// Used instead of DefaultTypeTestStub when null is assignable.
+void StubCodeCompiler::GenerateDefaultNullableTypeTestStub(
+ Assembler* assembler) {
Label done;
const Register kInstanceReg = R0;
@@ -2919,6 +2929,17 @@
void StubCodeCompiler::GenerateLazySpecializeTypeTestStub(
Assembler* assembler) {
+ __ ldr(CODE_REG,
+ Address(THR, target::Thread::lazy_specialize_type_test_stub_offset()));
+ __ EnterStubFrame();
+ InvokeTypeCheckFromTypeTestStub(assembler, kTypeCheckFromLazySpecializeStub);
+ __ LeaveStubFrame();
+ __ Ret();
+}
+
+// Used instead of LazySpecializeTypeTestStub when null is assignable.
+void StubCodeCompiler::GenerateLazySpecializeNullableTypeTestStub(
+ Assembler* assembler) {
const Register kInstanceReg = R0;
Label done;
@@ -2945,20 +2966,11 @@
__ EnterStubFrame();
-#ifdef DEBUG
- // Guaranteed by caller.
- Label no_error;
- __ CompareObject(kInstanceReg, NullObject());
- __ BranchIf(NOT_EQUAL, &no_error);
- __ Breakpoint();
- __ Bind(&no_error);
-#endif
-
// If the subtype-cache is null, it needs to be lazily-created by the runtime.
__ CompareObject(kSubtypeTestCacheReg, NullObject());
__ BranchIf(EQUAL, &call_runtime);
- const Register kTmp = NOTFP;
+ const Register kTmp = R9;
// If this is not a [Type] object, we'll go to the runtime.
Label is_simple_case, is_complex_case;
@@ -3049,7 +3061,7 @@
// Restore the pool pointer.
__ RestoreCodePointer();
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
- __ ldr(PP, Address(THR, target::Thread::global_object_pool_offset()));
+ __ SetupGlobalPoolAndDispatchTable();
__ set_constant_pool_allowed(true);
} else {
__ LoadPoolPointer();
diff --git a/runtime/vm/compiler/stub_code_compiler_arm64.cc b/runtime/vm/compiler/stub_code_compiler_arm64.cc
index 73c12f9..8e24271 100644
--- a/runtime/vm/compiler/stub_code_compiler_arm64.cc
+++ b/runtime/vm/compiler/stub_code_compiler_arm64.cc
@@ -2980,22 +2980,23 @@
// Note of warning: The caller will not populate CODE_REG and we have therefore
// no access to the pool.
void StubCodeCompiler::GenerateDefaultTypeTestStub(Assembler* assembler) {
+ // Tail call the [SubtypeTestCache]-based implementation.
+ __ ldr(CODE_REG, Address(THR, target::Thread::slow_type_test_stub_offset()));
+ __ ldr(R9, FieldAddress(CODE_REG, target::Code::entry_point_offset()));
+ __ br(R9);
+}
+
+// Used instead of DefaultTypeTestStub when null is assignable.
+void StubCodeCompiler::GenerateDefaultNullableTypeTestStub(
+ Assembler* assembler) {
Label done;
const Register kInstanceReg = R0;
- const Register kDstTypeReg = R8;
// Fast case for 'null'.
__ CompareObject(kInstanceReg, NullObject());
__ BranchIf(EQUAL, &done);
- // Fast case for 'int'.
- Label not_smi;
- __ BranchIfNotSmi(kInstanceReg, ¬_smi);
- __ CompareObject(kDstTypeReg, CastHandle<Object>(IntType()));
- __ BranchIf(EQUAL, &done);
- __ Bind(¬_smi);
-
// Tail call the [SubtypeTestCache]-based implementation.
__ ldr(CODE_REG, Address(THR, target::Thread::slow_type_test_stub_offset()));
__ ldr(R9, FieldAddress(CODE_REG, target::Code::entry_point_offset()));
@@ -3046,6 +3047,17 @@
void StubCodeCompiler::GenerateLazySpecializeTypeTestStub(
Assembler* assembler) {
+ __ ldr(CODE_REG,
+ Address(THR, target::Thread::lazy_specialize_type_test_stub_offset()));
+ __ EnterStubFrame();
+ InvokeTypeCheckFromTypeTestStub(assembler, kTypeCheckFromLazySpecializeStub);
+ __ LeaveStubFrame();
+ __ Ret();
+}
+
+// Used instead of LazySpecializeTypeTestStub when null is assignable.
+void StubCodeCompiler::GenerateLazySpecializeNullableTypeTestStub(
+ Assembler* assembler) {
const Register kInstanceReg = R0;
Label done;
@@ -3072,15 +3084,6 @@
__ EnterStubFrame();
-#ifdef DEBUG
- // Guaranteed by caller.
- Label no_error;
- __ CompareObject(kInstanceReg, NullObject());
- __ BranchIf(NOT_EQUAL, &no_error);
- __ Breakpoint();
- __ Bind(&no_error);
-#endif
-
// If the subtype-cache is null, it needs to be lazily-created by the runtime.
__ CompareObject(kSubtypeTestCacheReg, NullObject());
__ BranchIf(EQUAL, &call_runtime);
diff --git a/runtime/vm/compiler/stub_code_compiler_ia32.cc b/runtime/vm/compiler/stub_code_compiler_ia32.cc
index f29b2db..b9eac1f 100644
--- a/runtime/vm/compiler/stub_code_compiler_ia32.cc
+++ b/runtime/vm/compiler/stub_code_compiler_ia32.cc
@@ -2480,6 +2480,12 @@
__ Breakpoint();
}
+void StubCodeCompiler::GenerateDefaultNullableTypeTestStub(
+ Assembler* assembler) {
+ // Not implemented on ia32.
+ __ Breakpoint();
+}
+
void StubCodeCompiler::GenerateTopTypeTypeTestStub(Assembler* assembler) {
// Not implemented on ia32.
__ Breakpoint();
@@ -2496,6 +2502,12 @@
__ Breakpoint();
}
+void StubCodeCompiler::GenerateLazySpecializeNullableTypeTestStub(
+ Assembler* assembler) {
+ // Not implemented on ia32.
+ __ Breakpoint();
+}
+
void StubCodeCompiler::GenerateSlowTypeTestStub(Assembler* assembler) {
// Not implemented on ia32.
__ Breakpoint();
diff --git a/runtime/vm/compiler/stub_code_compiler_x64.cc b/runtime/vm/compiler/stub_code_compiler_x64.cc
index 582b39a..2a8b029 100644
--- a/runtime/vm/compiler/stub_code_compiler_x64.cc
+++ b/runtime/vm/compiler/stub_code_compiler_x64.cc
@@ -2945,6 +2945,13 @@
// Note of warning: The caller will not populate CODE_REG and we have therefore
// no access to the pool.
void StubCodeCompiler::GenerateDefaultTypeTestStub(Assembler* assembler) {
+ __ movq(CODE_REG, Address(THR, target::Thread::slow_type_test_stub_offset()));
+ __ jmp(FieldAddress(CODE_REG, target::Code::entry_point_offset()));
+}
+
+// Used instead of DefaultTypeTestStub when null is assignable.
+void StubCodeCompiler::GenerateDefaultNullableTypeTestStub(
+ Assembler* assembler) {
Label done;
const Register kInstanceReg = RAX;
@@ -3000,6 +3007,18 @@
void StubCodeCompiler::GenerateLazySpecializeTypeTestStub(
Assembler* assembler) {
+ __ movq(
+ CODE_REG,
+ Address(THR, target::Thread::lazy_specialize_type_test_stub_offset()));
+ __ EnterStubFrame();
+ InvokeTypeCheckFromTypeTestStub(assembler, kTypeCheckFromLazySpecializeStub);
+ __ LeaveStubFrame();
+ __ Ret();
+}
+
+// Used instead of LazySpecializeTypeTestStub when null is assignable.
+void StubCodeCompiler::GenerateLazySpecializeNullableTypeTestStub(
+ Assembler* assembler) {
const Register kInstanceReg = RAX;
Label done;
@@ -3028,19 +3047,6 @@
__ EnterStubFrame();
-#ifdef DEBUG
- // Guaranteed by caller.
- // TODO(regis): This will change when supporting NNBD, because the caller may
- // not always determine the test result for a null instance, as for example
- // in the case of a still uninstantiated test type, which may become nullable
- // or non-nullable after instantiation in the runtime.
- Label no_error;
- __ CompareObject(kInstanceReg, NullObject());
- __ BranchIf(NOT_EQUAL, &no_error);
- __ Breakpoint();
- __ Bind(&no_error);
-#endif
-
// If the subtype-cache is null, it needs to be lazily-created by the runtime.
__ CompareObject(kSubtypeTestCacheReg, NullObject());
__ BranchIf(EQUAL, &call_runtime);
diff --git a/runtime/vm/constants_arm.h b/runtime/vm/constants_arm.h
index 5c06142..8517f88 100644
--- a/runtime/vm/constants_arm.h
+++ b/runtime/vm/constants_arm.h
@@ -286,6 +286,7 @@
const Register TMP = IP; // Used as scratch register by assembler.
const Register TMP2 = kNoRegister; // There is no second assembler temporary.
const Register PP = R5; // Caches object pool pointer in generated code.
+const Register DISPATCH_TABLE_REG = NOTFP; // Dispatch table register.
const Register SPREG = SP; // Stack pointer register.
const Register FPREG = FP; // Frame pointer register.
const Register LRREG = LR; // Link register.
@@ -332,8 +333,8 @@
const RegList kReservedCpuRegisters = (1 << SPREG) | (1 << FPREG) | (1 << TMP) |
(1 << PP) | (1 << THR) | (1 << LR) |
- (1 << PC);
-constexpr intptr_t kNumberOfReservedCpuRegisters = 7;
+ (1 << PC) | (1 << NOTFP);
+constexpr intptr_t kNumberOfReservedCpuRegisters = 8;
// CPU registers available to Dart allocator.
constexpr RegList kDartAvailableCpuRegs =
kAllCpuRegistersList & ~kReservedCpuRegisters;
@@ -402,8 +403,7 @@
// We choose these to avoid overlap between themselves and reserved registers.
static constexpr Register kFirstNonArgumentRegister = R8;
static constexpr Register kSecondNonArgumentRegister = R9;
- static constexpr Register kFirstCalleeSavedCpuReg = NOTFP;
- static constexpr Register kSecondCalleeSavedCpuReg = R4;
+ static constexpr Register kFirstCalleeSavedCpuReg = R4;
static constexpr Register kStackPointerRegister = SPREG;
};
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index ccda701..4f2c567 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -208,8 +208,8 @@
Timeline::Init();
TimelineBeginEndScope tbes(Timeline::GetVMStream(), "Dart::Init");
#endif
- Isolate::InitVM();
IsolateGroup::Init();
+ Isolate::InitVM();
PortMap::Init();
FreeListElement::Init();
ForwardingCorpse::Init();
@@ -246,12 +246,14 @@
// really an isolate itself - it acts more as a container for VM-global
// objects.
std::unique_ptr<IsolateGroupSource> source(
- new IsolateGroupSource(nullptr, "vm-isolate", vm_isolate_snapshot,
+ new IsolateGroupSource(nullptr, kVmIsolateName, vm_isolate_snapshot,
instructions_snapshot, nullptr, -1, api_flags));
auto group = new IsolateGroup(std::move(source), /*embedder_data=*/nullptr);
+ group->CreateHeap(/*is_vm_isolate=*/true,
+ /*is_service_or_kernel_isolate=*/false);
IsolateGroup::RegisterIsolateGroup(group);
vm_isolate_ =
- Isolate::InitIsolate("vm-isolate", group, api_flags, is_vm_isolate);
+ Isolate::InitIsolate(kVmIsolateName, group, api_flags, is_vm_isolate);
group->set_initial_spawn_successful();
// Verify assumptions about executing in the VM isolate.
@@ -278,9 +280,7 @@
if (Snapshot::IncludesCode(vm_snapshot_kind_)) {
if (vm_snapshot_kind_ == Snapshot::kFullAOT) {
-#if defined(DART_PRECOMPILED_RUNTIME)
- vm_isolate_->set_compilation_allowed(false);
-#else
+#if !defined(DART_PRECOMPILED_RUNTIME)
return strdup("JIT runtime cannot run a precompiled snapshot");
#endif
}
@@ -405,31 +405,43 @@
return NULL;
}
-bool Dart::HasApplicationIsolateLocked() {
- for (Isolate* isolate = Isolate::isolates_list_head_; isolate != NULL;
- isolate = isolate->next_) {
- if (!Isolate::IsVMInternalIsolate(isolate)) return true;
- }
- return false;
+static void DumpAliveIsolates(intptr_t num_attempts,
+ bool only_aplication_isolates) {
+ IsolateGroup::ForEach([&](IsolateGroup* group) {
+ group->ForEachIsolate([&](Isolate* isolate) {
+ if (!only_aplication_isolates || !Isolate::IsVMInternalIsolate(isolate)) {
+ OS::PrintErr("Attempt:%" Pd " waiting for isolate %s to check in\n",
+ num_attempts, isolate->name());
+ }
+ });
+ });
+}
+
+static bool OnlyVmIsolateLeft() {
+ intptr_t count = 0;
+ bool found_vm_isolate = false;
+ IsolateGroup::ForEach([&](IsolateGroup* group) {
+ group->ForEachIsolate([&](Isolate* isolate) {
+ count++;
+ if (isolate == Dart::vm_isolate()) {
+ found_vm_isolate = true;
+ }
+ });
+ });
+ return count == 1 && found_vm_isolate;
}
// 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_);
+ MonitorLocker ml(Isolate::isolate_creation_monitor_);
intptr_t num_attempts = 0;
- while (HasApplicationIsolateLocked()) {
+ while (Isolate::application_isolates_count_ > 1) {
Monitor::WaitResult retval = ml.Wait(1000);
if (retval == Monitor::kTimedOut) {
num_attempts += 1;
if (num_attempts > 10) {
- for (Isolate* isolate = Isolate::isolates_list_head_; isolate != NULL;
- isolate = isolate->next_) {
- if (!Isolate::IsVMInternalIsolate(isolate)) {
- OS::PrintErr("Attempt:%" Pd " waiting for isolate %s to check in\n",
- num_attempts, isolate->name_);
- }
- }
+ DumpAliveIsolates(num_attempts, /*only_application_isolates=*/true);
}
}
}
@@ -438,22 +450,19 @@
// This waits until only the VM isolate remains in the list.
void Dart::WaitForIsolateShutdown() {
ASSERT(!Isolate::creation_enabled_);
- MonitorLocker ml(Isolate::isolates_list_monitor_);
+ MonitorLocker ml(Isolate::isolate_creation_monitor_);
intptr_t num_attempts = 0;
- while ((Isolate::isolates_list_head_ != NULL) &&
- (Isolate::isolates_list_head_->next_ != NULL)) {
+ while (Isolate::total_isolates_count_ > 1) {
Monitor::WaitResult retval = ml.Wait(1000);
if (retval == Monitor::kTimedOut) {
num_attempts += 1;
if (num_attempts > 10) {
- for (Isolate* isolate = Isolate::isolates_list_head_; isolate != NULL;
- isolate = isolate->next_)
- OS::PrintErr("Attempt:%" Pd " waiting for isolate %s to check in\n",
- num_attempts, isolate->name_);
+ DumpAliveIsolates(num_attempts, /*only_application_isolates=*/false);
}
}
}
- ASSERT(Isolate::isolates_list_head_ == Dart::vm_isolate());
+
+ ASSERT(OnlyVmIsolateLeft());
}
char* Dart::Cleanup() {
@@ -938,12 +947,12 @@
}
void Dart::ShutdownIsolate() {
- Isolate* isolate = Isolate::Current();
- isolate->Shutdown();
- if (KernelIsolate::IsKernelIsolate(isolate)) {
- KernelIsolate::SetKernelIsolate(NULL);
- }
- delete isolate;
+ Isolate::Current()->Shutdown();
+}
+
+bool Dart::VmIsolateNameEquals(const char* name) {
+ ASSERT(name != NULL);
+ return (strcmp(name, kVmIsolateName) == 0);
}
int64_t Dart::UptimeMicros() {
diff --git a/runtime/vm/dart.h b/runtime/vm/dart.h
index 11e5c43..0c7b6e8 100644
--- a/runtime/vm/dart.h
+++ b/runtime/vm/dart.h
@@ -66,6 +66,7 @@
static Isolate* vm_isolate() { return vm_isolate_; }
static ThreadPool* thread_pool() { return thread_pool_; }
+ static bool VmIsolateNameEquals(const char* name);
static int64_t UptimeMicros();
static int64_t UptimeMillis() {
@@ -129,9 +130,10 @@
static bool non_nullable_flag() { return true; }
private:
+ static constexpr const char* kVmIsolateName = "vm-isolate";
+
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 dbcc390..78f1f6b 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -146,15 +146,22 @@
static RawInstance* GetListInstance(Zone* zone, const Object& obj) {
if (obj.IsInstance()) {
- const Library& core_lib = Library::Handle(zone, Library::CoreLibrary());
- const Class& list_class =
- Class::Handle(zone, core_lib.LookupClass(Symbols::List()));
- ASSERT(!list_class.IsNull());
+ ObjectStore* object_store = Isolate::Current()->object_store();
+ Type& list_rare_type =
+ Type::Handle(zone, object_store->non_nullable_list_rare_type());
+ if (list_rare_type.IsNull()) {
+ const Library& core_lib = Library::Handle(zone, Library::CoreLibrary());
+ const Class& list_class =
+ Class::Handle(zone, core_lib.LookupClass(Symbols::List()));
+ ASSERT(!list_class.IsNull());
+ list_rare_type ^= list_class.RareType();
+ object_store->set_non_nullable_list_rare_type(list_rare_type);
+ }
const Instance& instance = Instance::Cast(obj);
const Class& obj_class = Class::Handle(zone, obj.clazz());
if (Class::IsSubtypeOf(NNBDMode::kLegacyLib, obj_class,
- Object::null_type_arguments(), list_class,
- Object::null_type_arguments(), Heap::kNew)) {
+ Object::null_type_arguments(), list_rare_type,
+ Heap::kNew)) {
return instance.raw();
}
}
@@ -163,15 +170,22 @@
static RawInstance* GetMapInstance(Zone* zone, const Object& obj) {
if (obj.IsInstance()) {
- const Library& core_lib = Library::Handle(zone, Library::CoreLibrary());
- const Class& map_class =
- Class::Handle(core_lib.LookupClass(Symbols::Map()));
- ASSERT(!map_class.IsNull());
+ ObjectStore* object_store = Isolate::Current()->object_store();
+ Type& map_rare_type =
+ Type::Handle(zone, object_store->non_nullable_map_rare_type());
+ if (map_rare_type.IsNull()) {
+ const Library& core_lib = Library::Handle(zone, Library::CoreLibrary());
+ const Class& map_class =
+ Class::Handle(zone, core_lib.LookupClass(Symbols::Map()));
+ ASSERT(!map_class.IsNull());
+ map_rare_type ^= map_class.RareType();
+ object_store->set_non_nullable_map_rare_type(map_rare_type);
+ }
const Instance& instance = Instance::Cast(obj);
const Class& obj_class = Class::Handle(zone, obj.clazz());
if (Class::IsSubtypeOf(NNBDMode::kLegacyLib, obj_class,
- Object::null_type_arguments(), map_class,
- Object::null_type_arguments(), Heap::kNew)) {
+ Object::null_type_arguments(), map_rare_type,
+ Heap::kNew)) {
return instance.raw();
}
}
@@ -360,7 +374,7 @@
ASSERT(thread->IsMutatorThread());
ASSERT(thread->isolate() != NULL);
ASSERT(!FLAG_verify_handles || thread->IsValidLocalHandle(object) ||
- thread->isolate()->api_state()->IsActivePersistentHandle(
+ thread->isolate()->group()->api_state()->IsActivePersistentHandle(
reinterpret_cast<Dart_PersistentHandle>(object)) ||
Dart::IsReadOnlyApiHandle(object));
ASSERT(FinalizablePersistentHandle::raw_offset() == 0 &&
@@ -463,9 +477,8 @@
return Api::NewHandle(T, error.raw());
}
-Dart_Handle Api::AcquiredError(Isolate* isolate) {
- ASSERT(isolate != NULL);
- ApiState* state = isolate->api_state();
+Dart_Handle Api::AcquiredError(IsolateGroup* isolate_group) {
+ ApiState* state = isolate_group->api_state();
ASSERT(state != NULL);
PersistentHandle* acquired_error_handle = state->AcquiredError();
return reinterpret_cast<Dart_Handle>(acquired_error_handle);
@@ -480,9 +493,9 @@
// Check against all of the handles in the current isolate as well as the
// read-only handles.
return thread->IsValidHandle(handle) ||
- isolate->api_state()->IsActivePersistentHandle(
+ isolate->group()->api_state()->IsActivePersistentHandle(
reinterpret_cast<Dart_PersistentHandle>(handle)) ||
- isolate->api_state()->IsActiveWeakPersistentHandle(
+ isolate->group()->api_state()->IsActiveWeakPersistentHandle(
reinterpret_cast<Dart_WeakPersistentHandle>(handle)) ||
Dart::IsReadOnlyApiHandle(handle) ||
Dart::IsReadOnlyHandle(reinterpret_cast<uword>(handle));
@@ -513,7 +526,7 @@
Isolate* isolate = Isolate::Current();
ASSERT(isolate != NULL);
ASSERT(isolate == Dart::vm_isolate());
- ApiState* state = isolate->api_state();
+ ApiState* state = isolate->group()->api_state();
ASSERT(state != NULL);
ASSERT(true_handle_ == NULL);
@@ -674,21 +687,21 @@
}
PersistentHandle* PersistentHandle::Cast(Dart_PersistentHandle handle) {
- ASSERT(Isolate::Current()->api_state()->IsValidPersistentHandle(handle));
+ ASSERT(IsolateGroup::Current()->api_state()->IsValidPersistentHandle(handle));
return reinterpret_cast<PersistentHandle*>(handle);
}
FinalizablePersistentHandle* FinalizablePersistentHandle::Cast(
Dart_WeakPersistentHandle handle) {
#if defined(DEBUG)
- ApiState* state = Isolate::Current()->api_state();
+ ApiState* state = IsolateGroup::Current()->api_state();
ASSERT(state->IsValidWeakPersistentHandle(handle));
#endif
return reinterpret_cast<FinalizablePersistentHandle*>(handle);
}
void FinalizablePersistentHandle::Finalize(
- Isolate* isolate,
+ IsolateGroup* isolate_group,
FinalizablePersistentHandle* handle) {
if (!handle->raw()->IsHeapObject()) {
return; // Free handle.
@@ -697,8 +710,8 @@
ASSERT(callback != NULL);
void* peer = handle->peer();
Dart_WeakPersistentHandle object = handle->apiHandle();
- (*callback)(isolate->init_callback_data(), object, peer);
- ApiState* state = isolate->api_state();
+ (*callback)(isolate_group->embedder_data(), object, peer);
+ ApiState* state = isolate_group->api_state();
ASSERT(state != NULL);
state->FreeWeakPersistentHandle(handle);
}
@@ -894,7 +907,7 @@
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
CHECK_ISOLATE(isolate);
- ApiState* state = isolate->api_state();
+ ApiState* state = isolate->group()->api_state();
ASSERT(state != NULL);
TransitionNativeToVM transition(thread);
NoSafepointScope no_safepoint_scope;
@@ -907,7 +920,7 @@
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
CHECK_ISOLATE(isolate);
- ApiState* state = isolate->api_state();
+ ApiState* state = isolate->group()->api_state();
ASSERT(state != NULL);
TransitionNativeToVM transition(thread);
NoSafepointScope no_safepoint_scope;
@@ -919,7 +932,7 @@
DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object) {
DARTSCOPE(Thread::Current());
Isolate* I = T->isolate();
- ApiState* state = I->api_state();
+ ApiState* state = I->group()->api_state();
ASSERT(state != NULL);
const Object& old_ref = Object::Handle(Z, Api::UnwrapHandle(object));
PersistentHandle* new_ref = state->AllocatePersistentHandle();
@@ -931,7 +944,7 @@
Dart_Handle obj2) {
DARTSCOPE(Thread::Current());
Isolate* I = T->isolate();
- ApiState* state = I->api_state();
+ ApiState* state = I->group()->api_state();
ASSERT(state != NULL);
ASSERT(state->IsValidPersistentHandle(obj1));
const Object& obj2_ref = Object::Handle(Z, Api::UnwrapHandle(obj2));
@@ -986,7 +999,7 @@
Isolate* isolate = Isolate::Current();
CHECK_ISOLATE(isolate);
NoSafepointScope no_safepoint_scope;
- ApiState* state = isolate->api_state();
+ ApiState* state = isolate->group()->api_state();
ASSERT(state != NULL);
PersistentHandle* ref = PersistentHandle::Cast(object);
ASSERT(!state->IsProtectedHandle(ref));
@@ -1002,10 +1015,10 @@
CHECK_ISOLATE(isolate);
NoSafepointScope no_safepoint_scope;
ASSERT(isolate == Isolate::Current());
- ApiState* state = isolate->api_state();
+ ApiState* state = isolate->group()->api_state();
ASSERT(state != NULL);
auto weak_ref = FinalizablePersistentHandle::Cast(object);
- weak_ref->EnsureFreeExternal(isolate);
+ weak_ref->EnsureFreeExternal(isolate->group());
state->FreeWeakPersistentHandle(weak_ref);
}
@@ -1059,6 +1072,17 @@
VM_METRIC_LIST(VM_METRIC_API);
#undef VM_METRIC_API
+#define ISOLATE_GROUP_METRIC_API(type, variable, name, unit) \
+ DART_EXPORT int64_t Dart_Isolate##variable##Metric(Dart_Isolate isolate) { \
+ if (isolate == nullptr) { \
+ FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); \
+ } \
+ Isolate* iso = reinterpret_cast<Isolate*>(isolate); \
+ return iso->group()->Get##variable##Metric()->Value(); \
+ }
+ISOLATE_GROUP_METRIC_LIST(ISOLATE_GROUP_METRIC_API)
+#undef ISOLATE_GROUP_METRIC_API
+
#define ISOLATE_METRIC_API(type, variable, name, unit) \
DART_EXPORT int64_t Dart_Isolate##variable##Metric(Dart_Isolate isolate) { \
if (isolate == NULL) { \
@@ -1067,24 +1091,28 @@
Isolate* iso = reinterpret_cast<Isolate*>(isolate); \
return iso->Get##variable##Metric()->Value(); \
}
-ISOLATE_METRIC_LIST(ISOLATE_METRIC_API);
+ISOLATE_METRIC_LIST(ISOLATE_METRIC_API)
#undef ISOLATE_METRIC_API
+
#else // !defined(PRODUCT)
+
#define VM_METRIC_API(type, variable, name, unit) \
DART_EXPORT int64_t Dart_VM##variable##Metric() { return -1; }
-VM_METRIC_LIST(VM_METRIC_API);
+VM_METRIC_LIST(VM_METRIC_API)
#undef VM_METRIC_API
#define ISOLATE_METRIC_API(type, variable, name, unit) \
DART_EXPORT int64_t Dart_Isolate##variable##Metric(Dart_Isolate isolate) { \
return -1; \
}
-ISOLATE_METRIC_LIST(ISOLATE_METRIC_API);
+ISOLATE_METRIC_LIST(ISOLATE_METRIC_API)
+ISOLATE_GROUP_METRIC_LIST(ISOLATE_METRIC_API)
#endif // !defined(PRODUCT)
// --- Isolates ---
static Dart_Isolate CreateIsolate(IsolateGroup* group,
+ bool is_new_group,
const char* name,
void* isolate_data,
char** error) {
@@ -1128,6 +1156,9 @@
}
if (success) {
+ if (is_new_group) {
+ I->heap()->InitGrowthControl();
+ }
// A Thread structure has been associated to the thread, we do the
// safepoint transition explicitly here instead of using the
// TransitionXXX scope objects as the reverse transition happens
@@ -1144,17 +1175,42 @@
return reinterpret_cast<Dart_Isolate>(NULL);
}
+static bool IsServiceOrKernelIsolateName(const char* name) {
+ if (ServiceIsolate::NameEquals(name)) {
+ ASSERT(!ServiceIsolate::Exists());
+ return true;
+ }
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ if (KernelIsolate::NameEquals(name)) {
+ ASSERT(!KernelIsolate::Exists());
+ return true;
+ }
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+ return false;
+}
+
Isolate* CreateWithinExistingIsolateGroup(IsolateGroup* group,
const char* name,
char** error) {
API_TIMELINE_DURATION(Thread::Current());
CHECK_NO_ISOLATE(Isolate::Current());
+ // During isolate start we'll make a temporary anonymous group from the same
+ // [source]. Once the isolate has been fully loaded we will merge it's heap
+ // into the shared heap.
+ auto spawning_group = new IsolateGroup(group->shareable_source(),
+ /*isolate_group_data=*/nullptr);
+ IsolateGroup::RegisterIsolateGroup(spawning_group);
+ spawning_group->CreateHeap(
+ /*is_vm_isolate=*/false,
+ IsServiceOrKernelIsolateName(group->source()->name));
+
Isolate* isolate = reinterpret_cast<Isolate*>(
- CreateIsolate(group, name, /*isolate_data=*/nullptr, error));
+ CreateIsolate(spawning_group, /*is_new_group=*/false, name,
+ /*isolate_data=*/nullptr, error));
if (isolate == nullptr) return nullptr;
- auto source = group->source();
+ auto source = spawning_group->source();
ASSERT(isolate->source() == source);
if (source->script_kernel_buffer != nullptr) {
@@ -1193,6 +1249,104 @@
#endif // defined(DART_PRECOMPILED_RUNTIME)
}
+ // If we are running in AppJIT training mode we'll have to remap class ids.
+ if (auto permutation_map = group->source()->cid_permutation_map.get()) {
+ Dart_EnterScope();
+ {
+ auto T = Thread::Current();
+ TransitionNativeToVM transition(T);
+ HANDLESCOPE(T);
+
+ // Remap all class ids loaded atm (e.g. from snapshot) and do appropriate
+ // re-hashing of constants and types.
+ ClassFinalizer::RemapClassIds(permutation_map);
+ // Types use cid's as part of their hashes.
+ ClassFinalizer::RehashTypes();
+ // Const objects use cid's as part of their hashes.
+ isolate->RehashConstants();
+ }
+ Dart_ExitScope();
+ }
+
+ auto thread = Thread::Current();
+ {
+ TransitionNativeToVM native_to_vm(thread);
+
+ // Ensure new space is empty and there are no threads running.
+ BackgroundCompiler::Stop(isolate);
+ isolate->heap()->new_space()->Evacuate();
+ isolate->heap()->WaitForMarkerTasks(thread);
+ isolate->heap()->WaitForSweeperTasks(thread);
+ RELEASE_ASSERT(isolate->heap()->new_space()->UsedInWords() == 0);
+ RELEASE_ASSERT(isolate->heap()->old_space()->tasks() == 0);
+ }
+
+ Dart_ExitIsolate();
+ {
+ const bool kBypassSafepoint = false;
+ Thread::EnterIsolateGroupAsHelper(group, Thread::kUnknownTask,
+ kBypassSafepoint);
+ ASSERT(group == IsolateGroup::Current());
+
+ {
+ auto thread = Thread::Current();
+
+ // Prevent additions of new isolates to [group] until we're done.
+ group->RunWithLockedGroup([&]() {
+ // Ensure no other old space GC tasks are running and "occupy" the old
+ // space.
+ {
+ auto old_space = group->heap()->old_space();
+ MonitorLocker ml(old_space->tasks_lock());
+ while (old_space->tasks() > 0) {
+ ml.WaitWithSafepointCheck(thread);
+ }
+ old_space->set_tasks(1);
+ }
+
+ // Merge the heap from [spawning_group] to [group].
+ {
+ SafepointOperationScope safepoint_scope(thread);
+ group->heap()->MergeOtherHeap(isolate->group()->heap());
+ }
+
+ spawning_group->UnregisterIsolate(isolate);
+ const bool shutdown_group =
+ spawning_group->UnregisterIsolateDecrementCount(isolate);
+ ASSERT(shutdown_group);
+
+ isolate->isolate_group_ = group;
+ group->RegisterIsolateLocked(isolate);
+ isolate->class_table()->shared_class_table_ = group->class_table();
+
+ // Even though the mutator thread was descheduled, it will still
+ // retain its [Thread] structure with valid isolate/isolate_group
+ // pointers.
+ // If GC happens before the mutator gets scheduled again, we have to
+ // ensure the isolate group change is reflected in the threads
+ // structure.
+ ASSERT(isolate->mutator_thread() != nullptr);
+ ASSERT(isolate->mutator_thread()->isolate_group() == spawning_group);
+ isolate->mutator_thread()->isolate_group_ = group;
+
+ // Allow other old space GC tasks to run again.
+ {
+ auto old_space = group->heap()->old_space();
+ MonitorLocker ml(old_space->tasks_lock());
+ ASSERT(old_space->tasks() == 1);
+ old_space->set_tasks(0);
+ ml.NotifyAll();
+ }
+
+ spawning_group->Shutdown();
+ });
+ }
+
+ Thread::ExitIsolateGroupAsHelper(kBypassSafepoint);
+ }
+ Dart_EnterIsolate(Api::CastIsolate(isolate));
+ ASSERT(Thread::Current()->isolate_group() == isolate->group());
+
return isolate;
}
@@ -1222,9 +1376,11 @@
new IsolateGroupSource(script_uri, non_null_name, snapshot_data,
snapshot_instructions, nullptr, -1, *flags));
auto group = new IsolateGroup(std::move(source), isolate_group_data);
+ group->CreateHeap(
+ /*is_vm_isolate=*/false, IsServiceOrKernelIsolateName(non_null_name));
IsolateGroup::RegisterIsolateGroup(group);
- Dart_Isolate isolate =
- CreateIsolate(group, non_null_name, isolate_data, error);
+ Dart_Isolate isolate = CreateIsolate(group, /*is_new_group=*/true,
+ non_null_name, isolate_data, error);
if (isolate != nullptr) {
group->set_initial_spawn_successful();
}
@@ -1249,13 +1405,15 @@
}
const char* non_null_name = name == nullptr ? "isolate" : name;
- std::unique_ptr<IsolateGroupSource> source(
+ std::shared_ptr<IsolateGroupSource> source(
new IsolateGroupSource(script_uri, non_null_name, nullptr, nullptr,
kernel_buffer, kernel_buffer_size, *flags));
- auto group = new IsolateGroup(std::move(source), isolate_group_data);
+ auto group = new IsolateGroup(source, isolate_group_data);
IsolateGroup::RegisterIsolateGroup(group);
- Dart_Isolate isolate =
- CreateIsolate(group, non_null_name, isolate_data, error);
+ group->CreateHeap(
+ /*is_vm_isolate=*/false, IsServiceOrKernelIsolateName(non_null_name));
+ Dart_Isolate isolate = CreateIsolate(group, /*is_new_group=*/true,
+ non_null_name, isolate_data, error);
if (isolate != nullptr) {
group->set_initial_spawn_successful();
}
@@ -1593,7 +1751,7 @@
CHECK_ISOLATE(T->isolate());
API_TIMELINE_BEGIN_END(T);
TransitionNativeToVM transition(T);
- T->isolate()->idle_time_handler()->NotifyIdle(deadline);
+ T->isolate()->group()->idle_time_handler()->NotifyIdle(deadline);
}
DART_EXPORT void Dart_NotifyLowMemory() {
@@ -2212,16 +2370,21 @@
DART_EXPORT bool Dart_IsFuture(Dart_Handle handle) {
DARTSCOPE(Thread::Current());
API_TIMELINE_DURATION(T);
- Isolate* I = T->isolate();
const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
if (obj.IsInstance()) {
- const Class& future_class =
- Class::Handle(I->object_store()->future_class());
- ASSERT(!future_class.IsNull());
+ ObjectStore* object_store = T->isolate()->object_store();
+ Type& future_rare_type =
+ Type::Handle(Z, object_store->non_nullable_future_rare_type());
+ if (future_rare_type.IsNull()) {
+ const Class& future_class = Class::Handle(object_store->future_class());
+ ASSERT(!future_class.IsNull());
+ future_rare_type ^= future_class.RareType();
+ object_store->set_non_nullable_future_rare_type(future_rare_type);
+ }
const Class& obj_class = Class::Handle(Z, obj.clazz());
- bool is_future = Class::IsSubtypeOf(
- NNBDMode::kLegacyLib, obj_class, Object::null_type_arguments(),
- future_class, Object::null_type_arguments(), Heap::kNew);
+ bool is_future = Class::IsSubtypeOf(NNBDMode::kLegacyLib, obj_class,
+ Object::null_type_arguments(),
+ future_rare_type, Heap::kNew);
return is_future;
}
return false;
@@ -3933,7 +4096,7 @@
ASSERT(I->heap()->Contains(reinterpret_cast<uword>(data_tmp)));
}
const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
- WeakTable* table = I->api_state()->acquired_table();
+ WeakTable* table = I->group()->api_state()->acquired_table();
intptr_t current = table->GetValue(obj.raw());
if (current != 0) {
return Api::NewError("Data was already acquired for this object.");
@@ -3963,7 +4126,7 @@
END_NO_CALLBACK_SCOPE(T);
if (FLAG_verify_acquired_data) {
const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
- WeakTable* table = I->api_state()->acquired_table();
+ WeakTable* table = I->group()->api_state()->acquired_table();
intptr_t current = table->GetValue(obj.raw());
if (current == 0) {
return Api::NewError("Data was not acquired for this object.");
@@ -5043,8 +5206,8 @@
#if defined(DEBUG)
Isolate* isolate = arguments->thread()->isolate();
ASSERT(isolate == Isolate::Current());
- ASSERT(isolate->api_state() != NULL &&
- (isolate->api_state()->IsValidWeakPersistentHandle(rval)));
+ ASSERT(isolate->group()->api_state() != NULL &&
+ (isolate->group()->api_state()->IsValidWeakPersistentHandle(rval)));
#endif
Api::SetWeakHandleReturnValue(arguments, rval);
}
@@ -5230,7 +5393,6 @@
CURRENT_FUNC, library_url.ToCString());
}
CHECK_CALLBACK_STATE(T);
- CHECK_COMPILATION_ALLOWED(I);
// NOTE: We do not attach a finalizer for this object, because the embedder
// will free it once the isolate group has shutdown.
@@ -5544,10 +5706,8 @@
DARTSCOPE(Thread::Current());
API_TIMELINE_DURATION(T);
StackZone zone(T);
- Isolate* I = T->isolate();
CHECK_CALLBACK_STATE(T);
- CHECK_COMPILATION_ALLOWED(I);
// NOTE: We do not attach a finalizer for this object, because the embedder
// will/should free it once the isolate group has shutdown.
@@ -5628,7 +5788,13 @@
I->debugger()->NotifyDoneLoading();
#endif
- I->heap()->old_space()->EvaluateAfterLoading();
+ // After having loaded all the code, we can let the GC set reaonsable limits
+ // for the heap growth.
+ // If this is an auxiliary isolate inside a larger isolate group, we will not
+ // re-initialize the growth policy.
+ if (I->group()->ContainsOnlyOneIsolate()) {
+ I->heap()->old_space()->EvaluateAfterLoading();
+ }
#if !defined(DART_PRECOMPILED_RUNTIME)
if (FLAG_enable_mirrors) {
@@ -6233,12 +6399,6 @@
#else
DARTSCOPE(Thread::Current());
API_TIMELINE_DURATION(T);
- Isolate* I = T->isolate();
- if (I->compilation_allowed()) {
- return Api::NewError(
- "Isolate is not precompiled. "
- "Did you forget to call Dart_Precompile?");
- }
CHECK_NULL(callback);
TIMELINE_DURATION(T, Isolate, "WriteAppAOTSnapshot");
@@ -6467,6 +6627,28 @@
#endif
}
+#if !defined(TARGET_ARCH_IA32) && !defined(DART_PRECOMPILED_RUNTIME)
+static void KillNonMainIsolatesSlow(Thread* thread, Isolate* main_isolate) {
+ auto group = main_isolate->group();
+ while (true) {
+ bool non_main_isolates_alive = false;
+ {
+ SafepointOperationScope safepoint(thread);
+ group->ForEachIsolate([&](Isolate* isolate) {
+ if (isolate != main_isolate) {
+ Isolate::KillIfExists(isolate, Isolate::kKillMsg);
+ non_main_isolates_alive = true;
+ }
+ });
+ if (!non_main_isolates_alive) {
+ break;
+ }
+ }
+ OS::SleepMicros(10 * 1000);
+ }
+}
+#endif // !defined(TARGET_ARCH_IA32) && !defined(DART_PRECOMPILED_RUNTIME)
+
DART_EXPORT Dart_Handle
Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
intptr_t* isolate_snapshot_data_size,
@@ -6484,11 +6666,16 @@
CHECK_NULL(isolate_snapshot_data_size);
CHECK_NULL(isolate_snapshot_instructions_buffer);
CHECK_NULL(isolate_snapshot_instructions_size);
+
// Finalize all classes if needed.
Dart_Handle state = Api::CheckAndFinalizePendingClasses(T);
if (Api::IsError(state)) {
return state;
}
+
+ // Kill off any auxiliary isolates before starting with deduping.
+ KillNonMainIsolatesSlow(T, I);
+
BackgroundCompiler::Stop(I);
DropRegExpMatchCode(Z);
diff --git a/runtime/vm/dart_api_impl.h b/runtime/vm/dart_api_impl.h
index 93a2443..b9221a3 100644
--- a/runtime/vm/dart_api_impl.h
+++ b/runtime/vm/dart_api_impl.h
@@ -177,7 +177,7 @@
static Dart_Handle Success() { return Api::True(); }
// Gets the handle which holds the pre-created acquired error object.
- static Dart_Handle AcquiredError(Isolate* isolate);
+ static Dart_Handle AcquiredError(IsolateGroup* isolate_group);
// Returns true if the handle holds a Smi.
static bool IsSmi(Dart_Handle handle) {
@@ -325,13 +325,7 @@
#define CHECK_CALLBACK_STATE(thread) \
if (thread->no_callback_scope_depth() != 0) { \
return reinterpret_cast<Dart_Handle>( \
- Api::AcquiredError(thread->isolate())); \
- }
-
-#define CHECK_COMPILATION_ALLOWED(isolate) \
- if (!isolate->compilation_allowed()) { \
- return Api::NewError("%s: Cannot load after Dart_Precompile", \
- CURRENT_FUNC); \
+ Api::AcquiredError(thread->isolate_group())); \
}
#define ASSERT_CALLBACK_STATE(thread) \
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 6fe05e3..60ce652 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -2933,7 +2933,7 @@
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
EXPECT(isolate != NULL);
- ApiState* state = isolate->api_state();
+ ApiState* state = isolate->group()->api_state();
EXPECT(state != NULL);
ApiLocalScope* scope = thread->api_top_scope();
@@ -3001,7 +3001,7 @@
Isolate* isolate = Isolate::Current();
EXPECT(isolate != NULL);
- ApiState* state = isolate->api_state();
+ ApiState* state = isolate->group()->api_state();
EXPECT(state != NULL);
Thread* thread = Thread::Current();
CHECK_API_SCOPE(thread);
@@ -3034,7 +3034,7 @@
CHECK_API_SCOPE(T);
Isolate* isolate = T->isolate();
EXPECT(isolate != NULL);
- ApiState* state = isolate->api_state();
+ ApiState* state = isolate->group()->api_state();
EXPECT(state != NULL);
// Start with a known persistent handle.
@@ -6086,7 +6086,7 @@
EXPECT_VALID(name);
const char* name_cstr = "";
EXPECT_VALID(Dart_StringToCString(name, &name_cstr));
- EXPECT_STREQ("Class", name_cstr);
+ EXPECT_STREQ("Class?", name_cstr);
name = Dart_GetField(type, NewString("name"));
EXPECT_VALID(name);
diff --git a/runtime/vm/dart_api_state.h b/runtime/vm/dart_api_state.h
index 77e0f3c..3e48e72 100644
--- a/runtime/vm/dart_api_state.h
+++ b/runtime/vm/dart_api_state.h
@@ -211,35 +211,35 @@
return ExternalSizeInWordsBits::decode(external_data_) * kWordSize;
}
- void SetExternalSize(intptr_t size, Isolate* isolate) {
+ void SetExternalSize(intptr_t size, IsolateGroup* isolate_group) {
ASSERT(size >= 0);
set_external_size(size);
if (SpaceForExternal() == Heap::kNew) {
SetExternalNewSpaceBit();
}
- isolate->heap()->AllocateExternal(raw()->GetClassIdMayBeSmi(),
- external_size(), SpaceForExternal());
+ isolate_group->heap()->AllocateExternal(
+ raw()->GetClassIdMayBeSmi(), external_size(), SpaceForExternal());
}
// Called when the referent becomes unreachable.
- void UpdateUnreachable(Isolate* isolate) {
- EnsureFreeExternal(isolate);
- Finalize(isolate, this);
+ void UpdateUnreachable(IsolateGroup* isolate_group) {
+ EnsureFreeExternal(isolate_group);
+ Finalize(isolate_group, this);
}
// Called when the referent has moved, potentially between generations.
- void UpdateRelocated(Isolate* isolate) {
+ void UpdateRelocated(IsolateGroup* isolate_group) {
if (IsSetNewSpaceBit() && (SpaceForExternal() == Heap::kOld)) {
- isolate->heap()->PromoteExternal(raw()->GetClassIdMayBeSmi(),
- external_size());
+ isolate_group->heap()->PromoteExternal(raw()->GetClassIdMayBeSmi(),
+ external_size());
ClearExternalNewSpaceBit();
}
}
// Idempotent. Called when the handle is explicitly deleted or the
// referent becomes unreachable.
- void EnsureFreeExternal(Isolate* isolate) {
- isolate->heap()->FreeExternal(external_size(), SpaceForExternal());
+ void EnsureFreeExternal(IsolateGroup* isolate_group) {
+ isolate_group->heap()->FreeExternal(external_size(), SpaceForExternal());
set_external_size(0);
}
@@ -268,7 +268,8 @@
: raw_(NULL), peer_(NULL), external_data_(0), callback_(NULL) {}
~FinalizablePersistentHandle() {}
- static void Finalize(Isolate* isolate, FinalizablePersistentHandle* handle);
+ static void Finalize(IsolateGroup* isolate_group,
+ FinalizablePersistentHandle* handle);
// Overload the raw_ field as a next pointer when adding freed
// handles to the free list.
@@ -677,7 +678,7 @@
// Implementation of the API State used in dart api for maintaining
// local scopes, persistent handles etc. These are setup on a per isolate
-// basis and destroyed when the isolate is shutdown.
+// group basis and destroyed when the isolate group is shutdown.
class ApiState {
public:
ApiState()
@@ -706,6 +707,8 @@
}
}
+ void MergeOtherApiState(ApiState* api_state);
+
void VisitObjectPointersUnlocked(ObjectPointerVisitor* visitor) {
persistent_handles_.VisitObjectPointers(visitor);
if (visitor->visit_weak_persistent_handles()) {
@@ -817,14 +820,14 @@
void* peer,
Dart_WeakPersistentHandleFinalizer callback,
intptr_t external_size) {
- ApiState* state = isolate->api_state();
+ ApiState* state = isolate->group()->api_state();
ASSERT(state != NULL);
FinalizablePersistentHandle* ref = state->AllocateWeakPersistentHandle();
ref->set_raw(object);
ref->set_peer(peer);
ref->set_callback(callback);
// This may trigger GC, so it must be called last.
- ref->SetExternalSize(external_size, isolate);
+ ref->SetExternalSize(external_size, isolate->group());
return ref;
}
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index 75f0f40..2550363 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -1542,7 +1542,7 @@
mapping_offset -= size;
for (intptr_t j = 0; j < size; ++j) {
type_param = TypeParameter::RawCast(type_params.TypeAt(j));
- name = type_param.Name();
+ name = type_param.name();
// Write the names in backwards in terms of chain of functions.
// But keep the order of names within the same function. so they
// match up with the order of the types in 'type_arguments'.
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index b103daa..1708052 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -499,6 +499,14 @@
if (FLAG_trace_deoptimization) {
THR_Print("Throwing to frame scheduled for lazy deopt fp=%" Pp "\n",
frame_pointer);
+
+#if defined(DEBUG)
+ // Ensure the frame references optimized code.
+ RawObject* pc_marker = *(reinterpret_cast<RawObject**>(
+ frame_pointer + runtime_frame_layout.code_from_fp * kWordSize));
+ Code& code = Code::Handle(Code::RawCast(pc_marker));
+ ASSERT(code.is_optimized() && !code.is_force_optimized());
+#endif
}
break;
}
@@ -542,7 +550,7 @@
"fp=%" Pp ", pc=%" Pp "\n",
(*pending_deopts)[i].fp(), (*pending_deopts)[i].pc());
}
- pending_deopts->RemoveAt(i);
+ pending_deopts->RemoveAt(i--);
}
}
diff --git a/runtime/vm/flag_list.h b/runtime/vm/flag_list.h
index 87d1f0a..6f09151 100644
--- a/runtime/vm/flag_list.h
+++ b/runtime/vm/flag_list.h
@@ -189,8 +189,8 @@
P(reorder_basic_blocks, bool, true, "Reorder basic blocks") \
C(stress_async_stacks, false, false, bool, false, \
"Stress test async stack traces") \
- P(strong_non_nullable_type_checks, bool, false, \
- "Enable strong non-nullable type checking mode.") \
+ P(null_safety, bool, false, \
+ "Respect the nullability of types in casts and instance checks.") \
P(use_table_dispatch, bool, true, "Enable dispatch table based calls.") \
P(enable_isolate_groups, bool, false, "Enable isolate group support.") \
P(show_invisible_frames, bool, false, \
@@ -237,6 +237,8 @@
"Enables heap verification after GC.") \
R(verify_before_gc, false, bool, false, \
"Enables heap verification before GC.") \
+ R(verify_store_buffer, false, bool, false, \
+ "Enables store buffer verification before and after scavenges.") \
P(enable_slow_path_sharing, bool, true, "Enable sharing of slow-path code.") \
P(shared_slow_path_triggers_gc, bool, false, \
"TESTING: slow-path triggers a GC.") \
diff --git a/runtime/vm/gdb_helpers.cc b/runtime/vm/gdb_helpers.cc
index 6cb98f0..1260263 100644
--- a/runtime/vm/gdb_helpers.cc
+++ b/runtime/vm/gdb_helpers.cc
@@ -75,7 +75,8 @@
class PrintObjectPointersVisitor : public ObjectPointerVisitor {
public:
- PrintObjectPointersVisitor() : ObjectPointerVisitor(Isolate::Current()) {}
+ PrintObjectPointersVisitor()
+ : ObjectPointerVisitor(IsolateGroup::Current()) {}
void VisitPointers(RawObject** first, RawObject** last) {
for (RawObject** p = first; p <= last; p++) {
diff --git a/runtime/vm/hash_map.h b/runtime/vm/hash_map.h
index a488807..69758a2 100644
--- a/runtime/vm/hash_map.h
+++ b/runtime/vm/hash_map.h
@@ -478,6 +478,7 @@
Pair() : key(NULL), value() {}
Pair(const Key key, const Value& value) : key(key), value(value) {}
Pair(const Pair& other) : key(other.key), value(other.value) {}
+ Pair& operator=(const Pair&) = default;
};
static Key KeyOf(Pair kv) { return kv.key; }
@@ -530,6 +531,7 @@
Pair() : key(NULL), value() {}
Pair(const Key key, const Value& value) : key(key), value(value) {}
Pair(const Pair& other) : key(other.key), value(other.value) {}
+ Pair& operator=(const Pair&) = default;
};
static Key KeyOf(Pair kv) { return kv.key; }
diff --git a/runtime/vm/hash_table.h b/runtime/vm/hash_table.h
index cd05fde..a59fd9a 100644
--- a/runtime/vm/hash_table.h
+++ b/runtime/vm/hash_table.h
@@ -62,7 +62,7 @@
// Each entry contains a key, followed by zero or more payload components,
// and has 3 possible states: unused, occupied, or deleted.
// The header tracks the number of entries in each state.
-// Any object except Object::sentinel() and Object::transition_sentinel()
+// Any object except the backing storage array and Object::transition_sentinel()
// may be stored as a key. Any object may be stored in a payload.
//
// Parameters
@@ -138,7 +138,7 @@
#endif // !defined(PRODUCT)
for (intptr_t i = kHeaderSize; i < data_->Length(); ++i) {
- data_->SetAt(i, Object::sentinel());
+ data_->SetAt(i, UnusedMarker());
}
}
@@ -225,6 +225,8 @@
// Sets the key of a previously unoccupied entry. This must not be the last
// unoccupied entry.
void InsertKey(intptr_t entry, const Object& key) const {
+ ASSERT(key.raw() != UnusedMarker().raw());
+ ASSERT(key.raw() != DeletedMarker().raw());
ASSERT(!IsOccupied(entry));
AdjustSmiValueAt(kOccupiedEntriesIndex, 1);
if (IsDeleted(entry)) {
@@ -237,14 +239,17 @@
ASSERT(NumOccupied() < NumEntries());
}
+ const Object& UnusedMarker() const { return Object::transition_sentinel(); }
+ const Object& DeletedMarker() const { return *data_; }
+
bool IsUnused(intptr_t entry) const {
- return InternalGetKey(entry) == Object::sentinel().raw();
+ return InternalGetKey(entry) == UnusedMarker().raw();
}
bool IsOccupied(intptr_t entry) const {
return !IsUnused(entry) && !IsDeleted(entry);
}
bool IsDeleted(intptr_t entry) const {
- return InternalGetKey(entry) == Object::transition_sentinel().raw();
+ return InternalGetKey(entry) == DeletedMarker().raw();
}
RawObject* GetKey(intptr_t entry) const {
@@ -266,9 +271,9 @@
void DeleteEntry(intptr_t entry) const {
ASSERT(IsOccupied(entry));
for (intptr_t i = 0; i < kPayloadSize; ++i) {
- UpdatePayload(entry, i, Object::transition_sentinel());
+ UpdatePayload(entry, i, DeletedMarker());
}
- InternalSetKey(entry, Object::transition_sentinel());
+ InternalSetKey(entry, DeletedMarker());
AdjustSmiValueAt(kOccupiedEntriesIndex, -1);
AdjustSmiValueAt(kDeletedEntriesIndex, 1);
}
@@ -720,8 +725,8 @@
Object& entry = Object::Handle();
for (intptr_t i = 0; i < this->data_->Length(); i++) {
entry = this->data_->At(i);
- if (entry.raw() == Object::sentinel().raw() ||
- entry.raw() == Object::transition_sentinel().raw() || entry.IsSmi()) {
+ if (entry.raw() == BaseSet::UnusedMarker().raw() ||
+ entry.raw() == BaseSet::DeletedMarker().raw() || entry.IsSmi()) {
// empty, deleted, num_used/num_deleted
OS::PrintErr("%" Pd ": %s\n", i, entry.ToCString());
} else {
diff --git a/runtime/vm/heap/become.cc b/runtime/vm/heap/become.cc
index 936cbc5..5f5ffba 100644
--- a/runtime/vm/heap/become.cc
+++ b/runtime/vm/heap/become.cc
@@ -79,7 +79,7 @@
class ForwardPointersVisitor : public ObjectPointerVisitor {
public:
explicit ForwardPointersVisitor(Thread* thread)
- : ObjectPointerVisitor(thread->isolate()),
+ : ObjectPointerVisitor(thread->isolate_group()),
thread_(thread),
visiting_object_(NULL) {}
@@ -217,8 +217,7 @@
void Become::ElementsForwardIdentity(const Array& before, const Array& after) {
Thread* thread = Thread::Current();
- Isolate* isolate = thread->isolate();
- Heap* heap = isolate->heap();
+ auto heap = thread->isolate_group()->heap();
TIMELINE_FUNCTION_GC_DURATION(thread, "Become::ElementsForwardIdentity");
HeapIterationScope his(thread);
@@ -273,12 +272,12 @@
void Become::FollowForwardingPointers(Thread* thread) {
// N.B.: We forward the heap before forwarding the stack. This limits the
// amount of following of forwarding pointers needed to get at stack maps.
- Isolate* isolate = thread->isolate();
- Heap* heap = isolate->heap();
+ auto isolate_group = thread->isolate_group();
+ Heap* heap = isolate_group->heap();
// Clear the store buffer; will be rebuilt as we forward the heap.
- isolate->ReleaseStoreBuffers();
- isolate->store_buffer()->Reset();
+ isolate_group->ReleaseStoreBuffers();
+ isolate_group->store_buffer()->Reset();
ForwardPointersVisitor pointer_visitor(thread);
@@ -291,17 +290,21 @@
}
// C++ pointers.
- isolate->VisitObjectPointers(&pointer_visitor,
- ValidationPolicy::kValidateFrames);
+ isolate_group->VisitObjectPointers(&pointer_visitor,
+ ValidationPolicy::kValidateFrames);
#ifndef PRODUCT
- ObjectIdRing* ring = isolate->object_id_ring();
- ASSERT(ring != NULL);
- ring->VisitPointers(&pointer_visitor);
+ isolate_group->ForEachIsolate(
+ [&](Isolate* isolate) {
+ ObjectIdRing* ring = isolate->object_id_ring();
+ ASSERT(ring != NULL);
+ ring->VisitPointers(&pointer_visitor);
+ },
+ /*at_safepoint=*/true);
#endif // !PRODUCT
// Weak persistent handles.
ForwardHeapPointersHandleVisitor handle_visitor(thread);
- isolate->VisitWeakPersistentHandles(&handle_visitor);
+ isolate_group->VisitWeakPersistentHandles(&handle_visitor);
}
} // namespace dart
diff --git a/runtime/vm/heap/compactor.cc b/runtime/vm/heap/compactor.cc
index 06b9529..90555f5 100644
--- a/runtime/vm/heap/compactor.cc
+++ b/runtime/vm/heap/compactor.cc
@@ -119,14 +119,14 @@
class CompactorTask : public ThreadPool::Task {
public:
- CompactorTask(Isolate* isolate,
+ CompactorTask(IsolateGroup* isolate_group,
GCCompactor* compactor,
ThreadBarrier* barrier,
RelaxedAtomic<intptr_t>* next_forwarding_task,
HeapPage* head,
HeapPage** tail,
FreeList* freelist)
- : isolate_(isolate),
+ : isolate_group_(isolate_group),
compactor_(compactor),
barrier_(barrier),
next_forwarding_task_(next_forwarding_task),
@@ -137,15 +137,17 @@
free_current_(0),
free_end_(0) {}
- private:
void Run();
+ void RunEnteredIsolateGroup();
+
+ private:
void PlanPage(HeapPage* page);
void SlidePage(HeapPage* page);
uword PlanBlock(uword first_object, ForwardingPage* forwarding_page);
uword SlideBlock(uword first_object, ForwardingPage* forwarding_page);
void PlanMoveToContiguousSize(intptr_t size);
- Isolate* isolate_;
+ IsolateGroup* isolate_group_;
GCCompactor* compactor_;
ThreadBarrier* barrier_;
RelaxedAtomic<intptr_t>* next_forwarding_task_;
@@ -237,21 +239,24 @@
}
{
- ThreadBarrier barrier(num_tasks + 1, heap_->barrier(),
- heap_->barrier_done());
+ ThreadBarrier barrier(num_tasks, heap_->barrier(), heap_->barrier_done());
RelaxedAtomic<intptr_t> next_forwarding_task = {0};
for (intptr_t task_index = 0; task_index < num_tasks; task_index++) {
- Dart::thread_pool()->Run<CompactorTask>(
- thread()->isolate(), this, &barrier, &next_forwarding_task,
- heads[task_index], &tails[task_index], freelist);
+ if (task_index < (num_tasks - 1)) {
+ // Begin compacting on a helper thread.
+ Dart::thread_pool()->Run<CompactorTask>(
+ thread()->isolate_group(), this, &barrier, &next_forwarding_task,
+ heads[task_index], &tails[task_index], freelist);
+ } else {
+ // Last worker is the main thread.
+ CompactorTask task(thread()->isolate_group(), this, &barrier,
+ &next_forwarding_task, heads[task_index],
+ &tails[task_index], freelist);
+ task.RunEnteredIsolateGroup();
+ barrier.Exit();
+ }
}
-
- // Plan pages.
- barrier.Sync();
- // Slides pages. Forward large pages, new space, etc.
- barrier.Sync();
- barrier.Exit();
}
// Update inner pointers in typed data views (needs to be done after all
@@ -321,8 +326,19 @@
void CompactorTask::Run() {
bool result =
- Thread::EnterIsolateAsHelper(isolate_, Thread::kCompactorTask, true);
+ Thread::EnterIsolateGroupAsHelper(isolate_group_, Thread::kCompactorTask,
+ /*bypass_safepoint=*/true);
ASSERT(result);
+
+ RunEnteredIsolateGroup();
+
+ Thread::ExitIsolateGroupAsHelper(/*bypass_safepoint=*/true);
+
+ // This task is done. Notify the original thread.
+ barrier_->Exit();
+}
+
+void CompactorTask::RunEnteredIsolateGroup() {
#ifdef SUPPORT_TIMELINE
Thread* thread = Thread::Current();
#endif
@@ -371,7 +387,7 @@
case 0: {
TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardLargePages");
for (HeapPage* large_page =
- isolate_->heap()->old_space()->large_pages_;
+ isolate_group_->heap()->old_space()->large_pages_;
large_page != NULL; large_page = large_page->next()) {
large_page->VisitObjectPointers(compactor_);
}
@@ -379,28 +395,32 @@
}
case 1: {
TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardNewSpace");
- isolate_->heap()->new_space()->VisitObjectPointers(compactor_);
+ isolate_group_->heap()->new_space()->VisitObjectPointers(compactor_);
break;
}
case 2: {
TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardRememberedSet");
- isolate_->store_buffer()->VisitObjectPointers(compactor_);
+ isolate_group_->store_buffer()->VisitObjectPointers(compactor_);
break;
}
case 3: {
TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardWeakTables");
- isolate_->heap()->ForwardWeakTables(compactor_);
+ isolate_group_->heap()->ForwardWeakTables(compactor_);
break;
}
case 4: {
TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardWeakHandles");
- isolate_->VisitWeakPersistentHandles(compactor_);
+ isolate_group_->VisitWeakPersistentHandles(compactor_);
break;
}
#ifndef PRODUCT
case 5: {
TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardObjectIdRing");
- isolate_->object_id_ring()->VisitPointers(compactor_);
+ isolate_group_->ForEachIsolate(
+ [&](Isolate* isolate) {
+ isolate->object_id_ring()->VisitPointers(compactor_);
+ },
+ /*at_safepoint=*/true);
break;
}
#endif // !PRODUCT
@@ -411,10 +431,6 @@
barrier_->Sync();
}
- Thread::ExitIsolateAsHelper(true);
-
- // This task is done. Notify the original thread.
- barrier_->Exit();
}
void CompactorTask::PlanPage(HeapPage* page) {
@@ -653,7 +669,8 @@
// N.B.: Heap pointers have already been forwarded. We forward the heap before
// forwarding the stack to limit the number of places that need to be aware of
// forwarding when reading stack maps.
- isolate()->VisitObjectPointers(this, ValidationPolicy::kDontValidateFrames);
+ isolate_group()->VisitObjectPointers(this,
+ ValidationPolicy::kDontValidateFrames);
}
} // namespace dart
diff --git a/runtime/vm/heap/compactor.h b/runtime/vm/heap/compactor.h
index 6bc036c..cd6b29c 100644
--- a/runtime/vm/heap/compactor.h
+++ b/runtime/vm/heap/compactor.h
@@ -27,7 +27,7 @@
public:
GCCompactor(Thread* thread, Heap* heap)
: HandleVisitor(thread),
- ObjectPointerVisitor(thread->isolate()),
+ ObjectPointerVisitor(thread->isolate_group()),
heap_(heap) {}
~GCCompactor() {}
diff --git a/runtime/vm/heap/freelist.cc b/runtime/vm/heap/freelist.cc
index e77f199..d08ec12 100644
--- a/runtime/vm/heap/freelist.cc
+++ b/runtime/vm/heap/freelist.cc
@@ -378,4 +378,41 @@
return NULL;
}
+void FreeList::MergeOtherFreelist(FreeList* other, bool is_protected) {
+ // The [other] free list is from a dying isolate. There are no other threads
+ // accessing it, so there is no need to lock here.
+ MutexLocker ml(&mutex_);
+ for (intptr_t i = 0; i < (kNumLists + 1); ++i) {
+ FreeListElement* other_head = other->free_lists_[i];
+ if (other_head != nullptr) {
+ // If we didn't have a freelist element before we have to set the bit now,
+ // since we will get 1+ elements from [other].
+ FreeListElement* old_head = free_lists_[i];
+ if (old_head == nullptr && i != kNumLists) {
+ free_map_.Set(i, true);
+ }
+
+ // Chain other's list in.
+ FreeListElement* last = other_head;
+ while (last->next() != nullptr) {
+ last = last->next();
+ }
+
+ if (is_protected) {
+ VirtualMemory::Protect(reinterpret_cast<void*>(last), sizeof(*last),
+ VirtualMemory::kReadWrite);
+ }
+ last->set_next(old_head);
+ if (is_protected) {
+ VirtualMemory::Protect(reinterpret_cast<void*>(last), sizeof(*last),
+ VirtualMemory::kReadExecute);
+ }
+ free_lists_[i] = other_head;
+ }
+ }
+
+ last_free_small_size_ =
+ Utils::Maximum(last_free_small_size_, other->last_free_small_size_);
+}
+
} // namespace dart
diff --git a/runtime/vm/heap/freelist.h b/runtime/vm/heap/freelist.h
index 09ad006..7c885cf 100644
--- a/runtime/vm/heap/freelist.h
+++ b/runtime/vm/heap/freelist.h
@@ -117,6 +117,8 @@
return 0;
}
+ void MergeOtherFreelist(FreeList* freelist, bool is_protected);
+
private:
static const int kNumLists = 128;
static const intptr_t kInitialFreeListSearchBudget = 1000;
diff --git a/runtime/vm/heap/heap.cc b/runtime/vm/heap/heap.cc
index 03be436..2bd5b41 100644
--- a/runtime/vm/heap/heap.cc
+++ b/runtime/vm/heap/heap.cc
@@ -2,13 +2,15 @@
// 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 <memory>
+#include <utility>
+
#include "vm/heap/heap.h"
#include "platform/assert.h"
#include "platform/utils.h"
#include "vm/compiler/jit/compiler.h"
#include "vm/flags.h"
-#include "vm/heap/become.h"
#include "vm/heap/pages.h"
#include "vm/heap/safepoint.h"
#include "vm/heap/scavenger.h"
@@ -33,10 +35,27 @@
DEFINE_FLAG(bool, write_protect_vm_isolate, true, "Write protect vm_isolate.");
-Heap::Heap(Isolate* isolate,
+// We ensure that the GC does not use the current isolate.
+class NoActiveIsolateScope {
+ public:
+ NoActiveIsolateScope() : thread_(Thread::Current()) {
+ saved_isolate_ = thread_->isolate_;
+ thread_->isolate_ = nullptr;
+ }
+ ~NoActiveIsolateScope() {
+ ASSERT(thread_->isolate_ == nullptr);
+ thread_->isolate_ = saved_isolate_;
+ }
+
+ private:
+ Thread* thread_;
+ Isolate* saved_isolate_;
+};
+
+Heap::Heap(IsolateGroup* isolate_group,
intptr_t max_new_gen_semi_words,
intptr_t max_old_gen_words)
- : isolate_(isolate),
+ : isolate_group_(isolate_group),
new_space_(this, max_new_gen_semi_words),
old_space_(this, max_old_gen_words),
barrier_(),
@@ -60,69 +79,27 @@
}
}
-void Heap::MakeTLABIterable(Thread* thread) {
- uword start = thread->top();
- uword end = thread->end();
- ASSERT(end >= start);
- intptr_t size = end - start;
- ASSERT(Utils::IsAligned(size, kObjectAlignment));
- if (size >= kObjectAlignment) {
- // ForwardingCorpse(forwarding to default null) will work as filler.
- ForwardingCorpse::AsForwarder(start, size);
- ASSERT(RawObject::FromAddr(start)->HeapSize() == size);
- }
-}
-
-void Heap::AbandonRemainingTLAB(Thread* thread) {
- MakeTLABIterable(thread);
- new_space_.AddAbandonedInBytes(thread->end() - thread->top());
- thread->set_top(0);
- thread->set_end(0);
-}
-
uword Heap::AllocateNew(intptr_t size) {
ASSERT(Thread::Current()->no_safepoint_scope_depth() == 0);
CollectForDebugging();
Thread* thread = Thread::Current();
- uword addr = new_space_.TryAllocateInTLAB(thread, size);
- if (addr != 0) {
+ uword addr = new_space_.TryAllocate(thread, size);
+ if (LIKELY(addr != 0)) {
return addr;
}
- intptr_t tlab_size = GetTLABSize();
- if ((tlab_size > 0) && (size > tlab_size)) {
- return AllocateOld(size, HeapPage::kData);
- }
-
- AbandonRemainingTLAB(thread);
- if (tlab_size > 0) {
- uword tlab_top = new_space_.TryAllocateNewTLAB(thread, tlab_size);
- if (tlab_top != 0) {
- addr = new_space_.TryAllocateInTLAB(thread, size);
- if (addr != 0) { // but "leftover" TLAB could end smaller than tlab_size
- return addr;
- }
- // Abandon "leftover" TLAB as well so we can start from scratch.
- AbandonRemainingTLAB(thread);
- }
- }
-
- ASSERT(!thread->HasActiveTLAB());
-
// This call to CollectGarbage might end up "reusing" a collection spawned
// from a different thread and will be racing to allocate the requested
// memory with other threads being released after the collection.
CollectGarbage(kNew);
- uword tlab_top = new_space_.TryAllocateNewTLAB(thread, tlab_size);
- if (tlab_top != 0) {
- addr = new_space_.TryAllocateInTLAB(thread, size);
- // It is possible a GC doesn't clear enough space.
- // In that case, we must fall through and allocate into old space.
- if (addr != 0) {
- return addr;
- }
+ addr = new_space_.TryAllocate(thread, size);
+ if (LIKELY(addr != 0)) {
+ return addr;
}
+
+ // It is possible a GC doesn't clear enough space.
+ // In that case, we must fall through and allocate into old space.
return AllocateOld(size, HeapPage::kData);
}
@@ -178,7 +155,7 @@
void Heap::AllocateExternal(intptr_t cid, intptr_t size, Space space) {
ASSERT(Thread::Current()->no_safepoint_scope_depth() == 0);
if (space == kNew) {
- isolate()->AssertCurrentThreadIsMutator();
+ Isolate::Current()->AssertCurrentThreadIsMutator();
new_space_.AllocateExternal(cid, size);
if (new_space_.ExternalInWords() <= (4 * new_space_.CapacityInWords())) {
return;
@@ -331,13 +308,13 @@
void HeapIterationScope::IterateObjectPointers(
ObjectPointerVisitor* visitor,
ValidationPolicy validate_frames) {
- isolate()->VisitObjectPointers(visitor, validate_frames);
+ isolate_group()->VisitObjectPointers(visitor, validate_frames);
}
void HeapIterationScope::IterateStackPointers(
ObjectPointerVisitor* visitor,
ValidationPolicy validate_frames) {
- isolate()->VisitStackPointers(visitor, validate_frames);
+ isolate_group()->VisitStackPointers(visitor, validate_frames);
}
void Heap::VisitObjectPointers(ObjectPointerVisitor* visitor) const {
@@ -462,7 +439,7 @@
void Heap::EvacuateNewSpace(Thread* thread, GCReason reason) {
ASSERT((reason != kOldSpace) && (reason != kPromotion));
- if (thread->isolate() == Dart::vm_isolate()) {
+ if (thread->isolate_group() == Dart::vm_isolate()->group()) {
// The vm isolate cannot safely collect garbage due to unvisited read-only
// handles and slots bootstrapped with RAW_NULL. Ignore GC requests to
// trigger a nice out-of-memory message instead of a crash in the middle of
@@ -483,8 +460,10 @@
}
void Heap::CollectNewSpaceGarbage(Thread* thread, GCReason reason) {
+ // TODO(40836) : Uncomment this line once the issue is fixed.
+ // NoActiveIsolateScope no_active_isolate_scope;
ASSERT((reason != kOldSpace) && (reason != kPromotion));
- if (thread->isolate() == Dart::vm_isolate()) {
+ if (thread->isolate_group() == Dart::vm_isolate()->group()) {
// The vm isolate cannot safely collect garbage due to unvisited read-only
// handles and slots bootstrapped with RAW_NULL. Ignore GC requests to
// trigger a nice out-of-memory message instead of a crash in the middle of
@@ -516,12 +495,15 @@
void Heap::CollectOldSpaceGarbage(Thread* thread,
GCType type,
GCReason reason) {
+ // TODO(40836) : Uncomment this line once the issue is fixed.
+ // NoActiveIsolateScope no_active_isolate_scope;
+
ASSERT(reason != kNewSpace);
ASSERT(type != kScavenge);
if (FLAG_use_compactor) {
type = kMarkCompact;
}
- if (thread->isolate() == Dart::vm_isolate()) {
+ if (thread->isolate_group() == Dart::vm_isolate()->group()) {
// The vm isolate cannot safely collect garbage due to unvisited read-only
// handles and slots bootstrapped with RAW_NULL. Ignore GC requests to
// trigger a nice out-of-memory message instead of a crash in the middle of
@@ -537,9 +519,12 @@
RecordAfterGC(type);
PrintStats();
NOT_IN_PRODUCT(PrintStatsToTimeline(&tbes, reason));
+
// Some Code objects may have been collected so invalidate handler cache.
- thread->isolate()->handler_info_cache()->Clear();
- thread->isolate()->catch_entry_moves_cache()->Clear();
+ thread->isolate_group()->ForEachIsolate([&](Isolate* isolate) {
+ isolate->handler_info_cache()->Clear();
+ isolate->catch_entry_moves_cache()->Clear();
+ });
EndOldSpaceGC();
}
}
@@ -641,18 +626,27 @@
}
void Heap::WaitForSweeperTasks(Thread* thread) {
+ ASSERT(!thread->IsAtSafepoint());
MonitorLocker ml(old_space_.tasks_lock());
while (old_space_.tasks() > 0) {
ml.WaitWithSafepointCheck(thread);
}
}
+void Heap::WaitForSweeperTasksAtSafepoint(Thread* thread) {
+ ASSERT(thread->IsAtSafepoint());
+ MonitorLocker ml(old_space_.tasks_lock());
+ while (old_space_.tasks() > 0) {
+ ml.Wait();
+ }
+}
+
void Heap::UpdateGlobalMaxUsed() {
#if !defined(PRODUCT)
- ASSERT(isolate_ != NULL);
+ ASSERT(isolate_group_ != NULL);
// We are accessing the used in words count for both new and old space
// without synchronizing. The value of this metric is approximate.
- isolate_->GetHeapGlobalUsedMaxMetric()->SetValue(
+ isolate_group_->GetHeapGlobalUsedMaxMetric()->SetValue(
(UsedInWords(Heap::kNew) * kWordSize) +
(UsedInWords(Heap::kOld) * kWordSize));
#endif // !defined(PRODUCT)
@@ -676,12 +670,13 @@
old_space_.WriteProtect(read_only);
}
-void Heap::Init(Isolate* isolate,
+void Heap::Init(IsolateGroup* isolate_group,
intptr_t max_new_gen_words,
intptr_t max_old_gen_words) {
- ASSERT(isolate->heap() == NULL);
- Heap* heap = new Heap(isolate, max_new_gen_words, max_old_gen_words);
- isolate->set_heap(heap);
+ ASSERT(isolate_group->heap() == nullptr);
+ std::unique_ptr<Heap> heap(
+ new Heap(isolate_group, max_new_gen_words, max_old_gen_words));
+ isolate_group->set_heap(std::move(heap));
}
const char* Heap::RegionName(Space space) {
@@ -700,14 +695,31 @@
void Heap::AddRegionsToObjectSet(ObjectSet* set) const {
new_space_.AddRegionsToObjectSet(set);
old_space_.AddRegionsToObjectSet(set);
+ set->SortRegions();
}
void Heap::CollectOnNthAllocation(intptr_t num_allocations) {
// Prevent generated code from using the TLAB fast path on next allocation.
- AbandonRemainingTLAB(Thread::Current());
+ new_space_.AbandonRemainingTLAB(Thread::Current());
gc_on_nth_allocation_ = num_allocations;
}
+void Heap::MergeOtherHeap(Heap* other) {
+ ASSERT(!other->gc_new_space_in_progress_);
+ ASSERT(!other->gc_old_space_in_progress_);
+ ASSERT(!other->read_only_);
+ ASSERT(other->new_space()->UsedInWords() == 0);
+ ASSERT(other->old_space()->tasks() == 0);
+
+ old_space_.MergeOtherPageSpace(other->old_space());
+
+ for (intptr_t i = 0; i < kNumWeakSelectors; ++i) {
+ // The new space rehashing should not be necessary.
+ new_weak_tables_[i]->MergeOtherWeakTable(other->new_weak_tables_[i]);
+ old_weak_tables_[i]->MergeOtherWeakTable(other->old_weak_tables_[i]);
+ }
+}
+
void Heap::CollectForDebugging() {
if (gc_on_nth_allocation_ == kNoForcedGarbageCollection) return;
gc_on_nth_allocation_--;
@@ -716,7 +728,7 @@
gc_on_nth_allocation_ = kNoForcedGarbageCollection;
} else {
// Prevent generated code from using the TLAB fast path on next allocation.
- AbandonRemainingTLAB(Thread::Current());
+ new_space_.AbandonRemainingTLAB(Thread::Current());
}
}
@@ -726,22 +738,22 @@
ObjectSet* allocated_set = new (zone) ObjectSet(zone);
this->AddRegionsToObjectSet(allocated_set);
+ Isolate* vm_isolate = Dart::vm_isolate();
+ vm_isolate->heap()->AddRegionsToObjectSet(allocated_set);
+
{
- VerifyObjectVisitor object_visitor(isolate(), allocated_set,
+ VerifyObjectVisitor object_visitor(isolate_group(), allocated_set,
mark_expectation);
this->VisitObjectsNoImagePages(&object_visitor);
}
{
- VerifyObjectVisitor object_visitor(isolate(), allocated_set,
+ VerifyObjectVisitor object_visitor(isolate_group(), allocated_set,
kRequireMarked);
this->VisitObjectsImagePages(&object_visitor);
}
-
- Isolate* vm_isolate = Dart::vm_isolate();
- vm_isolate->heap()->AddRegionsToObjectSet(allocated_set);
{
// VM isolate heap is premarked.
- VerifyObjectVisitor vm_object_visitor(isolate(), allocated_set,
+ VerifyObjectVisitor vm_object_visitor(isolate_group(), allocated_set,
kRequireMarked);
vm_isolate->heap()->VisitObjects(&vm_object_visitor);
}
@@ -762,7 +774,7 @@
ObjectSet* allocated_set =
CreateAllocatedObjectSet(stack_zone.GetZone(), mark_expectation);
- VerifyPointersVisitor visitor(isolate(), allocated_set);
+ VerifyPointersVisitor visitor(isolate_group(), allocated_set);
VisitObjectPointers(&visitor);
// Only returning a value so that Heap::Validate can be called from an ASSERT.
@@ -908,8 +920,12 @@
// We only come here during hot reload, in which case we assume that none of
// the isolates is in the middle of sending messages.
- RELEASE_ASSERT(isolate()->forward_table_new() == nullptr);
- RELEASE_ASSERT(isolate()->forward_table_old() == nullptr);
+ isolate_group()->ForEachIsolate(
+ [&](Isolate* isolate) {
+ RELEASE_ASSERT(isolate->forward_table_new() == nullptr);
+ RELEASE_ASSERT(isolate->forward_table_old() == nullptr);
+ },
+ /*at_safepoint=*/true);
}
void Heap::ForwardWeakTables(ObjectPointerVisitor* visitor) {
@@ -922,8 +938,12 @@
// Isolates might have forwarding tables (used for during snapshoting in
// isolate communication).
- auto table_old = isolate()->forward_table_old();
- if (table_old != nullptr) table_old->Forward(visitor);
+ isolate_group()->ForEachIsolate(
+ [&](Isolate* isolate) {
+ auto table_old = isolate->forward_table_old();
+ if (table_old != nullptr) table_old->Forward(visitor);
+ },
+ /*at_safepoint=*/true);
}
#ifndef PRODUCT
@@ -980,11 +1000,15 @@
(type == kMarkSweep && gc_old_space_in_progress_) ||
(type == kMarkCompact && gc_old_space_in_progress_));
#ifndef PRODUCT
- if (Service::gc_stream.enabled() &&
- !Isolate::IsVMInternalIsolate(isolate())) {
- ServiceEvent event(isolate(), ServiceEvent::kGC);
- event.set_gc_stats(&stats_);
- Service::HandleEvent(&event);
+ // For now we'll emit the same GC events on all isolates.
+ if (Service::gc_stream.enabled()) {
+ isolate_group_->ForEachIsolate([&](Isolate* isolate) {
+ if (!Isolate::IsVMInternalIsolate(isolate)) {
+ ServiceEvent event(isolate, ServiceEvent::kGC);
+ event.set_gc_stats(&stats_);
+ Service::HandleEvent(&event);
+ }
+ });
}
#endif // !PRODUCT
}
@@ -1012,7 +1036,7 @@
// clang-format off
OS::PrintErr(
- "[ %-13.13s, %10s(%9s), " // GC(isolate), type(reason)
+ "[ %-13.13s, %10s(%9s), " // GC(isolate-group), type(reason)
"%4" Pd ", " // count
"%6.2f, " // start time
"%5.1f, " // total time
@@ -1025,11 +1049,11 @@
"%6.2f, %6.2f, %6.2f, %6.2f, %6.2f, %6.2f, " // times
"%" Pd ", %" Pd ", %" Pd ", %" Pd ", " // data
"]\n", // End with a comma to make it easier to import in spreadsheets.
- isolate()->name(),
+ isolate_group()->source()->name,
GCTypeToString(stats_.type_),
GCReasonToString(stats_.reason_),
stats_.num_,
- MicrosecondsToSeconds(isolate()->UptimeMicros()),
+ MicrosecondsToSeconds(isolate_group_->UptimeMicros()),
MicrosecondsToMilliseconds(stats_.after_.micros_ -
stats_.before_.micros_),
RoundWordsToKB(stats_.before_.new_.used_in_words),
diff --git a/runtime/vm/heap/heap.h b/runtime/vm/heap/heap.h
index a9e2c05..34ab784 100644
--- a/runtime/vm/heap/heap.h
+++ b/runtime/vm/heap/heap.h
@@ -23,6 +23,7 @@
// Forward declarations.
class Isolate;
+class IsolateGroup;
class ObjectPointerVisitor;
class ObjectSet;
class ServiceEvent;
@@ -62,7 +63,7 @@
kExternal, // Dart_NewWeakPersistentHandle
kIdle, // Dart_NotifyIdle
kLowMemory, // Dart_NotifyLowMemory
- kDebugging, // service request, --gc_at_instance_allocation, etc.
+ kDebugging, // service request, etc.
};
// Pattern for unused new space and swept old space.
@@ -147,11 +148,11 @@
void CheckFinishConcurrentMarking(Thread* thread);
void WaitForMarkerTasks(Thread* thread);
void WaitForSweeperTasks(Thread* thread);
+ void WaitForSweeperTasksAtSafepoint(Thread* thread);
// Enables growth control on the page space heaps. This should be
// called before any user code is executed.
void InitGrowthControl();
- void EnableGrowthControl() { SetGrowthControlState(true); }
void DisableGrowthControl() { SetGrowthControlState(false); }
void SetGrowthControlState(bool state);
bool GrowthControlState();
@@ -164,7 +165,7 @@
}
// Initialize the heap and register it with the isolate.
- static void Init(Isolate* isolate,
+ static void Init(IsolateGroup* isolate_group,
intptr_t max_new_gen_words,
intptr_t max_old_gen_words);
@@ -293,7 +294,7 @@
}
#endif // PRODUCT
- Isolate* isolate() const { return isolate_; }
+ IsolateGroup* isolate_group() const { return isolate_group_; }
Monitor* barrier() const { return &barrier_; }
Monitor* barrier_done() const { return &barrier_done_; }
@@ -305,18 +306,12 @@
static const intptr_t kNewAllocatableSize = 256 * KB;
static const intptr_t kAllocatablePageSize = 64 * KB;
- intptr_t GetTLABSize() {
- // Inspired by V8 tlab size. More than threshold for old space allocation,
- // less then minimal(initial) new semi-space.
- const intptr_t size = 512 * KB;
- return Utils::RoundDown(size, kObjectAlignment);
- }
- void MakeTLABIterable(Thread* thread);
- void AbandonRemainingTLAB(Thread* thread);
Space SpaceForExternal(intptr_t size) const;
void CollectOnNthAllocation(intptr_t num_allocations);
+ void MergeOtherHeap(Heap* other);
+
private:
class GCStats : public ValueObject {
public:
@@ -348,7 +343,7 @@
DISALLOW_COPY_AND_ASSIGN(GCStats);
};
- Heap(Isolate* isolate,
+ Heap(IsolateGroup* isolate_group,
intptr_t max_new_gen_semi_words, // Max capacity of new semi-space.
intptr_t max_old_gen_words);
@@ -391,7 +386,7 @@
// Trigger major GC if 'gc_on_nth_allocation_' is set.
void CollectForDebugging();
- Isolate* isolate_;
+ IsolateGroup* isolate_group_;
// The different spaces used for allocation.
Scavenger new_space_;
diff --git a/runtime/vm/heap/heap_test.cc b/runtime/vm/heap/heap_test.cc
index 0bbe2fa..948d6f3 100644
--- a/runtime/vm/heap/heap_test.cc
+++ b/runtime/vm/heap/heap_test.cc
@@ -122,7 +122,7 @@
CountObjectsVisitor visitor(thread, class_table->NumCids());
HeapIterationScope iter(thread);
iter.IterateObjects(&visitor);
- isolate->VisitWeakPersistentHandles(&visitor);
+ isolate->group()->VisitWeakPersistentHandles(&visitor);
EXPECT_EQ(2, visitor.new_count_[cid]);
EXPECT_EQ(0, visitor.old_count_[cid]);
}
@@ -135,7 +135,7 @@
CountObjectsVisitor visitor(thread, class_table->NumCids());
HeapIterationScope iter(thread);
iter.IterateObjects(&visitor);
- isolate->VisitWeakPersistentHandles(&visitor);
+ isolate->group()->VisitWeakPersistentHandles(&visitor);
EXPECT_EQ(1, visitor.new_count_[cid]);
EXPECT_EQ(0, visitor.old_count_[cid]);
}
@@ -149,7 +149,7 @@
CountObjectsVisitor visitor(thread, class_table->NumCids());
HeapIterationScope iter(thread);
iter.IterateObjects(&visitor);
- isolate->VisitWeakPersistentHandles(&visitor);
+ isolate->group()->VisitWeakPersistentHandles(&visitor);
EXPECT_EQ(0, visitor.new_count_[cid]);
EXPECT_EQ(1, visitor.old_count_[cid]);
}
@@ -162,7 +162,7 @@
CountObjectsVisitor visitor(thread, class_table->NumCids());
HeapIterationScope iter(thread);
iter.IterateObjects(&visitor);
- isolate->VisitWeakPersistentHandles(&visitor);
+ isolate->group()->VisitWeakPersistentHandles(&visitor);
EXPECT_EQ(0, visitor.new_count_[cid]);
EXPECT_EQ(1, visitor.old_count_[cid]);
}
@@ -174,7 +174,7 @@
CountObjectsVisitor visitor(thread, class_table->NumCids());
HeapIterationScope iter(thread);
iter.IterateObjects(&visitor);
- isolate->VisitWeakPersistentHandles(&visitor);
+ isolate->group()->VisitWeakPersistentHandles(&visitor);
EXPECT_EQ(0, visitor.new_count_[cid]);
EXPECT_EQ(1, visitor.old_count_[cid]);
}
@@ -190,7 +190,7 @@
CountObjectsVisitor visitor(thread, class_table->NumCids());
HeapIterationScope iter(thread);
iter.IterateObjects(&visitor);
- isolate->VisitWeakPersistentHandles(&visitor);
+ isolate->group()->VisitWeakPersistentHandles(&visitor);
EXPECT_EQ(0, visitor.new_count_[cid]);
EXPECT_EQ(0, visitor.old_count_[cid]);
}
@@ -627,7 +627,7 @@
CountObjectsVisitor visitor(thread, isolate->class_table()->NumCids());
HeapIterationScope iter(thread);
iter.IterateObjects(&visitor);
- isolate->VisitWeakPersistentHandles(&visitor);
+ isolate->group()->VisitWeakPersistentHandles(&visitor);
EXPECT_LE(visitor.old_external_size_[kArrayCid],
heap->old_space()->ExternalInWords() * kWordSize);
EXPECT_LE(visitor.new_external_size_[kArrayCid],
diff --git a/runtime/vm/heap/marker.cc b/runtime/vm/heap/marker.cc
index 87d9c08..d353296 100644
--- a/runtime/vm/heap/marker.cc
+++ b/runtime/vm/heap/marker.cc
@@ -84,11 +84,11 @@
template <bool sync>
class MarkingVisitorBase : public ObjectPointerVisitor {
public:
- MarkingVisitorBase(Isolate* isolate,
+ MarkingVisitorBase(IsolateGroup* isolate_group,
PageSpace* page_space,
MarkingStack* marking_stack,
MarkingStack* deferred_marking_stack)
- : ObjectPointerVisitor(isolate),
+ : ObjectPointerVisitor(isolate_group),
thread_(Thread::Current()),
page_space_(page_space),
work_list_(marking_stack),
@@ -96,8 +96,9 @@
delayed_weak_properties_(NULL),
marked_bytes_(0),
marked_micros_(0) {
- ASSERT(thread_->isolate() == isolate);
+ ASSERT(thread_->isolate_group() == isolate_group);
}
+ ~MarkingVisitorBase() {}
uintptr_t marked_bytes() const { return marked_bytes_; }
int64_t marked_micros() const { return marked_micros_; }
@@ -347,14 +348,14 @@
public:
explicit MarkingWeakVisitor(Thread* thread)
: HandleVisitor(thread),
- class_table_(thread->isolate()->shared_class_table()) {}
+ class_table_(thread->isolate_group()->class_table()) {}
void VisitHandle(uword addr) {
FinalizablePersistentHandle* handle =
reinterpret_cast<FinalizablePersistentHandle*>(addr);
RawObject* raw_obj = handle->raw();
if (IsUnreachable(raw_obj)) {
- handle->UpdateUnreachable(thread()->isolate());
+ handle->UpdateUnreachable(thread()->isolate_group());
}
}
@@ -365,16 +366,20 @@
};
void GCMarker::Prologue() {
- isolate_->ReleaseStoreBuffers();
+ isolate_group_->ReleaseStoreBuffers();
#ifndef DART_PRECOMPILED_RUNTIME
- Thread* mutator_thread = isolate_->mutator_thread();
- if (mutator_thread != NULL) {
- Interpreter* interpreter = mutator_thread->interpreter();
- if (interpreter != NULL) {
- interpreter->ClearLookupCache();
- }
- }
+ isolate_group_->ForEachIsolate(
+ [&](Isolate* isolate) {
+ Thread* mutator_thread = isolate->mutator_thread();
+ if (mutator_thread != NULL) {
+ Interpreter* interpreter = mutator_thread->interpreter();
+ if (interpreter != NULL) {
+ interpreter->ClearLookupCache();
+ }
+ }
+ },
+ /*at_safepoint=*/true);
#endif
}
@@ -401,9 +406,10 @@
switch (slice) {
case kIsolate: {
- TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "ProcessIsolate");
- isolate_->VisitObjectPointers(visitor,
- ValidationPolicy::kDontValidateFrames);
+ TIMELINE_FUNCTION_GC_DURATION(Thread::Current(),
+ "ProcessIsolateGroupRoots");
+ isolate_group_->VisitObjectPointers(
+ visitor, ValidationPolicy::kDontValidateFrames);
break;
}
case kNewSpace: {
@@ -460,9 +466,9 @@
void GCMarker::ProcessWeakHandles(Thread* thread) {
TIMELINE_FUNCTION_GC_DURATION(thread, "ProcessWeakHandles");
MarkingWeakVisitor visitor(thread);
- ApiState* state = isolate_->api_state();
+ ApiState* state = isolate_group_->api_state();
ASSERT(state != NULL);
- isolate_->VisitWeakPersistentHandles(&visitor);
+ isolate_group_->VisitWeakPersistentHandles(&visitor);
}
void GCMarker::ProcessWeakTables(Thread* thread) {
@@ -486,7 +492,7 @@
void GCMarker::ProcessRememberedSet(Thread* thread) {
TIMELINE_FUNCTION_GC_DURATION(thread, "ProcessRememberedSet");
// Filter collected objects from the remembered set.
- StoreBuffer* store_buffer = isolate_->store_buffer();
+ StoreBuffer* store_buffer = isolate_group_->store_buffer();
StoreBufferBlock* reading = store_buffer->Blocks();
StoreBufferBlock* writing = store_buffer->PopNonFullBlock();
while (reading != NULL) {
@@ -515,8 +521,8 @@
class ObjectIdRingClearPointerVisitor : public ObjectPointerVisitor {
public:
- explicit ObjectIdRingClearPointerVisitor(Isolate* isolate)
- : ObjectPointerVisitor(isolate) {}
+ explicit ObjectIdRingClearPointerVisitor(IsolateGroup* isolate_group)
+ : ObjectPointerVisitor(isolate_group) {}
void VisitPointers(RawObject** first, RawObject** last) {
for (RawObject** current = first; current <= last; current++) {
@@ -533,32 +539,46 @@
void GCMarker::ProcessObjectIdTable(Thread* thread) {
#ifndef PRODUCT
TIMELINE_FUNCTION_GC_DURATION(thread, "ProcessObjectIdTable");
- ObjectIdRingClearPointerVisitor visitor(isolate_);
- ObjectIdRing* ring = isolate_->object_id_ring();
- ASSERT(ring != NULL);
- ring->VisitPointers(&visitor);
+ ObjectIdRingClearPointerVisitor visitor(isolate_group_);
+ isolate_group_->ForEachIsolate(
+ [&](Isolate* isolate) {
+ ObjectIdRing* ring = isolate->object_id_ring();
+ ASSERT(ring != NULL);
+ ring->VisitPointers(&visitor);
+ },
+ /*at_safepoint=*/true);
#endif // !PRODUCT
}
class ParallelMarkTask : public ThreadPool::Task {
public:
ParallelMarkTask(GCMarker* marker,
- Isolate* isolate,
+ IsolateGroup* isolate_group,
MarkingStack* marking_stack,
ThreadBarrier* barrier,
SyncMarkingVisitor* visitor,
RelaxedAtomic<uintptr_t>* num_busy)
: marker_(marker),
- isolate_(isolate),
+ isolate_group_(isolate_group),
marking_stack_(marking_stack),
barrier_(barrier),
visitor_(visitor),
num_busy_(num_busy) {}
virtual void Run() {
- bool result =
- Thread::EnterIsolateAsHelper(isolate_, Thread::kMarkerTask, true);
+ bool result = Thread::EnterIsolateGroupAsHelper(
+ isolate_group_, Thread::kMarkerTask, /*bypass_safepoint=*/true);
ASSERT(result);
+
+ RunEnteredIsolateGroup();
+
+ Thread::ExitIsolateGroupAsHelper(/*bypass_safepoint=*/true);
+
+ // This task is done. Notify the original thread.
+ barrier_->Exit();
+ }
+
+ void RunEnteredIsolateGroup() {
{
Thread* thread = Thread::Current();
TIMELINE_FUNCTION_GC_DURATION(thread, "ParallelMark");
@@ -579,7 +599,7 @@
if (num_busy_->fetch_sub(1u) == 1) break;
// Wait for some work to appear.
- // TODO(iposva): Replace busy-waiting with a solution using Monitor,
+ // TODO(40695): Replace busy-waiting with a solution using Monitor,
// and redraw the boundaries between stack/visitor/task as needed.
while (marking_stack_->IsEmpty() && num_busy_->load() > 0) {
}
@@ -640,15 +660,11 @@
delete visitor_;
}
- Thread::ExitIsolateAsHelper(true);
-
- // This task is done. Notify the original thread.
- barrier_->Exit();
}
private:
GCMarker* marker_;
- Isolate* isolate_;
+ IsolateGroup* isolate_group_;
MarkingStack* marking_stack_;
ThreadBarrier* barrier_;
SyncMarkingVisitor* visitor_;
@@ -660,11 +676,11 @@
class ConcurrentMarkTask : public ThreadPool::Task {
public:
ConcurrentMarkTask(GCMarker* marker,
- Isolate* isolate,
+ IsolateGroup* isolate_group,
PageSpace* page_space,
SyncMarkingVisitor* visitor)
: marker_(marker),
- isolate_(isolate),
+ isolate_group_(isolate_group),
page_space_(page_space),
visitor_(visitor) {
#if defined(DEBUG)
@@ -674,8 +690,8 @@
}
virtual void Run() {
- bool result =
- Thread::EnterIsolateAsHelper(isolate_, Thread::kMarkerTask, true);
+ bool result = Thread::EnterIsolateGroupAsHelper(
+ isolate_group_, Thread::kMarkerTask, /*bypass_safepoint=*/true);
ASSERT(result);
{
TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "ConcurrentMark");
@@ -693,7 +709,7 @@
}
// Exit isolate cleanly *before* notifying it, to avoid shutdown race.
- Thread::ExitIsolateAsHelper(true);
+ Thread::ExitIsolateGroupAsHelper(/*bypass_safepoint=*/true);
// This marker task is done. Notify the original isolate.
{
MonitorLocker ml(page_space_->tasks_lock());
@@ -710,7 +726,7 @@
private:
GCMarker* marker_;
- Isolate* isolate_;
+ IsolateGroup* isolate_group_;
PageSpace* page_space_;
SyncMarkingVisitor* visitor_;
@@ -744,8 +760,8 @@
return marked_words_per_job_micro * jobs;
}
-GCMarker::GCMarker(Isolate* isolate, Heap* heap)
- : isolate_(isolate),
+GCMarker::GCMarker(IsolateGroup* isolate_group, Heap* heap)
+ : isolate_group_(isolate_group),
heap_(heap),
marking_stack_(),
visitors_(),
@@ -760,8 +776,8 @@
GCMarker::~GCMarker() {
// Cleanup in case isolate shutdown happens after starting the concurrent
// marker and before finalizing.
- if (isolate_->marking_stack() != NULL) {
- isolate_->DisableIncrementalBarrier();
+ if (isolate_group_->marking_stack() != NULL) {
+ isolate_group_->DisableIncrementalBarrier();
for (intptr_t i = 0; i < FLAG_marker_tasks; i++) {
visitors_[i]->AbandonWork();
delete visitors_[i];
@@ -771,7 +787,8 @@
}
void GCMarker::StartConcurrentMark(PageSpace* page_space) {
- isolate_->EnableIncrementalBarrier(&marking_stack_, &deferred_marking_stack_);
+ isolate_group_->EnableIncrementalBarrier(&marking_stack_,
+ &deferred_marking_stack_);
const intptr_t num_tasks = FLAG_marker_tasks;
@@ -790,12 +807,12 @@
ResetSlices();
for (intptr_t i = 0; i < num_tasks; i++) {
ASSERT(visitors_[i] == NULL);
- visitors_[i] = new SyncMarkingVisitor(isolate_, page_space, &marking_stack_,
- &deferred_marking_stack_);
+ visitors_[i] = new SyncMarkingVisitor(
+ isolate_group_, page_space, &marking_stack_, &deferred_marking_stack_);
// Begin marking on a helper thread.
bool result = Dart::thread_pool()->Run<ConcurrentMarkTask>(
- this, isolate_, page_space, visitors_[i]);
+ this, isolate_group_, page_space, visitors_[i]);
ASSERT(result);
}
@@ -807,8 +824,8 @@
}
void GCMarker::MarkObjects(PageSpace* page_space) {
- if (isolate_->marking_stack() != NULL) {
- isolate_->DisableIncrementalBarrier();
+ if (isolate_group_->marking_stack() != NULL) {
+ isolate_group_->DisableIncrementalBarrier();
}
Prologue();
@@ -819,7 +836,7 @@
TIMELINE_FUNCTION_GC_DURATION(thread, "Mark");
int64_t start = OS::GetCurrentMonotonicMicros();
// Mark everything on main thread.
- UnsyncMarkingVisitor mark(isolate_, page_space, &marking_stack_,
+ UnsyncMarkingVisitor mark(isolate_group_, page_space, &marking_stack_,
&deferred_marking_stack_);
ResetSlices();
IterateRoots(&mark);
@@ -832,8 +849,7 @@
mark.AddMicros(stop - start);
FinalizeResultsFrom(&mark);
} else {
- ThreadBarrier barrier(num_tasks + 1, heap_->barrier(),
- heap_->barrier_done());
+ ThreadBarrier barrier(num_tasks, heap_->barrier(), heap_->barrier_done());
ResetSlices();
// Used to coordinate draining among tasks; all start out as 'busy'.
RelaxedAtomic<uintptr_t> num_busy(num_tasks);
@@ -844,44 +860,24 @@
visitor = visitors_[i];
visitors_[i] = NULL;
} else {
- visitor = new SyncMarkingVisitor(
- isolate_, page_space, &marking_stack_, &deferred_marking_stack_);
+ visitor =
+ new SyncMarkingVisitor(isolate_group_, page_space,
+ &marking_stack_, &deferred_marking_stack_);
}
-
- bool result = Dart::thread_pool()->Run<ParallelMarkTask>(
- this, isolate_, &marking_stack_, &barrier, visitor, &num_busy);
- ASSERT(result);
+ if (i < (num_tasks - 1)) {
+ // Begin marking on a helper thread.
+ bool result = Dart::thread_pool()->Run<ParallelMarkTask>(
+ this, isolate_group_, &marking_stack_, &barrier, visitor,
+ &num_busy);
+ ASSERT(result);
+ } else {
+ // Last worker is the main thread.
+ ParallelMarkTask task(this, isolate_group_, &marking_stack_, &barrier,
+ visitor, &num_busy);
+ task.RunEnteredIsolateGroup();
+ barrier.Exit();
+ }
}
- bool more_to_mark = false;
- do {
- // Wait for all markers to stop.
- barrier.Sync();
-#if defined(DEBUG)
- ASSERT(num_busy.load() == 0);
- // Caveat: must not allow any marker to continue past the barrier
- // before we checked num_busy, otherwise one of them might rush
- // ahead and increment it.
- barrier.Sync();
-#endif
-
- // Wait for all markers to go through weak properties and verify
- // that there are no more objects to mark.
- // Note: we need to have two barriers here because we want all markers
- // and main thread to make decisions in lock step.
- barrier.Sync();
- more_to_mark = num_busy.load() > 0;
- barrier.Sync();
- } while (more_to_mark);
-
- // Phase 2: Deferred marking.
- barrier.Sync();
-
- // Phase 3: Weak processing.
- IterateWeakRoots(thread);
- barrier.Sync();
-
- // Phase 4: Gather statistics from all markers.
- barrier.Exit();
}
}
Epilogue();
diff --git a/runtime/vm/heap/marker.h b/runtime/vm/heap/marker.h
index 35ebea9..a4ad4c0b 100644
--- a/runtime/vm/heap/marker.h
+++ b/runtime/vm/heap/marker.h
@@ -14,7 +14,7 @@
// Forward declarations.
class HandleVisitor;
class Heap;
-class Isolate;
+class IsolateGroup;
class ObjectPointerVisitor;
class PageSpace;
class RawWeakProperty;
@@ -30,7 +30,7 @@
// is exited during concurrent marking.
class GCMarker {
public:
- GCMarker(Isolate* isolate, Heap* heap);
+ GCMarker(IsolateGroup* isolate_group, Heap* heap);
~GCMarker();
// Mark roots synchronously, then spawn tasks to concurrently drain the
@@ -60,7 +60,7 @@
template <class MarkingVisitorType>
void FinalizeResultsFrom(MarkingVisitorType* visitor);
- Isolate* const isolate_;
+ IsolateGroup* const isolate_group_;
Heap* const heap_;
MarkingStack marking_stack_;
MarkingStack deferred_marking_stack_;
diff --git a/runtime/vm/heap/pages.cc b/runtime/vm/heap/pages.cc
index cf646cb..a5ecaab 100644
--- a/runtime/vm/heap/pages.cc
+++ b/runtime/vm/heap/pages.cc
@@ -361,7 +361,7 @@
page->set_object_end(page->memory_->end());
if ((type != HeapPage::kExecutable) && (heap_ != nullptr) &&
- (heap_->isolate() != Dart::vm_isolate())) {
+ (heap_->isolate_group() != Dart::vm_isolate()->group())) {
page->AllocateForwardingPage();
}
return page;
@@ -680,7 +680,7 @@
void PageSpace::MakeIterable() const {
// Assert not called from concurrent sweeper task.
// TODO(koda): Use thread/task identity when implemented.
- ASSERT(Isolate::Current()->heap() != NULL);
+ ASSERT(IsolateGroup::Current()->heap() != NULL);
if (bump_top_ < bump_end_) {
FreeListElement::AsElement(bump_top_, bump_end_ - bump_top_);
}
@@ -706,9 +706,9 @@
return;
}
ASSERT(heap_ != NULL);
- ASSERT(heap_->isolate() != NULL);
- Isolate* isolate = heap_->isolate();
- isolate->GetHeapOldCapacityMaxMetric()->SetValue(
+ ASSERT(heap_->isolate_group() != NULL);
+ auto isolate_group = heap_->isolate_group();
+ isolate_group->GetHeapOldCapacityMaxMetric()->SetValue(
static_cast<int64_t>(usage_.capacity_in_words) * kWordSize);
#endif // !defined(PRODUCT)
}
@@ -720,9 +720,9 @@
return;
}
ASSERT(heap_ != NULL);
- ASSERT(heap_->isolate() != NULL);
- Isolate* isolate = heap_->isolate();
- isolate->GetHeapOldUsedMaxMetric()->SetValue(UsedInWords() * kWordSize);
+ ASSERT(heap_->isolate_group() != NULL);
+ auto isolate_group = heap_->isolate_group();
+ isolate_group->GetHeapOldUsedMaxMetric()->SetValue(UsedInWords() * kWordSize);
#endif // !defined(PRODUCT)
}
@@ -859,8 +859,8 @@
#ifndef PRODUCT
void PageSpace::PrintToJSONObject(JSONObject* object) const {
- Isolate* isolate = Isolate::Current();
- ASSERT(isolate != NULL);
+ auto isolate_group = IsolateGroup::Current();
+ ASSERT(isolate_group != nullptr);
JSONObject space(object, "old");
space.AddProperty("type", "HeapSpace");
space.AddProperty("name", "old");
@@ -871,7 +871,7 @@
space.AddProperty64("external", ExternalInWords() * kWordSize);
space.AddProperty("time", MicrosecondsToSeconds(gc_time_micros()));
if (collections() > 0) {
- int64_t run_time = isolate->UptimeMicros();
+ int64_t run_time = isolate_group->UptimeMicros();
run_time = Utils::Maximum(run_time, static_cast<int64_t>(0));
double run_time_millis = MicrosecondsToMilliseconds(run_time);
double avg_time_between_collections =
@@ -1079,14 +1079,16 @@
int64_t pre_safe_point) {
Thread* thread = Thread::Current();
ASSERT(thread->IsAtSafepoint());
- Isolate* isolate = heap_->isolate();
- ASSERT(isolate == Isolate::Current());
+ auto isolate_group = heap_->isolate_group();
+ ASSERT(isolate_group == IsolateGroup::Current());
const int64_t start = OS::GetCurrentMonotonicMicros();
// Perform various cleanup that relies on no tasks interfering.
- isolate->class_table()->FreeOldTables();
- isolate->field_table()->FreeOldTables();
+ isolate_group->class_table()->FreeOldTables();
+ isolate_group->ForEachIsolate(
+ [&](Isolate* isolate) { isolate->field_table()->FreeOldTables(); },
+ /*at_safepoint=*/true);
NoSafepointScope no_safepoints;
@@ -1112,7 +1114,7 @@
// Mark all reachable old-gen objects.
if (marker_ == NULL) {
ASSERT(phase() == kDone);
- marker_ = new GCMarker(isolate, heap_);
+ marker_ = new GCMarker(isolate_group, heap_);
} else {
ASSERT(phase() == kAwaitingFinalization);
}
@@ -1177,7 +1179,7 @@
Compact(thread);
set_phase(kDone);
} else if (FLAG_concurrent_sweep) {
- ConcurrentSweep(isolate);
+ ConcurrentSweep(isolate_group);
} else {
SweepLarge();
Sweep();
@@ -1261,17 +1263,17 @@
}
}
-void PageSpace::ConcurrentSweep(Isolate* isolate) {
+void PageSpace::ConcurrentSweep(IsolateGroup* isolate_group) {
// Start the concurrent sweeper task now.
- GCSweeper::SweepConcurrent(isolate, pages_, pages_tail_, large_pages_,
+ GCSweeper::SweepConcurrent(isolate_group, pages_, pages_tail_, large_pages_,
large_pages_tail_, &freelist_[HeapPage::kData]);
}
void PageSpace::Compact(Thread* thread) {
- thread->isolate()->set_compaction_in_progress(true);
+ thread->isolate_group()->set_compaction_in_progress(true);
GCCompactor compactor(thread, heap_);
compactor.Compact(pages_, &freelist_[HeapPage::kData], &pages_lock_);
- thread->isolate()->set_compaction_in_progress(false);
+ thread->isolate_group()->set_compaction_in_progress(false);
if (FLAG_verify_after_gc) {
OS::PrintErr("Verifying after compacting...");
@@ -1381,6 +1383,92 @@
return false;
}
+static void AppendList(HeapPage** pages,
+ HeapPage** pages_tail,
+ HeapPage** other_pages,
+ HeapPage** other_pages_tail) {
+ ASSERT((*pages == nullptr) == (*pages_tail == nullptr));
+ ASSERT((*other_pages == nullptr) == (*other_pages_tail == nullptr));
+
+ if (*other_pages != nullptr) {
+ if (*pages_tail == nullptr) {
+ *pages = *other_pages;
+ *pages_tail = *other_pages_tail;
+ } else {
+ const bool is_execute = FLAG_write_protect_code &&
+ (*pages_tail)->type() == HeapPage::kExecutable;
+ if (is_execute) {
+ (*pages_tail)->WriteProtect(false);
+ }
+ (*pages_tail)->set_next(*other_pages);
+ if (is_execute) {
+ (*pages_tail)->WriteProtect(true);
+ }
+ *pages_tail = *other_pages_tail;
+ }
+ *other_pages = nullptr;
+ *other_pages_tail = nullptr;
+ }
+}
+
+static void EnsureEqualImagePages(HeapPage* pages, HeapPage* other_pages) {
+#if defined(DEBUG)
+ while (pages != nullptr) {
+ ASSERT((pages == nullptr) == (other_pages == nullptr));
+ ASSERT(pages->object_start() == other_pages->object_start());
+ ASSERT(pages->object_end() == other_pages->object_end());
+ pages = pages->next();
+ other_pages = other_pages->next();
+ }
+#endif
+}
+
+void PageSpace::MergeOtherPageSpace(PageSpace* other) {
+ MutexLocker ml(&pages_lock_);
+ MutexLocker ml2(&other->pages_lock_);
+
+ other->AbandonBumpAllocation();
+
+ ASSERT(other->bump_top_ == 0 && other->bump_end_ == 0);
+ ASSERT(other->tasks_ == 0);
+ ASSERT(other->concurrent_marker_tasks_ == 0);
+ ASSERT(other->phase_ == kDone);
+ DEBUG_ASSERT(other->iterating_thread_ == nullptr);
+ ASSERT(other->marker_ == nullptr);
+
+ for (intptr_t i = 0; i < HeapPage::kNumPageTypes; ++i) {
+ const bool is_protected =
+ FLAG_write_protect_code && i == HeapPage::kExecutable;
+ freelist_[i].MergeOtherFreelist(&other->freelist_[i], is_protected);
+ other->freelist_[i].Reset();
+ }
+
+ AppendList(&pages_, &pages_tail_, &other->pages_, &other->pages_tail_);
+ AppendList(&exec_pages_, &exec_pages_tail_, &other->exec_pages_,
+ &other->exec_pages_tail_);
+ AppendList(&large_pages_, &large_pages_tail_, &other->large_pages_,
+ &other->large_pages_tail_);
+ // We intentionall do not merge [image_pages_] beause [this] and [other] have
+ // the same mmap()ed image page areas.
+ EnsureEqualImagePages(image_pages_, other->image_pages_);
+
+ // We intentionaly do not increase [max_capacity_in_words_] because this can
+ // lead [max_capacity_in_words_] to become larger and larger and eventually
+ // wrap-around and become negative.
+ allocated_black_in_words_ += other->allocated_black_in_words_;
+ gc_time_micros_ += other->gc_time_micros_;
+ collections_ += other->collections_;
+
+ usage_.capacity_in_words += other->usage_.capacity_in_words;
+ usage_.used_in_words += other->usage_.used_in_words;
+ usage_.external_in_words += other->usage_.external_in_words;
+
+ page_space_controller_.MergeOtherPageSpaceController(
+ &other->page_space_controller_);
+
+ ASSERT(FLAG_concurrent_mark || other->enable_concurrent_mark_ == false);
+}
+
PageSpaceController::PageSpaceController(Heap* heap,
int heap_growth_ratio,
int heap_growth_max,
@@ -1576,11 +1664,19 @@
if (FLAG_log_growth) {
THR_Print("%s: threshold=%" Pd "kB, idle_threshold=%" Pd "kB, reason=%s\n",
- heap_->isolate()->name(), gc_threshold_in_words_ / KBInWords,
+ heap_->isolate_group()->source()->name,
+ gc_threshold_in_words_ / KBInWords,
idle_gc_threshold_in_words_ / KBInWords, reason);
}
}
+void PageSpaceController::MergeOtherPageSpaceController(
+ PageSpaceController* other) {
+ last_usage_.capacity_in_words += other->last_usage_.capacity_in_words;
+ last_usage_.used_in_words += other->last_usage_.used_in_words;
+ last_usage_.external_in_words += other->last_usage_.external_in_words;
+}
+
void PageSpaceGarbageCollectionHistory::AddGarbageCollectionTime(int64_t start,
int64_t end) {
Entry entry;
diff --git a/runtime/vm/heap/pages.h b/runtime/vm/heap/pages.h
index d8ee959..a8ef135 100644
--- a/runtime/vm/heap/pages.h
+++ b/runtime/vm/heap/pages.h
@@ -237,7 +237,10 @@
bool is_enabled() { return is_enabled_; }
private:
+ friend class PageSpace; // For MergeOtherPageSpaceController
+
void RecordUpdate(SpaceUsage before, SpaceUsage after, const char* reason);
+ void MergeOtherPageSpaceController(PageSpaceController* other);
Heap* heap_;
@@ -261,7 +264,7 @@
// we grow the heap more aggressively.
const int garbage_collection_time_ratio_;
- // Perform a synchronous GC when capacity exceeds this amount.
+ // Perform a GC when capacity exceeds this amount.
intptr_t gc_threshold_in_words_;
// Start considering idle GC when capacity exceeds this amount.
@@ -450,6 +453,8 @@
bool IsObjectFromImagePages(RawObject* object);
+ void MergeOtherPageSpace(PageSpace* other);
+
private:
// Ids for time and data records in Heap::GCStats.
enum {
@@ -506,7 +511,7 @@
int64_t pre_safe_point);
void SweepLarge();
void Sweep();
- void ConcurrentSweep(Isolate* isolate);
+ void ConcurrentSweep(IsolateGroup* isolate_group);
void Compact(Thread* thread);
static intptr_t LargePageSizeInWordsFor(intptr_t size);
diff --git a/runtime/vm/heap/pointer_block.cc b/runtime/vm/heap/pointer_block.cc
index 19428f7..69bc1f5 100644
--- a/runtime/vm/heap/pointer_block.cc
+++ b/runtime/vm/heap/pointer_block.cc
@@ -105,10 +105,11 @@
if ((policy == kCheckThreshold) && Overflowed()) {
MutexLocker ml(&mutex_);
Thread* thread = Thread::Current();
- // Sanity check: it makes no sense to schedule the GC in another isolate.
+ // Sanity check: it makes no sense to schedule the GC in another isolate
+ // group.
// (If Isolate ever gets multiple store buffers, we should avoid this
// coupling by passing in an explicit callback+parameter at construction.)
- ASSERT(thread->isolate()->store_buffer() == this);
+ ASSERT(thread->isolate_group()->store_buffer() == this);
thread->ScheduleInterrupts(Thread::kVMInterrupt);
}
}
diff --git a/runtime/vm/heap/pointer_block.h b/runtime/vm/heap/pointer_block.h
index e9ace07..b5fa276 100644
--- a/runtime/vm/heap/pointer_block.h
+++ b/runtime/vm/heap/pointer_block.h
@@ -45,6 +45,8 @@
#if defined(TESTING)
bool Contains(RawObject* obj) const {
+ // Generated code appends to store buffers; tell MemorySanitizer.
+ MSAN_UNPOISON(this, sizeof(*this));
for (intptr_t i = 0; i < Count(); i++) {
if (pointers_[i] == obj) {
return true;
diff --git a/runtime/vm/heap/safepoint.cc b/runtime/vm/heap/safepoint.cc
index 3bf198b..2773fe8 100644
--- a/runtime/vm/heap/safepoint.cc
+++ b/runtime/vm/heap/safepoint.cc
@@ -14,11 +14,9 @@
SafepointOperationScope::SafepointOperationScope(Thread* T)
: ThreadStackResource(T) {
- ASSERT(T != NULL);
- Isolate* I = T->isolate();
- ASSERT(I != NULL);
+ ASSERT(T != nullptr && T->isolate_group() != nullptr);
- SafepointHandler* handler = I->group()->safepoint_handler();
+ SafepointHandler* handler = T->isolate_group()->safepoint_handler();
ASSERT(handler != NULL);
// Signal all threads to get to a safepoint and wait for them to
@@ -28,12 +26,10 @@
SafepointOperationScope::~SafepointOperationScope() {
Thread* T = thread();
- ASSERT(T != NULL);
- Isolate* I = T->isolate();
- ASSERT(I != NULL);
+ ASSERT(T != nullptr && T->isolate_group() != nullptr);
// Resume all threads which are blocked for the safepoint operation.
- SafepointHandler* handler = I->safepoint_handler();
+ SafepointHandler* handler = T->isolate_group()->safepoint_handler();
ASSERT(handler != NULL);
handler->ResumeThreads(T);
}
@@ -42,10 +38,10 @@
Thread* T)
: ThreadStackResource(T) {
ASSERT(T != NULL);
- Isolate* I = T->isolate();
- ASSERT(I != NULL);
+ IsolateGroup* IG = T->isolate_group();
+ ASSERT(IG != NULL);
- SafepointHandler* handler = I->group()->safepoint_handler();
+ SafepointHandler* handler = IG->safepoint_handler();
ASSERT(handler != NULL);
// Signal all threads to get to a safepoint and wait for them to
@@ -53,7 +49,7 @@
handler->SafepointThreads(T);
// N.B.: Change growth policy inside the safepoint to prevent racy access.
- Heap* heap = I->heap();
+ Heap* heap = IG->heap();
current_growth_controller_state_ = heap->GrowthControlState();
heap->DisableGrowthControl();
}
@@ -61,15 +57,15 @@
ForceGrowthSafepointOperationScope::~ForceGrowthSafepointOperationScope() {
Thread* T = thread();
ASSERT(T != NULL);
- Isolate* I = T->isolate();
- ASSERT(I != NULL);
+ IsolateGroup* IG = T->isolate_group();
+ ASSERT(IG != NULL);
// N.B.: Change growth policy inside the safepoint to prevent racy access.
- Heap* heap = I->heap();
+ Heap* heap = IG->heap();
heap->SetGrowthControlState(current_growth_controller_state_);
// Resume all threads which are blocked for the safepoint operation.
- SafepointHandler* handler = I->safepoint_handler();
+ SafepointHandler* handler = IG->safepoint_handler();
ASSERT(handler != NULL);
handler->ResumeThreads(T);
@@ -138,7 +134,6 @@
// Thread is not already at a safepoint so try to
// get it to a safepoint and wait for it to check in.
if (current->IsMutatorThread()) {
- ASSERT(T->isolate() != NULL);
current->ScheduleInterruptsLocked(Thread::kVMInterrupt);
}
MonitorLocker sl(&safepoint_lock_);
diff --git a/runtime/vm/heap/scavenger.cc b/runtime/vm/heap/scavenger.cc
index e90fc3c..d3c20b2 100644
--- a/runtime/vm/heap/scavenger.cc
+++ b/runtime/vm/heap/scavenger.cc
@@ -7,6 +7,7 @@
#include "vm/dart.h"
#include "vm/dart_api_state.h"
#include "vm/flag_list.h"
+#include "vm/heap/become.h"
#include "vm/heap/pointer_block.h"
#include "vm/heap/safepoint.h"
#include "vm/heap/verifier.h"
@@ -87,10 +88,10 @@
class ScavengerVisitor : public ObjectPointerVisitor {
public:
- explicit ScavengerVisitor(Isolate* isolate,
+ explicit ScavengerVisitor(IsolateGroup* isolate_group,
Scavenger* scavenger,
SemiSpace* from)
- : ObjectPointerVisitor(isolate),
+ : ObjectPointerVisitor(isolate_group),
thread_(Thread::Current()),
scavenger_(scavenger),
from_(from),
@@ -280,8 +281,8 @@
ScavengerWeakVisitor(Thread* thread, Scavenger* scavenger)
: HandleVisitor(thread),
scavenger_(scavenger),
- class_table_(thread->isolate()->shared_class_table()) {
- ASSERT(scavenger->heap_->isolate() == thread->isolate());
+ class_table_(thread->isolate_group()->class_table()) {
+ ASSERT(scavenger->heap_->isolate_group() == thread->isolate_group());
}
void VisitHandle(uword addr) {
@@ -289,9 +290,9 @@
reinterpret_cast<FinalizablePersistentHandle*>(addr);
RawObject** p = handle->raw_addr();
if (scavenger_->IsUnreachable(p)) {
- handle->UpdateUnreachable(thread()->isolate());
+ handle->UpdateUnreachable(thread()->isolate_group());
} else {
- handle->UpdateRelocated(thread()->isolate());
+ handle->UpdateRelocated(thread()->isolate_group());
}
}
@@ -302,28 +303,6 @@
DISALLOW_COPY_AND_ASSIGN(ScavengerWeakVisitor);
};
-// Visitor used to verify that all old->new references have been added to the
-// StoreBuffers.
-class VerifyStoreBufferPointerVisitor : public ObjectPointerVisitor {
- public:
- VerifyStoreBufferPointerVisitor(Isolate* isolate, const SemiSpace* to)
- : ObjectPointerVisitor(isolate), to_(to) {}
-
- void VisitPointers(RawObject** first, RawObject** last) {
- for (RawObject** current = first; current <= last; current++) {
- RawObject* obj = *current;
- if (obj->IsHeapObject() && obj->IsNewObject()) {
- ASSERT(to_->Contains(RawObject::ToAddr(obj)));
- }
- }
- }
-
- private:
- const SemiSpace* to_;
-
- DISALLOW_COPY_AND_ASSIGN(VerifyStoreBufferPointerVisitor);
-};
-
SemiSpace::SemiSpace(VirtualMemory* reserved)
: reserved_(reserved), region_(NULL, 0) {
if (reserved != NULL) {
@@ -475,8 +454,104 @@
}
}
-SemiSpace* Scavenger::Prologue(Isolate* isolate) {
- isolate->ReleaseStoreBuffers();
+class CollectStoreBufferVisitor : public ObjectPointerVisitor {
+ public:
+ explicit CollectStoreBufferVisitor(ObjectSet* in_store_buffer)
+ : ObjectPointerVisitor(IsolateGroup::Current()),
+ in_store_buffer_(in_store_buffer) {}
+
+ void VisitPointers(RawObject** from, RawObject** to) {
+ for (RawObject** ptr = from; ptr <= to; ptr++) {
+ RawObject* raw_obj = *ptr;
+ RELEASE_ASSERT(!raw_obj->IsCardRemembered());
+ RELEASE_ASSERT(raw_obj->IsRemembered());
+ RELEASE_ASSERT(raw_obj->IsOldObject());
+ in_store_buffer_->Add(raw_obj);
+ }
+ }
+
+ private:
+ ObjectSet* const in_store_buffer_;
+};
+
+class CheckStoreBufferVisitor : public ObjectVisitor,
+ public ObjectPointerVisitor {
+ public:
+ CheckStoreBufferVisitor(ObjectSet* in_store_buffer, const SemiSpace* to)
+ : ObjectVisitor(),
+ ObjectPointerVisitor(IsolateGroup::Current()),
+ in_store_buffer_(in_store_buffer),
+ to_(to) {}
+
+ void VisitObject(RawObject* raw_obj) {
+ if (raw_obj->IsPseudoObject()) return;
+ RELEASE_ASSERT(raw_obj->IsOldObject());
+
+ if (raw_obj->IsCardRemembered()) {
+ RELEASE_ASSERT(!raw_obj->IsRemembered());
+ // TODO(rmacnak): Verify card tables.
+ return;
+ }
+
+ RELEASE_ASSERT(raw_obj->IsRemembered() ==
+ in_store_buffer_->Contains(raw_obj));
+
+ visiting_ = raw_obj;
+ is_remembered_ = raw_obj->IsRemembered();
+ raw_obj->VisitPointers(this);
+ }
+
+ void VisitPointers(RawObject** from, RawObject** to) {
+ for (RawObject** ptr = from; ptr <= to; ptr++) {
+ RawObject* raw_obj = *ptr;
+ if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) {
+ if (!is_remembered_) {
+ FATAL3(
+ "Old object %p references new object %p, but it is not in any"
+ " store buffer. Consider using rr to watch the slot %p and "
+ "reverse-continue to find the store with a missing barrier.\n",
+ visiting_, raw_obj, ptr);
+ }
+ RELEASE_ASSERT(to_->Contains(RawObject::ToAddr(raw_obj)));
+ }
+ }
+ }
+
+ private:
+ const ObjectSet* const in_store_buffer_;
+ const SemiSpace* const to_;
+ RawObject* visiting_;
+ bool is_remembered_;
+};
+
+void Scavenger::VerifyStoreBuffers() {
+ Thread* thread = Thread::Current();
+ StackZone stack_zone(thread);
+ Zone* zone = stack_zone.GetZone();
+
+ ObjectSet* in_store_buffer = new (zone) ObjectSet(zone);
+ heap_->AddRegionsToObjectSet(in_store_buffer);
+
+ {
+ CollectStoreBufferVisitor visitor(in_store_buffer);
+ heap_->isolate_group()->store_buffer()->VisitObjectPointers(&visitor);
+ }
+
+ {
+ CheckStoreBufferVisitor visitor(in_store_buffer, to_);
+ heap_->old_space()->VisitObjects(&visitor);
+ }
+}
+
+SemiSpace* Scavenger::Prologue(IsolateGroup* isolate_group) {
+ isolate_group->ReleaseStoreBuffers();
+
+ if (FLAG_verify_store_buffer) {
+ OS::PrintErr("Verifying remembered set before Scavenge...");
+ heap_->WaitForSweeperTasksAtSafepoint(Thread::Current());
+ VerifyStoreBuffers();
+ OS::PrintErr(" done.\n");
+ }
// Flip the two semi-spaces so that to_ is always the space for allocating
// objects.
@@ -497,14 +572,18 @@
return from;
}
-void Scavenger::Epilogue(Isolate* isolate, SemiSpace* from) {
+void Scavenger::Epilogue(IsolateGroup* isolate_group, SemiSpace* from) {
// All objects in the to space have been copied from the from space at this
// moment.
// Ensure the mutator thread will fail the next allocation. This will force
// mutator to allocate a new TLAB
- Thread* mutator_thread = isolate->mutator_thread();
- ASSERT((mutator_thread == NULL) || (!mutator_thread->HasActiveTLAB()));
+ isolate_group->ForEachIsolate(
+ [&](Isolate* isolate) {
+ Thread* mutator_thread = isolate->mutator_thread();
+ ASSERT((mutator_thread == NULL) || (!mutator_thread->HasActiveTLAB()));
+ },
+ /*at_safepoint=*/true);
double avg_frac = stats_history_.Get(0).PromoCandidatesSuccessFraction();
if (stats_history_.Size() >= 2) {
@@ -559,19 +638,22 @@
idle_scavenge_threshold_in_words_ = upper_bound;
}
-#if defined(DEBUG)
- // We can only safely verify the store buffers from old space if there is no
- // concurrent old space task. At the same time we prevent new tasks from
- // being spawned.
- {
- PageSpace* page_space = heap_->old_space();
- MonitorLocker ml(page_space->tasks_lock());
- if (page_space->tasks() == 0) {
- VerifyStoreBufferPointerVisitor verify_store_buffer_visitor(isolate, to_);
- heap_->old_space()->VisitObjectPointers(&verify_store_buffer_visitor);
- }
+ if (FLAG_verify_store_buffer) {
+ // Scavenging will insert into the store buffer block on the current
+ // thread (later will parallel scavenge, the worker's threads). We need to
+ // flush this thread-local block to the isolate group or we will incorrectly
+ // report some objects as absent from the store buffer. This might cause
+ // a program to hit a store buffer overflow a bit sooner than it might
+ // otherwise, since overflow is measured in blocks. Store buffer overflows
+ // are very rare.
+ isolate_group->ReleaseStoreBuffers();
+
+ OS::PrintErr("Verifying remembered set after Scavenge...");
+ heap_->WaitForSweeperTasksAtSafepoint(Thread::Current());
+ VerifyStoreBuffers();
+ OS::PrintErr(" done.\n");
}
-#endif // defined(DEBUG)
+
from->Delete();
UpdateMaxHeapUsage();
if (heap_ != NULL) {
@@ -595,11 +677,11 @@
return estimated_scavenge_completion <= deadline;
}
-void Scavenger::IterateStoreBuffers(Isolate* isolate,
+void Scavenger::IterateStoreBuffers(IsolateGroup* isolate_group,
ScavengerVisitor* visitor) {
// Iterating through the store buffers.
// Grab the deduplication sets out of the isolate's consolidated store buffer.
- StoreBufferBlock* pending = isolate->store_buffer()->Blocks();
+ StoreBufferBlock* pending = isolate_group->store_buffer()->Blocks();
intptr_t total_count = 0;
while (pending != NULL) {
StoreBufferBlock* next = pending->next();
@@ -617,7 +699,8 @@
}
pending->Reset();
// Return the emptied block for recycling (no need to check threshold).
- isolate->store_buffer()->PushBlock(pending, StoreBuffer::kIgnoreThreshold);
+ isolate_group->store_buffer()->PushBlock(pending,
+ StoreBuffer::kIgnoreThreshold);
pending = next;
}
@@ -631,29 +714,34 @@
visitor->VisitingOldObject(NULL);
}
-void Scavenger::IterateObjectIdTable(Isolate* isolate,
+void Scavenger::IterateObjectIdTable(IsolateGroup* isolate_group,
ScavengerVisitor* visitor) {
#ifndef PRODUCT
- isolate->object_id_ring()->VisitPointers(visitor);
+ isolate_group->ForEachIsolate(
+ [&](Isolate* isolate) {
+ isolate->object_id_ring()->VisitPointers(visitor);
+ },
+ /*at_safepoint=*/true);
#endif // !PRODUCT
}
-void Scavenger::IterateRoots(Isolate* isolate, ScavengerVisitor* visitor) {
+void Scavenger::IterateRoots(IsolateGroup* isolate_group,
+ ScavengerVisitor* visitor) {
#ifdef SUPPORT_TIMELINE
Thread* thread = Thread::Current();
#endif
int64_t start = OS::GetCurrentMonotonicMicros();
{
TIMELINE_FUNCTION_GC_DURATION(thread, "ProcessRoots");
- isolate->VisitObjectPointers(visitor,
- ValidationPolicy::kDontValidateFrames);
+ isolate_group->VisitObjectPointers(visitor,
+ ValidationPolicy::kDontValidateFrames);
}
int64_t middle = OS::GetCurrentMonotonicMicros();
{
TIMELINE_FUNCTION_GC_DURATION(thread, "ProcessRememberedSet");
- IterateStoreBuffers(isolate, visitor);
+ IterateStoreBuffers(isolate_group, visitor);
}
- IterateObjectIdTable(isolate, visitor);
+ IterateObjectIdTable(isolate_group, visitor);
int64_t end = OS::GetCurrentMonotonicMicros();
heap_->RecordData(kToKBAfterStoreBuffer, RoundWordsToKB(UsedInWords()));
heap_->RecordTime(kVisitIsolateRoots, middle - start);
@@ -682,8 +770,9 @@
return true;
}
-void Scavenger::IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor) {
- isolate->VisitWeakPersistentHandles(visitor);
+void Scavenger::IterateWeakRoots(IsolateGroup* isolate_group,
+ HandleVisitor* visitor) {
+ isolate_group->VisitWeakPersistentHandles(visitor);
}
void Scavenger::ProcessToSpace(ScavengerVisitor* visitor) {
@@ -767,10 +856,10 @@
}
ASSERT(to_ != NULL);
ASSERT(heap_ != NULL);
- Isolate* isolate = heap_->isolate();
- ASSERT(isolate != NULL);
- isolate->GetHeapNewCapacityMaxMetric()->SetValue(to_->size_in_words() *
- kWordSize);
+ auto isolate_group = heap_->isolate_group();
+ ASSERT(isolate_group != NULL);
+ isolate_group->GetHeapNewCapacityMaxMetric()->SetValue(to_->size_in_words() *
+ kWordSize);
#endif // !defined(PRODUCT)
}
@@ -782,9 +871,9 @@
}
ASSERT(to_ != NULL);
ASSERT(heap_ != NULL);
- Isolate* isolate = heap_->isolate();
- ASSERT(isolate != NULL);
- isolate->GetHeapNewUsedMaxMetric()->SetValue(UsedInWords() * kWordSize);
+ auto isolate_group = heap_->isolate_group();
+ ASSERT(isolate_group != NULL);
+ isolate_group->GetHeapNewUsedMaxMetric()->SetValue(UsedInWords() * kWordSize);
#endif // !defined(PRODUCT)
}
@@ -859,13 +948,16 @@
// Each isolate might have a weak table used for fast snapshot writing (i.e.
// isolate communication). Rehash those tables if need be.
- auto isolate = heap_->isolate();
- auto table = isolate->forward_table_new();
- if (table != NULL) {
- auto replacement = WeakTable::NewFrom(table);
- rehash_weak_table(table, replacement, isolate->forward_table_old());
- isolate->set_forward_table_new(replacement);
- }
+ heap_->isolate_group()->ForEachIsolate(
+ [&](Isolate* isolate) {
+ auto table = isolate->forward_table_new();
+ if (table != nullptr) {
+ auto replacement = WeakTable::NewFrom(table);
+ rehash_weak_table(table, replacement, isolate->forward_table_old());
+ isolate->set_forward_table_new(replacement);
+ }
+ },
+ /*at_safepoint=*/true);
// The queued weak properties at this point do not refer to reachable keys,
// so we clear their key and value fields.
@@ -898,45 +990,41 @@
ASSERT(Thread::Current()->IsAtSafepoint() ||
(Thread::Current()->task_kind() == Thread::kMarkerTask) ||
(Thread::Current()->task_kind() == Thread::kCompactorTask));
- Isolate* isolate = heap_->isolate();
- MonitorLocker ml(isolate->threads_lock(), false);
- Thread* current = heap_->isolate()->thread_registry()->active_list();
+ auto isolate_group = heap_->isolate_group();
+ MonitorLocker ml(isolate_group->threads_lock(), false);
+ Thread* current = heap_->isolate_group()->thread_registry()->active_list();
while (current != NULL) {
- // NOTE: During the transition period all isolates within an isolate group
- // share the thread registry, but have their own heap.
- // So we explicitly filter those threads which belong to the isolate of
- // interest (once we have a shared heap this needs to change).
- if (current->isolate() == isolate) {
- if (current->HasActiveTLAB()) {
- heap_->MakeTLABIterable(current);
- }
+ if (current->HasActiveTLAB()) {
+ heap_->new_space()->MakeTLABIterable(current);
}
current = current->next();
}
- Thread* mutator_thread = isolate->mutator_thread();
- if (mutator_thread != NULL) {
- heap_->MakeTLABIterable(mutator_thread);
- }
+ isolate_group->ForEachIsolate(
+ [&](Isolate* isolate) {
+ Thread* mutator_thread = isolate->mutator_thread();
+ if (mutator_thread != NULL) {
+ heap_->new_space()->MakeTLABIterable(mutator_thread);
+ }
+ },
+ /*at_safepoint=*/true);
}
-void Scavenger::AbandonTLABs(Isolate* isolate) {
+void Scavenger::AbandonTLABsLocked(IsolateGroup* isolate_group) {
ASSERT(Thread::Current()->IsAtSafepoint());
- MonitorLocker ml(isolate->threads_lock(), false);
- Thread* current = isolate->thread_registry()->active_list();
+ MonitorLocker ml(isolate_group->threads_lock(), false);
+ Thread* current = isolate_group->thread_registry()->active_list();
while (current != NULL) {
- // NOTE: During the transition period all isolates within an isolate group
- // share the thread registry, but have their own heap.
- // So we explicitly filter those threads which belong to the isolate of
- // interest (once we have a shared heap this needs to change).
- if (current->isolate() == isolate) {
- heap_->AbandonRemainingTLAB(current);
- }
+ AbandonRemainingTLABLocked(current);
current = current->next();
}
- Thread* mutator_thread = isolate->mutator_thread();
- if (mutator_thread != NULL) {
- heap_->AbandonRemainingTLAB(mutator_thread);
- }
+ isolate_group->ForEachIsolate(
+ [&](Isolate* isolate) {
+ Thread* mutator_thread = isolate->mutator_thread();
+ if (mutator_thread != NULL) {
+ AbandonRemainingTLABLocked(mutator_thread);
+ }
+ },
+ /*at_safepoint=*/true);
}
void Scavenger::VisitObjectPointers(ObjectPointerVisitor* visitor) const {
@@ -985,24 +1073,21 @@
return Object::null();
}
-uword Scavenger::TryAllocateNewTLAB(Thread* thread, intptr_t size) {
- ASSERT(Utils::IsAligned(size, kObjectAlignment));
+void Scavenger::TryAllocateNewTLAB(Thread* thread) {
ASSERT(heap_ != Dart::vm_isolate()->heap());
ASSERT(!scavenging_);
MutexLocker ml(&space_lock_);
+ AbandonRemainingTLABLocked(thread);
uword result = top_;
intptr_t remaining = end_ - top_;
+ intptr_t size = kTLABSize;
if (remaining < size) {
// Grab whatever is remaining
- size = remaining;
- } else {
- // Reduce TLAB size so we land at even TLAB size for future TLABs.
- intptr_t survived_size = UsedInWords() * kWordSize;
- size -= survived_size % size;
+ size = Utils::RoundDown(remaining, kObjectAlignment);
}
- size = Utils::RoundDown(size, kObjectAlignment);
+ ASSERT(Utils::IsAligned(size, kObjectAlignment));
if (size == 0) {
- return 0;
+ return;
}
ASSERT(to_->Contains(result));
ASSERT((result & kObjectAlignmentMask) == kNewObjectAlignmentOffset);
@@ -1011,11 +1096,37 @@
ASSERT(result < top_);
thread->set_top(result);
thread->set_end(top_);
- return result;
+}
+
+void Scavenger::MakeTLABIterable(Thread* thread) {
+ uword start = thread->top();
+ uword end = thread->end();
+ ASSERT(end >= start);
+ intptr_t size = end - start;
+ ASSERT(Utils::IsAligned(size, kObjectAlignment));
+ if (size >= kObjectAlignment) {
+ // ForwardingCorpse(forwarding to default null) will work as filler.
+ ForwardingCorpse::AsForwarder(start, size);
+ ASSERT(RawObject::FromAddr(start)->HeapSize() == size);
+ }
+}
+
+void Scavenger::AbandonRemainingTLAB(Thread* thread) {
+ MakeTLABIterable(thread);
+ AddAbandonedInBytes(thread->end() - thread->top());
+ thread->set_top(0);
+ thread->set_end(0);
+}
+
+void Scavenger::AbandonRemainingTLABLocked(Thread* thread) {
+ MakeTLABIterable(thread);
+ AddAbandonedInBytesLocked(thread->end() - thread->top());
+ thread->set_top(0);
+ thread->set_end(0);
}
void Scavenger::Scavenge() {
- Isolate* isolate = heap_->isolate();
+ auto isolate_group = heap_->isolate_group();
// Ensure that all threads for this isolate are at a safepoint (either stopped
// or in native code). If two threads are racing at this point, the loser
// will continue with its scavenge after waiting for the winner to complete.
@@ -1039,29 +1150,29 @@
int64_t safe_point = OS::GetCurrentMonotonicMicros();
heap_->RecordTime(kSafePoint, safe_point - start);
- // TODO(koda): Make verification more compatible with concurrent sweep.
- if (FLAG_verify_before_gc && !FLAG_concurrent_sweep) {
+ if (FLAG_verify_before_gc) {
OS::PrintErr("Verifying before Scavenge...");
- heap_->VerifyGC(kForbidMarked);
+ heap_->WaitForSweeperTasksAtSafepoint(thread);
+ heap_->VerifyGC(thread->is_marking() ? kAllowMarked : kForbidMarked);
OS::PrintErr(" done.\n");
}
// Prepare for a scavenge.
- AbandonTLABs(isolate);
+ AbandonTLABsLocked(isolate_group);
intptr_t abandoned_bytes = GetAndResetAbandonedInBytes();
SpaceUsage usage_before = GetCurrentUsage();
intptr_t promo_candidate_words =
(survivor_end_ - FirstObjectStart()) / kWordSize;
- SemiSpace* from = Prologue(isolate);
+ SemiSpace* from = Prologue(isolate_group);
// The API prologue/epilogue may create/destroy zones, so we must not
// depend on zone allocations surviving beyond the epilogue callback.
{
StackZone zone(thread);
// Setup the visitor and run the scavenge.
- ScavengerVisitor visitor(isolate, this, from);
+ ScavengerVisitor visitor(isolate_group, this, from);
page_space->AcquireDataLock();
- IterateRoots(isolate, &visitor);
+ IterateRoots(isolate_group, &visitor);
int64_t iterate_roots = OS::GetCurrentMonotonicMicros();
{
TIMELINE_FUNCTION_GC_DURATION(thread, "ProcessToSpace");
@@ -1071,7 +1182,7 @@
{
TIMELINE_FUNCTION_GC_DURATION(thread, "ProcessWeakHandles");
ScavengerWeakVisitor weak_visitor(thread, this);
- IterateWeakRoots(isolate, &weak_visitor);
+ IterateWeakRoots(isolate_group, &weak_visitor);
}
ProcessWeakReferences();
page_space->ReleaseDataLock();
@@ -1085,12 +1196,12 @@
visitor.bytes_promoted() >> kWordSizeLog2,
abandoned_bytes >> kWordSizeLog2));
}
- Epilogue(isolate, from);
+ Epilogue(isolate_group, from);
- // TODO(koda): Make verification more compatible with concurrent sweep.
- if (FLAG_verify_after_gc && !FLAG_concurrent_sweep) {
+ if (FLAG_verify_after_gc) {
OS::PrintErr("Verifying after Scavenge...");
- heap_->VerifyGC(kForbidMarked);
+ heap_->WaitForSweeperTasksAtSafepoint(thread);
+ heap_->VerifyGC(thread->is_marking() ? kAllowMarked : kForbidMarked);
OS::PrintErr(" done.\n");
}
@@ -1106,15 +1217,15 @@
#ifndef PRODUCT
void Scavenger::PrintToJSONObject(JSONObject* object) const {
- Isolate* isolate = Isolate::Current();
- ASSERT(isolate != NULL);
+ auto isolate_group = IsolateGroup::Current();
+ ASSERT(isolate_group != nullptr);
JSONObject space(object, "new");
space.AddProperty("type", "HeapSpace");
space.AddProperty("name", "new");
space.AddProperty("vmName", "Scavenger");
space.AddProperty("collections", collections());
if (collections() > 0) {
- int64_t run_time = isolate->UptimeMicros();
+ int64_t run_time = isolate_group->UptimeMicros();
run_time = Utils::Maximum(run_time, static_cast<int64_t>(0));
double run_time_millis = MicrosecondsToMilliseconds(run_time);
double avg_time_between_collections =
diff --git a/runtime/vm/heap/scavenger.h b/runtime/vm/heap/scavenger.h
index e314409..ff12b6b 100644
--- a/runtime/vm/heap/scavenger.h
+++ b/runtime/vm/heap/scavenger.h
@@ -129,7 +129,16 @@
RawObject* FindObject(FindObjectVisitor* visitor) const;
- uword TryAllocateNewTLAB(Thread* thread, intptr_t size);
+ uword TryAllocate(Thread* thread, intptr_t size) {
+ uword addr = TryAllocateFromTLAB(thread, size);
+ if (LIKELY(addr != 0)) {
+ return addr;
+ }
+ TryAllocateNewTLAB(thread);
+ return TryAllocateFromTLAB(thread, size);
+ }
+ void MakeTLABIterable(Thread* thread);
+ void AbandonRemainingTLAB(Thread* thread);
uword AllocateGC(intptr_t size) {
ASSERT(Utils::IsAligned(size, kObjectAlignment));
@@ -148,24 +157,6 @@
return result;
}
- uword TryAllocateInTLAB(Thread* thread, intptr_t size) {
- ASSERT(Utils::IsAligned(size, kObjectAlignment));
- ASSERT(heap_ != Dart::vm_isolate()->heap());
- uword top = thread->top();
- uword end = thread->end();
- uword result = top;
- intptr_t remaining = end - top;
- if (remaining < size) {
- return 0;
- }
- ASSERT(to_->Contains(result));
- ASSERT((result & kObjectAlignmentMask) == kNewObjectAlignmentOffset);
- top += size;
- ASSERT((to_->Contains(top)) || (top == to_->end()));
- thread->set_top(top);
- return result;
- }
-
// Collect the garbage in this scavenger.
void Scavenge();
@@ -183,7 +174,10 @@
// Report (TLAB) abandoned bytes that should be taken account when
// deciding whether to grow new space or not.
- void AddAbandonedInBytes(intptr_t value) { abandoned_ += value; }
+ void AddAbandonedInBytes(intptr_t value) {
+ MutexLocker ml(&space_lock_);
+ AddAbandonedInBytesLocked(value);
+ }
int64_t GetAndResetAbandonedInBytes() {
int64_t result = abandoned_;
abandoned_ = 0;
@@ -191,6 +185,7 @@
}
int64_t UsedInWords() const {
+ MutexLocker ml(&space_lock_);
return (top_ - FirstObjectStart()) >> kWordSizeLog2;
}
int64_t CapacityInWords() const { return to_->size_in_words(); }
@@ -229,9 +224,10 @@
void MakeNewSpaceIterable() const;
int64_t FreeSpaceInWords(Isolate* isolate) const;
- void AbandonTLABs(Isolate* isolate);
private:
+ static const intptr_t kTLABSize = 512 * KB;
+
// Ids for time and data records in Heap::GCStats.
enum {
// Time
@@ -248,24 +244,52 @@
kToKBAfterStoreBuffer = 3
};
+ uword TryAllocateFromTLAB(Thread* thread, intptr_t size) {
+ ASSERT(Utils::IsAligned(size, kObjectAlignment));
+ ASSERT(heap_ != Dart::vm_isolate()->heap());
+ uword top = thread->top();
+ uword end = thread->end();
+ uword result = top;
+ intptr_t remaining = end - top;
+ if (UNLIKELY(remaining < size)) {
+ return 0;
+ }
+ ASSERT(to_->Contains(result));
+ ASSERT((result & kObjectAlignmentMask) == kNewObjectAlignmentOffset);
+ top += size;
+ ASSERT((to_->Contains(top)) || (top == to_->end()));
+ thread->set_top(top);
+ return result;
+ }
+ void TryAllocateNewTLAB(Thread* thread);
+ void AddAbandonedInBytesLocked(intptr_t value) { abandoned_ += value; }
+ void AbandonRemainingTLABLocked(Thread* thread);
+ void AbandonTLABsLocked(IsolateGroup* isolate_group);
+
uword FirstObjectStart() const {
return to_->start() + kNewObjectAlignmentOffset;
}
- SemiSpace* Prologue(Isolate* isolate);
- void IterateStoreBuffers(Isolate* isolate, ScavengerVisitor* visitor);
- void IterateObjectIdTable(Isolate* isolate, ScavengerVisitor* visitor);
- void IterateRoots(Isolate* isolate, ScavengerVisitor* visitor);
- void IterateWeakProperties(Isolate* isolate, ScavengerVisitor* visitor);
- void IterateWeakReferences(Isolate* isolate, ScavengerVisitor* visitor);
- void IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor);
+ SemiSpace* Prologue(IsolateGroup* isolate_group);
+ void IterateStoreBuffers(IsolateGroup* isolate_group,
+ ScavengerVisitor* visitor);
+ void IterateObjectIdTable(IsolateGroup* isolate_group,
+ ScavengerVisitor* visitor);
+ void IterateRoots(IsolateGroup* isolate_group, ScavengerVisitor* visitor);
+ void IterateWeakProperties(IsolateGroup* isolate_group,
+ ScavengerVisitor* visitor);
+ void IterateWeakReferences(IsolateGroup* isolate_group,
+ ScavengerVisitor* visitor);
+ void IterateWeakRoots(IsolateGroup* isolate_group, HandleVisitor* visitor);
void ProcessToSpace(ScavengerVisitor* visitor);
void EnqueueWeakProperty(RawWeakProperty* raw_weak);
uword ProcessWeakProperty(RawWeakProperty* raw_weak,
ScavengerVisitor* visitor);
- void Epilogue(Isolate* isolate, SemiSpace* from);
+ void Epilogue(IsolateGroup* isolate_group, SemiSpace* from);
bool IsUnreachable(RawObject** p);
+ void VerifyStoreBuffers();
+
// During a scavenge we need to remember the promoted objects.
// This is implemented as a stack of objects at the end of the to space. As
// object sizes are always greater than sizeof(uword) and promoted objects do
@@ -335,7 +359,7 @@
bool failed_to_promote_;
// Protects new space during the allocation of new TLABs
- Mutex space_lock_;
+ mutable Mutex space_lock_;
friend class ScavengerVisitor;
friend class ScavengerWeakVisitor;
diff --git a/runtime/vm/heap/sweeper.cc b/runtime/vm/heap/sweeper.cc
index 8f23e7f..405357d 100644
--- a/runtime/vm/heap/sweeper.cc
+++ b/runtime/vm/heap/sweeper.cc
@@ -106,21 +106,21 @@
class ConcurrentSweeperTask : public ThreadPool::Task {
public:
- ConcurrentSweeperTask(Isolate* isolate,
+ ConcurrentSweeperTask(IsolateGroup* isolate_group,
PageSpace* old_space,
HeapPage* first,
HeapPage* last,
HeapPage* large_first,
HeapPage* large_last,
FreeList* freelist)
- : task_isolate_(isolate),
+ : task_isolate_group_(isolate_group),
old_space_(old_space),
first_(first),
last_(last),
large_first_(large_first),
large_last_(large_last),
freelist_(freelist) {
- ASSERT(task_isolate_ != NULL);
+ ASSERT(task_isolate_group_ != NULL);
ASSERT(first_ != NULL);
ASSERT(old_space_ != NULL);
ASSERT(last_ != NULL);
@@ -131,8 +131,8 @@
}
virtual void Run() {
- bool result =
- Thread::EnterIsolateAsHelper(task_isolate_, Thread::kSweeperTask, true);
+ bool result = Thread::EnterIsolateGroupAsHelper(
+ task_isolate_group_, Thread::kSweeperTask, /*bypass_safepoint=*/true);
ASSERT(result);
{
Thread* thread = Thread::Current();
@@ -197,7 +197,7 @@
}
}
// Exit isolate cleanly *before* notifying it, to avoid shutdown race.
- Thread::ExitIsolateAsHelper(true);
+ Thread::ExitIsolateGroupAsHelper(/*bypass_safepoint=*/true);
// This sweeper task is done. Notify the original isolate.
{
MonitorLocker ml(old_space_->tasks_lock());
@@ -209,7 +209,7 @@
}
private:
- Isolate* task_isolate_;
+ IsolateGroup* task_isolate_group_;
PageSpace* old_space_;
HeapPage* first_;
HeapPage* last_;
@@ -218,15 +218,15 @@
FreeList* freelist_;
};
-void GCSweeper::SweepConcurrent(Isolate* isolate,
+void GCSweeper::SweepConcurrent(IsolateGroup* isolate_group,
HeapPage* first,
HeapPage* last,
HeapPage* large_first,
HeapPage* large_last,
FreeList* freelist) {
bool result = Dart::thread_pool()->Run<ConcurrentSweeperTask>(
- isolate, isolate->heap()->old_space(), first, last, large_first,
- large_last, freelist);
+ isolate_group, isolate_group->heap()->old_space(), first, last,
+ large_first, large_last, freelist);
ASSERT(result);
}
diff --git a/runtime/vm/heap/sweeper.h b/runtime/vm/heap/sweeper.h
index 068a30d..60d3d3c 100644
--- a/runtime/vm/heap/sweeper.h
+++ b/runtime/vm/heap/sweeper.h
@@ -13,7 +13,7 @@
class FreeList;
class Heap;
class HeapPage;
-class Isolate;
+class IsolateGroup;
class PageSpace;
// The class GCSweeper is used to visit the heap after marking to reclaim unused
@@ -35,7 +35,7 @@
intptr_t SweepLargePage(HeapPage* page);
// Sweep the regular sized data pages between first and last inclusive.
- static void SweepConcurrent(Isolate* isolate,
+ static void SweepConcurrent(IsolateGroup* isolate_group,
HeapPage* first,
HeapPage* last,
HeapPage* large_first,
diff --git a/runtime/vm/heap/verifier.cc b/runtime/vm/heap/verifier.cc
index 237777e..12762ec 100644
--- a/runtime/vm/heap/verifier.cc
+++ b/runtime/vm/heap/verifier.cc
@@ -41,7 +41,7 @@
}
}
allocated_set_->Add(raw_obj);
- raw_obj->Validate(isolate_);
+ raw_obj->Validate(isolate_group_);
}
void VerifyPointersVisitor::VisitPointers(RawObject** first, RawObject** last) {
@@ -69,18 +69,19 @@
void VerifyPointersVisitor::VerifyPointers(MarkExpectation mark_expectation) {
Thread* thread = Thread::Current();
- Isolate* isolate = thread->isolate();
+ auto isolate_group = thread->isolate_group();
HeapIterationScope iteration(thread);
StackZone stack_zone(thread);
- ObjectSet* allocated_set = isolate->heap()->CreateAllocatedObjectSet(
+ ObjectSet* allocated_set = isolate_group->heap()->CreateAllocatedObjectSet(
stack_zone.GetZone(), mark_expectation);
- VerifyPointersVisitor visitor(isolate, allocated_set);
+ VerifyPointersVisitor visitor(isolate_group, allocated_set);
// Visit all strongly reachable objects.
iteration.IterateObjectPointers(&visitor, ValidationPolicy::kValidateFrames);
VerifyWeakPointersVisitor weak_visitor(&visitor);
+
// Visit weak handles and prologue weak handles.
- isolate->VisitWeakPersistentHandles(&weak_visitor);
+ isolate_group->VisitWeakPersistentHandles(&weak_visitor);
}
#if defined(DEBUG)
@@ -88,16 +89,22 @@
: thread_(thread), instanceHandle_(Instance::Handle(thread->zone())) {}
void VerifyCanonicalVisitor::VisitObject(RawObject* obj) {
- if ((obj->GetClassId() >= kInstanceCid) &&
- (obj->GetClassId() != kTypeArgumentsCid)) {
- if (obj->IsCanonical()) {
- instanceHandle_ ^= obj;
- const bool is_canonical = instanceHandle_.CheckIsCanonical(thread_);
- if (!is_canonical) {
- OS::PrintErr("Instance `%s` is not canonical!\n",
- instanceHandle_.ToCString());
+ // TODO(dartbug.com/36097): The heap walk can encounter canonical objects of
+ // other isolates. We should either scan live objects from the roots of each
+ // individual isolate, or wait until we are ready to share constants across
+ // isolates.
+ if (!FLAG_enable_isolate_groups) {
+ if ((obj->GetClassId() >= kInstanceCid) &&
+ (obj->GetClassId() != kTypeArgumentsCid)) {
+ if (obj->IsCanonical()) {
+ instanceHandle_ ^= obj;
+ const bool is_canonical = instanceHandle_.CheckIsCanonical(thread_);
+ if (!is_canonical) {
+ OS::PrintErr("Instance `%s` is not canonical!\n",
+ instanceHandle_.ToCString());
+ }
+ ASSERT(is_canonical);
}
- ASSERT(is_canonical);
}
}
}
diff --git a/runtime/vm/heap/verifier.h b/runtime/vm/heap/verifier.h
index 23ca6b4..ae13e90 100644
--- a/runtime/vm/heap/verifier.h
+++ b/runtime/vm/heap/verifier.h
@@ -15,7 +15,7 @@
namespace dart {
// Forward declarations.
-class Isolate;
+class IsolateGroup;
class ObjectSet;
class RawObject;
@@ -23,17 +23,17 @@
class VerifyObjectVisitor : public ObjectVisitor {
public:
- VerifyObjectVisitor(Isolate* isolate,
+ VerifyObjectVisitor(IsolateGroup* isolate_group,
ObjectSet* allocated_set,
MarkExpectation mark_expectation)
- : isolate_(isolate),
+ : isolate_group_(isolate_group),
allocated_set_(allocated_set),
mark_expectation_(mark_expectation) {}
virtual void VisitObject(RawObject* obj);
private:
- Isolate* isolate_;
+ IsolateGroup* isolate_group_;
ObjectSet* allocated_set_;
MarkExpectation mark_expectation_;
@@ -44,8 +44,9 @@
// the pointers visited are contained in the isolate heap.
class VerifyPointersVisitor : public ObjectPointerVisitor {
public:
- explicit VerifyPointersVisitor(Isolate* isolate, ObjectSet* allocated_set)
- : ObjectPointerVisitor(isolate), allocated_set_(allocated_set) {}
+ explicit VerifyPointersVisitor(IsolateGroup* isolate_group,
+ ObjectSet* allocated_set)
+ : ObjectPointerVisitor(isolate_group), allocated_set_(allocated_set) {}
virtual void VisitPointers(RawObject** first, RawObject** last);
diff --git a/runtime/vm/heap/weak_table.cc b/runtime/vm/heap/weak_table.cc
index 95acc86..b4cf28d 100644
--- a/runtime/vm/heap/weak_table.cc
+++ b/runtime/vm/heap/weak_table.cc
@@ -132,4 +132,12 @@
free(old_data);
}
+void WeakTable::MergeOtherWeakTable(WeakTable* other) {
+ for (intptr_t i = 0; i < other->size(); i++) {
+ if (other->IsValidEntryAtExclusive(i)) {
+ SetValue(other->ObjectAtExclusive(i), ValueIndex(i));
+ }
+ }
+}
+
} // namespace dart
diff --git a/runtime/vm/heap/weak_table.h b/runtime/vm/heap/weak_table.h
index c1487b1..051051f 100644
--- a/runtime/vm/heap/weak_table.h
+++ b/runtime/vm/heap/weak_table.h
@@ -130,6 +130,8 @@
void Reset();
+ void MergeOtherWeakTable(WeakTable* other);
+
private:
enum {
kObjectOffset = 0,
diff --git a/runtime/vm/interpreter.cc b/runtime/vm/interpreter.cc
index d59dbfe..5262474 100644
--- a/runtime/vm/interpreter.cc
+++ b/runtime/vm/interpreter.cc
@@ -282,7 +282,7 @@
const uword start = thread->top();
#ifndef PRODUCT
- auto table = thread->isolate()->shared_class_table();
+ auto table = thread->isolate_group()->class_table();
if (UNLIKELY(table->TraceAllocationFor(class_id))) {
return false;
}
@@ -2804,13 +2804,13 @@
{
BYTECODE(NullCheck, D);
- SP -= 1;
if (UNLIKELY(SP[0] == null_value)) {
// Load selector.
SP[0] = LOAD_CONSTANT(rD);
goto ThrowNullError;
}
+ SP -= 1;
DISPATCH();
}
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index f7f4f8b..4b3e5e5 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -203,48 +203,137 @@
}
}
-IsolateGroup::IsolateGroup(std::unique_ptr<IsolateGroupSource> source,
+class FinalizeWeakPersistentHandlesVisitor : public HandleVisitor {
+ public:
+ explicit FinalizeWeakPersistentHandlesVisitor(IsolateGroup* isolate_group)
+ : HandleVisitor(Thread::Current()), isolate_group_(isolate_group) {}
+
+ void VisitHandle(uword addr) {
+ auto handle = reinterpret_cast<FinalizablePersistentHandle*>(addr);
+ handle->UpdateUnreachable(isolate_group_);
+ }
+
+ private:
+ IsolateGroup* isolate_group_;
+
+ DISALLOW_COPY_AND_ASSIGN(FinalizeWeakPersistentHandlesVisitor);
+};
+
+IsolateGroup::IsolateGroup(std::shared_ptr<IsolateGroupSource> source,
void* embedder_data)
: embedder_data_(embedder_data),
- isolates_rwlock_(new RwLock()),
+ isolates_lock_(new SafepointRwLock()),
isolates_(),
+ start_time_micros_(OS::GetCurrentMonotonicMicros()),
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
last_reload_timestamp_(OS::GetCurrentTimeMillis()),
#endif
source_(std::move(source)),
+ api_state_(new ApiState()),
thread_registry_(new ThreadRegistry()),
- safepoint_handler_(new SafepointHandler(this)) {
+ safepoint_handler_(new SafepointHandler(this)),
+ shared_class_table_(new SharedClassTable()),
+ store_buffer_(new StoreBuffer()),
+ heap_(nullptr) {
+ {
+ WriteRwLocker wl(ThreadState::Current(), isolate_groups_rwlock_);
+ id_ = isolate_group_random_->NextUInt64();
+ }
}
-IsolateGroup::~IsolateGroup() {}
+IsolateGroup::~IsolateGroup() {
+ // Finalize any weak persistent handles with a non-null referent.
+ FinalizeWeakPersistentHandlesVisitor visitor(this);
+ api_state()->VisitWeakHandlesUnlocked(&visitor);
+
+ // Ensure we destroy the heap before the other members.
+ heap_ = nullptr;
+ ASSERT(marking_stack_ == nullptr);
+}
void IsolateGroup::RegisterIsolate(Isolate* isolate) {
- WriteRwLocker wl(ThreadState::Current(), isolates_rwlock_.get());
+ SafepointWriteRwLocker ml(Thread::Current(), isolates_lock_.get());
+ RegisterIsolateLocked(isolate);
+}
+
+void IsolateGroup::RegisterIsolateLocked(Isolate* isolate) {
isolates_.Append(isolate);
isolate_count_++;
}
+bool IsolateGroup::ContainsOnlyOneIsolate() {
+ SafepointWriteRwLocker ml(Thread::Current(), isolates_lock_.get());
+ return isolate_count_ == 0;
+}
+
+void IsolateGroup::RunWithLockedGroup(std::function<void()> fun) {
+ SafepointReadRwLocker ml(Thread::Current(), isolates_lock_.get());
+ fun();
+}
+
void IsolateGroup::UnregisterIsolate(Isolate* isolate) {
- bool is_last_isolate = false;
- {
- WriteRwLocker wl(ThreadState::Current(), isolates_rwlock_.get());
- isolates_.Remove(isolate);
- isolate_count_--;
- is_last_isolate = isolate_count_ == 0;
- }
- if (is_last_isolate) {
- // If the creation of the isolate group (or the first isolate within the
- // isolate group) failed, we do not invoke the cleanup callback (the
- // embedder is responsible for handling the creation error).
- if (initial_spawn_successful_) {
- auto group_shutdown_callback = Isolate::GroupCleanupCallback();
- if (group_shutdown_callback != nullptr) {
- group_shutdown_callback(embedder_data());
- }
+ SafepointWriteRwLocker ml(Thread::Current(), isolates_lock_.get());
+ isolates_.Remove(isolate);
+}
+
+bool IsolateGroup::UnregisterIsolateDecrementCount(Isolate* isolate) {
+ SafepointWriteRwLocker ml(Thread::Current(), isolates_lock_.get());
+ isolate_count_--;
+ return isolate_count_ == 0;
+}
+
+void IsolateGroup::CreateHeap(bool is_vm_isolate,
+ bool is_service_or_kernel_isolate) {
+ Heap::Init(this,
+ is_vm_isolate
+ ? 0 // New gen size 0; VM isolate should only allocate in old.
+ : FLAG_new_gen_semi_max_size * MBInWords,
+ (is_service_or_kernel_isolate ? kDefaultMaxOldGenHeapSize
+ : FLAG_old_gen_heap_size) *
+ MBInWords);
+
+ is_vm_isolate_heap_ = is_vm_isolate;
+
+#if !defined(PRODUCT)
+#define ISOLATE_METRIC_CONSTRUCTORS(type, variable, name, unit) \
+ metric_##variable##_.InitInstance(this, name, nullptr, Metric::unit);
+ ISOLATE_GROUP_METRIC_LIST(ISOLATE_METRIC_CONSTRUCTORS)
+#undef ISOLATE_METRIC_CONSTRUCTORS
+#endif
+}
+
+void IsolateGroup::Shutdown() {
+ if (heap_ != nullptr) {
+ // Wait for any concurrent GC tasks to finish before shutting down.
+ // TODO(rmacnak): Interrupt tasks for faster shutdown.
+ PageSpace* old_space = heap_->old_space();
+ MonitorLocker ml(old_space->tasks_lock());
+ while (old_space->tasks() > 0) {
+ ml.Wait();
}
- UnregisterIsolateGroup(this);
- delete this;
+ // Needs to happen before ~PageSpace so TLS and the thread registery are
+ // still valid.
+ old_space->AbandonMarkingForShutdown();
}
+
+ UnregisterIsolateGroup(this);
+
+ // If the creation of the isolate group (or the first isolate within the
+ // isolate group) failed, we do not invoke the cleanup callback (the
+ // embedder is responsible for handling the creation error).
+ if (initial_spawn_successful_) {
+ auto group_shutdown_callback = Isolate::GroupCleanupCallback();
+ if (group_shutdown_callback != nullptr) {
+ group_shutdown_callback(embedder_data());
+ }
+ }
+
+ delete this;
+}
+
+void IsolateGroup::set_heap(std::unique_ptr<Heap> heap) {
+ idle_time_handler_.InitializeWithHeap(heap.get());
+ heap_ = std::move(heap);
}
Thread* IsolateGroup::ScheduleThreadLocked(MonitorLocker* ml,
@@ -289,6 +378,8 @@
thread->isolate_ = nullptr;
thread->isolate_group_ = this;
thread->field_table_values_ = nullptr;
+ ASSERT(heap() != nullptr);
+ thread->heap_ = heap();
thread->set_os_thread(os_thread);
ASSERT(thread->execution_state() == Thread::kThreadInNative);
thread->set_execution_state(Thread::kThreadInVM);
@@ -307,6 +398,13 @@
Thread* thread,
bool is_mutator,
bool bypass_safepoint) {
+ // Clear since GC will not visit the thread once it is unscheduled. Do this
+ // under the thread lock to prevent races with the GC visiting thread roots.
+ if (!is_mutator) {
+ thread->heap()->new_space()->AbandonRemainingTLAB(thread);
+ thread->ClearReusableHandles();
+ }
+
// Disassociate the 'Thread' structure and unschedule the thread
// from this isolate group.
if (!is_mutator) {
@@ -335,7 +433,8 @@
// All other threads are not allowed to unschedule themselves and schedule
// again later on.
if (!is_mutator) {
- thread->isolate_ = nullptr;
+ ASSERT(thread->isolate_ == nullptr);
+ thread->isolate_group_ = nullptr;
}
thread->heap_ = nullptr;
thread->set_os_thread(nullptr);
@@ -397,7 +496,7 @@
jsobj->AddProperty("type", (ref ? "@IsolateGroup" : "IsolateGroup"));
jsobj->AddServiceId(ISOLATE_GROUP_SERVICE_ID_FORMAT_STRING, id());
- jsobj->AddProperty("name", "isolate_group");
+ jsobj->AddProperty("name", source()->script_uri);
jsobj->AddPropertyF("number", "%" Pu64 "", id());
if (ref) {
return;
@@ -472,9 +571,12 @@
isolate_groups_rwlock_ = new RwLock();
ASSERT(isolate_groups_ == nullptr);
isolate_groups_ = new IntrusiveDList<IsolateGroup>();
+ isolate_group_random_ = new Random();
}
void IsolateGroup::Cleanup() {
+ delete isolate_group_random_;
+ isolate_group_random_ = nullptr;
delete isolate_groups_rwlock_;
isolate_groups_rwlock_ = nullptr;
ASSERT(isolate_groups_->IsEmpty());
@@ -1226,10 +1328,9 @@
current_tag_(UserTag::null()),
default_tag_(UserTag::null()),
ic_miss_code_(Code::null()),
- shared_class_table_(new SharedClassTable()),
- class_table_(shared_class_table_.get()),
+ class_table_(isolate_group->class_table()),
field_table_(new FieldTable()),
- store_buffer_(new StoreBuffer()),
+ isolate_group_(isolate_group),
#if !defined(DART_PRECOMPILED_RUNTIME)
native_callback_trampolines_(),
#endif
@@ -1244,6 +1345,9 @@
#undef ISOLATE_METRIC_CONSTRUCTORS
reload_every_n_stack_overflow_checks_(FLAG_reload_every),
#endif // !defined(PRODUCT)
+#if !defined(PRODUCT)
+ object_id_ring_(new ObjectIdRing()),
+#endif
start_time_micros_(OS::GetCurrentMonotonicMicros()),
random_(),
mutex_(NOT_IN_PRODUCT("Isolate::mutex_")),
@@ -1270,7 +1374,6 @@
catch_entry_moves_cache_() {
FlagsCopyFrom(api_flags);
SetErrorsFatal(true);
- set_compilation_allowed(true);
// TODO(asiva): A Thread is not available here, need to figure out
// how the vm_tag (kEmbedderTagId) can be set, these tags need to
// move to the OSThread structure.
@@ -1289,9 +1392,6 @@
}
NOT_IN_PRECOMPILED(optimizing_background_compiler_ =
new BackgroundCompiler(this, /* optimizing = */ true));
-
- isolate_group->RegisterIsolate(this);
- isolate_group_ = isolate_group;
}
#undef REUSABLE_HANDLE_SCOPE_INIT
@@ -1327,12 +1427,8 @@
#endif // !defined(PRODUCT)
free(name_);
- delete store_buffer_;
- delete heap_;
- ASSERT(marking_stack_ == nullptr);
delete object_store_;
delete field_table_;
- delete api_state_;
#if defined(USING_SIMULATOR)
delete simulator_;
#endif
@@ -1367,11 +1463,6 @@
}
delete[] embedder_entry_points_;
}
-
- // Run isolate group specific cleanup function if the last isolate in an
- // isolate group died.
- isolate_group_->UnregisterIsolate(this);
- isolate_group_ = nullptr;
}
void Isolate::InitVM() {
@@ -1380,10 +1471,10 @@
shutdown_callback_ = nullptr;
cleanup_callback_ = nullptr;
cleanup_group_callback_ = nullptr;
- if (isolates_list_monitor_ == nullptr) {
- isolates_list_monitor_ = new Monitor();
+ if (isolate_creation_monitor_ == nullptr) {
+ isolate_creation_monitor_ = new Monitor();
}
- ASSERT(isolates_list_monitor_ != nullptr);
+ ASSERT(isolate_creation_monitor_ != nullptr);
EnableIsolateCreation();
}
@@ -1392,6 +1483,7 @@
const Dart_IsolateFlags& api_flags,
bool is_vm_isolate) {
Isolate* result = new Isolate(isolate_group, api_flags);
+ result->BuildName(name_prefix);
ASSERT(result != nullptr);
#if !defined(PRODUCT)
@@ -1402,52 +1494,37 @@
#undef ISOLATE_METRIC_INIT
#endif // !defined(PRODUCT)
- bool is_service_or_kernel_isolate = false;
- if (ServiceIsolate::NameEquals(name_prefix)) {
- ASSERT(!ServiceIsolate::Exists());
- is_service_or_kernel_isolate = true;
- }
-#if !defined(DART_PRECOMPILED_RUNTIME)
- if (KernelIsolate::NameEquals(name_prefix)) {
- ASSERT(!KernelIsolate::Exists());
- KernelIsolate::SetKernelIsolate(result);
- is_service_or_kernel_isolate = true;
- }
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
- Heap::Init(result,
- is_vm_isolate
- ? 0 // New gen size 0; VM isolate should only allocate in old.
- : FLAG_new_gen_semi_max_size * MBInWords,
- (is_service_or_kernel_isolate ? kDefaultMaxOldGenHeapSize
- : FLAG_old_gen_heap_size) *
- MBInWords);
-
- // TODO(5411455): For now just set the recently created isolate as
- // the current isolate.
+ // First we ensure we enter the isolate. This will ensure we're participating
+ // in any safepointing requests from this point on. Other threads requesting a
+ // safepoint operation will therefore wait until we've stopped.
+ //
+ // Though the [result] isolate is still in a state where no memory has been
+ // allocated, which means it's safe to GC the isolate group until here.
if (!Thread::EnterIsolate(result)) {
- // We failed to enter the isolate, it is possible the VM is shutting down,
- // return back a NULL so that CreateIsolate reports back an error.
- if (KernelIsolate::IsKernelIsolate(result)) {
- KernelIsolate::SetKernelIsolate(nullptr);
- }
- if (ServiceIsolate::IsServiceIsolate(result)) {
- ServiceIsolate::SetServiceIsolate(nullptr);
- }
delete result;
return nullptr;
}
+ // Now we register the isolate in the group. From this point on any GC would
+ // traverse the isolate roots (before this point, the roots are only pointing
+ // to vm-isolate objects, e.g. null)
+ isolate_group->RegisterIsolate(result);
+
+ if (ServiceIsolate::NameEquals(name_prefix)) {
+ ASSERT(!ServiceIsolate::Exists());
+ ServiceIsolate::SetServiceIsolate(result);
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ } else if (KernelIsolate::NameEquals(name_prefix)) {
+ ASSERT(!KernelIsolate::Exists());
+ KernelIsolate::SetKernelIsolate(result);
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+ }
+
// Setup the isolate message handler.
MessageHandler* handler = new IsolateMessageHandler(result);
ASSERT(handler != nullptr);
result->set_message_handler(handler);
- // Setup the Dart API state.
- ApiState* state = new ApiState();
- ASSERT(state != nullptr);
- result->set_api_state(state);
-
result->set_main_port(PortMap::CreatePort(result->message_handler()));
#if defined(DEBUG)
// Verify that we are never reusing a live origin id.
@@ -1458,7 +1535,6 @@
result->set_pause_capability(result->random()->NextUInt64());
result->set_terminate_capability(result->random()->NextUInt64());
- result->BuildName(name_prefix);
#if !defined(PRODUCT)
result->debugger_ = new Debugger(result);
#endif
@@ -1471,22 +1547,10 @@
}
}
-#ifndef PRODUCT
- ObjectIdRing::Init(result);
-#endif // !PRODUCT
-
// Add to isolate list. Shutdown and delete the isolate on failure.
- if (!AddIsolateToList(result)) {
+ if (!TryMarkIsolateReady(result)) {
result->LowLevelShutdown();
- Thread::ExitIsolate();
- if (KernelIsolate::IsKernelIsolate(result)) {
- KernelIsolate::SetKernelIsolate(nullptr);
- }
- if (ServiceIsolate::IsServiceIsolate(result)) {
- ServiceIsolate::SetServiceIsolate(nullptr);
- }
-
- delete result;
+ Isolate::LowLevelCleanup(result);
return nullptr;
}
@@ -1516,14 +1580,14 @@
void Isolate::SetupImagePage(const uint8_t* image_buffer, bool is_executable) {
Image image(image_buffer);
- heap_->SetupImagePage(image.object_start(), image.object_size(),
- is_executable);
+ heap()->SetupImagePage(image.object_start(), image.object_size(),
+ is_executable);
}
void Isolate::ScheduleInterrupts(uword interrupt_bits) {
// We take the threads lock here to ensure that the mutator thread does not
// exit the isolate while we are trying to schedule interrupts on it.
- MonitorLocker ml(threads_lock());
+ MonitorLocker ml(group()->threads_lock());
Thread* mthread = mutator_thread();
if (mthread != nullptr) {
mthread->ScheduleInterrupts(interrupt_bits);
@@ -1535,6 +1599,10 @@
name_ = strdup(name);
}
+int64_t IsolateGroup::UptimeMicros() const {
+ return OS::GetCurrentMonotonicMicros() - start_time_micros_;
+}
+
int64_t Isolate::UptimeMicros() const {
return OS::GetCurrentMonotonicMicros() - start_time_micros_;
}
@@ -1595,7 +1663,7 @@
RELEASE_ASSERT(isolates_.First() == isolates_.Last());
RELEASE_ASSERT(isolates_.First() == Isolate::Current());
- auto shared_class_table = Isolate::Current()->shared_class_table();
+ auto shared_class_table = IsolateGroup::Current()->class_table();
std::shared_ptr<IsolateGroupReloadContext> group_reload_context(
new IsolateGroupReloadContext(this, shared_class_table, js));
group_reload_context_ = group_reload_context;
@@ -1628,7 +1696,7 @@
RELEASE_ASSERT(isolates_.First() == isolates_.Last());
RELEASE_ASSERT(isolates_.First() == Isolate::Current());
- auto shared_class_table = Isolate::Current()->shared_class_table();
+ auto shared_class_table = IsolateGroup::Current()->class_table();
std::shared_ptr<IsolateGroupReloadContext> group_reload_context(
new IsolateGroupReloadContext(this, shared_class_table, js));
group_reload_context_ = group_reload_context;
@@ -2098,20 +2166,6 @@
return Function::RawCast(closures_array.At(idx));
}
-class FinalizeWeakPersistentHandlesVisitor : public HandleVisitor {
- public:
- FinalizeWeakPersistentHandlesVisitor() : HandleVisitor(Thread::Current()) {}
-
- void VisitHandle(uword addr) {
- FinalizablePersistentHandle* handle =
- reinterpret_cast<FinalizablePersistentHandle*>(addr);
- handle->UpdateUnreachable(thread()->isolate());
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(FinalizeWeakPersistentHandlesVisitor);
-};
-
// static
void Isolate::NotifyLowMemory() {
Isolate::KillAllIsolates(Isolate::kLowMemoryMsg);
@@ -2154,10 +2208,6 @@
}
#endif // !PRODUCT
- // Finalize any weak persistent handles with a non-null referent.
- FinalizeWeakPersistentHandlesVisitor visitor;
- api_state()->VisitWeakHandlesUnlocked(&visitor);
-
#if !defined(PRODUCT)
if (FLAG_dump_megamorphic_stats) {
MegamorphicCacheTable::PrintSizes(this);
@@ -2175,6 +2225,10 @@
if (FLAG_print_metrics || FLAG_print_benchmarking_metrics) {
LogBlock lb;
OS::PrintErr("Printing metrics for %s\n", name());
+#define ISOLATE_GROUP_METRIC_PRINT(type, variable, name, unit) \
+ OS::PrintErr("%s\n", isolate_group_->Get##variable##Metric()->ToString());
+ ISOLATE_GROUP_METRIC_LIST(ISOLATE_GROUP_METRIC_PRINT)
+#undef ISOLATE_GROUP_METRIC_PRINT
#define ISOLATE_METRIC_PRINT(type, variable, name, unit) \
OS::PrintErr("%s\n", metric_##variable##_.ToString());
ISOLATE_METRIC_LIST(ISOLATE_METRIC_PRINT)
@@ -2224,12 +2278,7 @@
// Don't allow anymore dart code to execution on this isolate.
thread->ClearStackLimit();
- // Remove this isolate from the list *before* we start tearing it down, to
- // avoid exposing it in a state of decay.
- RemoveIsolateFromList(this);
-
{
- // After removal from isolate list. Before tearing down the heap.
StackZone zone(thread);
HandleScope handle_scope(thread);
ServiceIsolate::SendIsolateShutdownMessage();
@@ -2239,19 +2288,6 @@
#endif
}
- if (heap_ != nullptr) {
- // Wait for any concurrent GC tasks to finish before shutting down.
- // TODO(rmacnak): Interrupt tasks for faster shutdown.
- PageSpace* old_space = heap_->old_space();
- MonitorLocker ml(old_space->tasks_lock());
- while (old_space->tasks() > 0) {
- ml.Wait();
- }
- // Needs to happen before ~PageSpace so TLS and the thread registery are
- // still valid.
- old_space->AbandonMarkingForShutdown();
- }
-
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
if (FLAG_check_reloaded && is_runnable() &&
!Isolate::IsVMInternalIsolate(this)) {
@@ -2265,28 +2301,71 @@
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
// Then, proceed with low-level teardown.
+ Isolate::UnMarkIsolateReady(this);
LowLevelShutdown();
-#if defined(DEBUG)
- // No concurrent sweeper tasks should be running at this point.
- if (heap_ != nullptr) {
- PageSpace* old_space = heap_->old_space();
- MonitorLocker ml(old_space->tasks_lock());
- ASSERT(old_space->tasks() == 0);
- }
-#endif
+ // Now we can unregister from the thread, invoke cleanup callback, delete the
+ // isolate (and possibly the isolate group).
+ Isolate::LowLevelCleanup(this);
+}
- // TODO(5411455): For now just make sure there are no current isolates
- // as we are shutting down the isolate.
+void Isolate::LowLevelCleanup(Isolate* isolate) {
+ const bool is_application_isolate = !Isolate::IsVMInternalIsolate(isolate);
+#if !defined(DART_PECOMPILED_RUNTIME)
+ if (KernelIsolate::IsKernelIsolate(isolate)) {
+ KernelIsolate::SetKernelIsolate(nullptr);
+#endif
+ } else if (ServiceIsolate::IsServiceIsolate(isolate)) {
+ ServiceIsolate::SetServiceIsolate(nullptr);
+ }
+
+ // Cache these two fields, since they are no longer available after the
+ // `delete this` further down.
+ IsolateGroup* isolate_group = isolate->isolate_group_;
+ Dart_IsolateCleanupCallback cleanup = Isolate::CleanupCallback();
+ auto callback_data = isolate->init_callback_data_;
+
+ // From this point on the isolate is no longer visited by GC (which is ok,
+ // since we're just going to delete it anyway).
+ isolate_group->UnregisterIsolate(isolate);
+
+ // Since the death of this isolate is not the death of the heap, we have to
+ // leave the new space iterable (e.g. for old space marking) by abanoning the
+ // TLAB.
+ isolate->group()->heap()->new_space()->AbandonRemainingTLAB(
+ Thread::Current());
+
+ // From this point on the isolate doesn't participate in safepointing
+ // requests anymore.
Thread::ExitIsolate();
+ // Now it's safe to delete the isolate.
+ delete isolate;
+
// Run isolate specific cleanup function for all non "vm-isolate's.
- if (Dart::vm_isolate() != this) {
- Dart_IsolateCleanupCallback cleanup = Isolate::CleanupCallback();
+ if (Dart::vm_isolate() != isolate) {
if (cleanup != nullptr) {
- cleanup(isolate_group_->embedder_data(), init_callback_data());
+ cleanup(isolate_group->embedder_data(), callback_data);
}
}
+
+ const bool shutdown_group =
+ isolate_group->UnregisterIsolateDecrementCount(isolate);
+ if (shutdown_group) {
+ isolate_group->Shutdown();
+ } else {
+ if (FLAG_enable_isolate_groups) {
+ // TODO(dartbug.com/36097): An isolate just died. A significant amount of
+ // memory might have become unreachable. We should evaluate how to best
+ // inform the GC about this situation.
+ }
+ }
+
+ // After deleting the isolate we know that all it's resources have been freed.
+ // We still delay the notification to a possible call to `Dart::Cleanup()` to
+ // after a potential shutdown of the group, which would turn down any pending
+ // GC tasks as well as the heap.
+ Isolate::MarkIsolateDead(is_application_isolate);
}
Dart_InitializeIsolateCallback Isolate::initialize_callback_ = nullptr;
@@ -2295,8 +2374,10 @@
Dart_IsolateCleanupCallback Isolate::cleanup_callback_ = nullptr;
Dart_IsolateGroupCleanupCallback Isolate::cleanup_group_callback_ = nullptr;
-Monitor* Isolate::isolates_list_monitor_ = nullptr;
-Isolate* Isolate::isolates_list_head_ = nullptr;
+Random* IsolateGroup::isolate_group_random_ = nullptr;
+Monitor* Isolate::isolate_creation_monitor_ = nullptr;
+intptr_t Isolate::application_isolates_count_ = 0;
+intptr_t Isolate::total_isolates_count_ = 0;
bool Isolate::creation_enabled_ = false;
RwLock* IsolateGroup::isolate_groups_rwlock_ = nullptr;
@@ -2307,7 +2388,9 @@
ASSERT(visitor != nullptr);
// Visit objects in the object store.
- object_store()->VisitObjectPointers(visitor);
+ if (object_store() != nullptr) {
+ object_store()->VisitObjectPointers(visitor);
+ }
// Visit objects in the class table.
class_table()->VisitObjectPointers(visitor);
@@ -2315,11 +2398,6 @@
// Visit objects in the field table.
field_table()->VisitObjectPointers(visitor);
- // Visit the dart api state for all local and persistent handles.
- if (api_state() != nullptr) {
- api_state()->VisitObjectPointersUnlocked(visitor);
- }
-
visitor->clear_gc_root_type();
// Visit the objects directly referenced from the isolate structure.
visitor->VisitPointer(reinterpret_cast<RawObject**>(¤t_tag_));
@@ -2350,7 +2428,9 @@
#if !defined(PRODUCT)
// Visit objects in the debugger.
- debugger()->VisitObjectPointers(visitor);
+ if (debugger() != nullptr) {
+ debugger()->VisitObjectPointers(visitor);
+ }
#if !defined(DART_PRECOMPILED_RUNTIME)
// Visit objects that are being used for isolate reload.
if (reload_context() != nullptr) {
@@ -2369,56 +2449,45 @@
deopt_context()->VisitObjectPointers(visitor);
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
- VisitStackPointers(visitor, validate_frames);
}
-void Isolate::VisitStackPointers(ObjectPointerVisitor* visitor,
- ValidationPolicy validate_frames) {
- visitor->set_gc_root_type("stack");
- // Visit objects in all threads (e.g., Dart stack, handles in zones).
- thread_registry()->VisitObjectPointers(this, visitor, validate_frames);
-
- // Visit mutator thread, even if the isolate isn't entered/scheduled (there
- // might be live API handles to visit).
- if (mutator_thread_ != nullptr) {
- mutator_thread_->VisitObjectPointers(visitor, validate_frames);
- }
- visitor->clear_gc_root_type();
+void IsolateGroup::ReleaseStoreBuffers() {
+ thread_registry()->ReleaseStoreBuffers();
}
-void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) {
- if (api_state() != nullptr) {
- api_state()->VisitWeakHandlesUnlocked(visitor);
- }
-}
-
-void Isolate::ReleaseStoreBuffers() {
- thread_registry()->ReleaseStoreBuffers(this);
-}
-
-void Isolate::EnableIncrementalBarrier(MarkingStack* marking_stack,
- MarkingStack* deferred_marking_stack) {
+void IsolateGroup::EnableIncrementalBarrier(
+ MarkingStack* marking_stack,
+ MarkingStack* deferred_marking_stack) {
ASSERT(marking_stack_ == nullptr);
marking_stack_ = marking_stack;
deferred_marking_stack_ = deferred_marking_stack;
- thread_registry()->AcquireMarkingStacks(this);
+ thread_registry()->AcquireMarkingStacks();
ASSERT(Thread::Current()->is_marking());
}
-void Isolate::DisableIncrementalBarrier() {
- thread_registry()->ReleaseMarkingStacks(this);
+void IsolateGroup::DisableIncrementalBarrier() {
+ thread_registry()->ReleaseMarkingStacks();
ASSERT(marking_stack_ != nullptr);
marking_stack_ = nullptr;
deferred_marking_stack_ = nullptr;
- ASSERT(!Thread::Current()->is_marking());
}
void IsolateGroup::ForEachIsolate(
- std::function<void(Isolate* isolate)> function) {
- ReadRwLocker wl(ThreadState::Current(), isolates_rwlock_.get());
- for (Isolate* isolate : isolates_) {
- function(isolate);
+ std::function<void(Isolate* isolate)> function,
+ bool at_safepoint) {
+ if (at_safepoint) {
+ ASSERT(Thread::Current()->IsAtSafepoint() ||
+ (Thread::Current()->task_kind() == Thread::kMutatorTask) ||
+ (Thread::Current()->task_kind() == Thread::kMarkerTask) ||
+ (Thread::Current()->task_kind() == Thread::kCompactorTask));
+ for (Isolate* isolate : isolates_) {
+ function(isolate);
+ }
+ } else {
+ SafepointReadRwLocker ml(Thread::Current(), isolates_lock_.get());
+ for (Isolate* isolate : isolates_) {
+ function(isolate);
+ }
}
}
@@ -2428,22 +2497,79 @@
bool use_force_growth_in_otherwise) {
auto thread = Thread::Current();
- ReadRwLocker wl(thread, isolates_rwlock_.get());
- const bool only_one_isolate = isolates_.First() == isolates_.Last();
- if (thread->IsMutatorThread() && only_one_isolate) {
+ if (thread->IsMutatorThread() && !FLAG_enable_isolate_groups) {
single_current_mutator();
- } else {
- // We use the more strict safepoint operation scope here (which ensures that
- // all other threads, including auxiliary threads are at a safepoint), even
- // though we only need to ensure that the mutator threads are stopped.
- if (use_force_growth_in_otherwise) {
- ForceGrowthSafepointOperationScope safepoint_scope(thread);
- otherwise();
- } else {
- SafepointOperationScope safepoint_scope(thread);
- otherwise();
+ return;
+ }
+
+ {
+ SafepointReadRwLocker ml(thread, isolates_lock_.get());
+ const bool only_one_isolate = isolates_.First() == isolates_.Last();
+ if (thread->IsMutatorThread() && only_one_isolate) {
+ single_current_mutator();
+ return;
}
}
+
+ // We use the more strict safepoint operation scope here (which ensures that
+ // all other threads, including auxiliary threads are at a safepoint), even
+ // though we only need to ensure that the mutator threads are stopped.
+ if (use_force_growth_in_otherwise) {
+ ForceGrowthSafepointOperationScope safepoint_scope(thread);
+ otherwise();
+ } else {
+ SafepointOperationScope safepoint_scope(thread);
+ otherwise();
+ }
+}
+
+void IsolateGroup::VisitObjectPointers(ObjectPointerVisitor* visitor,
+ ValidationPolicy validate_frames) {
+ ForEachIsolate(
+ [&](Isolate* isolate) {
+ isolate->VisitObjectPointers(visitor, validate_frames);
+ },
+ /*at_safepoint=*/true);
+ api_state()->VisitObjectPointersUnlocked(visitor);
+ VisitStackPointers(visitor, validate_frames);
+}
+
+void IsolateGroup::VisitStackPointers(ObjectPointerVisitor* visitor,
+ ValidationPolicy validate_frames) {
+ visitor->set_gc_root_type("stack");
+
+ // Visit objects in all threads (e.g. Dart stack, handles in zones), except
+ // for the mutator threads themselves.
+ thread_registry()->VisitObjectPointers(this, visitor, validate_frames);
+
+ ForEachIsolate(
+ [&](Isolate* isolate) {
+ // Visit mutator thread, even if the isolate isn't entered/scheduled
+ // (there might be live API handles to visit).
+ if (isolate->mutator_thread_ != nullptr) {
+ isolate->mutator_thread_->VisitObjectPointers(visitor,
+ validate_frames);
+ }
+ },
+ /*at_safepoint=*/true);
+
+ visitor->clear_gc_root_type();
+}
+
+void IsolateGroup::VisitWeakPersistentHandles(HandleVisitor* visitor) {
+ api_state()->VisitWeakHandlesUnlocked(visitor);
+}
+
+uword IsolateGroup::FindPendingDeoptAtSafepoint(uword fp) {
+ for (Isolate* isolate : isolates_) {
+ for (intptr_t i = 0; i < isolate->pending_deopts_->length(); i++) {
+ if ((*isolate->pending_deopts_)[i].fp() == fp) {
+ return (*isolate->pending_deopts_)[i].pc();
+ }
+ }
+ }
+ FATAL("Missing pending deopt entry");
+ return 0;
}
RawClass* Isolate::GetClassForHeapWalkAt(intptr_t cid) {
@@ -2462,10 +2588,10 @@
return raw_class;
}
-intptr_t Isolate::GetClassSizeForHeapWalkAt(intptr_t cid) {
+intptr_t IsolateGroup::GetClassSizeForHeapWalkAt(intptr_t cid) {
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
- if (group()->IsReloading()) {
- return group()->reload_context()->GetClassSizeForHeapWalkAt(cid);
+ if (IsReloading()) {
+ return group_reload_context_->GetClassSizeForHeapWalkAt(cid);
} else {
return class_table()->SizeAt(cid);
}
@@ -3026,113 +3152,98 @@
if (visitor == nullptr) {
return;
}
- // The visitor could potentially run code that could safepoint so use
- // SafepointMonitorLocker to ensure the lock has safepoint checks.
- SafepointMonitorLocker ml(isolates_list_monitor_);
- Isolate* current = isolates_list_head_;
- while (current != nullptr) {
- visitor->VisitIsolate(current);
- current = current->next_;
- }
+ IsolateGroup::ForEach([&](IsolateGroup* group) {
+ group->ForEachIsolate(
+ [&](Isolate* isolate) { visitor->VisitIsolate(isolate); });
+ });
}
intptr_t Isolate::IsolateListLength() {
- MonitorLocker ml(isolates_list_monitor_);
- intptr_t count = 0;
- Isolate* current = isolates_list_head_;
- while (current != nullptr) {
- count++;
- current = current->next_;
- }
- return count;
+ MonitorLocker ml(isolate_creation_monitor_);
+ return total_isolates_count_;
}
Isolate* Isolate::LookupIsolateByPort(Dart_Port port) {
- MonitorLocker ml(isolates_list_monitor_);
- Isolate* current = isolates_list_head_;
- while (current != nullptr) {
- if (current->main_port() == port) {
- return current;
- }
- current = current->next_;
- }
- return nullptr;
+ Isolate* match = nullptr;
+ IsolateGroup::ForEach([&](IsolateGroup* group) {
+ group->ForEachIsolate([&](Isolate* isolate) {
+ if (isolate->main_port() == port) {
+ match = isolate;
+ }
+ });
+ });
+ return match;
}
std::unique_ptr<char[]> Isolate::LookupIsolateNameByPort(Dart_Port port) {
- MonitorLocker ml(isolates_list_monitor_);
- Isolate* current = isolates_list_head_;
- while (current != nullptr) {
- if (current->main_port() == port) {
- const size_t len = strlen(current->name()) + 1;
- auto result = std::unique_ptr<char[]>(new char[len]);
- strncpy(result.get(), current->name(), len);
- return result;
- }
- current = current->next_;
- }
- return std::unique_ptr<char[]>();
+ MonitorLocker ml(isolate_creation_monitor_);
+ std::unique_ptr<char[]> result;
+ IsolateGroup::ForEach([&](IsolateGroup* group) {
+ group->ForEachIsolate([&](Isolate* isolate) {
+ if (isolate->main_port() == port) {
+ const size_t len = strlen(isolate->name()) + 1;
+ result = std::unique_ptr<char[]>(new char[len]);
+ strncpy(result.get(), isolate->name(), len);
+ }
+ });
+ });
+ return result;
}
-bool Isolate::AddIsolateToList(Isolate* isolate) {
- MonitorLocker ml(isolates_list_monitor_);
+bool Isolate::TryMarkIsolateReady(Isolate* isolate) {
+ MonitorLocker ml(isolate_creation_monitor_);
+ total_isolates_count_++;
+ if (!Isolate::IsVMInternalIsolate(isolate)) {
+ application_isolates_count_++;
+ }
if (!creation_enabled_) {
return false;
}
- ASSERT(isolate != nullptr);
- ASSERT(isolate->next_ == nullptr);
- isolate->next_ = isolates_list_head_;
- isolates_list_head_ = isolate;
+ isolate->accepts_messages_ = true;
return true;
}
-void Isolate::RemoveIsolateFromList(Isolate* isolate) {
- MonitorLocker ml(isolates_list_monitor_);
- ASSERT(isolate != nullptr);
- if (isolate == isolates_list_head_) {
- isolates_list_head_ = isolate->next_;
- if (!creation_enabled_) {
- ml.Notify();
- }
- return;
+void Isolate::UnMarkIsolateReady(Isolate* isolate) {
+ MonitorLocker ml(isolate_creation_monitor_);
+ isolate->accepts_messages_ = false;
+}
+
+void Isolate::MarkIsolateDead(bool is_application_isolate) {
+ MonitorLocker ml(isolate_creation_monitor_);
+ ASSERT(total_isolates_count_ > 0);
+ total_isolates_count_--;
+ if (is_application_isolate) {
+ ASSERT(application_isolates_count_ > 0);
+ application_isolates_count_--;
}
- Isolate* previous = nullptr;
- Isolate* current = isolates_list_head_;
- while (current != nullptr) {
- if (current == isolate) {
- ASSERT(previous != nullptr);
- previous->next_ = current->next_;
- if (!creation_enabled_) {
- ml.Notify();
- }
- return;
- }
- previous = current;
- current = current->next_;
+ if (!creation_enabled_) {
+ ml.Notify();
}
- // If we are shutting down the VM, the isolate may not be in the list.
- ASSERT(!creation_enabled_);
}
void Isolate::DisableIsolateCreation() {
- MonitorLocker ml(isolates_list_monitor_);
+ MonitorLocker ml(isolate_creation_monitor_);
creation_enabled_ = false;
}
void Isolate::EnableIsolateCreation() {
- MonitorLocker ml(isolates_list_monitor_);
+ MonitorLocker ml(isolate_creation_monitor_);
creation_enabled_ = true;
}
bool Isolate::IsolateCreationEnabled() {
- MonitorLocker ml(isolates_list_monitor_);
+ MonitorLocker ml(isolate_creation_monitor_);
return creation_enabled_;
}
bool Isolate::IsVMInternalIsolate(const Isolate* isolate) {
- return (isolate == Dart::vm_isolate()) ||
- ServiceIsolate::IsServiceIsolateDescendant(isolate) ||
- KernelIsolate::IsKernelIsolate(isolate);
+ // We use a name comparison here because this method can be called during
+ // shutdown, where the actual isolate pointers might've already been cleared.
+ return Dart::VmIsolateNameEquals(isolate->name()) ||
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ KernelIsolate::NameEquals(isolate->name()) ||
+#endif
+ ServiceIsolate::NameEquals(isolate->name());
}
void Isolate::KillLocked(LibMsgId msg_id) {
@@ -3187,9 +3298,12 @@
virtual ~IsolateKillerVisitor() {}
void VisitIsolate(Isolate* isolate) {
+ MonitorLocker ml(Isolate::isolate_creation_monitor_);
ASSERT(isolate != nullptr);
if (ShouldKill(isolate)) {
- isolate->KillLocked(msg_id_);
+ if (isolate->AcceptsMessagesLocked()) {
+ isolate->KillLocked(msg_id_);
+ }
}
}
@@ -3261,6 +3375,9 @@
// We lazily create a [Thread] structure for the mutator thread, but we'll
// reuse it until the death of the isolate.
Thread* existing_mutator_thread = is_mutator ? mutator_thread_ : nullptr;
+ if (existing_mutator_thread != nullptr) {
+ ASSERT(existing_mutator_thread->is_mutator_thread_);
+ }
// Schedule the thread into the isolate by associating a 'Thread' structure
// with it (this is done while we are holding the thread registry lock).
@@ -3271,13 +3388,11 @@
ASSERT(mutator_thread_ == nullptr || mutator_thread_ == thread);
mutator_thread_ = thread;
scheduled_mutator_thread_ = thread;
+ thread->is_mutator_thread_ = true;
}
thread->isolate_ = this;
thread->field_table_values_ = field_table_->table();
- ASSERT(heap() != nullptr);
- thread->heap_ = heap();
-
return thread;
}
@@ -3293,13 +3408,6 @@
// no_safepoint_scope_depth increments/decrements.
MonitorLocker ml(group()->threads_lock(), false);
- // Clear since GC will not visit the thread once it is unscheduled. Do this
- // under the thread lock to prevent races with the GC visiting thread roots.
- thread->ClearReusableHandles();
- if (!is_mutator) {
- thread->heap()->AbandonRemainingTLAB(thread);
- }
-
if (is_mutator) {
if (thread->sticky_error() != Error::null()) {
ASSERT(sticky_error_ == Error::null());
@@ -3308,6 +3416,11 @@
ASSERT(mutator_thread_ == thread);
ASSERT(mutator_thread_ == scheduled_mutator_thread_);
scheduled_mutator_thread_ = nullptr;
+ } else {
+ // We only reset the isolate pointer for non-mutator threads, since mutator
+ // threads can still be visited during GC even if unscheduled.
+ // See also IsolateGroup::UnscheduleThreadLocked`
+ thread->isolate_ = nullptr;
}
thread->field_table_values_ = nullptr;
group()->UnscheduleThreadLocked(&ml, thread, is_mutator, bypass_safepoint);
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 7a74bcc..0bc9b3a 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -82,6 +82,7 @@
class RawUserTag;
class ReversePcLookupCache;
class RwLock;
+class SafepointRwLock;
class SafepointHandler;
class SampleBuffer;
class SendPort;
@@ -213,6 +214,11 @@
// The kernel buffer used in `Dart_LoadScriptFromKernel`.
const uint8_t* script_kernel_buffer;
intptr_t script_kernel_size;
+
+ // During AppJit training we perform a permutation of the class ids before
+ // invoking the "main" script.
+ // Any newly spawned isolates need to use this permutation map.
+ std::unique_ptr<intptr_t[]> cid_permutation_map;
};
// Tracks idle time and notifies heap when idle time expired.
@@ -262,21 +268,67 @@
// Represents an isolate group and is shared among all isolates within a group.
class IsolateGroup : public IntrusiveDListEntry<IsolateGroup> {
public:
- IsolateGroup(std::unique_ptr<IsolateGroupSource> source, void* embedder_data);
+ IsolateGroup(std::shared_ptr<IsolateGroupSource> source, void* embedder_data);
~IsolateGroup();
IsolateGroupSource* source() const { return source_.get(); }
+ std::shared_ptr<IsolateGroupSource> shareable_source() const {
+ return source_;
+ }
void* embedder_data() const { return embedder_data_; }
+ bool initial_spawn_successful() { return initial_spawn_successful_; }
void set_initial_spawn_successful() { initial_spawn_successful_ = true; }
+ Heap* heap() const { return heap_.get(); }
+
+ IdleTimeHandler* idle_time_handler() { return &idle_time_handler_; }
+
void RegisterIsolate(Isolate* isolate);
+ void RegisterIsolateLocked(Isolate* isolate);
void UnregisterIsolate(Isolate* isolate);
+ // Returns `true` if this was the last isolate and the caller is responsible
+ // for deleting the isolate group.
+ bool UnregisterIsolateDecrementCount(Isolate* isolate);
+
+ bool ContainsOnlyOneIsolate();
+
+ void RunWithLockedGroup(std::function<void()> fun);
Monitor* threads_lock() const;
ThreadRegistry* thread_registry() const { return thread_registry_.get(); }
SafepointHandler* safepoint_handler() { return safepoint_handler_.get(); }
+ void CreateHeap(bool is_vm_isolate, bool is_service_or_kernel_isolate);
+ void Shutdown();
+
+#if !defined(PRODUCT)
+#define ISOLATE_METRIC_ACCESSOR(type, variable, name, unit) \
+ type* Get##variable##Metric() { return &metric_##variable##_; }
+ ISOLATE_GROUP_METRIC_LIST(ISOLATE_METRIC_ACCESSOR);
+#undef ISOLATE_METRIC_ACCESSOR
+
+ void UpdateLastAllocationProfileAccumulatorResetTimestamp() {
+ last_allocationprofile_accumulator_reset_timestamp_ =
+ OS::GetCurrentTimeMillis();
+ }
+
+ int64_t last_allocationprofile_accumulator_reset_timestamp() const {
+ return last_allocationprofile_accumulator_reset_timestamp_;
+ }
+
+ void UpdateLastAllocationProfileGCTimestamp() {
+ last_allocationprofile_gc_timestamp_ = OS::GetCurrentTimeMillis();
+ }
+
+ int64_t last_allocationprofile_gc_timestamp() const {
+ return last_allocationprofile_gc_timestamp_;
+ }
+#endif // !defined(PRODUCT)
+
+ SharedClassTable* class_table() const { return shared_class_table_.get(); }
+ StoreBuffer* store_buffer() const { return store_buffer_.get(); }
+
static inline IsolateGroup* Current() {
Thread* thread = Thread::Current();
return thread == nullptr ? nullptr : thread->isolate_group();
@@ -304,11 +356,29 @@
library_tag_handler_ = handler;
}
+ intptr_t GetClassSizeForHeapWalkAt(intptr_t cid);
+
+ // Prepares all threads in an isolate for Garbage Collection.
+ void ReleaseStoreBuffers();
+ void EnableIncrementalBarrier(MarkingStack* marking_stack,
+ MarkingStack* deferred_marking_stack);
+ void DisableIncrementalBarrier();
+
+ MarkingStack* marking_stack() const { return marking_stack_; }
+ MarkingStack* deferred_marking_stack() const {
+ return deferred_marking_stack_;
+ }
+
// Runs the given [function] on every isolate in the isolate group.
//
- // During the duration of this function, no new isolates can be added to the
- // isolate group.
- void ForEachIsolate(std::function<void(Isolate* isolate)> function);
+ // During the duration of this function, no new isolates can be added or
+ // removed.
+ //
+ // If [at_safepoint] is `true`, then the entire isolate group must be in a
+ // safepoint. There is therefore no reason to guard against other threads
+ // adding/removing isolates, so no locks will be held.
+ void ForEachIsolate(std::function<void(Isolate* isolate)> function,
+ bool at_safepoint = false);
// Ensures mutators are stopped during execution of the provided function.
//
@@ -381,29 +451,93 @@
static void RegisterIsolateGroup(IsolateGroup* isolate_group);
static void UnregisterIsolateGroup(IsolateGroup* isolate_group);
+ int64_t UptimeMicros() const;
+
+ ApiState* api_state() const { return api_state_.get(); }
+
+ // Visit all object pointers. Caller must ensure concurrent sweeper is not
+ // running, and the visitor must not allocate.
+ void VisitObjectPointers(ObjectPointerVisitor* visitor,
+ ValidationPolicy validate_frames);
+ void VisitStackPointers(ObjectPointerVisitor* visitor,
+ ValidationPolicy validate_frames);
+ void VisitWeakPersistentHandles(HandleVisitor* visitor);
+
+ bool compaction_in_progress() const {
+ return CompactionInProgressBit::decode(isolate_group_flags_);
+ }
+ void set_compaction_in_progress(bool value) {
+ isolate_group_flags_ =
+ CompactionInProgressBit::update(value, isolate_group_flags_);
+ }
+
+ uword FindPendingDeoptAtSafepoint(uword fp);
+
private:
+ friend class Heap;
+ friend class StackFrame; // For `[isolates_].First()`.
+
+#define ISOLATE_GROUP_FLAG_BITS(V) V(CompactionInProgress)
+
+ // Isolate specific flags.
+ enum FlagBits {
+#define DECLARE_BIT(Name) k##Name##Bit,
+ ISOLATE_GROUP_FLAG_BITS(DECLARE_BIT)
+#undef DECLARE_BIT
+ };
+
+#define DECLARE_BITFIELD(Name) \
+ class Name##Bit : public BitField<uint32_t, bool, k##Name##Bit, 1> {};
+ ISOLATE_GROUP_FLAG_BITS(DECLARE_BITFIELD)
+#undef DECLARE_BITFIELD
+
+ void set_heap(std::unique_ptr<Heap> value);
+
+ bool is_vm_isolate_heap_ = false;
void* embedder_data_ = nullptr;
- std::unique_ptr<RwLock> isolates_rwlock_;
+ std::unique_ptr<SafepointRwLock> isolates_lock_;
IntrusiveDList<Isolate> isolates_;
intptr_t isolate_count_ = 0;
bool initial_spawn_successful_ = false;
Dart_LibraryTagHandler library_tag_handler_ = nullptr;
+ int64_t start_time_micros_;
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
int64_t last_reload_timestamp_;
std::shared_ptr<IsolateGroupReloadContext> group_reload_context_;
#endif
- std::unique_ptr<IsolateGroupSource> source_;
+#if !defined(PRODUCT)
+#define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \
+ type metric_##variable##_;
+ ISOLATE_GROUP_METRIC_LIST(ISOLATE_METRIC_VARIABLE);
+#undef ISOLATE_METRIC_VARIABLE
+
+ // Timestamps of last operation via service.
+ int64_t last_allocationprofile_accumulator_reset_timestamp_ = 0;
+ int64_t last_allocationprofile_gc_timestamp_ = 0;
+
+#endif // !defined(PRODUCT)
+
+ MarkingStack* marking_stack_ = nullptr;
+ MarkingStack* deferred_marking_stack_ = nullptr;
+ std::shared_ptr<IsolateGroupSource> source_;
+ std::unique_ptr<ApiState> api_state_;
std::unique_ptr<ThreadRegistry> thread_registry_;
std::unique_ptr<SafepointHandler> safepoint_handler_;
static RwLock* isolate_groups_rwlock_;
static IntrusiveDList<IsolateGroup>* isolate_groups_;
+ static Random* isolate_group_random_;
- Random isolate_group_random_;
- uint64_t id_ = isolate_group_random_.NextUInt64();
+ uint64_t id_ = 0;
+
+ std::unique_ptr<SharedClassTable> shared_class_table_;
+ std::unique_ptr<StoreBuffer> store_buffer_;
+ std::unique_ptr<Heap> heap_;
+ IdleTimeHandler idle_time_handler_;
+ uint32_t isolate_group_flags_ = 0;
};
class Isolate : public BaseIsolate, public IntrusiveDListEntry<Isolate> {
@@ -454,29 +588,12 @@
void ValidateConstants();
#endif
- // Visits weak object pointers.
- void VisitWeakPersistentHandles(HandleVisitor* visitor);
-
- // Prepares all threads in an isolate for Garbage Collection.
- void ReleaseStoreBuffers();
- void EnableIncrementalBarrier(MarkingStack* marking_stack,
- MarkingStack* deferred_marking_stack);
- void DisableIncrementalBarrier();
-
- StoreBuffer* store_buffer() const { return store_buffer_; }
- MarkingStack* marking_stack() const { return marking_stack_; }
- MarkingStack* deferred_marking_stack() const {
- return deferred_marking_stack_;
- }
-
ThreadRegistry* thread_registry() const { return group()->thread_registry(); }
SafepointHandler* safepoint_handler() const {
return group()->safepoint_handler();
}
- SharedClassTable* shared_class_table() { return shared_class_table_.get(); }
-
ClassTable* class_table() { return &class_table_; }
static intptr_t class_table_offset() {
return OFFSET_OF(Isolate, class_table_);
@@ -486,7 +603,6 @@
// Prefers old classes when we are in the middle of a reload.
RawClass* GetClassForHeapWalkAt(intptr_t cid);
- intptr_t GetClassSizeForHeapWalkAt(intptr_t cid);
static intptr_t ic_miss_code_offset() {
return OFFSET_OF(Isolate, ic_miss_code_);
@@ -531,13 +647,7 @@
void SendInternalLibMessage(LibMsgId msg_id, uint64_t capability);
- IdleTimeHandler* idle_time_handler() { return &idle_time_handler_; }
-
- Heap* heap() const { return heap_; }
- void set_heap(Heap* value) {
- idle_time_handler_.InitializeWithHeap(value);
- heap_ = value;
- }
+ Heap* heap() const { return isolate_group_->heap(); }
ObjectStore* object_store() const { return object_store_; }
void set_object_store(ObjectStore* value) { object_store_ = value; }
@@ -545,9 +655,6 @@
return OFFSET_OF(Isolate, object_store_);
}
- ApiState* api_state() const { return api_state_; }
- void set_api_state(ApiState* value) { api_state_ = value; }
-
void set_init_callback_data(void* value) { init_callback_data_ = value; }
void* init_callback_data() const { return init_callback_data_; }
@@ -591,13 +698,6 @@
#endif
}
- bool compaction_in_progress() const {
- return CompactionInProgressBit::decode(isolate_flags_);
- }
- void set_compaction_in_progress(bool value) {
- isolate_flags_ = CompactionInProgressBit::update(value, isolate_flags_);
- }
-
IsolateSpawnState* spawn_state() const { return spawn_state_.get(); }
void set_spawn_state(std::unique_ptr<IsolateSpawnState> value) {
spawn_state_ = std::move(value);
@@ -724,7 +824,6 @@
}
#if !defined(PRODUCT)
- void set_object_id_ring(ObjectIdRing* ring) { object_id_ring_ = ring; }
ObjectIdRing* object_id_ring() { return object_id_ring_; }
#endif // !defined(PRODUCT)
@@ -749,25 +848,6 @@
return optimizing_background_compiler_;
}
-#if !defined(PRODUCT)
- void UpdateLastAllocationProfileAccumulatorResetTimestamp() {
- last_allocationprofile_accumulator_reset_timestamp_ =
- OS::GetCurrentTimeMillis();
- }
-
- int64_t last_allocationprofile_accumulator_reset_timestamp() const {
- return last_allocationprofile_accumulator_reset_timestamp_;
- }
-
- void UpdateLastAllocationProfileGCTimestamp() {
- last_allocationprofile_gc_timestamp_ = OS::GetCurrentTimeMillis();
- }
-
- int64_t last_allocationprofile_gc_timestamp() const {
- return last_allocationprofile_gc_timestamp_;
- }
-#endif // !defined(PRODUCT)
-
intptr_t BlockClassFinalization() {
ASSERT(defer_finalization_count_ >= 0);
return defer_finalization_count_++;
@@ -857,11 +937,6 @@
void set_ic_miss_code(const Code& code);
-#if !defined(PRODUCT)
- Metric* metrics_list_head() { return metrics_list_head_; }
- void set_metrics_list_head(Metric* metric) { metrics_list_head_ = metric; }
-#endif // !defined(PRODUCT)
-
RawGrowableObjectArray* deoptimized_code_array() const {
return deoptimized_code_array_;
}
@@ -874,13 +949,6 @@
RawError* sticky_error() const { return sticky_error_; }
DART_WARN_UNUSED_RESULT RawError* StealStickyError();
- bool compilation_allowed() const {
- return CompilationAllowedBit::decode(isolate_flags_);
- }
- void set_compilation_allowed(bool allowed) {
- isolate_flags_ = CompilationAllowedBit::update(allowed, isolate_flags_);
- }
-
// In precompilation we finalize all regular classes before compiling.
bool all_classes_finalized() const {
return AllClassesFinalizedBit::decode(isolate_flags_);
@@ -1078,6 +1146,9 @@
private:
friend class Dart; // Init, InitOnce, Shutdown.
friend class IsolateKillerVisitor; // Kill().
+ friend Isolate* CreateWithinExistingIsolateGroup(IsolateGroup* g,
+ const char* n,
+ char** e);
Isolate(IsolateGroup* group, const Dart_IsolateFlags& api_flags);
@@ -1087,11 +1158,16 @@
const Dart_IsolateFlags& api_flags,
bool is_vm_isolate = false);
- // The isolates_list_monitor_ should be held when calling Kill().
+ // The isolate_creation_monitor_ should be held when calling Kill().
void KillLocked(LibMsgId msg_id);
- void LowLevelShutdown();
void Shutdown();
+ void LowLevelShutdown();
+
+ // Unregister the [isolate] from the thread, remove it from the isolate group,
+ // invoke the cleanup function (if any), delete the isolate and possibly
+ // delete the isolate group (if it's the last isolate in the group).
+ static void LowLevelCleanup(Isolate* isolate);
void BuildName(const char* name_prefix);
@@ -1119,7 +1195,6 @@
const GrowableObjectArray& value);
#endif // !defined(PRODUCT)
- Monitor* threads_lock() { return isolate_group_->threads_lock(); }
Thread* ScheduleThread(bool is_mutator, bool bypass_safepoint = false);
void UnscheduleThread(Thread* thread,
bool is_mutator,
@@ -1142,18 +1217,13 @@
RawUserTag* current_tag_;
RawUserTag* default_tag_;
RawCode* ic_miss_code_;
- std::unique_ptr<SharedClassTable> shared_class_table_;
ObjectStore* object_store_ = nullptr;
ClassTable class_table_;
FieldTable* field_table_ = nullptr;
bool single_step_ = false;
// End accessed from generated code.
- StoreBuffer* store_buffer_ = nullptr;
- MarkingStack* marking_stack_ = nullptr;
- MarkingStack* deferred_marking_stack_ = nullptr;
- Heap* heap_ = nullptr;
- IsolateGroup* isolate_group_ = nullptr;
+ IsolateGroup* isolate_group_;
IdleTimeHandler idle_time_handler_;
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -1165,7 +1235,6 @@
V(IsRunnable) \
V(IsServiceIsolate) \
V(IsKernelIsolate) \
- V(CompilationAllowed) \
V(AllClassesFinalized) \
V(RemappingCids) \
V(ResumeRequest) \
@@ -1176,7 +1245,6 @@
V(UseFieldGuards) \
V(UseOsr) \
V(Obfuscate) \
- V(CompactionInProgress) \
V(ShouldLoadVmService) \
V(UnsafeTrustStrongModeTypes)
@@ -1206,10 +1274,6 @@
Debugger* debugger_ = nullptr;
int64_t last_resume_timestamp_;
- // Timestamps of last operation via service.
- int64_t last_allocationprofile_accumulator_reset_timestamp_ = 0;
- int64_t last_allocationprofile_gc_timestamp_ = 0;
-
VMTagCounters vm_tag_counters_;
// We use 6 list entries for each pending service extension calls.
@@ -1223,8 +1287,6 @@
kRegisteredEntrySize};
RawGrowableObjectArray* registered_service_extension_handlers_;
- Metric* metrics_list_head_ = nullptr;
-
// Used to wake the isolate when it is in the pause event loop.
Monitor* pause_loop_monitor_ = nullptr;
@@ -1253,7 +1315,6 @@
uint64_t terminate_capability_ = 0;
void* init_callback_data_ = nullptr;
Dart_EnvironmentCallback environment_callback_ = nullptr;
- ApiState* api_state_ = nullptr;
Random random_;
Simulator* simulator_ = nullptr;
Mutex mutex_; // Protects compiler stats.
@@ -1277,9 +1338,6 @@
RawError* sticky_error_;
- // Isolate list next pointer.
- Isolate* next_ = nullptr;
-
// Protect access to boxed_field_list_.
Mutex field_list_mutex_;
// List of fields that became boxed and that trigger deoptimization.
@@ -1303,6 +1361,11 @@
std::unique_ptr<WeakTable> forward_table_new_;
std::unique_ptr<WeakTable> forward_table_old_;
+ // Signals whether the isolate can receive messages (e.g. KillAllIsolates can
+ // send a kill message).
+ // This is protected by [isolate_creation_monitor_].
+ bool accepts_messages_ = false;
+
static Dart_IsolateGroupCreateCallback create_group_callback_;
static Dart_InitializeIsolateCallback initialize_callback_;
static Dart_IsolateShutdownCallback shutdown_callback_;
@@ -1314,12 +1377,19 @@
#endif
// Manage list of existing isolates.
- static bool AddIsolateToList(Isolate* isolate);
- static void RemoveIsolateFromList(Isolate* isolate);
+ static bool TryMarkIsolateReady(Isolate* isolate);
+ static void UnMarkIsolateReady(Isolate* isolate);
+ static void MarkIsolateDead(bool is_application_isolate);
+ bool AcceptsMessagesLocked() {
+ ASSERT(isolate_creation_monitor_->IsOwnedByCurrentThread());
+ return accepts_messages_;
+ }
- // This monitor protects isolates_list_head_, and creation_enabled_.
- static Monitor* isolates_list_monitor_;
- static Isolate* isolates_list_head_;
+ // This monitor protects application_isolates_count_, total_isolates_count_,
+ // creation_enabled_.
+ static Monitor* isolate_creation_monitor_;
+ static intptr_t application_isolates_count_;
+ static intptr_t total_isolates_count_;
static bool creation_enabled_;
#define REUSABLE_FRIEND_DECLARATION(name) \
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index 5d973a1..2bc33ff 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -2074,7 +2074,7 @@
DART_FORCE_INLINE
void CheckValueType(const Instance& value, const Field& field) {
- if (!FLAG_strong_non_nullable_type_checks && value.IsNull()) {
+ if (!FLAG_null_safety && value.IsNull()) {
return;
}
type_ = field.type();
diff --git a/runtime/vm/isolate_reload.h b/runtime/vm/isolate_reload.h
index ba6ba59..5bcf2a3 100644
--- a/runtime/vm/isolate_reload.h
+++ b/runtime/vm/isolate_reload.h
@@ -294,7 +294,8 @@
friend class MarkFunctionsForRecompilation; // IsDirty.
friend class ReasonForCancelling;
friend class IsolateReloadContext;
- friend class Instance; // GetClassSizeForHeapWalkAt
+ friend class IsolateGroup; // GetClassSizeForHeapWalkAt
+ friend class RawObject; // GetClassSizeForHeapWalkAt
static Dart_FileModifiedCallback file_modified_callback_;
};
diff --git a/runtime/vm/kernel.cc b/runtime/vm/kernel.cc
index 15accf8..1c1c752 100644
--- a/runtime/vm/kernel.cc
+++ b/runtime/vm/kernel.cc
@@ -770,8 +770,8 @@
auto& type = AbstractType::Handle(zone);
for (intptr_t i = function.NumImplicitParameters(); i < num_params; ++i) {
type = function.ParameterTypeAt(i);
- if (!type.IsTopType() && !is_generic_covariant_impl.Contains(i) &&
- !is_covariant.Contains(i)) {
+ if (!type.IsTopTypeForAssignability() &&
+ !is_generic_covariant_impl.Contains(i) && !is_covariant.Contains(i)) {
return true;
}
}
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index 2004067..10b5f0c 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -184,6 +184,11 @@
kIsExpressionFlagForNonNullableByDefault = 1 << 0,
};
+// Keep in sync with package:kernel/lib/ast.dart
+enum class NamedTypeFlags : uint8_t {
+ kIsRequired = 1 << 0,
+};
+
static const int SpecializedIntLiteralBias = 3;
static const int LibraryCountFieldCountFromEnd = 1;
static const int SourceTableFieldCountFromFirstLibraryOffset = 6;
diff --git a/runtime/vm/kernel_isolate.cc b/runtime/vm/kernel_isolate.cc
index c813c94..46e3efc 100644
--- a/runtime/vm/kernel_isolate.cc
+++ b/runtime/vm/kernel_isolate.cc
@@ -613,10 +613,6 @@
dart_incremental.type = Dart_CObject_kBool;
dart_incremental.value.as_bool = incremental_compile;
- Dart_CObject dart_strong;
- dart_strong.type = Dart_CObject_kBool;
- dart_strong.value.as_bool = true;
-
// TODO(aam): Assert that isolate exists once we move CompileAndReadScript
// compilation logic out of CreateIsolateAndSetupHelper and into
// IsolateSetupHelper in main.cc.
@@ -644,6 +640,10 @@
enable_asserts.value.as_bool =
isolate != NULL ? isolate->asserts() : FLAG_enable_asserts;
+ Dart_CObject null_safety;
+ null_safety.type = Dart_CObject_kBool;
+ null_safety.value.as_bool = FLAG_null_safety;
+
intptr_t num_experimental_flags = experimental_flags->length();
Dart_CObject** experimental_flags_array =
new Dart_CObject*[num_experimental_flags];
@@ -702,7 +702,7 @@
&uri,
&dart_platform_kernel,
&dart_incremental,
- &dart_strong,
+ &null_safety,
&isolate_id,
&files,
&suppress_warnings,
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index a2171d2..eedc433 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -1021,6 +1021,8 @@
if (library.Loaded()) return library.raw();
library.set_is_nnbd(library_helper.IsNonNullableByDefault());
+ library.set_nnbd_compiled_mode(
+ library_helper.GetNonNullableByDefaultCompiledMode());
library_kernel_data_ = helper_.reader_.ExternalDataFromTo(
library_kernel_offset_, library_kernel_offset_ + library_size);
@@ -2366,15 +2368,6 @@
return initializer_fun.raw();
}
-ParsedFunction* ParseStaticFieldInitializer(Zone* zone, const Field& field) {
- Thread* thread = Thread::Current();
-
- const Function& initializer_fun = Function::ZoneHandle(
- zone, CreateFieldInitializerFunction(thread, zone, field));
-
- return new (zone) ParsedFunction(thread, initializer_fun);
-}
-
} // namespace kernel
} // namespace dart
#endif // !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/kernel_loader.h b/runtime/vm/kernel_loader.h
index 3c9431f..b3b42a1 100644
--- a/runtime/vm/kernel_loader.h
+++ b/runtime/vm/kernel_loader.h
@@ -460,8 +460,6 @@
Zone* zone,
const Field& field);
-ParsedFunction* ParseStaticFieldInitializer(Zone* zone, const Field& field);
-
} // namespace kernel
} // namespace dart
diff --git a/runtime/vm/lockers.cc b/runtime/vm/lockers.cc
index b5bd727..7ad731d 100644
--- a/runtime/vm/lockers.cc
+++ b/runtime/vm/lockers.cc
@@ -5,6 +5,7 @@
#include "vm/lockers.h"
#include "platform/assert.h"
#include "vm/heap/safepoint.h"
+#include "vm/isolate.h"
namespace dart {
@@ -26,7 +27,7 @@
// Fast update failed which means we could potentially be in the middle
// of a safepoint operation and need to block for it.
monitor_->Exit();
- SafepointHandler* handler = thread->isolate()->safepoint_handler();
+ SafepointHandler* handler = thread->isolate_group()->safepoint_handler();
handler->ExitSafepointUsingLock(thread);
monitor_->Enter();
}
@@ -84,22 +85,4 @@
}
}
-ReadRwLocker::ReadRwLocker(ThreadState* thread_state, RwLock* rw_lock)
- : StackResource(thread_state), rw_lock_(rw_lock) {
- rw_lock_->EnterRead();
-}
-
-ReadRwLocker::~ReadRwLocker() {
- rw_lock_->LeaveRead();
-}
-
-WriteRwLocker::WriteRwLocker(ThreadState* thread_state, RwLock* rw_lock)
- : StackResource(thread_state), rw_lock_(rw_lock) {
- rw_lock_->EnterWrite();
-}
-
-WriteRwLocker::~WriteRwLocker() {
- rw_lock_->LeaveWrite();
-}
-
} // namespace dart
diff --git a/runtime/vm/lockers.h b/runtime/vm/lockers.h
index 5a4706e..16c6d93 100644
--- a/runtime/vm/lockers.h
+++ b/runtime/vm/lockers.h
@@ -245,6 +245,8 @@
Monitor::WaitResult Wait(int64_t millis = Monitor::kNoTimeout);
+ void NotifyAll() { monitor_->NotifyAll(); }
+
private:
Monitor* const monitor_;
@@ -296,6 +298,51 @@
intptr_t state_ = 0;
};
+class SafepointRwLock {
+ public:
+ SafepointRwLock() {}
+ ~SafepointRwLock() {}
+
+ private:
+ friend class SafepointReadRwLocker;
+ friend class SafepointWriteRwLocker;
+
+ void EnterRead() {
+ SafepointMonitorLocker ml(&monitor_);
+ while (state_ == -1) {
+ ml.Wait();
+ }
+ ++state_;
+ }
+ void LeaveRead() {
+ SafepointMonitorLocker ml(&monitor_);
+ ASSERT(state_ > 0);
+ if (--state_ == 0) {
+ ml.NotifyAll();
+ }
+ }
+
+ void EnterWrite() {
+ SafepointMonitorLocker ml(&monitor_);
+ while (state_ != 0) {
+ ml.Wait();
+ }
+ state_ = -1;
+ }
+ void LeaveWrite() {
+ SafepointMonitorLocker ml(&monitor_);
+ ASSERT(state_ == -1);
+ state_ = 0;
+ ml.NotifyAll();
+ }
+
+ Monitor monitor_;
+ // [state_] > 0 : The lock is held by multiple readers.
+ // [state_] == 0 : The lock is free (no readers/writers).
+ // [state_] == -1: The lock is held by a single writer.
+ intptr_t state_ = 0;
+};
+
/*
* Locks a given [RwLock] for reading purposes.
*
@@ -309,14 +356,33 @@
*/
class ReadRwLocker : public StackResource {
public:
- ReadRwLocker(ThreadState* thread_state, RwLock* rw_lock);
- ~ReadRwLocker();
+ ReadRwLocker(ThreadState* thread_state, RwLock* rw_lock)
+ : StackResource(thread_state), rw_lock_(rw_lock) {
+ rw_lock_->EnterRead();
+ }
+ ~ReadRwLocker() { rw_lock_->LeaveRead(); }
private:
RwLock* rw_lock_;
};
/*
+ * In addition to what [ReadRwLocker] does, this implementation also gets into a
+ * safepoint if necessary.
+ */
+class SafepointReadRwLocker : public StackResource {
+ public:
+ SafepointReadRwLocker(ThreadState* thread_state, SafepointRwLock* rw_lock)
+ : StackResource(thread_state), rw_lock_(rw_lock) {
+ rw_lock_->EnterRead();
+ }
+ ~SafepointReadRwLocker() { rw_lock_->LeaveRead(); }
+
+ private:
+ SafepointRwLock* rw_lock_;
+};
+
+/*
* Locks a given [RwLock] for writing purposes.
*
* It will block while the lock is held by one or more readers.
@@ -329,13 +395,34 @@
*/
class WriteRwLocker : public StackResource {
public:
- WriteRwLocker(ThreadState* thread_state, RwLock* rw_lock);
- ~WriteRwLocker();
+ WriteRwLocker(ThreadState* thread_state, RwLock* rw_lock)
+ : StackResource(thread_state), rw_lock_(rw_lock) {
+ rw_lock_->EnterWrite();
+ }
+
+ ~WriteRwLocker() { rw_lock_->LeaveWrite(); }
private:
RwLock* rw_lock_;
};
+/*
+ * In addition to what [WriteRwLocker] does, this implementation also gets into a
+ * safepoint if necessary.
+ */
+class SafepointWriteRwLocker : public StackResource {
+ public:
+ SafepointWriteRwLocker(ThreadState* thread_state, SafepointRwLock* rw_lock)
+ : StackResource(thread_state), rw_lock_(rw_lock) {
+ rw_lock_->EnterWrite();
+ }
+
+ ~SafepointWriteRwLocker() { rw_lock_->LeaveWrite(); }
+
+ private:
+ SafepointRwLock* rw_lock_;
+};
+
} // namespace dart
#endif // RUNTIME_VM_LOCKERS_H_
diff --git a/runtime/vm/malloc_hooks_tcmalloc.cc b/runtime/vm/malloc_hooks_tcmalloc.cc
index c525f0f..ff9bed6 100644
--- a/runtime/vm/malloc_hooks_tcmalloc.cc
+++ b/runtime/vm/malloc_hooks_tcmalloc.cc
@@ -175,6 +175,7 @@
Pair() : key(NULL), value(NULL) {}
Pair(const Key key, const Value& value) : key(key), value(value) {}
Pair(const Pair& other) : key(other.key), value(other.value) {}
+ Pair& operator=(const Pair&) = default;
};
static Key KeyOf(Pair kv) { return kv.key; }
diff --git a/runtime/vm/message_handler.cc b/runtime/vm/message_handler.cc
index 4b37bc0..1012630 100644
--- a/runtime/vm/message_handler.cc
+++ b/runtime/vm/message_handler.cc
@@ -8,6 +8,7 @@
#include "vm/dart.h"
#include "vm/heap/safepoint.h"
+#include "vm/isolate.h"
#include "vm/lockers.h"
#include "vm/object.h"
#include "vm/object_store.h"
@@ -202,7 +203,7 @@
ml->Enter();
auto idle_time_handler =
- isolate() != nullptr ? isolate()->idle_time_handler() : nullptr;
+ isolate() != nullptr ? isolate()->group()->idle_time_handler() : nullptr;
MessageStatus max_status = kOK;
Message::Priority min_priority =
@@ -523,12 +524,17 @@
bool MessageHandler::CheckIfIdleLocked(MonitorLocker* ml) {
if (isolate() == nullptr ||
- !isolate()->idle_time_handler()->ShouldCheckForIdle()) {
+ !isolate()->group()->idle_time_handler()->ShouldCheckForIdle()) {
// No idle task to schedule.
return false;
}
+ if (!isolate()->group()->initial_spawn_successful()) {
+ // The isolate has not started running application code yet.
+ return false;
+ }
int64_t idle_expirary = 0;
- if (isolate()->idle_time_handler()->ShouldNotifyIdle(&idle_expirary)) {
+ if (isolate()->group()->idle_time_handler()->ShouldNotifyIdle(
+ &idle_expirary)) {
// We've been without a message long enough to hope we can do some
// cleanup before the next message arrives.
RunIdleTaskLocked(ml);
@@ -553,7 +559,7 @@
ml->Exit();
{
StartIsolateScope start_isolate(isolate());
- isolate()->idle_time_handler()->NotifyIdleUsingDefaultDeadline();
+ isolate()->group()->idle_time_handler()->NotifyIdleUsingDefaultDeadline();
}
ml->Enter();
}
diff --git a/runtime/vm/message_handler_test.cc b/runtime/vm/message_handler_test.cc
index 76c46a1..aedcccc 100644
--- a/runtime/vm/message_handler_test.cc
+++ b/runtime/vm/message_handler_test.cc
@@ -2,6 +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.
+#include <utility>
+
#include "vm/message_handler.h"
#include "vm/port.h"
#include "vm/unit_test.h"
@@ -40,18 +42,24 @@
message_count_(0),
start_called_(false),
end_called_(false),
- results_(NULL) {}
+ results_(NULL),
+ monitor_() {}
~TestMessageHandler() {
PortMap::ClosePorts(this);
delete[] port_buffer_;
}
- void MessageNotify(Message::Priority priority) { notify_count_++; }
+ void MessageNotify(Message::Priority priority) {
+ MonitorLocker ml(&monitor_);
+ notify_count_++;
+ ml.Notify();
+ }
MessageStatus HandleMessage(std::unique_ptr<Message> message) {
// For testing purposes, keep a list of the ports
// for all messages we receive.
+ MonitorLocker ml(&monitor_);
AddPortToBuffer(message->dest_port());
message_count_++;
MessageStatus status = kOK;
@@ -59,6 +67,7 @@
status = results_[0];
results_++;
}
+ ml.Notify();
return status;
}
@@ -68,8 +77,10 @@
}
void End() {
+ MonitorLocker ml(&monitor_);
end_called_ = true;
AddPortToBuffer(-2);
+ ml.Notify();
}
Dart_Port* port_buffer() const { return port_buffer_; }
@@ -80,6 +91,8 @@
void set_results(MessageStatus* results) { results_ = results; }
+ Monitor* monitor() { return &monitor_; }
+
private:
void AddPortToBuffer(Dart_Port port) {
if (port_buffer_ == NULL) {
@@ -105,6 +118,7 @@
bool start_called_;
bool end_called_;
MessageStatus* results_;
+ Monitor monitor_;
DISALLOW_COPY_AND_ASSIGN(TestMessageHandler);
};
@@ -335,8 +349,6 @@
ThreadPool pool;
TestMessageHandler handler;
MessageHandlerTestPeer handler_peer(&handler);
- int sleep = 0;
- const int kMaxSleep = 20 * 1000; // 20 seconds.
EXPECT(!handler.HasLivePorts());
handler_peer.increment_live_ports();
@@ -347,15 +359,17 @@
handler_peer.PostMessage(BlankMessage(port, Message::kNormalPriority));
// Wait for the first message to be handled.
- while (sleep < kMaxSleep && handler.message_count() < 1) {
- OS::Sleep(10);
- sleep += 10;
+ {
+ MonitorLocker ml(handler.monitor());
+ while (handler.message_count() < 1) {
+ ml.Wait();
+ }
+ EXPECT_EQ(1, handler.message_count());
+ EXPECT(handler.start_called());
+ EXPECT(!handler.end_called());
+ Dart_Port* handler_ports = handler.port_buffer();
+ EXPECT_EQ(port, handler_ports[0]);
}
- EXPECT_EQ(1, handler.message_count());
- EXPECT(handler.start_called());
- EXPECT(!handler.end_called());
- Dart_Port* handler_ports = handler.port_buffer();
- EXPECT_EQ(port, handler_ports[0]);
// Start a thread which sends more messages.
Dart_Port ports[10];
@@ -367,20 +381,24 @@
info.ports = ports;
info.count = 10;
OSThread::Start("SendMessages", SendMessages, reinterpret_cast<uword>(&info));
- while (sleep < kMaxSleep && handler.message_count() < 11) {
- OS::Sleep(10);
- sleep += 10;
+
+ // Wait for the messages to be handled.
+ {
+ MonitorLocker ml(handler.monitor());
+ while (handler.message_count() < 11) {
+ ml.Wait();
+ }
+ Dart_Port* handler_ports = handler.port_buffer();
+ EXPECT_EQ(11, handler.message_count());
+ EXPECT(handler.start_called());
+ EXPECT(!handler.end_called());
+ EXPECT_EQ(port, handler_ports[0]);
+ for (int i = 1; i < 11; i++) {
+ EXPECT_EQ(ports[i - 1], handler_ports[i]);
+ }
+ handler_peer.decrement_live_ports();
+ EXPECT(!handler.HasLivePorts());
}
- handler_ports = handler.port_buffer();
- EXPECT_EQ(11, handler.message_count());
- EXPECT(handler.start_called());
- EXPECT(!handler.end_called());
- EXPECT_EQ(port, handler_ports[0]);
- for (int i = 1; i < 11; i++) {
- EXPECT_EQ(ports[i - 1], handler_ports[i]);
- }
- handler_peer.decrement_live_ports();
- EXPECT(!handler.HasLivePorts());
}
} // namespace dart
diff --git a/runtime/vm/metrics.cc b/runtime/vm/metrics.cc
index 6194760..3a59272 100644
--- a/runtime/vm/metrics.cc
+++ b/runtime/vm/metrics.cc
@@ -22,54 +22,41 @@
Metric* Metric::vm_list_head_ = NULL;
-Metric::Metric()
- : isolate_(NULL),
- name_(NULL),
- description_(NULL),
- unit_(kCounter),
- value_(0),
- next_(NULL) {}
+Metric::Metric() : unit_(kCounter), value_(0) {}
+Metric::~Metric() {}
+
+void Metric::InitInstance(IsolateGroup* isolate_group,
+ const char* name,
+ const char* description,
+ Unit unit) {
+ // Only called once.
+ ASSERT(name != NULL);
+ isolate_group_ = isolate_group;
+ name_ = name;
+ description_ = description;
+ unit_ = unit;
+}
void Metric::InitInstance(Isolate* isolate,
const char* name,
const char* description,
Unit unit) {
// Only called once.
- ASSERT(next_ == NULL);
ASSERT(name != NULL);
isolate_ = isolate;
name_ = name;
description_ = description;
unit_ = unit;
- RegisterWithIsolate();
}
void Metric::InitInstance(const char* name,
const char* description,
Unit unit) {
// Only called once.
- ASSERT(next_ == NULL);
ASSERT(name != NULL);
name_ = name;
description_ = description;
unit_ = unit;
- RegisterWithVM();
-}
-
-void Metric::CleanupInstance() {
- // Only deregister metrics which had been registered. Metrics without a name
- // are from shallow copy isolates.
- if (name_ != NULL) {
- if (isolate_ == NULL) {
- DeregisterWithVM();
- } else {
- DeregisterWithIsolate();
- }
- }
-}
-
-Metric::~Metric() {
- CleanupInstance();
}
#ifndef PRODUCT
@@ -94,7 +81,7 @@
obj.AddProperty("name", name_);
obj.AddProperty("description", description_);
obj.AddProperty("unit", UnitString(unit()));
- if (isolate_ == NULL) {
+ if (isolate_ == nullptr && isolate_group_ == nullptr) {
obj.AddFixedServiceId("vm/metrics/%s", name_);
} else {
obj.AddFixedServiceId("metrics/native/%s", name_);
@@ -156,136 +143,40 @@
return zone->PrintToString("%s %s", name(), ValueToString(Value(), unit()));
}
-bool Metric::NameExists(Metric* head, const char* name) {
- ASSERT(name != NULL);
- while (head != NULL) {
- const char* metric_name = head->name();
- ASSERT(metric_name != NULL);
- if (strcmp(metric_name, name) == 0) {
- return true;
- }
- head = head->next();
- }
- return false;
-}
-
-void Metric::RegisterWithIsolate() {
- ASSERT(isolate_ != NULL);
- ASSERT(next_ == NULL);
- // No duplicate names allowed.
- ASSERT(!NameExists(isolate_->metrics_list_head(), name()));
- Metric* head = isolate_->metrics_list_head();
- if (head != NULL) {
- set_next(head);
- }
- isolate_->set_metrics_list_head(this);
-}
-
-void Metric::DeregisterWithIsolate() {
- Metric* head = isolate_->metrics_list_head();
- ASSERT(head != NULL);
- // Handle head of list case.
- if (head == this) {
- isolate_->set_metrics_list_head(next());
- set_next(NULL);
- return;
- }
- Metric* previous = NULL;
- while (true) {
- previous = head;
- ASSERT(previous != NULL);
- head = head->next();
- if (head == NULL) {
- break;
- }
- if (head == this) {
- // Remove this from list.
- previous->set_next(head->next());
- set_next(NULL);
- return;
- }
- ASSERT(head != NULL);
- }
- UNREACHABLE();
-}
-
-void Metric::RegisterWithVM() {
- ASSERT(isolate_ == NULL);
- ASSERT(next_ == NULL);
- // No duplicate names allowed.
- ASSERT(!NameExists(vm_list_head_, name()));
- Metric* head = vm_list_head_;
- if (head != NULL) {
- set_next(head);
- }
- vm_list_head_ = this;
-}
-
-void Metric::DeregisterWithVM() {
- ASSERT(isolate_ == NULL);
- Metric* head = vm_list_head_;
- if (head == NULL) {
- return;
- }
- // Handle head of list case.
- if (head == this) {
- vm_list_head_ = next();
- set_next(NULL);
- return;
- }
- Metric* previous = NULL;
- while (true) {
- previous = head;
- ASSERT(previous != NULL);
- head = head->next();
- if (head == NULL) {
- break;
- }
- if (head == this) {
- // Remove this from list.
- previous->set_next(head->next());
- set_next(NULL);
- return;
- }
- ASSERT(head != NULL);
- }
- UNREACHABLE();
-}
-
int64_t MetricHeapOldUsed::Value() const {
- ASSERT(isolate() == Isolate::Current());
- return isolate()->heap()->UsedInWords(Heap::kOld) * kWordSize;
+ ASSERT(isolate_group() == IsolateGroup::Current());
+ return isolate_group()->heap()->UsedInWords(Heap::kOld) * kWordSize;
}
int64_t MetricHeapOldCapacity::Value() const {
- ASSERT(isolate() == Isolate::Current());
- return isolate()->heap()->CapacityInWords(Heap::kOld) * kWordSize;
+ ASSERT(isolate_group() == IsolateGroup::Current());
+ return isolate_group()->heap()->CapacityInWords(Heap::kOld) * kWordSize;
}
int64_t MetricHeapOldExternal::Value() const {
- ASSERT(isolate() == Isolate::Current());
- return isolate()->heap()->ExternalInWords(Heap::kOld) * kWordSize;
+ ASSERT(isolate_group() == IsolateGroup::Current());
+ return isolate_group()->heap()->ExternalInWords(Heap::kOld) * kWordSize;
}
int64_t MetricHeapNewUsed::Value() const {
- ASSERT(isolate() == Isolate::Current());
- return isolate()->heap()->UsedInWords(Heap::kNew) * kWordSize;
+ ASSERT(isolate_group() == IsolateGroup::Current());
+ return isolate_group()->heap()->UsedInWords(Heap::kNew) * kWordSize;
}
int64_t MetricHeapNewCapacity::Value() const {
- ASSERT(isolate() == Isolate::Current());
- return isolate()->heap()->CapacityInWords(Heap::kNew) * kWordSize;
+ ASSERT(isolate_group() == IsolateGroup::Current());
+ return isolate_group()->heap()->CapacityInWords(Heap::kNew) * kWordSize;
}
int64_t MetricHeapNewExternal::Value() const {
- ASSERT(isolate() == Isolate::Current());
- return isolate()->heap()->ExternalInWords(Heap::kNew) * kWordSize;
+ ASSERT(isolate_group() == IsolateGroup::Current());
+ return isolate_group()->heap()->ExternalInWords(Heap::kNew) * kWordSize;
}
int64_t MetricHeapUsed::Value() const {
- ASSERT(isolate() == Isolate::Current());
- return isolate()->heap()->UsedInWords(Heap::kNew) * kWordSize +
- isolate()->heap()->UsedInWords(Heap::kOld) * kWordSize;
+ ASSERT(isolate_group() == IsolateGroup::Current());
+ return isolate_group()->heap()->UsedInWords(Heap::kNew) * kWordSize +
+ isolate_group()->heap()->UsedInWords(Heap::kOld) * kWordSize;
}
int64_t MetricIsolateCount::Value() const {
@@ -317,17 +208,13 @@
// Create a zone to allocate temporary strings in.
StackZone sz(Thread::Current());
OS::PrintErr("Printing metrics for VM\n");
- Metric* current = Metric::vm_head();
- while (current != NULL) {
- OS::PrintErr("%s\n", current->ToString());
- current = current->next();
- }
+
+#define VM_METRIC_INIT(type, variable, name, unit) \
+ OS::PrintErr("%s\n", vm_metric_##variable.ToString());
+ VM_METRIC_LIST(VM_METRIC_INIT);
+#undef VM_METRIC_INIT
OS::PrintErr("\n");
}
-#define VM_METRIC_CLEANUP(type, variable, name, unit) \
- vm_metric_##variable.CleanupInstance();
- VM_METRIC_LIST(VM_METRIC_CLEANUP);
-#undef VM_METRIC_CLEANUP
}
MaxMetric::MaxMetric() : Metric() {
diff --git a/runtime/vm/metrics.h b/runtime/vm/metrics.h
index 36d9e4b..ea17ad4 100644
--- a/runtime/vm/metrics.h
+++ b/runtime/vm/metrics.h
@@ -10,10 +10,11 @@
namespace dart {
class Isolate;
+class IsolateGroup;
class JSONStream;
-// Metrics for each isolate.
-#define ISOLATE_METRIC_LIST(V) \
+// Metrics for each isolate group.
+#define ISOLATE_GROUP_METRIC_LIST(V) \
V(MetricHeapOldUsed, HeapOldUsed, "heap.old.used", kByte) \
V(MaxMetric, HeapOldUsedMax, "heap.old.used.max", kByte) \
V(MetricHeapOldCapacity, HeapOldCapacity, "heap.old.capacity", kByte) \
@@ -25,7 +26,10 @@
V(MaxMetric, HeapNewCapacityMax, "heap.new.capacity.max", kByte) \
V(MetricHeapNewExternal, HeapNewExternal, "heap.new.external", kByte) \
V(MetricHeapUsed, HeapGlobalUsed, "heap.global.used", kByte) \
- V(MaxMetric, HeapGlobalUsedMax, "heap.global.used.max", kByte) \
+ V(MaxMetric, HeapGlobalUsedMax, "heap.global.used.max", kByte)
+
+// Metrics for each isolate.
+#define ISOLATE_METRIC_LIST(V) \
V(Metric, RunnableLatency, "isolate.runnable.latency", kMicrosecond) \
V(Metric, RunnableHeapSize, "isolate.runnable.heap", kByte)
@@ -48,16 +52,20 @@
static void Cleanup();
- // Initialize and register a metric for an isolate.
+ // Initialize a metric for an isolate.
void InitInstance(Isolate* isolate,
const char* name,
const char* description,
Unit unit);
- // Initialize and register a metric for the VM.
- void InitInstance(const char* name, const char* description, Unit unit);
+ // Initialize a metric for an isolate group.
+ void InitInstance(IsolateGroup* isolate_group,
+ const char* name,
+ const char* description,
+ Unit unit);
- void CleanupInstance();
+ // Initialize a metric for the VM.
+ void InitInstance(const char* name, const char* description, Unit unit);
virtual ~Metric();
@@ -76,16 +84,16 @@
void increment() { value_++; }
- Metric* next() const { return next_; }
- void set_next(Metric* next) { next_ = next; }
-
const char* name() const { return name_; }
const char* description() const { return description_; }
Unit unit() const { return unit_; }
- // Will be NULL for Metric that is VM-global.
+ // Only non-null for isolate specific metrics.
Isolate* isolate() const { return isolate_; }
+ // Only non-null for isolate group specific metrics.
+ IsolateGroup* isolate_group() const { return isolate_group_; }
+
static Metric* vm_head() { return vm_list_head_; }
// Override to get a callback when value is serialized to JSON.
@@ -93,19 +101,12 @@
virtual int64_t Value() const { return value(); }
private:
- Isolate* isolate_;
- const char* name_;
- const char* description_;
+ Isolate* isolate_ = nullptr;
+ IsolateGroup* isolate_group_ = nullptr;
+ const char* name_ = nullptr;
+ const char* description_ = nullptr;
Unit unit_;
int64_t value_;
- Metric* next_;
-
- static bool NameExists(Metric* head, const char* name);
-
- void RegisterWithIsolate();
- void DeregisterWithIsolate();
- void RegisterWithVM();
- void DeregisterWithVM();
static Metric* vm_list_head_;
DISALLOW_COPY_AND_ASSIGN(Metric);
diff --git a/runtime/vm/native_entry.cc b/runtime/vm/native_entry.cc
index 8cb8001..1b3c546 100644
--- a/runtime/vm/native_entry.cc
+++ b/runtime/vm/native_entry.cc
@@ -206,7 +206,7 @@
ASSERT(thread->execution_state() == Thread::kThreadInGenerated);
{
Isolate* isolate = thread->isolate();
- ApiState* state = isolate->api_state();
+ ApiState* state = isolate->group()->api_state();
ASSERT(state != NULL);
TRACE_NATIVE_CALL("0x%" Px "", reinterpret_cast<uintptr_t>(func));
thread->EnterApiScope();
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index e1417a9..f4e247a 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -73,9 +73,8 @@
show_internal_names,
false,
"Show names of internal classes (e.g. \"OneByteString\") in error messages "
- "instead of showing the corresponding interface names (e.g. \"String\")");
-// TODO(regis): Remove this temporary flag used to debug nullability.
-DEFINE_FLAG(bool, show_nullability, false, "Show nullability in type names");
+ "instead of showing the corresponding interface names (e.g. \"String\"). "
+ "Also show legacy nullability in type names.");
DEFINE_FLAG(bool, use_lib_cache, false, "Use library name cache");
DEFINE_FLAG(bool, use_exp_cache, false, "Use library exported name cache");
@@ -2507,6 +2506,8 @@
cur += kWordSize;
}
} else {
+ // Check that MemorySantizer understands this is initialized.
+ MSAN_CHECK_INITIALIZED(reinterpret_cast<void*>(address), size);
#if defined(DEBUG)
while (cur < end) {
ASSERT(*reinterpret_cast<uword*>(cur) == initial_value);
@@ -2540,8 +2541,7 @@
}
ASSERT(vtable() == builtin_vtables_[cid]);
if (FLAG_verify_handles && raw_->IsHeapObject()) {
- Isolate* isolate = Isolate::Current();
- Heap* isolate_heap = isolate->heap();
+ Heap* isolate_heap = IsolateGroup::Current()->heap();
Heap* vm_isolate_heap = Dart::vm_isolate()->heap();
uword addr = RawObject::ToAddr(raw_);
if (!isolate_heap->Contains(addr) && !vm_isolate_heap->Contains(addr)) {
@@ -2577,7 +2577,7 @@
}
}
#ifndef PRODUCT
- auto class_table = thread->isolate()->shared_class_table();
+ auto class_table = thread->isolate_group()->class_table();
if (class_table->TraceAllocationFor(cls_id)) {
Profiler::SampleAllocation(thread, cls_id);
}
@@ -2604,7 +2604,7 @@
class WriteBarrierUpdateVisitor : public ObjectPointerVisitor {
public:
explicit WriteBarrierUpdateVisitor(Thread* thread, RawObject* obj)
- : ObjectPointerVisitor(thread->isolate()),
+ : ObjectPointerVisitor(thread->isolate()->group()),
thread_(thread),
old_obj_(obj) {
ASSERT(old_obj_->IsOldObject());
@@ -3235,7 +3235,7 @@
if (FLAG_precompiled_mode) {
host_bitmap =
- Isolate::Current()->shared_class_table()->GetUnboxedFieldsMapAt(
+ Isolate::Current()->group()->class_table()->GetUnboxedFieldsMapAt(
super.id());
}
}
@@ -3701,7 +3701,8 @@
// Sets the new size in the class table.
isolate->class_table()->SetAt(id(), raw());
if (FLAG_precompiled_mode) {
- isolate->shared_class_table()->SetUnboxedFieldsMapAt(id(), host_bitmap);
+ isolate->group()->class_table()->SetUnboxedFieldsMapAt(id(),
+ host_bitmap);
}
}
}
@@ -3797,7 +3798,7 @@
bool Class::TraceAllocation(Isolate* isolate) const {
#ifndef PRODUCT
- auto class_table = isolate->shared_class_table();
+ auto class_table = isolate->group()->class_table();
return class_table->TraceAllocationFor(id());
#else
return false;
@@ -3809,7 +3810,7 @@
Isolate* isolate = Isolate::Current();
const bool changed = trace_allocation != this->TraceAllocation(isolate);
if (changed) {
- auto class_table = isolate->shared_class_table();
+ auto class_table = isolate->group()->class_table();
class_table->SetTraceAllocationFor(id(), trace_allocation);
DisableAllocationStub();
}
@@ -4858,56 +4859,94 @@
(library() == Library::AsyncLibrary());
}
-// Checks if type S is a subtype of type T, assuming that S is non-nullable.
-// Type S is specified by class 'cls' parameterized with 'type_arguments', and
-// type T by class 'other' parameterized with 'other_type_arguments'.
+// Checks if type T0 is a subtype of type T1, assuming that T0 is non-nullable.
+// Type T0 is specified by class 'cls' parameterized with 'type_arguments', and
+// type T1 is specified by 'other' and must have a type class.
// This class and class 'other' do not need to be finalized, however, they must
// be resolved as well as their interfaces.
bool Class::IsSubtypeOf(NNBDMode mode,
const Class& cls,
const TypeArguments& type_arguments,
- const Class& other,
- const TypeArguments& other_type_arguments,
+ const AbstractType& other,
Heap::Space space) {
- // This function does not support Null, dynamic, or void as type S.
- ASSERT(!cls.IsNullClass() && !cls.IsDynamicClass() && !cls.IsVoidClass());
- // Since we assume that S is non-nullable, the nullability of T is irrelevant.
- if (other.IsDynamicClass() || other.IsVoidClass() || other.IsObjectClass()) {
+ // This function does not support Null, Never, dynamic, or void as type T0.
+ classid_t this_cid = cls.id();
+ ASSERT(this_cid != kNullCid && this_cid != kNeverCid &&
+ this_cid != kDynamicCid && this_cid != kVoidCid);
+ // Type T1 must have a type class (e.g. not a type parameter).
+ ASSERT(other.HasTypeClass());
+ const classid_t other_cid = other.type_class_id();
+ // Since T0 is assumed non-nullable, the nullability of T1 is irrelevant.
+ if (other_cid == kDynamicCid || other_cid == kVoidCid ||
+ other_cid == kObjectCid) {
return true;
}
- // Use the 'this_class' object as if it was the receiver of this method, but
- // instead of recursing, reset it to the super class and loop.
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
+ const Class& other_class = Class::Handle(zone, other.type_class());
+ const TypeArguments& other_type_arguments =
+ TypeArguments::Handle(zone, other.arguments());
+ // Use the 'this_class' object as if it was the receiver of this method, but
+ // instead of recursing, reset it to the super class and loop.
Class& this_class = Class::Handle(zone, cls.raw());
while (true) {
- // Apply additional subtyping rules if 'other' is 'FutureOr'.
- if (other.IsFutureOrClass()) {
- if (other_type_arguments.IsNull()) {
- return true;
+ // Apply additional subtyping rules if T0 or T1 are 'FutureOr'.
+
+ // Left FutureOr:
+ // if T0 is FutureOr<S0> then:
+ // T0 <: T1 iff Future<S0> <: T1 and S0 <: T1
+ if (this_cid == kFutureOrCid) {
+ // Check Future<S0> <: T1.
+ ObjectStore* object_store = Isolate::Current()->object_store();
+ const Class& future_class =
+ Class::Handle(zone, object_store->future_class());
+ ASSERT(!future_class.IsNull() && future_class.NumTypeParameters() == 1 &&
+ this_class.NumTypeParameters() == 1);
+ ASSERT(type_arguments.IsNull() || type_arguments.Length() >= 1);
+ if (Class::IsSubtypeOf(mode, future_class, type_arguments, other,
+ space)) {
+ // Check S0 <: T1.
+ const AbstractType& type_arg =
+ AbstractType::Handle(zone, type_arguments.TypeAtNullSafe(0));
+ if (type_arg.IsSubtypeOf(mode, other, space)) {
+ return true;
+ }
}
+ }
+
+ // Right FutureOr:
+ // if T1 is FutureOr<S1> then:
+ // T0 <: T1 iff any of the following hold:
+ // either T0 <: Future<S1>
+ // or T0 <: S1
+ // or T0 is X0 and X0 has bound S0 and S0 <: T1 (checked elsewhere)
+ if (other_cid == kFutureOrCid) {
const AbstractType& other_type_arg =
- AbstractType::Handle(zone, other_type_arguments.TypeAt(0));
+ AbstractType::Handle(zone, other_type_arguments.TypeAtNullSafe(0));
+ // Check if S1 is a top type.
if (other_type_arg.IsTopType()) {
return true;
}
- if (!type_arguments.IsNull() && this_class.IsFutureClass()) {
+ // Check T0 <: Future<S1> when T0 is Future<S0>.
+ if (this_class.IsFutureClass()) {
const AbstractType& type_arg =
- AbstractType::Handle(zone, type_arguments.TypeAt(0));
+ AbstractType::Handle(zone, type_arguments.TypeAtNullSafe(0));
+ // If T0 is Future<S0>, then T0 <: Future<S1>, iff S0 <: S1.
if (type_arg.IsSubtypeOf(mode, other_type_arg, space)) {
return true;
}
}
+ // Check T0 <: Future<S1> when T0 is FutureOr<S0> is already done.
+ // Check T0 <: S1.
if (other_type_arg.HasTypeClass() &&
- Class::IsSubtypeOf(
- mode, this_class, type_arguments,
- Class::Handle(zone, other_type_arg.type_class()),
- TypeArguments::Handle(zone, other_type_arg.arguments()), space)) {
+ Class::IsSubtypeOf(mode, this_class, type_arguments, other_type_arg,
+ space)) {
return true;
}
}
+
// Check for reflexivity.
- if (this_class.raw() == other.raw()) {
+ if (this_class.raw() == other_class.raw()) {
const intptr_t num_type_params = this_class.NumTypeParameters();
if (num_type_params == 0) {
return true;
@@ -4961,7 +5000,7 @@
continue;
}
if (Class::IsSubtypeOf(mode, interface_class, interface_args, other,
- other_type_arguments, space)) {
+ space)) {
return true;
}
}
@@ -4970,6 +5009,7 @@
if (this_class.IsNull()) {
return false;
}
+ this_cid = this_class.id();
}
UNREACHABLE();
return false;
@@ -5625,7 +5665,11 @@
for (intptr_t i = 0; i < len; i++) {
if (from_index + i < Length()) {
type = TypeAt(from_index + i);
- type.PrintName(name_visibility, printer);
+ if (type.IsNull()) {
+ printer->AddString("null"); // Unfinalized vector.
+ } else {
+ type.PrintName(name_visibility, printer);
+ }
} else {
printer->AddString("dynamic");
}
@@ -5833,12 +5877,10 @@
if ((type_param.index() != i) || type_param.IsFunctionTypeParameter()) {
return false;
}
- // If this type parameter specifies an upper bound, then the type argument
- // vector does not really represent the identity vector. It cannot be
- // substituted by the instantiator's type argument vector without checking
- // the upper bound.
- const AbstractType& bound = AbstractType::Handle(type_param.bound());
- if (!bound.IsObjectType() && !bound.IsDynamicType()) {
+ // Instantiating nullable and legacy type parameters may change
+ // nullability of a type, so type arguments vector containing such type
+ // parameters cannot be substituted with instantiator type arguments.
+ if (type_param.IsNullable() || type_param.IsLegacy()) {
return false;
}
}
@@ -7036,6 +7078,67 @@
StorePointer(&raw_ptr()->parameter_names_, value.raw());
}
+intptr_t Function::NameArrayLengthIncludingFlags(intptr_t num_parameters) {
+ return num_parameters +
+ (num_parameters + compiler::target::kNumParameterFlagsPerElement - 1) /
+ compiler::target::kNumParameterFlagsPerElement;
+}
+
+intptr_t Function::GetRequiredFlagIndex(intptr_t index,
+ intptr_t* flag_mask) const {
+ ASSERT(index >= num_fixed_parameters());
+ index -= num_fixed_parameters();
+ *flag_mask = 1 << (index % compiler::target::kNumParameterFlagsPerElement);
+ return NumParameters() +
+ index / compiler::target::kNumParameterFlagsPerElement;
+}
+
+bool Function::IsRequiredAt(intptr_t index) const {
+ if (index < num_fixed_parameters()) {
+ return false;
+ }
+ intptr_t flag_mask;
+ const intptr_t flag_index = GetRequiredFlagIndex(index, &flag_mask);
+ const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_);
+ if (flag_index >= parameter_names.Length()) {
+ return false;
+ }
+ RawObject* element = parameter_names.At(flag_index);
+ if (element == Object::null()) {
+ return false;
+ }
+ const intptr_t flag = Smi::Value(Smi::RawCast(element));
+ return (flag & flag_mask) != 0;
+}
+
+void Function::SetIsRequiredAt(intptr_t index) const {
+ intptr_t flag_mask;
+ const intptr_t flag_index = GetRequiredFlagIndex(index, &flag_mask);
+ const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_);
+ ASSERT(flag_index < parameter_names.Length());
+ intptr_t flag;
+ RawObject* element = parameter_names.At(flag_index);
+ if (element == Object::null()) {
+ flag = 0;
+ } else {
+ flag = Smi::Value(Smi::RawCast(element));
+ }
+ parameter_names.SetAt(flag_index, Object::Handle(Smi::New(flag | flag_mask)));
+}
+
+void Function::TruncateUnusedParameterFlags() const {
+ // Truncate the parameter names array to remove unused flags from the end.
+ const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_);
+ const intptr_t num_params = NumParameters();
+ intptr_t last_required_flag = parameter_names.Length() - 1;
+ for (; last_required_flag >= num_params; --last_required_flag) {
+ if (parameter_names.At(last_required_flag) != Object::null()) {
+ break;
+ }
+ }
+ parameter_names.Truncate(last_required_flag + 1);
+}
+
void Function::set_type_parameters(const TypeArguments& value) const {
StorePointer(&raw_ptr()->type_parameters_, value.raw());
}
@@ -7375,7 +7478,7 @@
num_named_arguments, error_message)) {
return false;
}
- if (mode != NNBDMode::kLegacyLib) {
+ if (FLAG_null_safety) {
// TODO(regis): Check required named arguments.
}
// Verify that all argument names are valid parameter names.
@@ -7743,6 +7846,7 @@
return false;
}
if (num_type_params > 0) {
+ const NNBDMode mode = nnbd_mode(); // TODO(regis): Remove unused mode.
const TypeArguments& type_params =
TypeArguments::Handle(zone, type_parameters());
ASSERT(!type_params.IsNull());
@@ -7760,8 +7864,16 @@
ASSERT(bound.IsFinalized());
other_bound = other_type_param.bound();
ASSERT(other_bound.IsFinalized());
- if (!bound.IsEquivalent(other_bound, kind)) {
- return false;
+ if (Dart::non_nullable_flag() && kind == TypeEquality::kInSubtypeTest) {
+ // Bounds that are mutual subtypes are considered equal.
+ if (!bound.IsSubtypeOf(mode, other_bound, Heap::kOld) ||
+ !other_bound.IsSubtypeOf(mode, bound, Heap::kOld)) {
+ return false;
+ }
+ } else {
+ if (!bound.IsEquivalent(other_bound, kind)) {
+ return false;
+ }
}
}
}
@@ -7771,9 +7883,6 @@
bool Function::IsSubtypeOf(NNBDMode mode,
const Function& other,
Heap::Space space) const {
- if (mode != NNBDMode::kLegacyLib) {
- // TODO(regis): Check required named parameters.
- }
const intptr_t num_fixed_params = num_fixed_parameters();
const intptr_t num_opt_pos_params = NumOptionalPositionalParameters();
const intptr_t num_opt_named_params = NumOptionalNamedParameters();
@@ -7795,8 +7904,7 @@
return false;
}
// Check the type parameters and bounds of generic functions.
- if (!HasSameTypeParametersAndBounds(other,
- TypeEquality::kSubtypeNullability)) {
+ if (!HasSameTypeParametersAndBounds(other, TypeEquality::kInSubtypeTest)) {
return false;
}
Thread* thread = Thread::Current();
@@ -7837,6 +7945,7 @@
for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) {
other_param_name = other.ParameterNameAt(i);
ASSERT(other_param_name.IsSymbol());
+ const bool other_is_required = other.IsRequiredAt(i);
found_param_name = false;
for (intptr_t j = num_fixed_params; j < num_params; j++) {
ASSERT(String::Handle(zone, ParameterNameAt(j)).IsSymbol());
@@ -7845,6 +7954,9 @@
if (!IsContravariantParameter(mode, j, other, i, space)) {
return false;
}
+ if (FLAG_null_safety && IsRequiredAt(j) && !other_is_required) {
+ return false;
+ }
break;
}
}
@@ -8093,12 +8205,14 @@
const int num_opt_params = NumOptionalParameters();
const bool has_opt_pos_params = HasOptionalPositionalParameters();
const int num_params = num_fixed_params + num_opt_params;
+ const int num_required_flags =
+ Array::Handle(zone, parameter_names()).Length() - NumParameters();
closure_function.set_num_fixed_parameters(num_fixed_params);
closure_function.SetNumOptionalParameters(num_opt_params, has_opt_pos_params);
closure_function.set_parameter_types(
Array::Handle(zone, Array::New(num_params, Heap::kOld)));
- closure_function.set_parameter_names(
- Array::Handle(zone, Array::New(num_params, Heap::kOld)));
+ closure_function.set_parameter_names(Array::Handle(
+ zone, Array::New(num_params + num_required_flags, Heap::kOld)));
AbstractType& param_type = AbstractType::Handle(zone);
String& param_name = String::Handle(zone);
// Add implicit closure object parameter.
@@ -8110,6 +8224,9 @@
closure_function.SetParameterTypeAt(i, param_type);
param_name = ParameterNameAt(has_receiver - kClosure + i);
closure_function.SetParameterNameAt(i, param_name);
+ if (IsRequiredAt(has_receiver - kClosure + i)) {
+ closure_function.SetIsRequiredAt(i);
+ }
}
closure_function.InheritBinaryDeclarationFrom(*this);
@@ -8203,6 +8320,9 @@
printer->AddString("{");
}
for (intptr_t i = num_fixed_params; i < num_params; i++) {
+ if (IsRequiredAt(i)) {
+ printer->AddString("required ");
+ }
param_type = ParameterTypeAt(i);
ASSERT(!param_type.IsNull());
param_type.PrintName(name_visibility, printer);
@@ -14495,23 +14615,26 @@
data_pos = 0;
}
data.SetAt(data_pos, Smi::Handle(Smi::New(receiver_class_id)));
- if (Isolate::Current()->compilation_allowed()) {
- data.SetAt(data_pos + TargetIndexFor(kNumArgsTested), target);
- data.SetAt(data_pos + CountIndexFor(kNumArgsTested),
- Smi::Handle(Smi::New(count)));
- if (is_tracking_exactness()) {
- data.SetAt(data_pos + ExactnessIndexFor(kNumArgsTested),
- Smi::Handle(Smi::New(exactness.Encode())));
- }
- } else {
- // Precompilation only, after all functions have been compiled.
- ASSERT(target.HasCode());
- const Code& code = Code::Handle(target.CurrentCode());
- const Smi& entry_point =
- Smi::Handle(Smi::FromAlignedAddress(code.EntryPoint()));
- data.SetAt(data_pos + CodeIndexFor(kNumArgsTested), code);
- data.SetAt(data_pos + EntryPointIndexFor(kNumArgsTested), entry_point);
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ // JIT
+ data.SetAt(data_pos + TargetIndexFor(kNumArgsTested), target);
+ data.SetAt(data_pos + CountIndexFor(kNumArgsTested),
+ Smi::Handle(Smi::New(count)));
+ if (is_tracking_exactness()) {
+ data.SetAt(data_pos + ExactnessIndexFor(kNumArgsTested),
+ Smi::Handle(Smi::New(exactness.Encode())));
}
+#else
+ // AOT
+ ASSERT(target.HasCode());
+ const Code& code = Code::Handle(target.CurrentCode());
+ const Smi& entry_point =
+ Smi::Handle(Smi::FromAlignedAddress(code.EntryPoint()));
+ data.SetAt(data_pos + CodeIndexFor(kNumArgsTested), code);
+ data.SetAt(data_pos + EntryPointIndexFor(kNumArgsTested), entry_point);
+#endif
+
// Multithreaded access to ICData requires setting of array to be the last
// operation.
set_entries(data);
@@ -14623,7 +14746,10 @@
}
RawFunction* ICData::GetTargetAt(intptr_t index) const {
- ASSERT(Isolate::Current()->compilation_allowed());
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return nullptr;
+#else
const intptr_t data_pos =
index * TestEntryLength() + TargetIndexFor(NumArgsTested());
ASSERT(Object::Handle(Array::Handle(entries()).At(data_pos)).IsFunction());
@@ -14631,6 +14757,7 @@
NoSafepointScope no_safepoint;
RawArray* raw_data = entries();
return reinterpret_cast<RawFunction*>(raw_data->ptr()->data()[data_pos]);
+#endif
}
RawObject* ICData::GetTargetOrCodeAt(intptr_t index) const {
@@ -14662,7 +14789,10 @@
}
intptr_t ICData::GetCountAt(intptr_t index) const {
- ASSERT(Isolate::Current()->compilation_allowed());
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return 0;
+#else
Thread* thread = Thread::Current();
REUSABLE_ARRAY_HANDLESCOPE(thread);
Array& data = thread->ArrayHandle();
@@ -14676,6 +14806,7 @@
// would rather just reset it to zero.
SetCountAt(index, 0);
return 0;
+#endif
}
intptr_t ICData::AggregateCount() const {
@@ -14689,7 +14820,9 @@
}
void ICData::SetCodeAt(intptr_t index, const Code& value) const {
- ASSERT(!Isolate::Current()->compilation_allowed());
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
Thread* thread = Thread::Current();
REUSABLE_ARRAY_HANDLESCOPE(thread);
Array& data = thread->ArrayHandle();
@@ -14697,10 +14830,13 @@
const intptr_t data_pos =
index * TestEntryLength() + CodeIndexFor(NumArgsTested());
data.SetAt(data_pos, value);
+#endif
}
void ICData::SetEntryPointAt(intptr_t index, const Smi& value) const {
- ASSERT(!Isolate::Current()->compilation_allowed());
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
Thread* thread = Thread::Current();
REUSABLE_ARRAY_HANDLESCOPE(thread);
Array& data = thread->ArrayHandle();
@@ -14708,6 +14844,7 @@
const intptr_t data_pos =
index * TestEntryLength() + EntryPointIndexFor(NumArgsTested());
data.SetAt(data_pos, value);
+#endif
}
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -15448,27 +15585,40 @@
return code.raw();
}
+#if defined(DART_PRECOMPILER)
+DECLARE_FLAG(charp, write_v8_snapshot_profile_to);
+#endif // defined(DART_PRECOMPILER)
+
RawCode* Code::FinalizeCode(FlowGraphCompiler* compiler,
compiler::Assembler* assembler,
PoolAttachment pool_attachment,
bool optimized,
CodeStatistics* stats /* = nullptr */) {
DEBUG_ASSERT(IsMutatorOrAtSafepoint());
- Isolate* isolate = Isolate::Current();
- if (!isolate->compilation_allowed()) {
- FATAL(
- "Compilation is not allowed (precompilation might have missed a "
- "code\n");
- }
ASSERT(assembler != NULL);
- const auto object_pool =
- pool_attachment == PoolAttachment::kAttachPool
- ? &ObjectPool::Handle(assembler->HasObjectPoolBuilder()
- ? ObjectPool::NewFromBuilder(
- assembler->object_pool_builder())
- : ObjectPool::empty_object_pool().raw())
- : nullptr;
+ ObjectPool& object_pool = ObjectPool::Handle();
+
+ if (pool_attachment == PoolAttachment::kAttachPool) {
+ if (assembler->HasObjectPoolBuilder()) {
+ object_pool =
+ ObjectPool::NewFromBuilder(assembler->object_pool_builder());
+ } else {
+ object_pool = ObjectPool::empty_object_pool().raw();
+ }
+ } else {
+#if defined(DART_PRECOMPILER)
+ if (FLAG_write_v8_snapshot_profile_to != nullptr &&
+ assembler->HasObjectPoolBuilder() &&
+ assembler->object_pool_builder().HasParent()) {
+ // We are not going to write this pool into snapshot, but we will use
+ // it to emit references from code object to other objects in the
+ // snapshot that it caused to be added to the pool.
+ object_pool =
+ ObjectPool::NewFromBuilder(assembler->object_pool_builder());
+ }
+#endif // defined(DART_PRECOMPILER)
+ }
// Allocate the Code and Instructions objects. Code is allocated first
// because a GC during allocation of the code will leave the instruction
@@ -15548,8 +15698,8 @@
code.set_is_alive(true);
// Set object pool in Instructions object.
- if (pool_attachment == PoolAttachment::kAttachPool) {
- code.set_object_pool(object_pool->raw());
+ if (!object_pool.IsNull()) {
+ code.set_object_pool(object_pool.raw());
}
#if defined(DART_PRECOMPILER)
@@ -17116,8 +17266,8 @@
}
uint32_t Instance::CanonicalizeHash() const {
- if (IsNull()) {
- return 2011;
+ if (GetClassId() == kNullCid) {
+ return 2011; // Matches null_patch.dart.
}
Thread* thread = Thread::Current();
uint32_t hash = thread->heap()->GetCanonicalHash(raw());
@@ -17130,8 +17280,9 @@
hash = instance_size / kWordSize;
uword this_addr = reinterpret_cast<uword>(this->raw_ptr());
Instance& member = Instance::Handle();
+
const auto unboxed_fields_bitmap =
- thread->isolate()->shared_class_table()->GetUnboxedFieldsMapAt(
+ thread->isolate()->group()->class_table()->GetUnboxedFieldsMapAt(
GetClassId());
for (intptr_t offset = Instance::NextFieldOffset(); offset < instance_size;
@@ -17152,8 +17303,8 @@
#if defined(DEBUG)
class CheckForPointers : public ObjectPointerVisitor {
public:
- explicit CheckForPointers(Isolate* isolate)
- : ObjectPointerVisitor(isolate), has_pointers_(false) {}
+ explicit CheckForPointers(IsolateGroup* isolate_group)
+ : ObjectPointerVisitor(isolate_group), has_pointers_(false) {}
bool has_pointers() const { return has_pointers_; }
@@ -17183,7 +17334,7 @@
const intptr_t instance_size = SizeFromClass();
ASSERT(instance_size != 0);
const auto unboxed_fields_bitmap =
- thread->isolate()->shared_class_table()->GetUnboxedFieldsMapAt(
+ thread->isolate()->group()->class_table()->GetUnboxedFieldsMapAt(
GetClassId());
for (intptr_t offset = Instance::NextFieldOffset(); offset < instance_size;
offset += kWordSize) {
@@ -17210,7 +17361,7 @@
} else {
#if defined(DEBUG)
// Make sure that we are not missing any fields.
- CheckForPointers has_pointers(Isolate::Current());
+ CheckForPointers has_pointers(Isolate::Current()->group());
this->raw()->VisitPointers(&has_pointers);
ASSERT(!has_pointers.has_pointers());
#endif // DEBUG
@@ -17433,7 +17584,7 @@
// In weak mode type casts, whether in legacy or opted-in libraries, the null
// instance is detected and handled in inlined code and therefore cannot be
// encountered here as a Dart null receiver.
- ASSERT(FLAG_strong_non_nullable_type_checks || !IsNull());
+ ASSERT(FLAG_null_safety || !IsNull());
// In strong mode, compute NNBD_SUBTYPE(runtimeType, other).
// In weak mode, compute LEGACY_SUBTYPE(runtimeType, other).
return RuntimeTypeIsSubtypeOf(mode, other, other_instantiator_type_arguments,
@@ -17452,30 +17603,45 @@
const TypeArguments& other_function_type_arguments) {
ASSERT(other.IsFinalized());
ASSERT(!other.IsTypeRef()); // Must be dereferenced at compile time.
- // TODO(regis): Verify that the nullability of an instantiated FutureOr
- // always matches the nullability of its type argument. For now, be safe.
- AbstractType& type = AbstractType::Handle(other.UnwrapFutureOr());
- Nullability nullability = type.nullability();
- if (nullability == Nullability::kNullable) {
+ if (other.IsNullable()) {
// The type will remain nullable after instantiation.
return true;
}
+ if (other.IsFutureOrType()) {
+ const auto& type = AbstractType::Handle(other.UnwrapFutureOr());
+ return NullIsInstanceOf(mode, type, other_instantiator_type_arguments,
+ other_function_type_arguments);
+ }
// No need to instantiate type, unless it is a type parameter.
// Note that a typeref cannot refer to a type parameter.
- if (type.IsTypeParameter()) {
- type = type.InstantiateFrom(mode, other_instantiator_type_arguments,
- other_function_type_arguments, kAllFree, NULL,
- Heap::kOld);
+ if (other.IsTypeParameter()) {
+ auto& type = AbstractType::Handle(other.InstantiateFrom(
+ mode, other_instantiator_type_arguments, other_function_type_arguments,
+ kAllFree, NULL, Heap::kOld));
if (type.IsTypeRef()) {
type = TypeRef::Cast(type).type();
}
- type = type.UnwrapFutureOr();
+ return Instance::NullIsInstanceOf(mode, type, Object::null_type_arguments(),
+ Object::null_type_arguments());
}
- nullability = type.nullability();
- if (nullability == Nullability::kLegacy) {
- return type.IsNullType() || type.IsTopType() || type.IsNeverType();
+ return other.IsLegacy() && (other.IsTopType() || other.IsNeverType());
+}
+
+bool Instance::NullIsAssignableTo(const AbstractType& other) {
+ // In weak mode, Null is a bottom type (according to LEGACY_SUBTYPE).
+ if (!FLAG_null_safety) {
+ return true;
}
- return nullability == Nullability::kNullable;
+ // "Left Null" rule: null is assignable when destination type is either
+ // legacy or nullable. Otherwise it is not assignable or we cannot tell
+ // without instantiating type parameter.
+ if (other.IsLegacy() || other.IsNullable()) {
+ return true;
+ }
+ if (other.IsFutureOrType()) {
+ return NullIsAssignableTo(AbstractType::Handle(other.UnwrapFutureOr()));
+ }
+ return false;
}
bool Instance::RuntimeTypeIsSubtypeOf(
@@ -17492,7 +17658,7 @@
return true;
}
// In weak testing mode, Null type is a subtype of any type.
- if (IsNull() && !FLAG_strong_non_nullable_type_checks) {
+ if (IsNull() && !FLAG_null_safety) {
return true;
}
Thread* thread = Thread::Current();
@@ -17558,7 +17724,7 @@
return false;
}
if (IsNull()) {
- ASSERT(FLAG_strong_non_nullable_type_checks);
+ ASSERT(FLAG_null_safety);
if (instantiated_other.IsNullType()) {
return true;
}
@@ -17569,35 +17735,28 @@
}
// RuntimeType of non-null instance is non-nullable, so there is no need to
// check nullability of other type.
- return Class::IsSubtypeOf(
- mode, cls, type_arguments,
- Class::Handle(zone, instantiated_other.type_class()),
- TypeArguments::Handle(zone, instantiated_other.arguments()), Heap::kOld);
+ return Class::IsSubtypeOf(mode, cls, type_arguments, instantiated_other,
+ Heap::kOld);
}
bool Instance::IsFutureOrInstanceOf(Zone* zone,
NNBDMode mode,
const AbstractType& other) const {
- if (other.IsType() && other.IsFutureOrType()) {
- if (other.arguments() == TypeArguments::null()) {
- return true;
- }
+ if (other.IsFutureOrType()) {
const TypeArguments& other_type_arguments =
TypeArguments::Handle(zone, other.arguments());
const AbstractType& other_type_arg =
- AbstractType::Handle(zone, other_type_arguments.TypeAt(0));
+ AbstractType::Handle(zone, other_type_arguments.TypeAtNullSafe(0));
if (other_type_arg.IsTopType()) {
return true;
}
if (Class::Handle(zone, clazz()).IsFutureClass()) {
const TypeArguments& type_arguments =
TypeArguments::Handle(zone, GetTypeArguments());
- if (!type_arguments.IsNull()) {
- const AbstractType& type_arg =
- AbstractType::Handle(zone, type_arguments.TypeAt(0));
- if (type_arg.IsSubtypeOf(mode, other_type_arg, Heap::kOld)) {
- return true;
- }
+ const AbstractType& type_arg =
+ AbstractType::Handle(zone, type_arguments.TypeAtNullSafe(0));
+ if (type_arg.IsSubtypeOf(mode, other_type_arg, Heap::kOld)) {
+ return true;
}
}
// Retry RuntimeTypeIsSubtypeOf after unwrapping type arg of FutureOr.
@@ -17832,18 +17991,12 @@
Nullability result_nullability;
const Nullability arg_nullability = nullability();
const Nullability var_nullability = type_param.nullability();
- // Adjust nullability of result 'arg' instantiated from 'var' (x throws).
+ // Adjust nullability of result 'arg' instantiated from 'var'.
// arg/var ! ? * %
// ! ! ? * !
- // ? x ? ? ?
+ // ? ? ? ? ?
// * * ? * *
- // % x ? * %
- // If the assert below triggers, file an issue against CFE.
- // A non-nullable type parameter cannot be instantiated to a nullable type.
- ASSERT(var_nullability != Nullability::kNonNullable ||
- (arg_nullability != Nullability::kNullable &&
- arg_nullability != Nullability::kUndetermined));
-
+ // % % ? * %
if (var_nullability == Nullability::kNullable ||
arg_nullability == Nullability::kNullable) {
result_nullability = Nullability::kNullable;
@@ -17851,7 +18004,8 @@
arg_nullability == Nullability::kLegacy) {
result_nullability = Nullability::kLegacy;
} else {
- result_nullability = arg_nullability;
+ // Keep arg nullability.
+ return raw();
}
if (arg_nullability == result_nullability) {
return raw();
@@ -17869,6 +18023,55 @@
.SetInstantiatedNullability(type_param, space);
}
+RawAbstractType* AbstractType::NormalizeInstantiatedType() const {
+ if (Dart::non_nullable_flag()) {
+ // Normalize FutureOr<T>.
+ if (IsFutureOrType()) {
+ const AbstractType& unwrapped_type =
+ AbstractType::Handle(UnwrapFutureOr());
+ const classid_t cid = unwrapped_type.type_class_id();
+ if (cid == kDynamicCid || cid == kVoidCid || cid == kInstanceCid) {
+ return unwrapped_type.raw();
+ }
+ if (cid == kNeverCid && IsNonNullable()) {
+ ObjectStore* object_store = Isolate::Current()->object_store();
+ if (object_store->non_nullable_future_never_type() == Type::null()) {
+ const Class& cls = Class::Handle(object_store->future_class());
+ ASSERT(!cls.IsNull());
+ const TypeArguments& type_args =
+ TypeArguments::Handle(TypeArguments::New(1));
+ type_args.SetTypeAt(0, never_type());
+ Type& type =
+ Type::Handle(Type::New(cls, type_args, TokenPosition::kNoSource,
+ Nullability::kNonNullable));
+ type.SetIsFinalized();
+ type ^= type.Canonicalize();
+ object_store->set_non_nullable_future_never_type(type);
+ }
+ return object_store->non_nullable_future_never_type();
+ }
+ if (cid == kNullCid) {
+ ObjectStore* object_store = Isolate::Current()->object_store();
+ if (object_store->nullable_future_null_type() == Type::null()) {
+ const Class& cls = Class::Handle(object_store->future_class());
+ ASSERT(!cls.IsNull());
+ const TypeArguments& type_args =
+ TypeArguments::Handle(TypeArguments::New(1));
+ Type& type = Type::Handle(object_store->null_type());
+ type_args.SetTypeAt(0, type);
+ type = Type::New(cls, type_args, TokenPosition::kNoSource,
+ Nullability::kNullable);
+ type.SetIsFinalized();
+ type ^= type.Canonicalize();
+ object_store->set_nullable_future_null_type(type);
+ }
+ return object_store->nullable_future_null_type();
+ }
+ }
+ }
+ return raw();
+}
+
bool AbstractType::IsInstantiated(Genericity genericity,
intptr_t num_free_fun_type_params,
TrailPtr trail) const {
@@ -18051,17 +18254,26 @@
return Symbols::FromConcatAll(thread, pieces);
}
-static const char* NullabilitySuffix(Nullability value) {
+const char* AbstractType::NullabilitySuffix(
+ NameVisibility name_visibility) const {
+ if (IsDynamicType() || IsVoidType() || IsNullType()) {
+ // Hide nullable suffix.
+ return "";
+ }
// Keep in sync with Nullability enum in runtime/vm/object.h.
- switch (value) {
+ switch (nullability()) {
case Nullability::kUndetermined:
- return "%";
+ return (FLAG_show_internal_names || name_visibility == kInternalName)
+ ? "%"
+ : "";
case Nullability::kNullable:
return "?";
case Nullability::kNonNullable:
return "";
case Nullability::kLegacy:
- return "*";
+ return (FLAG_show_internal_names || name_visibility == kInternalName)
+ ? "*"
+ : "";
default:
UNREACHABLE();
}
@@ -18088,9 +18300,7 @@
Zone* zone = thread->zone();
if (IsTypeParameter()) {
printer->AddString(String::Handle(zone, TypeParameter::Cast(*this).name()));
- if (FLAG_show_nullability) {
- printer->AddString(NullabilitySuffix(nullability()));
- }
+ printer->AddString(NullabilitySuffix(name_visibility));
return;
}
const TypeArguments& args = TypeArguments::Handle(zone, arguments());
@@ -18103,9 +18313,14 @@
const Function& signature_function =
Function::Handle(zone, Type::Cast(*this).signature());
if (!cls.IsTypedefClass()) {
- signature_function.PrintSignature(kUserVisibleName, printer);
- if (FLAG_show_nullability) {
- printer->AddString(NullabilitySuffix(nullability()));
+ const char* suffix = NullabilitySuffix(name_visibility);
+ if (suffix[0] != '\0') {
+ printer->AddString("(");
+ }
+ signature_function.PrintSignature(name_visibility, printer);
+ if (suffix[0] != '\0') {
+ printer->AddString(")");
+ printer->AddString(suffix);
}
return;
}
@@ -18115,9 +18330,7 @@
if (!IsFinalized() || IsBeingFinalized()) {
// TODO(regis): Check if this is dead code.
printer->AddString(class_name);
- if (FLAG_show_nullability) {
- printer->AddString(NullabilitySuffix(nullability()));
- }
+ printer->AddString(NullabilitySuffix(name_visibility));
return;
}
// Print the name of a typedef as a regular, possibly parameterized, class.
@@ -18155,9 +18368,7 @@
args.PrintSubvectorName(first_type_param_index, num_type_params,
name_visibility, printer);
}
- if (FLAG_show_nullability) {
- printer->AddString(NullabilitySuffix(nullability()));
- }
+ printer->AddString(NullabilitySuffix(name_visibility));
// The name is only used for type checking and debugging purposes.
// Unless profiling data shows otherwise, it is not worth caching the name in
// the type.
@@ -18182,7 +18393,6 @@
// Caution: IsTopType() does not return true for non-nullable Object.
bool AbstractType::IsTopType() const {
- // FutureOr<T> where T is a top type behaves as a top type.
const classid_t cid = type_class_id();
if (cid == kDynamicCid || cid == kVoidCid) {
return true;
@@ -18191,11 +18401,29 @@
return !IsNonNullable(); // kLegacy or kNullable.
}
if (cid == kFutureOrCid) {
+ // FutureOr<T> where T is a top type behaves as a top type.
return AbstractType::Handle(UnwrapFutureOr()).IsTopType();
}
return false;
}
+bool AbstractType::IsTopTypeForAssignability() const {
+ const classid_t cid = type_class_id();
+ if (cid == kDynamicCid || cid == kVoidCid) {
+ return true;
+ }
+ if (cid == kInstanceCid) { // Object type.
+ // NNBD weak mode uses LEGACY_SUBTYPE for assignability / 'as' tests,
+ // and non-nullable Object is a top type according to LEGACY_SUBTYPE.
+ return !FLAG_null_safety || !IsNonNullable();
+ }
+ if (cid == kFutureOrCid) {
+ // FutureOr<T> where T is a top type behaves as a top type.
+ return AbstractType::Handle(UnwrapFutureOr()).IsTopTypeForAssignability();
+ }
+ return false;
+}
+
bool AbstractType::IsIntType() const {
return HasTypeClass() &&
(type_class() == Type::Handle(Type::IntType()).type_class());
@@ -18245,7 +18473,7 @@
}
RawAbstractType* AbstractType::UnwrapFutureOr() const {
- if (!IsType() || !IsFutureOrType()) {
+ if (!IsFutureOrType()) {
return raw();
}
if (arguments() == TypeArguments::null()) {
@@ -18258,7 +18486,7 @@
REUSABLE_ABSTRACT_TYPE_HANDLESCOPE(thread);
AbstractType& type_arg = thread->AbstractTypeHandle();
type_arg = type_args.TypeAt(0);
- while (type_arg.IsType() && type_arg.IsFutureOrType()) {
+ while (type_arg.IsFutureOrType()) {
if (type_arg.arguments() == TypeArguments::null()) {
return Type::dynamic_type().raw();
}
@@ -18273,27 +18501,30 @@
Heap::Space space) const {
ASSERT(IsFinalized());
ASSERT(other.IsFinalized());
- // Right top type or left bottom type.
+ // Reflexivity.
+ if (raw() == other.raw()) {
+ return true;
+ }
+ // Right top type.
+ if (other.IsTopType()) {
+ return true;
+ }
+ // Left bottom type.
// Any form of Never in weak mode maps to Null and Null is a bottom type in
// weak mode. In strong mode, Never and Never* are bottom types. Therefore,
// Never and Never* are bottom types regardless of weak/strong mode.
- if (other.IsTopType() || (IsNeverType() && !IsNullable())) {
+ // Note that we cannot encounter Never?, as it is normalized to Null.
+ if (IsNeverType()) {
+ ASSERT(!IsNullable());
return true;
}
+ // Left top type.
if (IsDynamicType() || IsVoidType()) {
return false;
}
- // Left Null type, including left Never type mapped to Null.
- // Note that we already handled Never and Never* above.
- // Only Never? remains, which maps to Null regardless of weak/strong mode.
- if (IsNullType() || IsNeverType()) {
- // In weak mode, Null is a bottom type.
- if (!FLAG_strong_non_nullable_type_checks) {
- return true;
- }
- const AbstractType& unwrapped_other =
- AbstractType::Handle(other.UnwrapFutureOr());
- return unwrapped_other.IsNullable() || unwrapped_other.IsLegacy();
+ // Left Null type.
+ if (IsNullType()) {
+ return Instance::NullIsAssignableTo(other);
}
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
@@ -18314,32 +18545,9 @@
if (other.IsTypeParameter()) {
const TypeParameter& other_type_param = TypeParameter::Cast(other);
if (type_param.IsEquivalent(other_type_param,
- TypeEquality::kSubtypeNullability)) {
+ TypeEquality::kInSubtypeTest)) {
return true;
}
- if (type_param.IsFunctionTypeParameter() &&
- other_type_param.IsFunctionTypeParameter() &&
- type_param.IsFinalized() && other_type_param.IsFinalized()) {
- // To be compatible, the function type parameters should be declared
- // at the same position in the generic function. Their index therefore
- // needs adjustement before comparison.
- // Example: 'foo<F>(bar<B>(B b)) { }' and 'baz<Z>(Z z) { }', baz can
- // be assigned to bar, although B has index 1 and Z index 0.
- const Function& sig_fun =
- Function::Handle(zone, type_param.parameterized_function());
- const Function& other_sig_fun =
- Function::Handle(zone, other_type_param.parameterized_function());
- const int offset = sig_fun.NumParentTypeParameters();
- const int other_offset = other_sig_fun.NumParentTypeParameters();
- if (type_param.index() - offset ==
- other_type_param.index() - other_offset) {
- if (FLAG_strong_non_nullable_type_checks && type_param.IsNullable() &&
- other_type_param.IsNonNullable()) {
- return false;
- }
- return true;
- }
- }
}
const AbstractType& bound = AbstractType::Handle(zone, type_param.bound());
ASSERT(bound.IsFinalized());
@@ -18355,6 +18563,9 @@
if (other.IsTypeParameter()) {
return false;
}
+ if (FLAG_null_safety && IsNullable() && other.IsNonNullable()) {
+ return false;
+ }
const Class& type_cls = Class::Handle(zone, type_class());
const Class& other_type_cls = Class::Handle(zone, other.type_class());
// Function types cannot be handled by Class::IsSubtypeOf().
@@ -18391,23 +18602,15 @@
}
return false;
}
- if (FLAG_strong_non_nullable_type_checks && IsNullable() &&
- other.IsNonNullable()) {
- return false;
- }
return Class::IsSubtypeOf(
- mode, type_cls, TypeArguments::Handle(zone, arguments()), other_type_cls,
- TypeArguments::Handle(zone, other.arguments()), space);
+ mode, type_cls, TypeArguments::Handle(zone, arguments()), other, space);
}
bool AbstractType::IsSubtypeOfFutureOr(Zone* zone,
NNBDMode mode,
const AbstractType& other,
Heap::Space space) const {
- if (other.IsType() && other.IsFutureOrType()) {
- if (other.arguments() == TypeArguments::null()) {
- return true;
- }
+ if (other.IsFutureOrType()) {
// This function is only called with a receiver that is either a function
// type or an uninstantiated type parameter, therefore, it cannot be of
// class Future and we can spare the check.
@@ -18415,7 +18618,7 @@
const TypeArguments& other_type_arguments =
TypeArguments::Handle(zone, other.arguments());
const AbstractType& other_type_arg =
- AbstractType::Handle(zone, other_type_arguments.TypeAt(0));
+ AbstractType::Handle(zone, other_type_arguments.TypeAtNullSafe(0));
if (other_type_arg.IsTopType()) {
return true;
}
@@ -18585,6 +18788,10 @@
if (cid == kDynamicCid || cid == kVoidCid || cid == kNullCid) {
return raw();
}
+ if (cid == kNeverCid && value == Nullability::kNullable) {
+ // Normalize Never? to Null.
+ return Type::NullType();
+ }
// Clone type and set new nullability.
Type& type = Type::Handle();
// Always cloning in old space and removing space parameter would not satisfy
@@ -18734,7 +18941,7 @@
}
}
// Canonicalization is not part of instantiation.
- return instantiated_type.raw();
+ return instantiated_type.NormalizeInstantiatedType();
}
bool Type::IsEquivalent(const Instance& other,
@@ -18761,29 +18968,26 @@
if (type_class_id() != other_type.type_class_id()) {
return false;
}
- if (kind != TypeEquality::kIgnoreNullability) {
- Nullability this_type_nullability = nullability();
- Nullability other_type_nullability = other_type.nullability();
- if (kind == TypeEquality::kSubtypeNullability) {
- if (FLAG_strong_non_nullable_type_checks &&
- this_type_nullability == Nullability::kNullable &&
- other_type_nullability == Nullability::kNonNullable) {
- return false;
+ Nullability this_type_nullability = nullability();
+ Nullability other_type_nullability = other_type.nullability();
+ if (kind == TypeEquality::kInSubtypeTest) {
+ if (FLAG_null_safety && this_type_nullability == Nullability::kNullable &&
+ other_type_nullability == Nullability::kNonNullable) {
+ return false;
+ }
+ } else {
+ if (kind == TypeEquality::kSyntactical) {
+ if (this_type_nullability == Nullability::kLegacy) {
+ this_type_nullability = Nullability::kNonNullable;
+ }
+ if (other_type_nullability == Nullability::kLegacy) {
+ other_type_nullability = Nullability::kNonNullable;
}
} else {
- if (kind == TypeEquality::kSyntactical) {
- if (this_type_nullability == Nullability::kLegacy) {
- this_type_nullability = Nullability::kNonNullable;
- }
- if (other_type_nullability == Nullability::kLegacy) {
- other_type_nullability = Nullability::kNonNullable;
- }
- } else {
- ASSERT(kind == TypeEquality::kCanonical);
- }
- if (this_type_nullability != other_type_nullability) {
- return false;
- }
+ ASSERT(kind == TypeEquality::kCanonical);
+ }
+ if (this_type_nullability != other_type_nullability) {
+ return false;
}
}
if (!IsFinalized() || !other_type.IsFinalized()) {
@@ -18887,7 +19091,7 @@
// Check the result type.
param_type = sig_fun.result_type();
other_param_type = other_sig_fun.result_type();
- if (!param_type.Equals(other_param_type)) {
+ if (!param_type.IsEquivalent(other_param_type, kind)) {
return false;
}
// Check the types of all parameters.
@@ -18896,7 +19100,8 @@
for (intptr_t i = 0; i < num_params; i++) {
param_type = sig_fun.ParameterTypeAt(i);
other_param_type = other_sig_fun.ParameterTypeAt(i);
- if (!param_type.IsEquivalent(other_param_type, kind)) {
+ // Use contravariant order in case we test for subtyping.
+ if (!other_param_type.IsEquivalent(param_type, kind)) {
return false;
}
}
@@ -18908,7 +19113,9 @@
if (sig_fun.ParameterNameAt(i) != other_sig_fun.ParameterNameAt(i)) {
return false;
}
- // TODO(regis): Check 'required' annotation.
+ if (sig_fun.IsRequiredAt(i) != other_sig_fun.IsRequiredAt(i)) {
+ return false;
+ }
}
return true;
}
@@ -19222,32 +19429,42 @@
return "Type: null";
}
Zone* zone = Thread::Current()->zone();
+ ZoneTextBuffer args(zone);
const TypeArguments& type_args = TypeArguments::Handle(zone, arguments());
- const char* args_cstr = type_args.IsNull() ? "null" : type_args.ToCString();
+ const char* args_cstr = "";
+ if (!type_args.IsNull()) {
+ type_args.PrintSubvectorName(0, type_args.Length(), kInternalName, &args);
+ args_cstr = args.buffer();
+ }
const Class& cls = Class::Handle(zone, type_class());
const char* class_name;
const String& name = String::Handle(zone, cls.Name());
class_name = name.IsNull() ? "<null>" : name.ToCString();
+ const char* suffix = NullabilitySuffix(kInternalName);
if (IsFunctionType()) {
const Function& sig_fun = Function::Handle(zone, signature());
ZoneTextBuffer sig(zone);
+ if (suffix[0] != '\0') {
+ sig.AddString("(");
+ }
sig_fun.PrintSignature(kInternalName, &sig);
+ if (suffix[0] != '\0') {
+ sig.AddString(")");
+ sig.AddString(suffix);
+ }
if (cls.IsClosureClass()) {
ASSERT(type_args.IsNull());
return OS::SCreate(zone, "Function Type: %s", sig.buffer());
}
- return OS::SCreate(zone, "Function Type: %s (class: %s, args: %s)",
- sig.buffer(), class_name, args_cstr);
+ return OS::SCreate(zone, "Function Type: %s (%s%s%s)", sig.buffer(),
+ class_name, args_cstr, suffix);
}
- if (type_args.IsNull()) {
- return OS::SCreate(zone, "Type: class '%s'", class_name);
- } else if (IsFinalized() && IsRecursive()) {
+ if (IsFinalized() && IsRecursive()) {
const intptr_t hash = Hash();
- return OS::SCreate(zone, "Type: (H%" Px ") class '%s', args:[%s]", hash,
- class_name, args_cstr);
+ return OS::SCreate(zone, "Type: (H%" Px ") %s%s%s", hash, class_name,
+ args_cstr, suffix);
} else {
- return OS::SCreate(zone, "Type: class '%s', args:[%s]", class_name,
- args_cstr);
+ return OS::SCreate(zone, "Type: %s%s%s", class_name, args_cstr, suffix);
}
}
@@ -19460,42 +19677,66 @@
return false;
}
const TypeParameter& other_type_param = TypeParameter::Cast(other);
+ // Class type parameters must parameterize the same class to be equivalent.
+ // Note that this check will also reject a class type parameter being compared
+ // to a function type parameter.
if (parameterized_class_id() != other_type_param.parameterized_class_id()) {
return false;
}
- // The function doesn't matter in type tests, but it does in canonicalization.
- if (parameterized_function() != other_type_param.parameterized_function()) {
+ // The function does not matter in type tests or when comparing types with
+ // syntactical equality, but it does matter in canonicalization.
+ if (kind == TypeEquality::kCanonical &&
+ parameterized_function() != other_type_param.parameterized_function()) {
return false;
}
- if (kind != TypeEquality::kIgnoreNullability) {
- Nullability this_type_param_nullability = nullability();
- Nullability other_type_param_nullability = other_type_param.nullability();
- if (kind == TypeEquality::kSubtypeNullability) {
- if (FLAG_strong_non_nullable_type_checks &&
- this_type_param_nullability == Nullability::kNullable &&
- other_type_param_nullability == Nullability::kNonNullable) {
- return false;
+ Nullability this_type_param_nullability = nullability();
+ Nullability other_type_param_nullability = other_type_param.nullability();
+ if (kind == TypeEquality::kInSubtypeTest) {
+ if (FLAG_null_safety &&
+ this_type_param_nullability == Nullability::kNullable &&
+ (other_type_param_nullability == Nullability::kNonNullable ||
+ other_type_param_nullability == Nullability::kUndetermined)) {
+ return false;
+ }
+ } else {
+ if (kind == TypeEquality::kSyntactical) {
+ if (this_type_param_nullability == Nullability::kLegacy ||
+ this_type_param_nullability == Nullability::kUndetermined) {
+ this_type_param_nullability = Nullability::kNonNullable;
+ }
+ if (other_type_param_nullability == Nullability::kLegacy ||
+ other_type_param_nullability == Nullability::kUndetermined) {
+ other_type_param_nullability = Nullability::kNonNullable;
}
} else {
- if (kind == TypeEquality::kSyntactical) {
- if (this_type_param_nullability == Nullability::kLegacy ||
- this_type_param_nullability == Nullability::kUndetermined) {
- this_type_param_nullability = Nullability::kNonNullable;
- }
- if (other_type_param_nullability == Nullability::kLegacy ||
- other_type_param_nullability == Nullability::kUndetermined) {
- other_type_param_nullability = Nullability::kNonNullable;
- }
- } else {
- ASSERT(kind == TypeEquality::kCanonical);
- }
- if (this_type_param_nullability != other_type_param_nullability) {
- return false;
- }
+ ASSERT(kind == TypeEquality::kCanonical);
+ }
+ if (this_type_param_nullability != other_type_param_nullability) {
+ return false;
}
}
+ if (kind == TypeEquality::kInSubtypeTest) {
+ if (IsFunctionTypeParameter() && IsFinalized() &&
+ other_type_param.IsFinalized()) {
+ ASSERT(other_type_param.IsFunctionTypeParameter()); // Checked above.
+ // To be equivalent, the function type parameters should be declared
+ // at the same position in the generic function. Their index therefore
+ // needs adjustement before comparison.
+ // Example: 'foo<F>(bar<B>(B b)) { }' and 'baz<Z>(Z z) { }', baz can
+ // be assigned to bar, although B has index 1 and Z index 0.
+ const Function& sig_fun = Function::Handle(parameterized_function());
+ const Function& other_sig_fun =
+ Function::Handle(other_type_param.parameterized_function());
+ const int offset = sig_fun.NumParentTypeParameters();
+ const int other_offset = other_sig_fun.NumParentTypeParameters();
+ return index() - offset == other_type_param.index() - other_offset;
+ } else if (IsFinalized() == other_type_param.IsFinalized()) {
+ return index() == other_type_param.index();
+ }
+ return false;
+ }
if (IsFinalized() == other_type_param.IsFinalized()) {
- return (index() == other_type_param.index());
+ return index() == other_type_param.index();
}
return name() == other_type_param.name();
}
@@ -19566,9 +19807,10 @@
if (function_type_arguments.IsNull()) {
return Type::DynamicType();
}
- const AbstractType& result =
+ AbstractType& result =
AbstractType::Handle(function_type_arguments.TypeAt(index()));
- return result.SetInstantiatedNullability(*this, space);
+ result = result.SetInstantiatedNullability(*this, space);
+ return result.NormalizeInstantiatedType();
}
ASSERT(IsClassTypeParameter());
if (instantiator_type_arguments.IsNull()) {
@@ -19583,9 +19825,10 @@
// (see AssertAssignableInstr::Canonicalize).
return AbstractType::null();
}
- const AbstractType& result =
+ AbstractType& result =
AbstractType::Handle(instantiator_type_arguments.TypeAt(index()));
- return result.SetInstantiatedNullability(*this, space);
+ result = result.SetInstantiatedNullability(*this, space);
+ return result.NormalizeInstantiatedType();
// There is no need to canonicalize the instantiated type parameter, since all
// type arguments are canonicalized at type finalization time. It would be too
// early to canonicalize the returned type argument here, since instantiation
@@ -19684,7 +19927,8 @@
Thread* thread = Thread::Current();
ZoneTextBuffer printer(thread->zone());
printer.Printf("TypeParameter: name ");
- printer.AddString(String::Handle(Name()));
+ printer.AddString(String::Handle(name()));
+ printer.AddString(NullabilitySuffix(kInternalName));
printer.Printf("; index: %" Pd ";", index());
if (IsFunctionTypeParameter()) {
const Function& function = Function::Handle(parameterized_function());
@@ -22548,6 +22792,11 @@
if (len < 0 || len > ExternalTypedData::MaxElements(class_id)) {
FATAL1("Fatal error in ExternalTypedData::New: invalid len %" Pd "\n", len);
}
+
+ // Once the TypedData is created, Dart might read this memory. Check for
+ // intialization at construction to make it easier to track the source.
+ MSAN_CHECK_INITIALIZED(data, len);
+
ExternalTypedData& result = ExternalTypedData::Handle();
{
RawObject* raw =
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 413e36e..c9717e1 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -801,7 +801,7 @@
#undef DECLARE_SHARED_READONLY_HANDLE
friend void ClassTable::Register(const Class& cls);
- friend void RawObject::Validate(Isolate* isolate) const;
+ friend void RawObject::Validate(IsolateGroup* isolate_group) const;
friend class Closure;
friend class SnapshotReader;
friend class InstanceDeserializationCluster;
@@ -885,21 +885,29 @@
enum class TypeEquality {
kCanonical = 0,
kSyntactical = 1,
- kSubtypeNullability = 2,
- kIgnoreNullability = 3,
+ kInSubtypeTest = 2,
};
// The NNBDMode is passed to routines performing type reification and/or subtype
// tests. The mode reflects the opted-in status of the library performing type
// reification and/or subtype tests.
// Note that the weak or strong testing mode is not reflected in NNBDMode, but
-// imposed globally by the value of FLAG_strong_non_nullable_type_checks.
+// imposed globally by the value of FLAG_null_safety.
enum class NNBDMode {
// Status of the library:
kLegacyLib = 0, // Library is legacy.
kOptedInLib = 1, // Library is opted-in.
};
+// The NNBDCompiledMode reflects the mode in which constants of the library were
+// compiled by CFE.
+enum class NNBDCompiledMode {
+ kDisabled = 0,
+ kWeak = 1,
+ kStrong = 2,
+ kAgnostic = 3,
+};
+
class Class : public Object {
public:
enum InvocationDispatcherEntry {
@@ -1226,13 +1234,12 @@
cls->ptr()->library_->ptr()->flags_);
}
- // Returns true if the type specified by cls and type_arguments is a
- // subtype of the type specified by other class and other_type_arguments.
+ // Returns true if the type specified by cls and type_arguments is a subtype
+ // of the other type.
static bool IsSubtypeOf(NNBDMode mode,
const Class& cls,
const TypeArguments& type_arguments,
- const Class& other,
- const TypeArguments& other_type_arguments,
+ const AbstractType& other,
Heap::Space space);
// Check if this is the top level class.
@@ -2512,12 +2519,29 @@
void set_parameter_types(const Array& value) const;
// Parameter names are valid for all valid parameter indices, and are not
- // limited to named optional parameters.
+ // limited to named optional parameters. If there are parameter flags (eg
+ // required) they're stored at the end of this array, so the size of this
+ // array isn't necessarily NumParameters(), but the first NumParameters()
+ // elements are the names.
RawString* ParameterNameAt(intptr_t index) const;
void SetParameterNameAt(intptr_t index, const String& value) const;
RawArray* parameter_names() const { return raw_ptr()->parameter_names_; }
void set_parameter_names(const Array& value) const;
+ // The required flags are stored at the end of the parameter_names. The flags
+ // are packed into SMIs, but omitted if they're 0.
+ bool IsRequiredAt(intptr_t index) const;
+ void SetIsRequiredAt(intptr_t index) const;
+
+ // Truncate the parameter names array to remove any unused flag slots. Make
+ // sure to only do this after calling SetIsRequiredAt as necessary.
+ void TruncateUnusedParameterFlags() const;
+
+ // Returns the length of the parameter names array that is required to store
+ // all the names plus all their flags. This may be an overestimate if some
+ // parameters don't have flags.
+ static intptr_t NameArrayLengthIncludingFlags(intptr_t num_parameters);
+
// The type parameters (and their bounds) are specified as an array of
// TypeParameter.
RawTypeArguments* type_parameters() const {
@@ -3508,6 +3532,11 @@
intptr_t other_parameter_position,
Heap::Space space) const;
+ // Returns the index in the parameter names array of the corresponding flag
+ // for the given parametere index. Also returns (via flag_mask) the
+ // corresponding mask within the flag.
+ intptr_t GetRequiredFlagIndex(intptr_t index, intptr_t* flag_mask) const;
+
FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object);
friend class Class;
friend class SnapshotWriter;
@@ -4555,6 +4584,15 @@
return is_nnbd() ? NNBDMode::kOptedInLib : NNBDMode::kLegacyLib;
}
+ NNBDCompiledMode nnbd_compiled_mode() const {
+ return static_cast<NNBDCompiledMode>(
+ RawLibrary::NnbdCompiledModeBits::decode(raw_ptr()->flags_));
+ }
+ void set_nnbd_compiled_mode(NNBDCompiledMode value) const {
+ set_flags(RawLibrary::NnbdCompiledModeBits::update(
+ static_cast<uint8_t>(value), raw_ptr()->flags_));
+ }
+
RawString* PrivateName(const String& name) const;
intptr_t index() const { return raw_ptr()->index_; }
@@ -6836,6 +6874,11 @@
const TypeArguments& other_instantiator_type_arguments,
const TypeArguments& other_function_type_arguments) const;
+ // Return true if the null instance can be assigned to a variable of [other]
+ // type. Return false if null cannot be assigned or we cannot tell (if
+ // [other] is a type parameter in NNBD strong mode).
+ static bool NullIsAssignableTo(const AbstractType& other);
+
// Returns true if the type of this instance is a subtype of FutureOr<T>
// specified by instantiated type 'other'.
// Returns false if other type is not a FutureOr.
@@ -7052,6 +7095,13 @@
// Names of internal classes are mapped to their public interfaces.
RawString* UserVisibleName() const;
+ // Print the internal or public name of a subvector of this type argument
+ // vector, e.g. "<T, dynamic, List<T>, int>".
+ void PrintSubvectorName(intptr_t from_index,
+ intptr_t len,
+ NameVisibility name_visibility,
+ ZoneTextBuffer* printer) const;
+
// Check if the subvector of length 'len' starting at 'from_index' of this
// type argument vector consists solely of DynamicType.
bool IsRaw(intptr_t from_index, intptr_t len) const {
@@ -7228,13 +7278,6 @@
intptr_t from_index,
intptr_t len) const;
- // Return the internal or public name of a subvector of this type argument
- // vector, e.g. "<T, dynamic, List<T>, int>".
- void PrintSubvectorName(intptr_t from_index,
- intptr_t len,
- NameVisibility name_visibility,
- ZoneTextBuffer* printer) const;
-
RawArray* instantiations() const;
void set_instantiations(const Array& value) const;
RawAbstractType* const* TypeAddr(intptr_t index) const;
@@ -7279,6 +7322,7 @@
virtual RawAbstractType* SetInstantiatedNullability(
const TypeParameter& type_param,
Heap::Space space) const;
+ virtual RawAbstractType* NormalizeInstantiatedType() const;
virtual bool HasTypeClass() const { return type_class_id() != kIllegalCid; }
virtual classid_t type_class_id() const;
@@ -7365,6 +7409,10 @@
// Return a formatted string of the uris.
static RawString* PrintURIs(URIs* uris);
+ // Returns a C-String (possibly "") representing the nullability of this type.
+ // Legacy and undetermined suffixes are only displayed with kInternalName.
+ virtual const char* NullabilitySuffix(NameVisibility name_visibility) const;
+
// The name of this type, including the names of its type arguments, if any.
virtual RawString* Name() const;
@@ -7407,6 +7455,13 @@
// Check if this type represents a top type.
bool IsTopType() const;
+ // Check if this type represents a top type with respect to
+ // assignability and 'as' type tests, e.g. returns true if any value can be
+ // assigned to a variable of this type and 'as' type test always succeeds.
+ // Guaranteed to return true for top types according to IsTopType(), but
+ // may also return true for other types (non-nullable Object in weak mode).
+ bool IsTopTypeForAssignability() const;
+
// Check if this type represents the 'bool' type.
bool IsBoolType() const { return type_class_id() == kBoolCid; }
@@ -10519,7 +10574,7 @@
if ((raw_value & kSmiTagMask) == kSmiTag) {
return Smi::Class();
}
- ASSERT(!Isolate::Current()->compaction_in_progress());
+ ASSERT(!IsolateGroup::Current()->compaction_in_progress());
return Isolate::Current()->class_table()->At(raw()->GetClassId());
}
diff --git a/runtime/vm/object_graph.cc b/runtime/vm/object_graph.cc
index 98b112f..a982bb6 100644
--- a/runtime/vm/object_graph.cc
+++ b/runtime/vm/object_graph.cc
@@ -37,24 +37,28 @@
// - Use tag bits for compact Node and sentinel representations.
class ObjectGraph::Stack : public ObjectPointerVisitor {
public:
- explicit Stack(Isolate* isolate)
- : ObjectPointerVisitor(isolate),
+ explicit Stack(IsolateGroup* isolate_group)
+ : ObjectPointerVisitor(isolate_group),
include_vm_objects_(true),
- data_(kInitialCapacity) {}
+ data_(kInitialCapacity) {
+ object_ids_ = new WeakTable();
+ }
+ ~Stack() {
+ delete object_ids_;
+ object_ids_ = nullptr;
+ }
// Marks and pushes. Used to initialize this stack with roots.
// We can use ObjectIdTable normally used by serializers because it
// won't be in use while handling a service request (ObjectGraph's only use).
virtual void VisitPointers(RawObject** first, RawObject** last) {
- Heap* heap = isolate()->heap();
for (RawObject** current = first; current <= last; ++current) {
- if ((*current)->IsHeapObject() &&
- !(*current)->InVMIsolateHeap() &&
- heap->GetObjectId(*current) == 0) { // not visited yet
+ if ((*current)->IsHeapObject() && !(*current)->InVMIsolateHeap() &&
+ object_ids_->GetValueExclusive(*current) == 0) { // not visited yet
if (!include_vm_objects_ && !IsUserClass((*current)->GetClassId())) {
continue;
}
- heap->SetObjectId(*current, 1);
+ object_ids_->SetValueExclusive(*current, 1);
Node node;
node.ptr = current;
node.obj = *current;
@@ -91,7 +95,6 @@
clear_gc_root_type();
}
}
- isolate()->heap()->ResetObjectIdTable();
}
virtual bool visit_weak_persistent_handles() const {
@@ -126,6 +129,10 @@
return kNoParent;
}
+ // During the iteration of the heap we are already at a safepoint, so there is
+ // no need to let the GC know about [object_ids_] (i.e. GC cannot run while we
+ // use [object_ids]).
+ WeakTable* object_ids_ = nullptr;
GrowableArray<Node> data_;
friend class StackIterator;
DISALLOW_COPY_AND_ASSIGN(Stack);
@@ -214,15 +221,16 @@
ObjectGraph::~ObjectGraph() {}
void ObjectGraph::IterateObjects(ObjectGraph::Visitor* visitor) {
- Stack stack(isolate());
+ Stack stack(isolate_group());
stack.set_visit_weak_persistent_handles(
visitor->visit_weak_persistent_handles());
- isolate()->VisitObjectPointers(&stack, ValidationPolicy::kDontValidateFrames);
+ isolate_group()->VisitObjectPointers(&stack,
+ ValidationPolicy::kDontValidateFrames);
stack.TraverseGraph(visitor);
}
void ObjectGraph::IterateUserObjects(ObjectGraph::Visitor* visitor) {
- Stack stack(isolate());
+ Stack stack(isolate_group());
stack.set_visit_weak_persistent_handles(
visitor->visit_weak_persistent_handles());
IterateUserFields(&stack);
@@ -232,7 +240,7 @@
void ObjectGraph::IterateObjectsFrom(const Object& root,
ObjectGraph::Visitor* visitor) {
- Stack stack(isolate());
+ Stack stack(isolate_group());
stack.set_visit_weak_persistent_handles(
visitor->visit_weak_persistent_handles());
RawObject* root_raw = root.raw();
@@ -262,7 +270,7 @@
void ObjectGraph::IterateObjectsFrom(intptr_t class_id,
ObjectGraph::Visitor* visitor) {
HeapIterationScope iteration(thread());
- Stack stack(isolate());
+ Stack stack(isolate_group());
InstanceAccumulator accumulator(&stack, class_id);
iteration.IterateObjectsNoImagePages(&accumulator);
@@ -455,7 +463,7 @@
RawObject* target,
const Array& references,
Object* scratch)
- : ObjectPointerVisitor(isolate),
+ : ObjectPointerVisitor(isolate->group()),
source_(NULL),
target_(target),
references_(references),
@@ -753,7 +761,7 @@
public:
explicit Pass1Visitor(HeapSnapshotWriter* writer)
: ObjectVisitor(),
- ObjectPointerVisitor(Isolate::Current()),
+ ObjectPointerVisitor(IsolateGroup::Current()),
HandleVisitor(Thread::Current()),
writer_(writer) {}
@@ -806,8 +814,9 @@
public:
explicit Pass2Visitor(HeapSnapshotWriter* writer)
: ObjectVisitor(),
- ObjectPointerVisitor(Isolate::Current()),
+ ObjectPointerVisitor(IsolateGroup::Current()),
HandleVisitor(Thread::Current()),
+ isolate_(thread()->isolate()),
writer_(writer) {}
void VisitObject(RawObject* obj) {
@@ -920,9 +929,9 @@
}
DoCount();
- obj->VisitPointersPrecise(this);
+ obj->VisitPointersPrecise(isolate_, this);
DoWrite();
- obj->VisitPointersPrecise(this);
+ obj->VisitPointersPrecise(isolate_, this);
}
void ScrubAndWriteUtf8(RawString* str) {
@@ -983,6 +992,10 @@
}
private:
+ // TODO(dartbug.com/36097): Once the shared class table contains more
+ // information than just the size (i.e. includes an immutable class
+ // descriptor), we can remove this dependency on the current isolate.
+ Isolate* isolate_;
HeapSnapshotWriter* const writer_;
bool writing_ = false;
intptr_t counted_ = 0;
@@ -1129,7 +1142,7 @@
iteration.IterateObjects(&visitor);
// External properties.
- isolate()->VisitWeakPersistentHandles(&visitor);
+ isolate()->group()->VisitWeakPersistentHandles(&visitor);
}
{
@@ -1157,7 +1170,7 @@
// External properties.
WriteUnsigned(external_property_count_);
- isolate()->VisitWeakPersistentHandles(&visitor);
+ isolate()->group()->VisitWeakPersistentHandles(&visitor);
}
{
diff --git a/runtime/vm/object_id_ring.cc b/runtime/vm/object_id_ring.cc
index aba613a..2652db3 100644
--- a/runtime/vm/object_id_ring.cc
+++ b/runtime/vm/object_id_ring.cc
@@ -12,19 +12,10 @@
#ifndef PRODUCT
-void ObjectIdRing::Init(Isolate* isolate, int32_t capacity) {
- ObjectIdRing* ring = new ObjectIdRing(isolate, capacity);
- isolate->set_object_id_ring(ring);
-}
-
ObjectIdRing::~ObjectIdRing() {
ASSERT(table_ != NULL);
free(table_);
table_ = NULL;
- if (isolate_ != NULL) {
- isolate_->set_object_id_ring(NULL);
- isolate_ = NULL;
- }
}
int32_t ObjectIdRing::GetIdForObject(RawObject* object, IdPolicy policy) {
@@ -95,9 +86,8 @@
}
}
-ObjectIdRing::ObjectIdRing(Isolate* isolate, int32_t capacity) {
+ObjectIdRing::ObjectIdRing(int32_t capacity) {
ASSERT(capacity > 0);
- isolate_ = isolate;
serial_num_ = 0;
wrapped_ = false;
table_ = NULL;
diff --git a/runtime/vm/object_id_ring.h b/runtime/vm/object_id_ring.h
index faa25b0..2fe8090 100644
--- a/runtime/vm/object_id_ring.h
+++ b/runtime/vm/object_id_ring.h
@@ -11,7 +11,6 @@
// Forward declarations.
class RawObject;
-class Isolate;
class ObjectPointerVisitor;
class JSONStream;
@@ -40,8 +39,7 @@
static const int32_t kInvalidId = -1;
static const int32_t kDefaultCapacity = 8192;
- static void Init(Isolate* isolate, int32_t capacity = kDefaultCapacity);
-
+ explicit ObjectIdRing(int32_t capacity = kDefaultCapacity);
~ObjectIdRing();
// Adds the argument to the ring and returns its id. Note we do not allow
@@ -61,8 +59,6 @@
void SetCapacityAndMaxSerial(int32_t capacity, int32_t max_serial);
int32_t FindExistingIdForObject(RawObject* raw_obj);
- ObjectIdRing(Isolate* isolate, int32_t capacity);
- Isolate* isolate_;
RawObject** table_;
int32_t max_serial_;
int32_t capacity_;
diff --git a/runtime/vm/object_reload.cc b/runtime/vm/object_reload.cc
index 70e520d..8199db7 100644
--- a/runtime/vm/object_reload.cc
+++ b/runtime/vm/object_reload.cc
@@ -848,6 +848,7 @@
// Make sure the declaration types argument count matches for the two classes.
// ex. class A<int,B> {} cannot be replace with class A<B> {}.
auto group_context = context->group_reload_context();
+ auto shared_class_table = group_context->isolate_group()->class_table();
if (NumTypeArguments() != replacement.NumTypeArguments()) {
group_context->AddReasonForCancelling(
new (context->zone())
@@ -857,12 +858,10 @@
if (RequiresInstanceMorphing(replacement)) {
ASSERT(id() == replacement.id());
const classid_t cid = id();
-
// We unconditionally create an instance morpher. As a side effect of
// building the morpher, we will mark all new fields as late.
auto instance_morpher = InstanceMorpher::CreateFromClassDescriptors(
- context->zone(), context->isolate()->shared_class_table(), *this,
- replacement);
+ context->zone(), shared_class_table, *this, replacement);
group_context->EnsureHasInstanceMorpherFor(cid, instance_morpher);
}
return true;
diff --git a/runtime/vm/object_set.h b/runtime/vm/object_set.h
index a153377..f4f0254 100644
--- a/runtime/vm/object_set.h
+++ b/runtime/vm/object_set.h
@@ -18,69 +18,106 @@
ObjectSetRegion(Zone* zone, uword start, uword end)
: start_(start),
end_(end),
- bit_vector_(zone, (end - start) >> kWordSizeLog2),
- next_(NULL) {}
+ bit_vector_(zone, (end - start) >> kWordSizeLog2) {}
- bool ContainsAddress(uword address) {
+ bool ContainsAddress(uword address) const {
return address >= start_ && address < end_;
}
- intptr_t IndexForAddress(uword address) {
+ intptr_t IndexForAddress(uword address) const {
ASSERT(Utils::IsAligned(address, kWordSize));
return (address - start_) >> kWordSizeLog2;
}
void AddObject(uword address) { bit_vector_.Add(IndexForAddress(address)); }
- bool ContainsObject(uword address) {
+ bool ContainsObject(uword address) const {
return bit_vector_.Contains(IndexForAddress(address));
}
- ObjectSetRegion* next() { return next_; }
- void set_next(ObjectSetRegion* region) { next_ = region; }
+ uword start() const { return start_; }
+ uword end() const { return end_; }
private:
uword start_;
uword end_;
BitVector bit_vector_;
- ObjectSetRegion* next_;
};
class ObjectSet : public ZoneAllocated {
public:
- explicit ObjectSet(Zone* zone) : zone_(zone), head_(NULL) {}
+ explicit ObjectSet(Zone* zone) : zone_(zone), sorted_(true), regions_() {}
void AddRegion(uword start, uword end) {
+ if (start == end) {
+ return; // Ignore empty regions, such as semispaces in the vm-isolate.
+ }
+ ASSERT(start < end);
ObjectSetRegion* region = new (zone_) ObjectSetRegion(zone_, start, end);
- region->set_next(head_);
- head_ = region;
+ regions_.Add(region);
+ sorted_ = false;
+ }
+
+ void SortRegions() {
+ regions_.Sort(CompareRegions);
+ sorted_ = true;
}
bool Contains(RawObject* raw_obj) const {
uword raw_addr = RawObject::ToAddr(raw_obj);
- for (ObjectSetRegion* region = head_; region != NULL;
- region = region->next()) {
- if (region->ContainsAddress(raw_addr)) {
- return region->ContainsObject(raw_addr);
- }
+ ObjectSetRegion* region;
+ if (FindRegion(raw_addr, ®ion)) {
+ return region->ContainsObject(raw_addr);
}
return false;
}
void Add(RawObject* raw_obj) {
uword raw_addr = RawObject::ToAddr(raw_obj);
- for (ObjectSetRegion* region = head_; region != NULL;
- region = region->next()) {
- if (region->ContainsAddress(raw_addr)) {
- return region->AddObject(raw_addr);
- }
+ ObjectSetRegion* region;
+ if (FindRegion(raw_addr, ®ion)) {
+ return region->AddObject(raw_addr);
}
FATAL("Address not in any heap region");
}
private:
+ static int CompareRegions(ObjectSetRegion* const* a,
+ ObjectSetRegion* const* b) {
+ const uword a_start = (*a)->start();
+ const uword b_start = (*b)->start();
+ if (a_start < b_start) {
+ return -1;
+ } else if (a_start == b_start) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+
+ bool FindRegion(uword addr, ObjectSetRegion** region) const {
+ ASSERT(sorted_);
+ intptr_t lo = 0;
+ intptr_t hi = regions_.length() - 1;
+ while (lo <= hi) {
+ const intptr_t mid = (hi - lo + 1) / 2 + lo;
+ ASSERT(mid >= lo);
+ ASSERT(mid <= hi);
+ *region = regions_[mid];
+ if (addr < (*region)->start()) {
+ hi = mid - 1;
+ } else if (addr >= (*region)->end()) {
+ lo = mid + 1;
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
+
Zone* zone_;
- ObjectSetRegion* head_;
+ bool sorted_;
+ GrowableArray<ObjectSetRegion*> regions_;
};
} // namespace dart
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index bb47f4a..d3396a2 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -73,6 +73,9 @@
RW(Type, string_type) \
RW(Type, legacy_string_type) \
RW(Type, non_nullable_string_type) \
+ RW(Type, non_nullable_list_rare_type) /* maybe be null, lazily built */ \
+ RW(Type, non_nullable_map_rare_type) /* maybe be null, lazily built */ \
+ RW(Type, non_nullable_future_rare_type) /* maybe be null, lazily built */ \
RW(TypeArguments, type_argument_int) \
RW(TypeArguments, type_argument_legacy_int) \
RW(TypeArguments, type_argument_non_nullable_int) \
@@ -93,6 +96,8 @@
RW(Field, pragma_name) \
RW(Field, pragma_options) \
RW(Class, future_class) \
+ RW(Type, non_nullable_future_never_type) /* maybe be null, lazily built */ \
+ RW(Type, nullable_future_null_type) /* maybe be null, lazily built */ \
RW(Class, completer_class) \
RW(Class, symbol_class) \
RW(Class, one_byte_string_class) \
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index 3aaf191..4b65a02 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -1376,7 +1376,7 @@
SampleThreadSingleFrame(thread, pc);
return;
}
- if (isolate->compaction_in_progress()) {
+ if (isolate->group()->compaction_in_progress()) {
// The Dart stack isn't fully walkable.
SampleThreadSingleFrame(thread, pc);
return;
diff --git a/runtime/vm/program_visitor.cc b/runtime/vm/program_visitor.cc
index 00a2772..1b6305a 100644
--- a/runtime/vm/program_visitor.cc
+++ b/runtime/vm/program_visitor.cc
@@ -290,6 +290,7 @@
Pair(const Key key, const Value& value)
: key(ASSERT_NOTNULL(key)), value(value) {}
Pair(const Pair& other) : key(other.key), value(other.value) {}
+ Pair& operator=(const Pair&) = default;
};
static Key KeyOf(Pair kv) { return kv.key; }
@@ -868,6 +869,7 @@
if (!function.HasOptionalNamedParameters() &&
!list_.InVMIsolateHeap()) {
// Parameter names not needed for resolution.
+ ASSERT(list_.Length() == function.NumParameters());
for (intptr_t i = 0; i < list_.Length(); i++) {
list_.SetAt(i, Symbols::OptimizedOut());
}
diff --git a/runtime/vm/raw_object.cc b/runtime/vm/raw_object.cc
index 7bf1bb9..9cf9ab3 100644
--- a/runtime/vm/raw_object.cc
+++ b/runtime/vm/raw_object.cc
@@ -26,7 +26,7 @@
return heap->old_space()->ContainsUnsafe(ToAddr(this));
}
-void RawObject::Validate(Isolate* isolate) const {
+void RawObject::Validate(IsolateGroup* isolate_group) const {
if (Object::void_class_ == reinterpret_cast<RawClass*>(kHeapObjectTag)) {
// Validation relies on properly initialized class classes. Skip if the
// VM is still being initialized.
@@ -63,12 +63,12 @@
FATAL1("Old object missing kOldBit: %x\n", tags);
}
}
- intptr_t class_id = ClassIdTag::decode(tags);
- if (!isolate->shared_class_table()->IsValidIndex(class_id)) {
+ const intptr_t class_id = ClassIdTag::decode(tags);
+ if (!isolate_group->class_table()->IsValidIndex(class_id)) {
FATAL1("Invalid class id encountered %" Pd "\n", class_id);
}
if (class_id == kNullCid &&
- isolate->shared_class_table()->HasValidClassAt(class_id)) {
+ isolate_group->class_table()->HasValidClassAt(class_id)) {
// Null class not yet initialized; skip.
return;
}
@@ -225,11 +225,10 @@
default: {
// Get the (constant) instance size out of the class object.
// TODO(koda): Add Size(ClassTable*) interface to allow caching in loops.
- Isolate* isolate = Isolate::Current();
+ auto isolate_group = IsolateGroup::Current();
#if defined(DEBUG)
- auto class_table = isolate->shared_class_table();
#if !defined(DART_PRECOMPILED_RUNTIME)
- auto reload_context = isolate->group()->reload_context();
+ auto reload_context = isolate_group->reload_context();
const bool use_saved_class_table =
reload_context != nullptr ? reload_context->UseSavedSizeTableForGC()
: false;
@@ -237,6 +236,7 @@
const bool use_saved_class_table = false;
#endif
+ auto class_table = isolate_group->class_table();
ASSERT(use_saved_class_table || class_table->SizeAt(class_id) > 0);
if (!class_table->IsValidIndex(class_id) ||
(!class_table->HasValidClassAt(class_id) && !use_saved_class_table)) {
@@ -244,7 +244,7 @@
class_id, this, static_cast<uint32_t>(ptr()->tags_));
}
#endif // DEBUG
- instance_size = isolate->GetClassSizeForHeapWalkAt(class_id);
+ instance_size = isolate_group->GetClassSizeForHeapWalkAt(class_id);
}
}
ASSERT(instance_size != 0);
@@ -379,7 +379,8 @@
#endif
}
-void RawObject::VisitPointersPrecise(ObjectPointerVisitor* visitor) {
+void RawObject::VisitPointersPrecise(Isolate* isolate,
+ ObjectPointerVisitor* visitor) {
intptr_t class_id = GetClassId();
if (class_id < kNumPredefinedCids) {
VisitPointersPredefined(visitor, class_id);
@@ -387,8 +388,7 @@
}
// N.B.: Not using the heap size!
- uword next_field_offset = visitor->isolate()
- ->GetClassForHeapWalkAt(class_id)
+ uword next_field_offset = isolate->GetClassForHeapWalkAt(class_id)
->ptr()
->host_next_field_offset_in_words_
<< kWordSizeLog2;
@@ -657,8 +657,8 @@
uint32_t tags = raw_obj->ptr()->tags_;
intptr_t instance_size = SizeTag::decode(tags);
if (instance_size == 0) {
- instance_size =
- visitor->isolate()->GetClassSizeForHeapWalkAt(raw_obj->GetClassId());
+ instance_size = visitor->isolate_group()->GetClassSizeForHeapWalkAt(
+ raw_obj->GetClassId());
}
// Calculate the first and last raw object pointer fields.
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 288c36d..daedcc5 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -29,6 +29,7 @@
// Forward declarations.
class Isolate;
+class IsolateGroup;
#define DEFINE_FORWARD_DECLARATION(clazz) class Raw##clazz;
CLASS_LIST(DEFINE_FORWARD_DECLARATION)
#undef DEFINE_FORWARD_DECLARATION
@@ -456,7 +457,7 @@
return (addr >= this_addr) && (addr < (this_addr + this_size));
}
- void Validate(Isolate* isolate) const;
+ void Validate(IsolateGroup* isolate_group) const;
bool FindObject(FindObjectVisitor* visitor);
// This function may access the class-ID in the header, but it cannot access
@@ -539,7 +540,7 @@
// This variant ensures that we do not visit the extra slot created from
// rounding up instance sizes up to the allocation unit.
- void VisitPointersPrecise(ObjectPointerVisitor* visitor);
+ void VisitPointersPrecise(Isolate* isolate, ObjectPointerVisitor* visitor);
static RawObject* FromAddr(uword addr) {
// We expect the untagged address here.
@@ -1303,10 +1304,12 @@
enum LibraryFlags {
kDartSchemeBit = 0,
- kDebuggableBit, // True if debugger can stop in library.
- kInFullSnapshotBit, // True if library is in a full snapshot.
- kNnbdBit, // True if library is non nullable by default.
- kNumFlagBits,
+ kDebuggableBit, // True if debugger can stop in library.
+ kInFullSnapshotBit, // True if library is in a full snapshot.
+ kNnbdBit, // True if library is non nullable by default.
+ kNnbdCompiledModePos, // Encodes nnbd compiled mode of constants in lib.
+ kNnbdCompiledModeSize = 2,
+ kNumFlagBits = kNnbdCompiledModePos + kNnbdCompiledModeSize,
};
COMPILE_ASSERT(kNumFlagBits <= (sizeof(uint8_t) * kBitsPerByte));
class DartSchemeBit : public BitField<uint8_t, bool, kDartSchemeBit, 1> {};
@@ -1314,6 +1317,10 @@
class InFullSnapshotBit
: public BitField<uint8_t, bool, kInFullSnapshotBit, 1> {};
class NnbdBit : public BitField<uint8_t, bool, kNnbdBit, 1> {};
+ class NnbdCompiledModeBits : public BitField<uint8_t,
+ uint8_t,
+ kNnbdCompiledModePos,
+ kNnbdCompiledModeSize> {};
RAW_HEAP_OBJECT_IMPLEMENTATION(Library);
@@ -1573,6 +1580,7 @@
}
friend class Object;
+ friend class CodeSerializationCluster;
};
class RawInstructions : public RawObject {
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 9216283..df261cd 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -1713,7 +1713,7 @@
[](void* data, Dart_WeakPersistentHandle handle, void* peer) {
TransferableTypedDataPeer* tpeer =
reinterpret_cast<TransferableTypedDataPeer*>(peer);
- tpeer->handle()->EnsureFreeExternal(Isolate::Current());
+ tpeer->handle()->EnsureFreeExternal(IsolateGroup::Current());
tpeer->ClearData();
});
}
diff --git a/runtime/vm/resolver.cc b/runtime/vm/resolver.cc
index 244d67f..dfdbe19 100644
--- a/runtime/vm/resolver.cc
+++ b/runtime/vm/resolver.cc
@@ -219,36 +219,4 @@
return function.raw();
}
-RawFunction* Resolver::ResolveStaticAllowPrivate(const Class& cls,
- const String& function_name,
- intptr_t type_args_len,
- intptr_t num_arguments,
- const Array& argument_names) {
- ASSERT(!cls.IsNull());
- if (FLAG_trace_resolving) {
- THR_Print("ResolveStaticAllowPrivate '%s'\n", function_name.ToCString());
- }
- const Function& function =
- Function::Handle(cls.LookupStaticFunctionAllowPrivate(function_name));
- if (function.IsNull() ||
- !function.AreValidArguments(NNBDMode::kLegacyLib, type_args_len,
- num_arguments, argument_names, NULL)) {
- // Return a null function to signal to the upper levels to throw a
- // resolution error or maybe throw the error right here.
- if (FLAG_trace_resolving) {
- String& error_message = String::Handle(String::New("function not found"));
- if (!function.IsNull()) {
- // Obtain more detailed error message.
- function.AreValidArguments(NNBDMode::kLegacyLib, type_args_len,
- num_arguments, argument_names,
- &error_message);
- }
- THR_Print("ResolveStaticAllowPrivate error '%s': %s.\n",
- function_name.ToCString(), error_message.ToCString());
- }
- return Function::null();
- }
- return function.raw();
-}
-
} // namespace dart
diff --git a/runtime/vm/resolver.h b/runtime/vm/resolver.h
index 8c5fc15..b96f581 100644
--- a/runtime/vm/resolver.h
+++ b/runtime/vm/resolver.h
@@ -60,14 +60,6 @@
intptr_t type_args_len,
intptr_t num_arguments,
const Array& argument_names);
-
- // Resolve specified dart static function with specified arity. Resolves both
- // public and private functions.
- static RawFunction* ResolveStaticAllowPrivate(const Class& cls,
- const String& function_name,
- intptr_t type_args_len,
- intptr_t num_arguments,
- const Array& argument_names);
};
} // namespace dart
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index efc5d53..aacb48e 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -821,7 +821,7 @@
ASSERT(!dst_type.IsDynamicType()); // No need to check assignment.
// A null instance is already detected and allowed in inlined code, unless
// strong checking is enabled.
- ASSERT(!src_instance.IsNull() || FLAG_strong_non_nullable_type_checks);
+ ASSERT(!src_instance.IsNull() || FLAG_null_safety);
const bool is_instance_of = src_instance.IsAssignableTo(
nnbd_mode, dst_type, instantiator_type_arguments,
function_type_arguments);
@@ -1434,6 +1434,7 @@
arguments.SetReturn(target);
}
+#if defined(DART_PRECOMPILED_RUNTIME)
static bool IsSingleTarget(Isolate* isolate,
Zone* zone,
intptr_t lower_cid,
@@ -1456,12 +1457,16 @@
}
return true;
}
+#endif // defined(DART_PRECOMPILED_RUNTIME)
// Handle a miss of a single target cache.
// Arg1: Receiver.
// Arg0: Stub out.
// Returns: the ICData used to continue with a polymorphic call.
DEFINE_RUNTIME_ENTRY(SingleTargetMiss, 2) {
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
const Instance& receiver = Instance::CheckedHandle(zone, arguments.ArgAt(1));
DartFrameIterator iterator(thread,
@@ -1534,7 +1539,6 @@
// Call site is not single target, switch to call using ICData.
const Code& stub = StubCode::ICCallThroughCode();
- ASSERT(!Isolate::Current()->compilation_allowed());
CodePatcher::PatchSwitchableCallAt(caller_frame->pc(), caller_code, ic_data,
stub);
@@ -1542,6 +1546,7 @@
// IC call stub.
arguments.SetArgAt(0, stub);
arguments.SetReturn(ic_data);
+#endif // defined(DART_PRECOMPILED_RUNTIME)
}
#if defined(DART_PRECOMPILED_RUNTIME)
@@ -1606,6 +1611,9 @@
// Arg0: Stub out.
// Returns: the ICData used to continue with a polymorphic call.
DEFINE_RUNTIME_ENTRY(UnlinkedCall, 3) {
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
const Instance& receiver = Instance::CheckedHandle(zone, arguments.ArgAt(1));
const UnlinkedCall& unlinked =
UnlinkedCall::CheckedHandle(zone, arguments.ArgAt(2));
@@ -1707,7 +1715,6 @@
// Patch to call through stub.
const Code& stub = StubCode::ICCallThroughCode();
- ASSERT(!Isolate::Current()->compilation_allowed());
CodePatcher::PatchSwitchableCallAt(caller_frame->pc(), caller_code, ic_data,
stub);
@@ -1715,6 +1722,7 @@
// stub.
arguments.SetArgAt(0, stub);
arguments.SetReturn(ic_data);
+#endif // defined(DART_PRECOMPILED_RUNTIME)
}
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -1859,7 +1867,6 @@
// Patch to call through stub.
const Code& stub = StubCode::ICCallThroughCode();
- ASSERT(!Isolate::Current()->compilation_allowed());
CodePatcher::PatchSwitchableCallAt(caller_frame->pc(), caller_code, ic_data,
stub);
@@ -1951,8 +1958,7 @@
if ((number_of_checks == 0) &&
(!FLAG_precompiled_mode || ic_data.receiver_cannot_be_smi()) &&
!target_function.HasOptionalParameters() &&
- !target_function.IsGeneric() &&
- !Isolate::Current()->compilation_allowed()) {
+ !target_function.IsGeneric()) {
// This call site is unlinked: transition to a monomorphic direct call.
// Note we cannot do this if the target has optional parameters because
// the monomorphic direct call does not load the arguments descriptor.
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 33db8d9..2a129ba 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -238,25 +238,25 @@
}
static bool CheckDebuggerDisabled(Thread* thread, JSONStream* js) {
- Isolate* isolate = thread->isolate();
- if (!isolate->compilation_allowed()) {
- js->PrintError(kFeatureDisabled, "Debugger is disabled in AOT mode.");
- return true;
- }
- if (isolate->debugger() == NULL) {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ js->PrintError(kFeatureDisabled, "Debugger is disabled in AOT mode.");
+ return true;
+#else
+ if (thread->isolate()->debugger() == NULL) {
js->PrintError(kFeatureDisabled, "Debugger is disabled.");
return true;
}
return false;
+#endif
}
static bool CheckCompilerDisabled(Thread* thread, JSONStream* js) {
- Isolate* isolate = thread->isolate();
- if (!isolate->compilation_allowed()) {
- js->PrintError(kFeatureDisabled, "Compiler is disabled in AOT mode.");
- return true;
- }
+#if defined(DART_PRECOMPILED_RUNTIME)
+ js->PrintError(kFeatureDisabled, "Compiler is disabled in AOT mode.");
+ return true;
+#else
return false;
+#endif
}
static bool CheckProfilerDisabled(Thread* thread, JSONStream* js) {
@@ -3440,26 +3440,41 @@
obj.AddProperty("type", "MetricList");
{
JSONArray metrics(&obj, "metrics");
- Metric* current = thread->isolate()->metrics_list_head();
- while (current != NULL) {
- metrics.AddValue(current);
- current = current->next();
- }
+
+ auto isolate = thread->isolate();
+#define ADD_METRIC(type, variable, name, unit) \
+ metrics.AddValue(isolate->Get##variable##Metric());
+ ISOLATE_METRIC_LIST(ADD_METRIC);
+#undef ADD_METRIC
+
+ auto isolate_group = thread->isolate_group();
+#define ADD_METRIC(type, variable, name, unit) \
+ metrics.AddValue(isolate_group->Get##variable##Metric());
+ ISOLATE_GROUP_METRIC_LIST(ADD_METRIC);
+#undef ADD_METRIC
}
return true;
}
static bool HandleNativeMetric(Thread* thread, JSONStream* js, const char* id) {
- Metric* current = thread->isolate()->metrics_list_head();
- while (current != NULL) {
- const char* name = current->name();
- ASSERT(name != NULL);
- if (strcmp(name, id) == 0) {
- current->PrintJSON(js);
- return true;
- }
- current = current->next();
+ auto isolate = thread->isolate();
+#define ADD_METRIC(type, variable, name, unit) \
+ if (strcmp(id, name) == 0) { \
+ isolate->Get##variable##Metric()->PrintJSON(js); \
+ return true; \
}
+ ISOLATE_METRIC_LIST(ADD_METRIC);
+#undef ADD_METRIC
+
+ auto isolate_group = thread->isolate_group();
+#define ADD_METRIC(type, variable, name, unit) \
+ if (strcmp(id, name) == 0) { \
+ isolate_group->Get##variable##Metric()->PrintJSON(js); \
+ return true; \
+ }
+ ISOLATE_GROUP_METRIC_LIST(ADD_METRIC);
+#undef ADD_METRIC
+
PrintInvalidParamError(js, "metricId");
return true;
}
@@ -3965,13 +3980,14 @@
return true;
}
}
- Isolate* isolate = thread->isolate();
+ auto isolate = thread->isolate();
+ auto isolate_group = thread->isolate_group();
if (should_reset_accumulator) {
- isolate->UpdateLastAllocationProfileAccumulatorResetTimestamp();
+ isolate_group->UpdateLastAllocationProfileAccumulatorResetTimestamp();
}
if (should_collect) {
- isolate->UpdateLastAllocationProfileGCTimestamp();
- isolate->heap()->CollectAllGarbage();
+ isolate_group->UpdateLastAllocationProfileGCTimestamp();
+ isolate_group->heap()->CollectAllGarbage();
}
isolate->class_table()->AllocationProfilePrintJSON(js, internal);
return true;
@@ -4161,7 +4177,7 @@
Isolate* isolate = thread->isolate();
ASSERT(isolate != NULL);
- ApiState* api_state = isolate->api_state();
+ ApiState* api_state = isolate->group()->api_state();
ASSERT(api_state != NULL);
{
@@ -4435,7 +4451,15 @@
{
JSONArray jsarr_isolate_groups(&jsobj, "isolateGroups");
IsolateGroup::ForEach([&jsarr_isolate_groups](IsolateGroup* isolate_group) {
- jsarr_isolate_groups.AddValue(isolate_group);
+ bool has_internal = false;
+ isolate_group->ForEachIsolate([&has_internal](Isolate* isolate) {
+ if (Isolate::IsVMInternalIsolate(isolate)) {
+ has_internal = true;
+ }
+ });
+ if (FLAG_show_invisible_isolates || !has_internal) {
+ jsarr_isolate_groups.AddValue(isolate_group);
+ }
});
}
}
diff --git a/runtime/vm/service.h b/runtime/vm/service.h
index 395d0fe..fdf87a4 100644
--- a/runtime/vm/service.h
+++ b/runtime/vm/service.h
@@ -14,7 +14,7 @@
namespace dart {
#define SERVICE_PROTOCOL_MAJOR_VERSION 3
-#define SERVICE_PROTOCOL_MINOR_VERSION 29
+#define SERVICE_PROTOCOL_MINOR_VERSION 30
class Array;
class EmbedderServiceHandler;
diff --git a/runtime/vm/service/service.md b/runtime/vm/service/service.md
index 99cfa3d..c96ab96 100644
--- a/runtime/vm/service/service.md
+++ b/runtime/vm/service/service.md
@@ -1,8 +1,8 @@
-# Dart VM Service Protocol 3.29
+# Dart VM Service Protocol 3.30
> Please post feedback to the [observatory-discuss group][discuss-list]
-This document describes of _version 3.29_ of the Dart VM Service Protocol. This
+This document describes of _version 3.30_ of the Dart VM Service Protocol. This
protocol is used to communicate with a running Dart Virtual Machine.
To use the Service Protocol, start the VM with the *--observe* flag.
@@ -429,7 +429,7 @@
ReturnType1|ReturnType2
```
-Any RPC may return an _error_ response as [described above](#rpc-error).
+Any RPC may return an [RPC error](#rpc-error) response.
Some parameters are optional. This is indicated by the text
_[optional]_ following the parameter name:
@@ -444,10 +444,10 @@
### addBreakpoint
```
-Breakpoint addBreakpoint(string isolateId,
- string scriptId,
- int line,
- int column [optional])
+Breakpoint|Sentinel addBreakpoint(string isolateId,
+ string scriptId,
+ int line,
+ int column [optional])
```
The _addBreakpoint_ RPC is used to add a breakpoint at a specific line
@@ -467,19 +467,22 @@
breakpoints.
If no breakpoint is possible at that line, the _102_ (Cannot add
-breakpoint) error code is returned.
+breakpoint) [RPC error](#rpc-error) code is returned.
Note that breakpoints are added and removed on a per-isolate basis.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [Breakpoint](#breakpoint).
### addBreakpointWithScriptUri
```
-Breakpoint addBreakpointWithScriptUri(string isolateId,
- string scriptUri,
- int line,
- int column [optional])
+Breakpoint|Sentinel addBreakpointWithScriptUri(string isolateId,
+ string scriptUri,
+ int line,
+ int column [optional])
```
The _addBreakpoint_ RPC is used to add a breakpoint at a specific line
@@ -501,23 +504,29 @@
breakpoints.
If no breakpoint is possible at that line, the _102_ (Cannot add
-breakpoint) error code is returned.
+breakpoint) [RPC error](#rpc-error) code is returned.
Note that breakpoints are added and removed on a per-isolate basis.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [Breakpoint](#breakpoint).
### addBreakpointAtEntry
```
-Breakpoint addBreakpointAtEntry(string isolateId,
- string functionId)
+Breakpoint|Sentinel addBreakpointAtEntry(string isolateId,
+ string functionId)
```
The _addBreakpointAtEntry_ RPC is used to add a breakpoint at the
entrypoint of some function.
If no breakpoint is possible at the function entry, the _102_ (Cannot add
-breakpoint) error code is returned.
+breakpoint) [RPC error](#rpc-error) code is returned.
+
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
See [Breakpoint](#breakpoint).
@@ -526,11 +535,14 @@
### clearCpuSamples
```
-Success clearCpuSamples(string isolateId)
+Success|Sentinel clearCpuSamples(string isolateId)
```
Clears all CPU profiling samples.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [Success](#success).
### clearVMTimeline
@@ -573,10 +585,13 @@
collected by the VM's garbage collector, then the _Collected_
[Sentinel](#sentinel) is returned.
-If invocation triggers a failed compilation then [rpc error](#rpc-error) 113
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
+If invocation triggers a failed compilation then [RPC error](#rpc-error) 113
"Expression compilation error" is returned.
-If an runtime error occurs while evaluating the invocation, an [@Error](#error)
+If a runtime error occurs while evaluating the invocation, an [@Error](#error)
reference will be returned.
If the invocation is evaluated successfully, an [@Instance](#instance)
@@ -605,6 +620,9 @@
garbage collector, then the _Collected_ [Sentinel](#sentinel) is
returned.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
If _scope_ is provided, it should be a map from identifiers to object ids.
These bindings will be added to the scope in which the expression is evaluated,
which is a child scope of the class or library for instance/class or library
@@ -614,7 +632,7 @@
If _disableBreakpoints_ is provided and set to true, any breakpoints hit as a
result of this evaluation are ignored. Defaults to false if not provided.
-If the expression fails to parse and compile, then [rpc error](#rpc-error) 113
+If the expression fails to parse and compile, then [RPC error](#rpc-error) 113
"Expression compilation error" is returned.
If an error occurs while evaluating the expression, an [@Error](#error)
@@ -647,7 +665,7 @@
If _disableBreakpoints_ is provided and set to true, any breakpoints hit as a
result of this evaluation are ignored. Defaults to false if not provided.
-If the expression fails to parse and compile, then [rpc error](#rpc-error) 113
+If the expression fails to parse and compile, then [RPC error](#rpc-error) 113
"Expression compilation error" is returned.
If an error occurs while evaluating the expression, an [@Error](#error)
@@ -656,12 +674,15 @@
If the expression is evaluated successfully, an [@Instance](#instance)
reference will be returned.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
### getAllocationProfile
```
-AllocationProfile getAllocationProfile(string isolateId,
- bool reset [optional],
- bool gc [optional])
+AllocationProfile|Sentinel getAllocationProfile(string isolateId,
+ bool reset [optional],
+ bool gc [optional])
```
The _getAllocationProfile_ RPC is used to retrieve allocation information for a
@@ -674,6 +695,9 @@
before collecting allocation information. There is no guarantee that a garbage
collection will be actually be performed.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
### getClientName
```
@@ -689,16 +713,19 @@
### getCpuSamples
```
-CpuSamples getCpuSamples(string isolateId,
- int timeOriginMicros,
- int timeExtentMicros)
+CpuSamples|Sentinel getCpuSamples(string isolateId,
+ int timeOriginMicros,
+ int timeExtentMicros)
```
The _getCpuSamples_ RPC is used to retrieve samples collected by the CPU
profiler. Only samples collected in the time range `[timeOriginMicros,
timeOriginMicros + timeExtentMicros]` will be reported.
-If the profiler is disabled, an error response will be returned.
+If the profiler is disabled, an [RPC error](#rpc-error) response will be returned.
+
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
See [CpuSamples](#cpusamples).
@@ -739,14 +766,17 @@
garbage collector, then the _Collected_ [Sentinel](#sentinel) is
returned.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [InboundReferences](#inboundreferences).
### getInstances
```
-InstanceSet getInstances(string isolateId,
- string objectId,
- int limit)
+InstanceSet|Sentinel getInstances(string isolateId,
+ string objectId,
+ int limit)
```
The _getInstances_ RPC is used to retrieve a set of instances which are of a
@@ -762,10 +792,13 @@
been garbage collected.
_objectId_ is the ID of the `Class` to retrieve instances for. _objectId_ must
-be the ID of a `Class`, otherwise an error is returned.
+be the ID of a `Class`, otherwise an [RPC error](#rpc-error) is returned.
_limit_ is the maximum number of instances to be returned.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [InstanceSet](#instanceset).
### getIsolate
@@ -827,12 +860,15 @@
### getScripts
```
-ScriptList getScripts(string isolateId)
+ScriptList|Sentinel getScripts(string isolateId)
```
The _getScripts_ RPC is used to retrieve a _ScriptList_ containing all
scripts for an isolate based on the isolate's _isolateId_.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [ScriptList](#scriptlist).
### getObject
@@ -850,6 +886,9 @@
If _objectId_ is a temporary id which has expired, then the _Expired_
[Sentinel](#sentinel) is returned.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
If _objectId_ refers to a heap object which has been collected by the VM's
garbage collector, then the _Collected_ [Sentinel](#sentinel) is
returned.
@@ -870,15 +909,18 @@
### getRetainingPath
```
-RetainingPath getRetainingPath(string isolateId,
- string targetId,
- int limit)
+RetainingPath|Sentinel getRetainingPath(string isolateId,
+ string targetId,
+ int limit)
```
The _getRetainingPath_ RPC is used to lookup a path from an object specified by
_targetId_ to a GC root (i.e., the object which is preventing this object from
being garbage collected).
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
If _targetId_ refers to a heap object which has been collected by the VM's
garbage collector, then the _Collected_ [Sentinel](#sentinel) is returned.
@@ -897,23 +939,26 @@
### getStack
```
-Stack getStack(string isolateId)
+Stack|Sentinel getStack(string isolateId)
```
The _getStack_ RPC is used to retrieve the current execution stack and
message queue for an isolate. The isolate does not need to be paused.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [Stack](#stack).
### getSourceReport
```
-SourceReport getSourceReport(string isolateId,
- SourceReportKind[] reports,
- string scriptId [optional],
- int tokenPos [optional],
- int endTokenPos [optional],
- bool forceCompile [optional])
+SourceReport|Sentinel getSourceReport(string isolateId,
+ SourceReportKind[] reports,
+ string scriptId [optional],
+ int tokenPos [optional],
+ int endTokenPos [optional],
+ bool forceCompile [optional])
```
The _getSourceReport_ RPC is used to generate a set of reports tied to
@@ -949,6 +994,9 @@
program. If this parameter is not provided, it is considered to have
the value _false_.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [SourceReport](#sourcereport).
### getVersion
@@ -994,7 +1042,7 @@
from the following time range will be returned: `(timeOriginMicros, timeOriginMicros + timeExtentMicros)`.
If _getVMTimeline_ is invoked while the current recorder is one of Fuchsia or Macos or
-Systrace, the _114_ error code, invalid timeline request, will be returned as
+Systrace, an [RPC error](#rpc-error) with error code _114_, `invalid timeline request`, will be returned as
timeline events are handled by the OS in these modes.
### getVMTimelineFlags
@@ -1023,25 +1071,31 @@
### pause
```
-Success pause(string isolateId)
+Success|Sentinel pause(string isolateId)
```
The _pause_ RPC is used to interrupt a running isolate. The RPC enqueues the interrupt request and potentially returns before the isolate is paused.
When the isolate is paused an event will be sent on the _Debug_ stream.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [Success](#success).
### kill
```
-Success kill(string isolateId)
+Success|Sentinel kill(string isolateId)
```
The _kill_ RPC is used to kill an isolate as if by dart:isolate's `Isolate.kill(IMMEDIATE)`.
The isolate is killed regardless of whether it is paused or running.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [Success](#success).
### registerService
@@ -1062,11 +1116,11 @@
### reloadSources
```
-ReloadReport reloadSources(string isolateId,
- bool force [optional],
- bool pause [optional],
- string rootLibUri [optional],
- string packagesUri [optional])
+ReloadReport|Sentinel reloadSources(string isolateId,
+ bool force [optional],
+ bool pause [optional],
+ string rootLibUri [optional],
+ string packagesUri [optional])
```
The _reloadSources_ RPC is used to perform a hot reload of an Isolate's sources.
@@ -1083,23 +1137,29 @@
if the _packagesUri_ parameter is provided, it indicates the new uri to the
Isolate's package map (.packages) file.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
### removeBreakpoint
```
-Success removeBreakpoint(string isolateId,
- string breakpointId)
+Success|Sentinel removeBreakpoint(string isolateId,
+ string breakpointId)
```
The _removeBreakpoint_ RPC is used to remove a breakpoint by its _id_.
Note that breakpoints are added and removed on a per-isolate basis.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [Success](#success).
### requestHeapSnapshot
```
-Success requestHeapSnapshot(string isolateId)
+Success|Sentinel requestHeapSnapshot(string isolateId)
```
Requests a dump of the Dart heap of the given isolate.
@@ -1110,6 +1170,9 @@
type. The splitting of the SnapshotGraph into events can happen at any byte
offset.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
### requirePermissionToResume
```
@@ -1149,9 +1212,9 @@
### resume
```
-Success resume(string isolateId,
- StepOption step [optional],
- int frameIndex [optional])
+Success|Sentinel resume(string isolateId,
+ StepOption step [optional],
+ int frameIndex [optional])
```
The _resume_ RPC is used to resume execution of a paused isolate.
@@ -1175,6 +1238,9 @@
If the _frameIndex_ parameter is not provided, it defaults to 1.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [Success](#success), [StepOption](#StepOption).
### setClientName
@@ -1193,8 +1259,8 @@
### setExceptionPauseMode
```
-Success setExceptionPauseMode(string isolateId,
- ExceptionPauseMode mode)
+Success|Sentinel setExceptionPauseMode(string isolateId,
+ ExceptionPauseMode mode)
```
The _setExceptionPauseMode_ RPC is used to control if an isolate pauses when
@@ -1206,6 +1272,9 @@
Unhandled | Pause isolate on unhandled exceptions
All | Pause isolate on all thrown exceptions
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
### setFlag
```
@@ -1238,25 +1307,31 @@
### setLibraryDebuggable
```
-Success setLibraryDebuggable(string isolateId,
- string libraryId,
- bool isDebuggable)
+Success|Sentinel setLibraryDebuggable(string isolateId,
+ string libraryId,
+ bool isDebuggable)
```
The _setLibraryDebuggable_ RPC is used to enable or disable whether
breakpoints and stepping work for a given library.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [Success](#success).
### setName
```
-Success setName(string isolateId,
- string name)
+Success|Sentinel setName(string isolateId,
+ string name)
```
The _setName_ RPC is used to change the debugging name for an isolate.
+If _isolateId_ refers to an isolate which has exited, then the
+_Collected_ [Sentinel](#sentinel) is returned.
+
See [Success](#success).
### setVMName
@@ -1294,7 +1369,7 @@
The _streamCancel_ RPC cancels a stream subscription in the VM.
If the client is not subscribed to the stream, the _104_ (Stream not
-subscribed) error code is returned.
+subscribed) [RPC error](#rpc-error) code is returned.
See [Success](#success).
@@ -1308,7 +1383,7 @@
subscribed, the client will begin receiving events from the stream.
If the client is already subscribed to the stream, the _103_ (Stream already
-subscribed) error code is returned.
+subscribed) [RPC error](#rpc-error) code is returned.
The _streamId_ parameter may have the following published values:
@@ -1805,7 +1880,7 @@
```
An _Error_ represents a Dart language level error. This is distinct from an
-[rpc error](#rpc-error).
+[RPC error](#rpc-error).
### ErrorKind
@@ -2228,6 +2303,12 @@
// The owner of this function, which can be a Library, Class, or a Function.
@Library|@Class|@Function owner;
+ // Is this function static?
+ bool static;
+
+ // Is this function const?
+ bool const;
+
// The location of this function in the source code.
SourceLocation location [optional];
@@ -2490,7 +2571,19 @@
//
// Provided for instance kinds:
// RegExp
- String pattern [optional];
+ @Instance pattern [optional];
+
+// The function associated with a Closure instance.
+ //
+ // Provided for instance kinds:
+ // Closure
+ @Function closureFunction [optional];
+
+ // The context associated with a Closure instance.
+ //
+ // Provided for instance kinds:
+ // Closure
+ @Context closureContext [optional];
// Whether this regular expression is case sensitive.
//
@@ -3633,5 +3726,6 @@
3.27 | Add `clearCpuSamples`, `getCpuSamples` RPCs and `CpuSamples`, `CpuSample` objects.
3.28 | TODO(aam): document changes from 3.28
3.29 | Add `getClientName`, `setClientName`, `requireResumeApproval`
+3.30 | Updated return types of RPCs which require an `isolateId` to allow for `Sentinel` results if the target isolate has shutdown.
[discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss
diff --git a/runtime/vm/service_event.cc b/runtime/vm/service_event.cc
index e7441e1..4233863 100644
--- a/runtime/vm/service_event.cc
+++ b/runtime/vm/service_event.cc
@@ -228,12 +228,14 @@
JSONObject jssettings(&jsobj, "_debuggerSettings");
isolate()->debugger()->PrintSettingsToJSONObject(&jssettings);
}
- if ((top_frame() != NULL) && Isolate::Current()->compilation_allowed()) {
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ if (top_frame() != nullptr) {
JSONObject jsFrame(&jsobj, "topFrame");
top_frame()->PrintToJSONObject(&jsFrame);
intptr_t index = 0; // Avoid ambiguity in call to AddProperty.
jsFrame.AddProperty("index", index);
}
+#endif
if (exception() != NULL) {
jsobj.AddProperty("exception", *(exception()));
}
diff --git a/runtime/vm/service_isolate.cc b/runtime/vm/service_isolate.cc
index 7198691..4817ab9 100644
--- a/runtime/vm/service_isolate.cc
+++ b/runtime/vm/service_isolate.cc
@@ -363,7 +363,6 @@
free(error);
error = nullptr;
- ServiceIsolate::SetServiceIsolate(NULL);
ServiceIsolate::InitializingFailed(formatted_error);
return;
}
@@ -419,9 +418,6 @@
}
Dart::RunShutdownCallback();
}
- ASSERT(ServiceIsolate::IsServiceIsolate(I));
- ServiceIsolate::SetServiceIsolate(NULL);
- ServiceIsolate::SetServicePort(ILLEGAL_PORT);
// Shut the isolate down.
Dart::ShutdownIsolate(I);
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index 0eb8130..8968b17 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -621,7 +621,7 @@
intptr_t result_cid = result->GetClassId();
const auto unboxed_fields =
- isolate()->shared_class_table()->GetUnboxedFieldsMapAt(result_cid);
+ isolate()->group()->class_table()->GetUnboxedFieldsMapAt(result_cid);
while (offset < next_field_offset) {
if (unboxed_fields.Get(offset / kWordSize)) {
@@ -1476,7 +1476,8 @@
WriteObjectImpl(cls, kAsInlinedObject);
const auto unboxed_fields =
- isolate()->shared_class_table()->GetUnboxedFieldsMapAt(cls->ptr()->id_);
+ isolate()->group()->class_table()->GetUnboxedFieldsMapAt(
+ cls->ptr()->id_);
// Write out all the fields for the object.
// Instance::NextFieldOffset() returns the offset of the first field in
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index 3c528e8..e38f4bf 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -780,11 +780,11 @@
};
// An object pointer visitor implementation which writes out
-// objects to a snap shot.
+// objects to a snapshot.
class SnapshotWriterVisitor : public ObjectPointerVisitor {
public:
SnapshotWriterVisitor(SnapshotWriter* writer, bool as_references)
- : ObjectPointerVisitor(Isolate::Current()),
+ : ObjectPointerVisitor(Isolate::Current()->group()),
writer_(writer),
as_references_(as_references) {}
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index aeef453..9e619bd 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -357,7 +357,7 @@
Capability& obj = Capability::Handle();
obj ^= reader.ReadObject();
- EXPECT_STREQ("12345", obj.Id());
+ EXPECT_EQ(static_cast<uint64_t>(12345), obj.Id());
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
@@ -1447,7 +1447,7 @@
EXPECT_STREQ("A", element->value.as_string);
element = root->value.as_array.values[1];
EXPECT_EQ(Dart_CObject_kDouble, element->type);
- EXPECT_STREQ("2.72", element->value.as_double);
+ EXPECT_EQ(2.72, element->value.as_double);
for (int i = 2; i < kArrayLength; i++) {
element = root->value.as_array.values[i];
if ((i % 2) == 0) {
@@ -1458,7 +1458,7 @@
// Double values are expected to not be canonicalized in messages.
EXPECT_NE(root->value.as_array.values[1], element);
EXPECT_EQ(Dart_CObject_kDouble, element->type);
- EXPECT_STREQ("2.72", element->value.as_double);
+ EXPECT_EQ(2.72, element->value.as_double);
}
}
}
@@ -1651,7 +1651,7 @@
EXPECT_STREQ(".", element->value.as_string);
element = root->value.as_array.values[1];
EXPECT_EQ(Dart_CObject_kDouble, element->type);
- EXPECT_STREQ("2.72", element->value.as_double);
+ EXPECT_EQ(2.72, element->value.as_double);
for (int i = 2; i < kArrayLength; i++) {
Dart_CObject* element = root->value.as_array.values[i];
if ((i % 2) == 0) {
@@ -1662,7 +1662,7 @@
// Double values are expected to not be canonicalized in messages.
EXPECT_NE(root->value.as_array.values[1], element);
EXPECT_EQ(Dart_CObject_kDouble, element->type);
- EXPECT_STREQ("2.72", element->value.as_double);
+ EXPECT_EQ(2.72, element->value.as_double);
}
}
}
diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc
index 564d610..7f554a1 100644
--- a/runtime/vm/stack_frame.cc
+++ b/runtime/vm/stack_frame.cc
@@ -103,15 +103,25 @@
#endif
}
-Isolate* StackFrame::IsolateOfBareInstructionsFrame() const {
- auto isolate = this->isolate();
-
+Isolate* StackFrame::IsolateOfBareInstructionsFrame(bool needed_for_gc) const {
+ Isolate* isolate = Dart::vm_isolate();
if (isolate->object_store()->code_order_table() != Object::null()) {
auto rct = isolate->reverse_pc_lookup_cache();
if (rct->Contains(pc())) return isolate;
}
- isolate = Dart::vm_isolate();
+ isolate = this->isolate();
+ // The active isolate is null only during GC, in which case it does not matter
+ // which isolate we use for the reverse-pc lookup table, since the metadata
+ // is the same across all isolates.
+ // TODO(dartbug.com/36097): Avoid having the [ReversePcLookupTable]
+ // per-isolate. Right now we still need it per-isolate for non-GC cases, e.g.
+ // for stack walking code which relies on finding owner functions of code
+ // objects.
+ if (isolate == nullptr) {
+ ASSERT(needed_for_gc);
+ isolate = isolate_group()->isolates_.First();
+ }
if (isolate->object_store()->code_order_table() != Object::null()) {
auto rct = isolate->reverse_pc_lookup_cache();
if (rct->Contains(pc())) return isolate;
@@ -123,7 +133,7 @@
bool StackFrame::IsBareInstructionsDartFrame() const {
NoSafepointScope no_safepoint;
- if (auto isolate = IsolateOfBareInstructionsFrame()) {
+ if (auto isolate = IsolateOfBareInstructionsFrame(/*needed_for_gc=*/true)) {
Code code;
auto rct = isolate->reverse_pc_lookup_cache();
code = rct->Lookup(pc(), /*is_return_address=*/true);
@@ -138,7 +148,7 @@
bool StackFrame::IsBareInstructionsStubFrame() const {
NoSafepointScope no_safepoint;
- if (auto isolate = IsolateOfBareInstructionsFrame()) {
+ if (auto isolate = IsolateOfBareInstructionsFrame(/*needed_for_gc=*/true)) {
Code code;
auto rct = isolate->reverse_pc_lookup_cache();
code = rct->Lookup(pc(), /*is_return_address=*/true);
@@ -252,7 +262,7 @@
NoSafepointScope no_safepoint;
Code code;
- if (auto isolate = IsolateOfBareInstructionsFrame()) {
+ if (auto isolate = IsolateOfBareInstructionsFrame(/*needed_for_gc=*/true)) {
auto const rct = isolate->reverse_pc_lookup_cache();
code = rct->Lookup(pc(), /*is_return_address=*/true);
} else {
@@ -278,8 +288,16 @@
CompressedStackMaps maps;
maps = code.compressed_stackmaps();
CompressedStackMaps global_table;
- global_table =
- this->isolate()->object_store()->canonicalized_stack_map_entries();
+
+ // The GC does not have an active isolate, only an active isolate group,
+ // yet the global compressed stack map table is only stored in the object
+ // store. It has the same contents for all isolates, so we just pick the
+ // one from the first isolate here.
+ // TODO(dartbug.com/36097): Avoid having this per-isolate and instead store
+ // it per isolate group.
+ auto isolate = isolate_group()->isolates_.First();
+
+ global_table = isolate->object_store()->canonicalized_stack_map_entries();
CompressedStackMapsIterator it(maps, global_table);
const uword start = code.PayloadStart();
const uint32_t pc_offset = pc() - start;
@@ -387,7 +405,7 @@
// where Thread::Current() is NULL, so we cannot create a NoSafepointScope.
NoSafepointScope no_safepoint;
#endif
- if (auto isolate = IsolateOfBareInstructionsFrame()) {
+ if (auto isolate = IsolateOfBareInstructionsFrame(/*needed_for_gc=*/false)) {
auto const rct = isolate->reverse_pc_lookup_cache();
return rct->Lookup(pc(), /*is_return_address=*/true);
}
@@ -402,7 +420,7 @@
RawCode* StackFrame::GetCodeObject() const {
ASSERT(!is_interpreted());
- if (auto isolate = IsolateOfBareInstructionsFrame()) {
+ if (auto isolate = IsolateOfBareInstructionsFrame(/*needed_for_gc=*/false)) {
auto const rct = isolate->reverse_pc_lookup_cache();
return rct->Lookup(pc(), /*is_return_address=*/true);
} else {
diff --git a/runtime/vm/stack_frame.h b/runtime/vm/stack_frame.h
index 00ed7c91..39af4d5 100644
--- a/runtime/vm/stack_frame.h
+++ b/runtime/vm/stack_frame.h
@@ -100,7 +100,10 @@
//
// If the frame does not belong to a bare instructions snapshot, it will
// return nullptr.
- Isolate* IsolateOfBareInstructionsFrame() const;
+ //
+ // [needed_for_gc] has to be set to `true` if the caller needs only GC
+ // relevant information.
+ Isolate* IsolateOfBareInstructionsFrame(bool needed_for_gc) const;
// Returns true iff the current frame is a bare instructions dart frame.
bool IsBareInstructionsDartFrame() const;
@@ -150,6 +153,7 @@
}
Isolate* isolate() const { return thread_->isolate(); }
+ IsolateGroup* isolate_group() const { return thread_->isolate_group(); }
Thread* thread() const { return thread_; }
@@ -172,7 +176,7 @@
kWordSize)));
ASSERT(raw_pc != StubCode::DeoptimizeLazyFromThrow().EntryPoint());
if (raw_pc == StubCode::DeoptimizeLazyFromReturn().EntryPoint()) {
- return isolate()->FindPendingDeopt(GetCallerFp());
+ return isolate_group()->FindPendingDeoptAtSafepoint(GetCallerFp());
}
return raw_pc;
}
diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h
index 85fb329..be2ad99 100644
--- a/runtime/vm/stub_code.h
+++ b/runtime/vm/stub_code.h
@@ -75,6 +75,8 @@
static const Code& UnoptimizedStaticCallEntry(intptr_t num_args_tested);
+ static const char* NameAt(intptr_t index) { return entries_[index].name; }
+
static const Code& EntryAt(intptr_t index) { return *(entries_[index].code); }
static void EntryAtPut(intptr_t index, Code* entry) {
ASSERT(entry->IsReadOnlyHandle());
diff --git a/runtime/vm/stub_code_list.h b/runtime/vm/stub_code_list.h
index ce41ba0..9f710c9 100644
--- a/runtime/vm/stub_code_list.h
+++ b/runtime/vm/stub_code_list.h
@@ -64,10 +64,12 @@
V(Subtype4TestCache) \
V(Subtype6TestCache) \
V(DefaultTypeTest) \
+ V(DefaultNullableTypeTest) \
V(TopTypeTypeTest) \
V(UnreachableTypeTest) \
V(SlowTypeTest) \
V(LazySpecializeTypeTest) \
+ V(LazySpecializeNullableTypeTest) \
V(CallClosureNoSuchMethod) \
V(FrameAwaitingMaterialization) \
V(AsynchronousGapMarker) \
diff --git a/runtime/vm/tags.cc b/runtime/vm/tags.cc
index e756a8f..8636df7 100644
--- a/runtime/vm/tags.cc
+++ b/runtime/vm/tags.cc
@@ -78,7 +78,7 @@
VMTagScope::VMTagScope(Thread* thread, uword tag, bool conditional_set)
: ThreadStackResource(thread) {
- ASSERT(isolate() != NULL);
+ ASSERT(isolate_group() != NULL);
previous_tag_ = thread->vm_tag();
if (conditional_set) {
thread->set_vm_tag(tag);
@@ -86,7 +86,7 @@
}
VMTagScope::~VMTagScope() {
- ASSERT(isolate() != NULL);
+ ASSERT(isolate_group() != NULL);
thread()->set_vm_tag(previous_tag_);
}
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index 57d8dc8..52de00b 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -342,11 +342,9 @@
TaskKind kind,
bool bypass_safepoint) {
ASSERT(kind != kMutatorTask);
- const bool kIsNotMutatorThread = false;
- Thread* thread =
- isolate->ScheduleThread(kIsNotMutatorThread, bypass_safepoint);
+ const bool kIsMutatorThread = false;
+ Thread* thread = isolate->ScheduleThread(kIsMutatorThread, bypass_safepoint);
if (thread != NULL) {
- ASSERT(thread->store_buffer_block_ == NULL);
ASSERT(!thread->IsMutatorThread());
ASSERT(thread->isolate() == isolate);
ASSERT(thread->isolate_group() == isolate->group());
@@ -367,8 +365,37 @@
Isolate* isolate = thread->isolate();
ASSERT(isolate != NULL);
- const bool kIsNotMutatorThread = false;
- isolate->UnscheduleThread(thread, kIsNotMutatorThread, bypass_safepoint);
+ const bool kIsMutatorThread = false;
+ isolate->UnscheduleThread(thread, kIsMutatorThread, bypass_safepoint);
+}
+
+bool Thread::EnterIsolateGroupAsHelper(IsolateGroup* isolate_group,
+ TaskKind kind,
+ bool bypass_safepoint) {
+ ASSERT(kind != kMutatorTask);
+ Thread* thread = isolate_group->ScheduleThread(bypass_safepoint);
+ if (thread != NULL) {
+ ASSERT(!thread->IsMutatorThread());
+ ASSERT(thread->isolate() == nullptr);
+ ASSERT(thread->isolate_group() == isolate_group);
+ thread->FinishEntering(kind);
+ return true;
+ }
+ return false;
+}
+
+void Thread::ExitIsolateGroupAsHelper(bool bypass_safepoint) {
+ Thread* thread = Thread::Current();
+ ASSERT(thread != nullptr);
+ ASSERT(!thread->IsMutatorThread());
+ ASSERT(thread->isolate() == nullptr);
+ ASSERT(thread->isolate_group() != nullptr);
+
+ thread->PrepareLeaving();
+
+ const bool kIsMutatorThread = false;
+ thread->isolate_group()->UnscheduleThread(thread, kIsMutatorThread,
+ bypass_safepoint);
}
void Thread::ReleaseStoreBuffer() {
@@ -379,7 +406,7 @@
// Make sure to get an *empty* block; the isolate needs all entries
// at GC time.
// TODO(koda): Replace with an epilogue (PrepareAfterGC) that acquires.
- store_buffer_block_ = isolate()->store_buffer()->PopEmptyBlock();
+ store_buffer_block_ = isolate_group()->store_buffer()->PopEmptyBlock();
}
void Thread::SetStackLimit(uword limit) {
@@ -417,9 +444,10 @@
}
if (stack_limit_ == saved_stack_limit_) {
- stack_limit_ = kInterruptStackLimit & ~kInterruptsMask;
+ stack_limit_ = (kInterruptStackLimit & ~kInterruptsMask) | interrupt_bits;
+ } else {
+ stack_limit_ = stack_limit_ | interrupt_bits;
}
- stack_limit_ |= interrupt_bits;
}
uword Thread::GetAndClearInterrupts() {
@@ -447,7 +475,7 @@
deferred_interrupts_ = stack_limit_ & deferred_interrupts_mask_;
// Clear deferrable interrupts, if present.
- stack_limit_ &= ~deferred_interrupts_mask_;
+ stack_limit_ = stack_limit_ & ~deferred_interrupts_mask_;
if ((stack_limit_ & kInterruptsMask) == 0) {
// No other pending interrupts. Restore normal stack limit.
@@ -475,7 +503,7 @@
if (stack_limit_ == saved_stack_limit_) {
stack_limit_ = kInterruptStackLimit & ~kInterruptsMask;
}
- stack_limit_ |= deferred_interrupts_;
+ stack_limit_ = stack_limit_ | deferred_interrupts_;
deferred_interrupts_ = 0;
}
#if !defined(PRODUCT)
@@ -490,7 +518,7 @@
uword interrupt_bits = GetAndClearInterrupts();
if ((interrupt_bits & kVMInterrupt) != 0) {
CheckForSafepoint();
- if (isolate()->store_buffer()->Overflowed()) {
+ if (isolate_group()->store_buffer()->Overflowed()) {
if (FLAG_verbose_gc) {
OS::PrintErr("Scavenge scheduled by store buffer overflow.\n");
}
@@ -546,11 +574,11 @@
void Thread::StoreBufferRelease(StoreBuffer::ThresholdPolicy policy) {
StoreBufferBlock* block = store_buffer_block_;
store_buffer_block_ = NULL;
- isolate()->store_buffer()->PushBlock(block, policy);
+ isolate_group()->store_buffer()->PushBlock(block, policy);
}
void Thread::StoreBufferAcquire() {
- store_buffer_block_ = isolate()->store_buffer()->PopNonFullBlock();
+ store_buffer_block_ = isolate_group()->store_buffer()->PopNonFullBlock();
}
void Thread::MarkingStackBlockProcess() {
@@ -581,11 +609,11 @@
MarkingStackBlock* block = marking_stack_block_;
marking_stack_block_ = NULL;
write_barrier_mask_ = RawObject::kGenerationalBarrierMask;
- isolate()->marking_stack()->PushBlock(block);
+ isolate_group()->marking_stack()->PushBlock(block);
}
void Thread::MarkingStackAcquire() {
- marking_stack_block_ = isolate()->marking_stack()->PopEmptyBlock();
+ marking_stack_block_ = isolate_group()->marking_stack()->PopEmptyBlock();
write_barrier_mask_ =
RawObject::kGenerationalBarrierMask | RawObject::kIncrementalBarrierMask;
}
@@ -593,16 +621,19 @@
void Thread::DeferredMarkingStackRelease() {
MarkingStackBlock* block = deferred_marking_stack_block_;
deferred_marking_stack_block_ = NULL;
- isolate()->deferred_marking_stack()->PushBlock(block);
+ isolate_group()->deferred_marking_stack()->PushBlock(block);
}
void Thread::DeferredMarkingStackAcquire() {
deferred_marking_stack_block_ =
- isolate()->deferred_marking_stack()->PopEmptyBlock();
+ isolate_group()->deferred_marking_stack()->PopEmptyBlock();
}
bool Thread::IsMutatorThread() const {
- return ((isolate_ != NULL) && (isolate_->mutator_thread() == this));
+ if (isolate_ != nullptr) {
+ ASSERT(is_mutator_thread_ == (isolate_->mutator_thread() == this));
+ }
+ return is_mutator_thread_;
}
bool Thread::CanCollectGarbage() const {
@@ -894,22 +925,22 @@
}
void Thread::EnterSafepointUsingLock() {
- isolate()->safepoint_handler()->EnterSafepointUsingLock(this);
+ isolate_group()->safepoint_handler()->EnterSafepointUsingLock(this);
}
void Thread::ExitSafepointUsingLock() {
- isolate()->safepoint_handler()->ExitSafepointUsingLock(this);
+ isolate_group()->safepoint_handler()->ExitSafepointUsingLock(this);
}
void Thread::BlockForSafepoint() {
- isolate()->safepoint_handler()->BlockForSafepoint(this);
+ isolate_group()->safepoint_handler()->BlockForSafepoint(this);
}
void Thread::FinishEntering(TaskKind kind) {
ASSERT(store_buffer_block_ == nullptr);
task_kind_ = kind;
- if (isolate()->marking_stack() != NULL) {
+ if (isolate_group()->marking_stack() != NULL) {
// Concurrent mark in progress. Enable barrier for this thread.
MarkingStackAcquire();
DeferredMarkingStackAcquire();
@@ -920,7 +951,7 @@
if (kind == kMutatorTask) {
StoreBufferAcquire();
} else {
- store_buffer_block_ = isolate()->store_buffer()->PopEmptyBlock();
+ store_buffer_block_ = isolate_group()->store_buffer()->PopEmptyBlock();
}
}
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index 845db7a..8353003 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -271,6 +271,11 @@
bool bypass_safepoint = false);
static void ExitIsolateAsHelper(bool bypass_safepoint = false);
+ static bool EnterIsolateGroupAsHelper(IsolateGroup* isolate_group,
+ TaskKind kind,
+ bool bypass_safepoint);
+ static void ExitIsolateGroupAsHelper(bool bypass_safepoint);
+
// Empties the store buffer block into the isolate.
void ReleaseStoreBuffer();
void AcquireMarkingStack();
@@ -862,7 +867,7 @@
// in SIMARM(IA32) and ARM, and the same offsets in SIMARM64(X64) and ARM64.
// We use only word-sized fields to avoid differences in struct packing on the
// different architectures. See also CheckOffsets in dart.cc.
- uword stack_limit_;
+ RelaxedAtomic<uword> stack_limit_;
uword write_barrier_mask_;
Isolate* isolate_;
uword* dispatch_table_array_;
@@ -981,6 +986,7 @@
#endif
Thread* next_; // Used to chain the thread structures in an isolate.
+ bool is_mutator_thread_ = false;
explicit Thread(bool is_vm_isolate);
@@ -1021,9 +1027,13 @@
friend class Simulator;
friend class StackZone;
friend class ThreadRegistry;
+ friend class NoActiveIsolateScope;
friend class CompilerState;
friend class compiler::target::Thread;
friend class FieldTable;
+ friend Isolate* CreateWithinExistingIsolateGroup(IsolateGroup*,
+ const char*,
+ char**);
DISALLOW_COPY_AND_ASSIGN(Thread);
};
diff --git a/runtime/vm/thread_registry.cc b/runtime/vm/thread_registry.cc
index efbd892..8ef9227 100644
--- a/runtime/vm/thread_registry.cc
+++ b/runtime/vm/thread_registry.cc
@@ -41,15 +41,16 @@
ReturnToFreelistLocked(thread);
}
-void ThreadRegistry::VisitObjectPointers(Isolate* isolate_of_interest,
- ObjectPointerVisitor* visitor,
- ValidationPolicy validate_frames) {
+void ThreadRegistry::VisitObjectPointers(
+ IsolateGroup* isolate_group_of_interest,
+ ObjectPointerVisitor* visitor,
+ ValidationPolicy validate_frames) {
MonitorLocker ml(threads_lock());
Thread* thread = active_list_;
while (thread != NULL) {
- if (thread->isolate() == isolate_of_interest) {
+ if (thread->isolate_group() == isolate_group_of_interest) {
// The mutator thread is visited by the isolate itself (see
- // [Isolate::VisitStackPointers]).
+ // [IsolateGroup::VisitStackPointers]).
if (!thread->IsMutatorThread()) {
thread->VisitObjectPointers(visitor, validate_frames);
}
@@ -58,42 +59,37 @@
}
}
-void ThreadRegistry::ReleaseStoreBuffers(Isolate* isolate_of_interest) {
+void ThreadRegistry::ReleaseStoreBuffers() {
MonitorLocker ml(threads_lock());
Thread* thread = active_list_;
while (thread != NULL) {
- if (thread->isolate() == isolate_of_interest) {
- if (!thread->BypassSafepoints()) {
- thread->ReleaseStoreBuffer();
- }
+ if (!thread->BypassSafepoints()) {
+ thread->ReleaseStoreBuffer();
}
thread = thread->next_;
}
}
-void ThreadRegistry::AcquireMarkingStacks(Isolate* isolate_of_interest) {
+void ThreadRegistry::AcquireMarkingStacks() {
MonitorLocker ml(threads_lock());
Thread* thread = active_list_;
while (thread != NULL) {
- if (thread->isolate() == isolate_of_interest) {
- if (!thread->BypassSafepoints()) {
- thread->MarkingStackAcquire();
- thread->DeferredMarkingStackAcquire();
- }
+ if (!thread->BypassSafepoints()) {
+ thread->MarkingStackAcquire();
+ thread->DeferredMarkingStackAcquire();
}
thread = thread->next_;
}
}
-void ThreadRegistry::ReleaseMarkingStacks(Isolate* isolate_of_interest) {
+void ThreadRegistry::ReleaseMarkingStacks() {
MonitorLocker ml(threads_lock());
Thread* thread = active_list_;
while (thread != NULL) {
- if (thread->isolate() == isolate_of_interest) {
- if (!thread->BypassSafepoints()) {
- thread->MarkingStackRelease();
- thread->DeferredMarkingStackRelease();
- }
+ if (!thread->BypassSafepoints()) {
+ thread->MarkingStackRelease();
+ thread->DeferredMarkingStackRelease();
+ ASSERT(!thread->is_marking());
}
thread = thread->next_;
}
diff --git a/runtime/vm/thread_registry.h b/runtime/vm/thread_registry.h
index a9059a5..d8dc02e 100644
--- a/runtime/vm/thread_registry.h
+++ b/runtime/vm/thread_registry.h
@@ -25,13 +25,13 @@
ThreadRegistry() : threads_lock_(), active_list_(NULL), free_list_(NULL) {}
~ThreadRegistry();
- void VisitObjectPointers(Isolate* isolate_of_interest,
+ void VisitObjectPointers(IsolateGroup* isolate_group_of_interest,
ObjectPointerVisitor* visitor,
ValidationPolicy validate_frames);
- void ReleaseStoreBuffers(Isolate* isolate_of_interest);
- void AcquireMarkingStacks(Isolate* isolate_of_interest);
- void ReleaseMarkingStacks(Isolate* isolate_of_interest);
+ void ReleaseStoreBuffers();
+ void AcquireMarkingStacks();
+ void ReleaseMarkingStacks();
#ifndef PRODUCT
void PrintJSON(JSONStream* stream) const;
diff --git a/runtime/vm/thread_stack_resource.cc b/runtime/vm/thread_stack_resource.cc
index 69faf94..8f1dd90 100644
--- a/runtime/vm/thread_stack_resource.cc
+++ b/runtime/vm/thread_stack_resource.cc
@@ -23,4 +23,8 @@
return thread()->isolate();
}
+IsolateGroup* ThreadStackResource::isolate_group() const {
+ return thread()->isolate_group();
+}
+
} // namespace dart
diff --git a/runtime/vm/thread_stack_resource.h b/runtime/vm/thread_stack_resource.h
index abbf521..fa9dd31 100644
--- a/runtime/vm/thread_stack_resource.h
+++ b/runtime/vm/thread_stack_resource.h
@@ -11,6 +11,7 @@
namespace dart {
class Isolate;
+class IsolateGroup;
class ThreadState;
class Thread;
@@ -25,6 +26,7 @@
return reinterpret_cast<Thread*>(StackResource::thread());
}
Isolate* isolate() const;
+ IsolateGroup* isolate_group() const;
};
} // namespace dart
diff --git a/runtime/vm/thread_test.cc b/runtime/vm/thread_test.cc
index b11f669..748103e 100644
--- a/runtime/vm/thread_test.cc
+++ b/runtime/vm/thread_test.cc
@@ -82,8 +82,8 @@
class ObjectCounter : public ObjectPointerVisitor {
public:
- explicit ObjectCounter(Isolate* isolate, const Object* obj)
- : ObjectPointerVisitor(isolate), obj_(obj), count_(0) {}
+ explicit ObjectCounter(IsolateGroup* isolate_group, const Object* obj)
+ : ObjectPointerVisitor(isolate_group), obj_(obj), count_(0) {}
virtual void VisitPointers(RawObject** first, RawObject** last) {
for (RawObject** current = first; current <= last; ++current) {
@@ -131,7 +131,7 @@
EXPECT(smi.Value() == unique_smi);
{
HeapIterationScope iteration(thread);
- ObjectCounter counter(isolate_, &smi);
+ ObjectCounter counter(isolate_->group(), &smi);
// Ensure that our particular zone is visited.
iteration.IterateStackPointers(&counter,
ValidationPolicy::kValidateFrames);
@@ -148,7 +148,7 @@
EXPECT(unique_str.Equals(unique_chars));
{
HeapIterationScope iteration(thread);
- ObjectCounter str_counter(isolate_, &unique_str);
+ ObjectCounter str_counter(isolate_->group(), &unique_str);
// Ensure that our particular zone is visited.
iteration.IterateStackPointers(&str_counter,
ValidationPolicy::kValidateFrames);
@@ -568,7 +568,7 @@
// But occasionally, organize a rendezvous.
HeapIterationScope iteration(thread); // Establishes a safepoint.
ASSERT(thread->IsAtSafepoint());
- ObjectCounter counter(isolate_, &smi);
+ ObjectCounter counter(isolate_->group(), &smi);
iteration.IterateStackPointers(&counter,
ValidationPolicy::kValidateFrames);
{
diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc
index d2e88e4..48d4884 100644
--- a/runtime/vm/timeline.cc
+++ b/runtime/vm/timeline.cc
@@ -395,7 +395,8 @@
label_(NULL),
stream_(NULL),
thread_(OSThread::kInvalidThreadId),
- isolate_id_(ILLEGAL_PORT) {}
+ isolate_id_(ILLEGAL_PORT),
+ isolate_group_id_(0) {}
TimelineEvent::~TimelineEvent() {
Reset();
@@ -408,6 +409,7 @@
state_ = 0;
thread_ = OSThread::kInvalidThreadId;
isolate_id_ = ILLEGAL_PORT;
+ isolate_group_id_ = 0;
stream_ = NULL;
label_ = NULL;
arguments_.Free();
@@ -560,12 +562,11 @@
OSThread* os_thread = OSThread::Current();
ASSERT(os_thread != NULL);
thread_ = os_thread->trace_id();
- Isolate* isolate = Isolate::Current();
- if (isolate != NULL) {
- isolate_id_ = isolate->main_port();
- } else {
- isolate_id_ = ILLEGAL_PORT;
- }
+ auto thread = Thread::Current();
+ auto isolate = thread != nullptr ? thread->isolate() : nullptr;
+ auto isolate_group = thread != nullptr ? thread->isolate_group() : nullptr;
+ isolate_id_ = (isolate != nullptr) ? isolate->main_port() : ILLEGAL_PORT;
+ isolate_group_id_ = (isolate_group != nullptr) ? isolate_group->id() : 0;
label_ = label;
arguments_.Free();
set_event_type(event_type);
@@ -664,12 +665,20 @@
ASSERT(arguments_.length() == 1);
stream->AppendSerializedObject("args", arguments_[0].value);
if (isolate_id_ != ILLEGAL_PORT) {
- // If we have one, append the isolate id.
stream->UncloseObject();
stream->PrintfProperty("isolateId", ISOLATE_SERVICE_ID_FORMAT_STRING,
static_cast<int64_t>(isolate_id_));
stream->CloseObject();
}
+ if (isolate_group_id_ != 0) {
+ stream->UncloseObject();
+ stream->PrintfProperty("isolateGroupId",
+ ISOLATE_GROUP_SERVICE_ID_FORMAT_STRING,
+ isolate_group_id_);
+ stream->CloseObject();
+ } else {
+ ASSERT(isolate_group_id_ == ILLEGAL_PORT);
+ }
} else {
JSONObject args(&obj, "args");
for (intptr_t i = 0; i < arguments_.length(); i++) {
@@ -677,10 +686,16 @@
args.AddProperty(arg.name, arg.value);
}
if (isolate_id_ != ILLEGAL_PORT) {
- // If we have one, append the isolate id.
args.AddPropertyF("isolateId", ISOLATE_SERVICE_ID_FORMAT_STRING,
static_cast<int64_t>(isolate_id_));
}
+ if (isolate_group_id_ != 0) {
+ args.AddPropertyF("isolateGroupId",
+ ISOLATE_GROUP_SERVICE_ID_FORMAT_STRING,
+ isolate_group_id_);
+ } else {
+ ASSERT(isolate_group_id_ == ILLEGAL_PORT);
+ }
}
}
#endif
diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h
index 0ecdefa..9849176 100644
--- a/runtime/vm/timeline.h
+++ b/runtime/vm/timeline.h
@@ -344,6 +344,8 @@
Dart_Port isolate_id() const { return isolate_id_; }
+ uint64_t isolate_group_id() const { return isolate_group_id_; }
+
const char* label() const { return label_; }
// Does this duration end before |micros| ?
@@ -460,6 +462,7 @@
TimelineStream* stream_;
ThreadId thread_;
Dart_Port isolate_id_;
+ uint64_t isolate_group_id_;
friend class TimelineEventRecorder;
friend class TimelineEventEndlessRecorder;
diff --git a/runtime/vm/type_testing_stubs.cc b/runtime/vm/type_testing_stubs.cc
index 56aa808..bd0a9c1 100644
--- a/runtime/vm/type_testing_stubs.cc
+++ b/runtime/vm/type_testing_stubs.cc
@@ -92,32 +92,33 @@
const AbstractType& type,
bool lazy_specialize /* = true */) {
if (type.IsTypeRef()) {
- return StubCode::DefaultTypeTest().raw();
+ return FLAG_null_safety ? StubCode::DefaultTypeTest().raw()
+ : StubCode::DefaultNullableTypeTest().raw();
}
- const intptr_t cid = type.type_class_id();
// During bootstrapping we have no access to stubs yet, so we'll just return
// `null` and patch these later in `Object::FinishInit()`.
if (!StubCode::HasBeenInitialized()) {
ASSERT(type.IsType());
+ const classid_t cid = type.type_class_id();
ASSERT(cid == kDynamicCid || cid == kVoidCid || cid == kNeverCid);
return Code::null();
}
- if (cid == kDynamicCid || cid == kVoidCid ||
- (cid == kInstanceCid &&
- (!FLAG_strong_non_nullable_type_checks || !type.IsNonNullable()))) {
+ if (type.IsTopTypeForAssignability()) {
return StubCode::TopTypeTypeTest().raw();
}
if (type.IsType() || type.IsTypeParameter()) {
- // TODO(dartbug.com/38845): Add support for specialized TTS for
- // nullable and non-nullable types in NNBD strong mode.
- const bool should_specialize =
- !FLAG_precompiled_mode && lazy_specialize &&
- (type.IsLegacy() || !FLAG_strong_non_nullable_type_checks);
- return should_specialize ? StubCode::LazySpecializeTypeTest().raw()
- : StubCode::DefaultTypeTest().raw();
+ const bool should_specialize = !FLAG_precompiled_mode && lazy_specialize;
+ const bool nullable = Instance::NullIsAssignableTo(type);
+ if (should_specialize) {
+ return nullable ? StubCode::LazySpecializeNullableTypeTest().raw()
+ : StubCode::LazySpecializeTypeTest().raw();
+ } else {
+ return nullable ? StubCode::DefaultNullableTypeTest().raw()
+ : StubCode::DefaultTypeTest().raw();
+ }
}
return StubCode::UnreachableTypeTest().raw();
@@ -147,8 +148,7 @@
type, /*lazy_specialize=*/false);
}
- const intptr_t cid = type.type_class_id();
- if (cid == kDynamicCid || cid == kVoidCid || cid == kInstanceCid) {
+ if (type.IsTopTypeForAssignability()) {
return StubCode::TopTypeTypeTest().raw();
}
@@ -241,7 +241,7 @@
Register instance_reg,
Register class_id_reg) {
// These are handled via the TopTypeTypeTestStub!
- ASSERT(!(type.IsDynamicType() || type.IsVoidType() || type.IsObjectType()));
+ ASSERT(!type.IsTopTypeForAssignability());
// Fast case for 'int'.
if (type.IsIntType()) {
@@ -263,10 +263,10 @@
// Check the cid ranges which are a subtype of [type].
if (hi->CanUseSubtypeRangeCheckFor(type)) {
- const CidRangeVector& ranges =
- hi->SubtypeRangesForClass(type_class,
- /*include_abstract=*/false,
- /*exclude_null=*/false);
+ const CidRangeVector& ranges = hi->SubtypeRangesForClass(
+ type_class,
+ /*include_abstract=*/false,
+ /*exclude_null=*/!Instance::NullIsAssignableTo(type));
const Type& int_type = Type::Handle(Type::IntType());
const bool smi_is_ok =
@@ -287,16 +287,18 @@
const TypeArguments& ta = TypeArguments::Handle(type.arguments());
ASSERT(ta.Length() == num_type_arguments);
- BuildOptimizedSubclassRangeCheckWithTypeArguments(assembler, hi, type_class,
- tp, ta);
+ BuildOptimizedSubclassRangeCheckWithTypeArguments(assembler, hi, type,
+ type_class, tp, ta);
}
- // Fast case for 'null'.
- compiler::Label non_null;
- __ CompareObject(instance_reg, Object::null_object());
- __ BranchIf(NOT_EQUAL, &non_null);
- __ Ret();
- __ Bind(&non_null);
+ if (Instance::NullIsAssignableTo(type)) {
+ // Fast case for 'null'.
+ compiler::Label non_null;
+ __ CompareObject(instance_reg, Object::null_object());
+ __ BranchIf(NOT_EQUAL, &non_null);
+ __ Ret();
+ __ Bind(&non_null);
+ }
}
void TypeTestingStubGenerator::BuildOptimizedSubtypeRangeCheck(
@@ -325,6 +327,7 @@
BuildOptimizedSubclassRangeCheckWithTypeArguments(
compiler::Assembler* assembler,
HierarchyInfo* hi,
+ const Type& type,
const Class& type_class,
const TypeArguments& tp,
const TypeArguments& ta,
@@ -353,11 +356,16 @@
// TODO(kustermann): We could consider not using "null" as type argument
// vector representing all-dynamic to avoid this extra check (which will be
// uncommon because most Dart code in 2.0 will be strongly typed)!
- compiler::Label process_done;
__ CompareObject(instance_type_args_reg, Object::null_object());
- __ BranchIf(NOT_EQUAL, &process_done);
- __ Ret();
- __ Bind(&process_done);
+ const Type& rare_type = Type::Handle(Type::RawCast(type_class.RareType()));
+ if (rare_type.IsSubtypeOf(NNBDMode::kLegacyLib, type, Heap::kNew)) {
+ compiler::Label process_done;
+ __ BranchIf(NOT_EQUAL, &process_done);
+ __ Ret();
+ __ Bind(&process_done);
+ } else {
+ __ BranchIf(EQUAL, &check_failed);
+ }
// c) Then we'll check each value of the type argument.
AbstractType& type_arg = AbstractType::Handle();
@@ -395,6 +403,8 @@
__ Bind(&is_subtype);
}
+// Generate code to verify that instance's type argument is a subtype of
+// 'type_arg'.
void TypeTestingStubGenerator::BuildOptimizedTypeArgumentValueCheck(
compiler::Assembler* assembler,
HierarchyInfo* hi,
@@ -406,20 +416,64 @@
const Register function_type_args_reg,
const Register own_type_arg_reg,
compiler::Label* check_failed) {
- const intptr_t cid = type_arg.type_class_id();
- if (!(cid == kDynamicCid || cid == kVoidCid || cid == kInstanceCid)) {
- // TODO(kustermann): Even though it should be safe to use TMP here, we
- // should avoid using TMP outside the assembler. Try to find a free
- // register to use here!
- __ LoadField(TMP, compiler::FieldAddress(
- instance_type_args_reg,
- compiler::target::TypeArguments::type_at_offset(
- type_param_value_offset_i)));
- __ LoadField(class_id_reg,
- compiler::FieldAddress(
- TMP, compiler::target::Type::type_class_id_offset()));
+ if (type_arg.IsTopType()) {
+ return;
+ }
+ // TODO(dartbug.com/40736): Even though it should be safe to use TMP here,
+ // we should avoid using TMP outside the assembler. Try to find a free
+ // register to use here!
+ __ LoadField(TMP, compiler::FieldAddress(
+ instance_type_args_reg,
+ compiler::target::TypeArguments::type_at_offset(
+ type_param_value_offset_i)));
+ __ LoadField(class_id_reg,
+ compiler::FieldAddress(
+ TMP, compiler::target::Type::type_class_id_offset()));
- if (type_arg.IsTypeParameter()) {
+ if (type_arg.IsTypeParameter()) {
+ const TypeParameter& type_param = TypeParameter::Cast(type_arg);
+ const Register kTypeArgumentsReg = type_param.IsClassTypeParameter()
+ ? instantiator_type_args_reg
+ : function_type_args_reg;
+ __ LoadField(
+ own_type_arg_reg,
+ compiler::FieldAddress(kTypeArgumentsReg,
+ compiler::target::TypeArguments::type_at_offset(
+ type_param.index())));
+ __ CompareWithFieldValue(
+ class_id_reg,
+ compiler::FieldAddress(own_type_arg_reg,
+ compiler::target::Type::type_class_id_offset()));
+ __ BranchIf(NOT_EQUAL, check_failed);
+ } else {
+ const Class& type_class = Class::Handle(type_arg.type_class());
+ const CidRangeVector& ranges = hi->SubtypeRangesForClass(
+ type_class,
+ /*include_abstract=*/true,
+ /*exclude_null=*/!Instance::NullIsAssignableTo(type_arg));
+
+ compiler::Label is_subtype;
+ __ SmiUntag(class_id_reg);
+ FlowGraphCompiler::GenerateCidRangesCheck(assembler, class_id_reg, ranges,
+ &is_subtype, check_failed, true);
+ __ Bind(&is_subtype);
+ }
+
+ // Weak NNBD mode uses LEGACY_SUBTYPE which ignores nullability.
+ // We don't need to check nullability of LHS for nullable and legacy RHS
+ // ("Right Legacy", "Right Nullable" rules).
+ if (FLAG_null_safety && !type_arg.IsNullable() && !type_arg.IsLegacy()) {
+ ASSERT((type_arg.IsTypeParameter() && type_arg.IsUndetermined()) ||
+ type_arg.IsNonNullable());
+
+ compiler::Label skip_nullable_check;
+ if (type_arg.IsUndetermined()) {
+ ASSERT(type_arg.IsTypeParameter());
+ // Skip the nullability check if actual RHS is nullable or legacy.
+ // TODO(dartbug.com/40736): Allocate register for own_type_arg_reg
+ // which is not clobbered and avoid reloading own_type_arg_reg.
+ // Currently own_type_arg_reg == TMP on certain
+ // architectures and it is clobbered by CompareWithFieldValue.
const TypeParameter& type_param = TypeParameter::Cast(type_arg);
const Register kTypeArgumentsReg = type_param.IsClassTypeParameter()
? instantiator_type_args_reg
@@ -429,23 +483,26 @@
kTypeArgumentsReg,
compiler::target::TypeArguments::type_at_offset(
type_param.index())));
- __ CompareWithFieldValue(
- class_id_reg, compiler::FieldAddress(
- own_type_arg_reg,
- compiler::target::Type::type_class_id_offset()));
- __ BranchIf(NOT_EQUAL, check_failed);
- } else {
- const Class& type_class = Class::Handle(type_arg.type_class());
- const CidRangeVector& ranges =
- hi->SubtypeRangesForClass(type_class,
- /*include_abstract=*/true,
- /*exclude_null=*/false);
+ __ CompareTypeNullabilityWith(
+ own_type_arg_reg, compiler::target::Nullability::kNonNullable);
+ __ BranchIf(NOT_EQUAL, &skip_nullable_check);
+ }
- compiler::Label is_subtype;
- __ SmiUntag(class_id_reg);
- FlowGraphCompiler::GenerateCidRangesCheck(
- assembler, class_id_reg, ranges, &is_subtype, check_failed, true);
- __ Bind(&is_subtype);
+ // Nullable type is not a subtype of non-nullable type.
+ // TODO(dartbug.com/40736): allocate a register for instance type argument
+ // and avoid reloading it. Note that class_id_reg == TMP on certain
+ // architectures.
+ __ LoadField(
+ class_id_reg,
+ compiler::FieldAddress(instance_type_args_reg,
+ compiler::target::TypeArguments::type_at_offset(
+ type_param_value_offset_i)));
+ __ CompareTypeNullabilityWith(class_id_reg,
+ compiler::target::Nullability::kNullable);
+ __ BranchIf(EQUAL, check_failed);
+
+ if (type_arg.IsUndetermined()) {
+ __ Bind(&skip_nullable_check);
}
}
}
diff --git a/runtime/vm/type_testing_stubs.h b/runtime/vm/type_testing_stubs.h
index 65c9bd2..c7274c1 100644
--- a/runtime/vm/type_testing_stubs.h
+++ b/runtime/vm/type_testing_stubs.h
@@ -76,6 +76,7 @@
static void BuildOptimizedSubclassRangeCheckWithTypeArguments(
compiler::Assembler* assembler,
HierarchyInfo* hi,
+ const Type& type,
const Class& type_class,
const TypeArguments& type_parameters,
const TypeArguments& type_arguments);
@@ -83,6 +84,7 @@
static void BuildOptimizedSubclassRangeCheckWithTypeArguments(
compiler::Assembler* assembler,
HierarchyInfo* hi,
+ const Type& type,
const Class& type_class,
const TypeArguments& type_parameters,
const TypeArguments& type_arguments,
diff --git a/runtime/vm/type_testing_stubs_arm.cc b/runtime/vm/type_testing_stubs_arm.cc
index 345e3fb..8e49e28 100644
--- a/runtime/vm/type_testing_stubs_arm.cc
+++ b/runtime/vm/type_testing_stubs_arm.cc
@@ -34,15 +34,16 @@
BuildOptimizedSubclassRangeCheckWithTypeArguments(
compiler::Assembler* assembler,
HierarchyInfo* hi,
+ const Type& type,
const Class& type_class,
const TypeArguments& tp,
const TypeArguments& ta) {
const Register kInstanceReg = R0;
- const Register kInstanceTypeArguments = NOTFP;
+ const Register kInstanceTypeArguments = R4;
const Register kClassIdReg = R9;
BuildOptimizedSubclassRangeCheckWithTypeArguments(
- assembler, hi, type_class, tp, ta, kClassIdReg, kInstanceReg,
+ assembler, hi, type, type_class, tp, ta, kClassIdReg, kInstanceReg,
kInstanceTypeArguments);
}
@@ -54,7 +55,7 @@
compiler::Label* check_failed) {
const Register kInstantiatorTypeArgumentsReg = R2;
const Register kFunctionTypeArgumentsReg = R1;
- const Register kInstanceTypeArguments = NOTFP;
+ const Register kInstanceTypeArguments = R4;
const Register kClassIdReg = R9;
const Register kOwnTypeArgumentValue = TMP;
diff --git a/runtime/vm/type_testing_stubs_arm64.cc b/runtime/vm/type_testing_stubs_arm64.cc
index 4105fbd1..3e04361 100644
--- a/runtime/vm/type_testing_stubs_arm64.cc
+++ b/runtime/vm/type_testing_stubs_arm64.cc
@@ -33,6 +33,7 @@
BuildOptimizedSubclassRangeCheckWithTypeArguments(
compiler::Assembler* assembler,
HierarchyInfo* hi,
+ const Type& type,
const Class& type_class,
const TypeArguments& tp,
const TypeArguments& ta) {
@@ -41,7 +42,7 @@
const Register kClassIdReg = R9;
BuildOptimizedSubclassRangeCheckWithTypeArguments(
- assembler, hi, type_class, tp, ta, kClassIdReg, kInstanceReg,
+ assembler, hi, type, type_class, tp, ta, kClassIdReg, kInstanceReg,
kInstanceTypeArguments);
}
diff --git a/runtime/vm/type_testing_stubs_x64.cc b/runtime/vm/type_testing_stubs_x64.cc
index 6b13861..516c90a 100644
--- a/runtime/vm/type_testing_stubs_x64.cc
+++ b/runtime/vm/type_testing_stubs_x64.cc
@@ -32,6 +32,7 @@
BuildOptimizedSubclassRangeCheckWithTypeArguments(
compiler::Assembler* assembler,
HierarchyInfo* hi,
+ const Type& type,
const Class& type_class,
const TypeArguments& tp,
const TypeArguments& ta) {
@@ -40,7 +41,7 @@
const Register kClassIdReg = TMP;
BuildOptimizedSubclassRangeCheckWithTypeArguments(
- assembler, hi, type_class, tp, ta, kClassIdReg, kInstanceReg,
+ assembler, hi, type, type_class, tp, ta, kClassIdReg, kInstanceReg,
kInstanceTypeArguments);
}
diff --git a/runtime/vm/v8_snapshot_writer.cc b/runtime/vm/v8_snapshot_writer.cc
index 9c04c5a..1a79e0c 100644
--- a/runtime/vm/v8_snapshot_writer.cc
+++ b/runtime/vm/v8_snapshot_writer.cc
@@ -134,7 +134,8 @@
writer->PrintNewline();
}
-void V8SnapshotProfileWriter::AddRoot(ObjectId object_id) {
+void V8SnapshotProfileWriter::AddRoot(ObjectId object_id,
+ const char* name /*= nullptr*/) {
EnsureId(object_id);
// HeapSnapshotWorker.HeapSnapshot.calculateDistances (from HeapSnapshot.js)
// assumes that the root does not have more than one edge to any other node
@@ -143,7 +144,8 @@
ObjectIdToNodeInfoTraits::Pair pair;
pair.key = object_id;
- pair.value = NodeInfo{0, 0, object_id, 0, nullptr, 0};
+ pair.value = NodeInfo{
+ 0, name != nullptr ? EnsureString(name) : -1, object_id, 0, nullptr, 0};
roots_.Insert(pair);
}
@@ -239,7 +241,11 @@
ObjectIdToNodeInfoTraits::Pair* entry = nullptr;
auto roots_it = roots_.GetIterator();
for (int i = 0; (entry = roots_it.Next()) != nullptr; ++i) {
- WriteEdgeInfo(writer, {kInternal, i, entry->key});
+ if (entry->value.name != -1) {
+ WriteEdgeInfo(writer, {kProperty, entry->value.name, entry->key});
+ } else {
+ WriteEdgeInfo(writer, {kInternal, i, entry->key});
+ }
}
auto nodes_it = nodes_.GetIterator();
diff --git a/runtime/vm/v8_snapshot_writer.h b/runtime/vm/v8_snapshot_writer.h
index b3e5e09..98f19ed 100644
--- a/runtime/vm/v8_snapshot_writer.h
+++ b/runtime/vm/v8_snapshot_writer.h
@@ -73,7 +73,7 @@
const char* name) {}
void AttributeBytesTo(ObjectId object_id, size_t num_bytes) {}
void AttributeReferenceTo(ObjectId object_id, Reference reference) {}
- void AddRoot(ObjectId object_id) {}
+ void AddRoot(ObjectId object_id, const char* name = nullptr) {}
intptr_t EnsureString(const char* str) { return 0; }
#else
explicit V8SnapshotProfileWriter(Zone* zone);
@@ -98,7 +98,7 @@
// Marks an object as being a root in the graph. Used for analysis of the
// graph.
- void AddRoot(ObjectId object_id);
+ void AddRoot(ObjectId object_id, const char* name = nullptr);
// Write to a file in the V8 Snapshot Profile (JSON/.heapsnapshot) format.
void Write(const char* file);
diff --git a/runtime/vm/virtual_memory_fuchsia.cc b/runtime/vm/virtual_memory_fuchsia.cc
index 4f2aa78..ec747b0 100644
--- a/runtime/vm/virtual_memory_fuchsia.cc
+++ b/runtime/vm/virtual_memory_fuchsia.cc
@@ -183,7 +183,8 @@
void VirtualMemory::Protect(void* address, intptr_t size, Protection mode) {
#if defined(DEBUG)
Thread* thread = Thread::Current();
- ASSERT((thread == nullptr) || thread->IsMutatorThread() ||
+ ASSERT(thread == nullptr || thread->IsMutatorThread() ||
+ thread->isolate() == nullptr ||
thread->isolate()->mutator_thread()->IsAtSafepoint());
#endif
const uword start_address = reinterpret_cast<uword>(address);
diff --git a/runtime/vm/virtual_memory_posix.cc b/runtime/vm/virtual_memory_posix.cc
index 1c1c5e1..7010b26 100644
--- a/runtime/vm/virtual_memory_posix.cc
+++ b/runtime/vm/virtual_memory_posix.cc
@@ -288,7 +288,8 @@
void VirtualMemory::Protect(void* address, intptr_t size, Protection mode) {
#if defined(DEBUG)
Thread* thread = Thread::Current();
- ASSERT((thread == nullptr) || thread->IsMutatorThread() ||
+ ASSERT(thread == nullptr || thread->IsMutatorThread() ||
+ thread->isolate() == nullptr ||
thread->isolate()->mutator_thread()->IsAtSafepoint());
#endif
uword start_address = reinterpret_cast<uword>(address);
diff --git a/runtime/vm/virtual_memory_win.cc b/runtime/vm/virtual_memory_win.cc
index d52ea07..fd7c5d1 100644
--- a/runtime/vm/virtual_memory_win.cc
+++ b/runtime/vm/virtual_memory_win.cc
@@ -90,7 +90,8 @@
void VirtualMemory::Protect(void* address, intptr_t size, Protection mode) {
#if defined(DEBUG)
Thread* thread = Thread::Current();
- ASSERT((thread == nullptr) || thread->IsMutatorThread() ||
+ ASSERT(thread == nullptr || thread->IsMutatorThread() ||
+ thread->isolate() == nullptr ||
thread->isolate()->mutator_thread()->IsAtSafepoint());
#endif
uword start_address = reinterpret_cast<uword>(address);
diff --git a/runtime/vm/visitor.cc b/runtime/vm/visitor.cc
index 0fd28d4..8274cc8 100644
--- a/runtime/vm/visitor.cc
+++ b/runtime/vm/visitor.cc
@@ -8,9 +8,9 @@
namespace dart {
-ObjectPointerVisitor::ObjectPointerVisitor(Isolate* isolate)
- : isolate_(isolate),
+ObjectPointerVisitor::ObjectPointerVisitor(IsolateGroup* isolate_group)
+ : isolate_group_(isolate_group),
gc_root_type_("unknown"),
- shared_class_table_(isolate->shared_class_table()) {}
+ shared_class_table_(isolate_group->class_table()) {}
} // namespace dart
diff --git a/runtime/vm/visitor.h b/runtime/vm/visitor.h
index 9d5bf75..2dd68f4 100644
--- a/runtime/vm/visitor.h
+++ b/runtime/vm/visitor.h
@@ -14,6 +14,7 @@
// Forward declarations.
class Isolate;
+class IsolateGroup;
class RawObject;
class RawFunction;
class RawTypedDataView;
@@ -21,10 +22,10 @@
// An object pointer visitor interface.
class ObjectPointerVisitor {
public:
- explicit ObjectPointerVisitor(Isolate* isolate);
+ explicit ObjectPointerVisitor(IsolateGroup* isolate_group);
virtual ~ObjectPointerVisitor() {}
- Isolate* isolate() const { return isolate_; }
+ IsolateGroup* isolate_group() const { return isolate_group_; }
// Visit pointers inside the given typed data [view].
//
@@ -59,7 +60,7 @@
}
private:
- Isolate* isolate_;
+ IsolateGroup* isolate_group_;
const char* gc_root_type_;
SharedClassTable* shared_class_table_;
diff --git a/samples/ffi/async/sample_async_callback.dart b/samples/ffi/async/sample_async_callback.dart
index ac52326..697693b 100644
--- a/samples/ffi/async/sample_async_callback.dart
+++ b/samples/ffi/async/sample_async_callback.dart
@@ -7,8 +7,6 @@
// main Dart thread.
//
// TODO(dartbug.com/37022): Update this when we get real async callbacks.
-// TODO(dartbug.com/40564): On Windows DLL is wrongly linked against dart.exe
-// instead of dart_precompiled_runtime.exe
import 'dart:ffi';
import 'dart:isolate';
@@ -28,8 +26,9 @@
print("C T2 = Some C thread executing C.");
print("C = C T1 or C T2.");
print("Dart: Setup.");
- final interactiveCppRequests = ReceivePort()..listen(requestExecuteCallback);
+ registerDart_PostCObject(NativeApi.nativeApiPostCObject);
+ final interactiveCppRequests = ReceivePort()..listen(requestExecuteCallback);
final int nativePort = interactiveCppRequests.sendPort.nativePort;
registerCallback1(nativePort, callback1FP);
registerCallback2(nativePort, callback2FP);
@@ -102,6 +101,14 @@
final executeCallback = dl.lookupFunction<Void Function(Pointer<Work>),
void Function(Pointer<Work>)>('ExecuteCallback');
+final registerDart_PostCObject = dl.lookupFunction<
+ Void Function(
+ Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
+ functionPointer),
+ void Function(
+ Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
+ functionPointer)>('RegisterDart_PostCObject');
+
class Work extends Struct {}
Future asyncSleep(int ms) {
diff --git a/samples/ffi/async/sample_native_port_call.dart b/samples/ffi/async/sample_native_port_call.dart
index 87958e9..661d509 100644
--- a/samples/ffi/async/sample_native_port_call.dart
+++ b/samples/ffi/async/sample_native_port_call.dart
@@ -35,6 +35,10 @@
print("C T2 = Some C thread executing C.");
print("C = C T1 or C T2.");
print("Dart: Setup.");
+ registerDart_PostCObject(NativeApi.nativeApiPostCObject);
+ registerDart_NewNativePort(NativeApi.nativeApiNewNativePort);
+ registerDart_CloseNativePort(NativeApi.nativeApiCloseNativePort);
+
final interactiveCppRequests = ReceivePort()..listen(handleCppRequests);
final int nativePort = interactiveCppRequests.sendPort.nativePort;
registerSendPort(nativePort);
@@ -126,6 +130,39 @@
final stopWorkSimulator2 =
dl.lookupFunction<Void Function(), void Function()>('StopWorkSimulator2');
+final registerDart_PostCObject = dl.lookupFunction<
+ Void Function(
+ Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
+ functionPointer),
+ void Function(
+ Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
+ functionPointer)>('RegisterDart_PostCObject');
+
+final registerDart_NewNativePort = dl.lookupFunction<
+ Void Function(
+ Pointer<
+ NativeFunction<
+ Int64 Function(
+ Pointer<Uint8>,
+ Pointer<NativeFunction<Dart_NativeMessageHandler>>,
+ Int8)>>
+ functionPointer),
+ void Function(
+ Pointer<
+ NativeFunction<
+ Int64 Function(
+ Pointer<Uint8>,
+ Pointer<NativeFunction<Dart_NativeMessageHandler>>,
+ Int8)>>
+ functionPointer)>('RegisterDart_NewNativePort');
+
+final registerDart_CloseNativePort = dl.lookupFunction<
+ Void Function(
+ Pointer<NativeFunction<Int8 Function(Int64)>> functionPointer),
+ void Function(
+ Pointer<NativeFunction<Int8 Function(Int64)>> functionPointer)>(
+ 'RegisterDart_CloseNativePort');
+
Future asyncSleep(int ms) {
return new Future.delayed(Duration(milliseconds: ms), () => true);
}
diff --git a/samples/samples.status b/samples/samples.status
index 1c99182..2fe1de2 100644
--- a/samples/samples.status
+++ b/samples/samples.status
@@ -14,9 +14,6 @@
[ $compiler == dart2js && $runtime == none ]
*: Fail, Pass # TODO(ahe): Triage these tests.
-[ $compiler == dartkp && $system == windows ]
-ffi/async/async_test: Skip # dartbug.com/40564 dartbug.com/40579
-
[ $compiler == none && $mode == debug && $runtime == vm && $system == windows ]
sample_extension/test/sample_extension_app_snapshot_test: Pass, RuntimeError # Issue 28842
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 49377f6..b343437 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -49,6 +49,7 @@
# ........analysis_server.dart.snapshot
# ........dart2js.dart.snapshot
# ........dartanalyzer.dart.snapshot
+# ........dartdev.dart.snapshot
# ........dartdoc.dart.snapshot
# ........dartfmt.dart.snapshot
# ........dartdevc.dart.snapshot
@@ -123,6 +124,10 @@
"../utils/dartanalyzer:generate_dartanalyzer_snapshot",
],
[
+ "dartdev",
+ "../utils/dartdev",
+ ],
+ [
"dartdoc",
"../utils/dartdoc",
],
@@ -164,6 +169,10 @@
"../utils/dartanalyzer:generate_dartanalyzer_snapshot",
],
[
+ "dartdev",
+ "../utils/dartdev",
+ ],
+ [
"dartdevc",
"../utils/dartdevc",
],
@@ -306,9 +315,7 @@
{
target = "copy_7zip"
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
+ deps = [ ":copy_libraries" ]
source = "../third_party/7zip"
dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset/7zip"
ignore_patterns = ".svn"
@@ -321,9 +328,7 @@
{
target = "copy_language_model"
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
+ deps = [ ":copy_libraries" ]
source = "../pkg/analysis_server/language_model"
dest = "$root_out_dir/dart-sdk/bin/model"
ignore_patterns = "{}"
@@ -334,9 +339,7 @@
{
target = "copy_libtensorflowlite_c"
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
+ deps = [ ":copy_libraries" ]
source = "../third_party/pkg/tflite_native/lib/src/blobs"
dest = "$root_out_dir/dart-sdk/bin/snapshots"
ignore_patterns = "*.dll,*mac64.so"
@@ -348,9 +351,7 @@
{
target = "copy_libtensorflowlite_c"
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
+ deps = [ ":copy_libraries" ]
source = "../third_party/pkg/tflite_native/lib/src/blobs"
dest = "$root_out_dir/dart-sdk/bin/snapshots"
ignore_patterns = "*.dll,*linux64.so"
@@ -362,9 +363,7 @@
{
target = "copy_libtensorflowlite_c"
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
+ deps = [ ":copy_libraries" ]
source = "../third_party/pkg/tflite_native/lib/src/blobs"
dest = "$root_out_dir/dart-sdk/bin/snapshots"
ignore_patterns = "*.so"
@@ -396,16 +395,10 @@
action("copy_dart") {
visibility = [ ":create_common_sdk" ]
dart_label = "../runtime/bin:dart"
- deps = [
- dart_label,
- ]
+ deps = [ dart_label ]
dart_out = get_label_info(dart_label, "root_out_dir")
- sources = [
- "$dart_out/$dart_stripped_binary",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/$dart_stripped_binary",
- ]
+ sources = [ "$dart_out/$dart_stripped_binary" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/$dart_stripped_binary" ]
script = "/bin/ln"
args = [
"-snf",
@@ -416,69 +409,44 @@
} else {
copy("copy_dart") {
visibility = [ ":create_common_sdk" ]
- deps = [
- "../runtime/bin:dart",
- ]
+ deps = [ "../runtime/bin:dart" ]
dart_out = get_label_info("../runtime/bin:dart", "root_out_dir")
if (is_win) {
- sources = [
- "$dart_out/dart.exe",
- ]
+ sources = [ "$dart_out/dart.exe" ]
} else {
- sources = [
- "$dart_out/$dart_stripped_binary",
- ]
+ sources = [ "$dart_out/$dart_stripped_binary" ]
}
if (is_win) {
sources += [ "$dart_out/dart.lib" ]
}
- outputs = [
- "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
- ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/{{source_file_part}}" ]
}
}
copy("copy_dartaotruntime") {
- deps = [
- "../runtime/bin:dart_precompiled_runtime",
- ]
+ deps = [ "../runtime/bin:dart_precompiled_runtime" ]
dartaotruntime_out =
get_label_info("../runtime/bin:dart_precompiled_runtime", "root_out_dir")
if (is_win) {
- sources = [
- "$dartaotruntime_out/dart_precompiled_runtime.exe",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/dartaotruntime.exe",
- ]
+ sources = [ "$dartaotruntime_out/dart_precompiled_runtime.exe" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/dartaotruntime.exe" ]
} else {
- sources = [
- "$dartaotruntime_out/$dart_precompiled_runtime_stripped_binary",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/dartaotruntime",
- ]
+ sources =
+ [ "$dartaotruntime_out/$dart_precompiled_runtime_stripped_binary" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/dartaotruntime" ]
}
}
copy("copy_gen_snapshot") {
- deps = [
- "../runtime/bin:gen_snapshot",
- ]
+ deps = [ "../runtime/bin:gen_snapshot" ]
gen_snapshot_out =
get_label_info("../runtime/bin:gen_snapshot", "root_out_dir")
if (is_win) {
- sources = [
- "$gen_snapshot_out/gen_snapshot.exe",
- ]
+ sources = [ "$gen_snapshot_out/gen_snapshot.exe" ]
} else {
- sources = [
- "$gen_snapshot_out/$gen_snapshot_stripped_binary",
- ]
+ sources = [ "$gen_snapshot_out/$gen_snapshot_stripped_binary" ]
}
- outputs = [
- "$root_out_dir/dart-sdk/bin/utils/{{source_file_part}}",
- ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/utils/{{source_file_part}}" ]
}
copy("copy_dart2native") {
@@ -491,24 +459,14 @@
if (is_win) {
ext = ".bat"
}
- sources = [
- "bin/dart2native$ext",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
- ]
+ sources = [ "bin/dart2native$ext" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/{{source_file_part}}" ]
}
copy("copy_gen_kernel_snapshot") {
- deps = [
- "../utils/gen_kernel",
- ]
- sources = [
- "$root_gen_dir/gen_kernel.dart.snapshot",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}",
- ]
+ deps = [ "../utils/gen_kernel" ]
+ sources = [ "$root_gen_dir/gen_kernel.dart.snapshot" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}" ]
}
# A template for copying the things in _platform_sdk_scripts and
@@ -525,12 +483,8 @@
":copy_platform_sdk_scripts",
":copy_full_sdk_scripts",
]
- sources = [
- "bin/${name}_sdk$ext",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/$name$ext",
- ]
+ sources = [ "bin/${name}_sdk$ext" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/$name$ext" ]
}
}
@@ -550,12 +504,8 @@
if (is_win) {
ext = ".bat"
}
- sources = [
- "bin/$script$ext",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
- ]
+ sources = [ "bin/$script$ext" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/{{source_file_part}}" ]
}
}
@@ -597,15 +547,9 @@
":copy_platform_sdk_snapshots",
":copy_full_sdk_snapshots",
]
- deps = [
- snapshot[1],
- ]
- sources = [
- "$root/${snapshot[0]}.dart.snapshot",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}",
- ]
+ deps = [ snapshot[1] ]
+ sources = [ "$root/${snapshot[0]}.dart.snapshot" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}" ]
}
}
@@ -649,12 +593,8 @@
":copy_libraries",
"../utils/dartanalyzer:generate_summary_strong",
]
- sources = [
- "$root_gen_dir/strong.sum",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
- ]
+ sources = [ "$root_gen_dir/strong.sum" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}
# This rule copies dill files to lib/_internal.
@@ -664,22 +604,14 @@
":copy_libraries",
"../runtime/vm:kernel_platform_files",
]
- sources = [
- "$root_out_dir/vm_platform_strong.dill",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
- ]
+ sources = [ "$root_out_dir/vm_platform_strong.dill" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}
copy("copy_abi_dill_files") {
visibility = [ ":create_sdk_with_abi_versions" ]
- sources = [
- "../tools/abiversions",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/abiversions",
- ]
+ sources = [ "../tools/abiversions" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/abiversions" ]
}
copy("copy_dart2js_dill_files") {
@@ -693,9 +625,7 @@
"$root_out_dir/dart2js_platform.dill",
"$root_out_dir/dart2js_server_platform.dill",
]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
- ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}
# This rule copies ddc summaries to lib/_internal
@@ -705,20 +635,14 @@
":copy_libraries",
"../utils/dartdevc:dartdevc_platform",
]
- sources = [
- "$root_out_dir/ddc_sdk.dill",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
- ]
+ sources = [ "$root_out_dir/ddc_sdk.dill" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}
# This rule copies DDK's JS SDK and require.js to lib/dev_compiler/kernel/amd.
copy("copy_dev_compiler_js_amd_kernel") {
visibility = [ ":copy_dev_compiler_js" ]
- deps = [
- "../utils/dartdevc:dartdevc_kernel_sdk",
- ]
+ deps = [ "../utils/dartdevc:dartdevc_kernel_sdk" ]
gen_dir =
get_label_info("../utils/dartdevc:dartdevc_kernel_sdk", "target_gen_dir")
sources = [
@@ -734,9 +658,7 @@
# This rule copies DDK's JS SDK to lib/dev_compiler/kernel/common.
copy("copy_dev_compiler_js_common_kernel") {
visibility = [ ":copy_dev_compiler_js" ]
- deps = [
- "../utils/dartdevc:dartdevc_kernel_sdk",
- ]
+ deps = [ "../utils/dartdevc:dartdevc_kernel_sdk" ]
gen_dir =
get_label_info("../utils/dartdevc:dartdevc_kernel_sdk", "target_gen_dir")
sources = [
@@ -744,17 +666,13 @@
"$gen_dir/kernel/common/dart_sdk.js.map",
"../pkg/dev_compiler/lib/js/common/run.js",
]
- outputs = [
- "$root_out_dir/dart-sdk/lib/dev_compiler/kernel/common/{{source_file_part}}",
- ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/dev_compiler/kernel/common/{{source_file_part}}" ]
}
# This rule copies DDK's JS SDK to lib/dev_compiler/kernel/es6.
copy("copy_dev_compiler_js_es6_kernel") {
visibility = [ ":copy_dev_compiler_js" ]
- deps = [
- "../utils/dartdevc:dartdevc_kernel_sdk",
- ]
+ deps = [ "../utils/dartdevc:dartdevc_kernel_sdk" ]
gen_dir =
get_label_info("../utils/dartdevc:dartdevc_kernel_sdk", "target_gen_dir")
sources = [
@@ -788,12 +706,9 @@
]
dart_out =
get_label_info("../utils/dartdevc:stack_trace_mapper", "root_out_dir")
- sources = [
- "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/dev_compiler/web/{{source_file_part}}",
- ]
+ sources = [ "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js" ]
+ outputs =
+ [ "$root_out_dir/dart-sdk/lib/dev_compiler/web/{{source_file_part}}" ]
}
# This is the main rule for copying ddc's dependencies to lib/
@@ -814,23 +729,15 @@
"../runtime/include/dart_native_api.h",
"../runtime/include/dart_tools_api.h",
]
- outputs = [
- "$root_out_dir/dart-sdk/include/{{source_file_part}}",
- ]
+ outputs = [ "$root_out_dir/dart-sdk/include/{{source_file_part}}" ]
}
# This rule copies libraries.json files to lib/
copy("copy_libraries_specification") {
visibility = [ ":create_common_sdk" ]
- sources = [
- "lib/libraries.json",
- ]
- deps = [
- ":copy_libraries",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/{{source_file_part}}",
- ]
+ sources = [ "lib/libraries.json" ]
+ deps = [ ":copy_libraries" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/{{source_file_part}}" ]
}
# This is the main rule to copy libraries in _platform_sdk_libraries to lib/
@@ -859,13 +766,9 @@
group("copy_libraries") {
if (dart_platform_sdk) {
- public_deps = [
- ":copy_platform_sdk_libraries",
- ]
+ public_deps = [ ":copy_platform_sdk_libraries" ]
} else {
- public_deps = [
- ":copy_full_sdk_libraries",
- ]
+ public_deps = [ ":copy_full_sdk_libraries" ]
}
}
@@ -877,9 +780,7 @@
"$default_git_folder/logs/HEAD",
]
output = "$root_out_dir/dart-sdk/version"
- outputs = [
- output,
- ]
+ outputs = [ output ]
script = "../tools/write_version_file.py"
args = [
"--output",
@@ -890,13 +791,9 @@
# This rule writes the revision file.
action("write_revision_file") {
visibility = [ ":create_common_sdk" ]
- inputs = [
- "$default_git_folder/logs/HEAD",
- ]
+ inputs = [ "$default_git_folder/logs/HEAD" ]
output = "$root_out_dir/dart-sdk/revision"
- outputs = [
- output,
- ]
+ outputs = [ output ]
script = "../tools/write_revision_file.py"
args = [
"--output",
@@ -913,49 +810,31 @@
# analyzer and popular frameworks have migrated to use it.
copy("copy_libraries_dart") {
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
- sources = [
- "lib/_internal/sdk_library_metadata/lib/libraries.dart",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
- ]
+ deps = [ ":copy_libraries" ]
+ sources = [ "lib/_internal/sdk_library_metadata/lib/libraries.dart" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}
# This rule copies the README file.
copy("copy_readme") {
visibility = [ ":create_common_sdk" ]
- sources = [
- "../README.dart-sdk",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/README",
- ]
+ sources = [ "../README.dart-sdk" ]
+ outputs = [ "$root_out_dir/dart-sdk/README" ]
}
# This rule copies the LICENSE file.
copy("copy_license") {
visibility = [ ":create_common_sdk" ]
- sources = [
- "../LICENSE",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/LICENSE",
- ]
+ sources = [ "../LICENSE" ]
+ outputs = [ "$root_out_dir/dart-sdk/LICENSE" ]
}
# This rule generates a custom dartdoc_options.yaml file.
action("write_dartdoc_options") {
visibility = [ ":create_common_sdk" ]
- inputs = [
- "$default_git_folder/logs/HEAD",
- ]
+ inputs = [ "$default_git_folder/logs/HEAD" ]
output = "$root_out_dir/dart-sdk/dartdoc_options.yaml"
- outputs = [
- output,
- ]
+ outputs = [ output ]
script = "../tools/write_dartdoc_options_file.py"
args = [
"--output",
@@ -966,12 +845,8 @@
# This rule copies the API readme file to lib/
copy("copy_api_readme") {
visibility = [ ":create_common_sdk" ]
- sources = [
- "api_readme.md",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/api_readme.md",
- ]
+ sources = [ "api_readme.md" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/api_readme.md" ]
}
# Parts common to both platform and full SDKs.
@@ -1035,9 +910,7 @@
# The main target to depend on from ../BUILD.gn
group("create_sdk") {
- public_deps = [
- ":create_common_sdk",
- ]
+ public_deps = [ ":create_common_sdk" ]
if (dart_platform_sdk) {
public_deps += [ ":create_platform_sdk" ]
} else {
diff --git a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
index 14c8edd..f057e90 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
@@ -436,6 +436,8 @@
return obj;
}
+asNullableInt(obj) => asInt(obj);
+
/// Checks that `x` is not null or undefined.
//
// TODO(jmesserly): inline this, either by generating it as a function into
@@ -449,6 +451,9 @@
return x;
}
+/// No-op without null safety enabled.
+nullCast(x, type, [@notNull bool isImplicit = false]) => x;
+
/// The global constant map table.
final constantMaps = JS('', 'new Map()');
diff --git a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
index 2ace62a..b8c1c7c 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
@@ -962,19 +962,20 @@
// Without type bounds all will instantiate to dynamic. Only need to check
// further if at least one of the functions has type bounds.
if ($t1.hasTypeBounds || $t2.hasTypeBounds) {
- // Check the bounds of the type parameters of g1 and g2.
- // given a type parameter `T1 extends U1` from g1, and a type parameter
- // `T2 extends U2` from g2, we must ensure that:
- //
- // U2 == U1
+ // Check the bounds of the type parameters of g1 and g2. Given a type
+ // parameter `T1 extends U1` from g1, and a type parameter `T2 extends U2`
+ // from g2, we must ensure that U1 and U2 are mutual subtypes.
//
// (Note there is no variance in the type bounds of type parameters of
// generic functions).
let t1Bounds = $t1.instantiateTypeBounds(fresh);
let t2Bounds = $t2.instantiateTypeBounds(fresh);
for (let i = 0; i < formalCount; i++) {
- if (t2Bounds[i] != t1Bounds[i]) {
- return false;
+ if (t1Bounds[i] != t2Bounds[i]) {
+ if (!($_isSubtype(t1Bounds[i], t2Bounds[i])
+ && $_isSubtype(t2Bounds[i], t1Bounds[i]))) {
+ return false;
+ }
}
}
}
diff --git a/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart b/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart
index 94ef1de..a6edb37 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart
@@ -704,25 +704,22 @@
*/
abstract class JavaScriptIndexingBehavior<E> {}
-// TODO(lrn): These exceptions should be implemented in core.
-// When they are, remove the 'Implementation' here.
-
/// Thrown by type assertions that fail.
class TypeErrorImpl extends Error implements TypeError {
- final String message;
+ final String _message;
- TypeErrorImpl(this.message);
+ TypeErrorImpl(this._message);
- String toString() => message;
+ String toString() => _message;
}
/// Thrown by the 'as' operator if the cast isn't valid.
class CastErrorImpl extends Error implements CastError {
- final String message;
+ final String _message;
- CastErrorImpl(this.message);
+ CastErrorImpl(this._message);
- String toString() => message;
+ String toString() => _message;
}
class FallThroughErrorImplementation extends FallThroughError {
diff --git a/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart b/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
index bc96000..26bcf37 100644
--- a/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
@@ -7,6 +7,7 @@
library _foreign_helper;
import 'dart:_js_embedded_names' show JsGetName, JsBuiltin;
+import 'dart:_rti' show Rti;
/// Emits a JavaScript code fragment parametrized by arguments.
///
@@ -239,7 +240,10 @@
external bool JS_GET_FLAG(String name);
/// Returns a TypeReference to [T].
-external TYPE_REF<T>();
+external Rti TYPE_REF<T>();
+
+/// Returns a TypeReference to [T]*.
+external Rti LEGACY_TYPE_REF<T>();
/// Pretend [code] is executed. Generates no executable code. This is used to
/// model effects at some other point in external code. For example, the
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index 4f332f4..548286b 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -3087,34 +3087,30 @@
/// visible to anyone, and is only injected into special libraries.
abstract class JavaScriptIndexingBehavior<E> extends JSMutableIndexable<E> {}
-// TODO(lrn): These exceptions should be implemented in core.
-// When they are, remove the 'Implementation' here.
-
/// Thrown by type assertions that fail.
class TypeErrorImplementation extends Error implements TypeError {
- final String message;
+ final String _message;
/// Normal type error caused by a failed subtype test.
TypeErrorImplementation(Object value, String type)
- : message = "TypeError: ${Error.safeToString(value)}: type "
+ : _message = "TypeError: ${Error.safeToString(value)}: type "
"'${_typeDescription(value)}' is not a subtype of type '$type'";
- TypeErrorImplementation.fromMessage(String this.message);
+ TypeErrorImplementation.fromMessage(String this._message);
- String toString() => message;
+ String toString() => _message;
}
/// Thrown by the 'as' operator if the cast isn't valid.
class CastErrorImplementation extends Error implements CastError {
- // TODO(lrn): Rename to CastError (and move implementation into core).
- final String message;
+ final String _message;
/// Normal cast error caused by a failed type cast.
CastErrorImplementation(Object value, Object type)
- : message = "CastError: ${Error.safeToString(value)}: type "
+ : _message = "CastError: ${Error.safeToString(value)}: type "
"'${_typeDescription(value)}' is not a subtype of type '$type'";
- String toString() => message;
+ String toString() => _message;
}
String _typeDescription(value) {
diff --git a/sdk/lib/_internal/js_runtime/lib/rti.dart b/sdk/lib/_internal/js_runtime/lib/rti.dart
index 2a96828..a0ee070 100644
--- a/sdk/lib/_internal/js_runtime/lib/rti.dart
+++ b/sdk/lib/_internal/js_runtime/lib/rti.dart
@@ -17,7 +17,8 @@
JS_GET_FLAG,
JS_GET_NAME,
RAW_DART_FUNCTION_REF,
- TYPE_REF;
+ TYPE_REF,
+ LEGACY_TYPE_REF;
import 'dart:_interceptors'
show JavaScriptFunction, JSArray, JSUnmodifiableArray;
@@ -1676,7 +1677,6 @@
} else if (baseKind == Rti.kindStar) {
Rti starArgument = Rti._getStarArgument(baseType);
int starArgumentKind = Rti._getKind(starArgument);
- // TODO(fishythefish): Directly test for `LEGACY_TYPE_REF<Never>()`.
if (starArgumentKind == Rti.kindNever) {
return TYPE_REF<Null>();
} else if (starArgumentKind == Rti.kindFutureOr &&
@@ -1707,16 +1707,11 @@
universe, Rti baseType, String key, bool normalize) {
if (normalize) {
int baseKind = Rti._getKind(baseType);
- if (isTopType(baseType) ||
- isObjectType(baseType) ||
- // TODO(fishythefish): Directly test for `LEGACY_TYPE_REF<Object>()`.
- baseKind == Rti.kindStar &&
- isObjectType(Rti._getStarArgument(baseType))) {
+ if (isTopType(baseType) || isObjectType(baseType)) {
return baseType;
} else if (baseKind == Rti.kindNever) {
return _lookupFutureRti(universe, baseType);
} else if (isNullType(baseType)) {
- // TODO(fishythefish): Use `TYPE_REF<Future<Null>?>()`.
return JS_GET_FLAG('NNBD')
? _lookupQuestionRti(universe, TYPE_REF<Future<Null>>(), false)
: TYPE_REF<Future<Null>>();
@@ -2826,10 +2821,8 @@
}
bool isObjectType(Rti t) => _Utils.isIdentical(t, TYPE_REF<Object>());
-// TODO(fishythefish): Use `LEGACY_TYPE_REF<Object>()`.
bool isLegacyObjectType(Rti t) =>
- Rti._getKind(t) == Rti.kindStar && isObjectType(Rti._getStarArgument(t));
-// TODO(fishythefish): Use `TYPE_REF<Object?>()`.
+ _Utils.isIdentical(t, LEGACY_TYPE_REF<Object>());
bool isNullableObjectType(Rti t) =>
Rti._getKind(t) == Rti.kindQuestion &&
isObjectType(Rti._getQuestionArgument(t));
diff --git a/sdk/lib/_internal/vm/bin/file_patch.dart b/sdk/lib/_internal/vm/bin/file_patch.dart
index 6ee0c5b..73fe2dc 100644
--- a/sdk/lib/_internal/vm/bin/file_patch.dart
+++ b/sdk/lib/_internal/vm/bin/file_patch.dart
@@ -237,7 +237,7 @@
if (event[3]) {
add(event[4], new FileSystemCreateEvent._(getPath(event), isDir));
} else {
- add(event[4], new FileSystemDeleteEvent._(getPath(event), isDir));
+ add(event[4], new FileSystemDeleteEvent._(getPath(event), false));
}
}
@@ -281,10 +281,10 @@
}
}
if ((event[0] & FileSystemEvent.delete) != 0) {
- add(event[4], new FileSystemDeleteEvent._(path, isDir));
+ add(event[4], new FileSystemDeleteEvent._(path, false));
}
if ((event[0] & FileSystemEvent._deleteSelf) != 0) {
- add(event[4], new FileSystemDeleteEvent._(path, isDir));
+ add(event[4], new FileSystemDeleteEvent._(path, false));
// Signal done event.
stops.add([event[4], null]);
}
diff --git a/sdk/lib/_internal/vm/bin/process_patch.dart b/sdk/lib/_internal/vm/bin/process_patch.dart
index 7fc67dc..2c5ae51 100644
--- a/sdk/lib/_internal/vm/bin/process_patch.dart
+++ b/sdk/lib/_internal/vm/bin/process_patch.dart
@@ -127,7 +127,7 @@
}
static _setSignalHandler(int signal) native "Process_SetSignalHandler";
- static int _clearSignalHandler(int signal)
+ static void _clearSignalHandler(int signal)
native "Process_ClearSignalHandler";
}
@@ -534,19 +534,16 @@
_wait(_NativeSocket stdin, _NativeSocket stdout, _NativeSocket stderr,
_NativeSocket exitHandler) native "Process_Wait";
- Stream<List<int>> get stdout {
- return _stdout;
- }
+ Stream<List<int>> get stdout =>
+ _stdout ?? (throw StateError("stdio is not connected"));
- Stream<List<int>> get stderr {
- return _stderr;
- }
+ Stream<List<int>> get stderr =>
+ _stderr ?? (throw StateError("stdio is not connected"));
- IOSink get stdin {
- return _stdin;
- }
+ IOSink get stdin => _stdin ?? (throw StateError("stdio is not connected"));
- Future<int> get exitCode => _exitCode != null ? _exitCode.future : null;
+ Future<int> get exitCode =>
+ _exitCode?.future ?? (throw StateError("Process is detached"));
bool kill([ProcessSignal signal = ProcessSignal.sigterm]) {
if (signal is! ProcessSignal) {
diff --git a/sdk/lib/_internal/vm/bin/socket_patch.dart b/sdk/lib/_internal/vm/bin/socket_patch.dart
index 2e75234..af136d4 100644
--- a/sdk/lib/_internal/vm/bin/socket_patch.dart
+++ b/sdk/lib/_internal/vm/bin/socket_patch.dart
@@ -706,24 +706,32 @@
String get _serviceTypePath => throw new UnimplementedError();
String get _serviceTypeName => throw new UnimplementedError();
- Uint8List read(int len) {
- if (len != null && len <= 0) {
- throw new ArgumentError("Illegal length $len");
+ Uint8List read(int count) {
+ if (count != null && count <= 0) {
+ throw ArgumentError("Illegal length $count");
}
if (isClosing || isClosed) return null;
- len = min(available, len == null ? available : len);
- if (len == 0) return null;
- var result = nativeRead(len);
+ var length = count == null ? available : min(available, count);
+ if (length == 0) return null;
+ var result = nativeRead(length);
if (result is OSError) {
reportError(result, StackTrace.current, "Read failed");
return null;
}
- if (result != null) {
- available -= result.length;
+ final list = result as Uint8List;
+ if (list != null) {
+ if (count == null) {
+ // If count is not specified, read as many bytes as possible.
+ // This checks remaining bytes, if available > 0, issue() in
+ // issueReadEvent() will keep reading.
+ available = nativeAvailable();
+ } else {
+ available -= list.length;
+ }
// TODO(ricow): Remove when we track internal and pipe uses.
assert(resourceInfo != null || isPipe || isInternal || isInternalSignal);
if (resourceInfo != null) {
- resourceInfo.totalRead += result.length;
+ resourceInfo.totalRead += list.length;
}
}
// TODO(ricow): Remove when we track internal and pipe uses.
@@ -733,9 +741,9 @@
}
if (!const bool.fromEnvironment("dart.vm.product")) {
_SocketProfile.collectStatistic(
- nativeGetSocketId(), _SocketProfileType.readBytes, result?.length);
+ nativeGetSocketId(), _SocketProfileType.readBytes, list?.length);
}
- return result;
+ return list;
}
Datagram receive() {
diff --git a/sdk/lib/_internal/vm/lib/errors_patch.dart b/sdk/lib/_internal/vm/lib/errors_patch.dart
index 24ca940..9457152 100644
--- a/sdk/lib/_internal/vm/lib/errors_patch.dart
+++ b/sdk/lib/_internal/vm/lib/errors_patch.dart
@@ -82,15 +82,19 @@
final Object message;
}
-class _TypeError extends _AssertionError implements TypeError {
+class _TypeError extends Error implements TypeError {
@pragma("vm:entry-point")
- _TypeError._create(String url, int line, int column, String errorMsg)
- : super._create("is assignable", url, line, column, errorMsg);
+ _TypeError._create(this._url, this._line, this._column, this._message);
static _throwNew(int location, Object src_value, _Type dst_type,
String dst_name) native "TypeError_throwNew";
- String toString() => super.message;
+ String toString() => _message;
+
+ final String _url;
+ final int _line;
+ final int _column;
+ final Object _message;
}
class _CastError extends Error implements CastError {
diff --git a/sdk/lib/_internal/vm/lib/ffi_patch.dart b/sdk/lib/_internal/vm/lib/ffi_patch.dart
index 518e11e..4d21fb2 100644
--- a/sdk/lib/_internal/vm/lib/ffi_patch.dart
+++ b/sdk/lib/_internal/vm/lib/ffi_patch.dart
@@ -452,3 +452,27 @@
@patch
int get nativePort native "SendPortImpl_get_id";
}
+
+int _nativeApiFunctionPointer(String symbol) native "NativeApiFunctionPointer";
+
+@patch
+class NativeApi {
+ @patch
+ static Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
+ get nativeApiPostCObject =>
+ Pointer.fromAddress(_nativeApiFunctionPointer("Dart_PostCObject"));
+
+ @patch
+ static Pointer<
+ NativeFunction<
+ Int64 Function(
+ Pointer<Uint8>,
+ Pointer<NativeFunction<Dart_NativeMessageHandler>>,
+ Int8)>> get nativeApiNewNativePort =>
+ Pointer.fromAddress(_nativeApiFunctionPointer("Dart_NewNativePort"));
+
+ @patch
+ static Pointer<NativeFunction<Int8 Function(Int64)>>
+ get nativeApiCloseNativePort => Pointer.fromAddress(
+ _nativeApiFunctionPointer("Dart_CloseNativePort"));
+}
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart
index 53692d4..bb12431 100644
--- a/sdk/lib/core/errors.dart
+++ b/sdk/lib/core/errors.dart
@@ -112,9 +112,9 @@
}
/**
- * Error thrown by the runtime system when a type assertion fails.
+ * Error thrown by the runtime system when a dynamic type error happens.
*/
-class TypeError extends AssertionError {}
+class TypeError extends Error {}
/**
* Error thrown by the runtime system when a cast operation fails.
diff --git a/sdk/lib/ffi/ffi.dart b/sdk/lib/ffi/ffi.dart
index e8bae22..26f5ff6 100644
--- a/sdk/lib/ffi/ffi.dart
+++ b/sdk/lib/ffi/ffi.dart
@@ -622,3 +622,38 @@
/// `dart_native_api.h`.
external int get nativePort;
}
+
+/// Opaque, not exposing it's members.
+class Dart_CObject extends Struct {}
+
+typedef Dart_NativeMessageHandler = Void Function(Int64, Pointer<Dart_CObject>);
+
+/// Exposes function pointers to functions in `dart_native_api.h`.
+class NativeApi {
+ /// A function pointer to
+ /// `bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* message)`
+ /// in `dart_native_api.h`.
+ external static Pointer<
+ NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
+ get nativeApiPostCObject;
+
+ /// A function pointer to
+ /// ```
+ /// Dart_Port Dart_NewNativePort(const char* name,
+ /// Dart_NativeMessageHandler handler,
+ /// bool handle_concurrently)
+ /// ```
+ /// in `dart_native_api.h`.
+ external static Pointer<
+ NativeFunction<
+ Int64 Function(
+ Pointer<Uint8>,
+ Pointer<NativeFunction<Dart_NativeMessageHandler>>,
+ Int8)>> get nativeApiNewNativePort;
+
+ /// A function pointer to
+ /// `bool Dart_CloseNativePort(Dart_Port native_port_id)`
+ /// in `dart_native_api.h`.
+ external static Pointer<NativeFunction<Int8 Function(Int64)>>
+ get nativeApiCloseNativePort;
+}
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index e07517d..e09b761 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -117,7 +117,8 @@
HtmlElement.created() : super.created();
// From NoncedElement
- String nonce;
+ String get nonce native;
+ set nonce(String value) native;
}
/**
@@ -218,11 +219,11 @@
static Accelerometer _create_2() =>
JS('Accelerometer', 'new Accelerometer()');
- final num x;
+ num get x native;
- final num y;
+ num get y native;
- final num z;
+ num get z native;
}
// 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
@@ -259,99 +260,193 @@
static AccessibleNode _create_1() =>
JS('AccessibleNode', 'new AccessibleNode()');
- AccessibleNode activeDescendant;
+ AccessibleNode get activeDescendant native;
- bool atomic;
+ set activeDescendant(AccessibleNode value) native;
- String autocomplete;
+ bool get atomic native;
- bool busy;
+ set atomic(bool value) native;
- String checked;
+ String get autocomplete native;
- int colCount;
+ set autocomplete(String value) native;
- int colIndex;
+ bool get busy native;
- int colSpan;
+ set busy(bool value) native;
- AccessibleNodeList controls;
+ String get checked native;
- String current;
+ set checked(String value) native;
- AccessibleNodeList describedBy;
+ int get colCount native;
- AccessibleNode details;
+ set colCount(int value) native;
- bool disabled;
+ int get colIndex native;
- AccessibleNode errorMessage;
+ set colIndex(int value) native;
- bool expanded;
+ int get colSpan native;
- AccessibleNodeList flowTo;
+ set colSpan(int value) native;
- String hasPopUp;
+ AccessibleNodeList get controls native;
- bool hidden;
+ set controls(AccessibleNodeList value) native;
- String invalid;
+ String get current native;
- String keyShortcuts;
+ set current(String value) native;
- String label;
+ AccessibleNodeList get describedBy native;
- AccessibleNodeList labeledBy;
+ set describedBy(AccessibleNodeList value) native;
- int level;
+ AccessibleNode get details native;
- String live;
+ set details(AccessibleNode value) native;
- bool modal;
+ bool get disabled native;
- bool multiline;
+ set disabled(bool value) native;
- bool multiselectable;
+ AccessibleNode get errorMessage native;
- String orientation;
+ set errorMessage(AccessibleNode value) native;
- AccessibleNodeList owns;
+ bool get expanded native;
- String placeholder;
+ set expanded(bool value) native;
- int posInSet;
+ AccessibleNodeList get flowTo native;
- String pressed;
+ set flowTo(AccessibleNodeList value) native;
- bool readOnly;
+ String get hasPopUp native;
- String relevant;
+ set hasPopUp(String value) native;
- bool required;
+ bool get hidden native;
- String role;
+ set hidden(bool value) native;
- String roleDescription;
+ String get invalid native;
- int rowCount;
+ set invalid(String value) native;
- int rowIndex;
+ String get keyShortcuts native;
- int rowSpan;
+ set keyShortcuts(String value) native;
- bool selected;
+ String get label native;
- int setSize;
+ set label(String value) native;
- String sort;
+ AccessibleNodeList get labeledBy native;
- num valueMax;
+ set labeledBy(AccessibleNodeList value) native;
- num valueMin;
+ int get level native;
- num valueNow;
+ set level(int value) native;
- String valueText;
+ String get live native;
+
+ set live(String value) native;
+
+ bool get modal native;
+
+ set modal(bool value) native;
+
+ bool get multiline native;
+
+ set multiline(bool value) native;
+
+ bool get multiselectable native;
+
+ set multiselectable(bool value) native;
+
+ String get orientation native;
+
+ set orientation(String value) native;
+
+ AccessibleNodeList get owns native;
+
+ set owns(AccessibleNodeList value) native;
+
+ String get placeholder native;
+
+ set placeholder(String value) native;
+
+ int get posInSet native;
+
+ set posInSet(int value) native;
+
+ String get pressed native;
+
+ set pressed(String value) native;
+
+ bool get readOnly native;
+
+ set readOnly(bool value) native;
+
+ String get relevant native;
+
+ set relevant(String value) native;
+
+ bool get required native;
+
+ set required(bool value) native;
+
+ String get role native;
+
+ set role(String value) native;
+
+ String get roleDescription native;
+
+ set roleDescription(String value) native;
+
+ int get rowCount native;
+
+ set rowCount(int value) native;
+
+ int get rowIndex native;
+
+ set rowIndex(int value) native;
+
+ int get rowSpan native;
+
+ set rowSpan(int value) native;
+
+ bool get selected native;
+
+ set selected(bool value) native;
+
+ int get setSize native;
+
+ set setSize(int value) native;
+
+ String get sort native;
+
+ set sort(String value) native;
+
+ num get valueMax native;
+
+ set valueMax(num value) native;
+
+ num get valueMin native;
+
+ set valueMin(num value) native;
+
+ num get valueNow native;
+
+ set valueNow(num value) native;
+
+ String get valueText native;
+
+ set valueText(String value) native;
void appendChild(AccessibleNode child) native;
@@ -393,7 +488,9 @@
static AccessibleNodeList _create_2() =>
JS('AccessibleNodeList', 'new AccessibleNodeList()');
- int length;
+ int get length native;
+
+ set length(int value) native;
void __setter__(int index, AccessibleNode node) native;
@@ -426,7 +523,7 @@
static AmbientLightSensor _create_2() =>
JS('AmbientLightSensor', 'new AmbientLightSensor()');
- final num illuminance;
+ num get illuminance native;
}
// 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
@@ -452,41 +549,73 @@
*/
AnchorElement.created() : super.created();
- String download;
+ String get download native;
- String hreflang;
+ set download(String value) native;
- String referrerPolicy;
+ String get hreflang native;
- String rel;
+ set hreflang(String value) native;
- String target;
+ String get referrerPolicy native;
- String type;
+ set referrerPolicy(String value) native;
+
+ String get rel native;
+
+ set rel(String value) native;
+
+ String get target native;
+
+ set target(String value) native;
+
+ String get type native;
+
+ set type(String value) native;
// From HTMLHyperlinkElementUtils
- String hash;
+ String get hash native;
- String host;
+ set hash(String value) native;
- String hostname;
+ String get host native;
- String href;
+ set host(String value) native;
- final String origin;
+ String get hostname native;
- String password;
+ set hostname(String value) native;
- String pathname;
+ String get href native;
- String port;
+ set href(String value) native;
- String protocol;
+ String get origin native;
- String search;
+ String get password native;
- String username;
+ set password(String value) native;
+
+ String get pathname native;
+
+ set pathname(String value) native;
+
+ String get port native;
+
+ set port(String value) native;
+
+ String get protocol native;
+
+ set protocol(String value) native;
+
+ String get search native;
+
+ set search(String value) native;
+
+ String get username native;
+
+ set username(String value) native;
String toString() => JS('String', 'String(#)', this);
}
@@ -526,25 +655,35 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(document.body.animate)');
- num currentTime;
+ num get currentTime native;
- AnimationEffectReadOnly effect;
+ set currentTime(num value) native;
+
+ AnimationEffectReadOnly get effect native;
+
+ set effect(AnimationEffectReadOnly value) native;
Future<Animation> get finished =>
promiseToFuture<Animation>(JS("", "#.finished", this));
- String id;
+ String get id native;
- final String playState;
+ set id(String value) native;
- num playbackRate;
+ String get playState native;
+
+ num get playbackRate native;
+
+ set playbackRate(num value) native;
Future<Animation> get ready =>
promiseToFuture<Animation>(JS("", "#.ready", this));
- num startTime;
+ num get startTime native;
- final AnimationTimeline timeline;
+ set startTime(num value) native;
+
+ AnimationTimeline get timeline native;
void cancel() native;
@@ -571,7 +710,7 @@
throw new UnsupportedError("Not supported");
}
- final AnimationEffectTimingReadOnly timing;
+ AnimationEffectTimingReadOnly get timing native;
Map getComputedTiming() {
return convertNativeToDart_Dictionary(_getComputedTiming_1());
@@ -593,67 +732,51 @@
// Shadowing definition.
- num get delay => JS("num", "#.delay", this);
+ num get delay native;
- set delay(num value) {
- JS("void", "#.delay = #", this, value);
- }
+ set delay(num value) native;
// Shadowing definition.
- String get direction => JS("String", "#.direction", this);
+ String get direction native;
- set direction(String value) {
- JS("void", "#.direction = #", this, value);
- }
+ set direction(String value) native;
// Shadowing definition.
- Object get duration => JS("Object", "#.duration", this);
+ Object get duration native;
- set duration(Object value) {
- JS("void", "#.duration = #", this, value);
- }
+ set duration(Object value) native;
// Shadowing definition.
- String get easing => JS("String", "#.easing", this);
+ String get easing native;
- set easing(String value) {
- JS("void", "#.easing = #", this, value);
- }
+ set easing(String value) native;
// Shadowing definition.
- num get endDelay => JS("num", "#.endDelay", this);
+ num get endDelay native;
- set endDelay(num value) {
- JS("void", "#.endDelay = #", this, value);
- }
+ set endDelay(num value) native;
// Shadowing definition.
- String get fill => JS("String", "#.fill", this);
+ String get fill native;
- set fill(String value) {
- JS("void", "#.fill = #", this, value);
- }
+ set fill(String value) native;
// Shadowing definition.
- num get iterationStart => JS("num", "#.iterationStart", this);
+ num get iterationStart native;
- set iterationStart(num value) {
- JS("void", "#.iterationStart = #", this, value);
- }
+ set iterationStart(num value) native;
// Shadowing definition.
- num get iterations => JS("num", "#.iterations", this);
+ num get iterations native;
- set iterations(num value) {
- JS("void", "#.iterations = #", this, value);
- }
+ set iterations(num value) native;
}
// 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
@@ -666,21 +789,21 @@
throw new UnsupportedError("Not supported");
}
- final num delay;
+ num get delay native;
- final String direction;
+ String get direction native;
- final Object duration;
+ Object get duration native;
- final String easing;
+ String get easing native;
- final num endDelay;
+ num get endDelay native;
- final String fill;
+ String get fill native;
- final num iterationStart;
+ num get iterationStart native;
- final num iterations;
+ num get iterations native;
}
// 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
@@ -705,9 +828,9 @@
static AnimationEvent _create_2(type) =>
JS('AnimationEvent', 'new AnimationEvent(#)', type);
- final String animationName;
+ String get animationName native;
- final num elapsedTime;
+ num get elapsedTime native;
}
// 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
@@ -735,9 +858,9 @@
static AnimationPlaybackEvent _create_2(type) =>
JS('AnimationPlaybackEvent', 'new AnimationPlaybackEvent(#)', type);
- final num currentTime;
+ num get currentTime native;
- final num timelineTime;
+ num get timelineTime native;
}
// 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
@@ -750,7 +873,7 @@
throw new UnsupportedError("Not supported");
}
- final num currentTime;
+ num get currentTime native;
}
// 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
@@ -872,7 +995,7 @@
static const int UPDATEREADY = 4;
- final int status;
+ int get status native;
void abort() native;
@@ -930,13 +1053,13 @@
static ApplicationCacheErrorEvent _create_2(type) => JS(
'ApplicationCacheErrorEvent', 'new ApplicationCacheErrorEvent(#)', type);
- final String message;
+ String get message native;
- final String reason;
+ String get reason native;
- final int status;
+ int get status native;
- final String url;
+ String get url native;
}
// 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
@@ -971,43 +1094,77 @@
*/
AreaElement.created() : super.created();
- String alt;
+ String get alt native;
- String coords;
+ set alt(String value) native;
- String download;
+ String get coords native;
- String referrerPolicy;
+ set coords(String value) native;
- String rel;
+ String get download native;
- String shape;
+ set download(String value) native;
- String target;
+ String get referrerPolicy native;
+
+ set referrerPolicy(String value) native;
+
+ String get rel native;
+
+ set rel(String value) native;
+
+ String get shape native;
+
+ set shape(String value) native;
+
+ String get target native;
+
+ set target(String value) native;
// From HTMLHyperlinkElementUtils
- String hash;
+ String get hash native;
- String host;
+ set hash(String value) native;
- String hostname;
+ String get host native;
- String href;
+ set host(String value) native;
- final String origin;
+ String get hostname native;
- String password;
+ set hostname(String value) native;
- String pathname;
+ String get href native;
- String port;
+ set href(String value) native;
- String protocol;
+ String get origin native;
- String search;
+ String get password native;
- String username;
+ set password(String value) native;
+
+ String get pathname native;
+
+ set pathname(String value) native;
+
+ String get port native;
+
+ set port(String value) native;
+
+ String get protocol native;
+
+ set protocol(String value) native;
+
+ String get search native;
+
+ set search(String value) native;
+
+ String get username native;
+
+ set username(String value) native;
String toString() => JS('String', 'String(#)', this);
}
@@ -1045,9 +1202,9 @@
throw new UnsupportedError("Not supported");
}
- final ByteBuffer authenticatorData;
+ ByteBuffer get authenticatorData native;
- final ByteBuffer signature;
+ ByteBuffer get signature native;
}
// 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
@@ -1060,7 +1217,7 @@
throw new UnsupportedError("Not supported");
}
- final ByteBuffer attestationObject;
+ ByteBuffer get attestationObject native;
}
// 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
@@ -1074,7 +1231,7 @@
}
@JSName('clientDataJSON')
- final ByteBuffer clientDataJson;
+ ByteBuffer get clientDataJson native;
}
// 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
@@ -1117,7 +1274,7 @@
type,
init);
- final String state;
+ String get state native;
}
// 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
@@ -1137,7 +1294,7 @@
static BackgroundFetchEvent _create_1(type, init) =>
JS('BackgroundFetchEvent', 'new BackgroundFetchEvent(#,#)', type, init);
- final String id;
+ String get id native;
}
// 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
@@ -1160,7 +1317,7 @@
type,
init);
- final List<BackgroundFetchSettledFetch> fetches;
+ List<BackgroundFetchSettledFetch> get fetches native;
}
// 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
@@ -1173,7 +1330,7 @@
throw new UnsupportedError("Not supported");
}
- final _Request request;
+ _Request get request native;
}
// 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
@@ -1214,19 +1371,19 @@
throw new UnsupportedError("Not supported");
}
- final int downloadTotal;
+ int get downloadTotal native;
- final int downloaded;
+ int get downloaded native;
- final String id;
+ String get id native;
- final String title;
+ String get title native;
- final int totalDownloadSize;
+ int get totalDownloadSize native;
- final int uploadTotal;
+ int get uploadTotal native;
- final int uploaded;
+ int get uploaded native;
Future<bool> abort() => promiseToFuture<bool>(JS("", "#.abort()", this));
}
@@ -1250,7 +1407,7 @@
request,
response);
- final _Response response;
+ _Response get response native;
}
// 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
@@ -1270,7 +1427,7 @@
static BackgroundFetchedEvent _create_1(type, init) => JS(
'BackgroundFetchedEvent', 'new BackgroundFetchedEvent(#,#)', type, init);
- final List<BackgroundFetchSettledFetch> fetches;
+ List<BackgroundFetchSettledFetch> get fetches native;
Future updateUI(String title) =>
promiseToFuture(JS("", "#.updateUI(#)", this, title));
@@ -1288,7 +1445,7 @@
throw new UnsupportedError("Not supported");
}
- final bool visible;
+ bool get visible native;
}
// 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
@@ -1333,9 +1490,13 @@
*/
BaseElement.created() : super.created();
- String href;
+ String get href native;
- String target;
+ set href(String value) native;
+
+ String get target native;
+
+ set target(String value) native;
}
// 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
@@ -1348,13 +1509,13 @@
throw new UnsupportedError("Not supported");
}
- final bool charging;
+ bool get charging native;
- final num chargingTime;
+ num get chargingTime native;
- final num dischargingTime;
+ num get dischargingTime native;
- final num level;
+ num get level native;
}
// 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
@@ -1382,7 +1543,7 @@
static BeforeInstallPromptEvent _create_2(type) =>
JS('BeforeInstallPromptEvent', 'new BeforeInstallPromptEvent(#)', type);
- final List<String> platforms;
+ List<String> get platforms native;
Future<Map<String, dynamic>> get userChoice =>
promiseToFutureAsMap(JS("", "#.userChoice", this));
@@ -1402,11 +1563,9 @@
// Shadowing definition.
- String get returnValue => JS("String", "#.returnValue", this);
+ String get returnValue native;
- set returnValue(String value) {
- JS("void", "#.returnValue = #", this, value);
- }
+ set returnValue(String value) native;
}
// 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
@@ -1419,9 +1578,9 @@
throw new UnsupportedError("Not supported");
}
- final int size;
+ int get size native;
- final String type;
+ String get type native;
Blob slice([int start, int end, String contentType]) native;
@@ -1471,9 +1630,9 @@
static BlobEvent _create_1(type, eventInitDict) =>
JS('BlobEvent', 'new BlobEvent(#,#)', type, eventInitDict);
- final Blob data;
+ Blob get data native;
- final num timecode;
+ num get timecode native;
}
// 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
@@ -1486,11 +1645,11 @@
throw new UnsupportedError("Not supported");
}
- final _BluetoothRemoteGATTCharacteristic characteristic;
+ _BluetoothRemoteGATTCharacteristic get characteristic native;
- final String uuid;
+ String get uuid native;
- final ByteData value;
+ ByteData get value native;
Future readValue() => promiseToFuture(JS("", "#.readValue()", this));
@@ -1508,7 +1667,7 @@
throw new UnsupportedError("Not supported");
}
- final bool bodyUsed;
+ bool get bodyUsed native;
Future arrayBuffer() => promiseToFuture(JS("", "#.arrayBuffer()", this));
@@ -1713,7 +1872,7 @@
static BroadcastChannel _create_1(name) =>
JS('BroadcastChannel', 'new BroadcastChannel(#)', name);
- final String name;
+ String get name native;
void close() native;
@@ -1732,9 +1891,9 @@
throw new UnsupportedError("Not supported");
}
- final num budgetAt;
+ num get budgetAt native;
- final int time;
+ int get time native;
}
// 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
@@ -1759,38 +1918,58 @@
*/
ButtonElement.created() : super.created();
- bool autofocus;
+ bool get autofocus native;
- bool disabled;
+ set autofocus(bool value) native;
- final FormElement form;
+ bool get disabled native;
- String formAction;
+ set disabled(bool value) native;
- String formEnctype;
+ FormElement get form native;
- String formMethod;
+ String get formAction native;
- bool formNoValidate;
+ set formAction(String value) native;
- String formTarget;
+ String get formEnctype native;
+
+ set formEnctype(String value) native;
+
+ String get formMethod native;
+
+ set formMethod(String value) native;
+
+ bool get formNoValidate native;
+
+ set formNoValidate(bool value) native;
+
+ String get formTarget native;
+
+ set formTarget(String value) native;
@Unstable()
@Returns('NodeList|Null')
@Creates('NodeList')
- final List<Node> labels;
+ List<Node> get labels native;
- String name;
+ String get name native;
- String type;
+ set name(String value) native;
- final String validationMessage;
+ String get type native;
- final ValidityState validity;
+ set type(String value) native;
- String value;
+ String get validationMessage native;
- final bool willValidate;
+ ValidityState get validity native;
+
+ String get value native;
+
+ set value(String value) native;
+
+ bool get willValidate native;
bool checkValidity() native;
@@ -1863,13 +2042,13 @@
type,
eventInitDict);
- final List methodData;
+ List get methodData native;
- final List modifiers;
+ List get modifiers native;
- final String paymentRequestOrigin;
+ String get paymentRequestOrigin native;
- final String topLevelOrigin;
+ String get topLevelOrigin native;
void respondWith(Future canMakePaymentResponse) native;
}
@@ -1884,7 +2063,7 @@
throw new UnsupportedError("Not supported");
}
- final CanvasElement canvas;
+ CanvasElement get canvas native;
void requestFrame() native;
}
@@ -1932,10 +2111,16 @@
CanvasElement.created() : super.created();
/// The height of this canvas element in CSS pixels.
- int height;
+
+ int get height native;
+
+ set height(int value) native;
/// The width of this canvas element in CSS pixels.
- int width;
+
+ int get width native;
+
+ set width(int value) native;
MediaStream captureStream([num frameRate]) native;
@@ -2172,23 +2357,37 @@
throw new UnsupportedError("Not supported");
}
- final CanvasElement canvas;
+ CanvasElement get canvas native;
- Matrix currentTransform;
+ Matrix get currentTransform native;
- String direction;
+ set currentTransform(Matrix value) native;
+
+ String get direction native;
+
+ set direction(String value) native;
@Creates('String|CanvasGradient|CanvasPattern')
@Returns('String|CanvasGradient|CanvasPattern')
- Object fillStyle;
+ Object get fillStyle native;
- String filter;
+ set fillStyle(Object value) native;
- String font;
+ String get filter native;
- num globalAlpha;
+ set filter(String value) native;
- String globalCompositeOperation;
+ String get font native;
+
+ set font(String value) native;
+
+ num get globalAlpha native;
+
+ set globalAlpha(num value) native;
+
+ String get globalCompositeOperation native;
+
+ set globalCompositeOperation(String value) native;
/**
* Whether images and patterns on this canvas will be smoothed when this
@@ -2200,33 +2399,60 @@
* smoothing](https://html.spec.whatwg.org/multipage/scripting.html#image-smoothing)
* from WHATWG.
*/
- bool imageSmoothingEnabled;
- String imageSmoothingQuality;
+ bool get imageSmoothingEnabled native;
- String lineCap;
+ set imageSmoothingEnabled(bool value) native;
- String lineJoin;
+ String get imageSmoothingQuality native;
- num lineWidth;
+ set imageSmoothingQuality(String value) native;
- num miterLimit;
+ String get lineCap native;
- num shadowBlur;
+ set lineCap(String value) native;
- String shadowColor;
+ String get lineJoin native;
- num shadowOffsetX;
+ set lineJoin(String value) native;
- num shadowOffsetY;
+ num get lineWidth native;
+
+ set lineWidth(num value) native;
+
+ num get miterLimit native;
+
+ set miterLimit(num value) native;
+
+ num get shadowBlur native;
+
+ set shadowBlur(num value) native;
+
+ String get shadowColor native;
+
+ set shadowColor(String value) native;
+
+ num get shadowOffsetX native;
+
+ set shadowOffsetX(num value) native;
+
+ num get shadowOffsetY native;
+
+ set shadowOffsetY(num value) native;
@Creates('String|CanvasGradient|CanvasPattern')
@Returns('String|CanvasGradient|CanvasPattern')
- Object strokeStyle;
+ Object get strokeStyle native;
- String textAlign;
+ set strokeStyle(Object value) native;
- String textBaseline;
+ String get textAlign native;
+
+ set textAlign(String value) native;
+
+ String get textBaseline native;
+
+ set textBaseline(String value) native;
void addHitRegion([Map options]) {
if (options != null) {
@@ -2742,9 +2968,11 @@
throw new UnsupportedError("Not supported");
}
- String data;
+ String get data native;
- final int length;
+ set data(String value) native;
+
+ int get length native;
void appendData(String data) native;
@@ -2764,9 +2992,9 @@
// From NonDocumentTypeChildNode
- final Element nextElementSibling;
+ Element get nextElementSibling native;
- final Element previousElementSibling;
+ Element get previousElementSibling native;
}
// 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
@@ -2795,13 +3023,13 @@
throw new UnsupportedError("Not supported");
}
- final String frameType;
+ String get frameType native;
- final String id;
+ String get id native;
- final String type;
+ String get type native;
- final String url;
+ String get url native;
void postMessage(Object message, [List<Object> transfer]) native;
}
@@ -2855,7 +3083,7 @@
static ClipboardEvent _create_2(type) =>
JS('ClipboardEvent', 'new ClipboardEvent(#)', type);
- final DataTransfer clipboardData;
+ DataTransfer get clipboardData native;
}
// 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
@@ -2880,11 +3108,11 @@
static CloseEvent _create_2(type) =>
JS('CloseEvent', 'new CloseEvent(#)', type);
- final int code;
+ int get code native;
- final String reason;
+ String get reason native;
- final bool wasClean;
+ bool get wasClean native;
}
// 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
@@ -2943,7 +3171,7 @@
static CompositionEvent _create_2(type) =>
JS('CompositionEvent', 'new CompositionEvent(#)', type);
- final String data;
+ String get data native;
@JSName('initCompositionEvent')
void _initCompositionEvent(String type, bool bubbles, bool cancelable,
@@ -2972,7 +3200,9 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('content');
- String select;
+ String get select native;
+
+ set select(String value) native;
@Returns('NodeList|Null')
@Creates('NodeList')
@@ -3017,19 +3247,19 @@
throw new UnsupportedError("Not supported");
}
- final num accuracy;
+ num get accuracy native;
- final num altitude;
+ num get altitude native;
- final num altitudeAccuracy;
+ num get altitudeAccuracy native;
- final num heading;
+ num get heading native;
- final num latitude;
+ num get latitude native;
- final num longitude;
+ num get longitude native;
- final num speed;
+ num get speed native;
}
// 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
@@ -3042,9 +3272,9 @@
throw new UnsupportedError("Not supported");
}
- final String id;
+ String get id native;
- final String type;
+ String get type native;
}
// 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
@@ -3058,9 +3288,9 @@
}
@JSName('iconURL')
- final String iconUrl;
+ String get iconUrl native;
- final String name;
+ String get name native;
}
// 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
@@ -3119,7 +3349,7 @@
static bool get supported =>
JS('bool', '!!(window.crypto && window.crypto.getRandomValues)');
- final _SubtleCrypto subtle;
+ _SubtleCrypto get subtle native;
@JSName('getRandomValues')
@Creates('TypedData')
@@ -3138,13 +3368,13 @@
}
@Creates('Null')
- final Object algorithm;
+ Object get algorithm native;
- final bool extractable;
+ bool get extractable native;
- final String type;
+ String get type native;
- final Object usages;
+ Object get usages native;
}
// 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
@@ -3157,7 +3387,7 @@
throw new UnsupportedError("Not supported");
}
- static final _Worklet paintWorklet;
+ _Worklet get paintWorklet native;
static CssUnitValue Hz(num value) native;
@@ -3243,7 +3473,9 @@
throw new UnsupportedError("Not supported");
}
- String encoding;
+ String get encoding native;
+
+ set encoding(String value) native;
}
// 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
@@ -3256,7 +3488,7 @@
throw new UnsupportedError("Not supported");
}
- final String conditionText;
+ String get conditionText native;
}
// 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
@@ -3269,7 +3501,7 @@
throw new UnsupportedError("Not supported");
}
- final CssStyleDeclaration style;
+ CssStyleDeclaration get style native;
}
// 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
@@ -3284,7 +3516,7 @@
@Returns('_CssRuleList|Null')
@Creates('_CssRuleList')
- final List<CssRule> cssRules;
+ List<CssRule> get cssRules native;
void deleteRule(int index) native;
@@ -3301,11 +3533,11 @@
throw new UnsupportedError("Not supported");
}
- final num intrinsicHeight;
+ num get intrinsicHeight native;
- final num intrinsicRatio;
+ num get intrinsicRatio native;
- final num intrinsicWidth;
+ num get intrinsicWidth native;
}
// 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
@@ -3318,11 +3550,11 @@
throw new UnsupportedError("Not supported");
}
- final String href;
+ String get href native;
- final MediaList media;
+ MediaList get media native;
- final CssStyleSheet styleSheet;
+ CssStyleSheet get styleSheet native;
}
// 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
@@ -3335,9 +3567,11 @@
throw new UnsupportedError("Not supported");
}
- String keyText;
+ String get keyText native;
- final CssStyleDeclaration style;
+ set keyText(String value) native;
+
+ CssStyleDeclaration get style native;
}
// 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
@@ -3352,9 +3586,11 @@
@Returns('_CssRuleList|Null')
@Creates('_CssRuleList')
- final List<CssRule> cssRules;
+ List<CssRule> get cssRules native;
- String name;
+ String get name native;
+
+ set name(String value) native;
CssKeyframeRule __getter__(int index) native;
@@ -3381,7 +3617,9 @@
static CssKeywordValue _create_1(keyword) =>
JS('CssKeywordValue', 'new CSSKeywordValue(#)', keyword);
- String value;
+ String get value native;
+
+ set value(String value) native;
}
// 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
@@ -3406,7 +3644,9 @@
static CssMatrixComponent _create_2(matrix) =>
JS('CssMatrixComponent', 'new CSSMatrixComponent(#)', matrix);
- DomMatrix matrix;
+ DomMatrix get matrix native;
+
+ set matrix(DomMatrix value) native;
}
// 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
@@ -3419,7 +3659,7 @@
throw new UnsupportedError("Not supported");
}
- final MediaList media;
+ MediaList get media native;
}
// 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
@@ -3433,9 +3673,9 @@
}
@JSName('namespaceURI')
- final String namespaceUri;
+ String get namespaceUri native;
- final String prefix;
+ String get prefix native;
}
// 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
@@ -3471,9 +3711,11 @@
throw new UnsupportedError("Not supported");
}
- String selectorText;
+ String get selectorText native;
- final CssStyleDeclaration style;
+ set selectorText(String value) native;
+
+ CssStyleDeclaration get style native;
}
// 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
@@ -3492,7 +3734,9 @@
static CssPerspective _create_1(length) =>
JS('CssPerspective', 'new CSSPerspective(#)', length);
- CssNumericValue length;
+ CssNumericValue get length native;
+
+ set length(CssNumericValue value) native;
}
// 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
@@ -3511,9 +3755,13 @@
static CssPositionValue _create_1(x, y) =>
JS('CssPositionValue', 'new CSSPositionValue(#,#)', x, y);
- CssNumericValue x;
+ CssNumericValue get x native;
- CssNumericValue y;
+ set x(CssNumericValue value) native;
+
+ CssNumericValue get y native;
+
+ set y(CssNumericValue value) native;
}
// 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
@@ -3526,7 +3774,7 @@
throw new UnsupportedError("Not supported");
}
- final String state;
+ String get state native;
}
// 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
@@ -3559,13 +3807,21 @@
static CssRotation _create_2(angleValue_OR_x, y, z, angle) => JS(
'CssRotation', 'new CSSRotation(#,#,#,#)', angleValue_OR_x, y, z, angle);
- CssNumericValue angle;
+ CssNumericValue get angle native;
- num x;
+ set angle(CssNumericValue value) native;
- num y;
+ num get x native;
- num z;
+ set x(num value) native;
+
+ num get y native;
+
+ set y(num value) native;
+
+ num get z native;
+
+ set z(num value) native;
}
// 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
@@ -3600,13 +3856,15 @@
static const int VIEWPORT_RULE = 15;
- String cssText;
+ String get cssText native;
- final CssRule parentRule;
+ set cssText(String value) native;
- final CssStyleSheet parentStyleSheet;
+ CssRule get parentRule native;
- final int type;
+ CssStyleSheet get parentStyleSheet native;
+
+ int get type native;
}
// 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
@@ -3632,11 +3890,17 @@
static CssScale _create_2(x, y, z) =>
JS('CssScale', 'new CSSScale(#,#,#)', x, y, z);
- num x;
+ num get x native;
- num y;
+ set x(num value) native;
- num z;
+ num get y native;
+
+ set y(num value) native;
+
+ num get z native;
+
+ set z(num value) native;
}
// 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
@@ -3654,9 +3918,13 @@
}
static CssSkew _create_1(ax, ay) => JS('CssSkew', 'new CSSSkew(#,#)', ax, ay);
- CssNumericValue ax;
+ CssNumericValue get ax native;
- CssNumericValue ay;
+ set ax(CssNumericValue value) native;
+
+ CssNumericValue get ay native;
+
+ set ay(CssNumericValue value) native;
}
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
@@ -3685,8 +3953,7 @@
///
/// Please note the property name uses camelCase, not-hyphens.
String getPropertyValue(String propertyName) {
- var propValue = _getPropertyValueHelper(propertyName);
- return propValue ?? '';
+ return _getPropertyValueHelper(propertyName);
}
String _getPropertyValueHelper(String propertyName) {
@@ -3770,13 +4037,17 @@
throw new UnsupportedError("Not supported");
}
- String cssFloat;
+ String get cssFloat native;
- String cssText;
+ set cssFloat(String value) native;
- final int length;
+ String get cssText native;
- final CssRule parentRule;
+ set cssText(String value) native;
+
+ int get length native;
+
+ CssRule get parentRule native;
String getPropertyPriority(String property) native;
@@ -3797,7 +4068,10 @@
@Returns('String')
@JSName('background')
- String _background;
+ String get _background native;
+
+ @JSName('background')
+ set _background(String value) native;
/** Gets the value of "background-attachment" */
String get backgroundAttachment => this._backgroundAttachment;
@@ -3809,7 +4083,10 @@
@Returns('String')
@JSName('backgroundAttachment')
- String _backgroundAttachment;
+ String get _backgroundAttachment native;
+
+ @JSName('backgroundAttachment')
+ set _backgroundAttachment(String value) native;
/** Gets the value of "background-color" */
String get backgroundColor => this._backgroundColor;
@@ -3821,7 +4098,10 @@
@Returns('String')
@JSName('backgroundColor')
- String _backgroundColor;
+ String get _backgroundColor native;
+
+ @JSName('backgroundColor')
+ set _backgroundColor(String value) native;
/** Gets the value of "background-image" */
String get backgroundImage => this._backgroundImage;
@@ -3833,7 +4113,10 @@
@Returns('String')
@JSName('backgroundImage')
- String _backgroundImage;
+ String get _backgroundImage native;
+
+ @JSName('backgroundImage')
+ set _backgroundImage(String value) native;
/** Gets the value of "background-position" */
String get backgroundPosition => this._backgroundPosition;
@@ -3845,7 +4128,10 @@
@Returns('String')
@JSName('backgroundPosition')
- String _backgroundPosition;
+ String get _backgroundPosition native;
+
+ @JSName('backgroundPosition')
+ set _backgroundPosition(String value) native;
/** Gets the value of "background-repeat" */
String get backgroundRepeat => this._backgroundRepeat;
@@ -3857,7 +4143,10 @@
@Returns('String')
@JSName('backgroundRepeat')
- String _backgroundRepeat;
+ String get _backgroundRepeat native;
+
+ @JSName('backgroundRepeat')
+ set _backgroundRepeat(String value) native;
/** Gets the value of "border" */
String get border => this._border;
@@ -3869,7 +4158,10 @@
@Returns('String')
@JSName('border')
- String _border;
+ String get _border native;
+
+ @JSName('border')
+ set _border(String value) native;
/** Gets the value of "border-bottom" */
String get borderBottom => this._borderBottom;
@@ -3881,7 +4173,10 @@
@Returns('String')
@JSName('borderBottom')
- String _borderBottom;
+ String get _borderBottom native;
+
+ @JSName('borderBottom')
+ set _borderBottom(String value) native;
/** Gets the value of "border-bottom-color" */
String get borderBottomColor => this._borderBottomColor;
@@ -3893,7 +4188,10 @@
@Returns('String')
@JSName('borderBottomColor')
- String _borderBottomColor;
+ String get _borderBottomColor native;
+
+ @JSName('borderBottomColor')
+ set _borderBottomColor(String value) native;
/** Gets the value of "border-bottom-style" */
String get borderBottomStyle => this._borderBottomStyle;
@@ -3905,7 +4203,10 @@
@Returns('String')
@JSName('borderBottomStyle')
- String _borderBottomStyle;
+ String get _borderBottomStyle native;
+
+ @JSName('borderBottomStyle')
+ set _borderBottomStyle(String value) native;
/** Gets the value of "border-bottom-width" */
String get borderBottomWidth => this._borderBottomWidth;
@@ -3917,7 +4218,10 @@
@Returns('String')
@JSName('borderBottomWidth')
- String _borderBottomWidth;
+ String get _borderBottomWidth native;
+
+ @JSName('borderBottomWidth')
+ set _borderBottomWidth(String value) native;
/** Gets the value of "border-collapse" */
String get borderCollapse => this._borderCollapse;
@@ -3929,7 +4233,10 @@
@Returns('String')
@JSName('borderCollapse')
- String _borderCollapse;
+ String get _borderCollapse native;
+
+ @JSName('borderCollapse')
+ set _borderCollapse(String value) native;
/** Gets the value of "border-color" */
String get borderColor => this._borderColor;
@@ -3941,7 +4248,10 @@
@Returns('String')
@JSName('borderColor')
- String _borderColor;
+ String get _borderColor native;
+
+ @JSName('borderColor')
+ set _borderColor(String value) native;
/** Gets the value of "border-left" */
String get borderLeft => this._borderLeft;
@@ -3953,7 +4263,10 @@
@Returns('String')
@JSName('borderLeft')
- String _borderLeft;
+ String get _borderLeft native;
+
+ @JSName('borderLeft')
+ set _borderLeft(String value) native;
/** Gets the value of "border-left-color" */
String get borderLeftColor => this._borderLeftColor;
@@ -3965,7 +4278,10 @@
@Returns('String')
@JSName('borderLeftColor')
- String _borderLeftColor;
+ String get _borderLeftColor native;
+
+ @JSName('borderLeftColor')
+ set _borderLeftColor(String value) native;
/** Gets the value of "border-left-style" */
String get borderLeftStyle => this._borderLeftStyle;
@@ -3977,7 +4293,10 @@
@Returns('String')
@JSName('borderLeftStyle')
- String _borderLeftStyle;
+ String get _borderLeftStyle native;
+
+ @JSName('borderLeftStyle')
+ set _borderLeftStyle(String value) native;
/** Gets the value of "border-left-width" */
String get borderLeftWidth => this._borderLeftWidth;
@@ -3989,7 +4308,10 @@
@Returns('String')
@JSName('borderLeftWidth')
- String _borderLeftWidth;
+ String get _borderLeftWidth native;
+
+ @JSName('borderLeftWidth')
+ set _borderLeftWidth(String value) native;
/** Gets the value of "border-right" */
String get borderRight => this._borderRight;
@@ -4001,7 +4323,10 @@
@Returns('String')
@JSName('borderRight')
- String _borderRight;
+ String get _borderRight native;
+
+ @JSName('borderRight')
+ set _borderRight(String value) native;
/** Gets the value of "border-right-color" */
String get borderRightColor => this._borderRightColor;
@@ -4013,7 +4338,10 @@
@Returns('String')
@JSName('borderRightColor')
- String _borderRightColor;
+ String get _borderRightColor native;
+
+ @JSName('borderRightColor')
+ set _borderRightColor(String value) native;
/** Gets the value of "border-right-style" */
String get borderRightStyle => this._borderRightStyle;
@@ -4025,7 +4353,10 @@
@Returns('String')
@JSName('borderRightStyle')
- String _borderRightStyle;
+ String get _borderRightStyle native;
+
+ @JSName('borderRightStyle')
+ set _borderRightStyle(String value) native;
/** Gets the value of "border-right-width" */
String get borderRightWidth => this._borderRightWidth;
@@ -4037,7 +4368,10 @@
@Returns('String')
@JSName('borderRightWidth')
- String _borderRightWidth;
+ String get _borderRightWidth native;
+
+ @JSName('borderRightWidth')
+ set _borderRightWidth(String value) native;
/** Gets the value of "border-spacing" */
String get borderSpacing => this._borderSpacing;
@@ -4049,7 +4383,10 @@
@Returns('String')
@JSName('borderSpacing')
- String _borderSpacing;
+ String get _borderSpacing native;
+
+ @JSName('borderSpacing')
+ set _borderSpacing(String value) native;
/** Gets the value of "border-style" */
String get borderStyle => this._borderStyle;
@@ -4061,7 +4398,10 @@
@Returns('String')
@JSName('borderStyle')
- String _borderStyle;
+ String get _borderStyle native;
+
+ @JSName('borderStyle')
+ set _borderStyle(String value) native;
/** Gets the value of "border-top" */
String get borderTop => this._borderTop;
@@ -4073,7 +4413,10 @@
@Returns('String')
@JSName('borderTop')
- String _borderTop;
+ String get _borderTop native;
+
+ @JSName('borderTop')
+ set _borderTop(String value) native;
/** Gets the value of "border-top-color" */
String get borderTopColor => this._borderTopColor;
@@ -4085,7 +4428,10 @@
@Returns('String')
@JSName('borderTopColor')
- String _borderTopColor;
+ String get _borderTopColor native;
+
+ @JSName('borderTopColor')
+ set _borderTopColor(String value) native;
/** Gets the value of "border-top-style" */
String get borderTopStyle => this._borderTopStyle;
@@ -4097,7 +4443,10 @@
@Returns('String')
@JSName('borderTopStyle')
- String _borderTopStyle;
+ String get _borderTopStyle native;
+
+ @JSName('borderTopStyle')
+ set _borderTopStyle(String value) native;
/** Gets the value of "border-top-width" */
String get borderTopWidth => this._borderTopWidth;
@@ -4109,7 +4458,10 @@
@Returns('String')
@JSName('borderTopWidth')
- String _borderTopWidth;
+ String get _borderTopWidth native;
+
+ @JSName('borderTopWidth')
+ set _borderTopWidth(String value) native;
/** Gets the value of "border-width" */
String get borderWidth => this._borderWidth;
@@ -4121,7 +4473,10 @@
@Returns('String')
@JSName('borderWidth')
- String _borderWidth;
+ String get _borderWidth native;
+
+ @JSName('borderWidth')
+ set _borderWidth(String value) native;
/** Gets the value of "bottom" */
String get bottom => this._bottom;
@@ -4133,7 +4488,10 @@
@Returns('String')
@JSName('bottom')
- String _bottom;
+ String get _bottom native;
+
+ @JSName('bottom')
+ set _bottom(String value) native;
/** Gets the value of "caption-side" */
String get captionSide => this._captionSide;
@@ -4145,7 +4503,10 @@
@Returns('String')
@JSName('captionSide')
- String _captionSide;
+ String get _captionSide native;
+
+ @JSName('captionSide')
+ set _captionSide(String value) native;
/** Gets the value of "clear" */
String get clear => this._clear;
@@ -4157,7 +4518,10 @@
@Returns('String')
@JSName('clear')
- String _clear;
+ String get _clear native;
+
+ @JSName('clear')
+ set _clear(String value) native;
/** Gets the value of "clip" */
String get clip => this._clip;
@@ -4169,7 +4533,10 @@
@Returns('String')
@JSName('clip')
- String _clip;
+ String get _clip native;
+
+ @JSName('clip')
+ set _clip(String value) native;
/** Gets the value of "color" */
String get color => this._color;
@@ -4181,7 +4548,10 @@
@Returns('String')
@JSName('color')
- String _color;
+ String get _color native;
+
+ @JSName('color')
+ set _color(String value) native;
/** Gets the value of "content" */
String get content => this._content;
@@ -4193,7 +4563,10 @@
@Returns('String')
@JSName('content')
- String _content;
+ String get _content native;
+
+ @JSName('content')
+ set _content(String value) native;
/** Gets the value of "cursor" */
String get cursor => this._cursor;
@@ -4205,7 +4578,10 @@
@Returns('String')
@JSName('cursor')
- String _cursor;
+ String get _cursor native;
+
+ @JSName('cursor')
+ set _cursor(String value) native;
/** Gets the value of "direction" */
String get direction => this._direction;
@@ -4217,7 +4593,10 @@
@Returns('String')
@JSName('direction')
- String _direction;
+ String get _direction native;
+
+ @JSName('direction')
+ set _direction(String value) native;
/** Gets the value of "display" */
String get display => this._display;
@@ -4229,7 +4608,10 @@
@Returns('String')
@JSName('display')
- String _display;
+ String get _display native;
+
+ @JSName('display')
+ set _display(String value) native;
/** Gets the value of "empty-cells" */
String get emptyCells => this._emptyCells;
@@ -4241,7 +4623,10 @@
@Returns('String')
@JSName('emptyCells')
- String _emptyCells;
+ String get _emptyCells native;
+
+ @JSName('emptyCells')
+ set _emptyCells(String value) native;
/** Gets the value of "font" */
String get font => this._font;
@@ -4253,7 +4638,10 @@
@Returns('String')
@JSName('font')
- String _font;
+ String get _font native;
+
+ @JSName('font')
+ set _font(String value) native;
/** Gets the value of "font-family" */
String get fontFamily => this._fontFamily;
@@ -4265,7 +4653,10 @@
@Returns('String')
@JSName('fontFamily')
- String _fontFamily;
+ String get _fontFamily native;
+
+ @JSName('fontFamily')
+ set _fontFamily(String value) native;
/** Gets the value of "font-size" */
String get fontSize => this._fontSize;
@@ -4277,7 +4668,10 @@
@Returns('String')
@JSName('fontSize')
- String _fontSize;
+ String get _fontSize native;
+
+ @JSName('fontSize')
+ set _fontSize(String value) native;
/** Gets the value of "font-style" */
String get fontStyle => this._fontStyle;
@@ -4289,7 +4683,10 @@
@Returns('String')
@JSName('fontStyle')
- String _fontStyle;
+ String get _fontStyle native;
+
+ @JSName('fontStyle')
+ set _fontStyle(String value) native;
/** Gets the value of "font-variant" */
String get fontVariant => this._fontVariant;
@@ -4301,7 +4698,10 @@
@Returns('String')
@JSName('fontVariant')
- String _fontVariant;
+ String get _fontVariant native;
+
+ @JSName('fontVariant')
+ set _fontVariant(String value) native;
/** Gets the value of "font-weight" */
String get fontWeight => this._fontWeight;
@@ -4313,7 +4713,10 @@
@Returns('String')
@JSName('fontWeight')
- String _fontWeight;
+ String get _fontWeight native;
+
+ @JSName('fontWeight')
+ set _fontWeight(String value) native;
/** Gets the value of "height" */
String get height => this._height;
@@ -4325,7 +4728,10 @@
@Returns('String')
@JSName('height')
- String _height;
+ String get _height native;
+
+ @JSName('height')
+ set _height(String value) native;
/** Gets the value of "left" */
String get left => this._left;
@@ -4337,7 +4743,10 @@
@Returns('String')
@JSName('left')
- String _left;
+ String get _left native;
+
+ @JSName('left')
+ set _left(String value) native;
/** Gets the value of "letter-spacing" */
String get letterSpacing => this._letterSpacing;
@@ -4349,7 +4758,10 @@
@Returns('String')
@JSName('letterSpacing')
- String _letterSpacing;
+ String get _letterSpacing native;
+
+ @JSName('letterSpacing')
+ set _letterSpacing(String value) native;
/** Gets the value of "line-height" */
String get lineHeight => this._lineHeight;
@@ -4361,7 +4773,10 @@
@Returns('String')
@JSName('lineHeight')
- String _lineHeight;
+ String get _lineHeight native;
+
+ @JSName('lineHeight')
+ set _lineHeight(String value) native;
/** Gets the value of "list-style" */
String get listStyle => this._listStyle;
@@ -4373,7 +4788,10 @@
@Returns('String')
@JSName('listStyle')
- String _listStyle;
+ String get _listStyle native;
+
+ @JSName('listStyle')
+ set _listStyle(String value) native;
/** Gets the value of "list-style-image" */
String get listStyleImage => this._listStyleImage;
@@ -4385,7 +4803,10 @@
@Returns('String')
@JSName('listStyleImage')
- String _listStyleImage;
+ String get _listStyleImage native;
+
+ @JSName('listStyleImage')
+ set _listStyleImage(String value) native;
/** Gets the value of "list-style-position" */
String get listStylePosition => this._listStylePosition;
@@ -4397,7 +4818,10 @@
@Returns('String')
@JSName('listStylePosition')
- String _listStylePosition;
+ String get _listStylePosition native;
+
+ @JSName('listStylePosition')
+ set _listStylePosition(String value) native;
/** Gets the value of "list-style-type" */
String get listStyleType => this._listStyleType;
@@ -4409,7 +4833,10 @@
@Returns('String')
@JSName('listStyleType')
- String _listStyleType;
+ String get _listStyleType native;
+
+ @JSName('listStyleType')
+ set _listStyleType(String value) native;
/** Gets the value of "margin" */
String get margin => this._margin;
@@ -4421,7 +4848,10 @@
@Returns('String')
@JSName('margin')
- String _margin;
+ String get _margin native;
+
+ @JSName('margin')
+ set _margin(String value) native;
/** Gets the value of "margin-bottom" */
String get marginBottom => this._marginBottom;
@@ -4433,7 +4863,10 @@
@Returns('String')
@JSName('marginBottom')
- String _marginBottom;
+ String get _marginBottom native;
+
+ @JSName('marginBottom')
+ set _marginBottom(String value) native;
/** Gets the value of "margin-left" */
String get marginLeft => this._marginLeft;
@@ -4445,7 +4878,10 @@
@Returns('String')
@JSName('marginLeft')
- String _marginLeft;
+ String get _marginLeft native;
+
+ @JSName('marginLeft')
+ set _marginLeft(String value) native;
/** Gets the value of "margin-right" */
String get marginRight => this._marginRight;
@@ -4457,7 +4893,10 @@
@Returns('String')
@JSName('marginRight')
- String _marginRight;
+ String get _marginRight native;
+
+ @JSName('marginRight')
+ set _marginRight(String value) native;
/** Gets the value of "margin-top" */
String get marginTop => this._marginTop;
@@ -4469,7 +4908,10 @@
@Returns('String')
@JSName('marginTop')
- String _marginTop;
+ String get _marginTop native;
+
+ @JSName('marginTop')
+ set _marginTop(String value) native;
/** Gets the value of "max-height" */
String get maxHeight => this._maxHeight;
@@ -4481,7 +4923,10 @@
@Returns('String')
@JSName('maxHeight')
- String _maxHeight;
+ String get _maxHeight native;
+
+ @JSName('maxHeight')
+ set _maxHeight(String value) native;
/** Gets the value of "max-width" */
String get maxWidth => this._maxWidth;
@@ -4493,7 +4938,10 @@
@Returns('String')
@JSName('maxWidth')
- String _maxWidth;
+ String get _maxWidth native;
+
+ @JSName('maxWidth')
+ set _maxWidth(String value) native;
/** Gets the value of "min-height" */
String get minHeight => this._minHeight;
@@ -4505,7 +4953,10 @@
@Returns('String')
@JSName('minHeight')
- String _minHeight;
+ String get _minHeight native;
+
+ @JSName('minHeight')
+ set _minHeight(String value) native;
/** Gets the value of "min-width" */
String get minWidth => this._minWidth;
@@ -4517,7 +4968,10 @@
@Returns('String')
@JSName('minWidth')
- String _minWidth;
+ String get _minWidth native;
+
+ @JSName('minWidth')
+ set _minWidth(String value) native;
/** Gets the value of "outline" */
String get outline => this._outline;
@@ -4529,7 +4983,10 @@
@Returns('String')
@JSName('outline')
- String _outline;
+ String get _outline native;
+
+ @JSName('outline')
+ set _outline(String value) native;
/** Gets the value of "outline-color" */
String get outlineColor => this._outlineColor;
@@ -4541,7 +4998,10 @@
@Returns('String')
@JSName('outlineColor')
- String _outlineColor;
+ String get _outlineColor native;
+
+ @JSName('outlineColor')
+ set _outlineColor(String value) native;
/** Gets the value of "outline-style" */
String get outlineStyle => this._outlineStyle;
@@ -4553,7 +5013,10 @@
@Returns('String')
@JSName('outlineStyle')
- String _outlineStyle;
+ String get _outlineStyle native;
+
+ @JSName('outlineStyle')
+ set _outlineStyle(String value) native;
/** Gets the value of "outline-width" */
String get outlineWidth => this._outlineWidth;
@@ -4565,7 +5028,10 @@
@Returns('String')
@JSName('outlineWidth')
- String _outlineWidth;
+ String get _outlineWidth native;
+
+ @JSName('outlineWidth')
+ set _outlineWidth(String value) native;
/** Gets the value of "overflow" */
String get overflow => this._overflow;
@@ -4577,7 +5043,10 @@
@Returns('String')
@JSName('overflow')
- String _overflow;
+ String get _overflow native;
+
+ @JSName('overflow')
+ set _overflow(String value) native;
/** Gets the value of "padding" */
String get padding => this._padding;
@@ -4589,7 +5058,10 @@
@Returns('String')
@JSName('padding')
- String _padding;
+ String get _padding native;
+
+ @JSName('padding')
+ set _padding(String value) native;
/** Gets the value of "padding-bottom" */
String get paddingBottom => this._paddingBottom;
@@ -4601,7 +5073,10 @@
@Returns('String')
@JSName('paddingBottom')
- String _paddingBottom;
+ String get _paddingBottom native;
+
+ @JSName('paddingBottom')
+ set _paddingBottom(String value) native;
/** Gets the value of "padding-left" */
String get paddingLeft => this._paddingLeft;
@@ -4613,7 +5088,10 @@
@Returns('String')
@JSName('paddingLeft')
- String _paddingLeft;
+ String get _paddingLeft native;
+
+ @JSName('paddingLeft')
+ set _paddingLeft(String value) native;
/** Gets the value of "padding-right" */
String get paddingRight => this._paddingRight;
@@ -4625,7 +5103,10 @@
@Returns('String')
@JSName('paddingRight')
- String _paddingRight;
+ String get _paddingRight native;
+
+ @JSName('paddingRight')
+ set _paddingRight(String value) native;
/** Gets the value of "padding-top" */
String get paddingTop => this._paddingTop;
@@ -4637,7 +5118,10 @@
@Returns('String')
@JSName('paddingTop')
- String _paddingTop;
+ String get _paddingTop native;
+
+ @JSName('paddingTop')
+ set _paddingTop(String value) native;
/** Gets the value of "page-break-after" */
String get pageBreakAfter => this._pageBreakAfter;
@@ -4649,7 +5133,10 @@
@Returns('String')
@JSName('pageBreakAfter')
- String _pageBreakAfter;
+ String get _pageBreakAfter native;
+
+ @JSName('pageBreakAfter')
+ set _pageBreakAfter(String value) native;
/** Gets the value of "page-break-before" */
String get pageBreakBefore => this._pageBreakBefore;
@@ -4661,7 +5148,10 @@
@Returns('String')
@JSName('pageBreakBefore')
- String _pageBreakBefore;
+ String get _pageBreakBefore native;
+
+ @JSName('pageBreakBefore')
+ set _pageBreakBefore(String value) native;
/** Gets the value of "page-break-inside" */
String get pageBreakInside => this._pageBreakInside;
@@ -4673,7 +5163,10 @@
@Returns('String')
@JSName('pageBreakInside')
- String _pageBreakInside;
+ String get _pageBreakInside native;
+
+ @JSName('pageBreakInside')
+ set _pageBreakInside(String value) native;
/** Gets the value of "position" */
String get position => this._position;
@@ -4685,7 +5178,10 @@
@Returns('String')
@JSName('position')
- String _position;
+ String get _position native;
+
+ @JSName('position')
+ set _position(String value) native;
/** Gets the value of "quotes" */
String get quotes => this._quotes;
@@ -4697,7 +5193,10 @@
@Returns('String')
@JSName('quotes')
- String _quotes;
+ String get _quotes native;
+
+ @JSName('quotes')
+ set _quotes(String value) native;
/** Gets the value of "right" */
String get right => this._right;
@@ -4709,7 +5208,10 @@
@Returns('String')
@JSName('right')
- String _right;
+ String get _right native;
+
+ @JSName('right')
+ set _right(String value) native;
/** Gets the value of "table-layout" */
String get tableLayout => this._tableLayout;
@@ -4721,7 +5223,10 @@
@Returns('String')
@JSName('tableLayout')
- String _tableLayout;
+ String get _tableLayout native;
+
+ @JSName('tableLayout')
+ set _tableLayout(String value) native;
/** Gets the value of "text-align" */
String get textAlign => this._textAlign;
@@ -4733,7 +5238,10 @@
@Returns('String')
@JSName('textAlign')
- String _textAlign;
+ String get _textAlign native;
+
+ @JSName('textAlign')
+ set _textAlign(String value) native;
/** Gets the value of "text-decoration" */
String get textDecoration => this._textDecoration;
@@ -4745,7 +5253,10 @@
@Returns('String')
@JSName('textDecoration')
- String _textDecoration;
+ String get _textDecoration native;
+
+ @JSName('textDecoration')
+ set _textDecoration(String value) native;
/** Gets the value of "text-indent" */
String get textIndent => this._textIndent;
@@ -4757,7 +5268,10 @@
@Returns('String')
@JSName('textIndent')
- String _textIndent;
+ String get _textIndent native;
+
+ @JSName('textIndent')
+ set _textIndent(String value) native;
/** Gets the value of "text-transform" */
String get textTransform => this._textTransform;
@@ -4769,7 +5283,10 @@
@Returns('String')
@JSName('textTransform')
- String _textTransform;
+ String get _textTransform native;
+
+ @JSName('textTransform')
+ set _textTransform(String value) native;
/** Gets the value of "top" */
String get top => this._top;
@@ -4781,7 +5298,10 @@
@Returns('String')
@JSName('top')
- String _top;
+ String get _top native;
+
+ @JSName('top')
+ set _top(String value) native;
/** Gets the value of "unicode-bidi" */
String get unicodeBidi => this._unicodeBidi;
@@ -4793,7 +5313,10 @@
@Returns('String')
@JSName('unicodeBidi')
- String _unicodeBidi;
+ String get _unicodeBidi native;
+
+ @JSName('unicodeBidi')
+ set _unicodeBidi(String value) native;
/** Gets the value of "vertical-align" */
String get verticalAlign => this._verticalAlign;
@@ -4805,7 +5328,10 @@
@Returns('String')
@JSName('verticalAlign')
- String _verticalAlign;
+ String get _verticalAlign native;
+
+ @JSName('verticalAlign')
+ set _verticalAlign(String value) native;
/** Gets the value of "visibility" */
String get visibility => this._visibility;
@@ -4817,7 +5343,10 @@
@Returns('String')
@JSName('visibility')
- String _visibility;
+ String get _visibility native;
+
+ @JSName('visibility')
+ set _visibility(String value) native;
/** Gets the value of "white-space" */
String get whiteSpace => this._whiteSpace;
@@ -4829,7 +5358,10 @@
@Returns('String')
@JSName('whiteSpace')
- String _whiteSpace;
+ String get _whiteSpace native;
+
+ @JSName('whiteSpace')
+ set _whiteSpace(String value) native;
/** Gets the value of "width" */
String get width => this._width;
@@ -4841,7 +5373,10 @@
@Returns('String')
@JSName('width')
- String _width;
+ String get _width native;
+
+ @JSName('width')
+ set _width(String value) native;
/** Gets the value of "word-spacing" */
String get wordSpacing => this._wordSpacing;
@@ -4853,7 +5388,10 @@
@Returns('String')
@JSName('wordSpacing')
- String _wordSpacing;
+ String get _wordSpacing native;
+
+ @JSName('wordSpacing')
+ set _wordSpacing(String value) native;
/** Gets the value of "z-index" */
String get zIndex => this._zIndex;
@@ -4865,7 +5403,10 @@
@Returns('String')
@JSName('zIndex')
- String _zIndex;
+ String get _zIndex native;
+
+ @JSName('zIndex')
+ set _zIndex(String value) native;
}
class _CssStyleDeclarationSet extends Object with CssStyleDeclarationBase {
@@ -8122,9 +8663,11 @@
throw new UnsupportedError("Not supported");
}
- String selectorText;
+ String get selectorText native;
- final CssStyleDeclaration style;
+ set selectorText(String value) native;
+
+ CssStyleDeclaration get style native;
}
// 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
@@ -8139,13 +8682,13 @@
@Returns('_CssRuleList|Null')
@Creates('_CssRuleList')
- final List<CssRule> cssRules;
+ List<CssRule> get cssRules native;
- final CssRule ownerRule;
+ CssRule get ownerRule native;
@Returns('_CssRuleList|Null')
@Creates('_CssRuleList')
- final List<CssRule> rules;
+ List<CssRule> get rules native;
int addRule(String selector, String style, [int index]) native;
@@ -8190,7 +8733,9 @@
throw new UnsupportedError("Not supported");
}
- bool is2D;
+ bool get is2D native;
+
+ set is2D(bool value) native;
}
// 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
@@ -8217,9 +8762,9 @@
static CssTransformValue _create_2(transformComponents) =>
JS('CssTransformValue', 'new CSSTransformValue(#)', transformComponents);
- final bool is2D;
+ bool get is2D native;
- final int length;
+ int get length native;
CssTransformComponent componentAtIndex(int index) native;
@@ -8253,11 +8798,17 @@
static CssTranslation _create_2(x, y, z) =>
JS('CssTranslation', 'new CSSTranslation(#,#,#)', x, y, z);
- CssNumericValue x;
+ CssNumericValue get x native;
- CssNumericValue y;
+ set x(CssNumericValue value) native;
- CssNumericValue z;
+ CssNumericValue get y native;
+
+ set y(CssNumericValue value) native;
+
+ CssNumericValue get z native;
+
+ set z(CssNumericValue value) native;
}
// 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
@@ -8276,11 +8827,15 @@
static CssUnitValue _create_1(value, unit) =>
JS('CssUnitValue', 'new CSSUnitValue(#,#)', value, unit);
- final String type;
+ String get type native;
- String unit;
+ String get unit native;
- num value;
+ set unit(String value) native;
+
+ num get value native;
+
+ set value(num value) native;
}
// 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
@@ -8293,7 +8848,7 @@
throw new UnsupportedError("Not supported");
}
- final int length;
+ int get length native;
Object fragmentAtIndex(int index) native;
}
@@ -8308,9 +8863,9 @@
throw new UnsupportedError("Not supported");
}
- final CssUnparsedValue fallback;
+ CssUnparsedValue get fallback native;
- final String variable;
+ String get variable native;
}
// 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
@@ -8323,7 +8878,7 @@
throw new UnsupportedError("Not supported");
}
- final CssStyleDeclaration style;
+ CssStyleDeclaration get style native;
}
// 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
@@ -8342,7 +8897,7 @@
static CssurlImageValue _create_1(url) =>
JS('CssurlImageValue', 'new CSSURLImageValue(#)', url);
- final String url;
+ String get url native;
}
// 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
@@ -8440,7 +8995,7 @@
convertNativeToDart_SerializedScriptValue(this._get__detail);
@JSName('detail')
@Creates('Null')
- final dynamic _get__detail;
+ dynamic get _get__detail native;
@JSName('initCustomEvent')
void _initCustomEvent(String type,
@@ -8486,7 +9041,9 @@
*/
DataElement.created() : super.created();
- String value;
+ String get value native;
+
+ set value(String value) native;
}
// 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
@@ -8516,7 +9073,7 @@
@Returns('HtmlCollection|Null')
@Creates('HtmlCollection')
- final List<Node> options;
+ List<Node> get options native;
}
// 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
@@ -8534,17 +9091,21 @@
}
static DataTransfer _create_1() => JS('DataTransfer', 'new DataTransfer()');
- String dropEffect;
+ String get dropEffect native;
- String effectAllowed;
+ set dropEffect(String value) native;
+
+ String get effectAllowed native;
+
+ set effectAllowed(String value) native;
@Returns('FileList|Null')
@Creates('FileList')
- final List<File> files;
+ List<File> get files native;
- final DataTransferItemList items;
+ DataTransferItemList get items native;
- final List<String> types;
+ List<String> get types native;
void clearData([String format]) native;
@@ -8578,9 +9139,9 @@
throw new UnsupportedError("Not supported");
}
- final String kind;
+ String get kind native;
- final String type;
+ String get type native;
File getAsFile() native;
@@ -8600,7 +9161,7 @@
throw new UnsupportedError("Not supported");
}
- final int length;
+ int get length native;
DataTransferItem add(data_OR_file, [String type]) native;
@@ -8767,11 +9328,11 @@
throw new UnsupportedError("Not supported");
}
- final int lineNumber;
+ int get lineNumber native;
- final String message;
+ String get message native;
- final String sourceFile;
+ String get sourceFile native;
}
// 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
@@ -8797,7 +9358,9 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('details');
- bool open;
+ bool get open native;
+
+ set open(bool value) native;
}
// 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
@@ -8816,11 +9379,11 @@
static DetectedBarcode _create_1() =>
JS('DetectedBarcode', 'new DetectedBarcode()');
- final Rectangle boundingBox;
+ Rectangle get boundingBox native;
- final List cornerPoints;
+ List get cornerPoints native;
- final String rawValue;
+ String get rawValue native;
}
// 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
@@ -8838,9 +9401,9 @@
}
static DetectedFace _create_1() => JS('DetectedFace', 'new DetectedFace()');
- final Rectangle boundingBox;
+ Rectangle get boundingBox native;
- final List landmarks;
+ List get landmarks native;
}
// 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
@@ -8858,11 +9421,11 @@
}
static DetectedText _create_1() => JS('DetectedText', 'new DetectedText()');
- final Rectangle boundingBox;
+ Rectangle get boundingBox native;
- final List cornerPoints;
+ List get cornerPoints native;
- final String rawValue;
+ String get rawValue native;
}
// 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
@@ -8875,11 +9438,11 @@
throw new UnsupportedError("Not supported");
}
- final num x;
+ num get x native;
- final num y;
+ num get y native;
- final num z;
+ num get z native;
}
// 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
@@ -8904,13 +9467,13 @@
static DeviceMotionEvent _create_2(type) =>
JS('DeviceMotionEvent', 'new DeviceMotionEvent(#)', type);
- final DeviceAcceleration acceleration;
+ DeviceAcceleration get acceleration native;
- final DeviceAcceleration accelerationIncludingGravity;
+ DeviceAcceleration get accelerationIncludingGravity native;
- final num interval;
+ num get interval native;
- final DeviceRotationRate rotationRate;
+ DeviceRotationRate get rotationRate native;
}
// 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
@@ -8938,13 +9501,13 @@
static DeviceOrientationEvent _create_2(type) =>
JS('DeviceOrientationEvent', 'new DeviceOrientationEvent(#)', type);
- final bool absolute;
+ bool get absolute native;
- final num alpha;
+ num get alpha native;
- final num beta;
+ num get beta native;
- final num gamma;
+ num get gamma native;
}
// 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
@@ -8957,11 +9520,11 @@
throw new UnsupportedError("Not supported");
}
- final num alpha;
+ num get alpha native;
- final num beta;
+ num get beta native;
- final num gamma;
+ num get gamma native;
}
// 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
@@ -8981,9 +9544,13 @@
*/
DialogElement.created() : super.created();
- bool open;
+ bool get open native;
- String returnValue;
+ set open(bool value) native;
+
+ String get returnValue native;
+
+ set returnValue(String value) native;
void close([String returnValue]) native;
@@ -9287,16 +9854,21 @@
}
static Document _create_1() => JS('Document', 'new Document()');
- final String addressSpace;
+ String get addressSpace native;
@JSName('body')
- HtmlElement _body;
+ HtmlElement get _body native;
- final String contentType;
+ @JSName('body')
+ set _body(HtmlElement value) native;
- String cookie;
+ String get contentType native;
- final ScriptElement currentScript;
+ String get cookie native;
+
+ set cookie(String value) native;
+
+ ScriptElement get currentScript native;
WindowBase get window => _convertNativeToDart_Window(this._get_window);
@JSName('defaultView')
@@ -9304,72 +9876,80 @@
@Returns('Window|=Object')
@Creates('Window|=Object|Null')
@Returns('Window|=Object|Null')
- final dynamic _get_window;
+ dynamic get _get_window native;
- final Element documentElement;
+ Element get documentElement native;
- final String domain;
+ String get domain native;
- final bool fullscreenEnabled;
+ bool get fullscreenEnabled native;
@JSName('head')
- final HeadElement _head;
+ HeadElement get _head native;
- final bool hidden;
+ bool get hidden native;
- final DomImplementation implementation;
+ DomImplementation get implementation native;
@JSName('lastModified')
- final String _lastModified;
+ String get _lastModified native;
- final String origin;
+ String get origin native;
@JSName('preferredStylesheetSet')
- final String _preferredStylesheetSet;
+ String get _preferredStylesheetSet native;
- final String readyState;
+ String get readyState native;
@JSName('referrer')
- final String _referrer;
+ String get _referrer native;
- final SvgSvgElement rootElement;
+ SvgSvgElement get rootElement native;
- Element rootScroller;
+ Element get rootScroller native;
- final Element scrollingElement;
+ set rootScroller(Element value) native;
+
+ Element get scrollingElement native;
@JSName('selectedStylesheetSet')
- String _selectedStylesheetSet;
+ String get _selectedStylesheetSet native;
- final String suborigin;
+ @JSName('selectedStylesheetSet')
+ set _selectedStylesheetSet(String value) native;
- final DocumentTimeline timeline;
+ String get suborigin native;
+
+ DocumentTimeline get timeline native;
@JSName('title')
- String _title;
+ String get _title native;
+
+ @JSName('title')
+ set _title(String value) native;
@JSName('visibilityState')
- final String _visibilityState;
+ String get _visibilityState native;
@JSName('webkitFullscreenElement')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final Element _webkitFullscreenElement;
+ Element get _webkitFullscreenElement native;
@JSName('webkitFullscreenEnabled')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final bool _webkitFullscreenEnabled;
+ bool get _webkitFullscreenEnabled native;
@JSName('webkitHidden')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final bool _webkitHidden;
+ bool get _webkitHidden native;
@JSName('webkitVisibilityState')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final String _webkitVisibilityState;
+ String get _webkitVisibilityState native;
Node adoptNode(Node node) native;
@@ -9497,16 +10077,16 @@
// From DocumentOrShadowRoot
- final Element activeElement;
+ Element get activeElement native;
- final Element fullscreenElement;
+ Element get fullscreenElement native;
- final Element pointerLockElement;
+ Element get pointerLockElement native;
@JSName('styleSheets')
@Returns('_StyleSheetList|Null')
@Creates('_StyleSheetList')
- final List<StyleSheet> _styleSheets;
+ List<StyleSheet> get _styleSheets native;
@JSName('elementFromPoint')
Element _elementFromPoint(int x, int y) native;
@@ -9515,23 +10095,23 @@
// From FontFaceSource
- final FontFaceSet fonts;
+ FontFaceSet get fonts native;
// From ParentNode
@JSName('childElementCount')
- final int _childElementCount;
+ int get _childElementCount native;
@JSName('children')
@Returns('HtmlCollection|Null')
@Creates('HtmlCollection')
- final List<Node> _children;
+ List<Node> get _children native;
@JSName('firstElementChild')
- final Element _firstElementChild;
+ Element get _firstElementChild native;
@JSName('lastElementChild')
- final Element _lastElementChild;
+ Element get _lastElementChild native;
/**
* Finds the first descendant element of this document that matches the
@@ -9948,13 +10528,13 @@
// From ParentNode
@JSName('childElementCount')
- final int _childElementCount;
+ int get _childElementCount native;
@JSName('firstElementChild')
- final Element _firstElementChild;
+ Element get _firstElementChild native;
@JSName('lastElementChild')
- final Element _lastElementChild;
+ Element get _lastElementChild native;
/**
* Finds the first descendant element of this document fragment that matches
@@ -9986,15 +10566,15 @@
throw new UnsupportedError("Not supported");
}
- final Element activeElement;
+ Element get activeElement native;
- final Element fullscreenElement;
+ Element get fullscreenElement native;
- final Element pointerLockElement;
+ Element get pointerLockElement native;
@Returns('_StyleSheetList|Null')
@Creates('_StyleSheetList')
- final List<StyleSheet> styleSheets;
+ List<StyleSheet> get styleSheets native;
Element elementFromPoint(int x, int y) native;
@@ -10046,9 +10626,9 @@
JS('DomError', 'new DOMError(#,#)', name, message);
static DomError _create_2(name) => JS('DomError', 'new DOMError(#)', name);
- final String message;
+ String get message native;
- final String name;
+ String get name native;
}
// 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
@@ -10106,7 +10686,7 @@
throw new UnsupportedError("Not supported");
}
- final String message;
+ String get message native;
String toString() => JS('String', 'String(#)', this);
}
@@ -10167,179 +10747,135 @@
// Shadowing definition.
- num get a => JS("num", "#.a", this);
+ num get a native;
- set a(num value) {
- JS("void", "#.a = #", this, value);
- }
+ set a(num value) native;
// Shadowing definition.
- num get b => JS("num", "#.b", this);
+ num get b native;
- set b(num value) {
- JS("void", "#.b = #", this, value);
- }
+ set b(num value) native;
// Shadowing definition.
- num get c => JS("num", "#.c", this);
+ num get c native;
- set c(num value) {
- JS("void", "#.c = #", this, value);
- }
+ set c(num value) native;
// Shadowing definition.
- num get d => JS("num", "#.d", this);
+ num get d native;
- set d(num value) {
- JS("void", "#.d = #", this, value);
- }
+ set d(num value) native;
// Shadowing definition.
- num get e => JS("num", "#.e", this);
+ num get e native;
- set e(num value) {
- JS("void", "#.e = #", this, value);
- }
+ set e(num value) native;
// Shadowing definition.
- num get f => JS("num", "#.f", this);
+ num get f native;
- set f(num value) {
- JS("void", "#.f = #", this, value);
- }
+ set f(num value) native;
// Shadowing definition.
- num get m11 => JS("num", "#.m11", this);
+ num get m11 native;
- set m11(num value) {
- JS("void", "#.m11 = #", this, value);
- }
+ set m11(num value) native;
// Shadowing definition.
- num get m12 => JS("num", "#.m12", this);
+ num get m12 native;
- set m12(num value) {
- JS("void", "#.m12 = #", this, value);
- }
+ set m12(num value) native;
// Shadowing definition.
- num get m13 => JS("num", "#.m13", this);
+ num get m13 native;
- set m13(num value) {
- JS("void", "#.m13 = #", this, value);
- }
+ set m13(num value) native;
// Shadowing definition.
- num get m14 => JS("num", "#.m14", this);
+ num get m14 native;
- set m14(num value) {
- JS("void", "#.m14 = #", this, value);
- }
+ set m14(num value) native;
// Shadowing definition.
- num get m21 => JS("num", "#.m21", this);
+ num get m21 native;
- set m21(num value) {
- JS("void", "#.m21 = #", this, value);
- }
+ set m21(num value) native;
// Shadowing definition.
- num get m22 => JS("num", "#.m22", this);
+ num get m22 native;
- set m22(num value) {
- JS("void", "#.m22 = #", this, value);
- }
+ set m22(num value) native;
// Shadowing definition.
- num get m23 => JS("num", "#.m23", this);
+ num get m23 native;
- set m23(num value) {
- JS("void", "#.m23 = #", this, value);
- }
+ set m23(num value) native;
// Shadowing definition.
- num get m24 => JS("num", "#.m24", this);
+ num get m24 native;
- set m24(num value) {
- JS("void", "#.m24 = #", this, value);
- }
+ set m24(num value) native;
// Shadowing definition.
- num get m31 => JS("num", "#.m31", this);
+ num get m31 native;
- set m31(num value) {
- JS("void", "#.m31 = #", this, value);
- }
+ set m31(num value) native;
// Shadowing definition.
- num get m32 => JS("num", "#.m32", this);
+ num get m32 native;
- set m32(num value) {
- JS("void", "#.m32 = #", this, value);
- }
+ set m32(num value) native;
// Shadowing definition.
- num get m33 => JS("num", "#.m33", this);
+ num get m33 native;
- set m33(num value) {
- JS("void", "#.m33 = #", this, value);
- }
+ set m33(num value) native;
// Shadowing definition.
- num get m34 => JS("num", "#.m34", this);
+ num get m34 native;
- set m34(num value) {
- JS("void", "#.m34 = #", this, value);
- }
+ set m34(num value) native;
// Shadowing definition.
- num get m41 => JS("num", "#.m41", this);
+ num get m41 native;
- set m41(num value) {
- JS("void", "#.m41 = #", this, value);
- }
+ set m41(num value) native;
// Shadowing definition.
- num get m42 => JS("num", "#.m42", this);
+ num get m42 native;
- set m42(num value) {
- JS("void", "#.m42 = #", this, value);
- }
+ set m42(num value) native;
// Shadowing definition.
- num get m43 => JS("num", "#.m43", this);
+ num get m43 native;
- set m43(num value) {
- JS("void", "#.m43 = #", this, value);
- }
+ set m43(num value) native;
// Shadowing definition.
- num get m44 => JS("num", "#.m44", this);
+ num get m44 native;
- set m44(num value) {
- JS("void", "#.m44 = #", this, value);
- }
+ set m44(num value) native;
static DomMatrix fromFloat32Array(Float32List array32) native;
@@ -10433,53 +10969,53 @@
static DomMatrixReadOnly _create_2() =>
JS('DomMatrixReadOnly', 'new DOMMatrixReadOnly()');
- num get a => JS("num", "#.a", this);
+ num get a native;
- num get b => JS("num", "#.b", this);
+ num get b native;
- num get c => JS("num", "#.c", this);
+ num get c native;
- num get d => JS("num", "#.d", this);
+ num get d native;
- num get e => JS("num", "#.e", this);
+ num get e native;
- num get f => JS("num", "#.f", this);
+ num get f native;
- bool get is2D => JS("bool", "#.is2D", this);
+ bool get is2D native;
- bool get isIdentity => JS("bool", "#.isIdentity", this);
+ bool get isIdentity native;
- num get m11 => JS("num", "#.m11", this);
+ num get m11 native;
- num get m12 => JS("num", "#.m12", this);
+ num get m12 native;
- num get m13 => JS("num", "#.m13", this);
+ num get m13 native;
- num get m14 => JS("num", "#.m14", this);
+ num get m14 native;
- num get m21 => JS("num", "#.m21", this);
+ num get m21 native;
- num get m22 => JS("num", "#.m22", this);
+ num get m22 native;
- num get m23 => JS("num", "#.m23", this);
+ num get m23 native;
- num get m24 => JS("num", "#.m24", this);
+ num get m24 native;
- num get m31 => JS("num", "#.m31", this);
+ num get m31 native;
- num get m32 => JS("num", "#.m32", this);
+ num get m32 native;
- num get m33 => JS("num", "#.m33", this);
+ num get m33 native;
- num get m34 => JS("num", "#.m34", this);
+ num get m34 native;
- num get m41 => JS("num", "#.m41", this);
+ num get m41 native;
- num get m42 => JS("num", "#.m42", this);
+ num get m42 native;
- num get m43 => JS("num", "#.m43", this);
+ num get m43 native;
- num get m44 => JS("num", "#.m44", this);
+ num get m44 native;
DomMatrix flipX() native;
@@ -10614,35 +11150,27 @@
// Shadowing definition.
- num get w => JS("num", "#.w", this);
+ num get w native;
- set w(num value) {
- JS("void", "#.w = #", this, value);
- }
+ set w(num value) native;
// Shadowing definition.
- num get x => JS("num", "#.x", this);
+ num get x native;
- set x(num value) {
- JS("void", "#.x = #", this, value);
- }
+ set x(num value) native;
// Shadowing definition.
- num get y => JS("num", "#.y", this);
+ num get y native;
- set y(num value) {
- JS("void", "#.y = #", this, value);
- }
+ set y(num value) native;
// Shadowing definition.
- num get z => JS("num", "#.z", this);
+ num get z native;
- set z(num value) {
- JS("void", "#.z = #", this, value);
- }
+ set z(num value) native;
static DomPoint fromPoint([Map other]) {
if (other != null) {
@@ -10694,13 +11222,13 @@
static DomPointReadOnly _create_5() =>
JS('DomPointReadOnly', 'new DOMPointReadOnly()');
- num get w => JS("num", "#.w", this);
+ num get w native;
- num get x => JS("num", "#.x", this);
+ num get x native;
- num get y => JS("num", "#.y", this);
+ num get y native;
- num get z => JS("num", "#.z", this);
+ num get z native;
static DomPointReadOnly fromPoint([Map other]) {
if (other != null) {
@@ -10772,13 +11300,13 @@
static DomQuad _create_4(p1) => JS('DomQuad', 'new DOMQuad(#)', p1);
static DomQuad _create_5() => JS('DomQuad', 'new DOMQuad()');
- final DomPoint p1;
+ DomPoint get p1 native;
- final DomPoint p2;
+ DomPoint get p2 native;
- final DomPoint p3;
+ DomPoint get p3 native;
- final DomPoint p4;
+ DomPoint get p4 native;
static DomQuad fromQuad([Map other]) {
if (other != null) {
@@ -10993,21 +11521,21 @@
static DomRectReadOnly _create_5() =>
JS('DomRectReadOnly', 'new DOMRectReadOnly()');
- num get bottom => JS("num", "#.bottom", this);
+ num get bottom native;
- num get height => JS("num", "#.height", this);
+ num get height native;
- num get left => JS("num", "#.left", this);
+ num get left native;
- num get right => JS("num", "#.right", this);
+ num get right native;
- num get top => JS("num", "#.top", this);
+ num get top native;
- num get width => JS("num", "#.width", this);
+ num get width native;
- num get x => JS("num", "#.x", this);
+ num get x native;
- num get y => JS("num", "#.y", this);
+ num get y native;
static DomRectReadOnly fromRect([Map other]) {
if (other != null) {
@@ -11111,9 +11639,11 @@
throw new UnsupportedError("Not supported");
}
- final int length;
+ int get length native;
- String value;
+ String get value native;
+
+ set value(String value) native;
void add(String tokens) native;
@@ -13217,7 +13747,8 @@
String get innerHtml => _innerHtml;
@JSName('innerText')
- String innerText;
+ String get innerText native;
+ set innerText(String value) native;
/**
* This is an ease-of-use accessor for event streams which should only be
@@ -13288,7 +13819,7 @@
return result;
}
- final Element offsetParent;
+ Element get offsetParent native;
int get offsetHeight => JS<num>('num', '#.offsetHeight', this).round();
@@ -13873,9 +14404,13 @@
static const EventStreamProvider<WheelEvent> wheelEvent =
const EventStreamProvider<WheelEvent>('wheel');
- String contentEditable;
+ String get contentEditable native;
- String dir;
+ set contentEditable(String value) native;
+
+ String get dir native;
+
+ set dir(String value) native;
/**
* Indicates whether the element can be dragged and dropped.
@@ -13890,7 +14425,10 @@
* specification](https://html.spec.whatwg.org/multipage/interaction.html#dnd)
* from WHATWG.
*/
- bool draggable;
+
+ bool get draggable native;
+
+ set draggable(bool value) native;
/**
* Indicates whether the element is not relevant to the page's current state.
@@ -13901,25 +14439,38 @@
* specification](https://html.spec.whatwg.org/multipage/interaction.html#the-hidden-attribute)
* from WHATWG.
*/
- bool hidden;
- bool inert;
+ bool get hidden native;
- String inputMode;
+ set hidden(bool value) native;
- // Using property as subclass shadows.
+ bool get inert native;
- bool get isContentEditable => JS("bool", "#.isContentEditable", this);
+ set inert(bool value) native;
- String lang;
+ String get inputMode native;
- bool spellcheck;
+ set inputMode(String value) native;
- final CssStyleDeclaration style;
+ bool get isContentEditable native;
- int tabIndex;
+ String get lang native;
- String title;
+ set lang(String value) native;
+
+ bool get spellcheck native;
+
+ set spellcheck(bool value) native;
+
+ CssStyleDeclaration get style native;
+
+ int get tabIndex native;
+
+ set tabIndex(int value) native;
+
+ String get title native;
+
+ set title(String value) native;
/**
* Specifies whether this element's text content changes when the page is
@@ -13931,7 +14482,10 @@
* attribute](https://html.spec.whatwg.org/multipage/dom.html#the-translate-attribute)
* from WHATWG.
*/
- bool translate;
+
+ bool get translate native;
+
+ set translate(bool value) native;
void blur() native;
@@ -13939,59 +14493,73 @@
void focus() native;
- final AccessibleNode accessibleNode;
+ AccessibleNode get accessibleNode native;
- final SlotElement assignedSlot;
+ SlotElement get assignedSlot native;
@JSName('attributes')
- final _NamedNodeMap _attributes;
+ _NamedNodeMap get _attributes native;
- String className;
+ String get className native;
- final int clientHeight;
+ set className(String value) native;
- final int clientLeft;
+ int get clientHeight native;
- final int clientTop;
+ int get clientLeft native;
- final int clientWidth;
+ int get clientTop native;
- final String computedName;
+ int get clientWidth native;
- final String computedRole;
+ String get computedName native;
- String id;
+ String get computedRole native;
+
+ String get id native;
+
+ set id(String value) native;
@JSName('innerHTML')
- String _innerHtml;
+ String get _innerHtml native;
+
+ @JSName('innerHTML')
+ set _innerHtml(String value) native;
@JSName('localName')
- final String _localName;
+ String get _localName native;
@JSName('namespaceURI')
- final String _namespaceUri;
+ String get _namespaceUri native;
- // Using property as subclass shadows.
-
- String get outerHtml => JS("String", "#.outerHTML", this);
+ @JSName('outerHTML')
+ String get outerHtml native;
@JSName('scrollHeight')
- final int _scrollHeight;
+ int get _scrollHeight native;
@JSName('scrollLeft')
- num _scrollLeft;
+ num get _scrollLeft native;
+
+ @JSName('scrollLeft')
+ set _scrollLeft(num value) native;
@JSName('scrollTop')
- num _scrollTop;
+ num get _scrollTop native;
+
+ @JSName('scrollTop')
+ set _scrollTop(num value) native;
@JSName('scrollWidth')
- final int _scrollWidth;
+ int get _scrollWidth native;
- String slot;
+ String get slot native;
- final StylePropertyMap styleMap;
+ set slot(String value) native;
- final String tagName;
+ StylePropertyMap get styleMap native;
+
+ String get tagName native;
ShadowRoot attachShadow(Map shadowRootInitDict) {
var shadowRootInitDict_1 =
@@ -14206,25 +14774,25 @@
// From NonDocumentTypeChildNode
- final Element nextElementSibling;
+ Element get nextElementSibling native;
- final Element previousElementSibling;
+ Element get previousElementSibling native;
// From ParentNode
@JSName('childElementCount')
- final int _childElementCount;
+ int get _childElementCount native;
@JSName('children')
@Returns('HtmlCollection|Null')
@Creates('HtmlCollection')
- final List<Node> _children;
+ List<Node> get _children native;
@JSName('firstElementChild')
- final Element _firstElementChild;
+ Element get _firstElementChild native;
@JSName('lastElementChild')
- final Element _lastElementChild;
+ Element get _lastElementChild native;
/**
* Finds the first descendant element of this element that matches the
@@ -14613,15 +15181,25 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('embed');
- String height;
+ String get height native;
- String name;
+ set height(String value) native;
- String src;
+ String get name native;
- String type;
+ set name(String value) native;
- String width;
+ String get src native;
+
+ set src(String value) native;
+
+ String get type native;
+
+ set type(String value) native;
+
+ String get width native;
+
+ set width(String value) native;
Node __getter__(String name) native;
@@ -14645,15 +15223,15 @@
throw new UnsupportedError("Not supported");
}
- final FileSystem filesystem;
+ FileSystem get filesystem native;
- final String fullPath;
+ String get fullPath native;
- final bool isDirectory;
+ bool get isDirectory native;
- final bool isFile;
+ bool get isFile native;
- final String name;
+ String get name native;
@JSName('copyTo')
void _copyTo(DirectoryEntry parent,
@@ -14777,16 +15355,16 @@
static ErrorEvent _create_2(type) =>
JS('ErrorEvent', 'new ErrorEvent(#)', type);
- final int colno;
+ int get colno native;
@Creates('Null')
- final Object error;
+ Object get error native;
- final String filename;
+ String get filename native;
- final int lineno;
+ int get lineno native;
- final String message;
+ String get message native;
}
// 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
@@ -14823,7 +15401,8 @@
}
/** The CSS selector involved with event delegation. */
- String _selector;
+ String get _selector native;
+ set _selector(String value) native;
/**
* A pointer to the element whose CSS selector matched within which an event
@@ -14890,34 +15469,34 @@
*/
static const int CAPTURING_PHASE = 1;
- final bool bubbles;
+ bool get bubbles native;
- final bool cancelable;
+ bool get cancelable native;
- final bool composed;
+ bool get composed native;
EventTarget get currentTarget =>
_convertNativeToDart_EventTarget(this._get_currentTarget);
@JSName('currentTarget')
@Creates('Null')
@Returns('EventTarget|=Object|Null')
- final dynamic _get_currentTarget;
+ dynamic get _get_currentTarget native;
- final bool defaultPrevented;
+ bool get defaultPrevented native;
- final int eventPhase;
+ int get eventPhase native;
- final bool isTrusted;
+ bool get isTrusted native;
EventTarget get target => _convertNativeToDart_EventTarget(this._get_target);
@JSName('target')
@Creates('Node')
@Returns('EventTarget|=Object')
- final dynamic _get_target;
+ dynamic get _get_target native;
- final num timeStamp;
+ num get timeStamp native;
- final String type;
+ String get type native;
List<EventTarget> composedPath() native;
@@ -14995,11 +15574,11 @@
static const int OPEN = 1;
- final int readyState;
+ int get readyState native;
- final String url;
+ String get url native;
- final bool withCredentials;
+ bool get withCredentials native;
void close() native;
@@ -15184,17 +15763,17 @@
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final Object data;
+ Object get data native;
- final String lastEventId;
+ String get lastEventId native;
- final String origin;
+ String get origin native;
- final List<MessagePort> ports;
+ List<MessagePort> get ports native;
@Creates('Client|ServiceWorker|MessagePort')
@Returns('Client|ServiceWorker|MessagePort|Null')
- final Object source;
+ Object get source native;
}
// 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
@@ -15255,16 +15834,16 @@
static FederatedCredential _create_1(data) =>
JS('FederatedCredential', 'new FederatedCredential(#)', data);
- final String protocol;
+ String get protocol native;
- final String provider;
+ String get provider native;
// From CredentialUserData
@JSName('iconURL')
- final String iconUrl;
+ String get iconUrl native;
- final String name;
+ String get name native;
}
// 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
@@ -15284,14 +15863,14 @@
static FetchEvent _create_1(type, eventInitDict) =>
JS('FetchEvent', 'new FetchEvent(#,#)', type, eventInitDict);
- final String clientId;
+ String get clientId native;
- final bool isReload;
+ bool get isReload native;
Future get preloadResponse =>
promiseToFuture(JS("", "#.preloadResponse", this));
- final _Request request;
+ _Request get request native;
void respondWith(Future r) native;
}
@@ -15319,23 +15898,27 @@
*/
FieldSetElement.created() : super.created();
- bool disabled;
+ bool get disabled native;
+
+ set disabled(bool value) native;
@Returns('HtmlCollection|Null')
@Creates('HtmlCollection')
- final List<Node> elements;
+ List<Node> get elements native;
- final FormElement form;
+ FormElement get form native;
- String name;
+ String get name native;
- final String type;
+ set name(String value) native;
- final String validationMessage;
+ String get type native;
- final ValidityState validity;
+ String get validationMessage native;
- final bool willValidate;
+ ValidityState get validity native;
+
+ bool get willValidate native;
bool checkValidity() native;
@@ -15366,20 +15949,20 @@
static File _create_2(fileBits, fileName) =>
JS('File', 'new File(#,#)', fileBits, fileName);
- final int lastModified;
+ int get lastModified native;
DateTime get lastModifiedDate =>
convertNativeToDart_DateTime(this._get_lastModifiedDate);
@JSName('lastModifiedDate')
@Creates('Null')
- final dynamic _get_lastModifiedDate;
+ dynamic get _get_lastModifiedDate native;
- final String name;
+ String get name native;
@JSName('webkitRelativePath')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final String relativePath;
+ String get relativePath native;
}
// 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
@@ -15575,9 +16158,9 @@
static const int LOADING = 1;
- final DomException error;
+ DomException get error native;
- final int readyState;
+ int get readyState native;
void abort() native;
@@ -15621,9 +16204,9 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.webkitRequestFileSystem)');
- final String name;
+ String get name native;
- final DirectoryEntry root;
+ DirectoryEntry get root native;
}
// 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
@@ -15703,13 +16286,13 @@
static const int WRITING = 1;
- final DomException error;
+ DomException get error native;
- final int length;
+ int get length native;
- final int position;
+ int get position native;
- final int readyState;
+ int get readyState native;
void abort() native;
@@ -15771,7 +16354,7 @@
_convertNativeToDart_EventTarget(this._get_relatedTarget);
@JSName('relatedTarget')
@Creates('Null')
- final dynamic _get_relatedTarget;
+ dynamic get _get_relatedTarget native;
}
// 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
@@ -15796,26 +16379,42 @@
static FontFace _create_2(family, source) =>
JS('FontFace', 'new FontFace(#,#)', family, source);
- String display;
+ String get display native;
- String family;
+ set display(String value) native;
- String featureSettings;
+ String get family native;
+
+ set family(String value) native;
+
+ String get featureSettings native;
+
+ set featureSettings(String value) native;
Future<FontFace> get loaded =>
promiseToFuture<FontFace>(JS("", "#.loaded", this));
- final String status;
+ String get status native;
- String stretch;
+ String get stretch native;
- String style;
+ set stretch(String value) native;
- String unicodeRange;
+ String get style native;
- String variant;
+ set style(String value) native;
- String weight;
+ String get unicodeRange native;
+
+ set unicodeRange(String value) native;
+
+ String get variant native;
+
+ set variant(String value) native;
+
+ String get weight native;
+
+ set weight(String value) native;
Future<FontFace> load() =>
promiseToFuture<FontFace>(JS("", "#.load()", this));
@@ -15840,7 +16439,7 @@
static const EventStreamProvider<FontFaceSetLoadEvent> loadingErrorEvent =
const EventStreamProvider<FontFaceSetLoadEvent>('loadingerror');
- final String status;
+ String get status native;
FontFaceSet add(FontFace arg) native;
@@ -15888,7 +16487,7 @@
static FontFaceSetLoadEvent _create_2(type) =>
JS('FontFaceSetLoadEvent', 'new FontFaceSetLoadEvent(#)', type);
- final List<FontFace> fontfaces;
+ List<FontFace> get fontfaces native;
}
// 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
@@ -15901,7 +16500,7 @@
throw new UnsupportedError("Not supported");
}
- final FontFaceSet fonts;
+ FontFaceSet get fonts native;
}
// 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
@@ -15921,9 +16520,9 @@
static ForeignFetchEvent _create_1(type, eventInitDict) => JS(
'ForeignFetchEvent', 'new ForeignFetchEvent(#,#)', type, eventInitDict);
- final String origin;
+ String get origin native;
- final _Request request;
+ _Request get request native;
void respondWith(Future r) native;
}
@@ -15992,25 +16591,43 @@
*/
FormElement.created() : super.created();
- String acceptCharset;
+ String get acceptCharset native;
- String action;
+ set acceptCharset(String value) native;
- String autocomplete;
+ String get action native;
- String encoding;
+ set action(String value) native;
- String enctype;
+ String get autocomplete native;
- final int length;
+ set autocomplete(String value) native;
- String method;
+ String get encoding native;
- String name;
+ set encoding(String value) native;
- bool noValidate;
+ String get enctype native;
- String target;
+ set enctype(String value) native;
+
+ int get length native;
+
+ String get method native;
+
+ set method(String value) native;
+
+ String get name native;
+
+ set name(String value) native;
+
+ bool get noValidate native;
+
+ set noValidate(bool value) native;
+
+ String get target native;
+
+ set target(String value) native;
Object __getter__(String name) native;
@@ -16058,27 +16675,27 @@
throw new UnsupportedError("Not supported");
}
- final List<num> axes;
+ List<num> get axes native;
@Creates('JSExtendableArray|GamepadButton')
@Returns('JSExtendableArray')
- final List<GamepadButton> buttons;
+ List<GamepadButton> get buttons native;
- final bool connected;
+ bool get connected native;
- final int displayId;
+ int get displayId native;
- final String hand;
+ String get hand native;
- final String id;
+ String get id native;
- final int index;
+ int get index native;
- final String mapping;
+ String get mapping native;
- final GamepadPose pose;
+ GamepadPose get pose native;
- final int timestamp;
+ int get timestamp native;
}
// 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
@@ -16091,11 +16708,11 @@
throw new UnsupportedError("Not supported");
}
- final bool pressed;
+ bool get pressed native;
- final bool touched;
+ bool get touched native;
- final num value;
+ num get value native;
}
// 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
@@ -16120,7 +16737,7 @@
static GamepadEvent _create_2(type) =>
JS('GamepadEvent', 'new GamepadEvent(#)', type);
- final Gamepad gamepad;
+ Gamepad get gamepad native;
}
// 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
@@ -16133,21 +16750,21 @@
throw new UnsupportedError("Not supported");
}
- final Float32List angularAcceleration;
+ Float32List get angularAcceleration native;
- final Float32List angularVelocity;
+ Float32List get angularVelocity native;
- final bool hasOrientation;
+ bool get hasOrientation native;
- final bool hasPosition;
+ bool get hasPosition native;
- final Float32List linearAcceleration;
+ Float32List get linearAcceleration native;
- final Float32List linearVelocity;
+ Float32List get linearVelocity native;
- final Float32List orientation;
+ Float32List get orientation native;
- final Float32List position;
+ Float32List get position native;
}
// 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
@@ -16307,9 +16924,9 @@
throw new UnsupportedError("Not supported");
}
- final Coordinates coords;
+ Coordinates get coords native;
- final int timestamp;
+ int get timestamp native;
}
// 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
@@ -16640,11 +17257,11 @@
JS('Gyroscope', 'new Gyroscope(#)', sensorOptions);
static Gyroscope _create_2() => JS('Gyroscope', 'new Gyroscope()');
- final num x;
+ num get x native;
- final num y;
+ num get y native;
- final num z;
+ num get z native;
}
// 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
@@ -16669,7 +17286,9 @@
*/
HRElement.created() : super.created();
- String color;
+ String get color native;
+
+ set color(String value) native;
}
// 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
@@ -16714,10 +17333,10 @@
static bool get supported => Device.isEventTypeSupported('HashChangeEvent');
@JSName('newURL')
- final String newUrl;
+ String get newUrl native;
@JSName('oldURL')
- final String oldUrl;
+ String get oldUrl native;
}
// 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
@@ -16836,16 +17455,18 @@
throw new UnsupportedError("Not supported");
}
- final int length;
+ int get length native;
- String scrollRestoration;
+ String get scrollRestoration native;
+
+ set scrollRestoration(String value) native;
dynamic get state =>
convertNativeToDart_SerializedScriptValue(this._get_state);
@JSName('state')
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final dynamic _get_state;
+ dynamic get _get_state native;
void back() native;
@@ -16962,7 +17583,8 @@
throw new UnsupportedError("Not supported");
}
- BodyElement body;
+ BodyElement get body native;
+ set body(BodyElement value) native;
/// UNSTABLE: Chrome-only - create a Range from the given point.
@Unstable()
@@ -17155,27 +17777,47 @@
throw new UnsupportedError("Not supported");
}
- String hash;
+ String get hash native;
- String host;
+ set hash(String value) native;
- String hostname;
+ String get host native;
- String href;
+ set host(String value) native;
- final String origin;
+ String get hostname native;
- String password;
+ set hostname(String value) native;
- String pathname;
+ String get href native;
- String port;
+ set href(String value) native;
- String protocol;
+ String get origin native;
- String search;
+ String get password native;
- String username;
+ set password(String value) native;
+
+ String get pathname native;
+
+ set pathname(String value) native;
+
+ String get port native;
+
+ set port(String value) native;
+
+ String get protocol native;
+
+ set protocol(String value) native;
+
+ String get search native;
+
+ set search(String value) native;
+
+ String get username native;
+
+ set username(String value) native;
}
// 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
@@ -17662,7 +18304,8 @@
* </tr>
* </table>
*/
- final int readyState;
+
+ int get readyState native;
/**
* The data received as a reponse from the request.
@@ -17690,12 +18333,13 @@
@SupportedBrowser(SupportedBrowser.SAFARI)
@Creates(
'NativeByteBuffer|Blob|Document|=Object|JSExtendableArray|String|num')
- final dynamic _get_response;
+ dynamic get _get_response native;
/**
* The response in String form or empty String on failure.
*/
- final String responseText;
+
+ String get responseText native;
/**
* [String] telling the server the desired response format.
@@ -17708,12 +18352,16 @@
* See also: [MDN
* responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype)
*/
- String responseType;
+
+ String get responseType native;
+
+ set responseType(String value) native;
@JSName('responseURL')
- final String responseUrl;
+ String get responseUrl native;
@JSName('responseXML')
+
/**
* The request response, or null on failure.
*
@@ -17721,19 +18369,22 @@
* `text/xml` stream, unless responseType = 'document' and the request is
* synchronous.
*/
- final Document responseXml;
+
+ Document get responseXml native;
/**
* The HTTP result code from the request (200, 404, etc).
* See also: [HTTP Status Codes](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
*/
- final int status;
+
+ int get status native;
/**
* The request response string (such as \"OK\").
* See also: [HTTP Status Codes](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
*/
- final String statusText;
+
+ String get statusText native;
/**
* Length of time in milliseconds before a request is automatically
@@ -17750,14 +18401,17 @@
* * [The timeout attribute](http://www.w3.org/TR/XMLHttpRequest/#the-timeout-attribute)
* from W3C.
*/
- int timeout;
+
+ int get timeout native;
+
+ set timeout(int value) native;
/**
* [EventTarget] that can hold listeners to track the progress of the request.
* The events fired will be members of [HttpRequestUploadEvents].
*/
@Unstable()
- final HttpRequestUpload upload;
+ HttpRequestUpload get upload native;
/**
* True if cross-site requests should use credentials such as cookies
@@ -17765,7 +18419,10 @@
*
* This value is ignored for same-site requests.
*/
- bool withCredentials;
+
+ bool get withCredentials native;
+
+ set withCredentials(bool value) native;
/**
* Stop the current request.
@@ -17990,34 +18647,54 @@
*/
IFrameElement.created() : super.created();
- String allow;
+ String get allow native;
- bool allowFullscreen;
+ set allow(String value) native;
- bool allowPaymentRequest;
+ bool get allowFullscreen native;
+
+ set allowFullscreen(bool value) native;
+
+ bool get allowPaymentRequest native;
+
+ set allowPaymentRequest(bool value) native;
WindowBase get contentWindow =>
_convertNativeToDart_Window(this._get_contentWindow);
@JSName('contentWindow')
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _get_contentWindow;
+ dynamic get _get_contentWindow native;
- String csp;
+ String get csp native;
- String height;
+ set csp(String value) native;
- String name;
+ String get height native;
- String referrerPolicy;
+ set height(String value) native;
- final DomTokenList sandbox;
+ String get name native;
- String src;
+ set name(String value) native;
- String srcdoc;
+ String get referrerPolicy native;
- String width;
+ set referrerPolicy(String value) native;
+
+ DomTokenList get sandbox native;
+
+ String get src native;
+
+ set src(String value) native;
+
+ String get srcdoc native;
+
+ set srcdoc(String value) native;
+
+ String get width native;
+
+ set width(String value) native;
}
// 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
@@ -18030,7 +18707,7 @@
throw new UnsupportedError("Not supported");
}
- final bool didTimeout;
+ bool get didTimeout native;
double timeRemaining() native;
}
@@ -18052,9 +18729,9 @@
throw new UnsupportedError("Not supported");
}
- final int height;
+ int get height native;
- final int width;
+ int get width native;
void close() native;
}
@@ -18069,7 +18746,7 @@
throw new UnsupportedError("Not supported");
}
- final CanvasElement canvas;
+ CanvasElement get canvas native;
void transferFromImageBitmap(ImageBitmap bitmap) native;
}
@@ -18090,7 +18767,7 @@
static ImageCapture _create_1(track) =>
JS('ImageCapture', 'new ImageCapture(#)', track);
- final MediaStreamTrack track;
+ MediaStreamTrack get track native;
Future<PhotoCapabilities> getPhotoCapabilities() =>
promiseToFuture<PhotoCapabilities>(
@@ -18148,11 +18825,11 @@
@Creates('NativeUint8ClampedList')
@Returns('NativeUint8ClampedList')
- final Uint8ClampedList data;
+ Uint8ClampedList get data native;
- final int height;
+ int get height native;
- final int width;
+ int get width native;
}
// 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
@@ -18180,35 +18857,57 @@
*/
ImageElement.created() : super.created();
- String alt;
+ String get alt native;
- String async;
+ set alt(String value) native;
- final bool complete;
+ String get async native;
- String crossOrigin;
+ set async(String value) native;
- final String currentSrc;
+ bool get complete native;
- int height;
+ String get crossOrigin native;
- bool isMap;
+ set crossOrigin(String value) native;
- final int naturalHeight;
+ String get currentSrc native;
- final int naturalWidth;
+ int get height native;
- String referrerPolicy;
+ set height(int value) native;
- String sizes;
+ bool get isMap native;
- String src;
+ set isMap(bool value) native;
- String srcset;
+ int get naturalHeight native;
- String useMap;
+ int get naturalWidth native;
- int width;
+ String get referrerPolicy native;
+
+ set referrerPolicy(String value) native;
+
+ String get sizes native;
+
+ set sizes(String value) native;
+
+ String get src native;
+
+ set src(String value) native;
+
+ String get srcset native;
+
+ set srcset(String value) native;
+
+ String get useMap native;
+
+ set useMap(String value) native;
+
+ int get width native;
+
+ set width(int value) native;
Future decode() => promiseToFuture(JS("", "#.decode()", this));
}
@@ -18237,7 +18936,7 @@
static InputDeviceCapabilities _create_2() =>
JS('InputDeviceCapabilities', 'new InputDeviceCapabilities()');
- final bool firesTouchEvents;
+ bool get firesTouchEvents native;
}
// 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
@@ -18289,101 +18988,177 @@
*/
InputElement.created() : super.created();
- String accept;
+ String get accept native;
- String alt;
+ set accept(String value) native;
- String autocapitalize;
+ String get alt native;
- String autocomplete;
+ set alt(String value) native;
- bool autofocus;
+ String get autocapitalize native;
- String capture;
+ set autocapitalize(String value) native;
- bool checked;
+ String get autocomplete native;
- bool defaultChecked;
+ set autocomplete(String value) native;
- String defaultValue;
+ bool get autofocus native;
- String dirName;
+ set autofocus(bool value) native;
- bool disabled;
+ String get capture native;
+
+ set capture(String value) native;
+
+ bool get checked native;
+
+ set checked(bool value) native;
+
+ bool get defaultChecked native;
+
+ set defaultChecked(bool value) native;
+
+ String get defaultValue native;
+
+ set defaultValue(String value) native;
+
+ String get dirName native;
+
+ set dirName(String value) native;
+
+ bool get disabled native;
+
+ set disabled(bool value) native;
@Returns('FileList|Null')
@Creates('FileList')
- List<File> files;
+ List<File> get files native;
- final FormElement form;
+ set files(List<File> value) native;
- String formAction;
+ FormElement get form native;
- String formEnctype;
+ String get formAction native;
- String formMethod;
+ set formAction(String value) native;
- bool formNoValidate;
+ String get formEnctype native;
- String formTarget;
+ set formEnctype(String value) native;
- int height;
+ String get formMethod native;
- bool incremental;
+ set formMethod(String value) native;
- bool indeterminate;
+ bool get formNoValidate native;
+
+ set formNoValidate(bool value) native;
+
+ String get formTarget native;
+
+ set formTarget(String value) native;
+
+ int get height native;
+
+ set height(int value) native;
+
+ bool get incremental native;
+
+ set incremental(bool value) native;
+
+ bool get indeterminate native;
+
+ set indeterminate(bool value) native;
@Returns('NodeList|Null')
@Creates('NodeList')
- final List<Node> labels;
+ List<Node> get labels native;
- final HtmlElement list;
+ HtmlElement get list native;
- String max;
+ String get max native;
- int maxLength;
+ set max(String value) native;
- String min;
+ int get maxLength native;
- int minLength;
+ set maxLength(int value) native;
- bool multiple;
+ String get min native;
- String name;
+ set min(String value) native;
- String pattern;
+ int get minLength native;
- String placeholder;
+ set minLength(int value) native;
- bool readOnly;
+ bool get multiple native;
- bool required;
+ set multiple(bool value) native;
- String selectionDirection;
+ String get name native;
- int selectionEnd;
+ set name(String value) native;
- int selectionStart;
+ String get pattern native;
- int size;
+ set pattern(String value) native;
- String src;
+ String get placeholder native;
- String step;
+ set placeholder(String value) native;
- String type;
+ bool get readOnly native;
- final String validationMessage;
+ set readOnly(bool value) native;
- final ValidityState validity;
+ bool get required native;
- String value;
+ set required(bool value) native;
+
+ String get selectionDirection native;
+
+ set selectionDirection(String value) native;
+
+ int get selectionEnd native;
+
+ set selectionEnd(int value) native;
+
+ int get selectionStart native;
+
+ set selectionStart(int value) native;
+
+ int get size native;
+
+ set size(int value) native;
+
+ String get src native;
+
+ set src(String value) native;
+
+ String get step native;
+
+ set step(String value) native;
+
+ String get type native;
+
+ set type(String value) native;
+
+ String get validationMessage native;
+
+ ValidityState get validity native;
+
+ String get value native;
+
+ set value(String value) native;
DateTime get valueAsDate =>
convertNativeToDart_DateTime(this._get_valueAsDate);
@JSName('valueAsDate')
@Creates('Null')
- final dynamic _get_valueAsDate;
+ dynamic get _get_valueAsDate native;
set valueAsDate(DateTime value) {
this._set_valueAsDate = convertDartToNative_DateTime(value);
@@ -18393,21 +19168,28 @@
JS("void", "#.valueAsDate = #", this, value);
}
- num valueAsNumber;
+ num get valueAsNumber native;
+
+ set valueAsNumber(num value) native;
@JSName('webkitEntries')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final List<Entry> entries;
+ List<Entry> get entries native;
@JSName('webkitdirectory')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- bool directory;
+ bool get directory native;
- int width;
+ @JSName('webkitdirectory')
+ set directory(bool value) native;
- final bool willValidate;
+ int get width native;
+
+ set width(int value) native;
+
+ bool get willValidate native;
bool checkValidity() native;
@@ -18435,17 +19217,23 @@
* Exposes the functionality common between all InputElement types.
*/
abstract class InputElementBase implements Element {
- bool autofocus;
+ bool get autofocus;
+ set autofocus(bool value);
- bool disabled;
+ bool get disabled;
+ set disabled(bool value);
- bool incremental;
+ bool get incremental;
+ set incremental(bool value);
- bool indeterminate;
+ bool get indeterminate;
+ set indeterminate(bool value);
- String name;
+ String get name;
+ set name(String value);
- String value;
+ String get value;
+ set value(String value);
List<Node> get labels;
@@ -18471,27 +19259,37 @@
* Base interface for all inputs which involve text editing.
*/
abstract class TextInputElementBase implements InputElementBase {
- String autocomplete;
+ String get autocomplete;
+ set autocomplete(String value);
- int maxLength;
+ int get maxLength;
+ set maxLength(int value);
- String pattern;
+ String get pattern;
+ set pattern(String value);
- String placeholder;
+ String get placeholder;
+ set placeholder(String value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
- int size;
+ int get size;
+ set size(int value);
void select();
- String selectionDirection;
+ String get selectionDirection;
+ set selectionDirection(String value);
- int selectionEnd;
+ int get selectionEnd;
+ set selectionEnd(int value);
- int selectionStart;
+ int get selectionStart;
+ set selectionStart(int value);
void setSelectionRange(int start, int end, [String direction]);
}
@@ -18509,7 +19307,8 @@
abstract class SearchInputElement implements TextInputElementBase {
factory SearchInputElement() => new InputElement(type: 'search');
- String dirName;
+ String get dirName;
+ set dirName(String value);
Element get list;
@@ -18525,7 +19324,8 @@
abstract class TextInputElement implements TextInputElementBase {
factory TextInputElement() => new InputElement(type: 'text');
- String dirName;
+ String get dirName;
+ set dirName(String value);
Element get list;
}
@@ -18585,25 +19385,34 @@
abstract class EmailInputElement implements TextInputElementBase {
factory EmailInputElement() => new InputElement(type: 'email');
- String autocomplete;
+ String get autocomplete;
+ set autocomplete(String value);
- bool autofocus;
+ bool get autofocus;
+ set autofocus(bool value);
Element get list;
- int maxLength;
+ int get maxLength;
+ set maxLength(int value);
- bool multiple;
+ bool get multiple;
+ set multiple(bool value);
- String pattern;
+ String get pattern;
+ set pattern(String value);
- String placeholder;
+ String get placeholder;
+ set placeholder(String value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
- int size;
+ int get size;
+ set size(int value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -18624,13 +19433,17 @@
abstract class RangeInputElementBase implements InputElementBase {
Element get list;
- String max;
+ String get max;
+ set max(String value);
- String min;
+ String get min;
+ set min(String value);
- String step;
+ String get step;
+ set step(String value);
- num valueAsNumber;
+ num get valueAsNumber;
+ set valueAsNumber(num value);
void stepDown([int n]);
@@ -18646,11 +19459,14 @@
abstract class DateInputElement implements RangeInputElementBase {
factory DateInputElement() => new InputElement(type: 'date');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -18667,11 +19483,14 @@
abstract class MonthInputElement implements RangeInputElementBase {
factory MonthInputElement() => new InputElement(type: 'month');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -18688,11 +19507,14 @@
abstract class WeekInputElement implements RangeInputElementBase {
factory WeekInputElement() => new InputElement(type: 'week');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -18709,11 +19531,14 @@
abstract class TimeInputElement implements RangeInputElementBase {
factory TimeInputElement() => new InputElement(type: 'time');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -18732,9 +19557,11 @@
factory LocalDateTimeInputElement() =>
new InputElement(type: 'datetime-local');
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -18751,11 +19578,14 @@
abstract class NumberInputElement implements RangeInputElementBase {
factory NumberInputElement() => new InputElement(type: 'number');
- String placeholder;
+ String get placeholder;
+ set placeholder(String value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -18789,9 +19619,11 @@
abstract class CheckboxInputElement implements InputElementBase {
factory CheckboxInputElement() => new InputElement(type: 'checkbox');
- bool checked;
+ bool get checked;
+ set checked(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
}
/**
@@ -18808,9 +19640,11 @@
abstract class RadioButtonInputElement implements InputElementBase {
factory RadioButtonInputElement() => new InputElement(type: 'radio');
- bool checked;
+ bool get checked;
+ set checked(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
}
/**
@@ -18819,11 +19653,14 @@
abstract class FileUploadInputElement implements InputElementBase {
factory FileUploadInputElement() => new InputElement(type: 'file');
- String accept;
+ String get accept;
+ set accept(String value);
- bool multiple;
+ bool get multiple;
+ set multiple(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
List<File> files;
}
@@ -18834,15 +19671,20 @@
abstract class SubmitButtonInputElement implements InputElementBase {
factory SubmitButtonInputElement() => new InputElement(type: 'submit');
- String formAction;
+ String get formAction;
+ set formAction(String value);
- String formEnctype;
+ String get formEnctype;
+ set formEnctype(String value);
- String formMethod;
+ String get formMethod;
+ set formMethod(String value);
- bool formNoValidate;
+ bool get formNoValidate;
+ set formNoValidate(bool value);
- String formTarget;
+ String get formTarget;
+ set formTarget(String value);
}
/**
@@ -18852,23 +19694,32 @@
abstract class ImageButtonInputElement implements InputElementBase {
factory ImageButtonInputElement() => new InputElement(type: 'image');
- String alt;
+ String get alt;
+ set alt(String value);
- String formAction;
+ String get formAction;
+ set formAction(String value);
- String formEnctype;
+ String get formEnctype;
+ set formEnctype(String value);
- String formMethod;
+ String get formMethod;
+ set formMethod(String value);
- bool formNoValidate;
+ bool get formNoValidate;
+ set formNoValidate(bool value);
- String formTarget;
+ String get formTarget;
+ set formTarget(String value);
- int height;
+ int get height;
+ set height(int value);
- String src;
+ String get src;
+ set src(String value);
- int width;
+ int get width;
+ set width(int value);
}
/**
@@ -18945,11 +19796,11 @@
static IntersectionObserver _create_2(callback) =>
JS('IntersectionObserver', 'new IntersectionObserver(#)', callback);
- final Element root;
+ Element get root native;
- final String rootMargin;
+ String get rootMargin native;
- final List<num> thresholds;
+ List<num> get thresholds native;
void disconnect() native;
@@ -18978,19 +19829,19 @@
throw new UnsupportedError("Not supported");
}
- final DomRectReadOnly boundingClientRect;
+ DomRectReadOnly get boundingClientRect native;
- final num intersectionRatio;
+ num get intersectionRatio native;
- final DomRectReadOnly intersectionRect;
+ DomRectReadOnly get intersectionRect native;
- final bool isIntersecting;
+ bool get isIntersecting native;
- final DomRectReadOnly rootBounds;
+ DomRectReadOnly get rootBounds native;
- final Element target;
+ Element get target native;
- final num time;
+ num get time native;
}
// 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
@@ -19003,11 +19854,11 @@
throw new UnsupportedError("Not supported");
}
- final int lineNumber;
+ int get lineNumber native;
- final String message;
+ String get message native;
- final String sourceFile;
+ String get sourceFile native;
}
// 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
@@ -19091,9 +19942,9 @@
}
}
- final int keyCode;
+ int get keyCode native;
- final int charCode;
+ int get charCode native;
int get which => _which;
@@ -19117,29 +19968,29 @@
static const int DOM_KEY_LOCATION_STANDARD = 0x00;
- final bool altKey;
+ bool get altKey native;
@JSName('charCode')
- final int _charCode;
+ int get _charCode native;
- final String code;
+ String get code native;
- final bool ctrlKey;
+ bool get ctrlKey native;
- final bool isComposing;
+ bool get isComposing native;
- final String key;
+ String get key native;
@JSName('keyCode')
- final int _keyCode;
+ int get _keyCode native;
- final int location;
+ int get location native;
- final bool metaKey;
+ bool get metaKey native;
- final bool repeat;
+ bool get repeat native;
- final bool shiftKey;
+ bool get shiftKey native;
bool getModifierState(String keyArg) native;
}
@@ -19215,7 +20066,9 @@
*/
LIElement.created() : super.created();
- int value;
+ int get value native;
+
+ set value(int value) native;
}
// 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
@@ -19240,11 +20093,13 @@
*/
LabelElement.created() : super.created();
- final HtmlElement control;
+ HtmlElement get control native;
- final FormElement form;
+ FormElement get form native;
- String htmlFor;
+ String get htmlFor native;
+
+ set htmlFor(String value) native;
}
// 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
@@ -19269,7 +20124,7 @@
*/
LegendElement.created() : super.created();
- final FormElement form;
+ FormElement get form native;
}
// 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
@@ -19319,35 +20174,57 @@
*/
LinkElement.created() : super.created();
- String as;
+ String get as native;
- String crossOrigin;
+ set as(String value) native;
- bool disabled;
+ String get crossOrigin native;
- String href;
+ set crossOrigin(String value) native;
- String hreflang;
+ bool get disabled native;
- final Document import;
+ set disabled(bool value) native;
- String integrity;
+ String get href native;
- String media;
+ set href(String value) native;
- String referrerPolicy;
+ String get hreflang native;
- String rel;
+ set hreflang(String value) native;
- final DomTokenList relList;
+ Document get import native;
- String scope;
+ String get integrity native;
- final StyleSheet sheet;
+ set integrity(String value) native;
- final DomTokenList sizes;
+ String get media native;
- String type;
+ set media(String value) native;
+
+ String get referrerPolicy native;
+
+ set referrerPolicy(String value) native;
+
+ String get rel native;
+
+ set rel(String value) native;
+
+ DomTokenList get relList native;
+
+ String get scope native;
+
+ set scope(String value) native;
+
+ StyleSheet get sheet native;
+
+ DomTokenList get sizes native;
+
+ String get type native;
+
+ set type(String value) native;
/// Checks if HTML imports are supported on the current platform.
bool get supportsImport {
@@ -19367,25 +20244,43 @@
@Returns('DomStringList|Null')
@Creates('DomStringList')
- final List<String> ancestorOrigins;
+ List<String> get ancestorOrigins native;
- String hash;
+ String get hash native;
- String host;
+ set hash(String value) native;
- String hostname;
+ String get host native;
- String href;
+ set host(String value) native;
- String pathname;
+ String get hostname native;
- String port;
+ set hostname(String value) native;
- String protocol;
+ String get href native;
- String search;
+ set href(String value) native;
- TrustedUrl trustedHref;
+ String get pathname native;
+
+ set pathname(String value) native;
+
+ String get port native;
+
+ set port(String value) native;
+
+ String get protocol native;
+
+ set protocol(String value) native;
+
+ String get search native;
+
+ set search(String value) native;
+
+ TrustedUrl get trustedHref native;
+
+ set trustedHref(TrustedUrl value) native;
void assign([String url]) native;
@@ -19424,11 +20319,11 @@
JS('Magnetometer', 'new Magnetometer(#)', sensorOptions);
static Magnetometer _create_2() => JS('Magnetometer', 'new Magnetometer()');
- final num x;
+ num get x native;
- final num y;
+ num get y native;
- final num z;
+ num get z native;
}
// 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
@@ -19452,9 +20347,11 @@
@Returns('HtmlCollection|Null')
@Creates('HtmlCollection')
- final List<Node> areas;
+ List<Node> get areas native;
- String name;
+ String get name native;
+
+ set name(String value) native;
}
// 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
@@ -19490,11 +20387,11 @@
throw new UnsupportedError("Not supported");
}
- final bool powerEfficient;
+ bool get powerEfficient native;
- final bool smooth;
+ bool get smooth native;
- final bool supported;
+ bool get supported native;
}
// 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
@@ -19507,13 +20404,13 @@
throw new UnsupportedError("Not supported");
}
- final String deviceId;
+ String get deviceId native;
- final String groupId;
+ String get groupId native;
- final String kind;
+ String get kind native;
- final String label;
+ String get label native;
}
// 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
@@ -19572,79 +20469,107 @@
static const int NETWORK_NO_SOURCE = 3;
- final AudioTrackList audioTracks;
+ AudioTrackList get audioTracks native;
- bool autoplay;
+ bool get autoplay native;
- final TimeRanges buffered;
+ set autoplay(bool value) native;
- bool controls;
+ TimeRanges get buffered native;
- final DomTokenList controlsList;
+ bool get controls native;
- String crossOrigin;
+ set controls(bool value) native;
- final String currentSrc;
+ DomTokenList get controlsList native;
- num currentTime;
+ String get crossOrigin native;
- bool defaultMuted;
+ set crossOrigin(String value) native;
- num defaultPlaybackRate;
+ String get currentSrc native;
- bool disableRemotePlayback;
+ num get currentTime native;
- final num duration;
+ set currentTime(num value) native;
- final bool ended;
+ bool get defaultMuted native;
- final MediaError error;
+ set defaultMuted(bool value) native;
- bool loop;
+ num get defaultPlaybackRate native;
- final MediaKeys mediaKeys;
+ set defaultPlaybackRate(num value) native;
- bool muted;
+ bool get disableRemotePlayback native;
- final int networkState;
+ set disableRemotePlayback(bool value) native;
- final bool paused;
+ num get duration native;
- num playbackRate;
+ bool get ended native;
- final TimeRanges played;
+ MediaError get error native;
- String preload;
+ bool get loop native;
- final int readyState;
+ set loop(bool value) native;
- final RemotePlayback remote;
+ MediaKeys get mediaKeys native;
- final TimeRanges seekable;
+ bool get muted native;
- final bool seeking;
+ set muted(bool value) native;
- final String sinkId;
+ int get networkState native;
- String src;
+ bool get paused native;
- MediaStream srcObject;
+ num get playbackRate native;
- final TextTrackList textTracks;
+ set playbackRate(num value) native;
- final VideoTrackList videoTracks;
+ TimeRanges get played native;
- num volume;
+ String get preload native;
+
+ set preload(String value) native;
+
+ int get readyState native;
+
+ RemotePlayback get remote native;
+
+ TimeRanges get seekable native;
+
+ bool get seeking native;
+
+ String get sinkId native;
+
+ String get src native;
+
+ set src(String value) native;
+
+ MediaStream get srcObject native;
+
+ set srcObject(MediaStream value) native;
+
+ TextTrackList get textTracks native;
+
+ VideoTrackList get videoTracks native;
+
+ num get volume native;
+
+ set volume(num value) native;
@JSName('webkitAudioDecodedByteCount')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final int audioDecodedByteCount;
+ int get audioDecodedByteCount native;
@JSName('webkitVideoDecodedByteCount')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final int videoDecodedByteCount;
+ int get videoDecodedByteCount native;
TextTrack addTextTrack(String kind, [String label, String language]) native;
@@ -19691,9 +20616,9 @@
static MediaEncryptedEvent _create_2(type) =>
JS('MediaEncryptedEvent', 'new MediaEncryptedEvent(#)', type);
- final ByteBuffer initData;
+ ByteBuffer get initData native;
- final String initDataType;
+ String get initDataType native;
}
// 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
@@ -19715,9 +20640,9 @@
static const int MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
- final int code;
+ int get code native;
- final String message;
+ String get message native;
}
// 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
@@ -19740,9 +20665,9 @@
type,
eventInitDict);
- final ByteBuffer message;
+ ByteBuffer get message native;
- final String messageType;
+ String get messageType native;
}
// 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
@@ -19760,11 +20685,11 @@
Future<void> get closed => promiseToFuture<void>(JS("", "#.closed", this));
- final num expiration;
+ num get expiration native;
- final MediaKeyStatusMap keyStatuses;
+ MediaKeyStatusMap get keyStatuses native;
- final String sessionId;
+ String get sessionId native;
Future close() => promiseToFuture(JS("", "#.close()", this));
@@ -19793,7 +20718,7 @@
throw new UnsupportedError("Not supported");
}
- final int size;
+ int get size native;
Object get(/*BufferSource*/ keyId) native;
@@ -19810,7 +20735,7 @@
throw new UnsupportedError("Not supported");
}
- final String keySystem;
+ String get keySystem native;
Future createMediaKeys() =>
promiseToFuture(JS("", "#.createMediaKeys()", this));
@@ -19861,7 +20786,7 @@
static MediaKeysPolicy _create_1(init) =>
JS('MediaKeysPolicy', 'new MediaKeysPolicy(#)', init);
- final String minHdcpVersion;
+ String get minHdcpVersion native;
}
// 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
@@ -19875,9 +20800,11 @@
throw new UnsupportedError("Not supported");
}
- final int length;
+ int get length native;
- String mediaText;
+ String get mediaText native;
+
+ set mediaText(String value) native;
void appendMedium(String medium) native;
@@ -19908,13 +20835,21 @@
static MediaMetadata _create_2() =>
JS('MediaMetadata', 'new MediaMetadata()');
- String album;
+ String get album native;
- String artist;
+ set album(String value) native;
- List artwork;
+ String get artist native;
- String title;
+ set artist(String value) native;
+
+ List get artwork native;
+
+ set artwork(List value) native;
+
+ String get title native;
+
+ set title(String value) native;
}
// 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
@@ -19931,9 +20866,9 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- final bool matches;
+ bool get matches native;
- final String media;
+ String get media native;
void addListener(EventListener listener) native;
@@ -19967,9 +20902,9 @@
static MediaQueryListEvent _create_2(type) =>
JS('MediaQueryListEvent', 'new MediaQueryListEvent(#)', type);
- final bool matches;
+ bool get matches native;
- final String media;
+ String get media native;
}
// 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
@@ -20000,15 +20935,15 @@
static MediaRecorder _create_2(stream) =>
JS('MediaRecorder', 'new MediaRecorder(#)', stream);
- final int audioBitsPerSecond;
+ int get audioBitsPerSecond native;
- final String mimeType;
+ String get mimeType native;
- final String state;
+ String get state native;
- final MediaStream stream;
+ MediaStream get stream native;
- final int videoBitsPerSecond;
+ int get videoBitsPerSecond native;
static bool isTypeSupported(String type) native;
@@ -20037,9 +20972,13 @@
throw new UnsupportedError("Not supported");
}
- MediaMetadata metadata;
+ MediaMetadata get metadata native;
- String playbackState;
+ set metadata(MediaMetadata value) native;
+
+ String get playbackState native;
+
+ set playbackState(String value) native;
void setActionHandler(String action, MediaSessionActionHandler handler)
native;
@@ -20062,11 +21001,11 @@
throw new UnsupportedError("Not supported");
}
- final num max;
+ num get max native;
- final num min;
+ num get min native;
- final num step;
+ num get step native;
}
// 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
@@ -20089,13 +21028,15 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.MediaSource)');
- final SourceBufferList activeSourceBuffers;
+ SourceBufferList get activeSourceBuffers native;
- num duration;
+ num get duration native;
- final String readyState;
+ set duration(num value) native;
- final SourceBufferList sourceBuffers;
+ String get readyState native;
+
+ SourceBufferList get sourceBuffers native;
SourceBuffer addSourceBuffer(String type) native;
@@ -20157,9 +21098,9 @@
static MediaStream _create_3(stream_OR_tracks) =>
JS('MediaStream', 'new MediaStream(#)', stream_OR_tracks);
- final bool active;
+ bool get active native;
- final String id;
+ String get id native;
void addTrack(MediaStreamTrack track) native;
@@ -20228,7 +21169,7 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Device.isEventTypeSupported('MediaStreamEvent');
- final MediaStream stream;
+ MediaStream get stream native;
}
// 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
@@ -20269,19 +21210,23 @@
static const EventStreamProvider<Event> unmuteEvent =
const EventStreamProvider<Event>('unmute');
- String contentHint;
+ String get contentHint native;
- bool enabled;
+ set contentHint(String value) native;
- final String id;
+ bool get enabled native;
- final String kind;
+ set enabled(bool value) native;
- final String label;
+ String get id native;
- final bool muted;
+ String get kind native;
- final String readyState;
+ String get label native;
+
+ bool get muted native;
+
+ String get readyState native;
Future applyConstraints([Map constraints]) {
var constraints_dict = null;
@@ -20352,7 +21297,7 @@
static bool get supported =>
Device.isEventTypeSupported('MediaStreamTrackEvent');
- final MediaStreamTrack track;
+ MediaStreamTrack get track native;
}
// 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
@@ -20365,11 +21310,11 @@
throw new UnsupportedError("Not supported");
}
- final int jsHeapSizeLimit;
+ int get jsHeapSizeLimit native;
- final int totalJSHeapSize;
+ int get totalJSHeapSize native;
- final int usedJSHeapSize;
+ int get usedJSHeapSize native;
}
// 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
@@ -20429,9 +21374,9 @@
static MessageChannel _create_1() =>
JS('MessageChannel', 'new MessageChannel()');
- final MessagePort port1;
+ MessagePort get port1 native;
- final MessagePort port2;
+ MessagePort get port2 native;
}
// 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
@@ -20481,7 +21426,7 @@
@JSName('data')
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final dynamic _get_data;
+ dynamic get _get_data native;
factory MessageEvent._(String type, [Map eventInitDict]) {
if (eventInitDict != null) {
@@ -20496,21 +21441,21 @@
JS('MessageEvent', 'new MessageEvent(#)', type);
@Unstable()
- final String lastEventId;
+ String get lastEventId native;
- final String origin;
+ String get origin native;
@Unstable()
@Creates('JSExtendableArray')
- final List<MessagePort> ports;
+ List<MessagePort> get ports native;
EventTarget get source => _convertNativeToDart_EventTarget(this._get_source);
@JSName('source')
@Creates('Null')
@Returns('EventTarget|=Object')
- final dynamic _get_source;
+ dynamic get _get_source native;
- final String suborigin;
+ String get suborigin native;
void _initMessageEvent(
String typeArg,
@@ -20613,11 +21558,17 @@
*/
MetaElement.created() : super.created();
- String content;
+ String get content native;
- String httpEquiv;
+ set content(String value) native;
- String name;
+ String get httpEquiv native;
+
+ set httpEquiv(String value) native;
+
+ String get name native;
+
+ set name(String value) native;
}
// 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
@@ -20634,9 +21585,9 @@
convertNativeToDart_DateTime(this._get_modificationTime);
@JSName('modificationTime')
@Creates('Null')
- final dynamic _get_modificationTime;
+ dynamic get _get_modificationTime native;
- final int size;
+ int get size native;
}
// 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
@@ -20671,22 +21622,34 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('meter');
- num high;
+ num get high native;
+
+ set high(num value) native;
@Unstable()
@Returns('NodeList|Null')
@Creates('NodeList')
- final List<Node> labels;
+ List<Node> get labels native;
- num low;
+ num get low native;
- num max;
+ set low(num value) native;
- num min;
+ num get max native;
- num optimum;
+ set max(num value) native;
- num value;
+ num get min native;
+
+ set min(num value) native;
+
+ num get optimum native;
+
+ set optimum(num value) native;
+
+ num get value native;
+
+ set value(num value) native;
}
// 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
@@ -20699,11 +21662,11 @@
throw new UnsupportedError("Not supported");
}
- final MidiInputMap inputs;
+ MidiInputMap get inputs native;
- final MidiOutputMap outputs;
+ MidiOutputMap get outputs native;
- final bool sysexEnabled;
+ bool get sysexEnabled native;
}
// 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
@@ -20731,7 +21694,7 @@
static MidiConnectionEvent _create_2(type) =>
JS('MidiConnectionEvent', 'new MIDIConnectionEvent(#)', type);
- final MidiPort port;
+ MidiPort get port native;
}
// 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
@@ -20848,7 +21811,7 @@
static MidiMessageEvent _create_2(type) =>
JS('MidiMessageEvent', 'new MIDIMessageEvent(#)', type);
- final Uint8List data;
+ Uint8List get data native;
}
// 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
@@ -20942,19 +21905,19 @@
throw new UnsupportedError("Not supported");
}
- final String connection;
+ String get connection native;
- final String id;
+ String get id native;
- final String manufacturer;
+ String get manufacturer native;
- final String name;
+ String get name native;
- final String state;
+ String get state native;
- final String type;
+ String get type native;
- final String version;
+ String get version native;
Future close() => promiseToFuture(JS("", "#.close()", this));
@@ -20971,13 +21934,13 @@
throw new UnsupportedError("Not supported");
}
- final String description;
+ String get description native;
- final Plugin enabledPlugin;
+ Plugin get enabledPlugin native;
- final String suffixes;
+ String get suffixes native;
- final String type;
+ String get type native;
}
// 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
@@ -21059,9 +22022,13 @@
*/
ModElement.created() : super.created();
- String cite;
+ String get cite native;
- String dateTime;
+ set cite(String value) native;
+
+ String get dateTime native;
+
+ set dateTime(String value) native;
}
// 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
@@ -21126,19 +22093,19 @@
static MouseEvent _create_2(type) =>
JS('MouseEvent', 'new MouseEvent(#)', type);
- final bool altKey;
+ bool get altKey native;
- final int button;
+ int get button native;
- final int buttons;
+ int get buttons native;
@JSName('clientX')
- final num _clientX;
+ num get _clientX native;
@JSName('clientY')
- final num _clientY;
+ num get _clientY native;
- final bool ctrlKey;
+ bool get ctrlKey native;
/**
* The nonstandard way to access the element that the mouse comes
@@ -21148,44 +22115,44 @@
* relatedTarget to get the same information in the standard way.
*/
@deprecated
- final Node fromElement;
+ Node get fromElement native;
@JSName('layerX')
- final int _layerX;
+ int get _layerX native;
@JSName('layerY')
- final int _layerY;
+ int get _layerY native;
- final bool metaKey;
+ bool get metaKey native;
@JSName('movementX')
- final int _movementX;
+ int get _movementX native;
@JSName('movementY')
- final int _movementY;
+ int get _movementY native;
@JSName('pageX')
- final num _pageX;
+ num get _pageX native;
@JSName('pageY')
- final num _pageY;
+ num get _pageY native;
- final String region;
+ String get region native;
EventTarget get relatedTarget =>
_convertNativeToDart_EventTarget(this._get_relatedTarget);
@JSName('relatedTarget')
@Creates('Node')
@Returns('EventTarget|=Object|Null')
- final dynamic _get_relatedTarget;
+ dynamic get _get_relatedTarget native;
@JSName('screenX')
- final num _screenX;
+ num get _screenX native;
@JSName('screenY')
- final num _screenY;
+ num get _screenY native;
- final bool shiftKey;
+ bool get shiftKey native;
/**
* The nonstandard way to access the element that the mouse goes
@@ -21195,7 +22162,7 @@
* relatedTarget to get the same information in the standard way.
*/
@deprecated
- final Node toElement;
+ Node get toElement native;
bool getModifierState(String keyArg) native;
@@ -21317,15 +22284,15 @@
static const int REMOVAL = 3;
- final int attrChange;
+ int get attrChange native;
- final String attrName;
+ String get attrName native;
- final String newValue;
+ String get newValue native;
- final String prevValue;
+ String get prevValue native;
- final Node relatedNode;
+ Node get relatedNode native;
void initMutationEvent(
String type,
@@ -21458,25 +22425,25 @@
@Returns('NodeList|Null')
@Creates('NodeList')
- final List<Node> addedNodes;
+ List<Node> get addedNodes native;
- final String attributeName;
+ String get attributeName native;
- final String attributeNamespace;
+ String get attributeNamespace native;
- final Node nextSibling;
+ Node get nextSibling native;
- final String oldValue;
+ String get oldValue native;
- final Node previousSibling;
+ Node get previousSibling native;
@Returns('NodeList|Null')
@Creates('NodeList')
- final List<Node> removedNodes;
+ List<Node> get removedNodes native;
- final Node target;
+ Node get target native;
- final String type;
+ String get type native;
}
// 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
@@ -21597,61 +22564,61 @@
throw new UnsupportedError("Not supported");
}
- final _BudgetService budget;
+ _BudgetService get budget native;
- final _Clipboard clipboard;
+ _Clipboard get clipboard native;
- final NetworkInformation connection;
+ NetworkInformation get connection native;
- final CredentialsContainer credentials;
+ CredentialsContainer get credentials native;
- final num deviceMemory;
+ num get deviceMemory native;
- final String doNotTrack;
+ String get doNotTrack native;
@Unstable()
- final Geolocation geolocation;
+ Geolocation get geolocation native;
- final int maxTouchPoints;
+ int get maxTouchPoints native;
- final MediaCapabilities mediaCapabilities;
+ MediaCapabilities get mediaCapabilities native;
- final MediaDevices mediaDevices;
+ MediaDevices get mediaDevices native;
- final MediaSession mediaSession;
+ MediaSession get mediaSession native;
- final MimeTypeArray mimeTypes;
+ MimeTypeArray get mimeTypes native;
- final _NFC nfc;
+ _NFC get nfc native;
- final Permissions permissions;
+ Permissions get permissions native;
- final Presentation presentation;
+ Presentation get presentation native;
@Unstable()
- final String productSub;
+ String get productSub native;
- final ServiceWorkerContainer serviceWorker;
+ ServiceWorkerContainer get serviceWorker native;
- final StorageManager storage;
+ StorageManager get storage native;
@Unstable()
- final String vendor;
+ String get vendor native;
@Unstable()
- final String vendorSub;
+ String get vendorSub native;
- final VR vr;
+ VR get vr native;
@JSName('webkitPersistentStorage')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final DeprecatedStorageQuota persistentStorage;
+ DeprecatedStorageQuota get persistentStorage native;
@JSName('webkitTemporaryStorage')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final DeprecatedStorageQuota temporaryStorage;
+ DeprecatedStorageQuota get temporaryStorage native;
void cancelKeyboardLock() native;
@@ -21713,38 +22680,38 @@
// From NavigatorAutomationInformation
- final bool webdriver;
+ bool get webdriver native;
// From NavigatorCookies
@Unstable()
- final bool cookieEnabled;
+ bool get cookieEnabled native;
// From NavigatorID
- final String appCodeName;
+ String get appCodeName native;
- final String appName;
+ String get appName native;
- final String appVersion;
+ String get appVersion native;
- final bool dartEnabled;
+ bool get dartEnabled native;
- final String platform;
+ String get platform native;
@Unstable()
- final String product;
+ String get product native;
- final String userAgent;
+ String get userAgent native;
// From NavigatorLanguage
- final List<String> languages;
+ List<String> get languages native;
// From NavigatorOnLine
@Unstable()
- final bool onLine;
+ bool get onLine native;
}
// 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
@@ -21757,7 +22724,7 @@
throw new UnsupportedError("Not supported");
}
- final bool webdriver;
+ bool get webdriver native;
}
// 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
@@ -21770,7 +22737,7 @@
throw new UnsupportedError("Not supported");
}
- final int hardwareConcurrency;
+ int get hardwareConcurrency native;
}
// 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
@@ -21783,7 +22750,7 @@
throw new UnsupportedError("Not supported");
}
- final bool cookieEnabled;
+ bool get cookieEnabled native;
}
// 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
@@ -21795,19 +22762,19 @@
throw new UnsupportedError("Not supported");
}
- final String appCodeName;
+ String get appCodeName native;
- final String appName;
+ String get appName native;
- final String appVersion;
+ String get appVersion native;
- final bool dartEnabled;
+ bool get dartEnabled native;
- final String platform;
+ String get platform native;
- final String product;
+ String get product native;
- final String userAgent;
+ String get userAgent native;
}
// 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
@@ -21819,9 +22786,9 @@
throw new UnsupportedError("Not supported");
}
- final String language;
+ String get language native;
- final List<String> languages;
+ List<String> get languages native;
}
// 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
@@ -21833,7 +22800,7 @@
throw new UnsupportedError("Not supported");
}
- final bool onLine;
+ bool get onLine native;
}
// 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
@@ -21846,11 +22813,11 @@
throw new UnsupportedError("Not supported");
}
- final String constraintName;
+ String get constraintName native;
- final String message;
+ String get message native;
- final String name;
+ String get name native;
}
// 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
@@ -21880,15 +22847,15 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- final num downlink;
+ num get downlink native;
- final num downlinkMax;
+ num get downlinkMax native;
- final String effectiveType;
+ String get effectiveType native;
- final int rtt;
+ int get rtt native;
- final String type;
+ String get type native;
Stream<Event> get onChange => changeEvent.forTarget(this);
}
@@ -22159,7 +23126,7 @@
*/
@Returns('NodeList')
@Creates('NodeList')
- final List<Node> childNodes;
+ List<Node> get childNodes native;
// To suppress missing implicit constructor warnings.
factory Node._() {
@@ -22191,7 +23158,7 @@
static const int TEXT_NODE = 3;
@JSName('baseURI')
- final String baseUri;
+ String get baseUri native;
/**
* The first child of this node.
@@ -22201,9 +23168,10 @@
* * [Node.firstChild](https://developer.mozilla.org/en-US/docs/Web/API/Node.firstChild)
* from MDN.
*/
- final Node firstChild;
- final bool isConnected;
+ Node get firstChild native;
+
+ bool get isConnected native;
/**
* The last child of this node.
@@ -22213,9 +23181,11 @@
* * [Node.lastChild](https://developer.mozilla.org/en-US/docs/Web/API/Node.lastChild)
* from MDN.
*/
- final Node lastChild;
+
+ Node get lastChild native;
@JSName('nextSibling')
+
/**
* The next sibling node.
*
@@ -22224,7 +23194,8 @@
* * [Node.nextSibling](https://developer.mozilla.org/en-US/docs/Web/API/Node.nextSibling)
* from MDN.
*/
- final Node nextNode;
+
+ Node get nextNode native;
/**
* The name of this node.
@@ -22237,7 +23208,8 @@
* from MDN. This page contains a table of [nodeName] values for each
* [nodeType].
*/
- final String nodeName;
+
+ String get nodeName native;
/**
* The type of node.
@@ -22262,7 +23234,8 @@
* * [Node.nodeType](https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeType)
* from MDN.
*/
- final int nodeType;
+
+ int get nodeType native;
/**
* The value of this node.
@@ -22275,7 +23248,8 @@
* from MDN. This page contains a table of [nodeValue] values for each
* [nodeType].
*/
- final String nodeValue;
+
+ String get nodeValue native;
/**
* The document this node belongs to.
@@ -22287,9 +23261,11 @@
* * [Node.ownerDocument](https://developer.mozilla.org/en-US/docs/Web/API/Node.ownerDocument)
* from MDN.
*/
- final Document ownerDocument;
+
+ Document get ownerDocument native;
@JSName('parentElement')
+
/**
* The parent element of this node.
*
@@ -22301,7 +23277,8 @@
* * [Node.parentElement](https://developer.mozilla.org/en-US/docs/Web/API/Node.parentElement)
* from W3C.
*/
- final Element parent;
+
+ Element get parent native;
/**
* The parent node of this node.
@@ -22311,9 +23288,11 @@
* * [Node.parentNode](https://developer.mozilla.org/en-US/docs/Web/API/Node.parentNode)
* from MDN.
*/
- final Node parentNode;
+
+ Node get parentNode native;
@JSName('previousSibling')
+
/**
* The previous sibling node.
*
@@ -22322,9 +23301,11 @@
* * [Node.previousSibling](https://developer.mozilla.org/en-US/docs/Web/API/Node.previousSibling)
* from MDN.
*/
- final Node previousNode;
+
+ Node get previousNode native;
@JSName('textContent')
+
/**
* All text within this node and its descendents.
*
@@ -22333,7 +23314,11 @@
* * [Node.textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent)
* from MDN.
*/
- String text;
+
+ String get text native;
+
+ @JSName('textContent')
+ set text(String value) native;
@JSName('appendChild')
/**
@@ -22459,13 +23444,13 @@
throw new UnsupportedError("Not supported");
}
- final bool pointerBeforeReferenceNode;
+ bool get pointerBeforeReferenceNode native;
- final Node referenceNode;
+ Node get referenceNode native;
- final Node root;
+ Node get root native;
- final int whatToShow;
+ int get whatToShow native;
void detach() native;
@@ -22545,9 +23530,9 @@
throw new UnsupportedError("Not supported");
}
- final Element nextElementSibling;
+ Element get nextElementSibling native;
- final Element previousElementSibling;
+ Element get previousElementSibling native;
}
// 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
@@ -22573,7 +23558,9 @@
throw new UnsupportedError("Not supported");
}
- String nonce;
+ String get nonce native;
+
+ set nonce(String value) native;
}
// 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
@@ -22648,41 +23635,41 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.Notification)');
- final List actions;
+ List get actions native;
- final String badge;
+ String get badge native;
- final String body;
+ String get body native;
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final Object data;
+ Object get data native;
- final String dir;
+ String get dir native;
- final String icon;
+ String get icon native;
- final String image;
+ String get image native;
- final String lang;
+ String get lang native;
- static final int maxActions;
+ int get maxActions native;
- static final String permission;
+ String get permission native;
- final bool renotify;
+ bool get renotify native;
- final bool requireInteraction;
+ bool get requireInteraction native;
- final bool silent;
+ bool get silent native;
- final String tag;
+ String get tag native;
- final int timestamp;
+ int get timestamp native;
- final String title;
+ String get title native;
- final List<int> vibrate;
+ List<int> get vibrate native;
void close() native;
@@ -22729,11 +23716,11 @@
static NotificationEvent _create_1(type, eventInitDict) => JS(
'NotificationEvent', 'new NotificationEvent(#,#)', type, eventInitDict);
- final String action;
+ String get action native;
- final Notification notification;
+ Notification get notification native;
- final String reply;
+ String get reply native;
}
// 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
@@ -22765,11 +23752,17 @@
*/
OListElement.created() : super.created();
- bool reversed;
+ bool get reversed native;
- int start;
+ set reversed(bool value) native;
- String type;
+ int get start native;
+
+ set start(int value) native;
+
+ String get type native;
+
+ set type(String value) native;
}
// 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
@@ -22802,27 +23795,39 @@
@JSName('contentWindow')
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _get_contentWindow;
+ dynamic get _get_contentWindow native;
- String data;
+ String get data native;
- final FormElement form;
+ set data(String value) native;
- String height;
+ FormElement get form native;
- String name;
+ String get height native;
- String type;
+ set height(String value) native;
- String useMap;
+ String get name native;
- final String validationMessage;
+ set name(String value) native;
- final ValidityState validity;
+ String get type native;
- String width;
+ set type(String value) native;
- final bool willValidate;
+ String get useMap native;
+
+ set useMap(String value) native;
+
+ String get validationMessage native;
+
+ ValidityState get validity native;
+
+ String get width native;
+
+ set width(String value) native;
+
+ bool get willValidate native;
Node __getter__(String name) native;
@@ -22851,9 +23856,13 @@
static OffscreenCanvas _create_1(width, height) =>
JS('OffscreenCanvas', 'new OffscreenCanvas(#,#)', width, height);
- int height;
+ int get height native;
- int width;
+ set height(int value) native;
+
+ int get width native;
+
+ set width(int value) native;
Future<Blob> convertToBlob([Map options]) {
var options_dict = null;
@@ -22891,47 +23900,87 @@
throw new UnsupportedError("Not supported");
}
- final OffscreenCanvas canvas;
+ OffscreenCanvas get canvas native;
- String direction;
+ String get direction native;
- Object fillStyle;
+ set direction(String value) native;
- String filter;
+ Object get fillStyle native;
- String font;
+ set fillStyle(Object value) native;
- num globalAlpha;
+ String get filter native;
- String globalCompositeOperation;
+ set filter(String value) native;
- bool imageSmoothingEnabled;
+ String get font native;
- String imageSmoothingQuality;
+ set font(String value) native;
- String lineCap;
+ num get globalAlpha native;
- num lineDashOffset;
+ set globalAlpha(num value) native;
- String lineJoin;
+ String get globalCompositeOperation native;
- num lineWidth;
+ set globalCompositeOperation(String value) native;
- num miterLimit;
+ bool get imageSmoothingEnabled native;
- num shadowBlur;
+ set imageSmoothingEnabled(bool value) native;
- String shadowColor;
+ String get imageSmoothingQuality native;
- num shadowOffsetX;
+ set imageSmoothingQuality(String value) native;
- num shadowOffsetY;
+ String get lineCap native;
- Object strokeStyle;
+ set lineCap(String value) native;
- String textAlign;
+ num get lineDashOffset native;
- String textBaseline;
+ set lineDashOffset(num value) native;
+
+ String get lineJoin native;
+
+ set lineJoin(String value) native;
+
+ num get lineWidth native;
+
+ set lineWidth(num value) native;
+
+ num get miterLimit native;
+
+ set miterLimit(num value) native;
+
+ num get shadowBlur native;
+
+ set shadowBlur(num value) native;
+
+ String get shadowColor native;
+
+ set shadowColor(String value) native;
+
+ num get shadowOffsetX native;
+
+ set shadowOffsetX(num value) native;
+
+ num get shadowOffsetY native;
+
+ set shadowOffsetY(num value) native;
+
+ Object get strokeStyle native;
+
+ set strokeStyle(Object value) native;
+
+ String get textAlign native;
+
+ set textAlign(String value) native;
+
+ String get textBaseline native;
+
+ set textBaseline(String value) native;
void beginPath() native;
@@ -23128,9 +24177,13 @@
*/
OptGroupElement.created() : super.created();
- bool disabled;
+ bool get disabled native;
- String label;
+ set disabled(bool value) native;
+
+ String get label native;
+
+ set label(String value) native;
}
// 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
@@ -23180,19 +24233,29 @@
*/
OptionElement.created() : super.created();
- bool defaultSelected;
+ bool get defaultSelected native;
- bool disabled;
+ set defaultSelected(bool value) native;
- final FormElement form;
+ bool get disabled native;
- final int index;
+ set disabled(bool value) native;
- String label;
+ FormElement get form native;
- bool selected;
+ int get index native;
- String value;
+ String get label native;
+
+ set label(String value) native;
+
+ bool get selected native;
+
+ set selected(bool value) native;
+
+ String get value native;
+
+ set value(String value) native;
}
// 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
@@ -23205,7 +24268,7 @@
throw new UnsupportedError("Not supported");
}
- final List<num> quaternion;
+ List<num> get quaternion native;
void populateMatrix(Object targetBuffer) native;
}
@@ -23234,28 +24297,34 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('output');
- String defaultValue;
+ String get defaultValue native;
- final FormElement form;
+ set defaultValue(String value) native;
- final DomTokenList htmlFor;
+ FormElement get form native;
+
+ DomTokenList get htmlFor native;
@Unstable()
@Returns('NodeList|Null')
@Creates('NodeList')
- final List<Node> labels;
+ List<Node> get labels native;
- String name;
+ String get name native;
- final String type;
+ set name(String value) native;
- final String validationMessage;
+ String get type native;
- final ValidityState validity;
+ String get validationMessage native;
- String value;
+ ValidityState get validity native;
- final bool willValidate;
+ String get value native;
+
+ set value(String value) native;
+
+ bool get willValidate native;
bool checkValidity() native;
@@ -23283,11 +24352,11 @@
constraint,
message);
- final String constraint;
+ String get constraint native;
- final String message;
+ String get message native;
- final String name;
+ String get name native;
}
// 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
@@ -23315,7 +24384,7 @@
static PageTransitionEvent _create_2(type) =>
JS('PageTransitionEvent', 'new PageTransitionEvent(#)', type);
- final bool persisted;
+ bool get persisted native;
}
// 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
@@ -23328,39 +24397,73 @@
throw new UnsupportedError("Not supported");
}
- Matrix currentTransform;
+ Matrix get currentTransform native;
- Object fillStyle;
+ set currentTransform(Matrix value) native;
- String filter;
+ Object get fillStyle native;
- num globalAlpha;
+ set fillStyle(Object value) native;
- String globalCompositeOperation;
+ String get filter native;
- bool imageSmoothingEnabled;
+ set filter(String value) native;
- String imageSmoothingQuality;
+ num get globalAlpha native;
- String lineCap;
+ set globalAlpha(num value) native;
- num lineDashOffset;
+ String get globalCompositeOperation native;
- String lineJoin;
+ set globalCompositeOperation(String value) native;
- num lineWidth;
+ bool get imageSmoothingEnabled native;
- num miterLimit;
+ set imageSmoothingEnabled(bool value) native;
- num shadowBlur;
+ String get imageSmoothingQuality native;
- String shadowColor;
+ set imageSmoothingQuality(String value) native;
- num shadowOffsetX;
+ String get lineCap native;
- num shadowOffsetY;
+ set lineCap(String value) native;
- Object strokeStyle;
+ num get lineDashOffset native;
+
+ set lineDashOffset(num value) native;
+
+ String get lineJoin native;
+
+ set lineJoin(String value) native;
+
+ num get lineWidth native;
+
+ set lineWidth(num value) native;
+
+ num get miterLimit native;
+
+ set miterLimit(num value) native;
+
+ num get shadowBlur native;
+
+ set shadowBlur(num value) native;
+
+ String get shadowColor native;
+
+ set shadowColor(String value) native;
+
+ num get shadowOffsetX native;
+
+ set shadowOffsetX(num value) native;
+
+ num get shadowOffsetY native;
+
+ set shadowOffsetY(num value) native;
+
+ Object get strokeStyle native;
+
+ set strokeStyle(Object value) native;
void beginPath() native;
@@ -23451,9 +24554,9 @@
throw new UnsupportedError("Not supported");
}
- final num height;
+ num get height native;
- final num width;
+ num get width native;
}
// 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
@@ -23466,7 +24569,7 @@
throw new UnsupportedError("Not supported");
}
- final num devicePixelRatio;
+ num get devicePixelRatio native;
void registerPaint(String name, Object paintCtor) native;
}
@@ -23517,9 +24620,13 @@
*/
ParamElement.created() : super.created();
- String name;
+ String get name native;
- String value;
+ set name(String value) native;
+
+ String get value native;
+
+ set value(String value) native;
}
// 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
@@ -23531,13 +24638,13 @@
throw new UnsupportedError("Not supported");
}
- final int _childElementCount;
+ int get _childElementCount native;
- final List<Node> _children;
+ List<Node> get _children native;
- final Element _firstElementChild;
+ Element get _firstElementChild native;
- final Element _lastElementChild;
+ Element get _lastElementChild native;
Element querySelector(String selectors);
@@ -23569,20 +24676,26 @@
static PasswordCredential _create_2(data_OR_form) =>
JS('PasswordCredential', 'new PasswordCredential(#)', data_OR_form);
- Object additionalData;
+ Object get additionalData native;
- String idName;
+ set additionalData(Object value) native;
- final String password;
+ String get idName native;
- String passwordName;
+ set idName(String value) native;
+
+ String get password native;
+
+ String get passwordName native;
+
+ set passwordName(String value) native;
// From CredentialUserData
@JSName('iconURL')
- final String iconUrl;
+ String get iconUrl native;
- final String name;
+ String get name native;
}
// 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
@@ -23649,27 +24762,27 @@
throw new UnsupportedError("Not supported");
}
- final List<String> addressLine;
+ List<String> get addressLine native;
- final String city;
+ String get city native;
- final String country;
+ String get country native;
- final String dependentLocality;
+ String get dependentLocality native;
- final String languageCode;
+ String get languageCode native;
- final String organization;
+ String get organization native;
- final String phone;
+ String get phone native;
- final String postalCode;
+ String get postalCode native;
- final String recipient;
+ String get recipient native;
- final String region;
+ String get region native;
- final String sortingCode;
+ String get sortingCode native;
}
// 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
@@ -23713,9 +24826,11 @@
throw new UnsupportedError("Not supported");
}
- final PaymentInstruments instruments;
+ PaymentInstruments get instruments native;
- String userHint;
+ String get userHint native;
+
+ set userHint(String value) native;
}
// 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
@@ -23751,13 +24866,13 @@
throw new UnsupportedError("Not supported");
}
- final String id;
+ String get id native;
- final PaymentAddress shippingAddress;
+ PaymentAddress get shippingAddress native;
- final String shippingOption;
+ String get shippingOption native;
- final String shippingType;
+ String get shippingType native;
Future abort() => promiseToFuture(JS("", "#.abort()", this));
@@ -23789,19 +24904,19 @@
type,
eventInitDict);
- final String instrumentKey;
+ String get instrumentKey native;
- final List methodData;
+ List get methodData native;
- final List modifiers;
+ List get modifiers native;
- final String paymentRequestId;
+ String get paymentRequestId native;
- final String paymentRequestOrigin;
+ String get paymentRequestOrigin native;
- final String topLevelOrigin;
+ String get topLevelOrigin native;
- final Object total;
+ Object get total native;
Future<WindowClient> openWindow(String url) =>
promiseToFuture<WindowClient>(JS("", "#.openWindow(#)", this, url));
@@ -23847,21 +24962,21 @@
throw new UnsupportedError("Not supported");
}
- final Object details;
+ Object get details native;
- final String methodName;
+ String get methodName native;
- final String payerEmail;
+ String get payerEmail native;
- final String payerName;
+ String get payerName native;
- final String payerPhone;
+ String get payerPhone native;
- final String requestId;
+ String get requestId native;
- final PaymentAddress shippingAddress;
+ PaymentAddress get shippingAddress native;
- final String shippingOption;
+ String get shippingOption native;
Future complete([String paymentResult]) =>
promiseToFuture(JS("", "#.complete(#)", this, paymentResult));
@@ -23883,13 +24998,13 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.performance)');
- final MemoryInfo memory;
+ MemoryInfo get memory native;
- final PerformanceNavigation navigation;
+ PerformanceNavigation get navigation native;
- final num timeOrigin;
+ num get timeOrigin native;
- final PerformanceTiming timing;
+ PerformanceTiming get timing native;
void clearMarks(String markName) native;
@@ -23922,13 +25037,13 @@
throw new UnsupportedError("Not supported");
}
- final num duration;
+ num get duration native;
- final String entryType;
+ String get entryType native;
- final String name;
+ String get name native;
- final num startTime;
+ num get startTime native;
}
// 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
@@ -23941,7 +25056,7 @@
throw new UnsupportedError("Not supported");
}
- final List<TaskAttributionTiming> attribution;
+ List<TaskAttributionTiming> get attribution native;
}
// 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
@@ -23985,9 +25100,9 @@
static const int TYPE_RESERVED = 255;
- final int redirectCount;
+ int get redirectCount native;
- final int type;
+ int get type native;
}
// 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
@@ -24000,25 +25115,25 @@
throw new UnsupportedError("Not supported");
}
- final num domComplete;
+ num get domComplete native;
- final num domContentLoadedEventEnd;
+ num get domContentLoadedEventEnd native;
- final num domContentLoadedEventStart;
+ num get domContentLoadedEventStart native;
- final num domInteractive;
+ num get domInteractive native;
- final num loadEventEnd;
+ num get loadEventEnd native;
- final num loadEventStart;
+ num get loadEventStart native;
- final int redirectCount;
+ int get redirectCount native;
- final String type;
+ String get type native;
- final num unloadEventEnd;
+ num get unloadEventEnd native;
- final num unloadEventStart;
+ num get unloadEventStart native;
}
// 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
@@ -24096,41 +25211,41 @@
throw new UnsupportedError("Not supported");
}
- final num connectEnd;
+ num get connectEnd native;
- final num connectStart;
+ num get connectStart native;
- final int decodedBodySize;
+ int get decodedBodySize native;
- final num domainLookupEnd;
+ num get domainLookupEnd native;
- final num domainLookupStart;
+ num get domainLookupStart native;
- final int encodedBodySize;
+ int get encodedBodySize native;
- final num fetchStart;
+ num get fetchStart native;
- final String initiatorType;
+ String get initiatorType native;
- final String nextHopProtocol;
+ String get nextHopProtocol native;
- final num redirectEnd;
+ num get redirectEnd native;
- final num redirectStart;
+ num get redirectStart native;
- final num requestStart;
+ num get requestStart native;
- final num responseEnd;
+ num get responseEnd native;
- final num responseStart;
+ num get responseStart native;
- final num secureConnectionStart;
+ num get secureConnectionStart native;
- final List<PerformanceServerTiming> serverTiming;
+ List<PerformanceServerTiming> get serverTiming native;
- final int transferSize;
+ int get transferSize native;
- final num workerStart;
+ num get workerStart native;
}
// 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
@@ -24143,11 +25258,11 @@
throw new UnsupportedError("Not supported");
}
- final String description;
+ String get description native;
- final num duration;
+ num get duration native;
- final String name;
+ String get name native;
}
// 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
@@ -24161,47 +25276,47 @@
throw new UnsupportedError("Not supported");
}
- final int connectEnd;
+ int get connectEnd native;
- final int connectStart;
+ int get connectStart native;
- final int domComplete;
+ int get domComplete native;
- final int domContentLoadedEventEnd;
+ int get domContentLoadedEventEnd native;
- final int domContentLoadedEventStart;
+ int get domContentLoadedEventStart native;
- final int domInteractive;
+ int get domInteractive native;
- final int domLoading;
+ int get domLoading native;
- final int domainLookupEnd;
+ int get domainLookupEnd native;
- final int domainLookupStart;
+ int get domainLookupStart native;
- final int fetchStart;
+ int get fetchStart native;
- final int loadEventEnd;
+ int get loadEventEnd native;
- final int loadEventStart;
+ int get loadEventStart native;
- final int navigationStart;
+ int get navigationStart native;
- final int redirectEnd;
+ int get redirectEnd native;
- final int redirectStart;
+ int get redirectStart native;
- final int requestStart;
+ int get requestStart native;
- final int responseEnd;
+ int get responseEnd native;
- final int responseStart;
+ int get responseStart native;
- final int secureConnectionStart;
+ int get secureConnectionStart native;
- final int unloadEventEnd;
+ int get unloadEventEnd native;
- final int unloadEventStart;
+ int get unloadEventStart native;
}
// 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
@@ -24217,7 +25332,7 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- final String state;
+ String get state native;
Stream<Event> get onChange => changeEvent.forTarget(this);
}
@@ -24265,13 +25380,13 @@
throw new UnsupportedError("Not supported");
}
- final List fillLightMode;
+ List get fillLightMode native;
- final MediaSettingsRange imageHeight;
+ MediaSettingsRange get imageHeight native;
- final MediaSettingsRange imageWidth;
+ MediaSettingsRange get imageWidth native;
- final String redEyeReduction;
+ String get redEyeReduction native;
}
// 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
@@ -24301,13 +25416,13 @@
throw new UnsupportedError("Not supported");
}
- final String description;
+ String get description native;
- final String filename;
+ String get filename native;
- final int length;
+ int get length native;
- final String name;
+ String get name native;
MimeType item(int index) native;
@@ -24402,25 +25517,25 @@
static PointerEvent _create_2(type) =>
JS('PointerEvent', 'new PointerEvent(#)', type);
- final num height;
+ num get height native;
- final bool isPrimary;
+ bool get isPrimary native;
- final int pointerId;
+ int get pointerId native;
- final String pointerType;
+ String get pointerType native;
- final num pressure;
+ num get pressure native;
- final num tangentialPressure;
+ num get tangentialPressure native;
- final int tiltX;
+ int get tiltX native;
- final int tiltY;
+ int get tiltY native;
- final int twist;
+ int get twist native;
- final num width;
+ num get width native;
List<PointerEvent> getCoalescedEvents() native;
@@ -24467,7 +25582,7 @@
@JSName('state')
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final dynamic _get_state;
+ dynamic get _get_state native;
}
// 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
@@ -24495,9 +25610,9 @@
static const int TIMEOUT = 3;
- final int code;
+ int get code native;
- final String message;
+ String get message native;
}
// 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
@@ -24538,9 +25653,11 @@
throw new UnsupportedError("Not supported");
}
- PresentationRequest defaultRequest;
+ PresentationRequest get defaultRequest native;
- final PresentationReceiver receiver;
+ set defaultRequest(PresentationRequest value) native;
+
+ PresentationReceiver get receiver native;
}
// 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
@@ -24556,7 +25673,7 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- final bool value;
+ bool get value native;
Stream<Event> get onChange => changeEvent.forTarget(this);
}
@@ -24574,13 +25691,15 @@
static const EventStreamProvider<MessageEvent> messageEvent =
const EventStreamProvider<MessageEvent>('message');
- String binaryType;
+ String get binaryType native;
- final String id;
+ set binaryType(String value) native;
- final String state;
+ String get id native;
- final String url;
+ String get state native;
+
+ String get url native;
void close() native;
@@ -24610,7 +25729,7 @@
JS('PresentationConnectionAvailableEvent',
'new PresentationConnectionAvailableEvent(#,#)', type, eventInitDict);
- final PresentationConnection connection;
+ PresentationConnection get connection native;
}
// 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
@@ -24633,9 +25752,9 @@
type,
eventInitDict);
- final String message;
+ String get message native;
- final String reason;
+ String get reason native;
}
// 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
@@ -24648,7 +25767,7 @@
throw new UnsupportedError("Not supported");
}
- final List<PresentationConnection> connections;
+ List<PresentationConnection> get connections native;
}
// 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
@@ -24714,9 +25833,9 @@
throw new UnsupportedError("Not supported");
}
- final StyleSheet sheet;
+ StyleSheet get sheet native;
- final String target;
+ String get target native;
}
// 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
@@ -24747,13 +25866,17 @@
@Unstable()
@Returns('NodeList|Null')
@Creates('NodeList')
- final List<Node> labels;
+ List<Node> get labels native;
- num max;
+ num get max native;
- final num position;
+ set max(num value) native;
- num value;
+ num get position native;
+
+ num get value native;
+
+ set value(num value) native;
}
// 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
@@ -24778,11 +25901,11 @@
static ProgressEvent _create_2(type) =>
JS('ProgressEvent', 'new ProgressEvent(#)', type);
- final bool lengthComputable;
+ bool get lengthComputable native;
- final int loaded;
+ int get loaded native;
- final int total;
+ int get total native;
}
// 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
@@ -24807,7 +25930,7 @@
Future get promise => promiseToFuture(JS("", "#.promise", this));
- final Object reason;
+ Object get reason native;
}
// 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
@@ -24820,9 +25943,9 @@
throw new UnsupportedError("Not supported");
}
- final ByteBuffer rawId;
+ ByteBuffer get rawId native;
- final AuthenticatorResponse response;
+ AuthenticatorResponse get response native;
}
// 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
@@ -24846,7 +25969,7 @@
JS('PushEvent', 'new PushEvent(#,#)', type, eventInitDict);
static PushEvent _create_2(type) => JS('PushEvent', 'new PushEvent(#)', type);
- final PushMessageData data;
+ PushMessageData get data native;
}
// 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
@@ -24859,7 +25982,7 @@
throw new UnsupportedError("Not supported");
}
- static final List<String> supportedContentEncodings;
+ List<String> get supportedContentEncodings native;
Future<PushSubscription> getSubscription() =>
promiseToFuture<PushSubscription>(JS("", "#.getSubscription()", this));
@@ -24911,11 +26034,11 @@
throw new UnsupportedError("Not supported");
}
- final String endpoint;
+ String get endpoint native;
- final int expirationTime;
+ int get expirationTime native;
- final PushSubscriptionOptions options;
+ PushSubscriptionOptions get options native;
ByteBuffer getKey(String name) native;
@@ -24933,9 +26056,9 @@
throw new UnsupportedError("Not supported");
}
- final ByteBuffer applicationServerKey;
+ ByteBuffer get applicationServerKey native;
- final bool userVisibleOnly;
+ bool get userVisibleOnly native;
}
// 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
@@ -24960,7 +26083,9 @@
*/
QuoteElement.created() : super.created();
- String cite;
+ String get cite native;
+
+ set cite(String value) native;
}
// 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
@@ -25009,17 +26134,17 @@
static const int START_TO_START = 0;
- final bool collapsed;
+ bool get collapsed native;
- final Node commonAncestorContainer;
+ Node get commonAncestorContainer native;
- final Node endContainer;
+ Node get endContainer native;
- final int endOffset;
+ int get endOffset native;
- final Node startContainer;
+ Node get startContainer native;
- final int startOffset;
+ int get startOffset native;
DocumentFragment cloneContents() native;
@@ -25105,11 +26230,11 @@
throw new UnsupportedError("Not supported");
}
- final String id;
+ String get id native;
- final String platform;
+ String get platform native;
- final String url;
+ String get url native;
}
// 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
@@ -25147,7 +26272,7 @@
throw new UnsupportedError("Not supported");
}
- final String state;
+ String get state native;
Future cancelWatchAvailability([int id]) =>
promiseToFuture(JS("", "#.cancelWatchAvailability(#)", this, id));
@@ -25254,9 +26379,9 @@
throw new UnsupportedError("Not supported");
}
- final DomRectReadOnly contentRect;
+ DomRectReadOnly get contentRect native;
- final Element target;
+ Element get target native;
}
// 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
@@ -25269,7 +26394,7 @@
throw new UnsupportedError("Not supported");
}
- final int expires;
+ int get expires native;
List<Map> getFingerprints() native;
}
@@ -25320,29 +26445,33 @@
static const EventStreamProvider<Event> openEvent =
const EventStreamProvider<Event>('open');
- String binaryType;
+ String get binaryType native;
- final int bufferedAmount;
+ set binaryType(String value) native;
- int bufferedAmountLowThreshold;
+ int get bufferedAmount native;
- final int id;
+ int get bufferedAmountLowThreshold native;
- final String label;
+ set bufferedAmountLowThreshold(int value) native;
- final int maxRetransmitTime;
+ int get id native;
- final int maxRetransmits;
+ String get label native;
- final bool negotiated;
+ int get maxRetransmitTime native;
- final bool ordered;
+ int get maxRetransmits native;
- final String protocol;
+ bool get negotiated native;
- final String readyState;
+ bool get ordered native;
- final bool reliable;
+ String get protocol native;
+
+ String get readyState native;
+
+ bool get reliable native;
void close() native;
@@ -25393,7 +26522,7 @@
type,
eventInitDict);
- final RtcDataChannel channel;
+ RtcDataChannel get channel native;
}
// 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
@@ -25416,15 +26545,15 @@
const EventStreamProvider<RtcDtmfToneChangeEvent>('tonechange');
@JSName('canInsertDTMF')
- final bool canInsertDtmf;
+ bool get canInsertDtmf native;
- final int duration;
+ int get duration native;
- final int interToneGap;
+ int get interToneGap native;
- final String toneBuffer;
+ String get toneBuffer native;
- final MediaStreamTrack track;
+ MediaStreamTrack get track native;
@JSName('insertDTMF')
void insertDtmf(String tones, [int duration, int interToneGap]) native;
@@ -25454,7 +26583,7 @@
type,
eventInitDict);
- final String tone;
+ String get tone native;
}
// 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
@@ -25473,11 +26602,17 @@
throw new UnsupportedError("Not supported");
}
- String candidate;
+ String get candidate native;
- int sdpMLineIndex;
+ set candidate(String value) native;
- String sdpMid;
+ int get sdpMLineIndex native;
+
+ set sdpMLineIndex(int value) native;
+
+ String get sdpMid native;
+
+ set sdpMid(String value) native;
}
// 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
@@ -25490,13 +26625,13 @@
throw new UnsupportedError("Not supported");
}
- final String id;
+ String get id native;
DateTime get timestamp => convertNativeToDart_DateTime(this._get_timestamp);
@JSName('timestamp')
- final dynamic _get_timestamp;
+ dynamic get _get_timestamp native;
- final String type;
+ String get type native;
List<String> names() native;
@@ -25635,15 +26770,15 @@
static const EventStreamProvider<Event> signalingStateChangeEvent =
const EventStreamProvider<Event>('signalingstatechange');
- final String iceConnectionState;
+ String get iceConnectionState native;
- final String iceGatheringState;
+ String get iceGatheringState native;
- final RtcSessionDescription localDescription;
+ RtcSessionDescription get localDescription native;
- final RtcSessionDescription remoteDescription;
+ RtcSessionDescription get remoteDescription native;
- final String signalingState;
+ String get signalingState native;
Future addIceCandidate(Object candidate,
[VoidCallback successCallback,
@@ -25793,7 +26928,7 @@
static RtcPeerConnectionIceEvent _create_2(type) =>
JS('RtcPeerConnectionIceEvent', 'new RTCPeerConnectionIceEvent(#)', type);
- final RtcIceCandidate candidate;
+ RtcIceCandidate get candidate native;
}
// 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
@@ -25806,9 +26941,9 @@
throw new UnsupportedError("Not supported");
}
- final int source;
+ int get source native;
- final num timestamp;
+ num get timestamp native;
}
// 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
@@ -25821,7 +26956,7 @@
throw new UnsupportedError("Not supported");
}
- final MediaStreamTrack track;
+ MediaStreamTrack get track native;
List<RtcRtpContributingSource> getContributingSources() native;
}
@@ -25836,7 +26971,7 @@
throw new UnsupportedError("Not supported");
}
- final MediaStreamTrack track;
+ MediaStreamTrack get track native;
}
// 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
@@ -25855,9 +26990,13 @@
throw new UnsupportedError("Not supported");
}
- String sdp;
+ String get sdp native;
- String type;
+ set sdp(String value) native;
+
+ String get type native;
+
+ set type(String value) native;
}
// 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
@@ -25960,11 +27099,11 @@
static RtcTrackEvent _create_1(type, eventInitDict) =>
JS('RtcTrackEvent', 'new RTCTrackEvent(#,#)', type, eventInitDict);
- final RtcRtpReceiver receiver;
+ RtcRtpReceiver get receiver native;
- final List<MediaStream> streams;
+ List<MediaStream> get streams native;
- final MediaStreamTrack track;
+ MediaStreamTrack get track native;
}
// 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
@@ -25980,28 +27119,30 @@
}
@JSName('availHeight')
- final int _availHeight;
+ int get _availHeight native;
@JSName('availLeft')
- final int _availLeft;
+ int get _availLeft native;
@JSName('availTop')
- final int _availTop;
+ int get _availTop native;
@JSName('availWidth')
- final int _availWidth;
+ int get _availWidth native;
- final int colorDepth;
+ int get colorDepth native;
- final int height;
+ int get height native;
- bool keepAwake;
+ bool get keepAwake native;
- final ScreenOrientation orientation;
+ set keepAwake(bool value) native;
- final int pixelDepth;
+ ScreenOrientation get orientation native;
- final int width;
+ int get pixelDepth native;
+
+ int get width native;
}
// 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
@@ -26017,9 +27158,9 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- final int angle;
+ int get angle native;
- final String type;
+ String get type native;
Future lock(String orientation) =>
promiseToFuture(JS("", "#.lock(#)", this, orientation));
@@ -26051,21 +27192,37 @@
*/
ScriptElement.created() : super.created();
- bool async;
+ bool get async native;
- String charset;
+ set async(bool value) native;
- String crossOrigin;
+ String get charset native;
- bool defer;
+ set charset(String value) native;
- String integrity;
+ String get crossOrigin native;
- bool noModule;
+ set crossOrigin(String value) native;
- String src;
+ bool get defer native;
- String type;
+ set defer(bool value) native;
+
+ String get integrity native;
+
+ set integrity(String value) native;
+
+ bool get noModule native;
+
+ set noModule(bool value) native;
+
+ String get src native;
+
+ set src(String value) native;
+
+ String get type native;
+
+ set type(String value) native;
}
// 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
@@ -26089,29 +27246,29 @@
JS('ScrollState', 'new ScrollState(#)', scrollStateInit);
static ScrollState _create_2() => JS('ScrollState', 'new ScrollState()');
- final num deltaGranularity;
+ num get deltaGranularity native;
- final num deltaX;
+ num get deltaX native;
- final num deltaY;
+ num get deltaY native;
- final bool fromUserInput;
+ bool get fromUserInput native;
- final bool inInertialPhase;
+ bool get inInertialPhase native;
- final bool isBeginning;
+ bool get isBeginning native;
- final bool isDirectManipulation;
+ bool get isDirectManipulation native;
- final bool isEnding;
+ bool get isEnding native;
- final int positionX;
+ int get positionX native;
- final int positionY;
+ int get positionY native;
- final num velocityX;
+ num get velocityX native;
- final num velocityY;
+ num get velocityY native;
void consumeDelta(num x, num y) native;
@@ -26147,11 +27304,11 @@
static ScrollTimeline _create_2() =>
JS('ScrollTimeline', 'new ScrollTimeline()');
- final String orientation;
+ String get orientation native;
- final Element scrollSource;
+ Element get scrollSource native;
- final Object timeRange;
+ Object get timeRange native;
}
// 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
@@ -26182,30 +27339,30 @@
type);
@JSName('blockedURI')
- final String blockedUri;
+ String get blockedUri native;
- final int columnNumber;
+ int get columnNumber native;
- final String disposition;
+ String get disposition native;
@JSName('documentURI')
- final String documentUri;
+ String get documentUri native;
- final String effectiveDirective;
+ String get effectiveDirective native;
- final int lineNumber;
+ int get lineNumber native;
- final String originalPolicy;
+ String get originalPolicy native;
- final String referrer;
+ String get referrer native;
- final String sample;
+ String get sample native;
- final String sourceFile;
+ String get sourceFile native;
- final int statusCode;
+ int get statusCode native;
- final String violatedDirective;
+ String get violatedDirective native;
}
// 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
@@ -26230,38 +27387,56 @@
*/
SelectElement.created() : super.created();
- bool autofocus;
+ bool get autofocus native;
- bool disabled;
+ set autofocus(bool value) native;
- final FormElement form;
+ bool get disabled native;
+
+ set disabled(bool value) native;
+
+ FormElement get form native;
@Unstable()
@Returns('NodeList|Null')
@Creates('NodeList')
- final List<Node> labels;
+ List<Node> get labels native;
- int length;
+ int get length native;
- bool multiple;
+ set length(int value) native;
- String name;
+ bool get multiple native;
- bool required;
+ set multiple(bool value) native;
- int selectedIndex;
+ String get name native;
- int size;
+ set name(String value) native;
- final String type;
+ bool get required native;
- final String validationMessage;
+ set required(bool value) native;
- final ValidityState validity;
+ int get selectedIndex native;
- String value;
+ set selectedIndex(int value) native;
- final bool willValidate;
+ int get size native;
+
+ set size(int value) native;
+
+ String get type native;
+
+ String get validationMessage native;
+
+ ValidityState get validity native;
+
+ String get value native;
+
+ set value(String value) native;
+
+ bool get willValidate native;
void __setter__(int index, OptionElement option) native;
@@ -26305,27 +27480,27 @@
throw new UnsupportedError("Not supported");
}
- final Node anchorNode;
+ Node get anchorNode native;
- final int anchorOffset;
+ int get anchorOffset native;
- final Node baseNode;
+ Node get baseNode native;
- final int baseOffset;
+ int get baseOffset native;
- final Node extentNode;
+ Node get extentNode native;
- final int extentOffset;
+ int get extentOffset native;
- final Node focusNode;
+ Node get focusNode native;
- final int focusOffset;
+ int get focusOffset native;
- final bool isCollapsed;
+ bool get isCollapsed native;
- final int rangeCount;
+ int get rangeCount native;
- final String type;
+ String get type native;
void addRange(Range range) native;
@@ -26372,11 +27547,11 @@
static const EventStreamProvider<Event> errorEvent =
const EventStreamProvider<Event>('error');
- final bool activated;
+ bool get activated native;
- final bool hasReading;
+ bool get hasReading native;
- final num timestamp;
+ num get timestamp native;
void start() native;
@@ -26402,7 +27577,7 @@
static SensorErrorEvent _create_1(type, eventInitDict) =>
JS('SensorErrorEvent', 'new SensorErrorEvent(#,#)', type, eventInitDict);
- final DomException error;
+ DomException get error native;
}
// 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
@@ -26419,9 +27594,9 @@
const EventStreamProvider<Event>('error');
@JSName('scriptURL')
- final String scriptUrl;
+ String get scriptUrl native;
- final String state;
+ String get state native;
void postMessage(/*any*/ message, [List<Object> transfer]) {
if (transfer != null) {
@@ -26455,7 +27630,7 @@
static const EventStreamProvider<MessageEvent> messageEvent =
const EventStreamProvider<MessageEvent>('message');
- final ServiceWorker controller;
+ ServiceWorker get controller native;
Future<ServiceWorkerRegistration> get ready =>
promiseToFuture<ServiceWorkerRegistration>(JS("", "#.ready", this));
@@ -26504,9 +27679,9 @@
static const EventStreamProvider<MessageEvent> messageEvent =
const EventStreamProvider<MessageEvent>('message');
- final Clients clients;
+ Clients get clients native;
- final ServiceWorkerRegistration registration;
+ ServiceWorkerRegistration get registration native;
Future skipWaiting() => promiseToFuture(JS("", "#.skipWaiting()", this));
@@ -26537,23 +27712,23 @@
throw new UnsupportedError("Not supported");
}
- final ServiceWorker active;
+ ServiceWorker get active native;
- final BackgroundFetchManager backgroundFetch;
+ BackgroundFetchManager get backgroundFetch native;
- final ServiceWorker installing;
+ ServiceWorker get installing native;
- final NavigationPreloadManager navigationPreload;
+ NavigationPreloadManager get navigationPreload native;
- final PaymentManager paymentManager;
+ PaymentManager get paymentManager native;
- final PushManager pushManager;
+ PushManager get pushManager native;
- final String scope;
+ String get scope native;
- final SyncManager sync;
+ SyncManager get sync native;
- final ServiceWorker waiting;
+ ServiceWorker get waiting native;
Future<List<dynamic>> getNotifications([Map filter]) {
var filter_dict = null;
@@ -26619,28 +27794,31 @@
throw new UnsupportedError("Not supported");
}
- final bool delegatesFocus;
+ bool get delegatesFocus native;
- final Element host;
+ Element get host native;
@JSName('innerHTML')
- String innerHtml;
+ String get innerHtml native;
- final String mode;
+ @JSName('innerHTML')
+ set innerHtml(String value) native;
- final ShadowRoot olderShadowRoot;
+ String get mode native;
+
+ ShadowRoot get olderShadowRoot native;
// From DocumentOrShadowRoot
- final Element activeElement;
+ Element get activeElement native;
- final Element fullscreenElement;
+ Element get fullscreenElement native;
- final Element pointerLockElement;
+ Element get pointerLockElement native;
@Returns('_StyleSheetList|Null')
@Creates('_StyleSheetList')
- final List<StyleSheet> styleSheets;
+ List<StyleSheet> get styleSheets native;
Element elementFromPoint(int x, int y) native;
@@ -26699,7 +27877,7 @@
throw new UnsupportedError("Not supported");
}
- final int byteLength;
+ int get byteLength native;
}
// 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
@@ -26726,7 +27904,7 @@
static SharedWorker _create_2(scriptURL) =>
JS('SharedWorker', 'new SharedWorker(#)', scriptURL);
- final MessagePort port;
+ MessagePort get port native;
Stream<Event> get onError => errorEvent.forTarget(this);
}
@@ -26754,7 +27932,7 @@
static const int TEMPORARY = 0;
- final String name;
+ String get name native;
void close() native;
@@ -26807,7 +27985,9 @@
*/
SlotElement.created() : super.created();
- String name;
+ String get name native;
+
+ set name(String value) native;
List<Node> assignedNodes([Map options]) {
if (options != null) {
@@ -26839,23 +28019,33 @@
static const EventStreamProvider<Event> errorEvent =
const EventStreamProvider<Event>('error');
- num appendWindowEnd;
+ num get appendWindowEnd native;
- num appendWindowStart;
+ set appendWindowEnd(num value) native;
- final AudioTrackList audioTracks;
+ num get appendWindowStart native;
- final TimeRanges buffered;
+ set appendWindowStart(num value) native;
- String mode;
+ AudioTrackList get audioTracks native;
- num timestampOffset;
+ TimeRanges get buffered native;
- TrackDefaultList trackDefaults;
+ String get mode native;
- final bool updating;
+ set mode(String value) native;
- final VideoTrackList videoTracks;
+ num get timestampOffset native;
+
+ set timestampOffset(num value) native;
+
+ TrackDefaultList get trackDefaults native;
+
+ set trackDefaults(TrackDefaultList value) native;
+
+ bool get updating native;
+
+ VideoTrackList get videoTracks native;
void abort() native;
@@ -26953,15 +28143,25 @@
*/
SourceElement.created() : super.created();
- String media;
+ String get media native;
- String sizes;
+ set media(String value) native;
- String src;
+ String get sizes native;
- String srcset;
+ set sizes(String value) native;
- String type;
+ String get src native;
+
+ set src(String value) native;
+
+ String get srcset native;
+
+ set srcset(String value) native;
+
+ String get type native;
+
+ set type(String value) native;
}
// 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
@@ -27003,9 +28203,13 @@
static SpeechGrammar _create_1() =>
JS('SpeechGrammar', 'new SpeechGrammar()');
- String src;
+ String get src native;
- num weight;
+ set src(String value) native;
+
+ num get weight native;
+
+ set weight(num value) native;
}
// 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
@@ -27192,17 +28396,29 @@
static bool get supported => JS(
'bool', '!!(window.SpeechRecognition || window.webkitSpeechRecognition)');
- MediaStreamTrack audioTrack;
+ MediaStreamTrack get audioTrack native;
- bool continuous;
+ set audioTrack(MediaStreamTrack value) native;
- SpeechGrammarList grammars;
+ bool get continuous native;
- bool interimResults;
+ set continuous(bool value) native;
- String lang;
+ SpeechGrammarList get grammars native;
- int maxAlternatives;
+ set grammars(SpeechGrammarList value) native;
+
+ bool get interimResults native;
+
+ set interimResults(bool value) native;
+
+ String get lang native;
+
+ set lang(String value) native;
+
+ int get maxAlternatives native;
+
+ set maxAlternatives(int value) native;
void abort() native;
@@ -27260,9 +28476,9 @@
throw new UnsupportedError("Not supported");
}
- final num confidence;
+ num get confidence native;
- final String transcript;
+ String get transcript native;
}
// 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
@@ -27291,9 +28507,9 @@
static SpeechRecognitionError _create_2(type) =>
JS('SpeechRecognitionError', 'new SpeechRecognitionError(#)', type);
- final String error;
+ String get error native;
- final String message;
+ String get message native;
}
// 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
@@ -27322,15 +28538,15 @@
static SpeechRecognitionEvent _create_2(type) =>
JS('SpeechRecognitionEvent', 'new SpeechRecognitionEvent(#)', type);
- final Document emma;
+ Document get emma native;
- final Document interpretation;
+ Document get interpretation native;
- final int resultIndex;
+ int get resultIndex native;
@Returns('_SpeechRecognitionResultList|Null')
@Creates('_SpeechRecognitionResultList')
- final List<SpeechRecognitionResult> results;
+ List<SpeechRecognitionResult> get results native;
}
// 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
@@ -27344,9 +28560,9 @@
throw new UnsupportedError("Not supported");
}
- final bool isFinal;
+ bool get isFinal native;
- final int length;
+ int get length native;
SpeechRecognitionAlternative item(int index) native;
}
@@ -27367,11 +28583,11 @@
throw new UnsupportedError("Not supported");
}
- final bool paused;
+ bool get paused native;
- final bool pending;
+ bool get pending native;
- final bool speaking;
+ bool get speaking native;
void cancel() native;
@@ -27395,13 +28611,13 @@
throw new UnsupportedError("Not supported");
}
- final int charIndex;
+ int get charIndex native;
- final num elapsedTime;
+ num get elapsedTime native;
- final String name;
+ String get name native;
- final SpeechSynthesisUtterance utterance;
+ SpeechSynthesisUtterance get utterance native;
}
// 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
@@ -27488,17 +28704,29 @@
static SpeechSynthesisUtterance _create_2() =>
JS('SpeechSynthesisUtterance', 'new SpeechSynthesisUtterance()');
- String lang;
+ String get lang native;
- num pitch;
+ set lang(String value) native;
- num rate;
+ num get pitch native;
- String text;
+ set pitch(num value) native;
- SpeechSynthesisVoice voice;
+ num get rate native;
- num volume;
+ set rate(num value) native;
+
+ String get text native;
+
+ set text(String value) native;
+
+ SpeechSynthesisVoice get voice native;
+
+ set voice(SpeechSynthesisVoice value) native;
+
+ num get volume native;
+
+ set volume(num value) native;
/// Stream of `boundary` events handled by this [SpeechSynthesisUtterance].
Stream<SpeechSynthesisEvent> get onBoundary => boundaryEvent.forTarget(this);
@@ -27533,16 +28761,16 @@
}
@JSName('default')
- final bool defaultValue;
+ bool get defaultValue native;
- final String lang;
+ String get lang native;
- final bool localService;
+ bool get localService native;
- final String name;
+ String get name native;
@JSName('voiceURI')
- final String voiceUri;
+ String get voiceUri native;
}
// 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
@@ -27555,15 +28783,15 @@
throw new UnsupportedError("Not supported");
}
- final bool collapsed;
+ bool get collapsed native;
- final Node endContainer;
+ Node get endContainer native;
- final int endOffset;
+ int get endOffset native;
- final Node startContainer;
+ Node get startContainer native;
- final int startOffset;
+ int get startOffset native;
}
// 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
@@ -27659,7 +28887,7 @@
}
@JSName('length')
- final int _length;
+ int get _length native;
@JSName('clear')
void _clear() native;
@@ -27718,15 +28946,15 @@
static StorageEvent _create_2(type) =>
JS('StorageEvent', 'new StorageEvent(#)', type);
- final String key;
+ String get key native;
- final String newValue;
+ String get newValue native;
- final String oldValue;
+ String get oldValue native;
- final Storage storageArea;
+ Storage get storageArea native;
- final String url;
+ String get url native;
@JSName('initStorageEvent')
void _initStorageEvent(
@@ -27796,13 +29024,19 @@
*/
StyleElement.created() : super.created();
- bool disabled;
+ bool get disabled native;
- String media;
+ set disabled(bool value) native;
- final StyleSheet sheet;
+ String get media native;
- String type;
+ set media(String value) native;
+
+ StyleSheet get sheet native;
+
+ String get type native;
+
+ set type(String value) native;
}
// 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
@@ -27815,7 +29049,7 @@
throw new UnsupportedError("Not supported");
}
- final String type;
+ String get type native;
bool matchMedium(String mediaquery) native;
}
@@ -27866,19 +29100,21 @@
throw new UnsupportedError("Not supported");
}
- bool disabled;
+ bool get disabled native;
- final String href;
+ set disabled(bool value) native;
- final MediaList media;
+ String get href native;
- final Node ownerNode;
+ MediaList get media native;
- final StyleSheet parentStyleSheet;
+ Node get ownerNode native;
- final String title;
+ StyleSheet get parentStyleSheet native;
- final String type;
+ String get title native;
+
+ String get type native;
}
// 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
@@ -27898,9 +29134,9 @@
static SyncEvent _create_1(type, init) =>
JS('SyncEvent', 'new SyncEvent(#,#)', type, init);
- final bool lastChance;
+ bool get lastChance native;
- final String tag;
+ String get tag native;
}
// 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
@@ -27966,13 +29202,19 @@
*/
TableCellElement.created() : super.created();
- final int cellIndex;
+ int get cellIndex native;
- int colSpan;
+ int get colSpan native;
- String headers;
+ set colSpan(int value) native;
- int rowSpan;
+ String get headers native;
+
+ set headers(String value) native;
+
+ int get rowSpan native;
+
+ set rowSpan(int value) native;
}
// 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
@@ -27997,7 +29239,9 @@
*/
TableColElement.created() : super.created();
- int span;
+ int get span native;
+
+ set span(int value) native;
}
// 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
@@ -28065,21 +29309,27 @@
*/
TableElement.created() : super.created();
- TableCaptionElement caption;
+ TableCaptionElement get caption native;
+
+ set caption(TableCaptionElement value) native;
@JSName('rows')
@Returns('HtmlCollection|Null')
@Creates('HtmlCollection')
- final List<Node> _rows;
+ List<Node> get _rows native;
@JSName('tBodies')
@Returns('HtmlCollection|Null')
@Creates('HtmlCollection')
- final List<Node> _tBodies;
+ List<Node> get _tBodies native;
- TableSectionElement tFoot;
+ TableSectionElement get tFoot native;
- TableSectionElement tHead;
+ set tFoot(TableSectionElement value) native;
+
+ TableSectionElement get tHead native;
+
+ set tHead(TableSectionElement value) native;
@JSName('createCaption')
TableCaptionElement _createCaption() native;
@@ -28154,11 +29404,11 @@
@JSName('cells')
@Returns('HtmlCollection|Null')
@Creates('HtmlCollection')
- final List<Node> _cells;
+ List<Node> get _cells native;
- final int rowIndex;
+ int get rowIndex native;
- final int sectionRowIndex;
+ int get sectionRowIndex native;
void deleteCell(int index) native;
@@ -28210,7 +29460,7 @@
@JSName('rows')
@Returns('HtmlCollection|Null')
@Creates('HtmlCollection')
- final List<Node> _rows;
+ List<Node> get _rows native;
void deleteRow(int index) native;
@@ -28228,16 +29478,16 @@
throw new UnsupportedError("Not supported");
}
- final String containerId;
+ String get containerId native;
- final String containerName;
+ String get containerName native;
- final String containerSrc;
+ String get containerSrc native;
- final String containerType;
+ String get containerType native;
@JSName('scriptURL')
- final String scriptUrl;
+ String get scriptUrl native;
}
// 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
@@ -28264,7 +29514,7 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('template');
- final DocumentFragment content;
+ DocumentFragment get content native;
/**
* An override to place the contents into content rather than as child nodes.
@@ -28301,9 +29551,9 @@
throw new UnsupportedError("Not supported");
}
- final SlotElement assignedSlot;
+ SlotElement get assignedSlot native;
- final String wholeText;
+ String get wholeText native;
@Returns('NodeList|Null')
@Creates('NodeList')
@@ -28334,58 +29584,94 @@
*/
TextAreaElement.created() : super.created();
- String autocapitalize;
+ String get autocapitalize native;
- bool autofocus;
+ set autocapitalize(String value) native;
- int cols;
+ bool get autofocus native;
- String defaultValue;
+ set autofocus(bool value) native;
- String dirName;
+ int get cols native;
- bool disabled;
+ set cols(int value) native;
- final FormElement form;
+ String get defaultValue native;
+
+ set defaultValue(String value) native;
+
+ String get dirName native;
+
+ set dirName(String value) native;
+
+ bool get disabled native;
+
+ set disabled(bool value) native;
+
+ FormElement get form native;
@Unstable()
@Returns('NodeList|Null')
@Creates('NodeList')
- final List<Node> labels;
+ List<Node> get labels native;
- int maxLength;
+ int get maxLength native;
- int minLength;
+ set maxLength(int value) native;
- String name;
+ int get minLength native;
- String placeholder;
+ set minLength(int value) native;
- bool readOnly;
+ String get name native;
- bool required;
+ set name(String value) native;
- int rows;
+ String get placeholder native;
- String selectionDirection;
+ set placeholder(String value) native;
- int selectionEnd;
+ bool get readOnly native;
- int selectionStart;
+ set readOnly(bool value) native;
- final int textLength;
+ bool get required native;
- final String type;
+ set required(bool value) native;
- final String validationMessage;
+ int get rows native;
- final ValidityState validity;
+ set rows(int value) native;
- String value;
+ String get selectionDirection native;
- final bool willValidate;
+ set selectionDirection(String value) native;
- String wrap;
+ int get selectionEnd native;
+
+ set selectionEnd(int value) native;
+
+ int get selectionStart native;
+
+ set selectionStart(int value) native;
+
+ int get textLength native;
+
+ String get type native;
+
+ String get validationMessage native;
+
+ ValidityState get validity native;
+
+ String get value native;
+
+ set value(String value) native;
+
+ bool get willValidate native;
+
+ String get wrap native;
+
+ set wrap(String value) native;
bool checkValidity() native;
@@ -28445,7 +29731,7 @@
throw new UnsupportedError("Not supported");
}
- final String data;
+ String get data native;
@JSName('initTextEvent')
void _initTextEvent(String type, bool bubbles, bool cancelable, Window view,
@@ -28462,29 +29748,29 @@
throw new UnsupportedError("Not supported");
}
- final num actualBoundingBoxAscent;
+ num get actualBoundingBoxAscent native;
- final num actualBoundingBoxDescent;
+ num get actualBoundingBoxDescent native;
- final num actualBoundingBoxLeft;
+ num get actualBoundingBoxLeft native;
- final num actualBoundingBoxRight;
+ num get actualBoundingBoxRight native;
- final num alphabeticBaseline;
+ num get alphabeticBaseline native;
- final num emHeightAscent;
+ num get emHeightAscent native;
- final num emHeightDescent;
+ num get emHeightDescent native;
- final num fontBoundingBoxAscent;
+ num get fontBoundingBoxAscent native;
- final num fontBoundingBoxDescent;
+ num get fontBoundingBoxDescent native;
- final num hangingBaseline;
+ num get hangingBaseline native;
- final num ideographicBaseline;
+ num get ideographicBaseline native;
- final num width;
+ num get width native;
}
// 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
@@ -28506,19 +29792,21 @@
static const EventStreamProvider<Event> cueChangeEvent =
const EventStreamProvider<Event>('cuechange');
- final TextTrackCueList activeCues;
+ TextTrackCueList get activeCues native;
- final TextTrackCueList cues;
+ TextTrackCueList get cues native;
- final String id;
+ String get id native;
- final String kind;
+ String get kind native;
- final String label;
+ String get label native;
- final String language;
+ String get language native;
- String mode;
+ String get mode native;
+
+ set mode(String value) native;
void addCue(TextTrackCue cue) native;
@@ -28556,15 +29844,23 @@
static const EventStreamProvider<Event> exitEvent =
const EventStreamProvider<Event>('exit');
- num endTime;
+ num get endTime native;
- String id;
+ set endTime(num value) native;
- bool pauseOnExit;
+ String get id native;
- num startTime;
+ set id(String value) native;
- final TextTrack track;
+ bool get pauseOnExit native;
+
+ set pauseOnExit(bool value) native;
+
+ num get startTime native;
+
+ set startTime(num value) native;
+
+ TextTrack get track native;
/// Stream of `enter` events handled by this [TextTrackCue].
Stream<Event> get onEnter => enterEvent.forTarget(this);
@@ -28730,7 +30026,9 @@
*/
TimeElement.created() : super.created();
- String dateTime;
+ String get dateTime native;
+
+ set dateTime(String value) native;
}
// 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
@@ -28744,7 +30042,7 @@
throw new UnsupportedError("Not supported");
}
- final int length;
+ int get length native;
double end(int index) native;
@@ -28798,42 +30096,42 @@
static Touch _create_1(initDict) => JS('Touch', 'new Touch(#)', initDict);
@JSName('clientX')
- final num _clientX;
+ num get _clientX native;
@JSName('clientY')
- final num _clientY;
+ num get _clientY native;
- final num force;
+ num get force native;
- final int identifier;
+ int get identifier native;
@JSName('pageX')
- final num _pageX;
+ num get _pageX native;
@JSName('pageY')
- final num _pageY;
+ num get _pageY native;
@JSName('radiusX')
- final num _radiusX;
+ num get _radiusX native;
@JSName('radiusY')
- final num _radiusY;
+ num get _radiusY native;
- final String region;
+ String get region native;
- final num rotationAngle;
+ num get rotationAngle native;
@JSName('screenX')
- final num _screenX;
+ num get _screenX native;
@JSName('screenY')
- final num _screenY;
+ num get _screenY native;
EventTarget get target => _convertNativeToDart_EventTarget(this._get_target);
@JSName('target')
@Creates('Element|Document')
@Returns('Element|Document')
- final dynamic _get_target;
+ dynamic get _get_target native;
// As of Chrome 37, these all changed from long to double. This code
// preserves backwards compatibility for the time being.
@@ -28885,19 +30183,19 @@
static TouchEvent _create_2(type) =>
JS('TouchEvent', 'new TouchEvent(#)', type);
- final bool altKey;
+ bool get altKey native;
- final TouchList changedTouches;
+ TouchList get changedTouches native;
- final bool ctrlKey;
+ bool get ctrlKey native;
- final bool metaKey;
+ bool get metaKey native;
- final bool shiftKey;
+ bool get shiftKey native;
- final TouchList targetTouches;
+ TouchList get targetTouches native;
- final TouchList touches;
+ TouchList get touches native;
/**
* Checks if touch events supported on the current platform.
@@ -29007,15 +30305,15 @@
label,
kinds);
- final String byteStreamTrackID;
+ String get byteStreamTrackID native;
- final Object kinds;
+ Object get kinds native;
- final String label;
+ String get label native;
- final String language;
+ String get language native;
- final String type;
+ String get type native;
}
// 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
@@ -29039,7 +30337,7 @@
static TrackDefaultList _create_2() =>
JS('TrackDefaultList', 'new TrackDefaultList()');
- final int length;
+ int get length native;
TrackDefault item(int index) native;
}
@@ -29077,19 +30375,30 @@
static const int NONE = 0;
@JSName('default')
- bool defaultValue;
+ bool get defaultValue native;
- String kind;
+ @JSName('default')
+ set defaultValue(bool value) native;
- String label;
+ String get kind native;
- final int readyState;
+ set kind(String value) native;
- String src;
+ String get label native;
- String srclang;
+ set label(String value) native;
- final TextTrack track;
+ int get readyState native;
+
+ String get src native;
+
+ set src(String value) native;
+
+ String get srclang native;
+
+ set srclang(String value) native;
+
+ TextTrack get track native;
}
// 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
@@ -29116,7 +30425,7 @@
JS('TrackEvent', 'new TrackEvent(#)', type);
@Creates('Null')
- final Object track;
+ Object get track native;
}
// 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
@@ -29141,11 +30450,11 @@
static TransitionEvent _create_2(type) =>
JS('TransitionEvent', 'new TransitionEvent(#)', type);
- final num elapsedTime;
+ num get elapsedTime native;
- final String propertyName;
+ String get propertyName native;
- final String pseudoElement;
+ String get pseudoElement native;
}
// 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
@@ -29162,13 +30471,15 @@
throw new UnsupportedError("Not supported");
}
- Node currentNode;
+ Node get currentNode native;
- final NodeFilter filter;
+ set currentNode(Node value) native;
- final Node root;
+ NodeFilter get filter native;
- final int whatToShow;
+ Node get root native;
+
+ int get whatToShow native;
Node firstChild() native;
@@ -29265,19 +30576,19 @@
JS('UIEvent', 'new UIEvent(#,#)', type, eventInitDict);
static UIEvent _create_2(type) => JS('UIEvent', 'new UIEvent(#)', type);
- final int detail;
+ int get detail native;
- final InputDeviceCapabilities sourceCapabilities;
+ InputDeviceCapabilities get sourceCapabilities native;
WindowBase get view => _convertNativeToDart_Window(this._get_view);
@JSName('view')
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _get_view;
+ dynamic get _get_view native;
@JSName('which')
@Unstable()
- final int _which;
+ int get _which native;
@JSName('initUIEvent')
void _initUIEvent(String type, bool bubbles, bool cancelable, Window view,
@@ -29376,29 +30687,49 @@
throw new UnsupportedError("Not supported");
}
- String hash;
+ String get hash native;
- String host;
+ set hash(String value) native;
- String hostname;
+ String get host native;
- String href;
+ set host(String value) native;
- final String origin;
+ String get hostname native;
- String password;
+ set hostname(String value) native;
- String pathname;
+ String get href native;
- String port;
+ set href(String value) native;
- String protocol;
+ String get origin native;
- String search;
+ String get password native;
- final UrlSearchParams searchParams;
+ set password(String value) native;
- String username;
+ String get pathname native;
+
+ set pathname(String value) native;
+
+ String get port native;
+
+ set port(String value) native;
+
+ String get protocol native;
+
+ set protocol(String value) native;
+
+ String get search native;
+
+ set search(String value) native;
+
+ UrlSearchParams get searchParams native;
+
+ String get username native;
+
+ set username(String value) native;
}
// 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
@@ -29446,23 +30777,23 @@
throw new UnsupportedError("Not supported");
}
- final String hash;
+ String get hash native;
- final String host;
+ String get host native;
- final String hostname;
+ String get hostname native;
- final String href;
+ String get href native;
- final String origin;
+ String get origin native;
- final String pathname;
+ String get pathname native;
- final String port;
+ String get port native;
- final String protocol;
+ String get protocol native;
- final String search;
+ String get search native;
}
// 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
@@ -29501,9 +30832,9 @@
throw new UnsupportedError("Not supported");
}
- final String deviceName;
+ String get deviceName native;
- final bool isExternal;
+ bool get isExternal native;
Future requestSession([Map options]) {
var options_dict = null;
@@ -29539,7 +30870,7 @@
static VRDeviceEvent _create_1(type, eventInitDict) =>
JS('VRDeviceEvent', 'new VRDeviceEvent(#,#)', type, eventInitDict);
- final VRDevice device;
+ VRDevice get device native;
}
// 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
@@ -29552,19 +30883,23 @@
throw new UnsupportedError("Not supported");
}
- final VRDisplayCapabilities capabilities;
+ VRDisplayCapabilities get capabilities native;
- num depthFar;
+ num get depthFar native;
- num depthNear;
+ set depthFar(num value) native;
- final int displayId;
+ num get depthNear native;
- final String displayName;
+ set depthNear(num value) native;
- final bool isPresenting;
+ int get displayId native;
- final VRStageParameters stageParameters;
+ String get displayName native;
+
+ bool get isPresenting native;
+
+ VRStageParameters get stageParameters native;
void cancelAnimationFrame(int handle) native;
@@ -29594,13 +30929,13 @@
throw new UnsupportedError("Not supported");
}
- final bool canPresent;
+ bool get canPresent native;
- final bool hasExternalDisplay;
+ bool get hasExternalDisplay native;
- final bool hasPosition;
+ bool get hasPosition native;
- final int maxLayers;
+ int get maxLayers native;
}
// 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
@@ -29625,9 +30960,9 @@
static VRDisplayEvent _create_2(type) =>
JS('VRDisplayEvent', 'new VRDisplayEvent(#)', type);
- final VRDisplay display;
+ VRDisplay get display native;
- final String reason;
+ String get reason native;
}
// 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
@@ -29640,11 +30975,11 @@
throw new UnsupportedError("Not supported");
}
- final Float32List offset;
+ Float32List get offset native;
- final int renderHeight;
+ int get renderHeight native;
- final int renderWidth;
+ int get renderWidth native;
}
// 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
@@ -29662,15 +30997,15 @@
}
static VRFrameData _create_1() => JS('VRFrameData', 'new VRFrameData()');
- final Float32List leftProjectionMatrix;
+ Float32List get leftProjectionMatrix native;
- final Float32List leftViewMatrix;
+ Float32List get leftViewMatrix native;
- final VRPose pose;
+ VRPose get pose native;
- final Float32List rightProjectionMatrix;
+ Float32List get rightProjectionMatrix native;
- final Float32List rightViewMatrix;
+ Float32List get rightViewMatrix native;
}
// 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
@@ -29683,9 +31018,9 @@
throw new UnsupportedError("Not supported");
}
- final VRStageBounds bounds;
+ VRStageBounds get bounds native;
- final num emulatedHeight;
+ num get emulatedHeight native;
}
// 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
@@ -29698,17 +31033,17 @@
throw new UnsupportedError("Not supported");
}
- final Float32List angularAcceleration;
+ Float32List get angularAcceleration native;
- final Float32List angularVelocity;
+ Float32List get angularVelocity native;
- final Float32List linearAcceleration;
+ Float32List get linearAcceleration native;
- final Float32List linearVelocity;
+ Float32List get linearVelocity native;
- final Float32List orientation;
+ Float32List get orientation native;
- final Float32List position;
+ Float32List get position native;
}
// 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
@@ -29727,13 +31062,17 @@
static const EventStreamProvider<Event> focusEvent =
const EventStreamProvider<Event>('focus');
- num depthFar;
+ num get depthFar native;
- num depthNear;
+ set depthFar(num value) native;
- final VRDevice device;
+ num get depthNear native;
- final bool exclusive;
+ set depthNear(num value) native;
+
+ VRDevice get device native;
+
+ bool get exclusive native;
Future end() => promiseToFuture(JS("", "#.end()", this));
@@ -29768,7 +31107,7 @@
static VRSessionEvent _create_1(type, eventInitDict) =>
JS('VRSessionEvent', 'new VRSessionEvent(#,#)', type, eventInitDict);
- final VRSession session;
+ VRSession get session native;
}
// 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
@@ -29781,7 +31120,7 @@
throw new UnsupportedError("Not supported");
}
- final List<VRStageBoundsPoint> geometry;
+ List<VRStageBoundsPoint> get geometry native;
}
// 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
@@ -29794,9 +31133,9 @@
throw new UnsupportedError("Not supported");
}
- final num x;
+ num get x native;
- final num z;
+ num get z native;
}
// 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
@@ -29809,11 +31148,11 @@
throw new UnsupportedError("Not supported");
}
- final Float32List sittingToStandingTransform;
+ Float32List get sittingToStandingTransform native;
- final num sizeX;
+ num get sizeX native;
- final num sizeZ;
+ num get sizeZ native;
}
// 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
@@ -29826,27 +31165,27 @@
throw new UnsupportedError("Not supported");
}
- final bool badInput;
+ bool get badInput native;
- final bool customError;
+ bool get customError native;
- final bool patternMismatch;
+ bool get patternMismatch native;
- final bool rangeOverflow;
+ bool get rangeOverflow native;
- final bool rangeUnderflow;
+ bool get rangeUnderflow native;
- final bool stepMismatch;
+ bool get stepMismatch native;
- final bool tooLong;
+ bool get tooLong native;
- final bool tooShort;
+ bool get tooShort native;
- final bool typeMismatch;
+ bool get typeMismatch native;
- final bool valid;
+ bool get valid native;
- final bool valueMissing;
+ bool get valueMissing native;
}
// 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
@@ -29871,25 +31210,31 @@
*/
VideoElement.created() : super.created();
- int height;
+ int get height native;
- String poster;
+ set height(int value) native;
- final int videoHeight;
+ String get poster native;
- final int videoWidth;
+ set poster(String value) native;
+
+ int get videoHeight native;
+
+ int get videoWidth native;
@JSName('webkitDecodedFrameCount')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final int decodedFrameCount;
+ int get decodedFrameCount native;
@JSName('webkitDroppedFrameCount')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- final int droppedFrameCount;
+ int get droppedFrameCount native;
- int width;
+ int get width native;
+
+ set width(int value) native;
VideoPlaybackQuality getVideoPlaybackQuality() native;
@@ -29914,13 +31259,13 @@
throw new UnsupportedError("Not supported");
}
- final int corruptedVideoFrames;
+ int get corruptedVideoFrames native;
- final num creationTime;
+ num get creationTime native;
- final int droppedVideoFrames;
+ int get droppedVideoFrames native;
- final int totalVideoFrames;
+ int get totalVideoFrames native;
}
// 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
@@ -29933,17 +31278,19 @@
throw new UnsupportedError("Not supported");
}
- final String id;
+ String get id native;
- final String kind;
+ String get kind native;
- final String label;
+ String get label native;
- final String language;
+ String get language native;
- bool selected;
+ bool get selected native;
- final SourceBuffer sourceBuffer;
+ set selected(bool value) native;
+
+ SourceBuffer get sourceBuffer native;
}
// 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
@@ -29959,9 +31306,9 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- final int length;
+ int get length native;
- final int selectedIndex;
+ int get selectedIndex native;
VideoTrack __getter__(int index) native;
@@ -29986,19 +31333,19 @@
static const EventStreamProvider<Event> scrollEvent =
const EventStreamProvider<Event>('scroll');
- final num height;
+ num get height native;
- final num offsetLeft;
+ num get offsetLeft native;
- final num offsetTop;
+ num get offsetTop native;
- final num pageLeft;
+ num get pageLeft native;
- final num pageTop;
+ num get pageTop native;
- final num scale;
+ num get scale native;
- final num width;
+ num get width native;
Stream<Event> get onResize => resizeEvent.forTarget(this);
@@ -30028,25 +31375,41 @@
static VttCue _create_1(startTime, endTime, text) =>
JS('VttCue', 'new VTTCue(#,#,#)', startTime, endTime, text);
- String align;
+ String get align native;
+
+ set align(String value) native;
@Creates('Null')
@Returns('num|String')
- Object line;
+ Object get line native;
+
+ set line(Object value) native;
@Creates('Null')
@Returns('num|String')
- Object position;
+ Object get position native;
- VttRegion region;
+ set position(Object value) native;
- num size;
+ VttRegion get region native;
- bool snapToLines;
+ set region(VttRegion value) native;
- String text;
+ num get size native;
- String vertical;
+ set size(num value) native;
+
+ bool get snapToLines native;
+
+ set snapToLines(bool value) native;
+
+ String get text native;
+
+ set text(String value) native;
+
+ String get vertical native;
+
+ set vertical(String value) native;
@JSName('getCueAsHTML')
DocumentFragment getCueAsHtml() native;
@@ -30067,21 +31430,37 @@
}
static VttRegion _create_1() => JS('VttRegion', 'new VTTRegion()');
- String id;
+ String get id native;
- int lines;
+ set id(String value) native;
- num regionAnchorX;
+ int get lines native;
- num regionAnchorY;
+ set lines(int value) native;
- String scroll;
+ num get regionAnchorX native;
- num viewportAnchorX;
+ set regionAnchorX(num value) native;
- num viewportAnchorY;
+ num get regionAnchorY native;
- num width;
+ set regionAnchorY(num value) native;
+
+ String get scroll native;
+
+ set scroll(String value) native;
+
+ num get viewportAnchorX native;
+
+ set viewportAnchorX(num value) native;
+
+ num get viewportAnchorY native;
+
+ set viewportAnchorY(num value) native;
+
+ num get width native;
+
+ set width(num value) native;
}
// 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
@@ -30191,17 +31570,19 @@
static const int OPEN = 1;
- String binaryType;
+ String get binaryType native;
- final int bufferedAmount;
+ set binaryType(String value) native;
- final String extensions;
+ int get bufferedAmount native;
- final String protocol;
+ String get extensions native;
- final int readyState;
+ String get protocol native;
- final String url;
+ int get readyState native;
+
+ String get url native;
void close([int code, String reason]) native;
@@ -30339,12 +31720,12 @@
static const int DOM_DELTA_PIXEL = 0x00;
@JSName('deltaX')
- final num _deltaX;
+ num get _deltaX native;
@JSName('deltaY')
- final num _deltaY;
+ num get _deltaY native;
- final num deltaZ;
+ num get deltaZ native;
/**
* The amount that is expected to scroll vertically, in units determined by
@@ -30843,7 +32224,7 @@
*/
static const int TEMPORARY = 0;
- final _Worklet animationWorklet;
+ _Worklet get animationWorklet native;
/**
* The application cache for this window.
@@ -30857,15 +32238,16 @@
* API](https://html.spec.whatwg.org/multipage/browsers.html#application-cache-api)
* from WHATWG.
*/
- final ApplicationCache applicationCache;
- final _Worklet audioWorklet;
+ ApplicationCache get applicationCache native;
- final CacheStorage caches;
+ _Worklet get audioWorklet native;
- final bool closed;
+ CacheStorage get caches native;
- final CookieStore cookieStore;
+ bool get closed native;
+
+ CookieStore get cookieStore native;
/**
* Entrypoint for the browser's cryptographic functions.
@@ -30874,15 +32256,22 @@
*
* * [Web cryptography API](http://www.w3.org/TR/WebCryptoAPI/) from W3C.
*/
- final Crypto crypto;
- final CustomElementRegistry customElements;
+ Crypto get crypto native;
+
+ CustomElementRegistry get customElements native;
/// *Deprecated*.
- String defaultStatus;
+
+ String get defaultStatus native;
+
+ set defaultStatus(String value) native;
/// *Deprecated*.
- String defaultstatus;
+
+ String get defaultstatus native;
+
+ set defaultstatus(String value) native;
/**
* The ratio between physical pixels and logical CSS pixels.
@@ -30894,9 +32283,10 @@
* * [More about devicePixelRatio](http://www.quirksmode.org/blog/archives/2012/07/more_about_devi.html)
* from quirksmode.
*/
- final num devicePixelRatio;
- final External external;
+ num get devicePixelRatio native;
+
+ External get external native;
/**
* The current session history for this window's newest document.
@@ -30906,7 +32296,8 @@
* * [Loading web pages](https://html.spec.whatwg.org/multipage/browsers.html)
* from WHATWG.
*/
- final History history;
+
+ History get history native;
/**
* The height of the viewport including scrollbars.
@@ -30916,7 +32307,8 @@
* * [Window.innerHeight](https://developer.mozilla.org/en-US/docs/Web/API/Window/innerHeight)
* from MDN.
*/
- final int innerHeight;
+
+ int get innerHeight native;
/**
* The width of the viewport including scrollbars.
@@ -30926,9 +32318,10 @@
* * [Window.innerWidth](https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth)
* from MDN.
*/
- final int innerWidth;
- final bool isSecureContext;
+ int get innerWidth native;
+
+ bool get isSecureContext native;
/**
* Storage for this window that persists across sessions.
@@ -30942,7 +32335,8 @@
* * [Local storage specification](http://www.w3.org/TR/webstorage/#the-localstorage-attribute)
* from W3C.
*/
- final Storage localStorage;
+
+ Storage get localStorage native;
/**
* This window's location bar, which displays the URL.
@@ -30953,7 +32347,8 @@
* elements](https://html.spec.whatwg.org/multipage/browsers.html#browser-interface-elements)
* from WHATWG.
*/
- final BarProp locationbar;
+
+ BarProp get locationbar native;
/**
* This window's menu bar, which displays menu commands.
@@ -30964,7 +32359,8 @@
* elements](https://html.spec.whatwg.org/multipage/browsers.html#browser-interface-elements)
* from WHATWG.
*/
- final BarProp menubar;
+
+ BarProp get menubar native;
/**
* The name of this window.
@@ -30974,7 +32370,10 @@
* * [Window.name](https://developer.mozilla.org/en-US/docs/Web/API/Window/name)
* from MDN.
*/
- String name;
+
+ String get name native;
+
+ set name(String value) native;
/**
* The user agent accessing this window.
@@ -30985,7 +32384,8 @@
* object](https://html.spec.whatwg.org/multipage/webappapis.html#the-navigator-object)
* from WHATWG.
*/
- final Navigator navigator;
+
+ Navigator get navigator native;
/**
* Whether objects are drawn offscreen before being displayed.
@@ -30995,21 +32395,20 @@
* * [offscreenBuffering](https://webplatform.github.io/docs/dom/HTMLElement/offscreenBuffering/)
* from WebPlatform.org.
*/
- final bool offscreenBuffering;
+
+ bool get offscreenBuffering native;
WindowBase get opener => _convertNativeToDart_Window(this._get_opener);
@JSName('opener')
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _get_opener;
+ dynamic get _get_opener native;
- set opener(WindowBase value) {
- JS("void", "#.opener = #", this, value);
- }
+ set opener(WindowBase value) native;
- final int orientation;
+ int get orientation native;
- final String origin;
+ String get origin native;
/**
* The height of this window including all user interface elements.
@@ -31019,7 +32418,8 @@
* * [Window.outerHeight](https://developer.mozilla.org/en-US/docs/Web/API/Window/outerHeight)
* from MDN.
*/
- final int outerHeight;
+
+ int get outerHeight native;
/**
* The width of the window including all user interface elements.
@@ -31029,9 +32429,11 @@
* * [Window.outerWidth](https://developer.mozilla.org/en-US/docs/Web/API/Window/outerWidth)
* from MDN.
*/
- final int outerWidth;
+
+ int get outerWidth native;
@JSName('pageXOffset')
+
/**
* The distance this window has been scrolled horizontally.
*
@@ -31045,9 +32447,11 @@
* pageXOffset](https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollX)
* from MDN.
*/
- final num _pageXOffset;
+
+ num get _pageXOffset native;
@JSName('pageYOffset')
+
/**
* The distance this window has been scrolled vertically.
*
@@ -31061,13 +32465,14 @@
* pageYOffset](https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY)
* from MDN.
*/
- final num _pageYOffset;
+
+ num get _pageYOffset native;
WindowBase get parent => _convertNativeToDart_Window(this._get_parent);
@JSName('parent')
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _get_parent;
+ dynamic get _get_parent native;
/**
* Timing and navigation data for this window.
@@ -31083,7 +32488,7 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE)
- final Performance performance;
+ Performance get performance native;
/**
* Information about the screen displaying this window.
@@ -31093,7 +32498,8 @@
* * [The Screen interface specification](http://www.w3.org/TR/cssom-view/#screen)
* from W3C.
*/
- final Screen screen;
+
+ Screen get screen native;
/**
* The distance from the left side of the screen to the left side of this
@@ -31104,7 +32510,8 @@
* * [The Screen interface specification](http://www.w3.org/TR/cssom-view/#screen)
* from W3C.
*/
- final int screenLeft;
+
+ int get screenLeft native;
/**
* The distance from the top of the screen to the top of this window.
@@ -31114,7 +32521,8 @@
* * [The Screen interface specification](http://www.w3.org/TR/cssom-view/#screen)
* from W3C.
*/
- final int screenTop;
+
+ int get screenTop native;
/**
* The distance from the left side of the screen to the mouse pointer.
@@ -31124,7 +32532,8 @@
* * [The Screen interface specification](http://www.w3.org/TR/cssom-view/#screen)
* from W3C.
*/
- final int screenX;
+
+ int get screenX native;
/**
* The distance from the top of the screen to the mouse pointer.
@@ -31134,7 +32543,8 @@
* * [The Screen interface specification](http://www.w3.org/TR/cssom-view/#screen)
* from W3C.
*/
- final int screenY;
+
+ int get screenY native;
/**
* This window's scroll bars.
@@ -31145,7 +32555,8 @@
* elements](https://html.spec.whatwg.org/multipage/browsers.html#browser-interface-elements)
* from WHATWG.
*/
- final BarProp scrollbars;
+
+ BarProp get scrollbars native;
/**
* The current window.
@@ -31167,7 +32578,7 @@
*/
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _get_self;
+ dynamic get _get_self native;
/**
* Storage for this window that is cleared when this session ends.
@@ -31182,7 +32593,8 @@
* * [Local storage
* specification](http://www.w3.org/TR/webstorage/#dom-sessionstorage) from W3C.
*/
- final Storage sessionStorage;
+
+ Storage get sessionStorage native;
/**
* Access to speech synthesis in the browser.
@@ -31193,10 +32605,14 @@
* specification](https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#tts-section)
* from W3C.
*/
- final SpeechSynthesis speechSynthesis;
+
+ SpeechSynthesis get speechSynthesis native;
/// *Deprecated*.
- String status;
+
+ String get status native;
+
+ set status(String value) native;
/**
* This window's status bar.
@@ -31207,7 +32623,8 @@
* elements](https://html.spec.whatwg.org/multipage/browsers.html#browser-interface-elements)
* from WHATWG.
*/
- final BarProp statusbar;
+
+ BarProp get statusbar native;
/**
* Access to CSS media queries.
@@ -31218,7 +32635,8 @@
* reference](https://developer.apple.com/library/safari/documentation/SafariDOMAdditions/Reference/StyleMedia/)
* from Safari Developer Library.
*/
- final StyleMedia styleMedia;
+
+ StyleMedia get styleMedia native;
/**
* This window's tool bar.
@@ -31229,15 +32647,16 @@
* elements](https://html.spec.whatwg.org/multipage/browsers.html#browser-interface-elements)
* from WHATWG.
*/
- final BarProp toolbar;
+
+ BarProp get toolbar native;
WindowBase get top => _convertNativeToDart_Window(this._get_top);
@JSName('top')
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _get_top;
+ dynamic get _get_top native;
- final VisualViewport visualViewport;
+ VisualViewport get visualViewport native;
/**
* The current window.
@@ -31259,7 +32678,7 @@
*/
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _get_window;
+ dynamic get _get_window native;
@Creates('Window|=Object')
@Returns('Window|=Object')
@@ -32207,9 +33626,9 @@
throw new UnsupportedError("Not supported");
}
- final bool focused;
+ bool get focused native;
- final String visibilityState;
+ String get visibilityState native;
Future<WindowClient> focus() =>
promiseToFuture<WindowClient>(JS("", "#.focus()", this));
@@ -32350,25 +33769,25 @@
static const EventStreamProvider<Event> errorEvent =
const EventStreamProvider<Event>('error');
- final String addressSpace;
+ String get addressSpace native;
- final CacheStorage caches;
+ CacheStorage get caches native;
- final Crypto crypto;
+ Crypto get crypto native;
- final IdbFactory indexedDB;
+ IdbFactory get indexedDB native;
- final bool isSecureContext;
+ bool get isSecureContext native;
- final _WorkerLocation location;
+ _WorkerLocation get location native;
- final _WorkerNavigator navigator;
+ _WorkerNavigator get navigator native;
- final String origin;
+ String get origin native;
- final WorkerPerformance performance;
+ WorkerPerformance get performance native;
- final WorkerGlobalScope self;
+ WorkerGlobalScope get self native;
Future fetch(/*RequestInfo*/ input, [Map init]) {
var init_dict = null;
@@ -32425,9 +33844,9 @@
throw new UnsupportedError("Not supported");
}
- final MemoryInfo memory;
+ MemoryInfo get memory native;
- final num timeOrigin;
+ num get timeOrigin native;
void clearMarks(String markName) native;
@@ -32474,7 +33893,7 @@
JS('WorkletAnimation', 'new WorkletAnimation(#,#,#,#)', animatorName,
effects, timelines, options);
- final String playState;
+ String get playState native;
void cancel() native;
@@ -32583,19 +34002,19 @@
static const int UNORDERED_NODE_SNAPSHOT_TYPE = 6;
- final bool booleanValue;
+ bool get booleanValue native;
- final bool invalidIteratorState;
+ bool get invalidIteratorState native;
- final num numberValue;
+ num get numberValue native;
- final int resultType;
+ int get resultType native;
- final Node singleNodeValue;
+ Node get singleNodeValue native;
- final int snapshotLength;
+ int get snapshotLength native;
- final String stringValue;
+ String get stringValue native;
Node iterateNext() native;
@@ -32685,14 +34104,16 @@
}
@JSName('localName')
- final String _localName;
+ String get _localName native;
- final String name;
+ String get name native;
@JSName('namespaceURI')
- final String _namespaceUri;
+ String get _namespaceUri native;
- String value;
+ String get value native;
+
+ set value(String value) native;
}
// 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
@@ -33070,35 +34491,27 @@
// Shadowing definition.
- num get height => JS("num", "#.height", this);
+ num get height native;
- set height(num value) {
- JS("void", "#.height = #", this, value);
- }
+ set height(num value) native;
// Shadowing definition.
- num get width => JS("num", "#.width", this);
+ num get width native;
- set width(num value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(num value) native;
// Shadowing definition.
- num get x => JS("num", "#.x", this);
+ num get x native;
- set x(num value) {
- JS("void", "#.x = #", this, value);
- }
+ set x(num value) native;
// Shadowing definition.
- num get y => JS("num", "#.y", this);
+ num get y native;
- set y(num value) {
- JS("void", "#.y = #", this, value);
- }
+ set y(num value) native;
}
/**
@@ -33562,11 +34975,11 @@
throw new UnsupportedError("Not supported");
}
- final ReportBody body;
+ ReportBody get body native;
- final String type;
+ String get type native;
- final String url;
+ String get url native;
}
// 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
@@ -33590,23 +35003,23 @@
JS('_Request', 'new Request(#,#)', input, requestInitDict);
static _Request _create_2(input) => JS('_Request', 'new Request(#)', input);
- final String cache;
+ String get cache native;
- final String credentials;
+ String get credentials native;
- final Headers headers;
+ Headers get headers native;
- final String integrity;
+ String get integrity native;
- final String mode;
+ String get mode native;
- final String redirect;
+ String get redirect native;
- final String referrer;
+ String get referrer native;
- final String referrerPolicy;
+ String get referrerPolicy native;
- final String url;
+ String get url native;
_Request clone() native;
}
diff --git a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
index 60bab46..08bc19b 100644
--- a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
+++ b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
@@ -246,19 +246,19 @@
throw new UnsupportedError("Not supported");
}
- final String direction;
+ String get direction native;
@_annotation_Creates_IDBKey
@_annotation_Returns_IDBKey
- final Object key;
+ Object get key native;
@_annotation_Creates_IDBKey
@_annotation_Returns_IDBKey
- final Object primaryKey;
+ Object get primaryKey native;
@Creates('Null')
@Returns('ObjectStore|Index|Null')
- final Object source;
+ Object get source native;
void advance(int count) native;
@@ -291,7 +291,7 @@
@JSName('value')
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final dynamic _get_value;
+ dynamic get _get_value native;
}
// 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
@@ -402,15 +402,15 @@
static const EventStreamProvider<VersionChangeEvent> versionChangeEvent =
const EventStreamProvider<VersionChangeEvent>('versionchange');
- final String name;
+ String get name native;
@Returns('DomStringList|Null')
@Creates('DomStringList')
- final List<String> objectStoreNames;
+ List<String> get objectStoreNames native;
@Creates('int|String|Null')
@Returns('int|String|Null')
- final int version;
+ int get version native;
void close() native;
@@ -656,15 +656,17 @@
}
@annotation_Creates_SerializedScriptValue
- final Object keyPath;
+ Object get keyPath native;
- final bool multiEntry;
+ bool get multiEntry native;
- String name;
+ String get name native;
- final ObjectStore objectStore;
+ set name(String value) native;
- final bool unique;
+ ObjectStore get objectStore native;
+
+ bool get unique native;
@JSName('count')
Request _count(Object key) native;
@@ -725,14 +727,14 @@
}
@annotation_Creates_SerializedScriptValue
- final Object lower;
+ Object get lower native;
- final bool lowerOpen;
+ bool get lowerOpen native;
@annotation_Creates_SerializedScriptValue
- final Object upper;
+ Object get upper native;
- final bool upperOpen;
+ bool get upperOpen native;
@JSName('bound')
static KeyRange bound_(Object lower, Object upper,
@@ -879,18 +881,20 @@
throw new UnsupportedError("Not supported");
}
- final bool autoIncrement;
+ bool get autoIncrement native;
@Returns('DomStringList|Null')
@Creates('DomStringList')
- final List<String> indexNames;
+ List<String> get indexNames native;
@annotation_Creates_SerializedScriptValue
- final Object keyPath;
+ Object get keyPath native;
- String name;
+ String get name native;
- final Transaction transaction;
+ set name(String value) native;
+
+ Transaction get transaction native;
@Returns('Request')
@Creates('Request')
@@ -1024,11 +1028,11 @@
throw new UnsupportedError("Not supported");
}
- final Object key;
+ Object get key native;
- final String type;
+ String get type native;
- final Object value;
+ Object get value native;
}
// 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
@@ -1070,11 +1074,11 @@
throw new UnsupportedError("Not supported");
}
- final Database database;
+ Database get database native;
- final Object records;
+ Object get records native;
- final Transaction transaction;
+ Transaction get transaction native;
}
// 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
@@ -1143,19 +1147,19 @@
static const EventStreamProvider<Event> successEvent =
const EventStreamProvider<Event>('success');
- final DomException error;
+ DomException get error native;
- final String readyState;
+ String get readyState native;
dynamic get result => _convertNativeToDart_IDBAny(this._get_result);
@JSName('result')
@Creates('Null')
- final dynamic _get_result;
+ dynamic get _get_result native;
@Creates('Null')
- final Object source;
+ Object get source native;
- final Transaction transaction;
+ Transaction get transaction native;
/// Stream of `error` events handled by this [Request].
Stream<Event> get onError => errorEvent.forTarget(this);
@@ -1230,15 +1234,15 @@
static const EventStreamProvider<Event> errorEvent =
const EventStreamProvider<Event>('error');
- final Database db;
+ Database get db native;
- final DomException error;
+ DomException get error native;
- final String mode;
+ String get mode native;
@Returns('DomStringList|Null')
@Creates('DomStringList')
- final List<String> objectStoreNames;
+ List<String> get objectStoreNames native;
void abort() native;
@@ -1280,18 +1284,18 @@
static VersionChangeEvent _create_2(type) =>
JS('VersionChangeEvent', 'new IDBVersionChangeEvent(#)', type);
- final String dataLoss;
+ String get dataLoss native;
- final String dataLossMessage;
+ String get dataLossMessage native;
@Creates('int|String|Null')
@Returns('int|String|Null')
- final int newVersion;
+ int get newVersion native;
@Creates('int|String|Null')
@Returns('int|String|Null')
- final int oldVersion;
+ int get oldVersion native;
@JSName('target')
- final OpenDBRequest target;
+ OpenDBRequest get target native;
}
diff --git a/sdk/lib/svg/dart2js/svg_dart2js.dart b/sdk/lib/svg/dart2js/svg_dart2js.dart
index 2ad4ec6..5704564 100644
--- a/sdk/lib/svg/dart2js/svg_dart2js.dart
+++ b/sdk/lib/svg/dart2js/svg_dart2js.dart
@@ -55,11 +55,11 @@
*/
AElement.created() : super.created();
- final AnimatedString target;
+ AnimatedString get target native;
// From SVGURIReference
- final AnimatedString href;
+ AnimatedString get href native;
}
// 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
@@ -83,13 +83,19 @@
static const int SVG_ANGLETYPE_UNSPECIFIED = 1;
- final int unitType;
+ int get unitType native;
- num value;
+ num get value native;
- String valueAsString;
+ set value(num value) native;
- num valueInSpecifiedUnits;
+ String get valueAsString native;
+
+ set valueAsString(String value) native;
+
+ num get valueInSpecifiedUnits native;
+
+ set valueInSpecifiedUnits(num value) native;
void convertToSpecifiedUnits(int unitType) native;
@@ -194,9 +200,9 @@
throw new UnsupportedError("Not supported");
}
- final Angle animVal;
+ Angle get animVal native;
- final Angle baseVal;
+ Angle get baseVal native;
}
// 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
@@ -210,9 +216,11 @@
throw new UnsupportedError("Not supported");
}
- final bool animVal;
+ bool get animVal native;
- bool baseVal;
+ bool get baseVal native;
+
+ set baseVal(bool value) native;
}
// 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
@@ -226,9 +234,11 @@
throw new UnsupportedError("Not supported");
}
- final int animVal;
+ int get animVal native;
- int baseVal;
+ int get baseVal native;
+
+ set baseVal(int value) native;
}
// 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
@@ -242,9 +252,11 @@
throw new UnsupportedError("Not supported");
}
- final int animVal;
+ int get animVal native;
- int baseVal;
+ int get baseVal native;
+
+ set baseVal(int value) native;
}
// 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
@@ -258,9 +270,9 @@
throw new UnsupportedError("Not supported");
}
- final Length animVal;
+ Length get animVal native;
- final Length baseVal;
+ Length get baseVal native;
}
// 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
@@ -274,9 +286,9 @@
throw new UnsupportedError("Not supported");
}
- final LengthList animVal;
+ LengthList get animVal native;
- final LengthList baseVal;
+ LengthList get baseVal native;
}
// 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
@@ -290,9 +302,11 @@
throw new UnsupportedError("Not supported");
}
- final num animVal;
+ num get animVal native;
- num baseVal;
+ num get baseVal native;
+
+ set baseVal(num value) native;
}
// 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
@@ -306,9 +320,9 @@
throw new UnsupportedError("Not supported");
}
- final NumberList animVal;
+ NumberList get animVal native;
- final NumberList baseVal;
+ NumberList get baseVal native;
}
// 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
@@ -322,9 +336,9 @@
throw new UnsupportedError("Not supported");
}
- final PreserveAspectRatio animVal;
+ PreserveAspectRatio get animVal native;
- final PreserveAspectRatio baseVal;
+ PreserveAspectRatio get baseVal native;
}
// 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
@@ -338,9 +352,9 @@
throw new UnsupportedError("Not supported");
}
- final Rect animVal;
+ Rect get animVal native;
- final Rect baseVal;
+ Rect get baseVal native;
}
// 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
@@ -354,9 +368,11 @@
throw new UnsupportedError("Not supported");
}
- final String animVal;
+ String get animVal native;
- String baseVal;
+ String get baseVal native;
+
+ set baseVal(String value) native;
}
// 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
@@ -370,9 +386,9 @@
throw new UnsupportedError("Not supported");
}
- final TransformList animVal;
+ TransformList get animVal native;
- final TransformList baseVal;
+ TransformList get baseVal native;
}
// 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
@@ -395,7 +411,7 @@
*/
AnimationElement.created() : super.created();
- final SvgElement targetElement;
+ SvgElement get targetElement native;
void beginElement() native;
@@ -413,9 +429,9 @@
// From SVGTests
- final StringList requiredExtensions;
+ StringList get requiredExtensions native;
- final StringList systemLanguage;
+ StringList get systemLanguage native;
}
// 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
@@ -438,11 +454,11 @@
*/
CircleElement.created() : super.created();
- final AnimatedLength cx;
+ AnimatedLength get cx native;
- final AnimatedLength cy;
+ AnimatedLength get cy native;
- final AnimatedLength r;
+ AnimatedLength get r native;
}
// 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
@@ -465,7 +481,7 @@
*/
ClipPathElement.created() : super.created();
- final AnimatedEnumeration clipPathUnits;
+ AnimatedEnumeration get clipPathUnits native;
}
// 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
@@ -547,13 +563,13 @@
*/
EllipseElement.created() : super.created();
- final AnimatedLength cx;
+ AnimatedLength get cx native;
- final AnimatedLength cy;
+ AnimatedLength get cy native;
- final AnimatedLength rx;
+ AnimatedLength get rx native;
- final AnimatedLength ry;
+ AnimatedLength get ry native;
}
// 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
@@ -598,23 +614,23 @@
static const int SVG_FEBLEND_MODE_UNKNOWN = 0;
- final AnimatedString in1;
+ AnimatedString get in1 native;
- final AnimatedString in2;
+ AnimatedString get in2 native;
- final AnimatedEnumeration mode;
+ AnimatedEnumeration get mode native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -657,23 +673,23 @@
static const int SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0;
- final AnimatedString in1;
+ AnimatedString get in1 native;
- final AnimatedEnumeration type;
+ AnimatedEnumeration get type native;
- final AnimatedNumberList values;
+ AnimatedNumberList get values native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -706,19 +722,19 @@
SvgElement.isTagSupported('feComponentTransfer') &&
(new SvgElement.tag('feComponentTransfer') is FEComponentTransferElement);
- final AnimatedString in1;
+ AnimatedString get in1 native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -753,31 +769,31 @@
static const int SVG_FECOMPOSITE_OPERATOR_XOR = 5;
- final AnimatedString in1;
+ AnimatedString get in1 native;
- final AnimatedString in2;
+ AnimatedString get in2 native;
- final AnimatedNumber k1;
+ AnimatedNumber get k1 native;
- final AnimatedNumber k2;
+ AnimatedNumber get k2 native;
- final AnimatedNumber k3;
+ AnimatedNumber get k3 native;
- final AnimatedNumber k4;
+ AnimatedNumber get k4 native;
- final AnimatedEnumeration operator;
+ AnimatedEnumeration get operator native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -818,41 +834,41 @@
static const int SVG_EDGEMODE_WRAP = 2;
- final AnimatedNumber bias;
+ AnimatedNumber get bias native;
- final AnimatedNumber divisor;
+ AnimatedNumber get divisor native;
- final AnimatedEnumeration edgeMode;
+ AnimatedEnumeration get edgeMode native;
- final AnimatedString in1;
+ AnimatedString get in1 native;
- final AnimatedNumberList kernelMatrix;
+ AnimatedNumberList get kernelMatrix native;
- final AnimatedNumber kernelUnitLengthX;
+ AnimatedNumber get kernelUnitLengthX native;
- final AnimatedNumber kernelUnitLengthY;
+ AnimatedNumber get kernelUnitLengthY native;
- final AnimatedInteger orderX;
+ AnimatedInteger get orderX native;
- final AnimatedInteger orderY;
+ AnimatedInteger get orderY native;
- final AnimatedBoolean preserveAlpha;
+ AnimatedBoolean get preserveAlpha native;
- final AnimatedInteger targetX;
+ AnimatedInteger get targetX native;
- final AnimatedInteger targetY;
+ AnimatedInteger get targetY native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -885,27 +901,27 @@
SvgElement.isTagSupported('feDiffuseLighting') &&
(new SvgElement.tag('feDiffuseLighting') is FEDiffuseLightingElement);
- final AnimatedNumber diffuseConstant;
+ AnimatedNumber get diffuseConstant native;
- final AnimatedString in1;
+ AnimatedString get in1 native;
- final AnimatedNumber kernelUnitLengthX;
+ AnimatedNumber get kernelUnitLengthX native;
- final AnimatedNumber kernelUnitLengthY;
+ AnimatedNumber get kernelUnitLengthY native;
- final AnimatedNumber surfaceScale;
+ AnimatedNumber get surfaceScale native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -948,27 +964,27 @@
static const int SVG_CHANNEL_UNKNOWN = 0;
- final AnimatedString in1;
+ AnimatedString get in1 native;
- final AnimatedString in2;
+ AnimatedString get in2 native;
- final AnimatedNumber scale;
+ AnimatedNumber get scale native;
- final AnimatedEnumeration xChannelSelector;
+ AnimatedEnumeration get xChannelSelector native;
- final AnimatedEnumeration yChannelSelector;
+ AnimatedEnumeration get yChannelSelector native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1000,9 +1016,9 @@
SvgElement.isTagSupported('feDistantLight') &&
(new SvgElement.tag('feDistantLight') is FEDistantLightElement);
- final AnimatedNumber azimuth;
+ AnimatedNumber get azimuth native;
- final AnimatedNumber elevation;
+ AnimatedNumber get elevation native;
}
// 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
@@ -1037,15 +1053,15 @@
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1198,25 +1214,25 @@
SvgElement.isTagSupported('feGaussianBlur') &&
(new SvgElement.tag('feGaussianBlur') is FEGaussianBlurElement);
- final AnimatedString in1;
+ AnimatedString get in1 native;
- final AnimatedNumber stdDeviationX;
+ AnimatedNumber get stdDeviationX native;
- final AnimatedNumber stdDeviationY;
+ AnimatedNumber get stdDeviationY native;
void setStdDeviation(num stdDeviationX, num stdDeviationY) native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1249,23 +1265,23 @@
SvgElement.isTagSupported('feImage') &&
(new SvgElement.tag('feImage') is FEImageElement);
- final AnimatedPreserveAspectRatio preserveAspectRatio;
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
// From SVGURIReference
- final AnimatedString href;
+ AnimatedString get href native;
}
// 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
@@ -1300,15 +1316,15 @@
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1340,7 +1356,7 @@
SvgElement.isTagSupported('feMergeNode') &&
(new SvgElement.tag('feMergeNode') is FEMergeNodeElement);
- final AnimatedString in1;
+ AnimatedString get in1 native;
}
// 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
@@ -1371,25 +1387,25 @@
static const int SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0;
- final AnimatedString in1;
+ AnimatedString get in1 native;
- final AnimatedEnumeration operator;
+ AnimatedEnumeration get operator native;
- final AnimatedNumber radiusX;
+ AnimatedNumber get radiusX native;
- final AnimatedNumber radiusY;
+ AnimatedNumber get radiusY native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1422,23 +1438,23 @@
SvgElement.isTagSupported('feOffset') &&
(new SvgElement.tag('feOffset') is FEOffsetElement);
- final AnimatedNumber dx;
+ AnimatedNumber get dx native;
- final AnimatedNumber dy;
+ AnimatedNumber get dy native;
- final AnimatedString in1;
+ AnimatedString get in1 native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1470,11 +1486,11 @@
SvgElement.isTagSupported('fePointLight') &&
(new SvgElement.tag('fePointLight') is FEPointLightElement);
- final AnimatedNumber x;
+ AnimatedNumber get x native;
- final AnimatedNumber y;
+ AnimatedNumber get y native;
- final AnimatedNumber z;
+ AnimatedNumber get z native;
}
// 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
@@ -1507,29 +1523,29 @@
SvgElement.isTagSupported('feSpecularLighting') &&
(new SvgElement.tag('feSpecularLighting') is FESpecularLightingElement);
- final AnimatedString in1;
+ AnimatedString get in1 native;
- final AnimatedNumber kernelUnitLengthX;
+ AnimatedNumber get kernelUnitLengthX native;
- final AnimatedNumber kernelUnitLengthY;
+ AnimatedNumber get kernelUnitLengthY native;
- final AnimatedNumber specularConstant;
+ AnimatedNumber get specularConstant native;
- final AnimatedNumber specularExponent;
+ AnimatedNumber get specularExponent native;
- final AnimatedNumber surfaceScale;
+ AnimatedNumber get surfaceScale native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1561,21 +1577,21 @@
SvgElement.isTagSupported('feSpotLight') &&
(new SvgElement.tag('feSpotLight') is FESpotLightElement);
- final AnimatedNumber limitingConeAngle;
+ AnimatedNumber get limitingConeAngle native;
- final AnimatedNumber pointsAtX;
+ AnimatedNumber get pointsAtX native;
- final AnimatedNumber pointsAtY;
+ AnimatedNumber get pointsAtY native;
- final AnimatedNumber pointsAtZ;
+ AnimatedNumber get pointsAtZ native;
- final AnimatedNumber specularExponent;
+ AnimatedNumber get specularExponent native;
- final AnimatedNumber x;
+ AnimatedNumber get x native;
- final AnimatedNumber y;
+ AnimatedNumber get y native;
- final AnimatedNumber z;
+ AnimatedNumber get z native;
}
// 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
@@ -1608,19 +1624,19 @@
SvgElement.isTagSupported('feTile') &&
(new SvgElement.tag('feTile') is FETileElement);
- final AnimatedString in1;
+ AnimatedString get in1 native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1665,29 +1681,29 @@
static const int SVG_TURBULENCE_TYPE_UNKNOWN = 0;
- final AnimatedNumber baseFrequencyX;
+ AnimatedNumber get baseFrequencyX native;
- final AnimatedNumber baseFrequencyY;
+ AnimatedNumber get baseFrequencyY native;
- final AnimatedInteger numOctaves;
+ AnimatedInteger get numOctaves native;
- final AnimatedNumber seed;
+ AnimatedNumber get seed native;
- final AnimatedEnumeration stitchTiles;
+ AnimatedEnumeration get stitchTiles native;
- final AnimatedEnumeration type;
+ AnimatedEnumeration get type native;
// From SVGFilterPrimitiveStandardAttributes
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1719,21 +1735,21 @@
SvgElement.isTagSupported('filter') &&
(new SvgElement.tag('filter') is FilterElement);
- final AnimatedEnumeration filterUnits;
+ AnimatedEnumeration get filterUnits native;
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedEnumeration primitiveUnits;
+ AnimatedEnumeration get primitiveUnits native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
// From SVGURIReference
- final AnimatedString href;
+ AnimatedString get href native;
}
// 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
@@ -1746,15 +1762,15 @@
throw new UnsupportedError("Not supported");
}
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedString result;
+ AnimatedString get result native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1767,9 +1783,9 @@
throw new UnsupportedError("Not supported");
}
- final AnimatedPreserveAspectRatio preserveAspectRatio;
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- final AnimatedRect viewBox;
+ AnimatedRect get viewBox native;
}
// 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
@@ -1800,13 +1816,13 @@
SvgElement.isTagSupported('foreignObject') &&
(new SvgElement.tag('foreignObject') is ForeignObjectElement);
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -1845,7 +1861,7 @@
*/
GeometryElement.created() : super.created();
- final AnimatedNumber pathLength;
+ AnimatedNumber get pathLength native;
Point getPointAtLength(num distance) native;
@@ -1872,11 +1888,11 @@
*/
GraphicsElement.created() : super.created();
- final SvgElement farthestViewportElement;
+ SvgElement get farthestViewportElement native;
- final SvgElement nearestViewportElement;
+ SvgElement get nearestViewportElement native;
- final AnimatedTransformList transform;
+ AnimatedTransformList get transform native;
Rect getBBox() native;
@@ -1888,9 +1904,9 @@
// From SVGTests
- final StringList requiredExtensions;
+ StringList get requiredExtensions native;
- final StringList systemLanguage;
+ StringList get systemLanguage native;
}
// 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
@@ -1913,23 +1929,25 @@
*/
ImageElement.created() : super.created();
- String async;
+ String get async native;
- final AnimatedLength height;
+ set async(String value) native;
- final AnimatedPreserveAspectRatio preserveAspectRatio;
+ AnimatedLength get height native;
- final AnimatedLength width;
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- final AnimatedLength x;
+ AnimatedLength get width native;
- final AnimatedLength y;
+ AnimatedLength get x native;
+
+ AnimatedLength get y native;
Future decode() => promiseToFuture(JS("", "#.decode()", this));
// From SVGURIReference
- final AnimatedString href;
+ AnimatedString get href native;
}
// 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
@@ -1965,13 +1983,19 @@
static const int SVG_LENGTHTYPE_UNKNOWN = 0;
- final int unitType;
+ int get unitType native;
- num value;
+ num get value native;
- String valueAsString;
+ set value(num value) native;
- num valueInSpecifiedUnits;
+ String get valueAsString native;
+
+ set valueAsString(String value) native;
+
+ num get valueInSpecifiedUnits native;
+
+ set valueInSpecifiedUnits(num value) native;
void convertToSpecifiedUnits(int unitType) native;
@@ -1993,7 +2017,7 @@
int get length => JS("int", "#.length", this);
- final int numberOfItems;
+ int get numberOfItems native;
Length operator [](int index) {
if (JS("bool", "# >>> 0 !== # || # >= #", index, index, index, length))
@@ -2075,13 +2099,13 @@
*/
LineElement.created() : super.created();
- final AnimatedLength x1;
+ AnimatedLength get x1 native;
- final AnimatedLength x2;
+ AnimatedLength get x2 native;
- final AnimatedLength y1;
+ AnimatedLength get y1 native;
- final AnimatedLength y2;
+ AnimatedLength get y2 native;
}
// 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
@@ -2104,13 +2128,13 @@
*/
LinearGradientElement.created() : super.created();
- final AnimatedLength x1;
+ AnimatedLength get x1 native;
- final AnimatedLength x2;
+ AnimatedLength get x2 native;
- final AnimatedLength y1;
+ AnimatedLength get y1 native;
- final AnimatedLength y2;
+ AnimatedLength get y2 native;
}
// 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
@@ -2145,19 +2169,19 @@
static const int SVG_MARKER_ORIENT_UNKNOWN = 0;
- final AnimatedLength markerHeight;
+ AnimatedLength get markerHeight native;
- final AnimatedEnumeration markerUnits;
+ AnimatedEnumeration get markerUnits native;
- final AnimatedLength markerWidth;
+ AnimatedLength get markerWidth native;
- final AnimatedAngle orientAngle;
+ AnimatedAngle get orientAngle native;
- final AnimatedEnumeration orientType;
+ AnimatedEnumeration get orientType native;
- final AnimatedLength refX;
+ AnimatedLength get refX native;
- final AnimatedLength refY;
+ AnimatedLength get refY native;
void setOrientToAngle(Angle angle) native;
@@ -2165,9 +2189,9 @@
// From SVGFitToViewBox
- final AnimatedPreserveAspectRatio preserveAspectRatio;
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- final AnimatedRect viewBox;
+ AnimatedRect get viewBox native;
}
// 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
@@ -2190,23 +2214,23 @@
*/
MaskElement.created() : super.created();
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedEnumeration maskContentUnits;
+ AnimatedEnumeration get maskContentUnits native;
- final AnimatedEnumeration maskUnits;
+ AnimatedEnumeration get maskUnits native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
// From SVGTests
- final StringList requiredExtensions;
+ StringList get requiredExtensions native;
- final StringList systemLanguage;
+ StringList get systemLanguage native;
}
// 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
@@ -2220,17 +2244,29 @@
throw new UnsupportedError("Not supported");
}
- num a;
+ num get a native;
- num b;
+ set a(num value) native;
- num c;
+ num get b native;
- num d;
+ set b(num value) native;
- num e;
+ num get c native;
- num f;
+ set c(num value) native;
+
+ num get d native;
+
+ set d(num value) native;
+
+ num get e native;
+
+ set e(num value) native;
+
+ num get f native;
+
+ set f(num value) native;
Matrix flipX() native;
@@ -2284,7 +2320,9 @@
throw new UnsupportedError("Not supported");
}
- num value;
+ num get value native;
+
+ set value(num value) native;
}
// 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
@@ -2302,7 +2340,7 @@
int get length => JS("int", "#.length", this);
- final int numberOfItems;
+ int get numberOfItems native;
Number operator [](int index) {
if (JS("bool", "# >>> 0 !== # || # >= #", index, index, index, length))
@@ -2406,35 +2444,35 @@
*/
PatternElement.created() : super.created();
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedEnumeration patternContentUnits;
+ AnimatedEnumeration get patternContentUnits native;
- final AnimatedTransformList patternTransform;
+ AnimatedTransformList get patternTransform native;
- final AnimatedEnumeration patternUnits;
+ AnimatedEnumeration get patternUnits native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
// From SVGFitToViewBox
- final AnimatedPreserveAspectRatio preserveAspectRatio;
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- final AnimatedRect viewBox;
+ AnimatedRect get viewBox native;
// From SVGTests
- final StringList requiredExtensions;
+ StringList get requiredExtensions native;
- final StringList systemLanguage;
+ StringList get systemLanguage native;
// From SVGURIReference
- final AnimatedString href;
+ AnimatedString get href native;
}
// 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
@@ -2448,9 +2486,13 @@
throw new UnsupportedError("Not supported");
}
- num x;
+ num get x native;
- num y;
+ set x(num value) native;
+
+ num get y native;
+
+ set y(num value) native;
Point matrixTransform(Matrix matrix) native;
}
@@ -2466,9 +2508,9 @@
throw new UnsupportedError("Not supported");
}
- final int length;
+ int get length native;
- final int numberOfItems;
+ int get numberOfItems native;
void __setter__(int index, Point newItem) native;
@@ -2507,9 +2549,9 @@
*/
PolygonElement.created() : super.created();
- final PointList animatedPoints;
+ PointList get animatedPoints native;
- final PointList points;
+ PointList get points native;
}
// 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
@@ -2532,9 +2574,9 @@
*/
PolylineElement.created() : super.created();
- final PointList animatedPoints;
+ PointList get animatedPoints native;
- final PointList points;
+ PointList get points native;
}
// 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
@@ -2576,9 +2618,13 @@
static const int SVG_PRESERVEASPECTRATIO_XMINYMIN = 2;
- int align;
+ int get align native;
- int meetOrSlice;
+ set align(int value) native;
+
+ int get meetOrSlice native;
+
+ set meetOrSlice(int value) native;
}
// 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
@@ -2601,17 +2647,17 @@
*/
RadialGradientElement.created() : super.created();
- final AnimatedLength cx;
+ AnimatedLength get cx native;
- final AnimatedLength cy;
+ AnimatedLength get cy native;
- final AnimatedLength fr;
+ AnimatedLength get fr native;
- final AnimatedLength fx;
+ AnimatedLength get fx native;
- final AnimatedLength fy;
+ AnimatedLength get fy native;
- final AnimatedLength r;
+ AnimatedLength get r native;
}
// 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
@@ -2625,13 +2671,21 @@
throw new UnsupportedError("Not supported");
}
- num height;
+ num get height native;
- num width;
+ set height(num value) native;
- num x;
+ num get width native;
- num y;
+ set width(num value) native;
+
+ num get x native;
+
+ set x(num value) native;
+
+ num get y native;
+
+ set y(num value) native;
}
// 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
@@ -2654,17 +2708,17 @@
*/
RectElement.created() : super.created();
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedLength rx;
+ AnimatedLength get rx native;
- final AnimatedLength ry;
+ AnimatedLength get ry native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
}
// 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
@@ -2687,11 +2741,13 @@
*/
ScriptElement.created() : super.created();
- String type;
+ String get type native;
+
+ set type(String value) native;
// From SVGURIReference
- final AnimatedString href;
+ AnimatedString get href native;
}
// 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
@@ -2744,7 +2800,7 @@
StopElement.created() : super.created();
@JSName('offset')
- final AnimatedNumber gradientOffset;
+ AnimatedNumber get gradientOffset native;
}
// 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
@@ -2762,7 +2818,7 @@
int get length => JS("int", "#.length", this);
- final int numberOfItems;
+ int get numberOfItems native;
String operator [](int index) {
if (JS("bool", "# >>> 0 !== # || # >= #", index, index, index, length))
@@ -2843,16 +2899,23 @@
*/
StyleElement.created() : super.created();
- bool disabled;
+ bool get disabled native;
- String media;
+ set disabled(bool value) native;
- final StyleSheet sheet;
+ String get media native;
+
+ set media(String value) native;
+
+ StyleSheet get sheet native;
// Use implementation from Element.
- // final String title;
+ // String get title native;
+ // void set title(String value) native;
- String type;
+ String get type native;
+
+ set type(String value) native;
}
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -3182,18 +3245,20 @@
// Shadowing definition.
- AnimatedString get _svgClassName => JS("AnimatedString", "#.className", this);
+ AnimatedString get _svgClassName native;
@JSName('ownerSVGElement')
- final SvgSvgElement ownerSvgElement;
+ SvgSvgElement get ownerSvgElement native;
// Use implementation from Element.
- // final CssStyleDeclaration style;
+ // CssStyleDeclaration get style native;
+ // void set style(CssStyleDeclaration value) native;
// Use implementation from Element.
- // final int tabIndex;
+ // int get tabIndex native;
+ // void set tabIndex(int value) native;
- final SvgElement viewportElement;
+ SvgElement get viewportElement native;
void blur() native;
@@ -3201,7 +3266,9 @@
// From NoncedElement
- String nonce;
+ String get nonce native;
+
+ set nonce(String value) native;
ElementStream<Event> get onAbort => abortEvent.forElement(this);
@@ -3353,17 +3420,19 @@
*/
SvgSvgElement.created() : super.created();
- num currentScale;
+ num get currentScale native;
- final Point currentTranslate;
+ set currentScale(num value) native;
- final AnimatedLength height;
+ Point get currentTranslate native;
- final AnimatedLength width;
+ AnimatedLength get height native;
- final AnimatedLength x;
+ AnimatedLength get width native;
- final AnimatedLength y;
+ AnimatedLength get x native;
+
+ AnimatedLength get y native;
bool animationsPaused() native;
@@ -3425,13 +3494,15 @@
// From SVGFitToViewBox
- final AnimatedPreserveAspectRatio preserveAspectRatio;
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- final AnimatedRect viewBox;
+ AnimatedRect get viewBox native;
// From SVGZoomAndPan
- int zoomAndPan;
+ int get zoomAndPan native;
+
+ set zoomAndPan(int value) native;
}
// 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
@@ -3477,9 +3548,9 @@
// From SVGFitToViewBox
- final AnimatedPreserveAspectRatio preserveAspectRatio;
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- final AnimatedRect viewBox;
+ AnimatedRect get viewBox native;
}
// 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
@@ -3513,9 +3584,9 @@
throw new UnsupportedError("Not supported");
}
- final StringList requiredExtensions;
+ StringList get requiredExtensions native;
- final StringList systemLanguage;
+ StringList get systemLanguage native;
}
// 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
@@ -3541,9 +3612,9 @@
static const int LENGTHADJUST_UNKNOWN = 0;
- final AnimatedEnumeration lengthAdjust;
+ AnimatedEnumeration get lengthAdjust native;
- final AnimatedLength textLength;
+ AnimatedLength get textLength native;
int getCharNumAtPosition(Point point) native;
@@ -3614,15 +3685,15 @@
static const int TEXTPATH_SPACINGTYPE_UNKNOWN = 0;
- final AnimatedEnumeration method;
+ AnimatedEnumeration get method native;
- final AnimatedEnumeration spacing;
+ AnimatedEnumeration get spacing native;
- final AnimatedLength startOffset;
+ AnimatedLength get startOffset native;
// From SVGURIReference
- final AnimatedString href;
+ AnimatedString get href native;
}
// 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
@@ -3642,15 +3713,15 @@
*/
TextPositioningElement.created() : super.created();
- final AnimatedLengthList dx;
+ AnimatedLengthList get dx native;
- final AnimatedLengthList dy;
+ AnimatedLengthList get dy native;
- final AnimatedNumberList rotate;
+ AnimatedNumberList get rotate native;
- final AnimatedLengthList x;
+ AnimatedLengthList get x native;
- final AnimatedLengthList y;
+ AnimatedLengthList get y native;
}
// 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
@@ -3699,11 +3770,11 @@
static const int SVG_TRANSFORM_UNKNOWN = 0;
- final num angle;
+ num get angle native;
- final Matrix matrix;
+ Matrix get matrix native;
- final int type;
+ int get type native;
void setMatrix(Matrix matrix) native;
@@ -3733,7 +3804,7 @@
int get length => JS("int", "#.length", this);
- final int numberOfItems;
+ int get numberOfItems native;
Transform operator [](int index) {
if (JS("bool", "# >>> 0 !== # || # >= #", index, index, index, length))
@@ -3828,7 +3899,7 @@
throw new UnsupportedError("Not supported");
}
- final AnimatedString href;
+ AnimatedString get href native;
}
// 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
@@ -3851,17 +3922,17 @@
*/
UseElement.created() : super.created();
- final AnimatedLength height;
+ AnimatedLength get height native;
- final AnimatedLength width;
+ AnimatedLength get width native;
- final AnimatedLength x;
+ AnimatedLength get x native;
- final AnimatedLength y;
+ AnimatedLength get y native;
// From SVGURIReference
- final AnimatedString href;
+ AnimatedString get href native;
}
// 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
@@ -3886,13 +3957,15 @@
// From SVGFitToViewBox
- final AnimatedPreserveAspectRatio preserveAspectRatio;
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- final AnimatedRect viewBox;
+ AnimatedRect get viewBox native;
// From SVGZoomAndPan
- int zoomAndPan;
+ int get zoomAndPan native;
+
+ set zoomAndPan(int value) native;
}
// 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
@@ -3911,7 +3984,9 @@
static const int SVG_ZOOMANDPAN_UNKNOWN = 0;
- int zoomAndPan;
+ int get zoomAndPan native;
+
+ set zoomAndPan(int value) native;
}
// 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
@@ -3939,15 +4014,15 @@
static const int SVG_SPREADMETHOD_UNKNOWN = 0;
- final AnimatedTransformList gradientTransform;
+ AnimatedTransformList get gradientTransform native;
- final AnimatedEnumeration gradientUnits;
+ AnimatedEnumeration get gradientUnits native;
- final AnimatedEnumeration spreadMethod;
+ AnimatedEnumeration get spreadMethod native;
// From SVGURIReference
- final AnimatedString href;
+ AnimatedString get href native;
}
// 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
diff --git a/sdk/lib/vmservice/running_isolate.dart b/sdk/lib/vmservice/running_isolate.dart
index d811463..8f21a66 100644
--- a/sdk/lib/vmservice/running_isolate.dart
+++ b/sdk/lib/vmservice/running_isolate.dart
@@ -34,7 +34,13 @@
// If we've received approval to resume from all clients who care, clear
// approval state and resume.
- final pauseType = await _isolatePauseType(service, portId.toString());
+ var pauseType;
+ try {
+ pauseType = await _isolatePauseType(service, portId.toString());
+ } catch (_errorResponse) {
+ // ignore errors when attempting to retrieve isolate pause type
+ return;
+ }
if (pauseType != kInvalidPauseEvent &&
_shouldResume(service, null, pauseType)) {
_resumeApprovalsByName.clear();
@@ -76,9 +82,15 @@
..params.addAll({
'isolateId': isolateId,
});
- final result =
- (await routeRequest(service, getIsolateMessage)).decodeJson();
- final pauseEvent = result['result']['pauseEvent'];
+ final Response result = await routeRequest(service, getIsolateMessage);
+ final resultJson = result.decodeJson();
+ if (resultJson['result'] == null ||
+ resultJson['result']['pauseEvent'] == null) {
+ // Failed to send getIsolate message(due to isolate being de-registered
+ // for example).
+ throw result;
+ }
+ final pauseEvent = resultJson['result']['pauseEvent'];
const pauseEvents = <String, int>{
'PauseStart': kPauseOnStartMask,
'PausePostRequest': kPauseOnReloadMask,
@@ -92,8 +104,12 @@
VMService service, Message message) async {
// If we've received approval to resume from all clients who care, clear
// approval state and resume.
- final pauseType =
- await _isolatePauseType(service, message.params['isolateId']);
+ var pauseType;
+ try {
+ pauseType = await _isolatePauseType(service, message.params['isolateId']);
+ } catch (errorResponse) {
+ return errorResponse;
+ }
if (pauseType == kInvalidPauseEvent ||
_shouldResume(service, message.client, pauseType)) {
_resumeApprovalsByName.clear();
diff --git a/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart b/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
index 6a431aa..6c737f2e 100644
--- a/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
+++ b/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
@@ -52,15 +52,23 @@
static AnalyserNode _create_2(context) =>
JS('AnalyserNode', 'new AnalyserNode(#)', context);
- int fftSize;
+ int get fftSize native;
- final int frequencyBinCount;
+ set fftSize(int value) native;
- num maxDecibels;
+ int get frequencyBinCount native;
- num minDecibels;
+ num get maxDecibels native;
- num smoothingTimeConstant;
+ set maxDecibels(num value) native;
+
+ num get minDecibels native;
+
+ set minDecibels(num value) native;
+
+ num get smoothingTimeConstant native;
+
+ set smoothingTimeConstant(num value) native;
void getByteFrequencyData(Uint8List array) native;
@@ -88,13 +96,13 @@
static AudioBuffer _create_1(options) =>
JS('AudioBuffer', 'new AudioBuffer(#)', options);
- final num duration;
+ num get duration native;
- final int length;
+ int get length native;
- final int numberOfChannels;
+ int get numberOfChannels native;
- final num sampleRate;
+ num get sampleRate native;
void copyFromChannel(Float32List destination, int channelNumber,
[int startInChannel]) native;
@@ -132,17 +140,25 @@
static AudioBufferSourceNode _create_2(context) =>
JS('AudioBufferSourceNode', 'new AudioBufferSourceNode(#)', context);
- AudioBuffer buffer;
+ AudioBuffer get buffer native;
- final AudioParam detune;
+ set buffer(AudioBuffer value) native;
- bool loop;
+ AudioParam get detune native;
- num loopEnd;
+ bool get loop native;
- num loopStart;
+ set loop(bool value) native;
- final AudioParam playbackRate;
+ num get loopEnd native;
+
+ set loopEnd(num value) native;
+
+ num get loopStart native;
+
+ set loopStart(num value) native;
+
+ AudioParam get playbackRate native;
void start([num when, num grainOffset, num grainDuration]) native;
}
@@ -163,7 +179,7 @@
static bool get supported =>
JS('bool', '!!(window.AudioContext || window.webkitAudioContext)');
- final num baseLatency;
+ num get baseLatency native;
Future close() => promiseToFuture(JS("", "#.close()", this));
@@ -245,7 +261,7 @@
throw new UnsupportedError("Not supported");
}
- final int maxChannelCount;
+ int get maxChannelCount native;
}
// 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
@@ -258,23 +274,23 @@
throw new UnsupportedError("Not supported");
}
- final AudioParam forwardX;
+ AudioParam get forwardX native;
- final AudioParam forwardY;
+ AudioParam get forwardY native;
- final AudioParam forwardZ;
+ AudioParam get forwardZ native;
- final AudioParam positionX;
+ AudioParam get positionX native;
- final AudioParam positionY;
+ AudioParam get positionY native;
- final AudioParam positionZ;
+ AudioParam get positionZ native;
- final AudioParam upX;
+ AudioParam get upX native;
- final AudioParam upY;
+ AudioParam get upY native;
- final AudioParam upZ;
+ AudioParam get upZ native;
void setOrientation(num x, num y, num z, num xUp, num yUp, num zUp) native;
@@ -291,17 +307,23 @@
throw new UnsupportedError("Not supported");
}
- int channelCount;
+ int get channelCount native;
- String channelCountMode;
+ set channelCount(int value) native;
- String channelInterpretation;
+ String get channelCountMode native;
- final BaseAudioContext context;
+ set channelCountMode(String value) native;
- final int numberOfInputs;
+ String get channelInterpretation native;
- final int numberOfOutputs;
+ set channelInterpretation(String value) native;
+
+ BaseAudioContext get context native;
+
+ int get numberOfInputs native;
+
+ int get numberOfOutputs native;
@JSName('connect')
AudioNode _connect(destination, [int output, int input]) native;
@@ -327,13 +349,15 @@
throw new UnsupportedError("Not supported");
}
- final num defaultValue;
+ num get defaultValue native;
- final num maxValue;
+ num get maxValue native;
- final num minValue;
+ num get minValue native;
- num value;
+ num get value native;
+
+ set value(num value) native;
AudioParam cancelAndHoldAtTime(num startTime) native;
@@ -439,11 +463,11 @@
type,
eventInitDict);
- final AudioBuffer inputBuffer;
+ AudioBuffer get inputBuffer native;
- final AudioBuffer outputBuffer;
+ AudioBuffer get outputBuffer native;
- final num playbackTime;
+ num get playbackTime native;
}
// 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
@@ -477,17 +501,19 @@
throw new UnsupportedError("Not supported");
}
- bool enabled;
+ bool get enabled native;
- final String id;
+ set enabled(bool value) native;
- final String kind;
+ String get id native;
- final String label;
+ String get kind native;
- final String language;
+ String get label native;
- final SourceBuffer sourceBuffer;
+ String get language native;
+
+ SourceBuffer get sourceBuffer native;
}
// 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
@@ -503,7 +529,7 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- final int length;
+ int get length native;
AudioTrack __getter__(int index) native;
@@ -522,9 +548,9 @@
throw new UnsupportedError("Not supported");
}
- final num currentTime;
+ num get currentTime native;
- final num sampleRate;
+ num get sampleRate native;
void registerProcessor(String name, Object processorConstructor) native;
}
@@ -556,7 +582,7 @@
static AudioWorkletNode _create_2(context, name) =>
JS('AudioWorkletNode', 'new AudioWorkletNode(#,#)', context, name);
- final AudioParamMap parameters;
+ AudioParamMap get parameters native;
}
// 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
@@ -580,15 +606,15 @@
throw new UnsupportedError("Not supported");
}
- final num currentTime;
+ num get currentTime native;
- final AudioDestinationNode destination;
+ AudioDestinationNode get destination native;
- final AudioListener listener;
+ AudioListener get listener native;
- final num sampleRate;
+ num get sampleRate native;
- final String state;
+ String get state native;
AnalyserNode createAnalyser() native;
@@ -684,15 +710,17 @@
static BiquadFilterNode _create_2(context) =>
JS('BiquadFilterNode', 'new BiquadFilterNode(#)', context);
- final AudioParam Q;
+ AudioParam get Q native;
- final AudioParam detune;
+ AudioParam get detune native;
- final AudioParam frequency;
+ AudioParam get frequency native;
- final AudioParam gain;
+ AudioParam get gain native;
- String type;
+ String get type native;
+
+ set type(String value) native;
void getFrequencyResponse(Float32List frequencyHz, Float32List magResponse,
Float32List phaseResponse) native;
@@ -766,7 +794,7 @@
static ConstantSourceNode _create_2(context) =>
JS('ConstantSourceNode', 'new ConstantSourceNode(#)', context);
- final AudioParam offset;
+ AudioParam get offset native;
}
// 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
@@ -791,9 +819,13 @@
static ConvolverNode _create_2(context) =>
JS('ConvolverNode', 'new ConvolverNode(#)', context);
- AudioBuffer buffer;
+ AudioBuffer get buffer native;
- bool normalize;
+ set buffer(AudioBuffer value) native;
+
+ bool get normalize native;
+
+ set normalize(bool value) native;
}
// 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
@@ -818,7 +850,7 @@
static DelayNode _create_2(context) =>
JS('DelayNode', 'new DelayNode(#)', context);
- final AudioParam delayTime;
+ AudioParam get delayTime native;
}
// 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
@@ -846,17 +878,17 @@
static DynamicsCompressorNode _create_2(context) =>
JS('DynamicsCompressorNode', 'new DynamicsCompressorNode(#)', context);
- final AudioParam attack;
+ AudioParam get attack native;
- final AudioParam knee;
+ AudioParam get knee native;
- final AudioParam ratio;
+ AudioParam get ratio native;
- final num reduction;
+ num get reduction native;
- final AudioParam release;
+ AudioParam get release native;
- final AudioParam threshold;
+ AudioParam get threshold native;
}
// 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
@@ -881,7 +913,7 @@
static GainNode _create_2(context) =>
JS('GainNode', 'new GainNode(#)', context);
- final AudioParam gain;
+ AudioParam get gain native;
}
// 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
@@ -925,7 +957,7 @@
context,
options);
- final MediaElement mediaElement;
+ MediaElement get mediaElement native;
}
// 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
@@ -956,7 +988,7 @@
'new MediaStreamAudioDestinationNode(#)',
context);
- final MediaStream stream;
+ MediaStream get stream native;
}
// 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
@@ -979,7 +1011,7 @@
context,
options);
- final MediaStream mediaStream;
+ MediaStream get mediaStream native;
}
// 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
@@ -1002,7 +1034,7 @@
type,
eventInitDict);
- final AudioBuffer renderedBuffer;
+ AudioBuffer get renderedBuffer native;
}
// 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
@@ -1041,7 +1073,7 @@
'new OfflineAudioContext(#)',
numberOfChannels_OR_options);
- final int length;
+ int get length native;
Future<AudioBuffer> startRendering() =>
promiseToFuture<AudioBuffer>(JS("", "#.startRendering()", this));
@@ -1073,11 +1105,13 @@
static OscillatorNode _create_2(context) =>
JS('OscillatorNode', 'new OscillatorNode(#)', context);
- final AudioParam detune;
+ AudioParam get detune native;
- final AudioParam frequency;
+ AudioParam get frequency native;
- String type;
+ String get type native;
+
+ set type(String value) native;
void setPeriodicWave(PeriodicWave periodicWave) native;
}
@@ -1104,33 +1138,49 @@
static PannerNode _create_2(context) =>
JS('PannerNode', 'new PannerNode(#)', context);
- num coneInnerAngle;
+ num get coneInnerAngle native;
- num coneOuterAngle;
+ set coneInnerAngle(num value) native;
- num coneOuterGain;
+ num get coneOuterAngle native;
- String distanceModel;
+ set coneOuterAngle(num value) native;
- num maxDistance;
+ num get coneOuterGain native;
- final AudioParam orientationX;
+ set coneOuterGain(num value) native;
- final AudioParam orientationY;
+ String get distanceModel native;
- final AudioParam orientationZ;
+ set distanceModel(String value) native;
- String panningModel;
+ num get maxDistance native;
- final AudioParam positionX;
+ set maxDistance(num value) native;
- final AudioParam positionY;
+ AudioParam get orientationX native;
- final AudioParam positionZ;
+ AudioParam get orientationY native;
- num refDistance;
+ AudioParam get orientationZ native;
- num rolloffFactor;
+ String get panningModel native;
+
+ set panningModel(String value) native;
+
+ AudioParam get positionX native;
+
+ AudioParam get positionY native;
+
+ AudioParam get positionZ native;
+
+ num get refDistance native;
+
+ set refDistance(num value) native;
+
+ num get rolloffFactor native;
+
+ set rolloffFactor(num value) native;
void setOrientation(num x, num y, num z) native;
@@ -1179,7 +1229,7 @@
static const EventStreamProvider<AudioProcessingEvent> audioProcessEvent =
const EventStreamProvider<AudioProcessingEvent>('audioprocess');
- final int bufferSize;
+ int get bufferSize native;
void setEventListener(EventListener eventListener) native;
@@ -1217,7 +1267,7 @@
static StereoPannerNode _create_2(context) =>
JS('StereoPannerNode', 'new StereoPannerNode(#)', context);
- final AudioParam pan;
+ AudioParam get pan native;
}
// 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
@@ -1242,7 +1292,11 @@
static WaveShaperNode _create_2(context) =>
JS('WaveShaperNode', 'new WaveShaperNode(#)', context);
- Float32List curve;
+ Float32List get curve native;
- String oversample;
+ set curve(Float32List value) native;
+
+ String get oversample native;
+
+ set oversample(String value) native;
}
diff --git a/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart b/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart
index 8a6347f..22d252c 100644
--- a/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart
+++ b/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart
@@ -34,11 +34,11 @@
throw new UnsupportedError("Not supported");
}
- final String name;
+ String get name native;
- final int size;
+ int get size native;
- final int type;
+ int get type native;
}
// 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
@@ -88,10 +88,10 @@
}
@JSName('canvas')
- final CanvasElement canvas;
+ CanvasElement get canvas native;
@JSName('canvas')
- final OffscreenCanvas offscreenCanvas;
+ OffscreenCanvas get offscreenCanvas native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -314,7 +314,7 @@
static ContextEvent _create_2(type) =>
JS('ContextEvent', 'new WebGLContextEvent(#)', type);
- final String statusMessage;
+ String get statusMessage native;
}
// 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
@@ -725,13 +725,13 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.WebGLRenderingContext)');
- final CanvasElement canvas;
+ CanvasElement get canvas native;
// From WebGLRenderingContextBase
- final int drawingBufferHeight;
+ int get drawingBufferHeight native;
- final int drawingBufferWidth;
+ int get drawingBufferWidth native;
void activeTexture(int texture) native;
@@ -1362,7 +1362,7 @@
throw new UnsupportedError("Not supported");
}
- final Canvas canvas;
+ Canvas get canvas native;
// From WebGL2RenderingContextBase
@@ -2301,9 +2301,9 @@
// From WebGLRenderingContextBase
- final int drawingBufferHeight;
+ int get drawingBufferHeight native;
- final int drawingBufferWidth;
+ int get drawingBufferWidth native;
void activeTexture(int texture) native;
@@ -2856,11 +2856,11 @@
throw new UnsupportedError("Not supported");
}
- final int precision;
+ int get precision native;
- final int rangeMax;
+ int get rangeMax native;
- final int rangeMin;
+ int get rangeMin native;
}
// 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
@@ -2884,13 +2884,13 @@
throw new UnsupportedError("Not supported");
}
- final bool lastUploadedVideoFrameWasSkipped;
+ bool get lastUploadedVideoFrameWasSkipped native;
- final int lastUploadedVideoHeight;
+ int get lastUploadedVideoHeight native;
- final num lastUploadedVideoTimestamp;
+ num get lastUploadedVideoTimestamp native;
- final int lastUploadedVideoWidth;
+ int get lastUploadedVideoWidth native;
}
// 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
diff --git a/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart b/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
index afa8d39..9610771 100644
--- a/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
+++ b/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
@@ -81,7 +81,7 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.openDatabase)');
- final String version;
+ String get version native;
@JSName('changeVersion')
/**
@@ -187,9 +187,9 @@
static const int VERSION_ERR = 2;
- final int code;
+ int get code native;
- final String message;
+ String get message native;
}
// 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
@@ -202,11 +202,11 @@
throw new UnsupportedError("Not supported");
}
- final int insertId;
+ int get insertId native;
- final SqlResultSetRowList rows;
+ SqlResultSetRowList get rows native;
- final int rowsAffected;
+ int get rowsAffected native;
}
// 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
diff --git a/sdk_nnbd/BUILD.gn b/sdk_nnbd/BUILD.gn
index 49377f6..b343437 100644
--- a/sdk_nnbd/BUILD.gn
+++ b/sdk_nnbd/BUILD.gn
@@ -49,6 +49,7 @@
# ........analysis_server.dart.snapshot
# ........dart2js.dart.snapshot
# ........dartanalyzer.dart.snapshot
+# ........dartdev.dart.snapshot
# ........dartdoc.dart.snapshot
# ........dartfmt.dart.snapshot
# ........dartdevc.dart.snapshot
@@ -123,6 +124,10 @@
"../utils/dartanalyzer:generate_dartanalyzer_snapshot",
],
[
+ "dartdev",
+ "../utils/dartdev",
+ ],
+ [
"dartdoc",
"../utils/dartdoc",
],
@@ -164,6 +169,10 @@
"../utils/dartanalyzer:generate_dartanalyzer_snapshot",
],
[
+ "dartdev",
+ "../utils/dartdev",
+ ],
+ [
"dartdevc",
"../utils/dartdevc",
],
@@ -306,9 +315,7 @@
{
target = "copy_7zip"
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
+ deps = [ ":copy_libraries" ]
source = "../third_party/7zip"
dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset/7zip"
ignore_patterns = ".svn"
@@ -321,9 +328,7 @@
{
target = "copy_language_model"
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
+ deps = [ ":copy_libraries" ]
source = "../pkg/analysis_server/language_model"
dest = "$root_out_dir/dart-sdk/bin/model"
ignore_patterns = "{}"
@@ -334,9 +339,7 @@
{
target = "copy_libtensorflowlite_c"
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
+ deps = [ ":copy_libraries" ]
source = "../third_party/pkg/tflite_native/lib/src/blobs"
dest = "$root_out_dir/dart-sdk/bin/snapshots"
ignore_patterns = "*.dll,*mac64.so"
@@ -348,9 +351,7 @@
{
target = "copy_libtensorflowlite_c"
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
+ deps = [ ":copy_libraries" ]
source = "../third_party/pkg/tflite_native/lib/src/blobs"
dest = "$root_out_dir/dart-sdk/bin/snapshots"
ignore_patterns = "*.dll,*linux64.so"
@@ -362,9 +363,7 @@
{
target = "copy_libtensorflowlite_c"
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
+ deps = [ ":copy_libraries" ]
source = "../third_party/pkg/tflite_native/lib/src/blobs"
dest = "$root_out_dir/dart-sdk/bin/snapshots"
ignore_patterns = "*.so"
@@ -396,16 +395,10 @@
action("copy_dart") {
visibility = [ ":create_common_sdk" ]
dart_label = "../runtime/bin:dart"
- deps = [
- dart_label,
- ]
+ deps = [ dart_label ]
dart_out = get_label_info(dart_label, "root_out_dir")
- sources = [
- "$dart_out/$dart_stripped_binary",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/$dart_stripped_binary",
- ]
+ sources = [ "$dart_out/$dart_stripped_binary" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/$dart_stripped_binary" ]
script = "/bin/ln"
args = [
"-snf",
@@ -416,69 +409,44 @@
} else {
copy("copy_dart") {
visibility = [ ":create_common_sdk" ]
- deps = [
- "../runtime/bin:dart",
- ]
+ deps = [ "../runtime/bin:dart" ]
dart_out = get_label_info("../runtime/bin:dart", "root_out_dir")
if (is_win) {
- sources = [
- "$dart_out/dart.exe",
- ]
+ sources = [ "$dart_out/dart.exe" ]
} else {
- sources = [
- "$dart_out/$dart_stripped_binary",
- ]
+ sources = [ "$dart_out/$dart_stripped_binary" ]
}
if (is_win) {
sources += [ "$dart_out/dart.lib" ]
}
- outputs = [
- "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
- ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/{{source_file_part}}" ]
}
}
copy("copy_dartaotruntime") {
- deps = [
- "../runtime/bin:dart_precompiled_runtime",
- ]
+ deps = [ "../runtime/bin:dart_precompiled_runtime" ]
dartaotruntime_out =
get_label_info("../runtime/bin:dart_precompiled_runtime", "root_out_dir")
if (is_win) {
- sources = [
- "$dartaotruntime_out/dart_precompiled_runtime.exe",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/dartaotruntime.exe",
- ]
+ sources = [ "$dartaotruntime_out/dart_precompiled_runtime.exe" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/dartaotruntime.exe" ]
} else {
- sources = [
- "$dartaotruntime_out/$dart_precompiled_runtime_stripped_binary",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/dartaotruntime",
- ]
+ sources =
+ [ "$dartaotruntime_out/$dart_precompiled_runtime_stripped_binary" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/dartaotruntime" ]
}
}
copy("copy_gen_snapshot") {
- deps = [
- "../runtime/bin:gen_snapshot",
- ]
+ deps = [ "../runtime/bin:gen_snapshot" ]
gen_snapshot_out =
get_label_info("../runtime/bin:gen_snapshot", "root_out_dir")
if (is_win) {
- sources = [
- "$gen_snapshot_out/gen_snapshot.exe",
- ]
+ sources = [ "$gen_snapshot_out/gen_snapshot.exe" ]
} else {
- sources = [
- "$gen_snapshot_out/$gen_snapshot_stripped_binary",
- ]
+ sources = [ "$gen_snapshot_out/$gen_snapshot_stripped_binary" ]
}
- outputs = [
- "$root_out_dir/dart-sdk/bin/utils/{{source_file_part}}",
- ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/utils/{{source_file_part}}" ]
}
copy("copy_dart2native") {
@@ -491,24 +459,14 @@
if (is_win) {
ext = ".bat"
}
- sources = [
- "bin/dart2native$ext",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
- ]
+ sources = [ "bin/dart2native$ext" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/{{source_file_part}}" ]
}
copy("copy_gen_kernel_snapshot") {
- deps = [
- "../utils/gen_kernel",
- ]
- sources = [
- "$root_gen_dir/gen_kernel.dart.snapshot",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}",
- ]
+ deps = [ "../utils/gen_kernel" ]
+ sources = [ "$root_gen_dir/gen_kernel.dart.snapshot" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}" ]
}
# A template for copying the things in _platform_sdk_scripts and
@@ -525,12 +483,8 @@
":copy_platform_sdk_scripts",
":copy_full_sdk_scripts",
]
- sources = [
- "bin/${name}_sdk$ext",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/$name$ext",
- ]
+ sources = [ "bin/${name}_sdk$ext" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/$name$ext" ]
}
}
@@ -550,12 +504,8 @@
if (is_win) {
ext = ".bat"
}
- sources = [
- "bin/$script$ext",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
- ]
+ sources = [ "bin/$script$ext" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/{{source_file_part}}" ]
}
}
@@ -597,15 +547,9 @@
":copy_platform_sdk_snapshots",
":copy_full_sdk_snapshots",
]
- deps = [
- snapshot[1],
- ]
- sources = [
- "$root/${snapshot[0]}.dart.snapshot",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}",
- ]
+ deps = [ snapshot[1] ]
+ sources = [ "$root/${snapshot[0]}.dart.snapshot" ]
+ outputs = [ "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}" ]
}
}
@@ -649,12 +593,8 @@
":copy_libraries",
"../utils/dartanalyzer:generate_summary_strong",
]
- sources = [
- "$root_gen_dir/strong.sum",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
- ]
+ sources = [ "$root_gen_dir/strong.sum" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}
# This rule copies dill files to lib/_internal.
@@ -664,22 +604,14 @@
":copy_libraries",
"../runtime/vm:kernel_platform_files",
]
- sources = [
- "$root_out_dir/vm_platform_strong.dill",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
- ]
+ sources = [ "$root_out_dir/vm_platform_strong.dill" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}
copy("copy_abi_dill_files") {
visibility = [ ":create_sdk_with_abi_versions" ]
- sources = [
- "../tools/abiversions",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/abiversions",
- ]
+ sources = [ "../tools/abiversions" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/abiversions" ]
}
copy("copy_dart2js_dill_files") {
@@ -693,9 +625,7 @@
"$root_out_dir/dart2js_platform.dill",
"$root_out_dir/dart2js_server_platform.dill",
]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
- ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}
# This rule copies ddc summaries to lib/_internal
@@ -705,20 +635,14 @@
":copy_libraries",
"../utils/dartdevc:dartdevc_platform",
]
- sources = [
- "$root_out_dir/ddc_sdk.dill",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
- ]
+ sources = [ "$root_out_dir/ddc_sdk.dill" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}
# This rule copies DDK's JS SDK and require.js to lib/dev_compiler/kernel/amd.
copy("copy_dev_compiler_js_amd_kernel") {
visibility = [ ":copy_dev_compiler_js" ]
- deps = [
- "../utils/dartdevc:dartdevc_kernel_sdk",
- ]
+ deps = [ "../utils/dartdevc:dartdevc_kernel_sdk" ]
gen_dir =
get_label_info("../utils/dartdevc:dartdevc_kernel_sdk", "target_gen_dir")
sources = [
@@ -734,9 +658,7 @@
# This rule copies DDK's JS SDK to lib/dev_compiler/kernel/common.
copy("copy_dev_compiler_js_common_kernel") {
visibility = [ ":copy_dev_compiler_js" ]
- deps = [
- "../utils/dartdevc:dartdevc_kernel_sdk",
- ]
+ deps = [ "../utils/dartdevc:dartdevc_kernel_sdk" ]
gen_dir =
get_label_info("../utils/dartdevc:dartdevc_kernel_sdk", "target_gen_dir")
sources = [
@@ -744,17 +666,13 @@
"$gen_dir/kernel/common/dart_sdk.js.map",
"../pkg/dev_compiler/lib/js/common/run.js",
]
- outputs = [
- "$root_out_dir/dart-sdk/lib/dev_compiler/kernel/common/{{source_file_part}}",
- ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/dev_compiler/kernel/common/{{source_file_part}}" ]
}
# This rule copies DDK's JS SDK to lib/dev_compiler/kernel/es6.
copy("copy_dev_compiler_js_es6_kernel") {
visibility = [ ":copy_dev_compiler_js" ]
- deps = [
- "../utils/dartdevc:dartdevc_kernel_sdk",
- ]
+ deps = [ "../utils/dartdevc:dartdevc_kernel_sdk" ]
gen_dir =
get_label_info("../utils/dartdevc:dartdevc_kernel_sdk", "target_gen_dir")
sources = [
@@ -788,12 +706,9 @@
]
dart_out =
get_label_info("../utils/dartdevc:stack_trace_mapper", "root_out_dir")
- sources = [
- "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/dev_compiler/web/{{source_file_part}}",
- ]
+ sources = [ "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js" ]
+ outputs =
+ [ "$root_out_dir/dart-sdk/lib/dev_compiler/web/{{source_file_part}}" ]
}
# This is the main rule for copying ddc's dependencies to lib/
@@ -814,23 +729,15 @@
"../runtime/include/dart_native_api.h",
"../runtime/include/dart_tools_api.h",
]
- outputs = [
- "$root_out_dir/dart-sdk/include/{{source_file_part}}",
- ]
+ outputs = [ "$root_out_dir/dart-sdk/include/{{source_file_part}}" ]
}
# This rule copies libraries.json files to lib/
copy("copy_libraries_specification") {
visibility = [ ":create_common_sdk" ]
- sources = [
- "lib/libraries.json",
- ]
- deps = [
- ":copy_libraries",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/{{source_file_part}}",
- ]
+ sources = [ "lib/libraries.json" ]
+ deps = [ ":copy_libraries" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/{{source_file_part}}" ]
}
# This is the main rule to copy libraries in _platform_sdk_libraries to lib/
@@ -859,13 +766,9 @@
group("copy_libraries") {
if (dart_platform_sdk) {
- public_deps = [
- ":copy_platform_sdk_libraries",
- ]
+ public_deps = [ ":copy_platform_sdk_libraries" ]
} else {
- public_deps = [
- ":copy_full_sdk_libraries",
- ]
+ public_deps = [ ":copy_full_sdk_libraries" ]
}
}
@@ -877,9 +780,7 @@
"$default_git_folder/logs/HEAD",
]
output = "$root_out_dir/dart-sdk/version"
- outputs = [
- output,
- ]
+ outputs = [ output ]
script = "../tools/write_version_file.py"
args = [
"--output",
@@ -890,13 +791,9 @@
# This rule writes the revision file.
action("write_revision_file") {
visibility = [ ":create_common_sdk" ]
- inputs = [
- "$default_git_folder/logs/HEAD",
- ]
+ inputs = [ "$default_git_folder/logs/HEAD" ]
output = "$root_out_dir/dart-sdk/revision"
- outputs = [
- output,
- ]
+ outputs = [ output ]
script = "../tools/write_revision_file.py"
args = [
"--output",
@@ -913,49 +810,31 @@
# analyzer and popular frameworks have migrated to use it.
copy("copy_libraries_dart") {
visibility = [ ":create_common_sdk" ]
- deps = [
- ":copy_libraries",
- ]
- sources = [
- "lib/_internal/sdk_library_metadata/lib/libraries.dart",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
- ]
+ deps = [ ":copy_libraries" ]
+ sources = [ "lib/_internal/sdk_library_metadata/lib/libraries.dart" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
}
# This rule copies the README file.
copy("copy_readme") {
visibility = [ ":create_common_sdk" ]
- sources = [
- "../README.dart-sdk",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/README",
- ]
+ sources = [ "../README.dart-sdk" ]
+ outputs = [ "$root_out_dir/dart-sdk/README" ]
}
# This rule copies the LICENSE file.
copy("copy_license") {
visibility = [ ":create_common_sdk" ]
- sources = [
- "../LICENSE",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/LICENSE",
- ]
+ sources = [ "../LICENSE" ]
+ outputs = [ "$root_out_dir/dart-sdk/LICENSE" ]
}
# This rule generates a custom dartdoc_options.yaml file.
action("write_dartdoc_options") {
visibility = [ ":create_common_sdk" ]
- inputs = [
- "$default_git_folder/logs/HEAD",
- ]
+ inputs = [ "$default_git_folder/logs/HEAD" ]
output = "$root_out_dir/dart-sdk/dartdoc_options.yaml"
- outputs = [
- output,
- ]
+ outputs = [ output ]
script = "../tools/write_dartdoc_options_file.py"
args = [
"--output",
@@ -966,12 +845,8 @@
# This rule copies the API readme file to lib/
copy("copy_api_readme") {
visibility = [ ":create_common_sdk" ]
- sources = [
- "api_readme.md",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/api_readme.md",
- ]
+ sources = [ "api_readme.md" ]
+ outputs = [ "$root_out_dir/dart-sdk/lib/api_readme.md" ]
}
# Parts common to both platform and full SDKs.
@@ -1035,9 +910,7 @@
# The main target to depend on from ../BUILD.gn
group("create_sdk") {
- public_deps = [
- ":create_common_sdk",
- ]
+ public_deps = [ ":create_common_sdk" ]
if (dart_platform_sdk) {
public_deps += [ ":create_platform_sdk" ]
} else {
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/async_patch.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/async_patch.dart
index 089ed04..78ba91b 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/async_patch.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/async_patch.dart
@@ -25,7 +25,7 @@
_async<T>(Function() initGenerator) {
var iter;
late Object? Function(Object?) onValue;
- late Object Function(Object, StackTrace) onError;
+ late Object Function(Object, StackTrace?) onError;
onAwait(Object? value) {
_Future<Object?> f;
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/collection_patch.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/collection_patch.dart
index dbcfb6d..c10f04f 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/collection_patch.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/collection_patch.dart
@@ -130,8 +130,7 @@
identical(identical, equals)) {
return _IdentityHashSet<E>();
}
- return _CustomHashSet<E>(
- equals ?? dart.equals, hashCode ?? dart.hashCode);
+ return _CustomHashSet<E>(equals ?? dart.equals, hashCode);
}
return _CustomKeyHashSet<E>(
equals ?? dart.equals, hashCode ?? dart.hashCode, isValidKey);
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/core_patch.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/core_patch.dart
index 8baf647..273c38d 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/core_patch.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/core_patch.dart
@@ -134,14 +134,14 @@
@JSExportName('as')
static Object? _as_Function(Object? o) {
// Avoid extra function call to core.Function.is() by manually inlining.
- if (JS<bool>('!', 'typeof $o == "function"') || o == null) return o;
+ if (JS<bool>('!', 'typeof $o == "function"')) return o;
return dart.cast(o, dart.unwrapType(Function), false);
}
@JSExportName('_check')
static Object? _check_Function(Object? o) {
// Avoid extra function call to core.Function.is() by manually inlining.
- if (JS<bool>('!', 'typeof $o == "function"') || o == null) return o;
+ if (JS<bool>('!', 'typeof $o == "function"')) return o;
return dart.cast(o, dart.unwrapType(Function), true);
}
}
@@ -215,8 +215,7 @@
@JSExportName('as')
static Object? _as_int(Object? o) {
// Avoid extra function call to core.int.is() by manually inlining.
- if (JS<bool>('!', '(typeof $o == "number" && Math.floor($o) == $o)') ||
- o == null) {
+ if (JS<bool>('!', '(typeof $o == "number" && Math.floor($o) == $o)')) {
return o;
}
return dart.cast(o, dart.unwrapType(int), false);
@@ -225,8 +224,7 @@
@JSExportName('_check')
static Object? _check_int(Object? o) {
// Avoid extra function call to core.int.is() by manually inlining.
- if (JS<bool>('!', '(typeof $o == "number" && Math.floor($o) == $o)') ||
- o == null) {
+ if (JS<bool>('!', '(typeof $o == "number" && Math.floor($o) == $o)')) {
return o;
}
return dart.cast(o, dart.unwrapType(int), true);
@@ -254,14 +252,14 @@
@JSExportName('as')
static Object? _as_double(Object? o) {
// Avoid extra function call to core.double.is() by manually inlining.
- if (JS<bool>('!', 'typeof $o == "number"') || o == null) return o;
+ if (JS<bool>('!', 'typeof $o == "number"')) return o;
return dart.cast(o, dart.unwrapType(double), false);
}
@JSExportName('_check')
static Object? _check_double(Object? o) {
// Avoid extra function call to core.double.is() by manually inlining.
- if (JS<bool>('!', 'typeof $o == "number"') || o == null) return o;
+ if (JS<bool>('!', 'typeof $o == "number"')) return o;
return dart.cast(o, dart.unwrapType(double), true);
}
}
@@ -276,14 +274,14 @@
@JSExportName('as')
static Object? _as_num(Object? o) {
// Avoid extra function call to core.num.is() by manually inlining.
- if (JS<bool>('!', 'typeof $o == "number"') || o == null) return o;
+ if (JS<bool>('!', 'typeof $o == "number"')) return o;
return dart.cast(o, dart.unwrapType(num), false);
}
@JSExportName('_check')
static Object? _check_num(Object? o) {
// Avoid extra function call to core.num.is() by manually inlining.
- if (JS<bool>('!', 'typeof $o == "number"') || o == null) return o;
+ if (JS<bool>('!', 'typeof $o == "number"')) return o;
return dart.cast(o, dart.unwrapType(num), true);
}
}
@@ -662,14 +660,14 @@
@JSExportName('as')
static Object? _as_String(Object? o) {
// Avoid extra function call to core.String.is() by manually inlining.
- if (JS<bool>('!', 'typeof $o == "string"') || o == null) return o;
+ if (JS<bool>('!', 'typeof $o == "string"')) return o;
return dart.cast(o, dart.unwrapType(String), false);
}
@JSExportName('_check')
static Object? _check_String(Object? o) {
// Avoid extra function call to core.String.is() by manually inlining.
- if (JS<bool>('!', 'typeof $o == "string"') || o == null) return o;
+ if (JS<bool>('!', 'typeof $o == "string"')) return o;
return dart.cast(o, dart.unwrapType(String), true);
}
}
@@ -693,14 +691,14 @@
@JSExportName('as')
static Object? _as_bool(Object? o) {
// Avoid extra function call to core.bool.is() by manually inlining.
- if (JS<bool>("!", '$o === true || $o === false') || o == null) return o;
+ if (JS<bool>("!", '$o === true || $o === false')) return o;
return dart.cast(o, dart.unwrapType(bool), false);
}
@JSExportName('_check')
static Object? _check_bool(Object? o) {
// Avoid extra function call to core.bool.is() by manually inlining.
- if (JS<bool>("!", '$o === true || $o === false') || o == null) return o;
+ if (JS<bool>("!", '$o === true || $o === false')) return o;
return dart.cast(o, dart.unwrapType(bool), true);
}
}
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/io_patch.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/io_patch.dart
index bbe913d..cd854ce 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/io_patch.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/io_patch.dart
@@ -73,7 +73,7 @@
@patch
class _EventHandler {
@patch
- static void _sendData(Object sender, SendPort sendPort, int data) {
+ static void _sendData(Object? sender, SendPort sendPort, int data) {
throw UnsupportedError("EventHandler._sendData");
}
}
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart
index 398cbf6..0d62265 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart
@@ -24,10 +24,10 @@
throw AssertionErrorImpl(message, fileUri, line, column, conditionSource);
}
+final _nullFailedSet = JS('!', 'new Set()');
// Run-time null safety assertion per:
// https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/feature-specification.md#automatic-debug-assertion-insertion
nullFailed(String? fileUri, int? line, int? column, String? variable) {
- // TODO(vsm): Consider a weak mode warning cached by location.
if (_strictSubtypeChecks) {
throw AssertionErrorImpl(
'A null value was passed into a non-nullable parameter $variable',
@@ -35,6 +35,13 @@
line,
column,
'$variable != null');
+ } else {
+ var key = '$fileUri:$line:$column';
+ if (!JS('!', '#.has(#)', _nullFailedSet, key)) {
+ JS('', '#.add(#)', _nullFailedSet, key);
+ _nullWarn(
+ 'A null value was passed into a non-nullable parameter $variable');
+ }
}
}
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
index 87ef6e1..ca682cf 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
@@ -186,7 +186,7 @@
var error = "Dynamic call with missing required named arguments: "
"${missingRequired.join(', ')}.";
if (!_strictSubtypeChecks) {
- _warn("$error This will be an error when strict mode is enabled.");
+ _nullWarn(error);
} else {
return error;
}
@@ -422,7 +422,22 @@
@JSExportName('as')
cast(obj, type, @notNull bool isImplicit) {
- if (obj == null && (_isNullable(type) || _isNullType(type))) return obj;
+ // We hoist the common case where null is checked against another type here
+ // for better performance.
+ if (obj == null) {
+ if (_isLegacy(type) ||
+ _isNullType(type) ||
+ _isTop(type) ||
+ _isNullable(type)) {
+ return obj;
+ }
+ if (_strictSubtypeChecks) {
+ return castError(obj, type, isImplicit);
+ }
+ // Check the null comparison cache to avoid emitting repeated warnings.
+ _nullWarnOnType(type);
+ return obj;
+ }
var actual = getReifiedType(obj);
if (isSubtypeOf(actual, type)) {
return obj;
@@ -448,14 +463,20 @@
}
asInt(obj) {
- if (obj == null) return null;
-
+ // Note: null (and undefined) will fail this test.
if (JS('!', 'Math.floor(#) != #', obj, obj)) {
- castError(obj, JS('', '#', int), false);
+ if (obj == null && !_strictSubtypeChecks) {
+ _nullWarnOnType(JS('', '#', int));
+ return null;
+ } else {
+ castError(obj, JS('', '#', int), false);
+ }
}
return obj;
}
+asNullableInt(obj) => obj == null ? null : asInt(obj);
+
/// Checks that `x` is not null or undefined.
//
// TODO(jmesserly): inline this, either by generating it as a function into
@@ -469,6 +490,23 @@
return x;
}
+/// Checks that `x` is not null or undefined.
+///
+/// Unlike `_notNull`, this throws a `CastError` (under strict checking)
+/// or emits a runtime warning (otherwise). This is only used by the
+/// compiler when casting from nullable to non-nullable variants of the
+/// same type.
+nullCast(x, type, [@notNull bool isImplicit = false]) {
+ if (x == null) {
+ if (!_strictSubtypeChecks) {
+ _nullWarnOnType(type);
+ } else {
+ castError(x, type, isImplicit);
+ }
+ }
+ return x;
+}
+
/// The global constant map table.
final constantMaps = JS<Object>('!', 'new Map()');
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart
index c0e6173..45efd17 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart
@@ -170,6 +170,8 @@
///
/// This is used by [hotRestart] to ensure we don't leak types from previous
/// libraries.
+/// Results made against Null are cached in _nullComparisonMap and must be
+/// cleared separately.
@notNull
final List<Object> _cacheMaps = JS('!', '[]');
@@ -199,6 +201,7 @@
_resetFields.clear();
for (var m in _cacheMaps) JS('', '#.clear()', m);
_cacheMaps.clear();
+ JS('', '#.clear()', _nullComparisonSet);
JS('', '#.clear()', constantMaps);
}
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
index 408a4f5..68da983 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
@@ -215,8 +215,32 @@
JS('void', 'console.warn(#)', arg);
}
-var _lazyJSTypes = JS('', 'new Map()');
-var _anonymousJSTypes = JS('', 'new Map()');
+void _nullWarn(arg) {
+ _warn('$arg\n'
+ 'This will become a failure when runtime null safety is enabled.');
+}
+
+/// Tracks objects that have been compared against null (i.e., null is Type).
+/// Separating this null set out from _cacheMaps lets us fast-track common
+/// legacy type checks.
+/// TODO: Delete this set when legacy nullability is phased out.
+var _nullComparisonSet = JS<Object>('', 'new Set()');
+
+/// Warn on null cast failures when casting to a particular non-nullable
+/// `type`. Note, we cache by type to avoid excessive warning messages at
+/// runtime.
+/// TODO(vsm): Consider changing all invocations to pass / cache on location
+/// instead. That gives more useful feedback to the user.
+void _nullWarnOnType(type) {
+ bool result = JS('', '#.has(#)', _nullComparisonSet, type);
+ if (!result) {
+ JS('', '#.add(#)', _nullComparisonSet, type);
+ _nullWarn("Null is not a subtype of $type.");
+ }
+}
+
+var _lazyJSTypes = JS<Object>('', 'new Map()');
+var _anonymousJSTypes = JS<Object>('', 'new Map()');
lazyJSType(Function() getJSTypeCallback, String name) {
var ret = JS('', '#.get(#)', _lazyJSTypes, name);
@@ -251,7 +275,7 @@
Object nullable(type) {
if (_isNullable(type) || _isTop(type) || _isNullType(type)) return type;
if (type == never_) return unwrapType(Null);
- if (_isLegacy(type)) type = type.type;
+ if (_isLegacy(type)) type = JS<Object>('', '#.type', type);
// Check if a nullable version of this type has already been created.
if (JS<bool>('!', '#.hasOwnProperty(#)', type, _cachedNullable)) {
@@ -747,7 +771,6 @@
@JSExportName('as')
as_T(obj, [@notNull bool isImplicit = false]) {
- if (obj == null) return obj;
if (JS('!', 'typeof # == "function"', obj)) {
var actual = JS('', '#[#]', obj, _runtimeType);
// If there's no actual type, it's a JS function.
@@ -971,13 +994,13 @@
@JSExportName('as')
as_T(obj) {
- if (obj == null || is_T(obj)) return obj;
+ if (is_T(obj)) return obj;
return castError(obj, this, false);
}
@JSExportName('_check')
check_T(obj) {
- if (obj == null || is_T(obj)) return obj;
+ if (is_T(obj)) return obj;
return castError(obj, this, true);
}
}
@@ -1168,6 +1191,8 @@
bool isSubtypeOf(Object t1, Object t2) {
// TODO(jmesserly): we've optimized `is`/`as`/implicit type checks, so they're
// dispatched on the type. Can we optimize the subtype relation too?
+ // TODO: Find a way to eagerly attach this cache to the Null object at
+ // compile-time so we can remove the top-level null comparison cache entirely.
Object map;
if (JS('!', '!#.hasOwnProperty(#)', t1, _subtypeCache)) {
JS('', '#[#] = #', t1, _subtypeCache, map = JS<Object>('!', 'new Map()'));
@@ -1184,9 +1209,8 @@
if (validSubtype) {
// TODO(nshahan) Need more information to be helpful here.
// File and line number that caused the subtype check?
- // Possibly break into debuger?
- _warn("$t1 is not a subtype of $t2.\n"
- "This will be a runtime failure when strict mode is enabled.");
+ // Possibly break into debugger?
+ _nullWarn("$t1 is not a subtype of $t2.");
}
}
JS('', '#.set(#, #)', map, t2, validSubtype);
@@ -1390,15 +1414,9 @@
// Without type bounds all will instantiate to dynamic. Only need to check
// further if at least one of the functions has type bounds.
if ($t1.hasTypeBounds || $t2.hasTypeBounds) {
- // Check the bounds of the type parameters of g1 and g2.
- // given a type parameter `T1 extends U1` from g1, and a type parameter
- // `T2 extends U2` from g2, we must ensure that:
- //
- // U1 == U2
- //
- // given a legacy type can be equivalent to nullable or non-nullable
- // versions of the same type. The language spec recomends testing for
- // mutual subtypes to allow this behaivor.
+ // Check the bounds of the type parameters of g1 and g2. Given a type
+ // parameter `T1 extends U1` from g1, and a type parameter `T2 extends U2`
+ // from g2, we must ensure that U1 and U2 are mutual subtypes.
//
// (Note there is no variance in the type bounds of type parameters of
// generic functions).
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/private/js_helper.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/private/js_helper.dart
index 26c9db6..d084aeb 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/private/js_helper.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/private/js_helper.dart
@@ -704,25 +704,22 @@
*/
abstract class JavaScriptIndexingBehavior<E> {}
-// TODO(lrn): These exceptions should be implemented in core.
-// When they are, remove the 'Implementation' here.
-
/// Thrown by type assertions that fail.
class TypeErrorImpl extends Error implements TypeError {
- final String message;
+ final String _message;
- TypeErrorImpl(this.message);
+ TypeErrorImpl(this._message);
- String toString() => message;
+ String toString() => _message;
}
/// Thrown by the 'as' operator if the cast isn't valid.
class CastErrorImpl extends Error implements CastError {
- final String message;
+ final String _message;
- CastErrorImpl(this.message);
+ CastErrorImpl(this._message);
- String toString() => message;
+ String toString() => _message;
}
class FallThroughErrorImplementation extends FallThroughError {
diff --git a/sdk_nnbd/lib/_internal/js_runtime/lib/foreign_helper.dart b/sdk_nnbd/lib/_internal/js_runtime/lib/foreign_helper.dart
index b40f709..88ca3d2 100644
--- a/sdk_nnbd/lib/_internal/js_runtime/lib/foreign_helper.dart
+++ b/sdk_nnbd/lib/_internal/js_runtime/lib/foreign_helper.dart
@@ -5,6 +5,7 @@
library _foreign_helper;
import 'dart:_js_embedded_names' show JsGetName, JsBuiltin;
+import 'dart:_rti' show Rti;
/// Emits a JavaScript code fragment parametrized by arguments.
///
@@ -237,7 +238,10 @@
external bool JS_GET_FLAG(String name);
/// Returns a TypeReference to [T].
-external TYPE_REF<T>();
+external Rti TYPE_REF<T>();
+
+/// Returns a TypeReference to [T]*.
+external Rti LEGACY_TYPE_REF<T>();
/// Pretend [code] is executed. Generates no executable code. This is used to
/// model effects at some other point in external code. For example, the
diff --git a/sdk_nnbd/lib/_internal/js_runtime/lib/io_patch.dart b/sdk_nnbd/lib/_internal/js_runtime/lib/io_patch.dart
index f657133..a6121c9 100644
--- a/sdk_nnbd/lib/_internal/js_runtime/lib/io_patch.dart
+++ b/sdk_nnbd/lib/_internal/js_runtime/lib/io_patch.dart
@@ -73,7 +73,7 @@
@patch
class _EventHandler {
@patch
- static void _sendData(Object sender, SendPort sendPort, int data) {
+ static void _sendData(Object? sender, SendPort sendPort, int data) {
throw new UnsupportedError("EventHandler._sendData");
}
}
diff --git a/sdk_nnbd/lib/_internal/js_runtime/lib/js_helper.dart b/sdk_nnbd/lib/_internal/js_runtime/lib/js_helper.dart
index 83302ec..ca5caab 100644
--- a/sdk_nnbd/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk_nnbd/lib/_internal/js_runtime/lib/js_helper.dart
@@ -3086,34 +3086,30 @@
/// visible to anyone, and is only injected into special libraries.
abstract class JavaScriptIndexingBehavior<E> extends JSMutableIndexable<E> {}
-// TODO(lrn): These exceptions should be implemented in core.
-// When they are, remove the 'Implementation' here.
-
/// Thrown by type assertions that fail.
class TypeErrorImplementation extends Error implements TypeError {
- final String message;
+ final String _message;
/// Normal type error caused by a failed subtype test.
TypeErrorImplementation(Object value, String type)
- : message = "TypeError: ${Error.safeToString(value)}: type "
+ : _message = "TypeError: ${Error.safeToString(value)}: type "
"'${_typeDescription(value)}' is not a subtype of type '$type'";
- TypeErrorImplementation.fromMessage(String this.message);
+ TypeErrorImplementation.fromMessage(String this._message);
- String toString() => message;
+ String toString() => _message;
}
/// Thrown by the 'as' operator if the cast isn't valid.
class CastErrorImplementation extends Error implements CastError {
- // TODO(lrn): Rename to CastError (and move implementation into core).
- final String message;
+ final String _message;
/// Normal cast error caused by a failed type cast.
CastErrorImplementation(Object value, Object type)
- : message = "CastError: ${Error.safeToString(value)}: type "
+ : _message = "CastError: ${Error.safeToString(value)}: type "
"'${_typeDescription(value)}' is not a subtype of type '$type'";
- String toString() => message;
+ String toString() => _message;
}
String _typeDescription(value) {
diff --git a/sdk_nnbd/lib/_internal/js_runtime/lib/rti.dart b/sdk_nnbd/lib/_internal/js_runtime/lib/rti.dart
index 3c4a5eb..67f8325 100644
--- a/sdk_nnbd/lib/_internal/js_runtime/lib/rti.dart
+++ b/sdk_nnbd/lib/_internal/js_runtime/lib/rti.dart
@@ -15,7 +15,8 @@
JS_GET_FLAG,
JS_GET_NAME,
RAW_DART_FUNCTION_REF,
- TYPE_REF;
+ TYPE_REF,
+ LEGACY_TYPE_REF;
import 'dart:_interceptors'
show JavaScriptFunction, JSArray, JSUnmodifiableArray;
@@ -302,7 +303,7 @@
/// different indexing in the recipe.
Object? _evalCache;
- static Object? _getEvalCache(Rti rti) => rti._evalCache!;
+ static Object? _getEvalCache(Rti rti) => rti._evalCache;
static void _setEvalCache(Rti rti, value) {
rti._evalCache = value;
}
@@ -322,7 +323,7 @@
/// instantiations.
Object? _bindCache;
- static Object? _getBindCache(Rti rti) => rti._bindCache!;
+ static Object? _getBindCache(Rti rti) => rti._bindCache;
static void _setBindCache(Rti rti, value) {
rti._bindCache = value;
}
@@ -331,10 +332,10 @@
return new Rti();
}
- late Object _canonicalRecipe;
+ Object? _canonicalRecipe;
static String _getCanonicalRecipe(Rti rti) {
- Object s = rti._canonicalRecipe;
+ Object s = rti._canonicalRecipe!;
assert(_Utils.isString(s), 'Missing canonical recipe');
return _Utils.asString(s);
}
@@ -349,7 +350,7 @@
static _FunctionParameters allocate() => _FunctionParameters();
- late Object _requiredPositional;
+ Object? _requiredPositional;
static JSArray _getRequiredPositional(_FunctionParameters parameters) =>
JS('JSUnmodifiableArray', '#', parameters._requiredPositional);
static void _setRequiredPositional(
@@ -357,7 +358,7 @@
parameters._requiredPositional = requiredPositional;
}
- late Object _optionalPositional;
+ Object? _optionalPositional;
static JSArray _getOptionalPositional(_FunctionParameters parameters) =>
JS('JSUnmodifiableArray', '#', parameters._optionalPositional);
static void _setOptionalPositional(
@@ -374,7 +375,7 @@
/// the name [String]s and the odd indices are the type [Rti]s.
///
/// Invariant: These pairs are sorted by name in lexicographically ascending order.
- late Object _optionalNamed;
+ Object? _optionalNamed;
static JSArray _getOptionalNamed(_FunctionParameters parameters) =>
JS('JSUnmodifiableArray', '#', parameters._optionalNamed);
static void _setOptionalNamed(
@@ -1672,15 +1673,13 @@
baseKind == Rti.kindFutureOr &&
isNullable(Rti._getFutureOrArgument(baseType))) {
return baseType;
- } else if (baseKind == Rti.kindNever) {
+ } else if (baseKind == Rti.kindNever ||
+ _Utils.isIdentical(baseType, LEGACY_TYPE_REF<Never>())) {
return TYPE_REF<Null>();
} else if (baseKind == Rti.kindStar) {
Rti starArgument = Rti._getStarArgument(baseType);
int starArgumentKind = Rti._getKind(starArgument);
- // TODO(fishythefish): Directly test for `LEGACY_TYPE_REF<Never>()`.
- if (starArgumentKind == Rti.kindNever) {
- return TYPE_REF<Null>();
- } else if (starArgumentKind == Rti.kindFutureOr &&
+ if (starArgumentKind == Rti.kindFutureOr &&
isNullable(Rti._getFutureOrArgument(starArgument))) {
return starArgument;
} else {
@@ -1708,18 +1707,13 @@
universe, Rti baseType, String key, bool normalize) {
if (normalize) {
int baseKind = Rti._getKind(baseType);
- if (isTopType(baseType) ||
- isObjectType(baseType) ||
- // TODO(fishythefish): Directly test for `LEGACY_TYPE_REF<Object>()`.
- baseKind == Rti.kindStar &&
- isObjectType(Rti._getStarArgument(baseType))) {
+ if (isTopType(baseType) || isObjectType(baseType)) {
return baseType;
} else if (baseKind == Rti.kindNever) {
return _lookupFutureRti(universe, baseType);
} else if (isNullType(baseType)) {
- // TODO(fishythefish): Use `TYPE_REF<Future<Null>?>()`.
return JS_GET_FLAG('NNBD')
- ? _lookupQuestionRti(universe, TYPE_REF<Future<Null>>(), false)
+ ? TYPE_REF<Future<Null>?>()
: TYPE_REF<Future<Null>>();
}
}
@@ -2827,13 +2821,9 @@
}
bool isObjectType(Rti t) => _Utils.isIdentical(t, TYPE_REF<Object>());
-// TODO(fishythefish): Use `LEGACY_TYPE_REF<Object>()`.
bool isLegacyObjectType(Rti t) =>
- Rti._getKind(t) == Rti.kindStar && isObjectType(Rti._getStarArgument(t));
-// TODO(fishythefish): Use `TYPE_REF<Object?>()`.
-bool isNullableObjectType(Rti t) =>
- Rti._getKind(t) == Rti.kindQuestion &&
- isObjectType(Rti._getQuestionArgument(t));
+ _Utils.isIdentical(t, LEGACY_TYPE_REF<Object>());
+bool isNullableObjectType(Rti t) => _Utils.isIdentical(t, TYPE_REF<Object?>());
bool isNullType(Rti t) => _Utils.isIdentical(t, TYPE_REF<Null>());
bool isFunctionType(Rti t) => _Utils.isIdentical(t, TYPE_REF<Function>());
bool isJsFunctionType(Rti t) =>
diff --git a/sdk_nnbd/lib/_internal/vm/bin/eventhandler_patch.dart b/sdk_nnbd/lib/_internal/vm/bin/eventhandler_patch.dart
index 11ada47..072d995 100644
--- a/sdk_nnbd/lib/_internal/vm/bin/eventhandler_patch.dart
+++ b/sdk_nnbd/lib/_internal/vm/bin/eventhandler_patch.dart
@@ -7,7 +7,7 @@
@patch
class _EventHandler {
@patch
- static void _sendData(Object sender, SendPort sendPort, int data)
+ static void _sendData(Object? sender, SendPort sendPort, int data)
native "EventHandler_SendData";
static int _timerMillisecondClock()
diff --git a/sdk_nnbd/lib/_internal/vm/bin/file_patch.dart b/sdk_nnbd/lib/_internal/vm/bin/file_patch.dart
index 5dde072..8c50129 100644
--- a/sdk_nnbd/lib/_internal/vm/bin/file_patch.dart
+++ b/sdk_nnbd/lib/_internal/vm/bin/file_patch.dart
@@ -237,7 +237,7 @@
if (event[3]) {
add(event[4], new FileSystemCreateEvent._(getPath(event), isDir));
} else {
- add(event[4], new FileSystemDeleteEvent._(getPath(event), isDir));
+ add(event[4], new FileSystemDeleteEvent._(getPath(event), false));
}
}
@@ -281,10 +281,10 @@
}
}
if ((event[0] & FileSystemEvent.delete) != 0) {
- add(event[4], new FileSystemDeleteEvent._(path, isDir));
+ add(event[4], new FileSystemDeleteEvent._(path, false));
}
if ((event[0] & FileSystemEvent._deleteSelf) != 0) {
- add(event[4], new FileSystemDeleteEvent._(path, isDir));
+ add(event[4], new FileSystemDeleteEvent._(path, false));
// Signal done event.
stops.add([event[4], null]);
}
diff --git a/sdk_nnbd/lib/_internal/vm/bin/process_patch.dart b/sdk_nnbd/lib/_internal/vm/bin/process_patch.dart
index b87668b..2df7ef9 100644
--- a/sdk_nnbd/lib/_internal/vm/bin/process_patch.dart
+++ b/sdk_nnbd/lib/_internal/vm/bin/process_patch.dart
@@ -125,7 +125,7 @@
}
static _setSignalHandler(int signal) native "Process_SetSignalHandler";
- static int _clearSignalHandler(int signal)
+ static void _clearSignalHandler(int signal)
native "Process_ClearSignalHandler";
}
@@ -248,7 +248,7 @@
_arguments = [
for (int i = 0; i < arguments.length; i++)
Platform.isWindows
- ? _windowsArgumentEscape(_arguments[i])
+ ? _windowsArgumentEscape(arguments[i])
: arguments[i],
];
diff --git a/sdk_nnbd/lib/_internal/vm/bin/socket_patch.dart b/sdk_nnbd/lib/_internal/vm/bin/socket_patch.dart
index 30c2ccc..11be15b 100644
--- a/sdk_nnbd/lib/_internal/vm/bin/socket_patch.dart
+++ b/sdk_nnbd/lib/_internal/vm/bin/socket_patch.dart
@@ -705,21 +705,28 @@
String get _serviceTypePath => throw new UnimplementedError();
String get _serviceTypeName => throw new UnimplementedError();
- Uint8List? read(int? len) {
- if (len != null && len <= 0) {
- throw new ArgumentError("Illegal length $len");
+ Uint8List? read(int? count) {
+ if (count != null && count <= 0) {
+ throw ArgumentError("Illegal length $count");
}
if (isClosing || isClosed) return null;
- len = min(available, len == null ? available : len);
- if (len == 0) return null;
- var result = nativeRead(len);
+ var length = count == null ? available : min(available, count);
+ if (length == 0) return null;
+ var result = nativeRead(length);
if (result is OSError) {
reportError(result, StackTrace.current, "Read failed");
return null;
}
final list = result as Uint8List?;
if (list != null) {
- available -= list.length;
+ if (count == null) {
+ // If count is not specified, read as many bytes as possible.
+ // This checks remaining bytes, if available > 0, issue() in
+ // issueReadEvent() will keep reading.
+ available = nativeAvailable();
+ } else {
+ available -= list.length;
+ }
// TODO(ricow): Remove when we track internal and pipe uses.
assert(resourceInfo != null || isPipe || isInternal || isInternalSignal);
if (resourceInfo != null) {
diff --git a/sdk_nnbd/lib/_internal/vm/lib/developer.dart b/sdk_nnbd/lib/_internal/vm/lib/developer.dart
index cb35073..9f1bb46 100644
--- a/sdk_nnbd/lib/_internal/vm/lib/developer.dart
+++ b/sdk_nnbd/lib/_internal/vm/lib/developer.dart
@@ -58,7 +58,7 @@
native "Developer_postEvent";
@patch
-ServiceExtensionHandler _lookupExtension(String method)
+ServiceExtensionHandler? _lookupExtension(String method)
native "Developer_lookupExtension";
@patch
diff --git a/sdk_nnbd/lib/_internal/vm/lib/errors_patch.dart b/sdk_nnbd/lib/_internal/vm/lib/errors_patch.dart
index 4ce85be..c9dd54d 100644
--- a/sdk_nnbd/lib/_internal/vm/lib/errors_patch.dart
+++ b/sdk_nnbd/lib/_internal/vm/lib/errors_patch.dart
@@ -81,15 +81,19 @@
final Object? message;
}
-class _TypeError extends _AssertionError implements TypeError {
+class _TypeError extends Error implements TypeError {
@pragma("vm:entry-point")
- _TypeError._create(String url, int line, int column, String errorMsg)
- : super._create("is assignable", url, line, column, errorMsg);
+ _TypeError._create(this._url, this._line, this._column, this._message);
static _throwNew(int location, Object srcValue, _Type dstType, String dstName)
native "TypeError_throwNew";
- String toString() => super.message as String;
+ String toString() => _message;
+
+ final String _url;
+ final int _line;
+ final int _column;
+ final String _message;
}
class _CastError extends Error implements CastError {
diff --git a/sdk_nnbd/lib/_internal/vm/lib/ffi_patch.dart b/sdk_nnbd/lib/_internal/vm/lib/ffi_patch.dart
index 84a8849..aec115a 100644
--- a/sdk_nnbd/lib/_internal/vm/lib/ffi_patch.dart
+++ b/sdk_nnbd/lib/_internal/vm/lib/ffi_patch.dart
@@ -450,3 +450,27 @@
@patch
int get nativePort native "SendPortImpl_get_id";
}
+
+int _nativeApiFunctionPointer(String symbol) native "NativeApiFunctionPointer";
+
+@patch
+class NativeApi {
+ @patch
+ static Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
+ get nativeApiPostCObject =>
+ Pointer.fromAddress(_nativeApiFunctionPointer("Dart_PostCObject"));
+
+ @patch
+ static Pointer<
+ NativeFunction<
+ Int64 Function(
+ Pointer<Uint8>,
+ Pointer<NativeFunction<Dart_NativeMessageHandler>>,
+ Int8)>> get nativeApiNewNativePort =>
+ Pointer.fromAddress(_nativeApiFunctionPointer("Dart_NewNativePort"));
+
+ @patch
+ static Pointer<NativeFunction<Int8 Function(Int64)>>
+ get nativeApiCloseNativePort => Pointer.fromAddress(
+ _nativeApiFunctionPointer("Dart_CloseNativePort"));
+}
diff --git a/sdk_nnbd/lib/collection/list.dart b/sdk_nnbd/lib/collection/list.dart
index e958a7b..a47ca1b 100644
--- a/sdk_nnbd/lib/collection/list.dart
+++ b/sdk_nnbd/lib/collection/list.dart
@@ -450,7 +450,7 @@
}
}
- int indexOf(E element, [int start = 0]) {
+ int indexOf(Object? element, [int start = 0]) {
if (start < 0) start = 0;
for (int i = start; i < this.length; i++) {
if (this[i] == element) return i;
@@ -466,7 +466,7 @@
return -1;
}
- int lastIndexOf(E element, [int? start]) {
+ int lastIndexOf(Object? element, [int? start]) {
if (start == null || start >= this.length) start = this.length - 1;
// TODO(38493): The previous line should promote.
diff --git a/sdk_nnbd/lib/collection/queue.dart b/sdk_nnbd/lib/collection/queue.dart
index 9daafb1..c238840 100644
--- a/sdk_nnbd/lib/collection/queue.dart
+++ b/sdk_nnbd/lib/collection/queue.dart
@@ -121,8 +121,8 @@
}
void _unlink() {
- if (_previousLink != null) _previousLink!._nextLink = _nextLink as Link;
- if (_nextLink != null) _nextLink!._previousLink = _previousLink as Link;
+ if (_previousLink != null) _previousLink!._nextLink = _nextLink;
+ if (_nextLink != null) _nextLink!._previousLink = _previousLink;
_nextLink = null;
_previousLink = null;
}
diff --git a/sdk_nnbd/lib/collection/splay_tree.dart b/sdk_nnbd/lib/collection/splay_tree.dart
index 8d7f715..6eda337 100644
--- a/sdk_nnbd/lib/collection/splay_tree.dart
+++ b/sdk_nnbd/lib/collection/splay_tree.dart
@@ -166,9 +166,9 @@
_count--;
// assert(_count >= 0);
if (_root!.left == null) {
- _root = _root!.right as Node;
+ _root = _root!.right as Node?;
} else {
- Node right = _root!.right as Node;
+ Node? right = _root!.right as Node?;
// Splay to make sure that the new root has an empty right child.
_root = _splayMax(_root!.left as Node);
// Insert the original right child as the right child of the new
@@ -429,7 +429,7 @@
if (node.right != null && visit(node.right as _SplayTreeMapNode)) {
return true;
}
- node = node.left as _SplayTreeMapNode;
+ node = node.left as _SplayTreeMapNode?;
}
return false;
}
diff --git a/sdk_nnbd/lib/core/errors.dart b/sdk_nnbd/lib/core/errors.dart
index 9445339..8a87c8b 100644
--- a/sdk_nnbd/lib/core/errors.dart
+++ b/sdk_nnbd/lib/core/errors.dart
@@ -110,9 +110,9 @@
}
/**
- * Error thrown by the runtime system when a type assertion fails.
+ * Error thrown by the runtime system when a dynamic type error happens.
*/
-class TypeError extends AssertionError {}
+class TypeError extends Error {}
/**
* Error thrown by the runtime system when a cast operation fails.
diff --git a/sdk_nnbd/lib/dart2js_migration_libraries.json b/sdk_nnbd/lib/dart2js_migration_libraries.json
deleted file mode 100644
index 219d74a..0000000
--- a/sdk_nnbd/lib/dart2js_migration_libraries.json
+++ /dev/null
@@ -1,118 +0,0 @@
-{
- "comment:0": "NOTE: This file is only used temporarily while migrating ",
- "comment:1": "dart2js patch files.",
- "dart2js": {
- "libraries": {
- "async": {
- "uri": "async/async.dart",
- "patches": "_internal/js_runtime/lib/async_patch.dart"
- },
- "collection": {
- "uri": "collection/collection.dart",
- "patches": "_internal/js_runtime/lib/collection_patch.dart"
- },
- "convert": {
- "uri": "convert/convert.dart",
- "patches": "_internal/js_runtime/lib/convert_patch.dart"
- },
- "core": {
- "uri": "core/core.dart",
- "patches": "_internal/js_runtime/lib/core_patch.dart"
- },
- "developer": {
- "uri": "developer/developer.dart",
- "patches": "_internal/js_runtime/lib/developer_patch.dart"
- },
- "html": {
- "uri": "html/dart2js/html_dart2js.dart"
- },
- "html_common": {
- "uri": "html/html_common/html_common_dart2js.dart"
- },
- "indexed_db": {
- "uri": "indexed_db/dart2js/indexed_db_dart2js.dart"
- },
- "_http": {
- "uri": "_http/http.dart"
- },
- "io": {
- "uri": "io/io.dart",
- "patches": "_internal/js_runtime/lib/io_patch.dart",
- "supported": false
- },
- "isolate": {
- "uri": "isolate/isolate.dart",
- "patches": "_internal/js_runtime/lib/isolate_patch.dart",
- "supported": false
- },
- "js": {
- "uri": "js/js.dart",
- "patches": "_internal/js_runtime/lib/js_patch.dart"
- },
- "_js": {
- "uri": "js/_js.dart",
- "patches": "js/_js_client.dart"
- },
- "js_util": {
- "uri": "js_util/js_util.dart"
- },
- "math": {
- "uri": "math/math.dart",
- "patches": "_internal/js_runtime/lib/math_patch.dart"
- },
- "typed_data": {
- "uri": "typed_data/typed_data.dart",
- "patches": "_internal/js_runtime/lib/typed_data_patch.dart"
- },
- "_native_typed_data": {
- "uri": "_internal/js_runtime/lib/native_typed_data.dart"
- },
- "svg": {
- "uri": "svg/dart2js/svg_dart2js.dart"
- },
- "web_audio": {
- "uri": "web_audio/dart2js/web_audio_dart2js.dart"
- },
- "web_gl": {
- "uri": "web_gl/dart2js/web_gl_dart2js.dart"
- },
- "web_sql": {
- "uri": "web_sql/dart2js/web_sql_dart2js.dart"
- },
- "_internal": {
- "uri": "internal/internal.dart",
- "patches": "_internal/js_runtime/lib/internal_patch.dart"
- },
- "_js_helper": {
- "uri": "_internal/js_runtime/lib/js_helper.dart"
- },
- "_rti": {
- "uri": "_internal/js_runtime/lib/rti.dart"
- },
- "_interceptors": {
- "uri": "_internal/js_runtime/lib/interceptors.dart"
- },
- "_foreign_helper": {
- "uri": "_internal/js_runtime/lib/foreign_helper.dart"
- },
- "_js_names": {
- "uri": "_internal/js_runtime/lib/js_names.dart"
- },
- "_js_primitives": {
- "uri": "_internal/js_runtime/lib/js_primitives.dart"
- },
- "_js_embedded_names": {
- "uri": "_internal/js_runtime/lib/shared/embedded_names.dart"
- },
- "_async_await_error_codes": {
- "uri": "_internal/js_runtime/lib/shared/async_await_error_codes.dart"
- },
- "_recipe_syntax": {
- "uri": "_internal/js_runtime/lib/shared/recipe_syntax.dart"
- },
- "_metadata": {
- "uri": "html/html_common/metadata.dart"
- }
- }
- }
-}
diff --git a/sdk_nnbd/lib/ffi/ffi.dart b/sdk_nnbd/lib/ffi/ffi.dart
index 0e2d1cb..5cc8602 100644
--- a/sdk_nnbd/lib/ffi/ffi.dart
+++ b/sdk_nnbd/lib/ffi/ffi.dart
@@ -621,3 +621,38 @@
/// `dart_native_api.h`.
external int get nativePort;
}
+
+/// Opaque, not exposing it's members.
+class Dart_CObject extends Struct {}
+
+typedef Dart_NativeMessageHandler = Void Function(Int64, Pointer<Dart_CObject>);
+
+/// Exposes function pointers to functions in `dart_native_api.h`.
+class NativeApi {
+ /// A function pointer to
+ /// `bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* message)`
+ /// in `dart_native_api.h`.
+ external static Pointer<
+ NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
+ get nativeApiPostCObject;
+
+ /// A function pointer to
+ /// ```
+ /// Dart_Port Dart_NewNativePort(const char* name,
+ /// Dart_NativeMessageHandler handler,
+ /// bool handle_concurrently)
+ /// ```
+ /// in `dart_native_api.h`.
+ external static Pointer<
+ NativeFunction<
+ Int64 Function(
+ Pointer<Uint8>,
+ Pointer<NativeFunction<Dart_NativeMessageHandler>>,
+ Int8)>> get nativeApiNewNativePort;
+
+ /// A function pointer to
+ /// `bool Dart_CloseNativePort(Dart_Port native_port_id)`
+ /// in `dart_native_api.h`.
+ external static Pointer<NativeFunction<Int8 Function(Int64)>>
+ get nativeApiCloseNativePort;
+}
diff --git a/sdk_nnbd/lib/html/dart2js/html_dart2js.dart b/sdk_nnbd/lib/html/dart2js/html_dart2js.dart
index 3aebd68..1d41744 100644
--- a/sdk_nnbd/lib/html/dart2js/html_dart2js.dart
+++ b/sdk_nnbd/lib/html/dart2js/html_dart2js.dart
@@ -115,11 +115,8 @@
HtmlElement.created() : super.created();
// From NoncedElement
- String get nonce => JS("String", "#.nonce", this);
-
- set nonce(String value) {
- JS("void", "#.nonce = #", this, value);
- }
+ String get nonce native;
+ set nonce(String value) native;
}
/**
@@ -220,11 +217,11 @@
static Accelerometer _create_2() =>
JS('Accelerometer', 'new Accelerometer()');
- num? get x => JS("num", "#.x", this);
+ num? get x native;
- num? get y => JS("num", "#.y", this);
+ num? get y native;
- num? get z => JS("num", "#.z", this);
+ num? get z native;
}
// 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
@@ -261,99 +258,193 @@
static AccessibleNode _create_1() =>
JS('AccessibleNode', 'new AccessibleNode()');
- AccessibleNode? activeDescendant;
+ AccessibleNode? get activeDescendant native;
- bool? atomic;
+ set activeDescendant(AccessibleNode? value) native;
- String? autocomplete;
+ bool? get atomic native;
- bool? busy;
+ set atomic(bool? value) native;
- String? checked;
+ String? get autocomplete native;
- int? colCount;
+ set autocomplete(String? value) native;
- int? colIndex;
+ bool? get busy native;
- int? colSpan;
+ set busy(bool? value) native;
- AccessibleNodeList? controls;
+ String? get checked native;
- String? current;
+ set checked(String? value) native;
- AccessibleNodeList? describedBy;
+ int? get colCount native;
- AccessibleNode? details;
+ set colCount(int? value) native;
- bool? disabled;
+ int? get colIndex native;
- AccessibleNode? errorMessage;
+ set colIndex(int? value) native;
- bool? expanded;
+ int? get colSpan native;
- AccessibleNodeList? flowTo;
+ set colSpan(int? value) native;
- String? hasPopUp;
+ AccessibleNodeList? get controls native;
- bool? hidden;
+ set controls(AccessibleNodeList? value) native;
- String? invalid;
+ String? get current native;
- String? keyShortcuts;
+ set current(String? value) native;
- String? label;
+ AccessibleNodeList? get describedBy native;
- AccessibleNodeList? labeledBy;
+ set describedBy(AccessibleNodeList? value) native;
- int? level;
+ AccessibleNode? get details native;
- String? live;
+ set details(AccessibleNode? value) native;
- bool? modal;
+ bool? get disabled native;
- bool? multiline;
+ set disabled(bool? value) native;
- bool? multiselectable;
+ AccessibleNode? get errorMessage native;
- String? orientation;
+ set errorMessage(AccessibleNode? value) native;
- AccessibleNodeList? owns;
+ bool? get expanded native;
- String? placeholder;
+ set expanded(bool? value) native;
- int? posInSet;
+ AccessibleNodeList? get flowTo native;
- String? pressed;
+ set flowTo(AccessibleNodeList? value) native;
- bool? readOnly;
+ String? get hasPopUp native;
- String? relevant;
+ set hasPopUp(String? value) native;
- bool? required;
+ bool? get hidden native;
- String? role;
+ set hidden(bool? value) native;
- String? roleDescription;
+ String? get invalid native;
- int? rowCount;
+ set invalid(String? value) native;
- int? rowIndex;
+ String? get keyShortcuts native;
- int? rowSpan;
+ set keyShortcuts(String? value) native;
- bool? selected;
+ String? get label native;
- int? setSize;
+ set label(String? value) native;
- String? sort;
+ AccessibleNodeList? get labeledBy native;
- num? valueMax;
+ set labeledBy(AccessibleNodeList? value) native;
- num? valueMin;
+ int? get level native;
- num? valueNow;
+ set level(int? value) native;
- String? valueText;
+ String? get live native;
+
+ set live(String? value) native;
+
+ bool? get modal native;
+
+ set modal(bool? value) native;
+
+ bool? get multiline native;
+
+ set multiline(bool? value) native;
+
+ bool? get multiselectable native;
+
+ set multiselectable(bool? value) native;
+
+ String? get orientation native;
+
+ set orientation(String? value) native;
+
+ AccessibleNodeList? get owns native;
+
+ set owns(AccessibleNodeList? value) native;
+
+ String? get placeholder native;
+
+ set placeholder(String? value) native;
+
+ int? get posInSet native;
+
+ set posInSet(int? value) native;
+
+ String? get pressed native;
+
+ set pressed(String? value) native;
+
+ bool? get readOnly native;
+
+ set readOnly(bool? value) native;
+
+ String? get relevant native;
+
+ set relevant(String? value) native;
+
+ bool? get required native;
+
+ set required(bool? value) native;
+
+ String? get role native;
+
+ set role(String? value) native;
+
+ String? get roleDescription native;
+
+ set roleDescription(String? value) native;
+
+ int? get rowCount native;
+
+ set rowCount(int? value) native;
+
+ int? get rowIndex native;
+
+ set rowIndex(int? value) native;
+
+ int? get rowSpan native;
+
+ set rowSpan(int? value) native;
+
+ bool? get selected native;
+
+ set selected(bool? value) native;
+
+ int? get setSize native;
+
+ set setSize(int? value) native;
+
+ String? get sort native;
+
+ set sort(String? value) native;
+
+ num? get valueMax native;
+
+ set valueMax(num? value) native;
+
+ num? get valueMin native;
+
+ set valueMin(num? value) native;
+
+ num? get valueNow native;
+
+ set valueNow(num? value) native;
+
+ String? get valueText native;
+
+ set valueText(String? value) native;
void appendChild(AccessibleNode child) native;
@@ -395,11 +486,9 @@
static AccessibleNodeList _create_2() =>
JS('AccessibleNodeList', 'new AccessibleNodeList()');
- int get length => JS("int", "#.length", this);
+ int get length native;
- set length(int value) {
- JS("void", "#.length = #", this, value);
- }
+ set length(int value) native;
void __setter__(int index, AccessibleNode node) native;
@@ -432,7 +521,7 @@
static AmbientLightSensor _create_2() =>
JS('AmbientLightSensor', 'new AmbientLightSensor()');
- num? get illuminance => JS("num", "#.illuminance", this);
+ num? get illuminance native;
}
// 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
@@ -461,105 +550,73 @@
*/
AnchorElement.created() : super.created();
- String get download => JS("String", "#.download", this);
+ String get download native;
- set download(String value) {
- JS("void", "#.download = #", this, value);
- }
+ set download(String value) native;
- String get hreflang => JS("String", "#.hreflang", this);
+ String get hreflang native;
- set hreflang(String value) {
- JS("void", "#.hreflang = #", this, value);
- }
+ set hreflang(String value) native;
- String get referrerPolicy => JS("String", "#.referrerPolicy", this);
+ String get referrerPolicy native;
- set referrerPolicy(String value) {
- JS("void", "#.referrerPolicy = #", this, value);
- }
+ set referrerPolicy(String value) native;
- String get rel => JS("String", "#.rel", this);
+ String get rel native;
- set rel(String value) {
- JS("void", "#.rel = #", this, value);
- }
+ set rel(String value) native;
- String get target => JS("String", "#.target", this);
+ String get target native;
- set target(String value) {
- JS("void", "#.target = #", this, value);
- }
+ set target(String value) native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
// From HTMLHyperlinkElementUtils
- String get hash => JS("String", "#.hash", this);
+ String get hash native;
- set hash(String value) {
- JS("void", "#.hash = #", this, value);
- }
+ set hash(String value) native;
- String get host => JS("String", "#.host", this);
+ String get host native;
- set host(String value) {
- JS("void", "#.host = #", this, value);
- }
+ set host(String value) native;
- String get hostname => JS("String", "#.hostname", this);
+ String get hostname native;
- set hostname(String value) {
- JS("void", "#.hostname = #", this, value);
- }
+ set hostname(String value) native;
- String get href => JS("String", "#.href", this);
+ String get href native;
- set href(String value) {
- JS("void", "#.href = #", this, value);
- }
+ set href(String value) native;
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
- String get password => JS("String", "#.password", this);
+ String get password native;
- set password(String value) {
- JS("void", "#.password = #", this, value);
- }
+ set password(String value) native;
- String get pathname => JS("String", "#.pathname", this);
+ String get pathname native;
- set pathname(String value) {
- JS("void", "#.pathname = #", this, value);
- }
+ set pathname(String value) native;
- String get port => JS("String", "#.port", this);
+ String get port native;
- set port(String value) {
- JS("void", "#.port = #", this, value);
- }
+ set port(String value) native;
- String get protocol => JS("String", "#.protocol", this);
+ String get protocol native;
- set protocol(String value) {
- JS("void", "#.protocol = #", this, value);
- }
+ set protocol(String value) native;
- String get search => JS("String", "#.search", this);
+ String get search native;
- set search(String value) {
- JS("void", "#.search = #", this, value);
- }
+ set search(String value) native;
- String get username => JS("String", "#.username", this);
+ String get username native;
- set username(String value) {
- JS("void", "#.username = #", this, value);
- }
+ set username(String value) native;
String toString() => JS('String', 'String(#)', this);
}
@@ -599,34 +656,35 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(document.body.animate)');
- num? currentTime;
+ num? get currentTime native;
- AnimationEffectReadOnly? effect;
+ set currentTime(num? value) native;
+
+ AnimationEffectReadOnly? get effect native;
+
+ set effect(AnimationEffectReadOnly? value) native;
Future<Animation> get finished =>
promiseToFuture<Animation>(JS("", "#.finished", this));
- String get id => JS("String", "#.id", this);
+ String get id native;
- set id(String value) {
- JS("void", "#.id = #", this, value);
- }
+ set id(String value) native;
- String get playState => JS("String", "#.playState", this);
+ String get playState native;
- num get playbackRate => JS("num", "#.playbackRate", this);
+ num get playbackRate native;
- set playbackRate(num value) {
- JS("void", "#.playbackRate = #", this, value);
- }
+ set playbackRate(num value) native;
Future<Animation> get ready =>
promiseToFuture<Animation>(JS("", "#.ready", this));
- num? startTime;
+ num? get startTime native;
- AnimationTimeline? get timeline =>
- JS("AnimationTimeline", "#.timeline", this);
+ set startTime(num? value) native;
+
+ AnimationTimeline? get timeline native;
void cancel() native;
@@ -653,8 +711,7 @@
throw new UnsupportedError("Not supported");
}
- AnimationEffectTimingReadOnly get timing =>
- JS("AnimationEffectTimingReadOnly", "#.timing", this);
+ AnimationEffectTimingReadOnly get timing native;
Map getComputedTiming() {
return convertNativeToDart_Dictionary(_getComputedTiming_1())!;
@@ -676,67 +733,51 @@
// Shadowing definition.
- num get delay => JS("num", "#.delay", this);
+ num get delay native;
- set delay(num value) {
- JS("void", "#.delay = #", this, value);
- }
+ set delay(num value) native;
// Shadowing definition.
- String get direction => JS("String", "#.direction", this);
+ String get direction native;
- set direction(String value) {
- JS("void", "#.direction = #", this, value);
- }
+ set direction(String value) native;
// Shadowing definition.
- Object? get duration => JS("Object", "#.duration", this);
+ Object? get duration native;
- set duration(Object? value) {
- JS("void", "#.duration = #", this, value);
- }
+ set duration(Object? value) native;
// Shadowing definition.
- String get easing => JS("String", "#.easing", this);
+ String get easing native;
- set easing(String value) {
- JS("void", "#.easing = #", this, value);
- }
+ set easing(String value) native;
// Shadowing definition.
- num get endDelay => JS("num", "#.endDelay", this);
+ num get endDelay native;
- set endDelay(num value) {
- JS("void", "#.endDelay = #", this, value);
- }
+ set endDelay(num value) native;
// Shadowing definition.
- String get fill => JS("String", "#.fill", this);
+ String get fill native;
- set fill(String value) {
- JS("void", "#.fill = #", this, value);
- }
+ set fill(String value) native;
// Shadowing definition.
- num get iterationStart => JS("num", "#.iterationStart", this);
+ num get iterationStart native;
- set iterationStart(num value) {
- JS("void", "#.iterationStart = #", this, value);
- }
+ set iterationStart(num value) native;
// Shadowing definition.
- num get iterations => JS("num", "#.iterations", this);
+ num get iterations native;
- set iterations(num value) {
- JS("void", "#.iterations = #", this, value);
- }
+ set iterations(num value) native;
}
// 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
@@ -749,21 +790,21 @@
throw new UnsupportedError("Not supported");
}
- num get delay => JS("num", "#.delay", this);
+ num get delay native;
- String get direction => JS("String", "#.direction", this);
+ String get direction native;
- Object? get duration => JS("Object", "#.duration", this);
+ Object? get duration native;
- String get easing => JS("String", "#.easing", this);
+ String get easing native;
- num get endDelay => JS("num", "#.endDelay", this);
+ num get endDelay native;
- String get fill => JS("String", "#.fill", this);
+ String get fill native;
- num get iterationStart => JS("num", "#.iterationStart", this);
+ num get iterationStart native;
- num get iterations => JS("num", "#.iterations", this);
+ num get iterations native;
}
// 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
@@ -788,9 +829,9 @@
static AnimationEvent _create_2(type) =>
JS('AnimationEvent', 'new AnimationEvent(#)', type);
- String get animationName => JS("String", "#.animationName", this);
+ String get animationName native;
- num get elapsedTime => JS("num", "#.elapsedTime", this);
+ num get elapsedTime native;
}
// 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
@@ -818,9 +859,9 @@
static AnimationPlaybackEvent _create_2(type) =>
JS('AnimationPlaybackEvent', 'new AnimationPlaybackEvent(#)', type);
- num? get currentTime => JS("num", "#.currentTime", this);
+ num? get currentTime native;
- num? get timelineTime => JS("num", "#.timelineTime", this);
+ num? get timelineTime native;
}
// 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
@@ -833,7 +874,7 @@
throw new UnsupportedError("Not supported");
}
- num? get currentTime => JS("num", "#.currentTime", this);
+ num? get currentTime native;
}
// 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
@@ -955,7 +996,7 @@
static const int UPDATEREADY = 4;
- int get status => JS("int", "#.status", this);
+ int get status native;
void abort() native;
@@ -1013,13 +1054,13 @@
static ApplicationCacheErrorEvent _create_2(type) => JS(
'ApplicationCacheErrorEvent', 'new ApplicationCacheErrorEvent(#)', type);
- String get message => JS("String", "#.message", this);
+ String get message native;
- String get reason => JS("String", "#.reason", this);
+ String get reason native;
- int get status => JS("int", "#.status", this);
+ int get status native;
- String get url => JS("String", "#.url", this);
+ String get url native;
}
// 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
@@ -1054,111 +1095,77 @@
*/
AreaElement.created() : super.created();
- String get alt => JS("String", "#.alt", this);
+ String get alt native;
- set alt(String value) {
- JS("void", "#.alt = #", this, value);
- }
+ set alt(String value) native;
- String get coords => JS("String", "#.coords", this);
+ String get coords native;
- set coords(String value) {
- JS("void", "#.coords = #", this, value);
- }
+ set coords(String value) native;
- String get download => JS("String", "#.download", this);
+ String get download native;
- set download(String value) {
- JS("void", "#.download = #", this, value);
- }
+ set download(String value) native;
- String get referrerPolicy => JS("String", "#.referrerPolicy", this);
+ String get referrerPolicy native;
- set referrerPolicy(String value) {
- JS("void", "#.referrerPolicy = #", this, value);
- }
+ set referrerPolicy(String value) native;
- String get rel => JS("String", "#.rel", this);
+ String get rel native;
- set rel(String value) {
- JS("void", "#.rel = #", this, value);
- }
+ set rel(String value) native;
- String get shape => JS("String", "#.shape", this);
+ String get shape native;
- set shape(String value) {
- JS("void", "#.shape = #", this, value);
- }
+ set shape(String value) native;
- String get target => JS("String", "#.target", this);
+ String get target native;
- set target(String value) {
- JS("void", "#.target = #", this, value);
- }
+ set target(String value) native;
// From HTMLHyperlinkElementUtils
- String get hash => JS("String", "#.hash", this);
+ String get hash native;
- set hash(String value) {
- JS("void", "#.hash = #", this, value);
- }
+ set hash(String value) native;
- String get host => JS("String", "#.host", this);
+ String get host native;
- set host(String value) {
- JS("void", "#.host = #", this, value);
- }
+ set host(String value) native;
- String get hostname => JS("String", "#.hostname", this);
+ String get hostname native;
- set hostname(String value) {
- JS("void", "#.hostname = #", this, value);
- }
+ set hostname(String value) native;
- String get href => JS("String", "#.href", this);
+ String get href native;
- set href(String value) {
- JS("void", "#.href = #", this, value);
- }
+ set href(String value) native;
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
- String get password => JS("String", "#.password", this);
+ String get password native;
- set password(String value) {
- JS("void", "#.password = #", this, value);
- }
+ set password(String value) native;
- String get pathname => JS("String", "#.pathname", this);
+ String get pathname native;
- set pathname(String value) {
- JS("void", "#.pathname = #", this, value);
- }
+ set pathname(String value) native;
- String get port => JS("String", "#.port", this);
+ String get port native;
- set port(String value) {
- JS("void", "#.port = #", this, value);
- }
+ set port(String value) native;
- String get protocol => JS("String", "#.protocol", this);
+ String get protocol native;
- set protocol(String value) {
- JS("void", "#.protocol = #", this, value);
- }
+ set protocol(String value) native;
- String get search => JS("String", "#.search", this);
+ String get search native;
- set search(String value) {
- JS("void", "#.search = #", this, value);
- }
+ set search(String value) native;
- String get username => JS("String", "#.username", this);
+ String get username native;
- set username(String value) {
- JS("void", "#.username = #", this, value);
- }
+ set username(String value) native;
String toString() => JS('String', 'String(#)', this);
}
@@ -1196,10 +1203,9 @@
throw new UnsupportedError("Not supported");
}
- ByteBuffer get authenticatorData =>
- JS("ByteBuffer", "#.authenticatorData", this);
+ ByteBuffer get authenticatorData native;
- ByteBuffer get signature => JS("ByteBuffer", "#.signature", this);
+ ByteBuffer get signature native;
}
// 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
@@ -1212,8 +1218,7 @@
throw new UnsupportedError("Not supported");
}
- ByteBuffer get attestationObject =>
- JS("ByteBuffer", "#.attestationObject", this);
+ ByteBuffer get attestationObject native;
}
// 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
@@ -1227,7 +1232,7 @@
}
@JSName('clientDataJSON')
- ByteBuffer get clientDataJson => JS("ByteBuffer", "#.clientDataJSON", this);
+ ByteBuffer get clientDataJson native;
}
// 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
@@ -1273,7 +1278,7 @@
type,
init);
- String get state => JS("String", "#.state", this);
+ String get state native;
}
// 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
@@ -1293,7 +1298,7 @@
static BackgroundFetchEvent _create_1(type, init) =>
JS('BackgroundFetchEvent', 'new BackgroundFetchEvent(#,#)', type, init);
- String get id => JS("String", "#.id", this);
+ String get id native;
}
// 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
@@ -1316,8 +1321,7 @@
type,
init);
- List<BackgroundFetchSettledFetch> get fetches =>
- JS("List<BackgroundFetchSettledFetch>", "#.fetches", this);
+ List<BackgroundFetchSettledFetch> get fetches native;
}
// 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
@@ -1330,7 +1334,7 @@
throw new UnsupportedError("Not supported");
}
- _Request get request => JS("_Request", "#.request", this);
+ _Request get request native;
}
// 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
@@ -1371,19 +1375,19 @@
throw new UnsupportedError("Not supported");
}
- int get downloadTotal => JS("int", "#.downloadTotal", this);
+ int get downloadTotal native;
- int get downloaded => JS("int", "#.downloaded", this);
+ int get downloaded native;
- String get id => JS("String", "#.id", this);
+ String get id native;
- String get title => JS("String", "#.title", this);
+ String get title native;
- int get totalDownloadSize => JS("int", "#.totalDownloadSize", this);
+ int get totalDownloadSize native;
- int get uploadTotal => JS("int", "#.uploadTotal", this);
+ int get uploadTotal native;
- int get uploaded => JS("int", "#.uploaded", this);
+ int get uploaded native;
Future<bool> abort() => promiseToFuture<bool>(JS("", "#.abort()", this));
}
@@ -1407,7 +1411,7 @@
request,
response);
- _Response? get response => JS("_Response", "#.response", this);
+ _Response? get response native;
}
// 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
@@ -1427,8 +1431,7 @@
static BackgroundFetchedEvent _create_1(type, init) => JS(
'BackgroundFetchedEvent', 'new BackgroundFetchedEvent(#,#)', type, init);
- List<BackgroundFetchSettledFetch> get fetches =>
- JS("List<BackgroundFetchSettledFetch>", "#.fetches", this);
+ List<BackgroundFetchSettledFetch> get fetches native;
Future updateUI(String title) =>
promiseToFuture(JS("", "#.updateUI(#)", this, title));
@@ -1446,7 +1449,7 @@
throw new UnsupportedError("Not supported");
}
- bool get visible => JS("bool", "#.visible", this);
+ bool get visible native;
}
// 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
@@ -1491,17 +1494,13 @@
*/
BaseElement.created() : super.created();
- String get href => JS("String", "#.href", this);
+ String get href native;
- set href(String value) {
- JS("void", "#.href = #", this, value);
- }
+ set href(String value) native;
- String get target => JS("String", "#.target", this);
+ String get target native;
- set target(String value) {
- JS("void", "#.target = #", this, value);
- }
+ set target(String value) native;
}
// 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
@@ -1514,13 +1513,13 @@
throw new UnsupportedError("Not supported");
}
- bool get charging => JS("bool", "#.charging", this);
+ bool get charging native;
- num get chargingTime => JS("num", "#.chargingTime", this);
+ num get chargingTime native;
- num get dischargingTime => JS("num", "#.dischargingTime", this);
+ num get dischargingTime native;
- num get level => JS("num", "#.level", this);
+ num get level native;
}
// 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
@@ -1548,7 +1547,7 @@
static BeforeInstallPromptEvent _create_2(type) =>
JS('BeforeInstallPromptEvent', 'new BeforeInstallPromptEvent(#)', type);
- List<String> get platforms => JS("List<String>", "#.platforms", this);
+ List<String> get platforms native;
Future<Map<String, dynamic>?> get userChoice =>
promiseToFutureAsMap(JS("", "#.userChoice", this));
@@ -1568,11 +1567,9 @@
// Shadowing definition.
- String get returnValue => JS("String", "#.returnValue", this);
+ String get returnValue native;
- set returnValue(String value) {
- JS("void", "#.returnValue = #", this, value);
- }
+ set returnValue(String value) native;
}
// 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
@@ -1585,9 +1582,9 @@
throw new UnsupportedError("Not supported");
}
- int get size => JS("int", "#.size", this);
+ int get size native;
- String get type => JS("String", "#.type", this);
+ String get type native;
Blob slice([int? start, int? end, String? contentType]) native;
@@ -1637,9 +1634,9 @@
static BlobEvent _create_1(type, eventInitDict) =>
JS('BlobEvent', 'new BlobEvent(#,#)', type, eventInitDict);
- Blob get data => JS("Blob", "#.data", this);
+ Blob get data native;
- num get timecode => JS("num", "#.timecode", this);
+ num get timecode native;
}
// 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
@@ -1652,12 +1649,11 @@
throw new UnsupportedError("Not supported");
}
- _BluetoothRemoteGATTCharacteristic get characteristic =>
- JS("_BluetoothRemoteGATTCharacteristic", "#.characteristic", this);
+ _BluetoothRemoteGATTCharacteristic get characteristic native;
- String get uuid => JS("String", "#.uuid", this);
+ String get uuid native;
- ByteData? get value => JS("ByteData", "#.value", this);
+ ByteData? get value native;
Future readValue() => promiseToFuture(JS("", "#.readValue()", this));
@@ -1675,7 +1671,7 @@
throw new UnsupportedError("Not supported");
}
- bool get bodyUsed => JS("bool", "#.bodyUsed", this);
+ bool get bodyUsed native;
Future arrayBuffer() => promiseToFuture(JS("", "#.arrayBuffer()", this));
@@ -1880,7 +1876,7 @@
static BroadcastChannel _create_1(name) =>
JS('BroadcastChannel', 'new BroadcastChannel(#)', name);
- String get name => JS("String", "#.name", this);
+ String get name native;
void close() native;
@@ -1899,9 +1895,9 @@
throw new UnsupportedError("Not supported");
}
- num get budgetAt => JS("num", "#.budgetAt", this);
+ num get budgetAt native;
- int get time => JS("int", "#.time", this);
+ int get time native;
}
// 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
@@ -1926,78 +1922,58 @@
*/
ButtonElement.created() : super.created();
- bool get autofocus => JS("bool", "#.autofocus", this);
+ bool get autofocus native;
- set autofocus(bool value) {
- JS("void", "#.autofocus = #", this, value);
- }
+ set autofocus(bool value) native;
- bool get disabled => JS("bool", "#.disabled", this);
+ bool get disabled native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ set disabled(bool value) native;
- FormElement? get form => JS("FormElement", "#.form", this);
+ FormElement? get form native;
- String get formAction => JS("String", "#.formAction", this);
+ String get formAction native;
- set formAction(String value) {
- JS("void", "#.formAction = #", this, value);
- }
+ set formAction(String value) native;
- String get formEnctype => JS("String", "#.formEnctype", this);
+ String get formEnctype native;
- set formEnctype(String value) {
- JS("void", "#.formEnctype = #", this, value);
- }
+ set formEnctype(String value) native;
- String get formMethod => JS("String", "#.formMethod", this);
+ String get formMethod native;
- set formMethod(String value) {
- JS("void", "#.formMethod = #", this, value);
- }
+ set formMethod(String value) native;
- bool get formNoValidate => JS("bool", "#.formNoValidate", this);
+ bool get formNoValidate native;
- set formNoValidate(bool value) {
- JS("void", "#.formNoValidate = #", this, value);
- }
+ set formNoValidate(bool value) native;
- String get formTarget => JS("String", "#.formTarget", this);
+ String get formTarget native;
- set formTarget(String value) {
- JS("void", "#.formTarget = #", this, value);
- }
+ set formTarget(String value) native;
@Unstable()
@Returns('NodeList')
@Creates('NodeList')
- List<Node> get labels => JS("NodeList", "#.labels", this);
+ List<Node> get labels native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
- String get validationMessage => JS("String", "#.validationMessage", this);
+ String get validationMessage native;
- ValidityState get validity => JS("ValidityState", "#.validity", this);
+ ValidityState get validity native;
- String get value => JS("String", "#.value", this);
+ String get value native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(String value) native;
- bool get willValidate => JS("bool", "#.willValidate", this);
+ bool get willValidate native;
bool checkValidity() native;
@@ -2070,14 +2046,13 @@
type,
eventInitDict);
- List get methodData => JS("List", "#.methodData", this);
+ List get methodData native;
- List get modifiers => JS("List", "#.modifiers", this);
+ List get modifiers native;
- String get paymentRequestOrigin =>
- JS("String", "#.paymentRequestOrigin", this);
+ String get paymentRequestOrigin native;
- String get topLevelOrigin => JS("String", "#.topLevelOrigin", this);
+ String get topLevelOrigin native;
void respondWith(Future canMakePaymentResponse) native;
}
@@ -2092,7 +2067,7 @@
throw new UnsupportedError("Not supported");
}
- CanvasElement get canvas => JS("CanvasElement", "#.canvas", this);
+ CanvasElement get canvas native;
void requestFrame() native;
}
@@ -2144,19 +2119,15 @@
/// The height of this canvas element in CSS pixels.
- int get height => JS("int", "#.height", this);
+ int get height native;
- set height(int value) {
- JS("void", "#.height = #", this, value);
- }
+ set height(int value) native;
/// The width of this canvas element in CSS pixels.
- int get width => JS("int", "#.width", this);
+ int get width native;
- set width(int value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(int value) native;
MediaStream captureStream([num? frameRate]) native;
@@ -2393,48 +2364,37 @@
throw new UnsupportedError("Not supported");
}
- CanvasElement get canvas => JS("CanvasElement", "#.canvas", this);
+ CanvasElement get canvas native;
- Matrix get currentTransform => JS("Matrix", "#.currentTransform", this);
+ Matrix get currentTransform native;
- set currentTransform(Matrix value) {
- JS("void", "#.currentTransform = #", this, value);
- }
+ set currentTransform(Matrix value) native;
- String get direction => JS("String", "#.direction", this);
+ String get direction native;
- set direction(String value) {
- JS("void", "#.direction = #", this, value);
- }
+ set direction(String value) native;
@Creates('String|CanvasGradient|CanvasPattern')
@Returns('String|CanvasGradient|CanvasPattern')
- Object? fillStyle;
+ Object? get fillStyle native;
- String get filter => JS("String", "#.filter", this);
+ set fillStyle(Object? value) native;
- set filter(String value) {
- JS("void", "#.filter = #", this, value);
- }
+ String get filter native;
- String get font => JS("String", "#.font", this);
+ set filter(String value) native;
- set font(String value) {
- JS("void", "#.font = #", this, value);
- }
+ String get font native;
- num get globalAlpha => JS("num", "#.globalAlpha", this);
+ set font(String value) native;
- set globalAlpha(num value) {
- JS("void", "#.globalAlpha = #", this, value);
- }
+ num get globalAlpha native;
- String get globalCompositeOperation =>
- JS("String", "#.globalCompositeOperation", this);
+ set globalAlpha(num value) native;
- set globalCompositeOperation(String value) {
- JS("void", "#.globalCompositeOperation = #", this, value);
- }
+ String get globalCompositeOperation native;
+
+ set globalCompositeOperation(String value) native;
/**
* Whether images and patterns on this canvas will be smoothed when this
@@ -2447,82 +2407,59 @@
* from WHATWG.
*/
- bool get imageSmoothingEnabled => JS("bool", "#.imageSmoothingEnabled", this);
+ bool get imageSmoothingEnabled native;
- set imageSmoothingEnabled(bool value) {
- JS("void", "#.imageSmoothingEnabled = #", this, value);
- }
+ set imageSmoothingEnabled(bool value) native;
- String get imageSmoothingQuality =>
- JS("String", "#.imageSmoothingQuality", this);
+ String get imageSmoothingQuality native;
- set imageSmoothingQuality(String value) {
- JS("void", "#.imageSmoothingQuality = #", this, value);
- }
+ set imageSmoothingQuality(String value) native;
- String get lineCap => JS("String", "#.lineCap", this);
+ String get lineCap native;
- set lineCap(String value) {
- JS("void", "#.lineCap = #", this, value);
- }
+ set lineCap(String value) native;
- String get lineJoin => JS("String", "#.lineJoin", this);
+ String get lineJoin native;
- set lineJoin(String value) {
- JS("void", "#.lineJoin = #", this, value);
- }
+ set lineJoin(String value) native;
- num get lineWidth => JS("num", "#.lineWidth", this);
+ num get lineWidth native;
- set lineWidth(num value) {
- JS("void", "#.lineWidth = #", this, value);
- }
+ set lineWidth(num value) native;
- num get miterLimit => JS("num", "#.miterLimit", this);
+ num get miterLimit native;
- set miterLimit(num value) {
- JS("void", "#.miterLimit = #", this, value);
- }
+ set miterLimit(num value) native;
- num get shadowBlur => JS("num", "#.shadowBlur", this);
+ num get shadowBlur native;
- set shadowBlur(num value) {
- JS("void", "#.shadowBlur = #", this, value);
- }
+ set shadowBlur(num value) native;
- String get shadowColor => JS("String", "#.shadowColor", this);
+ String get shadowColor native;
- set shadowColor(String value) {
- JS("void", "#.shadowColor = #", this, value);
- }
+ set shadowColor(String value) native;
- num get shadowOffsetX => JS("num", "#.shadowOffsetX", this);
+ num get shadowOffsetX native;
- set shadowOffsetX(num value) {
- JS("void", "#.shadowOffsetX = #", this, value);
- }
+ set shadowOffsetX(num value) native;
- num get shadowOffsetY => JS("num", "#.shadowOffsetY", this);
+ num get shadowOffsetY native;
- set shadowOffsetY(num value) {
- JS("void", "#.shadowOffsetY = #", this, value);
- }
+ set shadowOffsetY(num value) native;
@Creates('String|CanvasGradient|CanvasPattern')
@Returns('String|CanvasGradient|CanvasPattern')
- Object? strokeStyle;
+ Object? get strokeStyle native;
- String get textAlign => JS("String", "#.textAlign", this);
+ set strokeStyle(Object? value) native;
- set textAlign(String value) {
- JS("void", "#.textAlign = #", this, value);
- }
+ String get textAlign native;
- String get textBaseline => JS("String", "#.textBaseline", this);
+ set textAlign(String value) native;
- set textBaseline(String value) {
- JS("void", "#.textBaseline = #", this, value);
- }
+ String get textBaseline native;
+
+ set textBaseline(String value) native;
void addHitRegion([Map? options]) {
if (options != null) {
@@ -3038,13 +2975,11 @@
throw new UnsupportedError("Not supported");
}
- String get data => JS("String", "#.data", this);
+ String get data native;
- set data(String value) {
- JS("void", "#.data = #", this, value);
- }
+ set data(String value) native;
- int get length => JS("int", "#.length", this);
+ int get length native;
void appendData(String data) native;
@@ -3064,11 +2999,9 @@
// From NonDocumentTypeChildNode
- Element? get nextElementSibling =>
- JS("Element", "#.nextElementSibling", this);
+ Element? get nextElementSibling native;
- Element? get previousElementSibling =>
- JS("Element", "#.previousElementSibling", this);
+ Element? get previousElementSibling native;
}
// 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
@@ -3097,13 +3030,13 @@
throw new UnsupportedError("Not supported");
}
- String get frameType => JS("String", "#.frameType", this);
+ String get frameType native;
- String get id => JS("String", "#.id", this);
+ String get id native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- String get url => JS("String", "#.url", this);
+ String get url native;
void postMessage(Object message, [List<Object>? transfer]) native;
}
@@ -3157,8 +3090,7 @@
static ClipboardEvent _create_2(type) =>
JS('ClipboardEvent', 'new ClipboardEvent(#)', type);
- DataTransfer? get clipboardData =>
- JS("DataTransfer", "#.clipboardData", this);
+ DataTransfer? get clipboardData native;
}
// 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
@@ -3183,11 +3115,11 @@
static CloseEvent _create_2(type) =>
JS('CloseEvent', 'new CloseEvent(#)', type);
- int get code => JS("int", "#.code", this);
+ int get code native;
- String get reason => JS("String", "#.reason", this);
+ String get reason native;
- bool get wasClean => JS("bool", "#.wasClean", this);
+ bool get wasClean native;
}
// 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
@@ -3247,7 +3179,7 @@
static CompositionEvent _create_2(type) =>
JS('CompositionEvent', 'new CompositionEvent(#)', type);
- String get data => JS("String", "#.data", this);
+ String get data native;
@JSName('initCompositionEvent')
void _initCompositionEvent(String? type, bool? bubbles, bool? cancelable,
@@ -3277,11 +3209,9 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('content');
- String get select => JS("String", "#.select", this);
+ String get select native;
- set select(String value) {
- JS("void", "#.select = #", this, value);
- }
+ set select(String value) native;
@Returns('NodeList')
@Creates('NodeList')
@@ -3326,19 +3256,19 @@
throw new UnsupportedError("Not supported");
}
- num get accuracy => JS("num", "#.accuracy", this);
+ num get accuracy native;
- num? get altitude => JS("num", "#.altitude", this);
+ num? get altitude native;
- num? get altitudeAccuracy => JS("num", "#.altitudeAccuracy", this);
+ num? get altitudeAccuracy native;
- num? get heading => JS("num", "#.heading", this);
+ num? get heading native;
- num get latitude => JS("num", "#.latitude", this);
+ num get latitude native;
- num get longitude => JS("num", "#.longitude", this);
+ num get longitude native;
- num? get speed => JS("num", "#.speed", this);
+ num? get speed native;
}
// 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
@@ -3351,9 +3281,9 @@
throw new UnsupportedError("Not supported");
}
- String get id => JS("String", "#.id", this);
+ String get id native;
- String get type => JS("String", "#.type", this);
+ String get type native;
}
// 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
@@ -3367,9 +3297,9 @@
}
@JSName('iconURL')
- String get iconUrl => JS("String", "#.iconURL", this);
+ String get iconUrl native;
- String get name => JS("String", "#.name", this);
+ String get name native;
}
// 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
@@ -3428,7 +3358,7 @@
static bool get supported =>
JS('bool', '!!(window.crypto && window.crypto.getRandomValues)');
- _SubtleCrypto get subtle => JS("_SubtleCrypto", "#.subtle", this);
+ _SubtleCrypto get subtle native;
@JSName('getRandomValues')
@Creates('TypedData')
@@ -3447,13 +3377,13 @@
}
@Creates('Null')
- Object get algorithm => JS("Object", "#.algorithm", this);
+ Object get algorithm native;
- bool get extractable => JS("bool", "#.extractable", this);
+ bool get extractable native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- Object get usages => JS("Object", "#.usages", this);
+ Object get usages native;
}
// 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
@@ -3466,7 +3396,7 @@
throw new UnsupportedError("Not supported");
}
- _Worklet get paintWorklet => JS("_Worklet", "#.paintWorklet", this);
+ _Worklet get paintWorklet native;
static CssUnitValue Hz(num value) native;
@@ -3552,11 +3482,9 @@
throw new UnsupportedError("Not supported");
}
- String get encoding => JS("String", "#.encoding", this);
+ String get encoding native;
- set encoding(String value) {
- JS("void", "#.encoding = #", this, value);
- }
+ set encoding(String value) native;
}
// 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
@@ -3569,7 +3497,7 @@
throw new UnsupportedError("Not supported");
}
- String get conditionText => JS("String", "#.conditionText", this);
+ String get conditionText native;
}
// 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
@@ -3582,7 +3510,7 @@
throw new UnsupportedError("Not supported");
}
- CssStyleDeclaration get style => JS("CssStyleDeclaration", "#.style", this);
+ CssStyleDeclaration get style native;
}
// 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
@@ -3597,7 +3525,7 @@
@Returns('_CssRuleList')
@Creates('_CssRuleList')
- List<CssRule> get cssRules => JS("_CssRuleList", "#.cssRules", this);
+ List<CssRule> get cssRules native;
void deleteRule(int index) native;
@@ -3614,11 +3542,11 @@
throw new UnsupportedError("Not supported");
}
- num? get intrinsicHeight => JS("num", "#.intrinsicHeight", this);
+ num? get intrinsicHeight native;
- num? get intrinsicRatio => JS("num", "#.intrinsicRatio", this);
+ num? get intrinsicRatio native;
- num? get intrinsicWidth => JS("num", "#.intrinsicWidth", this);
+ num? get intrinsicWidth native;
}
// 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
@@ -3631,11 +3559,11 @@
throw new UnsupportedError("Not supported");
}
- String get href => JS("String", "#.href", this);
+ String get href native;
- MediaList get media => JS("MediaList", "#.media", this);
+ MediaList get media native;
- CssStyleSheet get styleSheet => JS("CssStyleSheet", "#.styleSheet", this);
+ CssStyleSheet get styleSheet native;
}
// 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
@@ -3648,13 +3576,11 @@
throw new UnsupportedError("Not supported");
}
- String get keyText => JS("String", "#.keyText", this);
+ String get keyText native;
- set keyText(String value) {
- JS("void", "#.keyText = #", this, value);
- }
+ set keyText(String value) native;
- CssStyleDeclaration get style => JS("CssStyleDeclaration", "#.style", this);
+ CssStyleDeclaration get style native;
}
// 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
@@ -3669,13 +3595,11 @@
@Returns('_CssRuleList')
@Creates('_CssRuleList')
- List<CssRule> get cssRules => JS("_CssRuleList", "#.cssRules", this);
+ List<CssRule> get cssRules native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
CssKeyframeRule __getter__(int index) native;
@@ -3702,11 +3626,9 @@
static CssKeywordValue _create_1(keyword) =>
JS('CssKeywordValue', 'new CSSKeywordValue(#)', keyword);
- String get value => JS("String", "#.value", this);
+ String get value native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(String value) native;
}
// 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
@@ -3731,11 +3653,9 @@
static CssMatrixComponent _create_2(matrix) =>
JS('CssMatrixComponent', 'new CSSMatrixComponent(#)', matrix);
- DomMatrix get matrix => JS("DomMatrix", "#.matrix", this);
+ DomMatrix get matrix native;
- set matrix(DomMatrix value) {
- JS("void", "#.matrix = #", this, value);
- }
+ set matrix(DomMatrix value) native;
}
// 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
@@ -3748,7 +3668,7 @@
throw new UnsupportedError("Not supported");
}
- MediaList get media => JS("MediaList", "#.media", this);
+ MediaList get media native;
}
// 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
@@ -3762,9 +3682,9 @@
}
@JSName('namespaceURI')
- String get namespaceUri => JS("String", "#.namespaceURI", this);
+ String get namespaceUri native;
- String get prefix => JS("String", "#.prefix", this);
+ String get prefix native;
}
// 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
@@ -3800,13 +3720,11 @@
throw new UnsupportedError("Not supported");
}
- String get selectorText => JS("String", "#.selectorText", this);
+ String get selectorText native;
- set selectorText(String value) {
- JS("void", "#.selectorText = #", this, value);
- }
+ set selectorText(String value) native;
- CssStyleDeclaration get style => JS("CssStyleDeclaration", "#.style", this);
+ CssStyleDeclaration get style native;
}
// 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
@@ -3825,11 +3743,9 @@
static CssPerspective _create_1(length) =>
JS('CssPerspective', 'new CSSPerspective(#)', length);
- CssNumericValue get length => JS("CssNumericValue", "#.length", this);
+ CssNumericValue get length native;
- set length(CssNumericValue value) {
- JS("void", "#.length = #", this, value);
- }
+ set length(CssNumericValue value) native;
}
// 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
@@ -3848,17 +3764,13 @@
static CssPositionValue _create_1(x, y) =>
JS('CssPositionValue', 'new CSSPositionValue(#,#)', x, y);
- CssNumericValue get x => JS("CssNumericValue", "#.x", this);
+ CssNumericValue get x native;
- set x(CssNumericValue value) {
- JS("void", "#.x = #", this, value);
- }
+ set x(CssNumericValue value) native;
- CssNumericValue get y => JS("CssNumericValue", "#.y", this);
+ CssNumericValue get y native;
- set y(CssNumericValue value) {
- JS("void", "#.y = #", this, value);
- }
+ set y(CssNumericValue value) native;
}
// 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
@@ -3871,7 +3783,7 @@
throw new UnsupportedError("Not supported");
}
- String get state => JS("String", "#.state", this);
+ String get state native;
}
// 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
@@ -3905,29 +3817,21 @@
static CssRotation _create_2(angleValue_OR_x, y, z, angle) => JS(
'CssRotation', 'new CSSRotation(#,#,#,#)', angleValue_OR_x, y, z, angle);
- CssNumericValue get angle => JS("CssNumericValue", "#.angle", this);
+ CssNumericValue get angle native;
- set angle(CssNumericValue value) {
- JS("void", "#.angle = #", this, value);
- }
+ set angle(CssNumericValue value) native;
- num get x => JS("num", "#.x", this);
+ num get x native;
- set x(num value) {
- JS("void", "#.x = #", this, value);
- }
+ set x(num value) native;
- num get y => JS("num", "#.y", this);
+ num get y native;
- set y(num value) {
- JS("void", "#.y = #", this, value);
- }
+ set y(num value) native;
- num get z => JS("num", "#.z", this);
+ num get z native;
- set z(num value) {
- JS("void", "#.z = #", this, value);
- }
+ set z(num value) native;
}
// 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
@@ -3962,18 +3866,15 @@
static const int VIEWPORT_RULE = 15;
- String get cssText => JS("String", "#.cssText", this);
+ String get cssText native;
- set cssText(String value) {
- JS("void", "#.cssText = #", this, value);
- }
+ set cssText(String value) native;
- CssRule? get parentRule => JS("CssRule", "#.parentRule", this);
+ CssRule? get parentRule native;
- CssStyleSheet? get parentStyleSheet =>
- JS("CssStyleSheet", "#.parentStyleSheet", this);
+ CssStyleSheet? get parentStyleSheet native;
- int get type => JS("int", "#.type", this);
+ int get type native;
}
// 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
@@ -3999,23 +3900,17 @@
static CssScale _create_2(x, y, z) =>
JS('CssScale', 'new CSSScale(#,#,#)', x, y, z);
- num get x => JS("num", "#.x", this);
+ num get x native;
- set x(num value) {
- JS("void", "#.x = #", this, value);
- }
+ set x(num value) native;
- num get y => JS("num", "#.y", this);
+ num get y native;
- set y(num value) {
- JS("void", "#.y = #", this, value);
- }
+ set y(num value) native;
- num get z => JS("num", "#.z", this);
+ num get z native;
- set z(num value) {
- JS("void", "#.z = #", this, value);
- }
+ set z(num value) native;
}
// 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
@@ -4033,17 +3928,13 @@
}
static CssSkew _create_1(ax, ay) => JS('CssSkew', 'new CSSSkew(#,#)', ax, ay);
- CssNumericValue get ax => JS("CssNumericValue", "#.ax", this);
+ CssNumericValue get ax native;
- set ax(CssNumericValue value) {
- JS("void", "#.ax = #", this, value);
- }
+ set ax(CssNumericValue value) native;
- CssNumericValue get ay => JS("CssNumericValue", "#.ay", this);
+ CssNumericValue get ay native;
- set ay(CssNumericValue value) {
- JS("void", "#.ay = #", this, value);
- }
+ set ay(CssNumericValue value) native;
}
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
@@ -4072,8 +3963,7 @@
///
/// Please note the property name uses camelCase, not-hyphens.
String getPropertyValue(String propertyName) {
- var propValue = _getPropertyValueHelper(propertyName);
- return propValue ?? '';
+ return _getPropertyValueHelper(propertyName);
}
String _getPropertyValueHelper(String propertyName) {
@@ -4097,7 +3987,7 @@
return JS('bool', '# in #', propertyName, this);
}
- void setProperty(String propertyName, String value, [String? priority]) {
+ void setProperty(String propertyName, String? value, [String? priority]) {
return _setPropertyHelper(
_browserPropertyName(propertyName), value, priority);
}
@@ -4149,7 +4039,7 @@
* Checks to see if CSS Transitions are supported.
*/
static bool get supportsTransitions {
- return document.body.style.supportsProperty('transition');
+ return document.body!.style.supportsProperty('transition');
}
// To suppress missing implicit constructor warnings.
@@ -4157,21 +4047,17 @@
throw new UnsupportedError("Not supported");
}
- String get cssFloat => JS("String", "#.cssFloat", this);
+ String get cssFloat native;
- set cssFloat(String value) {
- JS("void", "#.cssFloat = #", this, value);
- }
+ set cssFloat(String value) native;
- String get cssText => JS("String", "#.cssText", this);
+ String get cssText native;
- set cssText(String value) {
- JS("void", "#.cssText = #", this, value);
- }
+ set cssText(String value) native;
- int get length => JS("int", "#.length", this);
+ int get length native;
- CssRule? get parentRule => JS("CssRule", "#.parentRule", this);
+ CssRule? get parentRule native;
String getPropertyPriority(String property) native;
@@ -4192,7 +4078,10 @@
@Returns('String')
@JSName('background')
- String _background;
+ String get _background native;
+
+ @JSName('background')
+ set _background(String value) native;
/** Gets the value of "background-attachment" */
String get backgroundAttachment => this._backgroundAttachment;
@@ -4204,7 +4093,10 @@
@Returns('String')
@JSName('backgroundAttachment')
- String _backgroundAttachment;
+ String get _backgroundAttachment native;
+
+ @JSName('backgroundAttachment')
+ set _backgroundAttachment(String value) native;
/** Gets the value of "background-color" */
String get backgroundColor => this._backgroundColor;
@@ -4216,7 +4108,10 @@
@Returns('String')
@JSName('backgroundColor')
- String _backgroundColor;
+ String get _backgroundColor native;
+
+ @JSName('backgroundColor')
+ set _backgroundColor(String value) native;
/** Gets the value of "background-image" */
String get backgroundImage => this._backgroundImage;
@@ -4228,7 +4123,10 @@
@Returns('String')
@JSName('backgroundImage')
- String _backgroundImage;
+ String get _backgroundImage native;
+
+ @JSName('backgroundImage')
+ set _backgroundImage(String value) native;
/** Gets the value of "background-position" */
String get backgroundPosition => this._backgroundPosition;
@@ -4240,7 +4138,10 @@
@Returns('String')
@JSName('backgroundPosition')
- String _backgroundPosition;
+ String get _backgroundPosition native;
+
+ @JSName('backgroundPosition')
+ set _backgroundPosition(String value) native;
/** Gets the value of "background-repeat" */
String get backgroundRepeat => this._backgroundRepeat;
@@ -4252,7 +4153,10 @@
@Returns('String')
@JSName('backgroundRepeat')
- String _backgroundRepeat;
+ String get _backgroundRepeat native;
+
+ @JSName('backgroundRepeat')
+ set _backgroundRepeat(String value) native;
/** Gets the value of "border" */
String get border => this._border;
@@ -4264,7 +4168,10 @@
@Returns('String')
@JSName('border')
- String _border;
+ String get _border native;
+
+ @JSName('border')
+ set _border(String value) native;
/** Gets the value of "border-bottom" */
String get borderBottom => this._borderBottom;
@@ -4276,7 +4183,10 @@
@Returns('String')
@JSName('borderBottom')
- String _borderBottom;
+ String get _borderBottom native;
+
+ @JSName('borderBottom')
+ set _borderBottom(String value) native;
/** Gets the value of "border-bottom-color" */
String get borderBottomColor => this._borderBottomColor;
@@ -4288,7 +4198,10 @@
@Returns('String')
@JSName('borderBottomColor')
- String _borderBottomColor;
+ String get _borderBottomColor native;
+
+ @JSName('borderBottomColor')
+ set _borderBottomColor(String value) native;
/** Gets the value of "border-bottom-style" */
String get borderBottomStyle => this._borderBottomStyle;
@@ -4300,7 +4213,10 @@
@Returns('String')
@JSName('borderBottomStyle')
- String _borderBottomStyle;
+ String get _borderBottomStyle native;
+
+ @JSName('borderBottomStyle')
+ set _borderBottomStyle(String value) native;
/** Gets the value of "border-bottom-width" */
String get borderBottomWidth => this._borderBottomWidth;
@@ -4312,7 +4228,10 @@
@Returns('String')
@JSName('borderBottomWidth')
- String _borderBottomWidth;
+ String get _borderBottomWidth native;
+
+ @JSName('borderBottomWidth')
+ set _borderBottomWidth(String value) native;
/** Gets the value of "border-collapse" */
String get borderCollapse => this._borderCollapse;
@@ -4324,7 +4243,10 @@
@Returns('String')
@JSName('borderCollapse')
- String _borderCollapse;
+ String get _borderCollapse native;
+
+ @JSName('borderCollapse')
+ set _borderCollapse(String value) native;
/** Gets the value of "border-color" */
String get borderColor => this._borderColor;
@@ -4336,7 +4258,10 @@
@Returns('String')
@JSName('borderColor')
- String _borderColor;
+ String get _borderColor native;
+
+ @JSName('borderColor')
+ set _borderColor(String value) native;
/** Gets the value of "border-left" */
String get borderLeft => this._borderLeft;
@@ -4348,7 +4273,10 @@
@Returns('String')
@JSName('borderLeft')
- String _borderLeft;
+ String get _borderLeft native;
+
+ @JSName('borderLeft')
+ set _borderLeft(String value) native;
/** Gets the value of "border-left-color" */
String get borderLeftColor => this._borderLeftColor;
@@ -4360,7 +4288,10 @@
@Returns('String')
@JSName('borderLeftColor')
- String _borderLeftColor;
+ String get _borderLeftColor native;
+
+ @JSName('borderLeftColor')
+ set _borderLeftColor(String value) native;
/** Gets the value of "border-left-style" */
String get borderLeftStyle => this._borderLeftStyle;
@@ -4372,7 +4303,10 @@
@Returns('String')
@JSName('borderLeftStyle')
- String _borderLeftStyle;
+ String get _borderLeftStyle native;
+
+ @JSName('borderLeftStyle')
+ set _borderLeftStyle(String value) native;
/** Gets the value of "border-left-width" */
String get borderLeftWidth => this._borderLeftWidth;
@@ -4384,7 +4318,10 @@
@Returns('String')
@JSName('borderLeftWidth')
- String _borderLeftWidth;
+ String get _borderLeftWidth native;
+
+ @JSName('borderLeftWidth')
+ set _borderLeftWidth(String value) native;
/** Gets the value of "border-right" */
String get borderRight => this._borderRight;
@@ -4396,7 +4333,10 @@
@Returns('String')
@JSName('borderRight')
- String _borderRight;
+ String get _borderRight native;
+
+ @JSName('borderRight')
+ set _borderRight(String value) native;
/** Gets the value of "border-right-color" */
String get borderRightColor => this._borderRightColor;
@@ -4408,7 +4348,10 @@
@Returns('String')
@JSName('borderRightColor')
- String _borderRightColor;
+ String get _borderRightColor native;
+
+ @JSName('borderRightColor')
+ set _borderRightColor(String value) native;
/** Gets the value of "border-right-style" */
String get borderRightStyle => this._borderRightStyle;
@@ -4420,7 +4363,10 @@
@Returns('String')
@JSName('borderRightStyle')
- String _borderRightStyle;
+ String get _borderRightStyle native;
+
+ @JSName('borderRightStyle')
+ set _borderRightStyle(String value) native;
/** Gets the value of "border-right-width" */
String get borderRightWidth => this._borderRightWidth;
@@ -4432,7 +4378,10 @@
@Returns('String')
@JSName('borderRightWidth')
- String _borderRightWidth;
+ String get _borderRightWidth native;
+
+ @JSName('borderRightWidth')
+ set _borderRightWidth(String value) native;
/** Gets the value of "border-spacing" */
String get borderSpacing => this._borderSpacing;
@@ -4444,7 +4393,10 @@
@Returns('String')
@JSName('borderSpacing')
- String _borderSpacing;
+ String get _borderSpacing native;
+
+ @JSName('borderSpacing')
+ set _borderSpacing(String value) native;
/** Gets the value of "border-style" */
String get borderStyle => this._borderStyle;
@@ -4456,7 +4408,10 @@
@Returns('String')
@JSName('borderStyle')
- String _borderStyle;
+ String get _borderStyle native;
+
+ @JSName('borderStyle')
+ set _borderStyle(String value) native;
/** Gets the value of "border-top" */
String get borderTop => this._borderTop;
@@ -4468,7 +4423,10 @@
@Returns('String')
@JSName('borderTop')
- String _borderTop;
+ String get _borderTop native;
+
+ @JSName('borderTop')
+ set _borderTop(String value) native;
/** Gets the value of "border-top-color" */
String get borderTopColor => this._borderTopColor;
@@ -4480,7 +4438,10 @@
@Returns('String')
@JSName('borderTopColor')
- String _borderTopColor;
+ String get _borderTopColor native;
+
+ @JSName('borderTopColor')
+ set _borderTopColor(String value) native;
/** Gets the value of "border-top-style" */
String get borderTopStyle => this._borderTopStyle;
@@ -4492,7 +4453,10 @@
@Returns('String')
@JSName('borderTopStyle')
- String _borderTopStyle;
+ String get _borderTopStyle native;
+
+ @JSName('borderTopStyle')
+ set _borderTopStyle(String value) native;
/** Gets the value of "border-top-width" */
String get borderTopWidth => this._borderTopWidth;
@@ -4504,7 +4468,10 @@
@Returns('String')
@JSName('borderTopWidth')
- String _borderTopWidth;
+ String get _borderTopWidth native;
+
+ @JSName('borderTopWidth')
+ set _borderTopWidth(String value) native;
/** Gets the value of "border-width" */
String get borderWidth => this._borderWidth;
@@ -4516,7 +4483,10 @@
@Returns('String')
@JSName('borderWidth')
- String _borderWidth;
+ String get _borderWidth native;
+
+ @JSName('borderWidth')
+ set _borderWidth(String value) native;
/** Gets the value of "bottom" */
String get bottom => this._bottom;
@@ -4528,7 +4498,10 @@
@Returns('String')
@JSName('bottom')
- String _bottom;
+ String get _bottom native;
+
+ @JSName('bottom')
+ set _bottom(String value) native;
/** Gets the value of "caption-side" */
String get captionSide => this._captionSide;
@@ -4540,7 +4513,10 @@
@Returns('String')
@JSName('captionSide')
- String _captionSide;
+ String get _captionSide native;
+
+ @JSName('captionSide')
+ set _captionSide(String value) native;
/** Gets the value of "clear" */
String get clear => this._clear;
@@ -4552,7 +4528,10 @@
@Returns('String')
@JSName('clear')
- String _clear;
+ String get _clear native;
+
+ @JSName('clear')
+ set _clear(String value) native;
/** Gets the value of "clip" */
String get clip => this._clip;
@@ -4564,7 +4543,10 @@
@Returns('String')
@JSName('clip')
- String _clip;
+ String get _clip native;
+
+ @JSName('clip')
+ set _clip(String value) native;
/** Gets the value of "color" */
String get color => this._color;
@@ -4576,7 +4558,10 @@
@Returns('String')
@JSName('color')
- String _color;
+ String get _color native;
+
+ @JSName('color')
+ set _color(String value) native;
/** Gets the value of "content" */
String get content => this._content;
@@ -4588,7 +4573,10 @@
@Returns('String')
@JSName('content')
- String _content;
+ String get _content native;
+
+ @JSName('content')
+ set _content(String value) native;
/** Gets the value of "cursor" */
String get cursor => this._cursor;
@@ -4600,7 +4588,10 @@
@Returns('String')
@JSName('cursor')
- String _cursor;
+ String get _cursor native;
+
+ @JSName('cursor')
+ set _cursor(String value) native;
/** Gets the value of "direction" */
String get direction => this._direction;
@@ -4612,7 +4603,10 @@
@Returns('String')
@JSName('direction')
- String _direction;
+ String get _direction native;
+
+ @JSName('direction')
+ set _direction(String value) native;
/** Gets the value of "display" */
String get display => this._display;
@@ -4624,7 +4618,10 @@
@Returns('String')
@JSName('display')
- String _display;
+ String get _display native;
+
+ @JSName('display')
+ set _display(String value) native;
/** Gets the value of "empty-cells" */
String get emptyCells => this._emptyCells;
@@ -4636,7 +4633,10 @@
@Returns('String')
@JSName('emptyCells')
- String _emptyCells;
+ String get _emptyCells native;
+
+ @JSName('emptyCells')
+ set _emptyCells(String value) native;
/** Gets the value of "font" */
String get font => this._font;
@@ -4648,7 +4648,10 @@
@Returns('String')
@JSName('font')
- String _font;
+ String get _font native;
+
+ @JSName('font')
+ set _font(String value) native;
/** Gets the value of "font-family" */
String get fontFamily => this._fontFamily;
@@ -4660,7 +4663,10 @@
@Returns('String')
@JSName('fontFamily')
- String _fontFamily;
+ String get _fontFamily native;
+
+ @JSName('fontFamily')
+ set _fontFamily(String value) native;
/** Gets the value of "font-size" */
String get fontSize => this._fontSize;
@@ -4672,7 +4678,10 @@
@Returns('String')
@JSName('fontSize')
- String _fontSize;
+ String get _fontSize native;
+
+ @JSName('fontSize')
+ set _fontSize(String value) native;
/** Gets the value of "font-style" */
String get fontStyle => this._fontStyle;
@@ -4684,7 +4693,10 @@
@Returns('String')
@JSName('fontStyle')
- String _fontStyle;
+ String get _fontStyle native;
+
+ @JSName('fontStyle')
+ set _fontStyle(String value) native;
/** Gets the value of "font-variant" */
String get fontVariant => this._fontVariant;
@@ -4696,7 +4708,10 @@
@Returns('String')
@JSName('fontVariant')
- String _fontVariant;
+ String get _fontVariant native;
+
+ @JSName('fontVariant')
+ set _fontVariant(String value) native;
/** Gets the value of "font-weight" */
String get fontWeight => this._fontWeight;
@@ -4708,7 +4723,10 @@
@Returns('String')
@JSName('fontWeight')
- String _fontWeight;
+ String get _fontWeight native;
+
+ @JSName('fontWeight')
+ set _fontWeight(String value) native;
/** Gets the value of "height" */
String get height => this._height;
@@ -4720,7 +4738,10 @@
@Returns('String')
@JSName('height')
- String _height;
+ String get _height native;
+
+ @JSName('height')
+ set _height(String value) native;
/** Gets the value of "left" */
String get left => this._left;
@@ -4732,7 +4753,10 @@
@Returns('String')
@JSName('left')
- String _left;
+ String get _left native;
+
+ @JSName('left')
+ set _left(String value) native;
/** Gets the value of "letter-spacing" */
String get letterSpacing => this._letterSpacing;
@@ -4744,7 +4768,10 @@
@Returns('String')
@JSName('letterSpacing')
- String _letterSpacing;
+ String get _letterSpacing native;
+
+ @JSName('letterSpacing')
+ set _letterSpacing(String value) native;
/** Gets the value of "line-height" */
String get lineHeight => this._lineHeight;
@@ -4756,7 +4783,10 @@
@Returns('String')
@JSName('lineHeight')
- String _lineHeight;
+ String get _lineHeight native;
+
+ @JSName('lineHeight')
+ set _lineHeight(String value) native;
/** Gets the value of "list-style" */
String get listStyle => this._listStyle;
@@ -4768,7 +4798,10 @@
@Returns('String')
@JSName('listStyle')
- String _listStyle;
+ String get _listStyle native;
+
+ @JSName('listStyle')
+ set _listStyle(String value) native;
/** Gets the value of "list-style-image" */
String get listStyleImage => this._listStyleImage;
@@ -4780,7 +4813,10 @@
@Returns('String')
@JSName('listStyleImage')
- String _listStyleImage;
+ String get _listStyleImage native;
+
+ @JSName('listStyleImage')
+ set _listStyleImage(String value) native;
/** Gets the value of "list-style-position" */
String get listStylePosition => this._listStylePosition;
@@ -4792,7 +4828,10 @@
@Returns('String')
@JSName('listStylePosition')
- String _listStylePosition;
+ String get _listStylePosition native;
+
+ @JSName('listStylePosition')
+ set _listStylePosition(String value) native;
/** Gets the value of "list-style-type" */
String get listStyleType => this._listStyleType;
@@ -4804,7 +4843,10 @@
@Returns('String')
@JSName('listStyleType')
- String _listStyleType;
+ String get _listStyleType native;
+
+ @JSName('listStyleType')
+ set _listStyleType(String value) native;
/** Gets the value of "margin" */
String get margin => this._margin;
@@ -4816,7 +4858,10 @@
@Returns('String')
@JSName('margin')
- String _margin;
+ String get _margin native;
+
+ @JSName('margin')
+ set _margin(String value) native;
/** Gets the value of "margin-bottom" */
String get marginBottom => this._marginBottom;
@@ -4828,7 +4873,10 @@
@Returns('String')
@JSName('marginBottom')
- String _marginBottom;
+ String get _marginBottom native;
+
+ @JSName('marginBottom')
+ set _marginBottom(String value) native;
/** Gets the value of "margin-left" */
String get marginLeft => this._marginLeft;
@@ -4840,7 +4888,10 @@
@Returns('String')
@JSName('marginLeft')
- String _marginLeft;
+ String get _marginLeft native;
+
+ @JSName('marginLeft')
+ set _marginLeft(String value) native;
/** Gets the value of "margin-right" */
String get marginRight => this._marginRight;
@@ -4852,7 +4903,10 @@
@Returns('String')
@JSName('marginRight')
- String _marginRight;
+ String get _marginRight native;
+
+ @JSName('marginRight')
+ set _marginRight(String value) native;
/** Gets the value of "margin-top" */
String get marginTop => this._marginTop;
@@ -4864,7 +4918,10 @@
@Returns('String')
@JSName('marginTop')
- String _marginTop;
+ String get _marginTop native;
+
+ @JSName('marginTop')
+ set _marginTop(String value) native;
/** Gets the value of "max-height" */
String get maxHeight => this._maxHeight;
@@ -4876,7 +4933,10 @@
@Returns('String')
@JSName('maxHeight')
- String _maxHeight;
+ String get _maxHeight native;
+
+ @JSName('maxHeight')
+ set _maxHeight(String value) native;
/** Gets the value of "max-width" */
String get maxWidth => this._maxWidth;
@@ -4888,7 +4948,10 @@
@Returns('String')
@JSName('maxWidth')
- String _maxWidth;
+ String get _maxWidth native;
+
+ @JSName('maxWidth')
+ set _maxWidth(String value) native;
/** Gets the value of "min-height" */
String get minHeight => this._minHeight;
@@ -4900,7 +4963,10 @@
@Returns('String')
@JSName('minHeight')
- String _minHeight;
+ String get _minHeight native;
+
+ @JSName('minHeight')
+ set _minHeight(String value) native;
/** Gets the value of "min-width" */
String get minWidth => this._minWidth;
@@ -4912,7 +4978,10 @@
@Returns('String')
@JSName('minWidth')
- String _minWidth;
+ String get _minWidth native;
+
+ @JSName('minWidth')
+ set _minWidth(String value) native;
/** Gets the value of "outline" */
String get outline => this._outline;
@@ -4924,7 +4993,10 @@
@Returns('String')
@JSName('outline')
- String _outline;
+ String get _outline native;
+
+ @JSName('outline')
+ set _outline(String value) native;
/** Gets the value of "outline-color" */
String get outlineColor => this._outlineColor;
@@ -4936,7 +5008,10 @@
@Returns('String')
@JSName('outlineColor')
- String _outlineColor;
+ String get _outlineColor native;
+
+ @JSName('outlineColor')
+ set _outlineColor(String value) native;
/** Gets the value of "outline-style" */
String get outlineStyle => this._outlineStyle;
@@ -4948,7 +5023,10 @@
@Returns('String')
@JSName('outlineStyle')
- String _outlineStyle;
+ String get _outlineStyle native;
+
+ @JSName('outlineStyle')
+ set _outlineStyle(String value) native;
/** Gets the value of "outline-width" */
String get outlineWidth => this._outlineWidth;
@@ -4960,7 +5038,10 @@
@Returns('String')
@JSName('outlineWidth')
- String _outlineWidth;
+ String get _outlineWidth native;
+
+ @JSName('outlineWidth')
+ set _outlineWidth(String value) native;
/** Gets the value of "overflow" */
String get overflow => this._overflow;
@@ -4972,7 +5053,10 @@
@Returns('String')
@JSName('overflow')
- String _overflow;
+ String get _overflow native;
+
+ @JSName('overflow')
+ set _overflow(String value) native;
/** Gets the value of "padding" */
String get padding => this._padding;
@@ -4984,7 +5068,10 @@
@Returns('String')
@JSName('padding')
- String _padding;
+ String get _padding native;
+
+ @JSName('padding')
+ set _padding(String value) native;
/** Gets the value of "padding-bottom" */
String get paddingBottom => this._paddingBottom;
@@ -4996,7 +5083,10 @@
@Returns('String')
@JSName('paddingBottom')
- String _paddingBottom;
+ String get _paddingBottom native;
+
+ @JSName('paddingBottom')
+ set _paddingBottom(String value) native;
/** Gets the value of "padding-left" */
String get paddingLeft => this._paddingLeft;
@@ -5008,7 +5098,10 @@
@Returns('String')
@JSName('paddingLeft')
- String _paddingLeft;
+ String get _paddingLeft native;
+
+ @JSName('paddingLeft')
+ set _paddingLeft(String value) native;
/** Gets the value of "padding-right" */
String get paddingRight => this._paddingRight;
@@ -5020,7 +5113,10 @@
@Returns('String')
@JSName('paddingRight')
- String _paddingRight;
+ String get _paddingRight native;
+
+ @JSName('paddingRight')
+ set _paddingRight(String value) native;
/** Gets the value of "padding-top" */
String get paddingTop => this._paddingTop;
@@ -5032,7 +5128,10 @@
@Returns('String')
@JSName('paddingTop')
- String _paddingTop;
+ String get _paddingTop native;
+
+ @JSName('paddingTop')
+ set _paddingTop(String value) native;
/** Gets the value of "page-break-after" */
String get pageBreakAfter => this._pageBreakAfter;
@@ -5044,7 +5143,10 @@
@Returns('String')
@JSName('pageBreakAfter')
- String _pageBreakAfter;
+ String get _pageBreakAfter native;
+
+ @JSName('pageBreakAfter')
+ set _pageBreakAfter(String value) native;
/** Gets the value of "page-break-before" */
String get pageBreakBefore => this._pageBreakBefore;
@@ -5056,7 +5158,10 @@
@Returns('String')
@JSName('pageBreakBefore')
- String _pageBreakBefore;
+ String get _pageBreakBefore native;
+
+ @JSName('pageBreakBefore')
+ set _pageBreakBefore(String value) native;
/** Gets the value of "page-break-inside" */
String get pageBreakInside => this._pageBreakInside;
@@ -5068,7 +5173,10 @@
@Returns('String')
@JSName('pageBreakInside')
- String _pageBreakInside;
+ String get _pageBreakInside native;
+
+ @JSName('pageBreakInside')
+ set _pageBreakInside(String value) native;
/** Gets the value of "position" */
String get position => this._position;
@@ -5080,7 +5188,10 @@
@Returns('String')
@JSName('position')
- String _position;
+ String get _position native;
+
+ @JSName('position')
+ set _position(String value) native;
/** Gets the value of "quotes" */
String get quotes => this._quotes;
@@ -5092,7 +5203,10 @@
@Returns('String')
@JSName('quotes')
- String _quotes;
+ String get _quotes native;
+
+ @JSName('quotes')
+ set _quotes(String value) native;
/** Gets the value of "right" */
String get right => this._right;
@@ -5104,7 +5218,10 @@
@Returns('String')
@JSName('right')
- String _right;
+ String get _right native;
+
+ @JSName('right')
+ set _right(String value) native;
/** Gets the value of "table-layout" */
String get tableLayout => this._tableLayout;
@@ -5116,7 +5233,10 @@
@Returns('String')
@JSName('tableLayout')
- String _tableLayout;
+ String get _tableLayout native;
+
+ @JSName('tableLayout')
+ set _tableLayout(String value) native;
/** Gets the value of "text-align" */
String get textAlign => this._textAlign;
@@ -5128,7 +5248,10 @@
@Returns('String')
@JSName('textAlign')
- String _textAlign;
+ String get _textAlign native;
+
+ @JSName('textAlign')
+ set _textAlign(String value) native;
/** Gets the value of "text-decoration" */
String get textDecoration => this._textDecoration;
@@ -5140,7 +5263,10 @@
@Returns('String')
@JSName('textDecoration')
- String _textDecoration;
+ String get _textDecoration native;
+
+ @JSName('textDecoration')
+ set _textDecoration(String value) native;
/** Gets the value of "text-indent" */
String get textIndent => this._textIndent;
@@ -5152,7 +5278,10 @@
@Returns('String')
@JSName('textIndent')
- String _textIndent;
+ String get _textIndent native;
+
+ @JSName('textIndent')
+ set _textIndent(String value) native;
/** Gets the value of "text-transform" */
String get textTransform => this._textTransform;
@@ -5164,7 +5293,10 @@
@Returns('String')
@JSName('textTransform')
- String _textTransform;
+ String get _textTransform native;
+
+ @JSName('textTransform')
+ set _textTransform(String value) native;
/** Gets the value of "top" */
String get top => this._top;
@@ -5176,7 +5308,10 @@
@Returns('String')
@JSName('top')
- String _top;
+ String get _top native;
+
+ @JSName('top')
+ set _top(String value) native;
/** Gets the value of "unicode-bidi" */
String get unicodeBidi => this._unicodeBidi;
@@ -5188,7 +5323,10 @@
@Returns('String')
@JSName('unicodeBidi')
- String _unicodeBidi;
+ String get _unicodeBidi native;
+
+ @JSName('unicodeBidi')
+ set _unicodeBidi(String value) native;
/** Gets the value of "vertical-align" */
String get verticalAlign => this._verticalAlign;
@@ -5200,7 +5338,10 @@
@Returns('String')
@JSName('verticalAlign')
- String _verticalAlign;
+ String get _verticalAlign native;
+
+ @JSName('verticalAlign')
+ set _verticalAlign(String value) native;
/** Gets the value of "visibility" */
String get visibility => this._visibility;
@@ -5212,7 +5353,10 @@
@Returns('String')
@JSName('visibility')
- String _visibility;
+ String get _visibility native;
+
+ @JSName('visibility')
+ set _visibility(String value) native;
/** Gets the value of "white-space" */
String get whiteSpace => this._whiteSpace;
@@ -5224,7 +5368,10 @@
@Returns('String')
@JSName('whiteSpace')
- String _whiteSpace;
+ String get _whiteSpace native;
+
+ @JSName('whiteSpace')
+ set _whiteSpace(String value) native;
/** Gets the value of "width" */
String get width => this._width;
@@ -5236,7 +5383,10 @@
@Returns('String')
@JSName('width')
- String _width;
+ String get _width native;
+
+ @JSName('width')
+ set _width(String value) native;
/** Gets the value of "word-spacing" */
String get wordSpacing => this._wordSpacing;
@@ -5248,7 +5398,10 @@
@Returns('String')
@JSName('wordSpacing')
- String _wordSpacing;
+ String get _wordSpacing native;
+
+ @JSName('wordSpacing')
+ set _wordSpacing(String value) native;
/** Gets the value of "z-index" */
String get zIndex => this._zIndex;
@@ -5260,7 +5413,10 @@
@Returns('String')
@JSName('zIndex')
- String _zIndex;
+ String get _zIndex native;
+
+ @JSName('zIndex')
+ set _zIndex(String value) native;
}
class _CssStyleDeclarationSet extends Object with CssStyleDeclarationBase {
@@ -5276,7 +5432,7 @@
_elementCssStyleDeclarationSetIterable!.first
.getPropertyValue(propertyName);
- void setProperty(String propertyName, String value, [String? priority]) {
+ void setProperty(String propertyName, String? value, [String? priority]) {
_elementCssStyleDeclarationSetIterable!
.forEach((e) => e.setProperty(propertyName, value, priority));
}
@@ -5747,7 +5903,7 @@
abstract class CssStyleDeclarationBase {
String getPropertyValue(String propertyName);
- void setProperty(String propertyName, String value, [String? priority]);
+ void setProperty(String propertyName, String? value, [String? priority]);
/** Gets the value of "align-content" */
String get alignContent => getPropertyValue('align-content');
@@ -8517,13 +8673,11 @@
throw new UnsupportedError("Not supported");
}
- String get selectorText => JS("String", "#.selectorText", this);
+ String get selectorText native;
- set selectorText(String value) {
- JS("void", "#.selectorText = #", this, value);
- }
+ set selectorText(String value) native;
- CssStyleDeclaration get style => JS("CssStyleDeclaration", "#.style", this);
+ CssStyleDeclaration get style native;
}
// 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
@@ -8538,13 +8692,13 @@
@Returns('_CssRuleList')
@Creates('_CssRuleList')
- List<CssRule> get cssRules => JS("_CssRuleList", "#.cssRules", this);
+ List<CssRule> get cssRules native;
- CssRule? get ownerRule => JS("CssRule", "#.ownerRule", this);
+ CssRule? get ownerRule native;
@Returns('_CssRuleList')
@Creates('_CssRuleList')
- List<CssRule> get rules => JS("_CssRuleList", "#.rules", this);
+ List<CssRule> get rules native;
int addRule(String? selector, String? style, [int? index]) native;
@@ -8589,11 +8743,9 @@
throw new UnsupportedError("Not supported");
}
- bool get is2D => JS("bool", "#.is2D", this);
+ bool get is2D native;
- set is2D(bool value) {
- JS("void", "#.is2D = #", this, value);
- }
+ set is2D(bool value) native;
}
// 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
@@ -8621,9 +8773,9 @@
static CssTransformValue _create_2(transformComponents) =>
JS('CssTransformValue', 'new CSSTransformValue(#)', transformComponents);
- bool get is2D => JS("bool", "#.is2D", this);
+ bool get is2D native;
- int get length => JS("int", "#.length", this);
+ int get length native;
CssTransformComponent componentAtIndex(int index) native;
@@ -8657,23 +8809,17 @@
static CssTranslation _create_2(x, y, z) =>
JS('CssTranslation', 'new CSSTranslation(#,#,#)', x, y, z);
- CssNumericValue get x => JS("CssNumericValue", "#.x", this);
+ CssNumericValue get x native;
- set x(CssNumericValue value) {
- JS("void", "#.x = #", this, value);
- }
+ set x(CssNumericValue value) native;
- CssNumericValue get y => JS("CssNumericValue", "#.y", this);
+ CssNumericValue get y native;
- set y(CssNumericValue value) {
- JS("void", "#.y = #", this, value);
- }
+ set y(CssNumericValue value) native;
- CssNumericValue get z => JS("CssNumericValue", "#.z", this);
+ CssNumericValue get z native;
- set z(CssNumericValue value) {
- JS("void", "#.z = #", this, value);
- }
+ set z(CssNumericValue value) native;
}
// 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
@@ -8692,19 +8838,15 @@
static CssUnitValue _create_1(value, unit) =>
JS('CssUnitValue', 'new CSSUnitValue(#,#)', value, unit);
- String get type => JS("String", "#.type", this);
+ String get type native;
- String get unit => JS("String", "#.unit", this);
+ String get unit native;
- set unit(String value) {
- JS("void", "#.unit = #", this, value);
- }
+ set unit(String value) native;
- num get value => JS("num", "#.value", this);
+ num get value native;
- set value(num value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(num value) native;
}
// 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
@@ -8717,7 +8859,7 @@
throw new UnsupportedError("Not supported");
}
- int get length => JS("int", "#.length", this);
+ int get length native;
Object? fragmentAtIndex(int index) native;
}
@@ -8732,9 +8874,9 @@
throw new UnsupportedError("Not supported");
}
- CssUnparsedValue get fallback => JS("CssUnparsedValue", "#.fallback", this);
+ CssUnparsedValue get fallback native;
- String get variable => JS("String", "#.variable", this);
+ String get variable native;
}
// 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
@@ -8747,7 +8889,7 @@
throw new UnsupportedError("Not supported");
}
- CssStyleDeclaration get style => JS("CssStyleDeclaration", "#.style", this);
+ CssStyleDeclaration get style native;
}
// 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
@@ -8766,7 +8908,7 @@
static CssurlImageValue _create_1(url) =>
JS('CssurlImageValue', 'new CSSURLImageValue(#)', url);
- String get url => JS("String", "#.url", this);
+ String get url native;
}
// 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
@@ -8864,7 +9006,7 @@
convertNativeToDart_SerializedScriptValue(this._get__detail);
@JSName('detail')
@Creates('Null')
- dynamic get _get__detail => JS("", "#.detail", this);
+ dynamic get _get__detail native;
@JSName('initCustomEvent')
void _initCustomEvent(String type,
@@ -8910,11 +9052,9 @@
*/
DataElement.created() : super.created();
- String get value => JS("String", "#.value", this);
+ String get value native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(String value) native;
}
// 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
@@ -8945,7 +9085,7 @@
@Returns('HtmlCollection')
@Creates('HtmlCollection')
- List<Node> get options => JS("HtmlCollection", "#.options", this);
+ List<Node> get options native;
}
// 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
@@ -8963,25 +9103,21 @@
}
static DataTransfer _create_1() => JS('DataTransfer', 'new DataTransfer()');
- String get dropEffect => JS("String", "#.dropEffect", this);
+ String get dropEffect native;
- set dropEffect(String value) {
- JS("void", "#.dropEffect = #", this, value);
- }
+ set dropEffect(String value) native;
- String get effectAllowed => JS("String", "#.effectAllowed", this);
+ String get effectAllowed native;
- set effectAllowed(String value) {
- JS("void", "#.effectAllowed = #", this, value);
- }
+ set effectAllowed(String value) native;
@Returns('FileList')
@Creates('FileList')
- List<File> get files => JS("FileList", "#.files", this);
+ List<File> get files native;
- DataTransferItemList get items => JS("DataTransferItemList", "#.items", this);
+ DataTransferItemList get items native;
- List<String> get types => JS("List<String>", "#.types", this);
+ List<String> get types native;
void clearData([String? format]) native;
@@ -9015,9 +9151,9 @@
throw new UnsupportedError("Not supported");
}
- String get kind => JS("String", "#.kind", this);
+ String get kind native;
- String get type => JS("String", "#.type", this);
+ String get type native;
File? getAsFile() native;
@@ -9037,7 +9173,7 @@
throw new UnsupportedError("Not supported");
}
- int get length => JS("int", "#.length", this);
+ int get length native;
DataTransferItem? add(data_OR_file, [String? type]) native;
@@ -9204,11 +9340,11 @@
throw new UnsupportedError("Not supported");
}
- int get lineNumber => JS("int", "#.lineNumber", this);
+ int get lineNumber native;
- String get message => JS("String", "#.message", this);
+ String get message native;
- String get sourceFile => JS("String", "#.sourceFile", this);
+ String get sourceFile native;
}
// 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
@@ -9235,11 +9371,9 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('details');
- bool get open => JS("bool", "#.open", this);
+ bool get open native;
- set open(bool value) {
- JS("void", "#.open = #", this, value);
- }
+ set open(bool value) native;
}
// 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
@@ -9258,11 +9392,11 @@
static DetectedBarcode _create_1() =>
JS('DetectedBarcode', 'new DetectedBarcode()');
- Rectangle get boundingBox => JS("Rectangle", "#.boundingBox", this);
+ Rectangle get boundingBox native;
- List get cornerPoints => JS("List", "#.cornerPoints", this);
+ List get cornerPoints native;
- String get rawValue => JS("String", "#.rawValue", this);
+ String get rawValue native;
}
// 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
@@ -9280,9 +9414,9 @@
}
static DetectedFace _create_1() => JS('DetectedFace', 'new DetectedFace()');
- Rectangle get boundingBox => JS("Rectangle", "#.boundingBox", this);
+ Rectangle get boundingBox native;
- List get landmarks => JS("List", "#.landmarks", this);
+ List get landmarks native;
}
// 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
@@ -9300,11 +9434,11 @@
}
static DetectedText _create_1() => JS('DetectedText', 'new DetectedText()');
- Rectangle get boundingBox => JS("Rectangle", "#.boundingBox", this);
+ Rectangle get boundingBox native;
- List get cornerPoints => JS("List", "#.cornerPoints", this);
+ List get cornerPoints native;
- String get rawValue => JS("String", "#.rawValue", this);
+ String get rawValue native;
}
// 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
@@ -9317,11 +9451,11 @@
throw new UnsupportedError("Not supported");
}
- num? get x => JS("num", "#.x", this);
+ num? get x native;
- num? get y => JS("num", "#.y", this);
+ num? get y native;
- num? get z => JS("num", "#.z", this);
+ num? get z native;
}
// 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
@@ -9346,16 +9480,13 @@
static DeviceMotionEvent _create_2(type) =>
JS('DeviceMotionEvent', 'new DeviceMotionEvent(#)', type);
- DeviceAcceleration? get acceleration =>
- JS("DeviceAcceleration", "#.acceleration", this);
+ DeviceAcceleration? get acceleration native;
- DeviceAcceleration? get accelerationIncludingGravity =>
- JS("DeviceAcceleration", "#.accelerationIncludingGravity", this);
+ DeviceAcceleration? get accelerationIncludingGravity native;
- num get interval => JS("num", "#.interval", this);
+ num get interval native;
- DeviceRotationRate? get rotationRate =>
- JS("DeviceRotationRate", "#.rotationRate", this);
+ DeviceRotationRate? get rotationRate native;
}
// 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
@@ -9383,13 +9514,13 @@
static DeviceOrientationEvent _create_2(type) =>
JS('DeviceOrientationEvent', 'new DeviceOrientationEvent(#)', type);
- bool get absolute => JS("bool", "#.absolute", this);
+ bool get absolute native;
- num? get alpha => JS("num", "#.alpha", this);
+ num? get alpha native;
- num? get beta => JS("num", "#.beta", this);
+ num? get beta native;
- num? get gamma => JS("num", "#.gamma", this);
+ num? get gamma native;
}
// 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
@@ -9402,11 +9533,11 @@
throw new UnsupportedError("Not supported");
}
- num? get alpha => JS("num", "#.alpha", this);
+ num? get alpha native;
- num? get beta => JS("num", "#.beta", this);
+ num? get beta native;
- num? get gamma => JS("num", "#.gamma", this);
+ num? get gamma native;
}
// 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
@@ -9426,17 +9557,13 @@
*/
DialogElement.created() : super.created();
- bool get open => JS("bool", "#.open", this);
+ bool get open native;
- set open(bool value) {
- JS("void", "#.open = #", this, value);
- }
+ set open(bool value) native;
- String get returnValue => JS("String", "#.returnValue", this);
+ String get returnValue native;
- set returnValue(String value) {
- JS("void", "#.returnValue = #", this, value);
- }
+ set returnValue(String value) native;
void close([String? returnValue]) native;
@@ -9743,21 +9870,21 @@
}
static Document _create_1() => JS('Document', 'new Document()');
- String get addressSpace => JS("String", "#.addressSpace", this);
+ String get addressSpace native;
@JSName('body')
- HtmlElement? _body;
+ HtmlElement? get _body native;
- String get contentType => JS("String", "#.contentType", this);
+ @JSName('body')
+ set _body(HtmlElement? value) native;
- String get cookie => JS("String", "#.cookie", this);
+ String get contentType native;
- set cookie(String value) {
- JS("void", "#.cookie = #", this, value);
- }
+ String get cookie native;
- ScriptElement? get currentScript =>
- JS("ScriptElement", "#.currentScript", this);
+ set cookie(String value) native;
+
+ ScriptElement? get currentScript native;
WindowBase? get window => _convertNativeToDart_Window(this._get_window);
@JSName('defaultView')
@@ -9765,82 +9892,80 @@
@Returns('Window|=Object')
@Creates('Window|=Object|Null')
@Returns('Window|=Object|Null')
- dynamic get _get_window => JS("", "#.defaultView", this);
+ dynamic get _get_window native;
- Element? get documentElement => JS("Element", "#.documentElement", this);
+ Element? get documentElement native;
- String get domain => JS("String", "#.domain", this);
+ String get domain native;
- bool get fullscreenEnabled => JS("bool", "#.fullscreenEnabled", this);
+ bool get fullscreenEnabled native;
@JSName('head')
- HeadElement? get _head => JS("HeadElement", "#.head", this);
+ HeadElement? get _head native;
- bool get hidden => JS("bool", "#.hidden", this);
+ bool get hidden native;
- DomImplementation get implementation =>
- JS("DomImplementation", "#.implementation", this);
+ DomImplementation get implementation native;
@JSName('lastModified')
- String get _lastModified => JS("String", "#.lastModified", this);
+ String get _lastModified native;
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
@JSName('preferredStylesheetSet')
- String? get _preferredStylesheetSet =>
- JS("String", "#.preferredStylesheetSet", this);
+ String? get _preferredStylesheetSet native;
- String get readyState => JS("String", "#.readyState", this);
+ String get readyState native;
@JSName('referrer')
- String get _referrer => JS("String", "#.referrer", this);
+ String get _referrer native;
- SvgSvgElement get rootElement => JS("SvgSvgElement", "#.rootElement", this);
+ SvgSvgElement get rootElement native;
- Element? rootScroller;
+ Element? get rootScroller native;
- Element? get scrollingElement => JS("Element", "#.scrollingElement", this);
+ set rootScroller(Element? value) native;
+
+ Element? get scrollingElement native;
@JSName('selectedStylesheetSet')
- String? _selectedStylesheetSet;
+ String? get _selectedStylesheetSet native;
- String get suborigin => JS("String", "#.suborigin", this);
+ @JSName('selectedStylesheetSet')
+ set _selectedStylesheetSet(String? value) native;
- DocumentTimeline get timeline => JS("DocumentTimeline", "#.timeline", this);
+ String get suborigin native;
+
+ DocumentTimeline get timeline native;
@JSName('title')
- String get _title => JS("String", "#.title", this);
+ String get _title native;
@JSName('title')
- set _title(String value) {
- JS("void", "#.title = #", this, value);
- }
+ set _title(String value) native;
@JSName('visibilityState')
- String get _visibilityState => JS("String", "#.visibilityState", this);
+ String get _visibilityState native;
@JSName('webkitFullscreenElement')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- Element get _webkitFullscreenElement =>
- JS("Element", "#.webkitFullscreenElement", this);
+ Element get _webkitFullscreenElement native;
@JSName('webkitFullscreenEnabled')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- bool get _webkitFullscreenEnabled =>
- JS("bool", "#.webkitFullscreenEnabled", this);
+ bool get _webkitFullscreenEnabled native;
@JSName('webkitHidden')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- bool get _webkitHidden => JS("bool", "#.webkitHidden", this);
+ bool get _webkitHidden native;
@JSName('webkitVisibilityState')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- String get _webkitVisibilityState =>
- JS("String", "#.webkitVisibilityState", this);
+ String get _webkitVisibilityState native;
Node adoptNode(Node node) native;
@@ -9968,18 +10093,16 @@
// From DocumentOrShadowRoot
- Element? get activeElement => JS("Element", "#.activeElement", this);
+ Element? get activeElement native;
- Element? get fullscreenElement => JS("Element", "#.fullscreenElement", this);
+ Element? get fullscreenElement native;
- Element? get pointerLockElement =>
- JS("Element", "#.pointerLockElement", this);
+ Element? get pointerLockElement native;
@JSName('styleSheets')
@Returns('_StyleSheetList')
@Creates('_StyleSheetList')
- List<StyleSheet> get _styleSheets =>
- JS("_StyleSheetList", "#.styleSheets", this);
+ List<StyleSheet> get _styleSheets native;
@JSName('elementFromPoint')
Element? _elementFromPoint(int x, int y) native;
@@ -9988,23 +10111,23 @@
// From FontFaceSource
- FontFaceSet get fonts => JS("FontFaceSet", "#.fonts", this);
+ FontFaceSet get fonts native;
// From ParentNode
@JSName('childElementCount')
- int get _childElementCount => JS("int", "#.childElementCount", this);
+ int get _childElementCount native;
@JSName('children')
@Returns('HtmlCollection')
@Creates('HtmlCollection')
- List<Node> get _children => JS("HtmlCollection", "#.children", this);
+ List<Node> get _children native;
@JSName('firstElementChild')
- Element? get _firstElementChild => JS("Element", "#.firstElementChild", this);
+ Element? get _firstElementChild native;
@JSName('lastElementChild')
- Element? get _lastElementChild => JS("Element", "#.lastElementChild", this);
+ Element? get _lastElementChild native;
/**
* Finds the first descendant element of this document that matches the
@@ -10327,7 +10450,7 @@
factory DocumentFragment.html(String html,
{NodeValidator? validator, NodeTreeSanitizer? treeSanitizer}) {
- return document.body.createFragment(html,
+ return document.body!.createFragment(html,
validator: validator, treeSanitizer: treeSanitizer);
}
@@ -10343,13 +10466,13 @@
// Native field is used only by Dart code so does not lead to instantiation
// of native classes
@Creates('Null')
- List<Element> _docChildren;
+ List<Element>? _docChildren;
List<Element> get children {
if (_docChildren == null) {
_docChildren = new FilteredElementList(this);
}
- return _docChildren;
+ return _docChildren!;
}
set children(List<Element> value) {
@@ -10387,7 +10510,7 @@
void setInnerHtml(String html,
{NodeValidator? validator, NodeTreeSanitizer? treeSanitizer}) {
this.nodes.clear();
- append(document.body.createFragment(html,
+ append(document.body!.createFragment(html,
validator: validator, treeSanitizer: treeSanitizer));
}
@@ -10421,13 +10544,13 @@
// From ParentNode
@JSName('childElementCount')
- int get _childElementCount => JS("int", "#.childElementCount", this);
+ int get _childElementCount native;
@JSName('firstElementChild')
- Element? get _firstElementChild => JS("Element", "#.firstElementChild", this);
+ Element? get _firstElementChild native;
@JSName('lastElementChild')
- Element? get _lastElementChild => JS("Element", "#.lastElementChild", this);
+ Element? get _lastElementChild native;
/**
* Finds the first descendant element of this document fragment that matches
@@ -10459,17 +10582,15 @@
throw new UnsupportedError("Not supported");
}
- Element? get activeElement => JS("Element", "#.activeElement", this);
+ Element? get activeElement native;
- Element? get fullscreenElement => JS("Element", "#.fullscreenElement", this);
+ Element? get fullscreenElement native;
- Element? get pointerLockElement =>
- JS("Element", "#.pointerLockElement", this);
+ Element? get pointerLockElement native;
@Returns('_StyleSheetList')
@Creates('_StyleSheetList')
- List<StyleSheet> get styleSheets =>
- JS("_StyleSheetList", "#.styleSheets", this);
+ List<StyleSheet> get styleSheets native;
Element? elementFromPoint(int x, int y) native;
@@ -10521,9 +10642,9 @@
JS('DomError', 'new DOMError(#,#)', name, message);
static DomError _create_2(name) => JS('DomError', 'new DOMError(#)', name);
- String get message => JS("String", "#.message", this);
+ String get message native;
- String get name => JS("String", "#.name", this);
+ String get name native;
}
// 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
@@ -10581,7 +10702,7 @@
throw new UnsupportedError("Not supported");
}
- String get message => JS("String", "#.message", this);
+ String get message native;
String toString() => JS('String', 'String(#)', this);
}
@@ -10642,179 +10763,135 @@
// Shadowing definition.
- num get a => JS("num", "#.a", this);
+ num get a native;
- set a(num value) {
- JS("void", "#.a = #", this, value);
- }
+ set a(num value) native;
// Shadowing definition.
- num get b => JS("num", "#.b", this);
+ num get b native;
- set b(num value) {
- JS("void", "#.b = #", this, value);
- }
+ set b(num value) native;
// Shadowing definition.
- num get c => JS("num", "#.c", this);
+ num get c native;
- set c(num value) {
- JS("void", "#.c = #", this, value);
- }
+ set c(num value) native;
// Shadowing definition.
- num get d => JS("num", "#.d", this);
+ num get d native;
- set d(num value) {
- JS("void", "#.d = #", this, value);
- }
+ set d(num value) native;
// Shadowing definition.
- num get e => JS("num", "#.e", this);
+ num get e native;
- set e(num value) {
- JS("void", "#.e = #", this, value);
- }
+ set e(num value) native;
// Shadowing definition.
- num get f => JS("num", "#.f", this);
+ num get f native;
- set f(num value) {
- JS("void", "#.f = #", this, value);
- }
+ set f(num value) native;
// Shadowing definition.
- num get m11 => JS("num", "#.m11", this);
+ num get m11 native;
- set m11(num value) {
- JS("void", "#.m11 = #", this, value);
- }
+ set m11(num value) native;
// Shadowing definition.
- num get m12 => JS("num", "#.m12", this);
+ num get m12 native;
- set m12(num value) {
- JS("void", "#.m12 = #", this, value);
- }
+ set m12(num value) native;
// Shadowing definition.
- num get m13 => JS("num", "#.m13", this);
+ num get m13 native;
- set m13(num value) {
- JS("void", "#.m13 = #", this, value);
- }
+ set m13(num value) native;
// Shadowing definition.
- num get m14 => JS("num", "#.m14", this);
+ num get m14 native;
- set m14(num value) {
- JS("void", "#.m14 = #", this, value);
- }
+ set m14(num value) native;
// Shadowing definition.
- num get m21 => JS("num", "#.m21", this);
+ num get m21 native;
- set m21(num value) {
- JS("void", "#.m21 = #", this, value);
- }
+ set m21(num value) native;
// Shadowing definition.
- num get m22 => JS("num", "#.m22", this);
+ num get m22 native;
- set m22(num value) {
- JS("void", "#.m22 = #", this, value);
- }
+ set m22(num value) native;
// Shadowing definition.
- num get m23 => JS("num", "#.m23", this);
+ num get m23 native;
- set m23(num value) {
- JS("void", "#.m23 = #", this, value);
- }
+ set m23(num value) native;
// Shadowing definition.
- num get m24 => JS("num", "#.m24", this);
+ num get m24 native;
- set m24(num value) {
- JS("void", "#.m24 = #", this, value);
- }
+ set m24(num value) native;
// Shadowing definition.
- num get m31 => JS("num", "#.m31", this);
+ num get m31 native;
- set m31(num value) {
- JS("void", "#.m31 = #", this, value);
- }
+ set m31(num value) native;
// Shadowing definition.
- num get m32 => JS("num", "#.m32", this);
+ num get m32 native;
- set m32(num value) {
- JS("void", "#.m32 = #", this, value);
- }
+ set m32(num value) native;
// Shadowing definition.
- num get m33 => JS("num", "#.m33", this);
+ num get m33 native;
- set m33(num value) {
- JS("void", "#.m33 = #", this, value);
- }
+ set m33(num value) native;
// Shadowing definition.
- num get m34 => JS("num", "#.m34", this);
+ num get m34 native;
- set m34(num value) {
- JS("void", "#.m34 = #", this, value);
- }
+ set m34(num value) native;
// Shadowing definition.
- num get m41 => JS("num", "#.m41", this);
+ num get m41 native;
- set m41(num value) {
- JS("void", "#.m41 = #", this, value);
- }
+ set m41(num value) native;
// Shadowing definition.
- num get m42 => JS("num", "#.m42", this);
+ num get m42 native;
- set m42(num value) {
- JS("void", "#.m42 = #", this, value);
- }
+ set m42(num value) native;
// Shadowing definition.
- num get m43 => JS("num", "#.m43", this);
+ num get m43 native;
- set m43(num value) {
- JS("void", "#.m43 = #", this, value);
- }
+ set m43(num value) native;
// Shadowing definition.
- num get m44 => JS("num", "#.m44", this);
+ num get m44 native;
- set m44(num value) {
- JS("void", "#.m44 = #", this, value);
- }
+ set m44(num value) native;
static DomMatrix fromFloat32Array(Float32List array32) native;
@@ -10908,53 +10985,53 @@
static DomMatrixReadOnly _create_2() =>
JS('DomMatrixReadOnly', 'new DOMMatrixReadOnly()');
- num get a => JS("num", "#.a", this);
+ num get a native;
- num get b => JS("num", "#.b", this);
+ num get b native;
- num get c => JS("num", "#.c", this);
+ num get c native;
- num get d => JS("num", "#.d", this);
+ num get d native;
- num get e => JS("num", "#.e", this);
+ num get e native;
- num get f => JS("num", "#.f", this);
+ num get f native;
- bool get is2D => JS("bool", "#.is2D", this);
+ bool get is2D native;
- bool get isIdentity => JS("bool", "#.isIdentity", this);
+ bool get isIdentity native;
- num get m11 => JS("num", "#.m11", this);
+ num get m11 native;
- num get m12 => JS("num", "#.m12", this);
+ num get m12 native;
- num get m13 => JS("num", "#.m13", this);
+ num get m13 native;
- num get m14 => JS("num", "#.m14", this);
+ num get m14 native;
- num get m21 => JS("num", "#.m21", this);
+ num get m21 native;
- num get m22 => JS("num", "#.m22", this);
+ num get m22 native;
- num get m23 => JS("num", "#.m23", this);
+ num get m23 native;
- num get m24 => JS("num", "#.m24", this);
+ num get m24 native;
- num get m31 => JS("num", "#.m31", this);
+ num get m31 native;
- num get m32 => JS("num", "#.m32", this);
+ num get m32 native;
- num get m33 => JS("num", "#.m33", this);
+ num get m33 native;
- num get m34 => JS("num", "#.m34", this);
+ num get m34 native;
- num get m41 => JS("num", "#.m41", this);
+ num get m41 native;
- num get m42 => JS("num", "#.m42", this);
+ num get m42 native;
- num get m43 => JS("num", "#.m43", this);
+ num get m43 native;
- num get m44 => JS("num", "#.m44", this);
+ num get m44 native;
DomMatrix flipX() native;
@@ -11090,35 +11167,27 @@
// Shadowing definition.
- num get w => JS("num", "#.w", this);
+ num get w native;
- set w(num value) {
- JS("void", "#.w = #", this, value);
- }
+ set w(num value) native;
// Shadowing definition.
- num get x => JS("num", "#.x", this);
+ num get x native;
- set x(num value) {
- JS("void", "#.x = #", this, value);
- }
+ set x(num value) native;
// Shadowing definition.
- num get y => JS("num", "#.y", this);
+ num get y native;
- set y(num value) {
- JS("void", "#.y = #", this, value);
- }
+ set y(num value) native;
// Shadowing definition.
- num get z => JS("num", "#.z", this);
+ num get z native;
- set z(num value) {
- JS("void", "#.z = #", this, value);
- }
+ set z(num value) native;
static DomPoint fromPoint([Map? other]) {
if (other != null) {
@@ -11170,13 +11239,13 @@
static DomPointReadOnly _create_5() =>
JS('DomPointReadOnly', 'new DOMPointReadOnly()');
- num get w => JS("num", "#.w", this);
+ num get w native;
- num get x => JS("num", "#.x", this);
+ num get x native;
- num get y => JS("num", "#.y", this);
+ num get y native;
- num get z => JS("num", "#.z", this);
+ num get z native;
static DomPointReadOnly fromPoint([Map? other]) {
if (other != null) {
@@ -11248,13 +11317,13 @@
static DomQuad _create_4(p1) => JS('DomQuad', 'new DOMQuad(#)', p1);
static DomQuad _create_5() => JS('DomQuad', 'new DOMQuad()');
- DomPoint get p1 => JS("DomPoint", "#.p1", this);
+ DomPoint get p1 native;
- DomPoint get p2 => JS("DomPoint", "#.p2", this);
+ DomPoint get p2 native;
- DomPoint get p3 => JS("DomPoint", "#.p3", this);
+ DomPoint get p3 native;
- DomPoint get p4 => JS("DomPoint", "#.p4", this);
+ DomPoint get p4 native;
static DomQuad fromQuad([Map? other]) {
if (other != null) {
@@ -11469,21 +11538,21 @@
static DomRectReadOnly _create_5() =>
JS('DomRectReadOnly', 'new DOMRectReadOnly()');
- num get bottom => JS("num", "#.bottom", this);
+ num get bottom native;
- num get height => JS("num", "#.height", this);
+ num get height native;
- num get left => JS("num", "#.left", this);
+ num get left native;
- num get right => JS("num", "#.right", this);
+ num get right native;
- num get top => JS("num", "#.top", this);
+ num get top native;
- num get width => JS("num", "#.width", this);
+ num get width native;
- num get x => JS("num", "#.x", this);
+ num get x native;
- num get y => JS("num", "#.y", this);
+ num get y native;
static DomRectReadOnly fromRect([Map? other]) {
if (other != null) {
@@ -11587,13 +11656,11 @@
throw new UnsupportedError("Not supported");
}
- int get length => JS("int", "#.length", this);
+ int get length native;
- String get value => JS("String", "#.value", this);
+ String get value native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(String value) native;
void add(String tokens) native;
@@ -12596,7 +12663,7 @@
*/
factory Element.html(String html,
{NodeValidator? validator, NodeTreeSanitizer? treeSanitizer}) {
- var fragment = document.body.createFragment(html,
+ var fragment = document.body!.createFragment(html,
validator: validator, treeSanitizer: treeSanitizer);
return fragment.nodes.where((e) => e is Element).single as Element;
@@ -12815,6 +12882,7 @@
@pragma('dart2js:tryInline')
String? getAttribute(String name) {
// Protect [name] against string conversion to "null" or "undefined".
+ assert(name != null, 'Attribute name cannot be null');
return _getAttribute(name);
}
@@ -12822,12 +12890,14 @@
String? getAttributeNS(String? namespaceURI, String name) {
// Protect [name] against string conversion to "null" or "undefined".
// [namespaceURI] does not need protecting, both `null` and `undefined` map to `null`.
+ assert(name != null, 'Attribute name cannot be null');
return _getAttributeNS(namespaceURI, name);
}
@pragma('dart2js:tryInline')
bool hasAttribute(String name) {
// Protect [name] against string conversion to "null" or "undefined".
+ assert(name != null, 'Attribute name cannot be null');
return _hasAttribute(name);
}
@@ -12835,30 +12905,37 @@
bool hasAttributeNS(String? namespaceURI, String name) {
// Protect [name] against string conversion to "null" or "undefined".
// [namespaceURI] does not need protecting, both `null` and `undefined` map to `null`.
+ assert(name != null, 'Attribute name cannot be null');
return _hasAttributeNS(namespaceURI, name);
}
@pragma('dart2js:tryInline')
void removeAttribute(String name) {
// Protect [name] against string conversion to "null" or "undefined".
+ assert(name != null, 'Attribute name cannot be null');
_removeAttribute(name);
}
@pragma('dart2js:tryInline')
void removeAttributeNS(String? namespaceURI, String name) {
// Protect [name] against string conversion to "null" or "undefined".
+ assert(name != null, 'Attribute name cannot be null');
_removeAttributeNS(namespaceURI, name);
}
@pragma('dart2js:tryInline')
void setAttribute(String name, String value) {
// Protect [name] against string conversion to "null" or "undefined".
+ assert(name != null, 'Attribute name cannot be null');
+ // TODO(sra): assert(value != null, 'Attribute value cannot be null.');
_setAttribute(name, value);
}
@pragma('dart2js:tryInline')
void setAttributeNS(String? namespaceURI, String name, String value) {
// Protect [name] against string conversion to "null" or "undefined".
+ assert(name != null, 'Attribute name cannot be null');
+ // TODO(sra): assert(value != null, 'Attribute value cannot be null.');
_setAttributeNS(namespaceURI, name, value);
}
@@ -13577,10 +13654,10 @@
var contextElement;
if (this is BodyElement) {
- contextElement = _parseDocument!.body;
+ contextElement = _parseDocument!.body!;
} else {
contextElement = _parseDocument!.createElement(tagName);
- _parseDocument!.body.append(contextElement);
+ _parseDocument!.body!.append(contextElement);
}
var fragment;
if (Range.supportsCreateContextualFragment &&
@@ -13688,10 +13765,8 @@
String get innerHtml => _innerHtml;
@JSName('innerText')
- String get innerText => JS<String>("String", "#.innerText", this);
- set innerText(String value) {
- JS("void", "#.innerText = #", this, value);
- }
+ String get innerText native;
+ set innerText(String value) native;
/**
* This is an ease-of-use accessor for event streams which should only be
@@ -13762,7 +13837,7 @@
return result;
}
- Element get offsetParent => JS("Element", "#.offsetParent", this);
+ Element get offsetParent native;
int get offsetHeight => JS<num>('num', '#.offsetHeight', this).round();
@@ -14347,17 +14422,13 @@
static const EventStreamProvider<WheelEvent> wheelEvent =
const EventStreamProvider<WheelEvent>('wheel');
- String get contentEditable => JS("String", "#.contentEditable", this);
+ String get contentEditable native;
- set contentEditable(String value) {
- JS("void", "#.contentEditable = #", this, value);
- }
+ set contentEditable(String value) native;
- String get dir => JS("String", "#.dir", this);
+ String get dir native;
- set dir(String value) {
- JS("void", "#.dir = #", this, value);
- }
+ set dir(String value) native;
/**
* Indicates whether the element can be dragged and dropped.
@@ -14373,11 +14444,9 @@
* from WHATWG.
*/
- bool get draggable => JS("bool", "#.draggable", this);
+ bool get draggable native;
- set draggable(bool value) {
- JS("void", "#.draggable = #", this, value);
- }
+ set draggable(bool value) native;
/**
* Indicates whether the element is not relevant to the page's current state.
@@ -14389,53 +14458,37 @@
* from WHATWG.
*/
- bool get hidden => JS("bool", "#.hidden", this);
+ bool get hidden native;
- set hidden(bool value) {
- JS("void", "#.hidden = #", this, value);
- }
+ set hidden(bool value) native;
- bool get inert => JS("bool", "#.inert", this);
+ bool get inert native;
- set inert(bool value) {
- JS("void", "#.inert = #", this, value);
- }
+ set inert(bool value) native;
- String get inputMode => JS("String", "#.inputMode", this);
+ String get inputMode native;
- set inputMode(String value) {
- JS("void", "#.inputMode = #", this, value);
- }
+ set inputMode(String value) native;
- // Using property as subclass shadows.
+ bool get isContentEditable native;
- bool get isContentEditable => JS("bool", "#.isContentEditable", this);
+ String get lang native;
- String get lang => JS("String", "#.lang", this);
+ set lang(String value) native;
- set lang(String value) {
- JS("void", "#.lang = #", this, value);
- }
+ bool get spellcheck native;
- bool get spellcheck => JS("bool", "#.spellcheck", this);
+ set spellcheck(bool value) native;
- set spellcheck(bool value) {
- JS("void", "#.spellcheck = #", this, value);
- }
+ CssStyleDeclaration get style native;
- CssStyleDeclaration get style => JS("CssStyleDeclaration", "#.style", this);
+ int get tabIndex native;
- int get tabIndex => JS("int", "#.tabIndex", this);
+ set tabIndex(int value) native;
- set tabIndex(int value) {
- JS("void", "#.tabIndex = #", this, value);
- }
+ String get title native;
- String get title => JS("String", "#.title", this);
-
- set title(String value) {
- JS("void", "#.title = #", this, value);
- }
+ set title(String value) native;
/**
* Specifies whether this element's text content changes when the page is
@@ -14448,11 +14501,9 @@
* from WHATWG.
*/
- bool get translate => JS("bool", "#.translate", this);
+ bool get translate native;
- set translate(bool value) {
- JS("void", "#.translate = #", this, value);
- }
+ set translate(bool value) native;
void blur() native;
@@ -14460,87 +14511,73 @@
void focus() native;
- AccessibleNode? get accessibleNode =>
- JS("AccessibleNode", "#.accessibleNode", this);
+ AccessibleNode? get accessibleNode native;
- SlotElement? get assignedSlot => JS("SlotElement", "#.assignedSlot", this);
+ SlotElement? get assignedSlot native;
@JSName('attributes')
- _NamedNodeMap get _attributes => JS("_NamedNodeMap", "#.attributes", this);
+ _NamedNodeMap get _attributes native;
- String get className => JS("String", "#.className", this);
+ String get className native;
- set className(String value) {
- JS("void", "#.className = #", this, value);
- }
+ set className(String value) native;
- int get clientHeight => JS("int", "#.clientHeight", this);
+ int get clientHeight native;
- int get clientLeft => JS("int", "#.clientLeft", this);
+ int get clientLeft native;
- int get clientTop => JS("int", "#.clientTop", this);
+ int get clientTop native;
- int get clientWidth => JS("int", "#.clientWidth", this);
+ int get clientWidth native;
- String? get computedName => JS("String", "#.computedName", this);
+ String? get computedName native;
- String? get computedRole => JS("String", "#.computedRole", this);
+ String? get computedRole native;
- String get id => JS("String", "#.id", this);
+ String get id native;
- set id(String value) {
- JS("void", "#.id = #", this, value);
- }
+ set id(String value) native;
@JSName('innerHTML')
- String get _innerHtml => JS("String", "#.innerHTML", this);
+ String get _innerHtml native;
@JSName('innerHTML')
- set _innerHtml(String value) {
- JS("void", "#.innerHTML = #", this, value);
- }
+ set _innerHtml(String value) native;
@JSName('localName')
- String get _localName => JS("String", "#.localName", this);
+ String get _localName native;
@JSName('namespaceURI')
- String? get _namespaceUri => JS("String", "#.namespaceURI", this);
+ String? get _namespaceUri native;
- // Using property as subclass shadows.
-
- String get outerHtml => JS("String", "#.outerHTML", this);
+ @JSName('outerHTML')
+ String get outerHtml native;
@JSName('scrollHeight')
- int get _scrollHeight => JS("int", "#.scrollHeight", this);
+ int get _scrollHeight native;
@JSName('scrollLeft')
- num get _scrollLeft => JS("num", "#.scrollLeft", this);
+ num get _scrollLeft native;
@JSName('scrollLeft')
- set _scrollLeft(num value) {
- JS("void", "#.scrollLeft = #", this, value);
- }
+ set _scrollLeft(num value) native;
@JSName('scrollTop')
- num get _scrollTop => JS("num", "#.scrollTop", this);
+ num get _scrollTop native;
@JSName('scrollTop')
- set _scrollTop(num value) {
- JS("void", "#.scrollTop = #", this, value);
- }
+ set _scrollTop(num value) native;
@JSName('scrollWidth')
- int get _scrollWidth => JS("int", "#.scrollWidth", this);
+ int get _scrollWidth native;
- String get slot => JS("String", "#.slot", this);
+ String get slot native;
- set slot(String value) {
- JS("void", "#.slot = #", this, value);
- }
+ set slot(String value) native;
- StylePropertyMap get styleMap => JS("StylePropertyMap", "#.styleMap", this);
+ StylePropertyMap get styleMap native;
- String get tagName => JS("String", "#.tagName", this);
+ String get tagName native;
ShadowRoot attachShadow(Map shadowRootInitDict) {
var shadowRootInitDict_1 =
@@ -14755,27 +14792,25 @@
// From NonDocumentTypeChildNode
- Element? get nextElementSibling =>
- JS("Element", "#.nextElementSibling", this);
+ Element? get nextElementSibling native;
- Element? get previousElementSibling =>
- JS("Element", "#.previousElementSibling", this);
+ Element? get previousElementSibling native;
// From ParentNode
@JSName('childElementCount')
- int get _childElementCount => JS("int", "#.childElementCount", this);
+ int get _childElementCount native;
@JSName('children')
@Returns('HtmlCollection')
@Creates('HtmlCollection')
- List<Node> get _children => JS("HtmlCollection", "#.children", this);
+ List<Node> get _children native;
@JSName('firstElementChild')
- Element? get _firstElementChild => JS("Element", "#.firstElementChild", this);
+ Element? get _firstElementChild native;
@JSName('lastElementChild')
- Element? get _lastElementChild => JS("Element", "#.lastElementChild", this);
+ Element? get _lastElementChild native;
/**
* Finds the first descendant element of this element that matches the
@@ -15164,35 +15199,25 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('embed');
- String get height => JS("String", "#.height", this);
+ String get height native;
- set height(String value) {
- JS("void", "#.height = #", this, value);
- }
+ set height(String value) native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- String get src => JS("String", "#.src", this);
+ String get src native;
- set src(String value) {
- JS("void", "#.src = #", this, value);
- }
+ set src(String value) native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
- String get width => JS("String", "#.width", this);
+ String get width native;
- set width(String value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(String value) native;
Node __getter__(String name) native;
@@ -15216,15 +15241,15 @@
throw new UnsupportedError("Not supported");
}
- FileSystem get filesystem => JS("FileSystem", "#.filesystem", this);
+ FileSystem get filesystem native;
- String get fullPath => JS("String", "#.fullPath", this);
+ String get fullPath native;
- bool get isDirectory => JS("bool", "#.isDirectory", this);
+ bool get isDirectory native;
- bool get isFile => JS("bool", "#.isFile", this);
+ bool get isFile native;
- String get name => JS("String", "#.name", this);
+ String get name native;
@JSName('copyTo')
void _copyTo(DirectoryEntry parent,
@@ -15348,16 +15373,16 @@
static ErrorEvent _create_2(type) =>
JS('ErrorEvent', 'new ErrorEvent(#)', type);
- int get colno => JS("int", "#.colno", this);
+ int get colno native;
@Creates('Null')
- Object? get error => JS("Object", "#.error", this);
+ Object? get error native;
- String get filename => JS("String", "#.filename", this);
+ String get filename native;
- int get lineno => JS("int", "#.lineno", this);
+ int get lineno native;
- String get message => JS("String", "#.message", this);
+ String get message native;
}
// 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
@@ -15394,7 +15419,8 @@
}
/** The CSS selector involved with event delegation. */
- String? _selector;
+ String? get _selector native;
+ set _selector(String? value) native;
/**
* A pointer to the element whose CSS selector matched within which an event
@@ -15461,34 +15487,34 @@
*/
static const int CAPTURING_PHASE = 1;
- bool get bubbles => JS("bool", "#.bubbles", this);
+ bool get bubbles native;
- bool get cancelable => JS("bool", "#.cancelable", this);
+ bool get cancelable native;
- bool get composed => JS("bool", "#.composed", this);
+ bool get composed native;
EventTarget? get currentTarget =>
_convertNativeToDart_EventTarget(this._get_currentTarget);
@JSName('currentTarget')
@Creates('Null')
@Returns('EventTarget|=Object|Null')
- dynamic get _get_currentTarget => JS("", "#.currentTarget", this);
+ dynamic get _get_currentTarget native;
- bool get defaultPrevented => JS("bool", "#.defaultPrevented", this);
+ bool get defaultPrevented native;
- int get eventPhase => JS("int", "#.eventPhase", this);
+ int get eventPhase native;
- bool get isTrusted => JS("bool", "#.isTrusted", this);
+ bool get isTrusted native;
EventTarget? get target => _convertNativeToDart_EventTarget(this._get_target);
@JSName('target')
@Creates('Node')
@Returns('EventTarget|=Object')
- dynamic get _get_target => JS("", "#.target", this);
+ dynamic get _get_target native;
- num get timeStamp => JS("num", "#.timeStamp", this);
+ num get timeStamp native;
- String get type => JS("String", "#.type", this);
+ String get type native;
List<EventTarget> composedPath() native;
@@ -15566,11 +15592,11 @@
static const int OPEN = 1;
- int get readyState => JS("int", "#.readyState", this);
+ int get readyState native;
- String get url => JS("String", "#.url", this);
+ String get url native;
- bool get withCredentials => JS("bool", "#.withCredentials", this);
+ bool get withCredentials native;
void close() native;
@@ -15755,17 +15781,17 @@
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- Object? get data => JS("Object", "#.data", this);
+ Object? get data native;
- String get lastEventId => JS("String", "#.lastEventId", this);
+ String get lastEventId native;
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
- List<MessagePort> get ports => JS("List<MessagePort>", "#.ports", this);
+ List<MessagePort> get ports native;
@Creates('Client|ServiceWorker|MessagePort')
@Returns('Client|ServiceWorker|MessagePort|Null')
- Object? get source => JS("Object", "#.source", this);
+ Object? get source native;
}
// 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
@@ -15826,16 +15852,16 @@
static FederatedCredential _create_1(data) =>
JS('FederatedCredential', 'new FederatedCredential(#)', data);
- String? get protocol => JS("String", "#.protocol", this);
+ String? get protocol native;
- String get provider => JS("String", "#.provider", this);
+ String get provider native;
// From CredentialUserData
@JSName('iconURL')
- String get iconUrl => JS("String", "#.iconURL", this);
+ String get iconUrl native;
- String get name => JS("String", "#.name", this);
+ String get name native;
}
// 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
@@ -15855,14 +15881,14 @@
static FetchEvent _create_1(type, eventInitDict) =>
JS('FetchEvent', 'new FetchEvent(#,#)', type, eventInitDict);
- String? get clientId => JS("String", "#.clientId", this);
+ String? get clientId native;
- bool get isReload => JS("bool", "#.isReload", this);
+ bool get isReload native;
Future get preloadResponse =>
promiseToFuture(JS("", "#.preloadResponse", this));
- _Request get request => JS("_Request", "#.request", this);
+ _Request get request native;
void respondWith(Future r) native;
}
@@ -15890,31 +15916,27 @@
*/
FieldSetElement.created() : super.created();
- bool get disabled => JS("bool", "#.disabled", this);
+ bool get disabled native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ set disabled(bool value) native;
@Returns('HtmlCollection')
@Creates('HtmlCollection')
- List<Node> get elements => JS("HtmlCollection", "#.elements", this);
+ List<Node> get elements native;
- FormElement? get form => JS("FormElement", "#.form", this);
+ FormElement? get form native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- String get validationMessage => JS("String", "#.validationMessage", this);
+ String get validationMessage native;
- ValidityState get validity => JS("ValidityState", "#.validity", this);
+ ValidityState get validity native;
- bool get willValidate => JS("bool", "#.willValidate", this);
+ bool get willValidate native;
bool checkValidity() native;
@@ -15945,20 +15967,20 @@
static File _create_2(fileBits, fileName) =>
JS('File', 'new File(#,#)', fileBits, fileName);
- int get lastModified => JS("int", "#.lastModified", this);
+ int get lastModified native;
DateTime get lastModifiedDate =>
convertNativeToDart_DateTime(this._get_lastModifiedDate);
@JSName('lastModifiedDate')
@Creates('Null')
- dynamic get _get_lastModifiedDate => JS("", "#.lastModifiedDate", this);
+ dynamic get _get_lastModifiedDate native;
- String get name => JS("String", "#.name", this);
+ String get name native;
@JSName('webkitRelativePath')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- String get relativePath => JS("String", "#.webkitRelativePath", this);
+ String get relativePath native;
}
// 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
@@ -16154,9 +16176,9 @@
static const int LOADING = 1;
- DomException? get error => JS("DomException", "#.error", this);
+ DomException? get error native;
- int get readyState => JS("int", "#.readyState", this);
+ int get readyState native;
void abort() native;
@@ -16200,9 +16222,9 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.webkitRequestFileSystem)');
- String get name => JS("String", "#.name", this);
+ String get name native;
- DirectoryEntry get root => JS("DirectoryEntry", "#.root", this);
+ DirectoryEntry get root native;
}
// 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
@@ -16282,13 +16304,13 @@
static const int WRITING = 1;
- DomException? get error => JS("DomException", "#.error", this);
+ DomException? get error native;
- int get length => JS("int", "#.length", this);
+ int get length native;
- int get position => JS("int", "#.position", this);
+ int get position native;
- int get readyState => JS("int", "#.readyState", this);
+ int get readyState native;
void abort() native;
@@ -16350,7 +16372,7 @@
_convertNativeToDart_EventTarget(this._get_relatedTarget);
@JSName('relatedTarget')
@Creates('Null')
- dynamic get _get_relatedTarget => JS("", "#.relatedTarget", this);
+ dynamic get _get_relatedTarget native;
}
// 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
@@ -16375,58 +16397,42 @@
static FontFace _create_2(family, source) =>
JS('FontFace', 'new FontFace(#,#)', family, source);
- String get display => JS("String", "#.display", this);
+ String get display native;
- set display(String value) {
- JS("void", "#.display = #", this, value);
- }
+ set display(String value) native;
- String get family => JS("String", "#.family", this);
+ String get family native;
- set family(String value) {
- JS("void", "#.family = #", this, value);
- }
+ set family(String value) native;
- String get featureSettings => JS("String", "#.featureSettings", this);
+ String get featureSettings native;
- set featureSettings(String value) {
- JS("void", "#.featureSettings = #", this, value);
- }
+ set featureSettings(String value) native;
Future<FontFace> get loaded =>
promiseToFuture<FontFace>(JS("", "#.loaded", this));
- String get status => JS("String", "#.status", this);
+ String get status native;
- String get stretch => JS("String", "#.stretch", this);
+ String get stretch native;
- set stretch(String value) {
- JS("void", "#.stretch = #", this, value);
- }
+ set stretch(String value) native;
- String get style => JS("String", "#.style", this);
+ String get style native;
- set style(String value) {
- JS("void", "#.style = #", this, value);
- }
+ set style(String value) native;
- String get unicodeRange => JS("String", "#.unicodeRange", this);
+ String get unicodeRange native;
- set unicodeRange(String value) {
- JS("void", "#.unicodeRange = #", this, value);
- }
+ set unicodeRange(String value) native;
- String get variant => JS("String", "#.variant", this);
+ String get variant native;
- set variant(String value) {
- JS("void", "#.variant = #", this, value);
- }
+ set variant(String value) native;
- String get weight => JS("String", "#.weight", this);
+ String get weight native;
- set weight(String value) {
- JS("void", "#.weight = #", this, value);
- }
+ set weight(String value) native;
Future<FontFace> load() =>
promiseToFuture<FontFace>(JS("", "#.load()", this));
@@ -16451,7 +16457,7 @@
static const EventStreamProvider<FontFaceSetLoadEvent> loadingErrorEvent =
const EventStreamProvider<FontFaceSetLoadEvent>('loadingerror');
- String get status => JS("String", "#.status", this);
+ String get status native;
FontFaceSet add(FontFace arg) native;
@@ -16499,7 +16505,7 @@
static FontFaceSetLoadEvent _create_2(type) =>
JS('FontFaceSetLoadEvent', 'new FontFaceSetLoadEvent(#)', type);
- List<FontFace> get fontfaces => JS("List<FontFace>", "#.fontfaces", this);
+ List<FontFace> get fontfaces native;
}
// 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
@@ -16512,7 +16518,7 @@
throw new UnsupportedError("Not supported");
}
- FontFaceSet get fonts => JS("FontFaceSet", "#.fonts", this);
+ FontFaceSet get fonts native;
}
// 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
@@ -16532,9 +16538,9 @@
static ForeignFetchEvent _create_1(type, eventInitDict) => JS(
'ForeignFetchEvent', 'new ForeignFetchEvent(#,#)', type, eventInitDict);
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
- _Request get request => JS("_Request", "#.request", this);
+ _Request get request native;
void respondWith(Future r) native;
}
@@ -16603,61 +16609,43 @@
*/
FormElement.created() : super.created();
- String get acceptCharset => JS("String", "#.acceptCharset", this);
+ String get acceptCharset native;
- set acceptCharset(String value) {
- JS("void", "#.acceptCharset = #", this, value);
- }
+ set acceptCharset(String value) native;
- String get action => JS("String", "#.action", this);
+ String get action native;
- set action(String value) {
- JS("void", "#.action = #", this, value);
- }
+ set action(String value) native;
- String get autocomplete => JS("String", "#.autocomplete", this);
+ String get autocomplete native;
- set autocomplete(String value) {
- JS("void", "#.autocomplete = #", this, value);
- }
+ set autocomplete(String value) native;
- String get encoding => JS("String", "#.encoding", this);
+ String get encoding native;
- set encoding(String value) {
- JS("void", "#.encoding = #", this, value);
- }
+ set encoding(String value) native;
- String get enctype => JS("String", "#.enctype", this);
+ String get enctype native;
- set enctype(String value) {
- JS("void", "#.enctype = #", this, value);
- }
+ set enctype(String value) native;
- int get length => JS("int", "#.length", this);
+ int get length native;
- String get method => JS("String", "#.method", this);
+ String get method native;
- set method(String value) {
- JS("void", "#.method = #", this, value);
- }
+ set method(String value) native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- bool get noValidate => JS("bool", "#.noValidate", this);
+ bool get noValidate native;
- set noValidate(bool value) {
- JS("void", "#.noValidate = #", this, value);
- }
+ set noValidate(bool value) native;
- String get target => JS("String", "#.target", this);
+ String get target native;
- set target(String value) {
- JS("void", "#.target = #", this, value);
- }
+ set target(String value) native;
Object? __getter__(String name) native;
@@ -16705,28 +16693,27 @@
throw new UnsupportedError("Not supported");
}
- List<num> get axes => JS("List<num>", "#.axes", this);
+ List<num> get axes native;
@Creates('JSExtendableArray|GamepadButton')
@Returns('JSExtendableArray')
- List<GamepadButton> get buttons =>
- JS("List<GamepadButton>", "#.buttons", this);
+ List<GamepadButton> get buttons native;
- bool get connected => JS("bool", "#.connected", this);
+ bool get connected native;
- int get displayId => JS("int", "#.displayId", this);
+ int get displayId native;
- String get hand => JS("String", "#.hand", this);
+ String get hand native;
- String get id => JS("String", "#.id", this);
+ String get id native;
- int get index => JS("int", "#.index", this);
+ int get index native;
- String get mapping => JS("String", "#.mapping", this);
+ String get mapping native;
- GamepadPose? get pose => JS("GamepadPose", "#.pose", this);
+ GamepadPose? get pose native;
- int get timestamp => JS("int", "#.timestamp", this);
+ int get timestamp native;
}
// 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
@@ -16739,11 +16726,11 @@
throw new UnsupportedError("Not supported");
}
- bool get pressed => JS("bool", "#.pressed", this);
+ bool get pressed native;
- bool get touched => JS("bool", "#.touched", this);
+ bool get touched native;
- num get value => JS("num", "#.value", this);
+ num get value native;
}
// 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
@@ -16768,7 +16755,7 @@
static GamepadEvent _create_2(type) =>
JS('GamepadEvent', 'new GamepadEvent(#)', type);
- Gamepad get gamepad => JS("Gamepad", "#.gamepad", this);
+ Gamepad get gamepad native;
}
// 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
@@ -16781,25 +16768,21 @@
throw new UnsupportedError("Not supported");
}
- Float32List? get angularAcceleration =>
- JS("Float32List", "#.angularAcceleration", this);
+ Float32List? get angularAcceleration native;
- Float32List? get angularVelocity =>
- JS("Float32List", "#.angularVelocity", this);
+ Float32List? get angularVelocity native;
- bool get hasOrientation => JS("bool", "#.hasOrientation", this);
+ bool get hasOrientation native;
- bool get hasPosition => JS("bool", "#.hasPosition", this);
+ bool get hasPosition native;
- Float32List? get linearAcceleration =>
- JS("Float32List", "#.linearAcceleration", this);
+ Float32List? get linearAcceleration native;
- Float32List? get linearVelocity =>
- JS("Float32List", "#.linearVelocity", this);
+ Float32List? get linearVelocity native;
- Float32List? get orientation => JS("Float32List", "#.orientation", this);
+ Float32List? get orientation native;
- Float32List? get position => JS("Float32List", "#.position", this);
+ Float32List? get position native;
}
// 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
@@ -16959,9 +16942,9 @@
throw new UnsupportedError("Not supported");
}
- Coordinates get coords => JS("Coordinates", "#.coords", this);
+ Coordinates get coords native;
- int get timestamp => JS("int", "#.timestamp", this);
+ int get timestamp native;
}
// 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
@@ -17292,11 +17275,11 @@
JS('Gyroscope', 'new Gyroscope(#)', sensorOptions);
static Gyroscope _create_2() => JS('Gyroscope', 'new Gyroscope()');
- num? get x => JS("num", "#.x", this);
+ num? get x native;
- num? get y => JS("num", "#.y", this);
+ num? get y native;
- num? get z => JS("num", "#.z", this);
+ num? get z native;
}
// 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
@@ -17324,11 +17307,9 @@
*/
HRElement.created() : super.created();
- String get color => JS("String", "#.color", this);
+ String get color native;
- set color(String value) {
- JS("void", "#.color = #", this, value);
- }
+ set color(String value) native;
}
// 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
@@ -17373,10 +17354,10 @@
static bool get supported => Device.isEventTypeSupported('HashChangeEvent');
@JSName('newURL')
- String get newUrl => JS("String", "#.newURL", this);
+ String get newUrl native;
@JSName('oldURL')
- String get oldUrl => JS("String", "#.oldURL", this);
+ String get oldUrl native;
}
// 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
@@ -17495,20 +17476,18 @@
throw new UnsupportedError("Not supported");
}
- int get length => JS("int", "#.length", this);
+ int get length native;
- String get scrollRestoration => JS("String", "#.scrollRestoration", this);
+ String get scrollRestoration native;
- set scrollRestoration(String value) {
- JS("void", "#.scrollRestoration = #", this, value);
- }
+ set scrollRestoration(String value) native;
dynamic get state =>
convertNativeToDart_SerializedScriptValue(this._get_state);
@JSName('state')
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- dynamic get _get_state => JS("", "#.state", this);
+ dynamic get _get_state native;
void back() native;
@@ -17625,7 +17604,8 @@
throw new UnsupportedError("Not supported");
}
- BodyElement body;
+ BodyElement? get body native;
+ set body(BodyElement? value) native;
/// UNSTABLE: Chrome-only - create a Range from the given point.
@Unstable()
@@ -17818,67 +17798,47 @@
throw new UnsupportedError("Not supported");
}
- String get hash => JS("String", "#.hash", this);
+ String get hash native;
- set hash(String value) {
- JS("void", "#.hash = #", this, value);
- }
+ set hash(String value) native;
- String get host => JS("String", "#.host", this);
+ String get host native;
- set host(String value) {
- JS("void", "#.host = #", this, value);
- }
+ set host(String value) native;
- String get hostname => JS("String", "#.hostname", this);
+ String get hostname native;
- set hostname(String value) {
- JS("void", "#.hostname = #", this, value);
- }
+ set hostname(String value) native;
- String get href => JS("String", "#.href", this);
+ String get href native;
- set href(String value) {
- JS("void", "#.href = #", this, value);
- }
+ set href(String value) native;
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
- String get password => JS("String", "#.password", this);
+ String get password native;
- set password(String value) {
- JS("void", "#.password = #", this, value);
- }
+ set password(String value) native;
- String get pathname => JS("String", "#.pathname", this);
+ String get pathname native;
- set pathname(String value) {
- JS("void", "#.pathname = #", this, value);
- }
+ set pathname(String value) native;
- String get port => JS("String", "#.port", this);
+ String get port native;
- set port(String value) {
- JS("void", "#.port = #", this, value);
- }
+ set port(String value) native;
- String get protocol => JS("String", "#.protocol", this);
+ String get protocol native;
- set protocol(String value) {
- JS("void", "#.protocol = #", this, value);
- }
+ set protocol(String value) native;
- String get search => JS("String", "#.search", this);
+ String get search native;
- set search(String value) {
- JS("void", "#.search = #", this, value);
- }
+ set search(String value) native;
- String get username => JS("String", "#.username", this);
+ String get username native;
- set username(String value) {
- JS("void", "#.username = #", this, value);
- }
+ set username(String value) native;
}
// 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
@@ -18366,7 +18326,7 @@
* </table>
*/
- int get readyState => JS("int", "#.readyState", this);
+ int get readyState native;
/**
* The data received as a reponse from the request.
@@ -18394,13 +18354,13 @@
@SupportedBrowser(SupportedBrowser.SAFARI)
@Creates(
'NativeByteBuffer|Blob|Document|=Object|JSExtendableArray|String|num')
- dynamic get _get_response => JS("", "#.response", this);
+ dynamic get _get_response native;
/**
* The response in String form or empty String on failure.
*/
- String get responseText => JS("String", "#.responseText", this);
+ String get responseText native;
/**
* [String] telling the server the desired response format.
@@ -18414,14 +18374,12 @@
* responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype)
*/
- String get responseType => JS("String", "#.responseType", this);
+ String get responseType native;
- set responseType(String value) {
- JS("void", "#.responseType = #", this, value);
- }
+ set responseType(String value) native;
@JSName('responseURL')
- String get responseUrl => JS("String", "#.responseURL", this);
+ String get responseUrl native;
@JSName('responseXML')
@@ -18433,21 +18391,21 @@
* synchronous.
*/
- Document? get responseXml => JS("Document", "#.responseXML", this);
+ Document? get responseXml native;
/**
* The HTTP result code from the request (200, 404, etc).
* See also: [HTTP Status Codes](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
*/
- int get status => JS("int", "#.status", this);
+ int get status native;
/**
* The request response string (such as \"OK\").
* See also: [HTTP Status Codes](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
*/
- String get statusText => JS("String", "#.statusText", this);
+ String get statusText native;
/**
* Length of time in milliseconds before a request is automatically
@@ -18465,18 +18423,16 @@
* from W3C.
*/
- int get timeout => JS("int", "#.timeout", this);
+ int get timeout native;
- set timeout(int value) {
- JS("void", "#.timeout = #", this, value);
- }
+ set timeout(int value) native;
/**
* [EventTarget] that can hold listeners to track the progress of the request.
* The events fired will be members of [HttpRequestUploadEvents].
*/
@Unstable()
- HttpRequestUpload get upload => JS("HttpRequestUpload", "#.upload", this);
+ HttpRequestUpload get upload native;
/**
* True if cross-site requests should use credentials such as cookies
@@ -18485,11 +18441,9 @@
* This value is ignored for same-site requests.
*/
- bool get withCredentials => JS("bool", "#.withCredentials", this);
+ bool get withCredentials native;
- set withCredentials(bool value) {
- JS("void", "#.withCredentials = #", this, value);
- }
+ set withCredentials(bool value) native;
/**
* Stop the current request.
@@ -18714,74 +18668,54 @@
*/
IFrameElement.created() : super.created();
- String get allow => JS("String", "#.allow", this);
+ String get allow native;
- set allow(String value) {
- JS("void", "#.allow = #", this, value);
- }
+ set allow(String value) native;
- bool get allowFullscreen => JS("bool", "#.allowFullscreen", this);
+ bool get allowFullscreen native;
- set allowFullscreen(bool value) {
- JS("void", "#.allowFullscreen = #", this, value);
- }
+ set allowFullscreen(bool value) native;
- bool get allowPaymentRequest => JS("bool", "#.allowPaymentRequest", this);
+ bool get allowPaymentRequest native;
- set allowPaymentRequest(bool value) {
- JS("void", "#.allowPaymentRequest = #", this, value);
- }
+ set allowPaymentRequest(bool value) native;
WindowBase? get contentWindow =>
_convertNativeToDart_Window(this._get_contentWindow);
@JSName('contentWindow')
@Creates('Window|=Object')
@Returns('Window|=Object')
- dynamic get _get_contentWindow => JS("", "#.contentWindow", this);
+ dynamic get _get_contentWindow native;
- String get csp => JS("String", "#.csp", this);
+ String get csp native;
- set csp(String value) {
- JS("void", "#.csp = #", this, value);
- }
+ set csp(String value) native;
- String get height => JS("String", "#.height", this);
+ String get height native;
- set height(String value) {
- JS("void", "#.height = #", this, value);
- }
+ set height(String value) native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- String get referrerPolicy => JS("String", "#.referrerPolicy", this);
+ String get referrerPolicy native;
- set referrerPolicy(String value) {
- JS("void", "#.referrerPolicy = #", this, value);
- }
+ set referrerPolicy(String value) native;
- DomTokenList get sandbox => JS("DomTokenList", "#.sandbox", this);
+ DomTokenList get sandbox native;
- String get src => JS("String", "#.src", this);
+ String get src native;
- set src(String value) {
- JS("void", "#.src = #", this, value);
- }
+ set src(String value) native;
- String get srcdoc => JS("String", "#.srcdoc", this);
+ String get srcdoc native;
- set srcdoc(String value) {
- JS("void", "#.srcdoc = #", this, value);
- }
+ set srcdoc(String value) native;
- String get width => JS("String", "#.width", this);
+ String get width native;
- set width(String value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(String value) native;
}
// 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
@@ -18794,7 +18728,7 @@
throw new UnsupportedError("Not supported");
}
- bool get didTimeout => JS("bool", "#.didTimeout", this);
+ bool get didTimeout native;
double timeRemaining() native;
}
@@ -18816,9 +18750,9 @@
throw new UnsupportedError("Not supported");
}
- int get height => JS("int", "#.height", this);
+ int get height native;
- int get width => JS("int", "#.width", this);
+ int get width native;
void close() native;
}
@@ -18833,7 +18767,7 @@
throw new UnsupportedError("Not supported");
}
- CanvasElement get canvas => JS("CanvasElement", "#.canvas", this);
+ CanvasElement get canvas native;
void transferFromImageBitmap(ImageBitmap? bitmap) native;
}
@@ -18854,7 +18788,7 @@
static ImageCapture _create_1(track) =>
JS('ImageCapture', 'new ImageCapture(#)', track);
- MediaStreamTrack get track => JS("MediaStreamTrack", "#.track", this);
+ MediaStreamTrack get track native;
Future<PhotoCapabilities> getPhotoCapabilities() =>
promiseToFuture<PhotoCapabilities>(
@@ -18912,11 +18846,11 @@
@Creates('NativeUint8ClampedList')
@Returns('NativeUint8ClampedList')
- Uint8ClampedList get data => JS("Uint8ClampedList", "#.data", this);
+ Uint8ClampedList get data native;
- int get height => JS("int", "#.height", this);
+ int get height native;
- int get width => JS("int", "#.width", this);
+ int get width native;
}
// 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
@@ -18947,75 +18881,57 @@
*/
ImageElement.created() : super.created();
- String get alt => JS("String", "#.alt", this);
+ String get alt native;
- set alt(String value) {
- JS("void", "#.alt = #", this, value);
- }
+ set alt(String value) native;
- String get async => JS("String", "#.async", this);
+ String get async native;
- set async(String value) {
- JS("void", "#.async = #", this, value);
- }
+ set async(String value) native;
- bool get complete => JS("bool", "#.complete", this);
+ bool get complete native;
- String? crossOrigin;
+ String? get crossOrigin native;
- String get currentSrc => JS("String", "#.currentSrc", this);
+ set crossOrigin(String? value) native;
- int get height => JS("int", "#.height", this);
+ String get currentSrc native;
- set height(int value) {
- JS("void", "#.height = #", this, value);
- }
+ int get height native;
- bool get isMap => JS("bool", "#.isMap", this);
+ set height(int value) native;
- set isMap(bool value) {
- JS("void", "#.isMap = #", this, value);
- }
+ bool get isMap native;
- int get naturalHeight => JS("int", "#.naturalHeight", this);
+ set isMap(bool value) native;
- int get naturalWidth => JS("int", "#.naturalWidth", this);
+ int get naturalHeight native;
- String get referrerPolicy => JS("String", "#.referrerPolicy", this);
+ int get naturalWidth native;
- set referrerPolicy(String value) {
- JS("void", "#.referrerPolicy = #", this, value);
- }
+ String get referrerPolicy native;
- String get sizes => JS("String", "#.sizes", this);
+ set referrerPolicy(String value) native;
- set sizes(String value) {
- JS("void", "#.sizes = #", this, value);
- }
+ String get sizes native;
- String get src => JS("String", "#.src", this);
+ set sizes(String value) native;
- set src(String value) {
- JS("void", "#.src = #", this, value);
- }
+ String get src native;
- String get srcset => JS("String", "#.srcset", this);
+ set src(String value) native;
- set srcset(String value) {
- JS("void", "#.srcset = #", this, value);
- }
+ String get srcset native;
- String get useMap => JS("String", "#.useMap", this);
+ set srcset(String value) native;
- set useMap(String value) {
- JS("void", "#.useMap = #", this, value);
- }
+ String get useMap native;
- int get width => JS("int", "#.width", this);
+ set useMap(String value) native;
- set width(int value) {
- JS("void", "#.width = #", this, value);
- }
+ int get width native;
+
+ set width(int value) native;
Future decode() => promiseToFuture(JS("", "#.decode()", this));
}
@@ -19044,7 +18960,7 @@
static InputDeviceCapabilities _create_2() =>
JS('InputDeviceCapabilities', 'new InputDeviceCapabilities()');
- bool get firesTouchEvents => JS("bool", "#.firesTouchEvents", this);
+ bool get firesTouchEvents native;
}
// 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
@@ -19096,237 +19012,177 @@
*/
InputElement.created() : super.created();
- String get accept => JS("String", "#.accept", this);
+ String get accept native;
- set accept(String value) {
- JS("void", "#.accept = #", this, value);
- }
+ set accept(String value) native;
- String get alt => JS("String", "#.alt", this);
+ String get alt native;
- set alt(String value) {
- JS("void", "#.alt = #", this, value);
- }
+ set alt(String value) native;
- String get autocapitalize => JS("String", "#.autocapitalize", this);
+ String get autocapitalize native;
- set autocapitalize(String value) {
- JS("void", "#.autocapitalize = #", this, value);
- }
+ set autocapitalize(String value) native;
- String get autocomplete => JS("String", "#.autocomplete", this);
+ String get autocomplete native;
- set autocomplete(String value) {
- JS("void", "#.autocomplete = #", this, value);
- }
+ set autocomplete(String value) native;
- bool get autofocus => JS("bool", "#.autofocus", this);
+ bool get autofocus native;
- set autofocus(bool value) {
- JS("void", "#.autofocus = #", this, value);
- }
+ set autofocus(bool value) native;
- String get capture => JS("String", "#.capture", this);
+ String get capture native;
- set capture(String value) {
- JS("void", "#.capture = #", this, value);
- }
+ set capture(String value) native;
- bool get checked => JS("bool", "#.checked", this);
+ bool get checked native;
- set checked(bool value) {
- JS("void", "#.checked = #", this, value);
- }
+ set checked(bool value) native;
- bool get defaultChecked => JS("bool", "#.defaultChecked", this);
+ bool get defaultChecked native;
- set defaultChecked(bool value) {
- JS("void", "#.defaultChecked = #", this, value);
- }
+ set defaultChecked(bool value) native;
- String get defaultValue => JS("String", "#.defaultValue", this);
+ String get defaultValue native;
- set defaultValue(String value) {
- JS("void", "#.defaultValue = #", this, value);
- }
+ set defaultValue(String value) native;
- String get dirName => JS("String", "#.dirName", this);
+ String get dirName native;
- set dirName(String value) {
- JS("void", "#.dirName = #", this, value);
- }
+ set dirName(String value) native;
- bool get disabled => JS("bool", "#.disabled", this);
+ bool get disabled native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ set disabled(bool value) native;
@Returns('FileList|Null')
@Creates('FileList')
- List<File>? files;
+ List<File>? get files native;
- FormElement? get form => JS("FormElement", "#.form", this);
+ set files(List<File>? value) native;
- String get formAction => JS("String", "#.formAction", this);
+ FormElement? get form native;
- set formAction(String value) {
- JS("void", "#.formAction = #", this, value);
- }
+ String get formAction native;
- String get formEnctype => JS("String", "#.formEnctype", this);
+ set formAction(String value) native;
- set formEnctype(String value) {
- JS("void", "#.formEnctype = #", this, value);
- }
+ String get formEnctype native;
- String get formMethod => JS("String", "#.formMethod", this);
+ set formEnctype(String value) native;
- set formMethod(String value) {
- JS("void", "#.formMethod = #", this, value);
- }
+ String get formMethod native;
- bool get formNoValidate => JS("bool", "#.formNoValidate", this);
+ set formMethod(String value) native;
- set formNoValidate(bool value) {
- JS("void", "#.formNoValidate = #", this, value);
- }
+ bool get formNoValidate native;
- String get formTarget => JS("String", "#.formTarget", this);
+ set formNoValidate(bool value) native;
- set formTarget(String value) {
- JS("void", "#.formTarget = #", this, value);
- }
+ String get formTarget native;
- int get height => JS("int", "#.height", this);
+ set formTarget(String value) native;
- set height(int value) {
- JS("void", "#.height = #", this, value);
- }
+ int get height native;
- bool get incremental => JS("bool", "#.incremental", this);
+ set height(int value) native;
- set incremental(bool value) {
- JS("void", "#.incremental = #", this, value);
- }
+ bool get incremental native;
- bool get indeterminate => JS("bool", "#.indeterminate", this);
+ set incremental(bool value) native;
- set indeterminate(bool value) {
- JS("void", "#.indeterminate = #", this, value);
- }
+ bool get indeterminate native;
+
+ set indeterminate(bool value) native;
@Returns('NodeList')
@Creates('NodeList')
- List<Node> get labels => JS("NodeList", "#.labels", this);
+ List<Node> get labels native;
- HtmlElement? get list => JS("HtmlElement", "#.list", this);
+ HtmlElement? get list native;
- String get max => JS("String", "#.max", this);
+ String get max native;
- set max(String value) {
- JS("void", "#.max = #", this, value);
- }
+ set max(String value) native;
- int get maxLength => JS("int", "#.maxLength", this);
+ int get maxLength native;
- set maxLength(int value) {
- JS("void", "#.maxLength = #", this, value);
- }
+ set maxLength(int value) native;
- String get min => JS("String", "#.min", this);
+ String get min native;
- set min(String value) {
- JS("void", "#.min = #", this, value);
- }
+ set min(String value) native;
- int get minLength => JS("int", "#.minLength", this);
+ int get minLength native;
- set minLength(int value) {
- JS("void", "#.minLength = #", this, value);
- }
+ set minLength(int value) native;
- bool get multiple => JS("bool", "#.multiple", this);
+ bool get multiple native;
- set multiple(bool value) {
- JS("void", "#.multiple = #", this, value);
- }
+ set multiple(bool value) native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- String get pattern => JS("String", "#.pattern", this);
+ String get pattern native;
- set pattern(String value) {
- JS("void", "#.pattern = #", this, value);
- }
+ set pattern(String value) native;
- String get placeholder => JS("String", "#.placeholder", this);
+ String get placeholder native;
- set placeholder(String value) {
- JS("void", "#.placeholder = #", this, value);
- }
+ set placeholder(String value) native;
- bool get readOnly => JS("bool", "#.readOnly", this);
+ bool get readOnly native;
- set readOnly(bool value) {
- JS("void", "#.readOnly = #", this, value);
- }
+ set readOnly(bool value) native;
- bool get required => JS("bool", "#.required", this);
+ bool get required native;
- set required(bool value) {
- JS("void", "#.required = #", this, value);
- }
+ set required(bool value) native;
- String? selectionDirection;
+ String? get selectionDirection native;
- int? selectionEnd;
+ set selectionDirection(String? value) native;
- int? selectionStart;
+ int? get selectionEnd native;
- int get size => JS("int", "#.size", this);
+ set selectionEnd(int? value) native;
- set size(int value) {
- JS("void", "#.size = #", this, value);
- }
+ int? get selectionStart native;
- String get src => JS("String", "#.src", this);
+ set selectionStart(int? value) native;
- set src(String value) {
- JS("void", "#.src = #", this, value);
- }
+ int get size native;
- String get step => JS("String", "#.step", this);
+ set size(int value) native;
- set step(String value) {
- JS("void", "#.step = #", this, value);
- }
+ String get src native;
- String get type => JS("String", "#.type", this);
+ set src(String value) native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ String get step native;
- String get validationMessage => JS("String", "#.validationMessage", this);
+ set step(String value) native;
- ValidityState get validity => JS("ValidityState", "#.validity", this);
+ String get type native;
- String get value => JS("String", "#.value", this);
+ set type(String value) native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ String get validationMessage native;
+
+ ValidityState get validity native;
+
+ String get value native;
+
+ set value(String value) native;
DateTime get valueAsDate =>
convertNativeToDart_DateTime(this._get_valueAsDate);
@JSName('valueAsDate')
@Creates('Null')
- dynamic get _get_valueAsDate => JS("", "#.valueAsDate", this);
+ dynamic get _get_valueAsDate native;
set valueAsDate(DateTime? value) {
this._set_valueAsDate = convertDartToNative_DateTime(value!);
@@ -19336,34 +19192,28 @@
JS("void", "#.valueAsDate = #", this, value);
}
- num get valueAsNumber => JS("num", "#.valueAsNumber", this);
+ num get valueAsNumber native;
- set valueAsNumber(num value) {
- JS("void", "#.valueAsNumber = #", this, value);
- }
+ set valueAsNumber(num value) native;
@JSName('webkitEntries')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- List<Entry> get entries => JS("List<Entry>", "#.webkitEntries", this);
+ List<Entry> get entries native;
@JSName('webkitdirectory')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- bool get directory => JS("bool", "#.webkitdirectory", this);
+ bool get directory native;
@JSName('webkitdirectory')
- set directory(bool value) {
- JS("void", "#.webkitdirectory = #", this, value);
- }
+ set directory(bool value) native;
- int get width => JS("int", "#.width", this);
+ int get width native;
- set width(int value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(int value) native;
- bool get willValidate => JS("bool", "#.willValidate", this);
+ bool get willValidate native;
bool checkValidity() native;
@@ -19391,8 +19241,6 @@
* Exposes the functionality common between all InputElement types.
*/
abstract class InputElementBase implements Element {
- // These fields here and below are overridden by generated code and therefore
- // can't be nullable. Opted to translate these fields to getters/setters.
bool get autofocus;
set autofocus(bool value);
@@ -19458,11 +19306,14 @@
void select();
- String? selectionDirection;
+ String? get selectionDirection;
+ set selectionDirection(String? value);
- int? selectionEnd;
+ int? get selectionEnd;
+ set selectionEnd(int? value);
- int? selectionStart;
+ int? get selectionStart;
+ set selectionStart(int? value);
void setSelectionRange(int start, int end, [String? direction]);
}
@@ -19480,7 +19331,8 @@
abstract class SearchInputElement implements TextInputElementBase {
factory SearchInputElement() => new InputElement(type: 'search');
- String dirName;
+ String get dirName;
+ set dirName(String value);
Element? get list;
@@ -19496,7 +19348,8 @@
abstract class TextInputElement implements TextInputElementBase {
factory TextInputElement() => new InputElement(type: 'text');
- String dirName;
+ String get dirName;
+ set dirName(String value);
Element? get list;
}
@@ -19556,25 +19409,34 @@
abstract class EmailInputElement implements TextInputElementBase {
factory EmailInputElement() => new InputElement(type: 'email');
- String autocomplete;
+ String get autocomplete;
+ set autocomplete(String value);
- bool autofocus;
+ bool get autofocus;
+ set autofocus(bool value);
Element? get list;
- int maxLength;
+ int get maxLength;
+ set maxLength(int value);
- bool multiple;
+ bool get multiple;
+ set multiple(bool value);
- String pattern;
+ String get pattern;
+ set pattern(String value);
- String placeholder;
+ String get placeholder;
+ set placeholder(String value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
- int size;
+ int get size;
+ set size(int value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -19621,11 +19483,14 @@
abstract class DateInputElement implements RangeInputElementBase {
factory DateInputElement() => new InputElement(type: 'date');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -19642,11 +19507,14 @@
abstract class MonthInputElement implements RangeInputElementBase {
factory MonthInputElement() => new InputElement(type: 'month');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -19663,11 +19531,14 @@
abstract class WeekInputElement implements RangeInputElementBase {
factory WeekInputElement() => new InputElement(type: 'week');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -19684,11 +19555,14 @@
abstract class TimeInputElement implements RangeInputElementBase {
factory TimeInputElement() => new InputElement(type: 'time');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -19707,9 +19581,11 @@
factory LocalDateTimeInputElement() =>
new InputElement(type: 'datetime-local');
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -19726,11 +19602,14 @@
abstract class NumberInputElement implements RangeInputElementBase {
factory NumberInputElement() => new InputElement(type: 'number');
- String placeholder;
+ String get placeholder;
+ set placeholder(String value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -19764,9 +19643,11 @@
abstract class CheckboxInputElement implements InputElementBase {
factory CheckboxInputElement() => new InputElement(type: 'checkbox');
- bool checked;
+ bool get checked;
+ set checked(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
}
/**
@@ -19783,9 +19664,11 @@
abstract class RadioButtonInputElement implements InputElementBase {
factory RadioButtonInputElement() => new InputElement(type: 'radio');
- bool checked;
+ bool get checked;
+ set checked(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
}
/**
@@ -19794,11 +19677,14 @@
abstract class FileUploadInputElement implements InputElementBase {
factory FileUploadInputElement() => new InputElement(type: 'file');
- String accept;
+ String get accept;
+ set accept(String value);
- bool multiple;
+ bool get multiple;
+ set multiple(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
List<File>? files;
}
@@ -19809,15 +19695,20 @@
abstract class SubmitButtonInputElement implements InputElementBase {
factory SubmitButtonInputElement() => new InputElement(type: 'submit');
- String formAction;
+ String get formAction;
+ set formAction(String value);
- String formEnctype;
+ String get formEnctype;
+ set formEnctype(String value);
- String formMethod;
+ String get formMethod;
+ set formMethod(String value);
- bool formNoValidate;
+ bool get formNoValidate;
+ set formNoValidate(bool value);
- String formTarget;
+ String get formTarget;
+ set formTarget(String value);
}
/**
@@ -19827,23 +19718,32 @@
abstract class ImageButtonInputElement implements InputElementBase {
factory ImageButtonInputElement() => new InputElement(type: 'image');
- String alt;
+ String get alt;
+ set alt(String value);
- String formAction;
+ String get formAction;
+ set formAction(String value);
- String formEnctype;
+ String get formEnctype;
+ set formEnctype(String value);
- String formMethod;
+ String get formMethod;
+ set formMethod(String value);
- bool formNoValidate;
+ bool get formNoValidate;
+ set formNoValidate(bool value);
- String formTarget;
+ String get formTarget;
+ set formTarget(String value);
- int height;
+ int get height;
+ set height(int value);
- String src;
+ String get src;
+ set src(String value);
- int width;
+ int get width;
+ set width(int value);
}
/**
@@ -19920,11 +19820,11 @@
static IntersectionObserver _create_2(callback) =>
JS('IntersectionObserver', 'new IntersectionObserver(#)', callback);
- Element? get root => JS("Element", "#.root", this);
+ Element? get root native;
- String get rootMargin => JS("String", "#.rootMargin", this);
+ String get rootMargin native;
- List<num> get thresholds => JS("List<num>", "#.thresholds", this);
+ List<num> get thresholds native;
void disconnect() native;
@@ -19953,22 +19853,19 @@
throw new UnsupportedError("Not supported");
}
- DomRectReadOnly get boundingClientRect =>
- JS("DomRectReadOnly", "#.boundingClientRect", this);
+ DomRectReadOnly get boundingClientRect native;
- num get intersectionRatio => JS("num", "#.intersectionRatio", this);
+ num get intersectionRatio native;
- DomRectReadOnly get intersectionRect =>
- JS("DomRectReadOnly", "#.intersectionRect", this);
+ DomRectReadOnly get intersectionRect native;
- bool get isIntersecting => JS("bool", "#.isIntersecting", this);
+ bool get isIntersecting native;
- DomRectReadOnly? get rootBounds =>
- JS("DomRectReadOnly", "#.rootBounds", this);
+ DomRectReadOnly? get rootBounds native;
- Element get target => JS("Element", "#.target", this);
+ Element get target native;
- num get time => JS("num", "#.time", this);
+ num get time native;
}
// 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
@@ -19981,11 +19878,11 @@
throw new UnsupportedError("Not supported");
}
- int get lineNumber => JS("int", "#.lineNumber", this);
+ int get lineNumber native;
- String get message => JS("String", "#.message", this);
+ String get message native;
- String get sourceFile => JS("String", "#.sourceFile", this);
+ String get sourceFile native;
}
// 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
@@ -20069,9 +19966,9 @@
}
}
- final int keyCode;
+ int get keyCode native;
- final int charCode;
+ int get charCode native;
int get which => _which;
@@ -20095,29 +19992,29 @@
static const int DOM_KEY_LOCATION_STANDARD = 0x00;
- bool get altKey => JS("bool", "#.altKey", this);
+ bool get altKey native;
@JSName('charCode')
- int get _charCode => JS("int", "#.charCode", this);
+ int get _charCode native;
- String get code => JS("String", "#.code", this);
+ String get code native;
- bool get ctrlKey => JS("bool", "#.ctrlKey", this);
+ bool get ctrlKey native;
- bool get isComposing => JS("bool", "#.isComposing", this);
+ bool get isComposing native;
- String get key => JS("String", "#.key", this);
+ String get key native;
@JSName('keyCode')
- int get _keyCode => JS("int", "#.keyCode", this);
+ int get _keyCode native;
- int get location => JS("int", "#.location", this);
+ int get location native;
- bool get metaKey => JS("bool", "#.metaKey", this);
+ bool get metaKey native;
- bool get repeat => JS("bool", "#.repeat", this);
+ bool get repeat native;
- bool get shiftKey => JS("bool", "#.shiftKey", this);
+ bool get shiftKey native;
bool getModifierState(String keyArg) native;
}
@@ -20196,11 +20093,9 @@
*/
LIElement.created() : super.created();
- int get value => JS("int", "#.value", this);
+ int get value native;
- set value(int value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(int value) native;
}
// 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
@@ -20225,15 +20120,13 @@
*/
LabelElement.created() : super.created();
- HtmlElement? get control => JS("HtmlElement", "#.control", this);
+ HtmlElement? get control native;
- FormElement? get form => JS("FormElement", "#.form", this);
+ FormElement? get form native;
- String get htmlFor => JS("String", "#.htmlFor", this);
+ String get htmlFor native;
- set htmlFor(String value) {
- JS("void", "#.htmlFor = #", this, value);
- }
+ set htmlFor(String value) native;
}
// 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
@@ -20258,7 +20151,7 @@
*/
LegendElement.created() : super.created();
- FormElement? get form => JS("FormElement", "#.form", this);
+ FormElement? get form native;
}
// 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
@@ -20308,75 +20201,57 @@
*/
LinkElement.created() : super.created();
- String get as => JS("String", "#.as", this);
+ String get as native;
- set as(String value) {
- JS("void", "#.as = #", this, value);
- }
+ set as(String value) native;
- String? crossOrigin;
+ String? get crossOrigin native;
- bool get disabled => JS("bool", "#.disabled", this);
+ set crossOrigin(String? value) native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ bool get disabled native;
- String get href => JS("String", "#.href", this);
+ set disabled(bool value) native;
- set href(String value) {
- JS("void", "#.href = #", this, value);
- }
+ String get href native;
- String get hreflang => JS("String", "#.hreflang", this);
+ set href(String value) native;
- set hreflang(String value) {
- JS("void", "#.hreflang = #", this, value);
- }
+ String get hreflang native;
- Document? get import => JS("Document", "#.import", this);
+ set hreflang(String value) native;
- String get integrity => JS("String", "#.integrity", this);
+ Document? get import native;
- set integrity(String value) {
- JS("void", "#.integrity = #", this, value);
- }
+ String get integrity native;
- String get media => JS("String", "#.media", this);
+ set integrity(String value) native;
- set media(String value) {
- JS("void", "#.media = #", this, value);
- }
+ String get media native;
- String get referrerPolicy => JS("String", "#.referrerPolicy", this);
+ set media(String value) native;
- set referrerPolicy(String value) {
- JS("void", "#.referrerPolicy = #", this, value);
- }
+ String get referrerPolicy native;
- String get rel => JS("String", "#.rel", this);
+ set referrerPolicy(String value) native;
- set rel(String value) {
- JS("void", "#.rel = #", this, value);
- }
+ String get rel native;
- DomTokenList get relList => JS("DomTokenList", "#.relList", this);
+ set rel(String value) native;
- String get scope => JS("String", "#.scope", this);
+ DomTokenList get relList native;
- set scope(String value) {
- JS("void", "#.scope = #", this, value);
- }
+ String get scope native;
- StyleSheet? get sheet => JS("StyleSheet", "#.sheet", this);
+ set scope(String value) native;
- DomTokenList get sizes => JS("DomTokenList", "#.sizes", this);
+ StyleSheet? get sheet native;
- String get type => JS("String", "#.type", this);
+ DomTokenList get sizes native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ String get type native;
+
+ set type(String value) native;
/// Checks if HTML imports are supported on the current platform.
bool get supportsImport {
@@ -20396,62 +20271,43 @@
@Returns('DomStringList')
@Creates('DomStringList')
- List<String> get ancestorOrigins =>
- JS("DomStringList", "#.ancestorOrigins", this);
+ List<String> get ancestorOrigins native;
- String get hash => JS("String", "#.hash", this);
+ String get hash native;
- set hash(String value) {
- JS("void", "#.hash = #", this, value);
- }
+ set hash(String value) native;
- String get host => JS("String", "#.host", this);
+ String get host native;
- set host(String value) {
- JS("void", "#.host = #", this, value);
- }
+ set host(String value) native;
- String get hostname => JS("String", "#.hostname", this);
+ String get hostname native;
- set hostname(String value) {
- JS("void", "#.hostname = #", this, value);
- }
+ set hostname(String value) native;
- String get href => JS("String", "#.href", this);
+ String get href native;
- set href(String value) {
- JS("void", "#.href = #", this, value);
- }
+ set href(String value) native;
- String get pathname => JS("String", "#.pathname", this);
+ String get pathname native;
- set pathname(String value) {
- JS("void", "#.pathname = #", this, value);
- }
+ set pathname(String value) native;
- String get port => JS("String", "#.port", this);
+ String get port native;
- set port(String value) {
- JS("void", "#.port = #", this, value);
- }
+ set port(String value) native;
- String get protocol => JS("String", "#.protocol", this);
+ String get protocol native;
- set protocol(String value) {
- JS("void", "#.protocol = #", this, value);
- }
+ set protocol(String value) native;
- String get search => JS("String", "#.search", this);
+ String get search native;
- set search(String value) {
- JS("void", "#.search = #", this, value);
- }
+ set search(String value) native;
- TrustedUrl get trustedHref => JS("TrustedUrl", "#.trustedHref", this);
+ TrustedUrl get trustedHref native;
- set trustedHref(TrustedUrl value) {
- JS("void", "#.trustedHref = #", this, value);
- }
+ set trustedHref(TrustedUrl value) native;
void assign([String? url]) native;
@@ -20490,11 +20346,11 @@
JS('Magnetometer', 'new Magnetometer(#)', sensorOptions);
static Magnetometer _create_2() => JS('Magnetometer', 'new Magnetometer()');
- num? get x => JS("num", "#.x", this);
+ num? get x native;
- num? get y => JS("num", "#.y", this);
+ num? get y native;
- num? get z => JS("num", "#.z", this);
+ num? get z native;
}
// 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
@@ -20521,13 +20377,11 @@
@Returns('HtmlCollection')
@Creates('HtmlCollection')
- List<Node> get areas => JS("HtmlCollection", "#.areas", this);
+ List<Node> get areas native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
}
// 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
@@ -20563,11 +20417,11 @@
throw new UnsupportedError("Not supported");
}
- bool get powerEfficient => JS("bool", "#.powerEfficient", this);
+ bool get powerEfficient native;
- bool get smooth => JS("bool", "#.smooth", this);
+ bool get smooth native;
- bool get supported => JS("bool", "#.supported", this);
+ bool get supported native;
}
// 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
@@ -20580,13 +20434,13 @@
throw new UnsupportedError("Not supported");
}
- String get deviceId => JS("String", "#.deviceId", this);
+ String get deviceId native;
- String get groupId => JS("String", "#.groupId", this);
+ String get groupId native;
- String get kind => JS("String", "#.kind", this);
+ String get kind native;
- String get label => JS("String", "#.label", this);
+ String get label native;
}
// 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
@@ -20645,133 +20499,107 @@
static const int NETWORK_NO_SOURCE = 3;
- AudioTrackList get audioTracks => JS("AudioTrackList", "#.audioTracks", this);
+ AudioTrackList get audioTracks native;
- bool get autoplay => JS("bool", "#.autoplay", this);
+ bool get autoplay native;
- set autoplay(bool value) {
- JS("void", "#.autoplay = #", this, value);
- }
+ set autoplay(bool value) native;
- TimeRanges get buffered => JS("TimeRanges", "#.buffered", this);
+ TimeRanges get buffered native;
- bool get controls => JS("bool", "#.controls", this);
+ bool get controls native;
- set controls(bool value) {
- JS("void", "#.controls = #", this, value);
- }
+ set controls(bool value) native;
- DomTokenList get controlsList => JS("DomTokenList", "#.controlsList", this);
+ DomTokenList get controlsList native;
- String? crossOrigin;
+ String? get crossOrigin native;
- String get currentSrc => JS("String", "#.currentSrc", this);
+ set crossOrigin(String? value) native;
- num get currentTime => JS("num", "#.currentTime", this);
+ String get currentSrc native;
- set currentTime(num value) {
- JS("void", "#.currentTime = #", this, value);
- }
+ num get currentTime native;
- bool get defaultMuted => JS("bool", "#.defaultMuted", this);
+ set currentTime(num value) native;
- set defaultMuted(bool value) {
- JS("void", "#.defaultMuted = #", this, value);
- }
+ bool get defaultMuted native;
- num get defaultPlaybackRate => JS("num", "#.defaultPlaybackRate", this);
+ set defaultMuted(bool value) native;
- set defaultPlaybackRate(num value) {
- JS("void", "#.defaultPlaybackRate = #", this, value);
- }
+ num get defaultPlaybackRate native;
- bool get disableRemotePlayback => JS("bool", "#.disableRemotePlayback", this);
+ set defaultPlaybackRate(num value) native;
- set disableRemotePlayback(bool value) {
- JS("void", "#.disableRemotePlayback = #", this, value);
- }
+ bool get disableRemotePlayback native;
- num get duration => JS("num", "#.duration", this);
+ set disableRemotePlayback(bool value) native;
- bool get ended => JS("bool", "#.ended", this);
+ num get duration native;
- MediaError? get error => JS("MediaError", "#.error", this);
+ bool get ended native;
- bool get loop => JS("bool", "#.loop", this);
+ MediaError? get error native;
- set loop(bool value) {
- JS("void", "#.loop = #", this, value);
- }
+ bool get loop native;
- MediaKeys get mediaKeys => JS("MediaKeys", "#.mediaKeys", this);
+ set loop(bool value) native;
- bool get muted => JS("bool", "#.muted", this);
+ MediaKeys get mediaKeys native;
- set muted(bool value) {
- JS("void", "#.muted = #", this, value);
- }
+ bool get muted native;
- int get networkState => JS("int", "#.networkState", this);
+ set muted(bool value) native;
- bool get paused => JS("bool", "#.paused", this);
+ int get networkState native;
- num get playbackRate => JS("num", "#.playbackRate", this);
+ bool get paused native;
- set playbackRate(num value) {
- JS("void", "#.playbackRate = #", this, value);
- }
+ num get playbackRate native;
- TimeRanges get played => JS("TimeRanges", "#.played", this);
+ set playbackRate(num value) native;
- String get preload => JS("String", "#.preload", this);
+ TimeRanges get played native;
- set preload(String value) {
- JS("void", "#.preload = #", this, value);
- }
+ String get preload native;
- int get readyState => JS("int", "#.readyState", this);
+ set preload(String value) native;
- RemotePlayback get remote => JS("RemotePlayback", "#.remote", this);
+ int get readyState native;
- TimeRanges get seekable => JS("TimeRanges", "#.seekable", this);
+ RemotePlayback get remote native;
- bool get seeking => JS("bool", "#.seeking", this);
+ TimeRanges get seekable native;
- String get sinkId => JS("String", "#.sinkId", this);
+ bool get seeking native;
- String get src => JS("String", "#.src", this);
+ String get sinkId native;
- set src(String value) {
- JS("void", "#.src = #", this, value);
- }
+ String get src native;
- MediaStream get srcObject => JS("MediaStream", "#.srcObject", this);
+ set src(String value) native;
- set srcObject(MediaStream value) {
- JS("void", "#.srcObject = #", this, value);
- }
+ MediaStream get srcObject native;
- TextTrackList get textTracks => JS("TextTrackList", "#.textTracks", this);
+ set srcObject(MediaStream value) native;
- VideoTrackList get videoTracks => JS("VideoTrackList", "#.videoTracks", this);
+ TextTrackList get textTracks native;
- num get volume => JS("num", "#.volume", this);
+ VideoTrackList get videoTracks native;
- set volume(num value) {
- JS("void", "#.volume = #", this, value);
- }
+ num get volume native;
+
+ set volume(num value) native;
@JSName('webkitAudioDecodedByteCount')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- int get audioDecodedByteCount =>
- JS("int", "#.webkitAudioDecodedByteCount", this);
+ int get audioDecodedByteCount native;
@JSName('webkitVideoDecodedByteCount')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- int get videoDecodedByteCount =>
- JS("int", "#.webkitVideoDecodedByteCount", this);
+ int get videoDecodedByteCount native;
TextTrack addTextTrack(String kind, [String? label, String? language]) native;
@@ -20818,9 +20646,9 @@
static MediaEncryptedEvent _create_2(type) =>
JS('MediaEncryptedEvent', 'new MediaEncryptedEvent(#)', type);
- ByteBuffer? get initData => JS("ByteBuffer", "#.initData", this);
+ ByteBuffer? get initData native;
- String get initDataType => JS("String", "#.initDataType", this);
+ String get initDataType native;
}
// 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
@@ -20842,9 +20670,9 @@
static const int MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
- int get code => JS("int", "#.code", this);
+ int get code native;
- String get message => JS("String", "#.message", this);
+ String get message native;
}
// 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
@@ -20867,9 +20695,9 @@
type,
eventInitDict);
- ByteBuffer get message => JS("ByteBuffer", "#.message", this);
+ ByteBuffer get message native;
- String get messageType => JS("String", "#.messageType", this);
+ String get messageType native;
}
// 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
@@ -20887,12 +20715,11 @@
Future<void> get closed => promiseToFuture<void>(JS("", "#.closed", this));
- num get expiration => JS("num", "#.expiration", this);
+ num get expiration native;
- MediaKeyStatusMap get keyStatuses =>
- JS("MediaKeyStatusMap", "#.keyStatuses", this);
+ MediaKeyStatusMap get keyStatuses native;
- String get sessionId => JS("String", "#.sessionId", this);
+ String get sessionId native;
Future close() => promiseToFuture(JS("", "#.close()", this));
@@ -20921,7 +20748,7 @@
throw new UnsupportedError("Not supported");
}
- int get size => JS("int", "#.size", this);
+ int get size native;
Object? get(/*BufferSource*/ keyId) native;
@@ -20938,7 +20765,7 @@
throw new UnsupportedError("Not supported");
}
- String get keySystem => JS("String", "#.keySystem", this);
+ String get keySystem native;
Future createMediaKeys() =>
promiseToFuture(JS("", "#.createMediaKeys()", this));
@@ -20989,7 +20816,7 @@
static MediaKeysPolicy _create_1(init) =>
JS('MediaKeysPolicy', 'new MediaKeysPolicy(#)', init);
- String get minHdcpVersion => JS("String", "#.minHdcpVersion", this);
+ String get minHdcpVersion native;
}
// 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
@@ -21003,9 +20830,11 @@
throw new UnsupportedError("Not supported");
}
- int get length => JS("int", "#.length", this);
+ int get length native;
- String? mediaText;
+ String? get mediaText native;
+
+ set mediaText(String? value) native;
void appendMedium(String medium) native;
@@ -21036,29 +20865,21 @@
static MediaMetadata _create_2() =>
JS('MediaMetadata', 'new MediaMetadata()');
- String get album => JS("String", "#.album", this);
+ String get album native;
- set album(String value) {
- JS("void", "#.album = #", this, value);
- }
+ set album(String value) native;
- String get artist => JS("String", "#.artist", this);
+ String get artist native;
- set artist(String value) {
- JS("void", "#.artist = #", this, value);
- }
+ set artist(String value) native;
- List get artwork => JS("List", "#.artwork", this);
+ List get artwork native;
- set artwork(List value) {
- JS("void", "#.artwork = #", this, value);
- }
+ set artwork(List value) native;
- String get title => JS("String", "#.title", this);
+ String get title native;
- set title(String value) {
- JS("void", "#.title = #", this, value);
- }
+ set title(String value) native;
}
// 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
@@ -21075,9 +20896,9 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- bool get matches => JS("bool", "#.matches", this);
+ bool get matches native;
- String get media => JS("String", "#.media", this);
+ String get media native;
void addListener(EventListener? listener) native;
@@ -21111,9 +20932,9 @@
static MediaQueryListEvent _create_2(type) =>
JS('MediaQueryListEvent', 'new MediaQueryListEvent(#)', type);
- bool get matches => JS("bool", "#.matches", this);
+ bool get matches native;
- String get media => JS("String", "#.media", this);
+ String get media native;
}
// 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
@@ -21144,15 +20965,15 @@
static MediaRecorder _create_2(stream) =>
JS('MediaRecorder', 'new MediaRecorder(#)', stream);
- int get audioBitsPerSecond => JS("int", "#.audioBitsPerSecond", this);
+ int get audioBitsPerSecond native;
- String get mimeType => JS("String", "#.mimeType", this);
+ String get mimeType native;
- String get state => JS("String", "#.state", this);
+ String get state native;
- MediaStream get stream => JS("MediaStream", "#.stream", this);
+ MediaStream get stream native;
- int get videoBitsPerSecond => JS("int", "#.videoBitsPerSecond", this);
+ int get videoBitsPerSecond native;
static bool isTypeSupported(String type) native;
@@ -21181,13 +21002,13 @@
throw new UnsupportedError("Not supported");
}
- MediaMetadata? metadata;
+ MediaMetadata? get metadata native;
- String get playbackState => JS("String", "#.playbackState", this);
+ set metadata(MediaMetadata? value) native;
- set playbackState(String value) {
- JS("void", "#.playbackState = #", this, value);
- }
+ String get playbackState native;
+
+ set playbackState(String value) native;
void setActionHandler(String action, MediaSessionActionHandler? handler)
native;
@@ -21210,11 +21031,11 @@
throw new UnsupportedError("Not supported");
}
- num get max => JS("num", "#.max", this);
+ num get max native;
- num get min => JS("num", "#.min", this);
+ num get min native;
- num get step => JS("num", "#.step", this);
+ num get step native;
}
// 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
@@ -21237,19 +21058,15 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.MediaSource)');
- SourceBufferList get activeSourceBuffers =>
- JS("SourceBufferList", "#.activeSourceBuffers", this);
+ SourceBufferList get activeSourceBuffers native;
- num get duration => JS("num", "#.duration", this);
+ num get duration native;
- set duration(num value) {
- JS("void", "#.duration = #", this, value);
- }
+ set duration(num value) native;
- String get readyState => JS("String", "#.readyState", this);
+ String get readyState native;
- SourceBufferList get sourceBuffers =>
- JS("SourceBufferList", "#.sourceBuffers", this);
+ SourceBufferList get sourceBuffers native;
SourceBuffer addSourceBuffer(String type) native;
@@ -21311,9 +21128,9 @@
static MediaStream _create_3(stream_OR_tracks) =>
JS('MediaStream', 'new MediaStream(#)', stream_OR_tracks);
- bool get active => JS("bool", "#.active", this);
+ bool get active native;
- String get id => JS("String", "#.id", this);
+ String get id native;
void addTrack(MediaStreamTrack track) native;
@@ -21382,7 +21199,7 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Device.isEventTypeSupported('MediaStreamEvent');
- MediaStream? get stream => JS("MediaStream", "#.stream", this);
+ MediaStream? get stream native;
}
// 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
@@ -21423,27 +21240,23 @@
static const EventStreamProvider<Event> unmuteEvent =
const EventStreamProvider<Event>('unmute');
- String get contentHint => JS("String", "#.contentHint", this);
+ String get contentHint native;
- set contentHint(String value) {
- JS("void", "#.contentHint = #", this, value);
- }
+ set contentHint(String value) native;
- bool get enabled => JS("bool", "#.enabled", this);
+ bool get enabled native;
- set enabled(bool value) {
- JS("void", "#.enabled = #", this, value);
- }
+ set enabled(bool value) native;
- String get id => JS("String", "#.id", this);
+ String get id native;
- String get kind => JS("String", "#.kind", this);
+ String get kind native;
- String get label => JS("String", "#.label", this);
+ String get label native;
- bool get muted => JS("bool", "#.muted", this);
+ bool get muted native;
- String get readyState => JS("String", "#.readyState", this);
+ String get readyState native;
Future applyConstraints([Map? constraints]) {
var constraints_dict = null;
@@ -21514,7 +21327,7 @@
static bool get supported =>
Device.isEventTypeSupported('MediaStreamTrackEvent');
- MediaStreamTrack get track => JS("MediaStreamTrack", "#.track", this);
+ MediaStreamTrack get track native;
}
// 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
@@ -21527,11 +21340,11 @@
throw new UnsupportedError("Not supported");
}
- int get jsHeapSizeLimit => JS("int", "#.jsHeapSizeLimit", this);
+ int get jsHeapSizeLimit native;
- int get totalJSHeapSize => JS("int", "#.totalJSHeapSize", this);
+ int get totalJSHeapSize native;
- int get usedJSHeapSize => JS("int", "#.usedJSHeapSize", this);
+ int get usedJSHeapSize native;
}
// 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
@@ -21591,9 +21404,9 @@
static MessageChannel _create_1() =>
JS('MessageChannel', 'new MessageChannel()');
- MessagePort get port1 => JS("MessagePort", "#.port1", this);
+ MessagePort get port1 native;
- MessagePort get port2 => JS("MessagePort", "#.port2", this);
+ MessagePort get port2 native;
}
// 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
@@ -21643,7 +21456,7 @@
@JSName('data')
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final dynamic _get_data;
+ dynamic get _get_data native;
factory MessageEvent._(String type, [Map? eventInitDict]) {
if (eventInitDict != null) {
@@ -21658,21 +21471,21 @@
JS('MessageEvent', 'new MessageEvent(#)', type);
@Unstable()
- String get lastEventId => JS("String", "#.lastEventId", this);
+ String get lastEventId native;
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
@Unstable()
@Creates('JSExtendableArray')
- List<MessagePort> get ports => JS("List<MessagePort>", "#.ports", this);
+ List<MessagePort> get ports native;
EventTarget? get source => _convertNativeToDart_EventTarget(this._get_source);
@JSName('source')
@Creates('Null')
@Returns('EventTarget|=Object')
- dynamic get _get_source => JS("", "#.source", this);
+ dynamic get _get_source native;
- String get suborigin => JS("String", "#.suborigin", this);
+ String get suborigin native;
void _initMessageEvent(
String? typeArg,
@@ -21775,23 +21588,17 @@
*/
MetaElement.created() : super.created();
- String get content => JS("String", "#.content", this);
+ String get content native;
- set content(String value) {
- JS("void", "#.content = #", this, value);
- }
+ set content(String value) native;
- String get httpEquiv => JS("String", "#.httpEquiv", this);
+ String get httpEquiv native;
- set httpEquiv(String value) {
- JS("void", "#.httpEquiv = #", this, value);
- }
+ set httpEquiv(String value) native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
}
// 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
@@ -21808,9 +21615,9 @@
convertNativeToDart_DateTime(this._get_modificationTime);
@JSName('modificationTime')
@Creates('Null')
- dynamic get _get_modificationTime => JS("", "#.modificationTime", this);
+ dynamic get _get_modificationTime native;
- int get size => JS("int", "#.size", this);
+ int get size native;
}
// 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
@@ -21845,46 +21652,34 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('meter');
- num get high => JS("num", "#.high", this);
+ num get high native;
- set high(num value) {
- JS("void", "#.high = #", this, value);
- }
+ set high(num value) native;
@Unstable()
@Returns('NodeList')
@Creates('NodeList')
- List<Node> get labels => JS("NodeList", "#.labels", this);
+ List<Node> get labels native;
- num get low => JS("num", "#.low", this);
+ num get low native;
- set low(num value) {
- JS("void", "#.low = #", this, value);
- }
+ set low(num value) native;
- num get max => JS("num", "#.max", this);
+ num get max native;
- set max(num value) {
- JS("void", "#.max = #", this, value);
- }
+ set max(num value) native;
- num get min => JS("num", "#.min", this);
+ num get min native;
- set min(num value) {
- JS("void", "#.min = #", this, value);
- }
+ set min(num value) native;
- num get optimum => JS("num", "#.optimum", this);
+ num get optimum native;
- set optimum(num value) {
- JS("void", "#.optimum = #", this, value);
- }
+ set optimum(num value) native;
- num get value => JS("num", "#.value", this);
+ num get value native;
- set value(num value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(num value) native;
}
// 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
@@ -21897,11 +21692,11 @@
throw new UnsupportedError("Not supported");
}
- MidiInputMap get inputs => JS("MidiInputMap", "#.inputs", this);
+ MidiInputMap get inputs native;
- MidiOutputMap get outputs => JS("MidiOutputMap", "#.outputs", this);
+ MidiOutputMap get outputs native;
- bool get sysexEnabled => JS("bool", "#.sysexEnabled", this);
+ bool get sysexEnabled native;
}
// 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
@@ -21929,7 +21724,7 @@
static MidiConnectionEvent _create_2(type) =>
JS('MidiConnectionEvent', 'new MIDIConnectionEvent(#)', type);
- MidiPort get port => JS("MidiPort", "#.port", this);
+ MidiPort get port native;
}
// 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
@@ -22046,7 +21841,7 @@
static MidiMessageEvent _create_2(type) =>
JS('MidiMessageEvent', 'new MIDIMessageEvent(#)', type);
- Uint8List get data => JS("Uint8List", "#.data", this);
+ Uint8List get data native;
}
// 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
@@ -22140,19 +21935,19 @@
throw new UnsupportedError("Not supported");
}
- String get connection => JS("String", "#.connection", this);
+ String get connection native;
- String get id => JS("String", "#.id", this);
+ String get id native;
- String get manufacturer => JS("String", "#.manufacturer", this);
+ String get manufacturer native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- String get state => JS("String", "#.state", this);
+ String get state native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- String get version => JS("String", "#.version", this);
+ String get version native;
Future close() => promiseToFuture(JS("", "#.close()", this));
@@ -22169,13 +21964,13 @@
throw new UnsupportedError("Not supported");
}
- String get description => JS("String", "#.description", this);
+ String get description native;
- Plugin get enabledPlugin => JS("Plugin", "#.enabledPlugin", this);
+ Plugin get enabledPlugin native;
- String get suffixes => JS("String", "#.suffixes", this);
+ String get suffixes native;
- String get type => JS("String", "#.type", this);
+ String get type native;
}
// 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
@@ -22257,17 +22052,13 @@
*/
ModElement.created() : super.created();
- String get cite => JS("String", "#.cite", this);
+ String get cite native;
- set cite(String value) {
- JS("void", "#.cite = #", this, value);
- }
+ set cite(String value) native;
- String get dateTime => JS("String", "#.dateTime", this);
+ String get dateTime native;
- set dateTime(String value) {
- JS("void", "#.dateTime = #", this, value);
- }
+ set dateTime(String value) native;
}
// 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
@@ -22332,19 +22123,19 @@
static MouseEvent _create_2(type) =>
JS('MouseEvent', 'new MouseEvent(#)', type);
- bool get altKey => JS("bool", "#.altKey", this);
+ bool get altKey native;
- int get button => JS("int", "#.button", this);
+ int get button native;
- int get buttons => JS("int", "#.buttons", this);
+ int get buttons native;
@JSName('clientX')
- num get _clientX => JS("num", "#.clientX", this);
+ num get _clientX native;
@JSName('clientY')
- num get _clientY => JS("num", "#.clientY", this);
+ num get _clientY native;
- bool get ctrlKey => JS("bool", "#.ctrlKey", this);
+ bool get ctrlKey native;
/**
* The nonstandard way to access the element that the mouse comes
@@ -22354,44 +22145,44 @@
* relatedTarget to get the same information in the standard way.
*/
@deprecated
- Node get fromElement => JS("Node", "#.fromElement", this);
+ Node get fromElement native;
@JSName('layerX')
- int get _layerX => JS("int", "#.layerX", this);
+ int get _layerX native;
@JSName('layerY')
- int get _layerY => JS("int", "#.layerY", this);
+ int get _layerY native;
- bool get metaKey => JS("bool", "#.metaKey", this);
+ bool get metaKey native;
@JSName('movementX')
- int get _movementX => JS("int", "#.movementX", this);
+ int get _movementX native;
@JSName('movementY')
- int get _movementY => JS("int", "#.movementY", this);
+ int get _movementY native;
@JSName('pageX')
- num get _pageX => JS("num", "#.pageX", this);
+ num get _pageX native;
@JSName('pageY')
- num get _pageY => JS("num", "#.pageY", this);
+ num get _pageY native;
- String? get region => JS("String", "#.region", this);
+ String? get region native;
EventTarget? get relatedTarget =>
_convertNativeToDart_EventTarget(this._get_relatedTarget);
@JSName('relatedTarget')
@Creates('Node')
@Returns('EventTarget|=Object|Null')
- dynamic get _get_relatedTarget => JS("", "#.relatedTarget", this);
+ dynamic get _get_relatedTarget native;
@JSName('screenX')
- num get _screenX => JS("num", "#.screenX", this);
+ num get _screenX native;
@JSName('screenY')
- num get _screenY => JS("num", "#.screenY", this);
+ num get _screenY native;
- bool get shiftKey => JS("bool", "#.shiftKey", this);
+ bool get shiftKey native;
/**
* The nonstandard way to access the element that the mouse goes
@@ -22401,7 +22192,7 @@
* relatedTarget to get the same information in the standard way.
*/
@deprecated
- Node get toElement => JS("Node", "#.toElement", this);
+ Node get toElement native;
bool getModifierState(String keyArg) native;
@@ -22523,15 +22314,15 @@
static const int REMOVAL = 3;
- int get attrChange => JS("int", "#.attrChange", this);
+ int get attrChange native;
- String get attrName => JS("String", "#.attrName", this);
+ String get attrName native;
- String get newValue => JS("String", "#.newValue", this);
+ String get newValue native;
- String get prevValue => JS("String", "#.prevValue", this);
+ String get prevValue native;
- Node? get relatedNode => JS("Node", "#.relatedNode", this);
+ Node? get relatedNode native;
void initMutationEvent(
String? type,
@@ -22664,25 +22455,25 @@
@Returns('NodeList')
@Creates('NodeList')
- List<Node> get addedNodes => JS("NodeList", "#.addedNodes", this);
+ List<Node> get addedNodes native;
- String? get attributeName => JS("String", "#.attributeName", this);
+ String? get attributeName native;
- String? get attributeNamespace => JS("String", "#.attributeNamespace", this);
+ String? get attributeNamespace native;
- Node? get nextSibling => JS("Node", "#.nextSibling", this);
+ Node? get nextSibling native;
- String? get oldValue => JS("String", "#.oldValue", this);
+ String? get oldValue native;
- Node? get previousSibling => JS("Node", "#.previousSibling", this);
+ Node? get previousSibling native;
@Returns('NodeList')
@Creates('NodeList')
- List<Node> get removedNodes => JS("NodeList", "#.removedNodes", this);
+ List<Node> get removedNodes native;
- Node get target => JS("Node", "#.target", this);
+ Node get target native;
- String get type => JS("String", "#.type", this);
+ String get type native;
}
// 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
@@ -22803,67 +22594,61 @@
throw new UnsupportedError("Not supported");
}
- _BudgetService get budget => JS("_BudgetService", "#.budget", this);
+ _BudgetService get budget native;
- _Clipboard get clipboard => JS("_Clipboard", "#.clipboard", this);
+ _Clipboard get clipboard native;
- NetworkInformation get connection =>
- JS("NetworkInformation", "#.connection", this);
+ NetworkInformation get connection native;
- CredentialsContainer get credentials =>
- JS("CredentialsContainer", "#.credentials", this);
+ CredentialsContainer get credentials native;
- num get deviceMemory => JS("num", "#.deviceMemory", this);
+ num get deviceMemory native;
- String? get doNotTrack => JS("String", "#.doNotTrack", this);
+ String? get doNotTrack native;
@Unstable()
- Geolocation get geolocation => JS("Geolocation", "#.geolocation", this);
+ Geolocation get geolocation native;
- int get maxTouchPoints => JS("int", "#.maxTouchPoints", this);
+ int get maxTouchPoints native;
- MediaCapabilities get mediaCapabilities =>
- JS("MediaCapabilities", "#.mediaCapabilities", this);
+ MediaCapabilities get mediaCapabilities native;
- MediaDevices get mediaDevices => JS("MediaDevices", "#.mediaDevices", this);
+ MediaDevices get mediaDevices native;
- MediaSession get mediaSession => JS("MediaSession", "#.mediaSession", this);
+ MediaSession get mediaSession native;
- MimeTypeArray get mimeTypes => JS("MimeTypeArray", "#.mimeTypes", this);
+ MimeTypeArray get mimeTypes native;
- _NFC get nfc => JS("_NFC", "#.nfc", this);
+ _NFC get nfc native;
- Permissions get permissions => JS("Permissions", "#.permissions", this);
+ Permissions get permissions native;
- Presentation get presentation => JS("Presentation", "#.presentation", this);
+ Presentation get presentation native;
@Unstable()
- String get productSub => JS("String", "#.productSub", this);
+ String get productSub native;
- ServiceWorkerContainer get serviceWorker =>
- JS("ServiceWorkerContainer", "#.serviceWorker", this);
+ ServiceWorkerContainer get serviceWorker native;
- StorageManager get storage => JS("StorageManager", "#.storage", this);
+ StorageManager get storage native;
@Unstable()
- String get vendor => JS("String", "#.vendor", this);
+ String get vendor native;
@Unstable()
- String get vendorSub => JS("String", "#.vendorSub", this);
+ String get vendorSub native;
- VR get vr => JS("VR", "#.vr", this);
+ VR get vr native;
@JSName('webkitPersistentStorage')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- DeprecatedStorageQuota get persistentStorage =>
- JS("DeprecatedStorageQuota", "#.webkitPersistentStorage", this);
+ DeprecatedStorageQuota get persistentStorage native;
@JSName('webkitTemporaryStorage')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- DeprecatedStorageQuota get temporaryStorage =>
- JS("DeprecatedStorageQuota", "#.webkitTemporaryStorage", this);
+ DeprecatedStorageQuota get temporaryStorage native;
void cancelKeyboardLock() native;
@@ -22925,38 +22710,38 @@
// From NavigatorAutomationInformation
- bool get webdriver => JS("bool", "#.webdriver", this);
+ bool get webdriver native;
// From NavigatorCookies
@Unstable()
- bool get cookieEnabled => JS("bool", "#.cookieEnabled", this);
+ bool get cookieEnabled native;
// From NavigatorID
- String get appCodeName => JS("String", "#.appCodeName", this);
+ String get appCodeName native;
- String get appName => JS("String", "#.appName", this);
+ String get appName native;
- String get appVersion => JS("String", "#.appVersion", this);
+ String get appVersion native;
- bool get dartEnabled => JS("bool", "#.dartEnabled", this);
+ bool get dartEnabled native;
- String get platform => JS("String", "#.platform", this);
+ String get platform native;
@Unstable()
- String get product => JS("String", "#.product", this);
+ String get product native;
- String get userAgent => JS("String", "#.userAgent", this);
+ String get userAgent native;
// From NavigatorLanguage
- List<String> get languages => JS("List<String>", "#.languages", this);
+ List<String> get languages native;
// From NavigatorOnLine
@Unstable()
- bool get onLine => JS("bool", "#.onLine", this);
+ bool get onLine native;
}
// 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
@@ -22969,7 +22754,7 @@
throw new UnsupportedError("Not supported");
}
- bool get webdriver => JS("bool", "#.webdriver", this);
+ bool get webdriver native;
}
// 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
@@ -22982,7 +22767,7 @@
throw new UnsupportedError("Not supported");
}
- int get hardwareConcurrency => JS("int", "#.hardwareConcurrency", this);
+ int get hardwareConcurrency native;
}
// 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
@@ -22995,7 +22780,7 @@
throw new UnsupportedError("Not supported");
}
- bool get cookieEnabled => JS("bool", "#.cookieEnabled", this);
+ bool get cookieEnabled native;
}
// 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
@@ -23007,19 +22792,19 @@
throw new UnsupportedError("Not supported");
}
- String get appCodeName => JS("String", "#.appCodeName", this);
+ String get appCodeName native;
- String get appName => JS("String", "#.appName", this);
+ String get appName native;
- String get appVersion => JS("String", "#.appVersion", this);
+ String get appVersion native;
- bool get dartEnabled => JS("bool", "#.dartEnabled", this);
+ bool get dartEnabled native;
- String get platform => JS("String", "#.platform", this);
+ String get platform native;
- String get product => JS("String", "#.product", this);
+ String get product native;
- String get userAgent => JS("String", "#.userAgent", this);
+ String get userAgent native;
}
// 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
@@ -23031,9 +22816,9 @@
throw new UnsupportedError("Not supported");
}
- String get language => JS("String", "#.language", this);
+ String get language native;
- List<String> get languages => JS("List<String>", "#.languages", this);
+ List<String> get languages native;
}
// 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
@@ -23045,7 +22830,7 @@
throw new UnsupportedError("Not supported");
}
- bool get onLine => JS("bool", "#.onLine", this);
+ bool get onLine native;
}
// 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
@@ -23058,11 +22843,11 @@
throw new UnsupportedError("Not supported");
}
- String get constraintName => JS("String", "#.constraintName", this);
+ String get constraintName native;
- String get message => JS("String", "#.message", this);
+ String get message native;
- String get name => JS("String", "#.name", this);
+ String get name native;
}
// 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
@@ -23092,15 +22877,15 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- num get downlink => JS("num", "#.downlink", this);
+ num get downlink native;
- num get downlinkMax => JS("num", "#.downlinkMax", this);
+ num get downlinkMax native;
- String get effectiveType => JS("String", "#.effectiveType", this);
+ String get effectiveType native;
- int get rtt => JS("int", "#.rtt", this);
+ int get rtt native;
- String get type => JS("String", "#.type", this);
+ String get type native;
Stream<Event> get onChange => changeEvent.forTarget(this);
}
@@ -23371,7 +23156,7 @@
*/
@Returns('NodeList')
@Creates('NodeList')
- List<Node> get childNodes => JS("NodeList", "#.childNodes", this);
+ List<Node> get childNodes native;
// To suppress missing implicit constructor warnings.
factory Node._() {
@@ -23403,7 +23188,7 @@
static const int TEXT_NODE = 3;
@JSName('baseURI')
- String get baseUri => JS("String", "#.baseURI", this);
+ String get baseUri native;
/**
* The first child of this node.
@@ -23414,9 +23199,9 @@
* from MDN.
*/
- Node? get firstChild => JS("Node", "#.firstChild", this);
+ Node? get firstChild native;
- bool get isConnected => JS("bool", "#.isConnected", this);
+ bool get isConnected native;
/**
* The last child of this node.
@@ -23427,7 +23212,7 @@
* from MDN.
*/
- Node? get lastChild => JS("Node", "#.lastChild", this);
+ Node? get lastChild native;
@JSName('nextSibling')
@@ -23440,7 +23225,7 @@
* from MDN.
*/
- Node? get nextNode => JS("Node", "#.nextSibling", this);
+ Node? get nextNode native;
/**
* The name of this node.
@@ -23454,7 +23239,7 @@
* [nodeType].
*/
- String get nodeName => JS("String", "#.nodeName", this);
+ String get nodeName native;
/**
* The type of node.
@@ -23480,7 +23265,7 @@
* from MDN.
*/
- int get nodeType => JS("int", "#.nodeType", this);
+ int get nodeType native;
/**
* The value of this node.
@@ -23494,7 +23279,7 @@
* [nodeType].
*/
- String? get nodeValue => JS("String", "#.nodeValue", this);
+ String? get nodeValue native;
/**
* The document this node belongs to.
@@ -23507,7 +23292,7 @@
* from MDN.
*/
- Document? get ownerDocument => JS("Document", "#.ownerDocument", this);
+ Document? get ownerDocument native;
@JSName('parentElement')
@@ -23523,7 +23308,7 @@
* from W3C.
*/
- Element? get parent => JS("Element", "#.parentElement", this);
+ Element? get parent native;
/**
* The parent node of this node.
@@ -23534,7 +23319,7 @@
* from MDN.
*/
- Node? get parentNode => JS("Node", "#.parentNode", this);
+ Node? get parentNode native;
@JSName('previousSibling')
@@ -23547,9 +23332,10 @@
* from MDN.
*/
- Node? get previousNode => JS("Node", "#.previousSibling", this);
+ Node? get previousNode native;
@JSName('textContent')
+
/**
* All text within this node and its descendents.
*
@@ -23558,7 +23344,11 @@
* * [Node.textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent)
* from MDN.
*/
- String? text;
+
+ String? get text native;
+
+ @JSName('textContent')
+ set text(String? value) native;
@JSName('appendChild')
/**
@@ -23684,14 +23474,13 @@
throw new UnsupportedError("Not supported");
}
- bool get pointerBeforeReferenceNode =>
- JS("bool", "#.pointerBeforeReferenceNode", this);
+ bool get pointerBeforeReferenceNode native;
- Node get referenceNode => JS("Node", "#.referenceNode", this);
+ Node get referenceNode native;
- Node get root => JS("Node", "#.root", this);
+ Node get root native;
- int get whatToShow => JS("int", "#.whatToShow", this);
+ int get whatToShow native;
void detach() native;
@@ -23771,11 +23560,9 @@
throw new UnsupportedError("Not supported");
}
- Element? get nextElementSibling =>
- JS("Element", "#.nextElementSibling", this);
+ Element? get nextElementSibling native;
- Element? get previousElementSibling =>
- JS("Element", "#.previousElementSibling", this);
+ Element? get previousElementSibling native;
}
// 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
@@ -23801,11 +23588,9 @@
throw new UnsupportedError("Not supported");
}
- String get nonce => JS("String", "#.nonce", this);
+ String get nonce native;
- set nonce(String value) {
- JS("void", "#.nonce = #", this, value);
- }
+ set nonce(String value) native;
}
// 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
@@ -23880,41 +23665,41 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.Notification)');
- List get actions => JS("List", "#.actions", this);
+ List get actions native;
- String get badge => JS("String", "#.badge", this);
+ String get badge native;
- String get body => JS("String", "#.body", this);
+ String get body native;
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- Object? get data => JS("Object", "#.data", this);
+ Object? get data native;
- String get dir => JS("String", "#.dir", this);
+ String get dir native;
- String get icon => JS("String", "#.icon", this);
+ String get icon native;
- String get image => JS("String", "#.image", this);
+ String get image native;
- String get lang => JS("String", "#.lang", this);
+ String get lang native;
- int get maxActions => JS("int", "#.maxActions", this);
+ int get maxActions native;
- String get permission => JS("String", "#.permission", this);
+ String get permission native;
- bool get renotify => JS("bool", "#.renotify", this);
+ bool get renotify native;
- bool get requireInteraction => JS("bool", "#.requireInteraction", this);
+ bool get requireInteraction native;
- bool get silent => JS("bool", "#.silent", this);
+ bool get silent native;
- String get tag => JS("String", "#.tag", this);
+ String get tag native;
- int get timestamp => JS("int", "#.timestamp", this);
+ int get timestamp native;
- String get title => JS("String", "#.title", this);
+ String get title native;
- List<int> get vibrate => JS("List<int>", "#.vibrate", this);
+ List<int> get vibrate native;
void close() native;
@@ -23961,11 +23746,11 @@
static NotificationEvent _create_1(type, eventInitDict) => JS(
'NotificationEvent', 'new NotificationEvent(#,#)', type, eventInitDict);
- String get action => JS("String", "#.action", this);
+ String get action native;
- Notification get notification => JS("Notification", "#.notification", this);
+ Notification get notification native;
- String? get reply => JS("String", "#.reply", this);
+ String? get reply native;
}
// 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
@@ -23997,23 +23782,17 @@
*/
OListElement.created() : super.created();
- bool get reversed => JS("bool", "#.reversed", this);
+ bool get reversed native;
- set reversed(bool value) {
- JS("void", "#.reversed = #", this, value);
- }
+ set reversed(bool value) native;
- int get start => JS("int", "#.start", this);
+ int get start native;
- set start(int value) {
- JS("void", "#.start = #", this, value);
- }
+ set start(int value) native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
}
// 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
@@ -24046,51 +23825,39 @@
@JSName('contentWindow')
@Creates('Window|=Object')
@Returns('Window|=Object')
- dynamic get _get_contentWindow => JS("", "#.contentWindow", this);
+ dynamic get _get_contentWindow native;
- String get data => JS("String", "#.data", this);
+ String get data native;
- set data(String value) {
- JS("void", "#.data = #", this, value);
- }
+ set data(String value) native;
- FormElement? get form => JS("FormElement", "#.form", this);
+ FormElement? get form native;
- String get height => JS("String", "#.height", this);
+ String get height native;
- set height(String value) {
- JS("void", "#.height = #", this, value);
- }
+ set height(String value) native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
- String get useMap => JS("String", "#.useMap", this);
+ String get useMap native;
- set useMap(String value) {
- JS("void", "#.useMap = #", this, value);
- }
+ set useMap(String value) native;
- String get validationMessage => JS("String", "#.validationMessage", this);
+ String get validationMessage native;
- ValidityState get validity => JS("ValidityState", "#.validity", this);
+ ValidityState get validity native;
- String get width => JS("String", "#.width", this);
+ String get width native;
- set width(String value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(String value) native;
- bool get willValidate => JS("bool", "#.willValidate", this);
+ bool get willValidate native;
Node __getter__(String name) native;
@@ -24119,17 +23886,13 @@
static OffscreenCanvas _create_1(width, height) =>
JS('OffscreenCanvas', 'new OffscreenCanvas(#,#)', width, height);
- int get height => JS("int", "#.height", this);
+ int get height native;
- set height(int value) {
- JS("void", "#.height = #", this, value);
- }
+ set height(int value) native;
- int get width => JS("int", "#.width", this);
+ int get width native;
- set width(int value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(int value) native;
Future<Blob> convertToBlob([Map? options]) {
var options_dict = null;
@@ -24167,121 +23930,87 @@
throw new UnsupportedError("Not supported");
}
- OffscreenCanvas get canvas => JS("OffscreenCanvas", "#.canvas", this);
+ OffscreenCanvas get canvas native;
- String get direction => JS("String", "#.direction", this);
+ String get direction native;
- set direction(String value) {
- JS("void", "#.direction = #", this, value);
- }
+ set direction(String value) native;
- Object? fillStyle;
+ Object? get fillStyle native;
- String get filter => JS("String", "#.filter", this);
+ set fillStyle(Object? value) native;
- set filter(String value) {
- JS("void", "#.filter = #", this, value);
- }
+ String get filter native;
- String get font => JS("String", "#.font", this);
+ set filter(String value) native;
- set font(String value) {
- JS("void", "#.font = #", this, value);
- }
+ String get font native;
- num get globalAlpha => JS("num", "#.globalAlpha", this);
+ set font(String value) native;
- set globalAlpha(num value) {
- JS("void", "#.globalAlpha = #", this, value);
- }
+ num get globalAlpha native;
- String get globalCompositeOperation =>
- JS("String", "#.globalCompositeOperation", this);
+ set globalAlpha(num value) native;
- set globalCompositeOperation(String value) {
- JS("void", "#.globalCompositeOperation = #", this, value);
- }
+ String get globalCompositeOperation native;
- bool get imageSmoothingEnabled => JS("bool", "#.imageSmoothingEnabled", this);
+ set globalCompositeOperation(String value) native;
- set imageSmoothingEnabled(bool value) {
- JS("void", "#.imageSmoothingEnabled = #", this, value);
- }
+ bool get imageSmoothingEnabled native;
- String get imageSmoothingQuality =>
- JS("String", "#.imageSmoothingQuality", this);
+ set imageSmoothingEnabled(bool value) native;
- set imageSmoothingQuality(String value) {
- JS("void", "#.imageSmoothingQuality = #", this, value);
- }
+ String get imageSmoothingQuality native;
- String get lineCap => JS("String", "#.lineCap", this);
+ set imageSmoothingQuality(String value) native;
- set lineCap(String value) {
- JS("void", "#.lineCap = #", this, value);
- }
+ String get lineCap native;
- num get lineDashOffset => JS("num", "#.lineDashOffset", this);
+ set lineCap(String value) native;
- set lineDashOffset(num value) {
- JS("void", "#.lineDashOffset = #", this, value);
- }
+ num get lineDashOffset native;
- String get lineJoin => JS("String", "#.lineJoin", this);
+ set lineDashOffset(num value) native;
- set lineJoin(String value) {
- JS("void", "#.lineJoin = #", this, value);
- }
+ String get lineJoin native;
- num get lineWidth => JS("num", "#.lineWidth", this);
+ set lineJoin(String value) native;
- set lineWidth(num value) {
- JS("void", "#.lineWidth = #", this, value);
- }
+ num get lineWidth native;
- num get miterLimit => JS("num", "#.miterLimit", this);
+ set lineWidth(num value) native;
- set miterLimit(num value) {
- JS("void", "#.miterLimit = #", this, value);
- }
+ num get miterLimit native;
- num get shadowBlur => JS("num", "#.shadowBlur", this);
+ set miterLimit(num value) native;
- set shadowBlur(num value) {
- JS("void", "#.shadowBlur = #", this, value);
- }
+ num get shadowBlur native;
- String get shadowColor => JS("String", "#.shadowColor", this);
+ set shadowBlur(num value) native;
- set shadowColor(String value) {
- JS("void", "#.shadowColor = #", this, value);
- }
+ String get shadowColor native;
- num get shadowOffsetX => JS("num", "#.shadowOffsetX", this);
+ set shadowColor(String value) native;
- set shadowOffsetX(num value) {
- JS("void", "#.shadowOffsetX = #", this, value);
- }
+ num get shadowOffsetX native;
- num get shadowOffsetY => JS("num", "#.shadowOffsetY", this);
+ set shadowOffsetX(num value) native;
- set shadowOffsetY(num value) {
- JS("void", "#.shadowOffsetY = #", this, value);
- }
+ num get shadowOffsetY native;
- Object? strokeStyle;
+ set shadowOffsetY(num value) native;
- String get textAlign => JS("String", "#.textAlign", this);
+ Object? get strokeStyle native;
- set textAlign(String value) {
- JS("void", "#.textAlign = #", this, value);
- }
+ set strokeStyle(Object? value) native;
- String get textBaseline => JS("String", "#.textBaseline", this);
+ String get textAlign native;
- set textBaseline(String value) {
- JS("void", "#.textBaseline = #", this, value);
- }
+ set textAlign(String value) native;
+
+ String get textBaseline native;
+
+ set textBaseline(String value) native;
void beginPath() native;
@@ -24478,17 +24207,13 @@
*/
OptGroupElement.created() : super.created();
- bool get disabled => JS("bool", "#.disabled", this);
+ bool get disabled native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ set disabled(bool value) native;
- String get label => JS("String", "#.label", this);
+ String get label native;
- set label(String value) {
- JS("void", "#.label = #", this, value);
- }
+ set label(String value) native;
}
// 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
@@ -24538,39 +24263,29 @@
*/
OptionElement.created() : super.created();
- bool get defaultSelected => JS("bool", "#.defaultSelected", this);
+ bool get defaultSelected native;
- set defaultSelected(bool value) {
- JS("void", "#.defaultSelected = #", this, value);
- }
+ set defaultSelected(bool value) native;
- bool get disabled => JS("bool", "#.disabled", this);
+ bool get disabled native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ set disabled(bool value) native;
- FormElement? get form => JS("FormElement", "#.form", this);
+ FormElement? get form native;
- int get index => JS("int", "#.index", this);
+ int get index native;
- String get label => JS("String", "#.label", this);
+ String get label native;
- set label(String value) {
- JS("void", "#.label = #", this, value);
- }
+ set label(String value) native;
- bool get selected => JS("bool", "#.selected", this);
+ bool get selected native;
- set selected(bool value) {
- JS("void", "#.selected = #", this, value);
- }
+ set selected(bool value) native;
- String get value => JS("String", "#.value", this);
+ String get value native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(String value) native;
}
// 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
@@ -24583,7 +24298,7 @@
throw new UnsupportedError("Not supported");
}
- List<num>? get quaternion => JS("List<num>", "#.quaternion", this);
+ List<num>? get quaternion native;
void populateMatrix(Object targetBuffer) native;
}
@@ -24612,40 +24327,34 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('output');
- String get defaultValue => JS("String", "#.defaultValue", this);
+ String get defaultValue native;
- set defaultValue(String value) {
- JS("void", "#.defaultValue = #", this, value);
- }
+ set defaultValue(String value) native;
- FormElement? get form => JS("FormElement", "#.form", this);
+ FormElement? get form native;
- DomTokenList get htmlFor => JS("DomTokenList", "#.htmlFor", this);
+ DomTokenList get htmlFor native;
@Unstable()
@Returns('NodeList')
@Creates('NodeList')
- List<Node> get labels => JS("NodeList", "#.labels", this);
+ List<Node> get labels native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- String get validationMessage => JS("String", "#.validationMessage", this);
+ String get validationMessage native;
- ValidityState get validity => JS("ValidityState", "#.validity", this);
+ ValidityState get validity native;
- String get value => JS("String", "#.value", this);
+ String get value native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(String value) native;
- bool get willValidate => JS("bool", "#.willValidate", this);
+ bool get willValidate native;
bool checkValidity() native;
@@ -24673,11 +24382,11 @@
constraint,
message);
- String? get constraint => JS("String", "#.constraint", this);
+ String? get constraint native;
- String? get message => JS("String", "#.message", this);
+ String? get message native;
- String get name => JS("String", "#.name", this);
+ String get name native;
}
// 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
@@ -24705,7 +24414,7 @@
static PageTransitionEvent _create_2(type) =>
JS('PageTransitionEvent', 'new PageTransitionEvent(#)', type);
- bool get persisted => JS("bool", "#.persisted", this);
+ bool get persisted native;
}
// 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
@@ -24718,101 +24427,73 @@
throw new UnsupportedError("Not supported");
}
- Matrix get currentTransform => JS("Matrix", "#.currentTransform", this);
+ Matrix get currentTransform native;
- set currentTransform(Matrix value) {
- JS("void", "#.currentTransform = #", this, value);
- }
+ set currentTransform(Matrix value) native;
- Object? fillStyle;
+ Object? get fillStyle native;
- String get filter => JS("String", "#.filter", this);
+ set fillStyle(Object? value) native;
- set filter(String value) {
- JS("void", "#.filter = #", this, value);
- }
+ String get filter native;
- num get globalAlpha => JS("num", "#.globalAlpha", this);
+ set filter(String value) native;
- set globalAlpha(num value) {
- JS("void", "#.globalAlpha = #", this, value);
- }
+ num get globalAlpha native;
- String get globalCompositeOperation =>
- JS("String", "#.globalCompositeOperation", this);
+ set globalAlpha(num value) native;
- set globalCompositeOperation(String value) {
- JS("void", "#.globalCompositeOperation = #", this, value);
- }
+ String get globalCompositeOperation native;
- bool get imageSmoothingEnabled => JS("bool", "#.imageSmoothingEnabled", this);
+ set globalCompositeOperation(String value) native;
- set imageSmoothingEnabled(bool value) {
- JS("void", "#.imageSmoothingEnabled = #", this, value);
- }
+ bool get imageSmoothingEnabled native;
- String get imageSmoothingQuality =>
- JS("String", "#.imageSmoothingQuality", this);
+ set imageSmoothingEnabled(bool value) native;
- set imageSmoothingQuality(String value) {
- JS("void", "#.imageSmoothingQuality = #", this, value);
- }
+ String get imageSmoothingQuality native;
- String get lineCap => JS("String", "#.lineCap", this);
+ set imageSmoothingQuality(String value) native;
- set lineCap(String value) {
- JS("void", "#.lineCap = #", this, value);
- }
+ String get lineCap native;
- num get lineDashOffset => JS("num", "#.lineDashOffset", this);
+ set lineCap(String value) native;
- set lineDashOffset(num value) {
- JS("void", "#.lineDashOffset = #", this, value);
- }
+ num get lineDashOffset native;
- String get lineJoin => JS("String", "#.lineJoin", this);
+ set lineDashOffset(num value) native;
- set lineJoin(String value) {
- JS("void", "#.lineJoin = #", this, value);
- }
+ String get lineJoin native;
- num get lineWidth => JS("num", "#.lineWidth", this);
+ set lineJoin(String value) native;
- set lineWidth(num value) {
- JS("void", "#.lineWidth = #", this, value);
- }
+ num get lineWidth native;
- num get miterLimit => JS("num", "#.miterLimit", this);
+ set lineWidth(num value) native;
- set miterLimit(num value) {
- JS("void", "#.miterLimit = #", this, value);
- }
+ num get miterLimit native;
- num get shadowBlur => JS("num", "#.shadowBlur", this);
+ set miterLimit(num value) native;
- set shadowBlur(num value) {
- JS("void", "#.shadowBlur = #", this, value);
- }
+ num get shadowBlur native;
- String get shadowColor => JS("String", "#.shadowColor", this);
+ set shadowBlur(num value) native;
- set shadowColor(String value) {
- JS("void", "#.shadowColor = #", this, value);
- }
+ String get shadowColor native;
- num get shadowOffsetX => JS("num", "#.shadowOffsetX", this);
+ set shadowColor(String value) native;
- set shadowOffsetX(num value) {
- JS("void", "#.shadowOffsetX = #", this, value);
- }
+ num get shadowOffsetX native;
- num get shadowOffsetY => JS("num", "#.shadowOffsetY", this);
+ set shadowOffsetX(num value) native;
- set shadowOffsetY(num value) {
- JS("void", "#.shadowOffsetY = #", this, value);
- }
+ num get shadowOffsetY native;
- Object? strokeStyle;
+ set shadowOffsetY(num value) native;
+
+ Object? get strokeStyle native;
+
+ set strokeStyle(Object? value) native;
void beginPath() native;
@@ -24903,9 +24584,9 @@
throw new UnsupportedError("Not supported");
}
- num get height => JS("num", "#.height", this);
+ num get height native;
- num get width => JS("num", "#.width", this);
+ num get width native;
}
// 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
@@ -24918,7 +24599,7 @@
throw new UnsupportedError("Not supported");
}
- num get devicePixelRatio => JS("num", "#.devicePixelRatio", this);
+ num get devicePixelRatio native;
void registerPaint(String name, Object paintCtor) native;
}
@@ -24969,17 +24650,13 @@
*/
ParamElement.created() : super.created();
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- String get value => JS("String", "#.value", this);
+ String get value native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(String value) native;
}
// 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
@@ -24991,13 +24668,13 @@
throw new UnsupportedError("Not supported");
}
- int get _childElementCount => JS("int", "#.childElementCount", this);
+ int get _childElementCount native;
- List<Node> get _children => JS("HtmlCollection", "#.children", this);
+ List<Node> get _children native;
- Element? get _firstElementChild => JS("Element", "#.firstElementChild", this);
+ Element? get _firstElementChild native;
- Element? get _lastElementChild => JS("Element", "#.lastElementChild", this);
+ Element? get _lastElementChild native;
Element? querySelector(String selectors);
@@ -25029,28 +24706,26 @@
static PasswordCredential _create_2(data_OR_form) =>
JS('PasswordCredential', 'new PasswordCredential(#)', data_OR_form);
- Object? additionalData;
+ Object? get additionalData native;
- String get idName => JS("String", "#.idName", this);
+ set additionalData(Object? value) native;
- set idName(String value) {
- JS("void", "#.idName = #", this, value);
- }
+ String get idName native;
- String get password => JS("String", "#.password", this);
+ set idName(String value) native;
- String get passwordName => JS("String", "#.passwordName", this);
+ String get password native;
- set passwordName(String value) {
- JS("void", "#.passwordName = #", this, value);
- }
+ String get passwordName native;
+
+ set passwordName(String value) native;
// From CredentialUserData
@JSName('iconURL')
- String get iconUrl => JS("String", "#.iconURL", this);
+ String get iconUrl native;
- String get name => JS("String", "#.name", this);
+ String get name native;
}
// 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
@@ -25117,27 +24792,27 @@
throw new UnsupportedError("Not supported");
}
- List<String> get addressLine => JS("List<String>", "#.addressLine", this);
+ List<String> get addressLine native;
- String get city => JS("String", "#.city", this);
+ String get city native;
- String get country => JS("String", "#.country", this);
+ String get country native;
- String get dependentLocality => JS("String", "#.dependentLocality", this);
+ String get dependentLocality native;
- String get languageCode => JS("String", "#.languageCode", this);
+ String get languageCode native;
- String get organization => JS("String", "#.organization", this);
+ String get organization native;
- String get phone => JS("String", "#.phone", this);
+ String get phone native;
- String get postalCode => JS("String", "#.postalCode", this);
+ String get postalCode native;
- String get recipient => JS("String", "#.recipient", this);
+ String get recipient native;
- String get region => JS("String", "#.region", this);
+ String get region native;
- String get sortingCode => JS("String", "#.sortingCode", this);
+ String get sortingCode native;
}
// 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
@@ -25181,14 +24856,11 @@
throw new UnsupportedError("Not supported");
}
- PaymentInstruments get instruments =>
- JS("PaymentInstruments", "#.instruments", this);
+ PaymentInstruments get instruments native;
- String get userHint => JS("String", "#.userHint", this);
+ String get userHint native;
- set userHint(String value) {
- JS("void", "#.userHint = #", this, value);
- }
+ set userHint(String value) native;
}
// 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
@@ -25224,14 +24896,13 @@
throw new UnsupportedError("Not supported");
}
- String get id => JS("String", "#.id", this);
+ String get id native;
- PaymentAddress? get shippingAddress =>
- JS("PaymentAddress", "#.shippingAddress", this);
+ PaymentAddress? get shippingAddress native;
- String? get shippingOption => JS("String", "#.shippingOption", this);
+ String? get shippingOption native;
- String? get shippingType => JS("String", "#.shippingType", this);
+ String? get shippingType native;
Future abort() => promiseToFuture(JS("", "#.abort()", this));
@@ -25263,20 +24934,19 @@
type,
eventInitDict);
- String get instrumentKey => JS("String", "#.instrumentKey", this);
+ String get instrumentKey native;
- List get methodData => JS("List", "#.methodData", this);
+ List get methodData native;
- List get modifiers => JS("List", "#.modifiers", this);
+ List get modifiers native;
- String get paymentRequestId => JS("String", "#.paymentRequestId", this);
+ String get paymentRequestId native;
- String get paymentRequestOrigin =>
- JS("String", "#.paymentRequestOrigin", this);
+ String get paymentRequestOrigin native;
- String get topLevelOrigin => JS("String", "#.topLevelOrigin", this);
+ String get topLevelOrigin native;
- Object get total => JS("Object", "#.total", this);
+ Object get total native;
Future<WindowClient> openWindow(String url) =>
promiseToFuture<WindowClient>(JS("", "#.openWindow(#)", this, url));
@@ -25322,22 +24992,21 @@
throw new UnsupportedError("Not supported");
}
- Object get details => JS("Object", "#.details", this);
+ Object get details native;
- String get methodName => JS("String", "#.methodName", this);
+ String get methodName native;
- String? get payerEmail => JS("String", "#.payerEmail", this);
+ String? get payerEmail native;
- String? get payerName => JS("String", "#.payerName", this);
+ String? get payerName native;
- String? get payerPhone => JS("String", "#.payerPhone", this);
+ String? get payerPhone native;
- String get requestId => JS("String", "#.requestId", this);
+ String get requestId native;
- PaymentAddress? get shippingAddress =>
- JS("PaymentAddress", "#.shippingAddress", this);
+ PaymentAddress? get shippingAddress native;
- String? get shippingOption => JS("String", "#.shippingOption", this);
+ String? get shippingOption native;
Future complete([String? paymentResult]) =>
promiseToFuture(JS("", "#.complete(#)", this, paymentResult));
@@ -25359,14 +25028,13 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.performance)');
- MemoryInfo get memory => JS("MemoryInfo", "#.memory", this);
+ MemoryInfo get memory native;
- PerformanceNavigation get navigation =>
- JS("PerformanceNavigation", "#.navigation", this);
+ PerformanceNavigation get navigation native;
- num get timeOrigin => JS("num", "#.timeOrigin", this);
+ num get timeOrigin native;
- PerformanceTiming get timing => JS("PerformanceTiming", "#.timing", this);
+ PerformanceTiming get timing native;
void clearMarks(String? markName) native;
@@ -25400,13 +25068,13 @@
throw new UnsupportedError("Not supported");
}
- num get duration => JS("num", "#.duration", this);
+ num get duration native;
- String get entryType => JS("String", "#.entryType", this);
+ String get entryType native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- num get startTime => JS("num", "#.startTime", this);
+ num get startTime native;
}
// 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
@@ -25419,8 +25087,7 @@
throw new UnsupportedError("Not supported");
}
- List<TaskAttributionTiming> get attribution =>
- JS("List<TaskAttributionTiming>", "#.attribution", this);
+ List<TaskAttributionTiming> get attribution native;
}
// 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
@@ -25464,9 +25131,9 @@
static const int TYPE_RESERVED = 255;
- int get redirectCount => JS("int", "#.redirectCount", this);
+ int get redirectCount native;
- int get type => JS("int", "#.type", this);
+ int get type native;
}
// 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
@@ -25479,27 +25146,25 @@
throw new UnsupportedError("Not supported");
}
- num get domComplete => JS("num", "#.domComplete", this);
+ num get domComplete native;
- num get domContentLoadedEventEnd =>
- JS("num", "#.domContentLoadedEventEnd", this);
+ num get domContentLoadedEventEnd native;
- num get domContentLoadedEventStart =>
- JS("num", "#.domContentLoadedEventStart", this);
+ num get domContentLoadedEventStart native;
- num get domInteractive => JS("num", "#.domInteractive", this);
+ num get domInteractive native;
- num get loadEventEnd => JS("num", "#.loadEventEnd", this);
+ num get loadEventEnd native;
- num get loadEventStart => JS("num", "#.loadEventStart", this);
+ num get loadEventStart native;
- int get redirectCount => JS("int", "#.redirectCount", this);
+ int get redirectCount native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- num get unloadEventEnd => JS("num", "#.unloadEventEnd", this);
+ num get unloadEventEnd native;
- num get unloadEventStart => JS("num", "#.unloadEventStart", this);
+ num get unloadEventStart native;
}
// 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
@@ -25578,42 +25243,41 @@
throw new UnsupportedError("Not supported");
}
- num get connectEnd => JS("num", "#.connectEnd", this);
+ num get connectEnd native;
- num get connectStart => JS("num", "#.connectStart", this);
+ num get connectStart native;
- int get decodedBodySize => JS("int", "#.decodedBodySize", this);
+ int get decodedBodySize native;
- num get domainLookupEnd => JS("num", "#.domainLookupEnd", this);
+ num get domainLookupEnd native;
- num get domainLookupStart => JS("num", "#.domainLookupStart", this);
+ num get domainLookupStart native;
- int get encodedBodySize => JS("int", "#.encodedBodySize", this);
+ int get encodedBodySize native;
- num get fetchStart => JS("num", "#.fetchStart", this);
+ num get fetchStart native;
- String get initiatorType => JS("String", "#.initiatorType", this);
+ String get initiatorType native;
- String get nextHopProtocol => JS("String", "#.nextHopProtocol", this);
+ String get nextHopProtocol native;
- num get redirectEnd => JS("num", "#.redirectEnd", this);
+ num get redirectEnd native;
- num get redirectStart => JS("num", "#.redirectStart", this);
+ num get redirectStart native;
- num get requestStart => JS("num", "#.requestStart", this);
+ num get requestStart native;
- num get responseEnd => JS("num", "#.responseEnd", this);
+ num get responseEnd native;
- num get responseStart => JS("num", "#.responseStart", this);
+ num get responseStart native;
- num get secureConnectionStart => JS("num", "#.secureConnectionStart", this);
+ num get secureConnectionStart native;
- List<PerformanceServerTiming> get serverTiming =>
- JS("List<PerformanceServerTiming>", "#.serverTiming", this);
+ List<PerformanceServerTiming> get serverTiming native;
- int get transferSize => JS("int", "#.transferSize", this);
+ int get transferSize native;
- num get workerStart => JS("num", "#.workerStart", this);
+ num get workerStart native;
}
// 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
@@ -25626,11 +25290,11 @@
throw new UnsupportedError("Not supported");
}
- String get description => JS("String", "#.description", this);
+ String get description native;
- num get duration => JS("num", "#.duration", this);
+ num get duration native;
- String get name => JS("String", "#.name", this);
+ String get name native;
}
// 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
@@ -25644,49 +25308,47 @@
throw new UnsupportedError("Not supported");
}
- int get connectEnd => JS("int", "#.connectEnd", this);
+ int get connectEnd native;
- int get connectStart => JS("int", "#.connectStart", this);
+ int get connectStart native;
- int get domComplete => JS("int", "#.domComplete", this);
+ int get domComplete native;
- int get domContentLoadedEventEnd =>
- JS("int", "#.domContentLoadedEventEnd", this);
+ int get domContentLoadedEventEnd native;
- int get domContentLoadedEventStart =>
- JS("int", "#.domContentLoadedEventStart", this);
+ int get domContentLoadedEventStart native;
- int get domInteractive => JS("int", "#.domInteractive", this);
+ int get domInteractive native;
- int get domLoading => JS("int", "#.domLoading", this);
+ int get domLoading native;
- int get domainLookupEnd => JS("int", "#.domainLookupEnd", this);
+ int get domainLookupEnd native;
- int get domainLookupStart => JS("int", "#.domainLookupStart", this);
+ int get domainLookupStart native;
- int get fetchStart => JS("int", "#.fetchStart", this);
+ int get fetchStart native;
- int get loadEventEnd => JS("int", "#.loadEventEnd", this);
+ int get loadEventEnd native;
- int get loadEventStart => JS("int", "#.loadEventStart", this);
+ int get loadEventStart native;
- int get navigationStart => JS("int", "#.navigationStart", this);
+ int get navigationStart native;
- int get redirectEnd => JS("int", "#.redirectEnd", this);
+ int get redirectEnd native;
- int get redirectStart => JS("int", "#.redirectStart", this);
+ int get redirectStart native;
- int get requestStart => JS("int", "#.requestStart", this);
+ int get requestStart native;
- int get responseEnd => JS("int", "#.responseEnd", this);
+ int get responseEnd native;
- int get responseStart => JS("int", "#.responseStart", this);
+ int get responseStart native;
- int get secureConnectionStart => JS("int", "#.secureConnectionStart", this);
+ int get secureConnectionStart native;
- int get unloadEventEnd => JS("int", "#.unloadEventEnd", this);
+ int get unloadEventEnd native;
- int get unloadEventStart => JS("int", "#.unloadEventStart", this);
+ int get unloadEventStart native;
}
// 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
@@ -25702,7 +25364,7 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- String get state => JS("String", "#.state", this);
+ String get state native;
Stream<Event> get onChange => changeEvent.forTarget(this);
}
@@ -25750,15 +25412,13 @@
throw new UnsupportedError("Not supported");
}
- List get fillLightMode => JS("List", "#.fillLightMode", this);
+ List get fillLightMode native;
- MediaSettingsRange get imageHeight =>
- JS("MediaSettingsRange", "#.imageHeight", this);
+ MediaSettingsRange get imageHeight native;
- MediaSettingsRange get imageWidth =>
- JS("MediaSettingsRange", "#.imageWidth", this);
+ MediaSettingsRange get imageWidth native;
- String get redEyeReduction => JS("String", "#.redEyeReduction", this);
+ String get redEyeReduction native;
}
// 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
@@ -25788,13 +25448,13 @@
throw new UnsupportedError("Not supported");
}
- String get description => JS("String", "#.description", this);
+ String get description native;
- String get filename => JS("String", "#.filename", this);
+ String get filename native;
- int get length => JS("int", "#.length", this);
+ int get length native;
- String get name => JS("String", "#.name", this);
+ String get name native;
MimeType? item(int index) native;
@@ -25889,25 +25549,25 @@
static PointerEvent _create_2(type) =>
JS('PointerEvent', 'new PointerEvent(#)', type);
- num get height => JS("num", "#.height", this);
+ num get height native;
- bool get isPrimary => JS("bool", "#.isPrimary", this);
+ bool get isPrimary native;
- int get pointerId => JS("int", "#.pointerId", this);
+ int get pointerId native;
- String get pointerType => JS("String", "#.pointerType", this);
+ String get pointerType native;
- num get pressure => JS("num", "#.pressure", this);
+ num get pressure native;
- num get tangentialPressure => JS("num", "#.tangentialPressure", this);
+ num get tangentialPressure native;
- int get tiltX => JS("int", "#.tiltX", this);
+ int get tiltX native;
- int get tiltY => JS("int", "#.tiltY", this);
+ int get tiltY native;
- int get twist => JS("int", "#.twist", this);
+ int get twist native;
- num get width => JS("num", "#.width", this);
+ num get width native;
List<PointerEvent> getCoalescedEvents() native;
@@ -25954,7 +25614,7 @@
@JSName('state')
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- dynamic get _get_state => JS("", "#.state", this);
+ dynamic get _get_state native;
}
// 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
@@ -25982,9 +25642,9 @@
static const int TIMEOUT = 3;
- int get code => JS("int", "#.code", this);
+ int get code native;
- String get message => JS("String", "#.message", this);
+ String get message native;
}
// 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
@@ -26028,10 +25688,11 @@
throw new UnsupportedError("Not supported");
}
- PresentationRequest? defaultRequest;
+ PresentationRequest? get defaultRequest native;
- PresentationReceiver? get receiver =>
- JS("PresentationReceiver", "#.receiver", this);
+ set defaultRequest(PresentationRequest? value) native;
+
+ PresentationReceiver? get receiver native;
}
// 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
@@ -26047,7 +25708,7 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- bool get value => JS("bool", "#.value", this);
+ bool get value native;
Stream<Event> get onChange => changeEvent.forTarget(this);
}
@@ -26065,17 +25726,15 @@
static const EventStreamProvider<MessageEvent> messageEvent =
const EventStreamProvider<MessageEvent>('message');
- String get binaryType => JS("String", "#.binaryType", this);
+ String get binaryType native;
- set binaryType(String value) {
- JS("void", "#.binaryType = #", this, value);
- }
+ set binaryType(String value) native;
- String get id => JS("String", "#.id", this);
+ String get id native;
- String get state => JS("String", "#.state", this);
+ String get state native;
- String get url => JS("String", "#.url", this);
+ String get url native;
void close() native;
@@ -26105,8 +25764,7 @@
JS('PresentationConnectionAvailableEvent',
'new PresentationConnectionAvailableEvent(#,#)', type, eventInitDict);
- PresentationConnection get connection =>
- JS("PresentationConnection", "#.connection", this);
+ PresentationConnection get connection native;
}
// 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
@@ -26129,9 +25787,9 @@
type,
eventInitDict);
- String get message => JS("String", "#.message", this);
+ String get message native;
- String get reason => JS("String", "#.reason", this);
+ String get reason native;
}
// 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
@@ -26144,8 +25802,7 @@
throw new UnsupportedError("Not supported");
}
- List<PresentationConnection> get connections =>
- JS("List<PresentationConnection>", "#.connections", this);
+ List<PresentationConnection> get connections native;
}
// 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
@@ -26211,9 +25868,9 @@
throw new UnsupportedError("Not supported");
}
- StyleSheet? get sheet => JS("StyleSheet", "#.sheet", this);
+ StyleSheet? get sheet native;
- String get target => JS("String", "#.target", this);
+ String get target native;
}
// 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
@@ -26245,21 +25902,17 @@
@Unstable()
@Returns('NodeList')
@Creates('NodeList')
- List<Node> get labels => JS("NodeList", "#.labels", this);
+ List<Node> get labels native;
- num get max => JS("num", "#.max", this);
+ num get max native;
- set max(num value) {
- JS("void", "#.max = #", this, value);
- }
+ set max(num value) native;
- num get position => JS("num", "#.position", this);
+ num get position native;
- num get value => JS("num", "#.value", this);
+ num get value native;
- set value(num value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(num value) native;
}
// 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
@@ -26284,11 +25937,11 @@
static ProgressEvent _create_2(type) =>
JS('ProgressEvent', 'new ProgressEvent(#)', type);
- bool get lengthComputable => JS("bool", "#.lengthComputable", this);
+ bool get lengthComputable native;
- int get loaded => JS("int", "#.loaded", this);
+ int get loaded native;
- int get total => JS("int", "#.total", this);
+ int get total native;
}
// 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
@@ -26313,7 +25966,7 @@
Future get promise => promiseToFuture(JS("", "#.promise", this));
- Object? get reason => JS("Object", "#.reason", this);
+ Object? get reason native;
}
// 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
@@ -26326,10 +25979,9 @@
throw new UnsupportedError("Not supported");
}
- ByteBuffer get rawId => JS("ByteBuffer", "#.rawId", this);
+ ByteBuffer get rawId native;
- AuthenticatorResponse get response =>
- JS("AuthenticatorResponse", "#.response", this);
+ AuthenticatorResponse get response native;
}
// 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
@@ -26353,7 +26005,7 @@
JS('PushEvent', 'new PushEvent(#,#)', type, eventInitDict);
static PushEvent _create_2(type) => JS('PushEvent', 'new PushEvent(#)', type);
- PushMessageData? get data => JS("PushMessageData", "#.data", this);
+ PushMessageData? get data native;
}
// 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
@@ -26366,8 +26018,7 @@
throw new UnsupportedError("Not supported");
}
- List<String> get supportedContentEncodings =>
- JS("List<String>", "#.supportedContentEncodings", this);
+ List<String> get supportedContentEncodings native;
Future<PushSubscription> getSubscription() =>
promiseToFuture<PushSubscription>(JS("", "#.getSubscription()", this));
@@ -26419,12 +26070,11 @@
throw new UnsupportedError("Not supported");
}
- String get endpoint => JS("String", "#.endpoint", this);
+ String get endpoint native;
- int get expirationTime => JS("int", "#.expirationTime", this);
+ int get expirationTime native;
- PushSubscriptionOptions get options =>
- JS("PushSubscriptionOptions", "#.options", this);
+ PushSubscriptionOptions get options native;
ByteBuffer? getKey(String name) native;
@@ -26442,10 +26092,9 @@
throw new UnsupportedError("Not supported");
}
- ByteBuffer? get applicationServerKey =>
- JS("ByteBuffer", "#.applicationServerKey", this);
+ ByteBuffer? get applicationServerKey native;
- bool get userVisibleOnly => JS("bool", "#.userVisibleOnly", this);
+ bool get userVisibleOnly native;
}
// 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
@@ -26470,11 +26119,9 @@
*/
QuoteElement.created() : super.created();
- String get cite => JS("String", "#.cite", this);
+ String get cite native;
- set cite(String value) {
- JS("void", "#.cite = #", this, value);
- }
+ set cite(String value) native;
}
// 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
@@ -26523,18 +26170,17 @@
static const int START_TO_START = 0;
- bool get collapsed => JS("bool", "#.collapsed", this);
+ bool get collapsed native;
- Node get commonAncestorContainer =>
- JS("Node", "#.commonAncestorContainer", this);
+ Node get commonAncestorContainer native;
- Node get endContainer => JS("Node", "#.endContainer", this);
+ Node get endContainer native;
- int get endOffset => JS("int", "#.endOffset", this);
+ int get endOffset native;
- Node get startContainer => JS("Node", "#.startContainer", this);
+ Node get startContainer native;
- int get startOffset => JS("int", "#.startOffset", this);
+ int get startOffset native;
DocumentFragment cloneContents() native;
@@ -26620,11 +26266,11 @@
throw new UnsupportedError("Not supported");
}
- String get id => JS("String", "#.id", this);
+ String get id native;
- String get platform => JS("String", "#.platform", this);
+ String get platform native;
- String get url => JS("String", "#.url", this);
+ String get url native;
}
// 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
@@ -26662,7 +26308,7 @@
throw new UnsupportedError("Not supported");
}
- String get state => JS("String", "#.state", this);
+ String get state native;
Future cancelWatchAvailability([int? id]) =>
promiseToFuture(JS("", "#.cancelWatchAvailability(#)", this, id));
@@ -26769,10 +26415,9 @@
throw new UnsupportedError("Not supported");
}
- DomRectReadOnly get contentRect =>
- JS("DomRectReadOnly", "#.contentRect", this);
+ DomRectReadOnly get contentRect native;
- Element get target => JS("Element", "#.target", this);
+ Element get target native;
}
// 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
@@ -26785,7 +26430,7 @@
throw new UnsupportedError("Not supported");
}
- int get expires => JS("int", "#.expires", this);
+ int get expires native;
List<Map> getFingerprints() native;
}
@@ -26836,38 +26481,33 @@
static const EventStreamProvider<Event> openEvent =
const EventStreamProvider<Event>('open');
- String get binaryType => JS("String", "#.binaryType", this);
+ String get binaryType native;
- set binaryType(String value) {
- JS("void", "#.binaryType = #", this, value);
- }
+ set binaryType(String value) native;
- int get bufferedAmount => JS("int", "#.bufferedAmount", this);
+ int get bufferedAmount native;
- int get bufferedAmountLowThreshold =>
- JS("int", "#.bufferedAmountLowThreshold", this);
+ int get bufferedAmountLowThreshold native;
- set bufferedAmountLowThreshold(int value) {
- JS("void", "#.bufferedAmountLowThreshold = #", this, value);
- }
+ set bufferedAmountLowThreshold(int value) native;
- int get id => JS("int", "#.id", this);
+ int get id native;
- String get label => JS("String", "#.label", this);
+ String get label native;
- int get maxRetransmitTime => JS("int", "#.maxRetransmitTime", this);
+ int get maxRetransmitTime native;
- int get maxRetransmits => JS("int", "#.maxRetransmits", this);
+ int get maxRetransmits native;
- bool get negotiated => JS("bool", "#.negotiated", this);
+ bool get negotiated native;
- bool get ordered => JS("bool", "#.ordered", this);
+ bool get ordered native;
- String get protocol => JS("String", "#.protocol", this);
+ String get protocol native;
- String get readyState => JS("String", "#.readyState", this);
+ String get readyState native;
- bool get reliable => JS("bool", "#.reliable", this);
+ bool get reliable native;
void close() native;
@@ -26918,7 +26558,7 @@
type,
eventInitDict);
- RtcDataChannel get channel => JS("RtcDataChannel", "#.channel", this);
+ RtcDataChannel get channel native;
}
// 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
@@ -26941,15 +26581,15 @@
const EventStreamProvider<RtcDtmfToneChangeEvent>('tonechange');
@JSName('canInsertDTMF')
- bool get canInsertDtmf => JS("bool", "#.canInsertDTMF", this);
+ bool get canInsertDtmf native;
- int get duration => JS("int", "#.duration", this);
+ int get duration native;
- int get interToneGap => JS("int", "#.interToneGap", this);
+ int get interToneGap native;
- String get toneBuffer => JS("String", "#.toneBuffer", this);
+ String get toneBuffer native;
- MediaStreamTrack get track => JS("MediaStreamTrack", "#.track", this);
+ MediaStreamTrack get track native;
@JSName('insertDTMF')
void insertDtmf(String tones, [int? duration, int? interToneGap]) native;
@@ -26979,7 +26619,7 @@
type,
eventInitDict);
- String get tone => JS("String", "#.tone", this);
+ String get tone native;
}
// 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
@@ -26998,23 +26638,17 @@
throw new UnsupportedError("Not supported");
}
- String get candidate => JS("String", "#.candidate", this);
+ String get candidate native;
- set candidate(String value) {
- JS("void", "#.candidate = #", this, value);
- }
+ set candidate(String value) native;
- int get sdpMLineIndex => JS("int", "#.sdpMLineIndex", this);
+ int get sdpMLineIndex native;
- set sdpMLineIndex(int value) {
- JS("void", "#.sdpMLineIndex = #", this, value);
- }
+ set sdpMLineIndex(int value) native;
- String get sdpMid => JS("String", "#.sdpMid", this);
+ String get sdpMid native;
- set sdpMid(String value) {
- JS("void", "#.sdpMid = #", this, value);
- }
+ set sdpMid(String value) native;
}
// 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
@@ -27027,13 +26661,13 @@
throw new UnsupportedError("Not supported");
}
- String get id => JS("String", "#.id", this);
+ String get id native;
DateTime get timestamp => convertNativeToDart_DateTime(this._get_timestamp);
@JSName('timestamp')
- dynamic get _get_timestamp => JS("", "#.timestamp", this);
+ dynamic get _get_timestamp native;
- String get type => JS("String", "#.type", this);
+ String get type native;
List<String> names() native;
@@ -27172,17 +26806,15 @@
static const EventStreamProvider<Event> signalingStateChangeEvent =
const EventStreamProvider<Event>('signalingstatechange');
- String get iceConnectionState => JS("String", "#.iceConnectionState", this);
+ String get iceConnectionState native;
- String get iceGatheringState => JS("String", "#.iceGatheringState", this);
+ String get iceGatheringState native;
- RtcSessionDescription? get localDescription =>
- JS("RtcSessionDescription", "#.localDescription", this);
+ RtcSessionDescription? get localDescription native;
- RtcSessionDescription? get remoteDescription =>
- JS("RtcSessionDescription", "#.remoteDescription", this);
+ RtcSessionDescription? get remoteDescription native;
- String get signalingState => JS("String", "#.signalingState", this);
+ String get signalingState native;
Future addIceCandidate(Object candidate,
[VoidCallback? successCallback,
@@ -27332,7 +26964,7 @@
static RtcPeerConnectionIceEvent _create_2(type) =>
JS('RtcPeerConnectionIceEvent', 'new RTCPeerConnectionIceEvent(#)', type);
- RtcIceCandidate? get candidate => JS("RtcIceCandidate", "#.candidate", this);
+ RtcIceCandidate? get candidate native;
}
// 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
@@ -27345,9 +26977,9 @@
throw new UnsupportedError("Not supported");
}
- int get source => JS("int", "#.source", this);
+ int get source native;
- num get timestamp => JS("num", "#.timestamp", this);
+ num get timestamp native;
}
// 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
@@ -27360,7 +26992,7 @@
throw new UnsupportedError("Not supported");
}
- MediaStreamTrack get track => JS("MediaStreamTrack", "#.track", this);
+ MediaStreamTrack get track native;
List<RtcRtpContributingSource> getContributingSources() native;
}
@@ -27375,7 +27007,7 @@
throw new UnsupportedError("Not supported");
}
- MediaStreamTrack? get track => JS("MediaStreamTrack", "#.track", this);
+ MediaStreamTrack? get track native;
}
// 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
@@ -27394,9 +27026,13 @@
throw new UnsupportedError("Not supported");
}
- String? sdp;
+ String? get sdp native;
- String? type;
+ set sdp(String? value) native;
+
+ String? get type native;
+
+ set type(String? value) native;
}
// 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
@@ -27499,11 +27135,11 @@
static RtcTrackEvent _create_1(type, eventInitDict) =>
JS('RtcTrackEvent', 'new RTCTrackEvent(#,#)', type, eventInitDict);
- RtcRtpReceiver get receiver => JS("RtcRtpReceiver", "#.receiver", this);
+ RtcRtpReceiver get receiver native;
- List<MediaStream> get streams => JS("List<MediaStream>", "#.streams", this);
+ List<MediaStream> get streams native;
- MediaStreamTrack get track => JS("MediaStreamTrack", "#.track", this);
+ MediaStreamTrack get track native;
}
// 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
@@ -27519,33 +27155,30 @@
}
@JSName('availHeight')
- int get _availHeight => JS("int", "#.availHeight", this);
+ int get _availHeight native;
@JSName('availLeft')
- int get _availLeft => JS("int", "#.availLeft", this);
+ int get _availLeft native;
@JSName('availTop')
- int get _availTop => JS("int", "#.availTop", this);
+ int get _availTop native;
@JSName('availWidth')
- int get _availWidth => JS("int", "#.availWidth", this);
+ int get _availWidth native;
- int get colorDepth => JS("int", "#.colorDepth", this);
+ int get colorDepth native;
- int get height => JS("int", "#.height", this);
+ int get height native;
- bool get keepAwake => JS("bool", "#.keepAwake", this);
+ bool get keepAwake native;
- set keepAwake(bool value) {
- JS("void", "#.keepAwake = #", this, value);
- }
+ set keepAwake(bool value) native;
- ScreenOrientation get orientation =>
- JS("ScreenOrientation", "#.orientation", this);
+ ScreenOrientation get orientation native;
- int get pixelDepth => JS("int", "#.pixelDepth", this);
+ int get pixelDepth native;
- int get width => JS("int", "#.width", this);
+ int get width native;
}
// 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
@@ -27561,9 +27194,9 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- int get angle => JS("int", "#.angle", this);
+ int get angle native;
- String get type => JS("String", "#.type", this);
+ String get type native;
Future lock(String orientation) =>
promiseToFuture(JS("", "#.lock(#)", this, orientation));
@@ -27595,49 +27228,37 @@
*/
ScriptElement.created() : super.created();
- bool get async => JS("bool", "#.async", this);
+ bool get async native;
- set async(bool value) {
- JS("void", "#.async = #", this, value);
- }
+ set async(bool value) native;
- String get charset => JS("String", "#.charset", this);
+ String get charset native;
- set charset(String value) {
- JS("void", "#.charset = #", this, value);
- }
+ set charset(String value) native;
- String? crossOrigin;
+ String? get crossOrigin native;
- bool get defer => JS("bool", "#.defer", this);
+ set crossOrigin(String? value) native;
- set defer(bool value) {
- JS("void", "#.defer = #", this, value);
- }
+ bool get defer native;
- String get integrity => JS("String", "#.integrity", this);
+ set defer(bool value) native;
- set integrity(String value) {
- JS("void", "#.integrity = #", this, value);
- }
+ String get integrity native;
- bool get noModule => JS("bool", "#.noModule", this);
+ set integrity(String value) native;
- set noModule(bool value) {
- JS("void", "#.noModule = #", this, value);
- }
+ bool get noModule native;
- String get src => JS("String", "#.src", this);
+ set noModule(bool value) native;
- set src(String value) {
- JS("void", "#.src = #", this, value);
- }
+ String get src native;
- String get type => JS("String", "#.type", this);
+ set src(String value) native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ String get type native;
+
+ set type(String value) native;
}
// 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
@@ -27661,29 +27282,29 @@
JS('ScrollState', 'new ScrollState(#)', scrollStateInit);
static ScrollState _create_2() => JS('ScrollState', 'new ScrollState()');
- num get deltaGranularity => JS("num", "#.deltaGranularity", this);
+ num get deltaGranularity native;
- num get deltaX => JS("num", "#.deltaX", this);
+ num get deltaX native;
- num get deltaY => JS("num", "#.deltaY", this);
+ num get deltaY native;
- bool get fromUserInput => JS("bool", "#.fromUserInput", this);
+ bool get fromUserInput native;
- bool get inInertialPhase => JS("bool", "#.inInertialPhase", this);
+ bool get inInertialPhase native;
- bool get isBeginning => JS("bool", "#.isBeginning", this);
+ bool get isBeginning native;
- bool get isDirectManipulation => JS("bool", "#.isDirectManipulation", this);
+ bool get isDirectManipulation native;
- bool get isEnding => JS("bool", "#.isEnding", this);
+ bool get isEnding native;
- int get positionX => JS("int", "#.positionX", this);
+ int get positionX native;
- int get positionY => JS("int", "#.positionY", this);
+ int get positionY native;
- num get velocityX => JS("num", "#.velocityX", this);
+ num get velocityX native;
- num get velocityY => JS("num", "#.velocityY", this);
+ num get velocityY native;
void consumeDelta(num x, num y) native;
@@ -27719,11 +27340,11 @@
static ScrollTimeline _create_2() =>
JS('ScrollTimeline', 'new ScrollTimeline()');
- String get orientation => JS("String", "#.orientation", this);
+ String get orientation native;
- Element? get scrollSource => JS("Element", "#.scrollSource", this);
+ Element? get scrollSource native;
- Object? get timeRange => JS("Object", "#.timeRange", this);
+ Object? get timeRange native;
}
// 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
@@ -27754,30 +27375,30 @@
type);
@JSName('blockedURI')
- String get blockedUri => JS("String", "#.blockedURI", this);
+ String get blockedUri native;
- int get columnNumber => JS("int", "#.columnNumber", this);
+ int get columnNumber native;
- String get disposition => JS("String", "#.disposition", this);
+ String get disposition native;
@JSName('documentURI')
- String get documentUri => JS("String", "#.documentURI", this);
+ String get documentUri native;
- String get effectiveDirective => JS("String", "#.effectiveDirective", this);
+ String get effectiveDirective native;
- int get lineNumber => JS("int", "#.lineNumber", this);
+ int get lineNumber native;
- String get originalPolicy => JS("String", "#.originalPolicy", this);
+ String get originalPolicy native;
- String get referrer => JS("String", "#.referrer", this);
+ String get referrer native;
- String get sample => JS("String", "#.sample", this);
+ String get sample native;
- String get sourceFile => JS("String", "#.sourceFile", this);
+ String get sourceFile native;
- int get statusCode => JS("int", "#.statusCode", this);
+ int get statusCode native;
- String get violatedDirective => JS("String", "#.violatedDirective", this);
+ String get violatedDirective native;
}
// 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
@@ -27802,74 +27423,56 @@
*/
SelectElement.created() : super.created();
- bool get autofocus => JS("bool", "#.autofocus", this);
+ bool get autofocus native;
- set autofocus(bool value) {
- JS("void", "#.autofocus = #", this, value);
- }
+ set autofocus(bool value) native;
- bool get disabled => JS("bool", "#.disabled", this);
+ bool get disabled native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ set disabled(bool value) native;
- FormElement? get form => JS("FormElement", "#.form", this);
+ FormElement? get form native;
@Unstable()
@Returns('NodeList')
@Creates('NodeList')
- List<Node> get labels => JS("NodeList", "#.labels", this);
+ List<Node> get labels native;
- int get length => JS("int", "#.length", this);
+ int get length native;
- set length(int value) {
- JS("void", "#.length = #", this, value);
- }
+ set length(int value) native;
- bool get multiple => JS("bool", "#.multiple", this);
+ bool get multiple native;
- set multiple(bool value) {
- JS("void", "#.multiple = #", this, value);
- }
+ set multiple(bool value) native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- bool get required => JS("bool", "#.required", this);
+ bool get required native;
- set required(bool value) {
- JS("void", "#.required = #", this, value);
- }
+ set required(bool value) native;
- int get selectedIndex => JS("int", "#.selectedIndex", this);
+ int get selectedIndex native;
- set selectedIndex(int value) {
- JS("void", "#.selectedIndex = #", this, value);
- }
+ set selectedIndex(int value) native;
- int get size => JS("int", "#.size", this);
+ int get size native;
- set size(int value) {
- JS("void", "#.size = #", this, value);
- }
+ set size(int value) native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- String get validationMessage => JS("String", "#.validationMessage", this);
+ String get validationMessage native;
- ValidityState get validity => JS("ValidityState", "#.validity", this);
+ ValidityState get validity native;
- String get value => JS("String", "#.value", this);
+ String get value native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(String value) native;
- bool get willValidate => JS("bool", "#.willValidate", this);
+ bool get willValidate native;
void __setter__(int index, OptionElement? option) native;
@@ -27913,27 +27516,27 @@
throw new UnsupportedError("Not supported");
}
- Node? get anchorNode => JS("Node", "#.anchorNode", this);
+ Node? get anchorNode native;
- int get anchorOffset => JS("int", "#.anchorOffset", this);
+ int get anchorOffset native;
- Node? get baseNode => JS("Node", "#.baseNode", this);
+ Node? get baseNode native;
- int get baseOffset => JS("int", "#.baseOffset", this);
+ int get baseOffset native;
- Node? get extentNode => JS("Node", "#.extentNode", this);
+ Node? get extentNode native;
- int get extentOffset => JS("int", "#.extentOffset", this);
+ int get extentOffset native;
- Node? get focusNode => JS("Node", "#.focusNode", this);
+ Node? get focusNode native;
- int get focusOffset => JS("int", "#.focusOffset", this);
+ int get focusOffset native;
- bool get isCollapsed => JS("bool", "#.isCollapsed", this);
+ bool get isCollapsed native;
- int get rangeCount => JS("int", "#.rangeCount", this);
+ int get rangeCount native;
- String get type => JS("String", "#.type", this);
+ String get type native;
void addRange(Range range) native;
@@ -27980,11 +27583,11 @@
static const EventStreamProvider<Event> errorEvent =
const EventStreamProvider<Event>('error');
- bool get activated => JS("bool", "#.activated", this);
+ bool get activated native;
- bool get hasReading => JS("bool", "#.hasReading", this);
+ bool get hasReading native;
- num get timestamp => JS("num", "#.timestamp", this);
+ num get timestamp native;
void start() native;
@@ -28010,7 +27613,7 @@
static SensorErrorEvent _create_1(type, eventInitDict) =>
JS('SensorErrorEvent', 'new SensorErrorEvent(#,#)', type, eventInitDict);
- DomException get error => JS("DomException", "#.error", this);
+ DomException get error native;
}
// 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
@@ -28027,9 +27630,9 @@
const EventStreamProvider<Event>('error');
@JSName('scriptURL')
- String get scriptUrl => JS("String", "#.scriptURL", this);
+ String get scriptUrl native;
- String get state => JS("String", "#.state", this);
+ String get state native;
void postMessage(/*any*/ message, [List<Object>? transfer]) {
if (transfer != null) {
@@ -28063,7 +27666,7 @@
static const EventStreamProvider<MessageEvent> messageEvent =
const EventStreamProvider<MessageEvent>('message');
- ServiceWorker? get controller => JS("ServiceWorker", "#.controller", this);
+ ServiceWorker? get controller native;
Future<ServiceWorkerRegistration> get ready =>
promiseToFuture<ServiceWorkerRegistration>(JS("", "#.ready", this));
@@ -28112,10 +27715,9 @@
static const EventStreamProvider<MessageEvent> messageEvent =
const EventStreamProvider<MessageEvent>('message');
- Clients get clients => JS("Clients", "#.clients", this);
+ Clients get clients native;
- ServiceWorkerRegistration get registration =>
- JS("ServiceWorkerRegistration", "#.registration", this);
+ ServiceWorkerRegistration get registration native;
Future skipWaiting() => promiseToFuture(JS("", "#.skipWaiting()", this));
@@ -28146,26 +27748,23 @@
throw new UnsupportedError("Not supported");
}
- ServiceWorker? get active => JS("ServiceWorker", "#.active", this);
+ ServiceWorker? get active native;
- BackgroundFetchManager get backgroundFetch =>
- JS("BackgroundFetchManager", "#.backgroundFetch", this);
+ BackgroundFetchManager get backgroundFetch native;
- ServiceWorker? get installing => JS("ServiceWorker", "#.installing", this);
+ ServiceWorker? get installing native;
- NavigationPreloadManager get navigationPreload =>
- JS("NavigationPreloadManager", "#.navigationPreload", this);
+ NavigationPreloadManager get navigationPreload native;
- PaymentManager get paymentManager =>
- JS("PaymentManager", "#.paymentManager", this);
+ PaymentManager get paymentManager native;
- PushManager get pushManager => JS("PushManager", "#.pushManager", this);
+ PushManager get pushManager native;
- String get scope => JS("String", "#.scope", this);
+ String get scope native;
- SyncManager get sync => JS("SyncManager", "#.sync", this);
+ SyncManager get sync native;
- ServiceWorker? get waiting => JS("ServiceWorker", "#.waiting", this);
+ ServiceWorker? get waiting native;
Future<List<dynamic>> getNotifications([Map? filter]) {
var filter_dict = null;
@@ -28231,36 +27830,31 @@
throw new UnsupportedError("Not supported");
}
- bool get delegatesFocus => JS("bool", "#.delegatesFocus", this);
+ bool get delegatesFocus native;
- Element get host => JS("Element", "#.host", this);
+ Element get host native;
@JSName('innerHTML')
- String get innerHtml => JS("String", "#.innerHTML", this);
+ String get innerHtml native;
@JSName('innerHTML')
- set innerHtml(String value) {
- JS("void", "#.innerHTML = #", this, value);
- }
+ set innerHtml(String value) native;
- String get mode => JS("String", "#.mode", this);
+ String get mode native;
- ShadowRoot? get olderShadowRoot =>
- JS("ShadowRoot", "#.olderShadowRoot", this);
+ ShadowRoot? get olderShadowRoot native;
// From DocumentOrShadowRoot
- Element? get activeElement => JS("Element", "#.activeElement", this);
+ Element? get activeElement native;
- Element? get fullscreenElement => JS("Element", "#.fullscreenElement", this);
+ Element? get fullscreenElement native;
- Element? get pointerLockElement =>
- JS("Element", "#.pointerLockElement", this);
+ Element? get pointerLockElement native;
@Returns('_StyleSheetList')
@Creates('_StyleSheetList')
- List<StyleSheet> get styleSheets =>
- JS("_StyleSheetList", "#.styleSheets", this);
+ List<StyleSheet> get styleSheets native;
Element? elementFromPoint(int x, int y) native;
@@ -28319,7 +27913,7 @@
throw new UnsupportedError("Not supported");
}
- int get byteLength => JS("int", "#.byteLength", this);
+ int get byteLength native;
}
// 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
@@ -28346,7 +27940,7 @@
static SharedWorker _create_2(scriptURL) =>
JS('SharedWorker', 'new SharedWorker(#)', scriptURL);
- MessagePort get port => JS("MessagePort", "#.port", this);
+ MessagePort get port native;
Stream<Event> get onError => errorEvent.forTarget(this);
}
@@ -28374,7 +27968,7 @@
static const int TEMPORARY = 0;
- String get name => JS("String", "#.name", this);
+ String get name native;
void close() native;
@@ -28427,11 +28021,9 @@
*/
SlotElement.created() : super.created();
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
List<Node> assignedNodes([Map? options]) {
if (options != null) {
@@ -28463,44 +28055,33 @@
static const EventStreamProvider<Event> errorEvent =
const EventStreamProvider<Event>('error');
- num get appendWindowEnd => JS("num", "#.appendWindowEnd", this);
+ num get appendWindowEnd native;
- set appendWindowEnd(num value) {
- JS("void", "#.appendWindowEnd = #", this, value);
- }
+ set appendWindowEnd(num value) native;
- num get appendWindowStart => JS("num", "#.appendWindowStart", this);
+ num get appendWindowStart native;
- set appendWindowStart(num value) {
- JS("void", "#.appendWindowStart = #", this, value);
- }
+ set appendWindowStart(num value) native;
- AudioTrackList get audioTracks => JS("AudioTrackList", "#.audioTracks", this);
+ AudioTrackList get audioTracks native;
- TimeRanges get buffered => JS("TimeRanges", "#.buffered", this);
+ TimeRanges get buffered native;
- String get mode => JS("String", "#.mode", this);
+ String get mode native;
- set mode(String value) {
- JS("void", "#.mode = #", this, value);
- }
+ set mode(String value) native;
- num get timestampOffset => JS("num", "#.timestampOffset", this);
+ num get timestampOffset native;
- set timestampOffset(num value) {
- JS("void", "#.timestampOffset = #", this, value);
- }
+ set timestampOffset(num value) native;
- TrackDefaultList get trackDefaults =>
- JS("TrackDefaultList", "#.trackDefaults", this);
+ TrackDefaultList get trackDefaults native;
- set trackDefaults(TrackDefaultList value) {
- JS("void", "#.trackDefaults = #", this, value);
- }
+ set trackDefaults(TrackDefaultList value) native;
- bool get updating => JS("bool", "#.updating", this);
+ bool get updating native;
- VideoTrackList get videoTracks => JS("VideoTrackList", "#.videoTracks", this);
+ VideoTrackList get videoTracks native;
void abort() native;
@@ -28598,35 +28179,25 @@
*/
SourceElement.created() : super.created();
- String get media => JS("String", "#.media", this);
+ String get media native;
- set media(String value) {
- JS("void", "#.media = #", this, value);
- }
+ set media(String value) native;
- String get sizes => JS("String", "#.sizes", this);
+ String get sizes native;
- set sizes(String value) {
- JS("void", "#.sizes = #", this, value);
- }
+ set sizes(String value) native;
- String get src => JS("String", "#.src", this);
+ String get src native;
- set src(String value) {
- JS("void", "#.src = #", this, value);
- }
+ set src(String value) native;
- String get srcset => JS("String", "#.srcset", this);
+ String get srcset native;
- set srcset(String value) {
- JS("void", "#.srcset = #", this, value);
- }
+ set srcset(String value) native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
}
// 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
@@ -28668,17 +28239,13 @@
static SpeechGrammar _create_1() =>
JS('SpeechGrammar', 'new SpeechGrammar()');
- String get src => JS("String", "#.src", this);
+ String get src native;
- set src(String value) {
- JS("void", "#.src = #", this, value);
- }
+ set src(String value) native;
- num get weight => JS("num", "#.weight", this);
+ num get weight native;
- set weight(num value) {
- JS("void", "#.weight = #", this, value);
- }
+ set weight(num value) native;
}
// 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
@@ -28865,37 +28432,29 @@
static bool get supported => JS(
'bool', '!!(window.SpeechRecognition || window.webkitSpeechRecognition)');
- MediaStreamTrack? audioTrack;
+ MediaStreamTrack? get audioTrack native;
- bool get continuous => JS("bool", "#.continuous", this);
+ set audioTrack(MediaStreamTrack? value) native;
- set continuous(bool value) {
- JS("void", "#.continuous = #", this, value);
- }
+ bool get continuous native;
- SpeechGrammarList get grammars => JS("SpeechGrammarList", "#.grammars", this);
+ set continuous(bool value) native;
- set grammars(SpeechGrammarList value) {
- JS("void", "#.grammars = #", this, value);
- }
+ SpeechGrammarList get grammars native;
- bool get interimResults => JS("bool", "#.interimResults", this);
+ set grammars(SpeechGrammarList value) native;
- set interimResults(bool value) {
- JS("void", "#.interimResults = #", this, value);
- }
+ bool get interimResults native;
- String get lang => JS("String", "#.lang", this);
+ set interimResults(bool value) native;
- set lang(String value) {
- JS("void", "#.lang = #", this, value);
- }
+ String get lang native;
- int get maxAlternatives => JS("int", "#.maxAlternatives", this);
+ set lang(String value) native;
- set maxAlternatives(int value) {
- JS("void", "#.maxAlternatives = #", this, value);
- }
+ int get maxAlternatives native;
+
+ set maxAlternatives(int value) native;
void abort() native;
@@ -28953,9 +28512,9 @@
throw new UnsupportedError("Not supported");
}
- num get confidence => JS("num", "#.confidence", this);
+ num get confidence native;
- String get transcript => JS("String", "#.transcript", this);
+ String get transcript native;
}
// 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
@@ -28984,9 +28543,9 @@
static SpeechRecognitionError _create_2(type) =>
JS('SpeechRecognitionError', 'new SpeechRecognitionError(#)', type);
- String get error => JS("String", "#.error", this);
+ String get error native;
- String get message => JS("String", "#.message", this);
+ String get message native;
}
// 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
@@ -29015,16 +28574,15 @@
static SpeechRecognitionEvent _create_2(type) =>
JS('SpeechRecognitionEvent', 'new SpeechRecognitionEvent(#)', type);
- Document? get emma => JS("Document", "#.emma", this);
+ Document? get emma native;
- Document? get interpretation => JS("Document", "#.interpretation", this);
+ Document? get interpretation native;
- int get resultIndex => JS("int", "#.resultIndex", this);
+ int get resultIndex native;
@Returns('_SpeechRecognitionResultList|Null')
@Creates('_SpeechRecognitionResultList')
- List<SpeechRecognitionResult>? get results =>
- JS("_SpeechRecognitionResultList", "#.results", this);
+ List<SpeechRecognitionResult>? get results native;
}
// 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
@@ -29038,9 +28596,9 @@
throw new UnsupportedError("Not supported");
}
- bool get isFinal => JS("bool", "#.isFinal", this);
+ bool get isFinal native;
- int get length => JS("int", "#.length", this);
+ int get length native;
SpeechRecognitionAlternative item(int index) native;
}
@@ -29061,11 +28619,11 @@
throw new UnsupportedError("Not supported");
}
- bool get paused => JS("bool", "#.paused", this);
+ bool get paused native;
- bool get pending => JS("bool", "#.pending", this);
+ bool get pending native;
- bool get speaking => JS("bool", "#.speaking", this);
+ bool get speaking native;
void cancel() native;
@@ -29089,14 +28647,13 @@
throw new UnsupportedError("Not supported");
}
- int get charIndex => JS("int", "#.charIndex", this);
+ int get charIndex native;
- num get elapsedTime => JS("num", "#.elapsedTime", this);
+ num get elapsedTime native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- SpeechSynthesisUtterance get utterance =>
- JS("SpeechSynthesisUtterance", "#.utterance", this);
+ SpeechSynthesisUtterance get utterance native;
}
// 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
@@ -29183,37 +28740,29 @@
static SpeechSynthesisUtterance _create_2() =>
JS('SpeechSynthesisUtterance', 'new SpeechSynthesisUtterance()');
- String get lang => JS("String", "#.lang", this);
+ String get lang native;
- set lang(String value) {
- JS("void", "#.lang = #", this, value);
- }
+ set lang(String value) native;
- num get pitch => JS("num", "#.pitch", this);
+ num get pitch native;
- set pitch(num value) {
- JS("void", "#.pitch = #", this, value);
- }
+ set pitch(num value) native;
- num get rate => JS("num", "#.rate", this);
+ num get rate native;
- set rate(num value) {
- JS("void", "#.rate = #", this, value);
- }
+ set rate(num value) native;
- String get text => JS("String", "#.text", this);
+ String get text native;
- set text(String value) {
- JS("void", "#.text = #", this, value);
- }
+ set text(String value) native;
- SpeechSynthesisVoice? voice;
+ SpeechSynthesisVoice? get voice native;
- num get volume => JS("num", "#.volume", this);
+ set voice(SpeechSynthesisVoice? value) native;
- set volume(num value) {
- JS("void", "#.volume = #", this, value);
- }
+ num get volume native;
+
+ set volume(num value) native;
/// Stream of `boundary` events handled by this [SpeechSynthesisUtterance].
Stream<SpeechSynthesisEvent> get onBoundary => boundaryEvent.forTarget(this);
@@ -29248,16 +28797,16 @@
}
@JSName('default')
- bool get defaultValue => JS("bool", "#.default", this);
+ bool get defaultValue native;
- String get lang => JS("String", "#.lang", this);
+ String get lang native;
- bool get localService => JS("bool", "#.localService", this);
+ bool get localService native;
- String get name => JS("String", "#.name", this);
+ String get name native;
@JSName('voiceURI')
- String get voiceUri => JS("String", "#.voiceURI", this);
+ String get voiceUri native;
}
// 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
@@ -29270,15 +28819,15 @@
throw new UnsupportedError("Not supported");
}
- bool get collapsed => JS("bool", "#.collapsed", this);
+ bool get collapsed native;
- Node get endContainer => JS("Node", "#.endContainer", this);
+ Node get endContainer native;
- int get endOffset => JS("int", "#.endOffset", this);
+ int get endOffset native;
- Node get startContainer => JS("Node", "#.startContainer", this);
+ Node get startContainer native;
- int get startOffset => JS("int", "#.startOffset", this);
+ int get startOffset native;
}
// 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
@@ -29374,7 +28923,7 @@
}
@JSName('length')
- int get _length => JS("int", "#.length", this);
+ int get _length native;
@JSName('clear')
void _clear() native;
@@ -29433,15 +28982,15 @@
static StorageEvent _create_2(type) =>
JS('StorageEvent', 'new StorageEvent(#)', type);
- String? get key => JS("String", "#.key", this);
+ String? get key native;
- String? get newValue => JS("String", "#.newValue", this);
+ String? get newValue native;
- String? get oldValue => JS("String", "#.oldValue", this);
+ String? get oldValue native;
- Storage? get storageArea => JS("Storage", "#.storageArea", this);
+ Storage? get storageArea native;
- String get url => JS("String", "#.url", this);
+ String get url native;
@JSName('initStorageEvent')
void _initStorageEvent(
@@ -29511,25 +29060,19 @@
*/
StyleElement.created() : super.created();
- bool get disabled => JS("bool", "#.disabled", this);
+ bool get disabled native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ set disabled(bool value) native;
- String get media => JS("String", "#.media", this);
+ String get media native;
- set media(String value) {
- JS("void", "#.media = #", this, value);
- }
+ set media(String value) native;
- StyleSheet? get sheet => JS("StyleSheet", "#.sheet", this);
+ StyleSheet? get sheet native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
}
// 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
@@ -29542,7 +29085,7 @@
throw new UnsupportedError("Not supported");
}
- String get type => JS("String", "#.type", this);
+ String get type native;
bool matchMedium(String? mediaquery) native;
}
@@ -29593,24 +29136,21 @@
throw new UnsupportedError("Not supported");
}
- bool get disabled => JS("bool", "#.disabled", this);
+ bool get disabled native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ set disabled(bool value) native;
- String? get href => JS("String", "#.href", this);
+ String? get href native;
- MediaList get media => JS("MediaList", "#.media", this);
+ MediaList get media native;
- Node? get ownerNode => JS("Node", "#.ownerNode", this);
+ Node? get ownerNode native;
- StyleSheet? get parentStyleSheet =>
- JS("StyleSheet", "#.parentStyleSheet", this);
+ StyleSheet? get parentStyleSheet native;
- String? get title => JS("String", "#.title", this);
+ String? get title native;
- String get type => JS("String", "#.type", this);
+ String get type native;
}
// 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
@@ -29630,9 +29170,9 @@
static SyncEvent _create_1(type, init) =>
JS('SyncEvent', 'new SyncEvent(#,#)', type, init);
- bool get lastChance => JS("bool", "#.lastChance", this);
+ bool get lastChance native;
- String get tag => JS("String", "#.tag", this);
+ String get tag native;
}
// 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
@@ -29698,25 +29238,19 @@
*/
TableCellElement.created() : super.created();
- int get cellIndex => JS("int", "#.cellIndex", this);
+ int get cellIndex native;
- int get colSpan => JS("int", "#.colSpan", this);
+ int get colSpan native;
- set colSpan(int value) {
- JS("void", "#.colSpan = #", this, value);
- }
+ set colSpan(int value) native;
- String get headers => JS("String", "#.headers", this);
+ String get headers native;
- set headers(String value) {
- JS("void", "#.headers = #", this, value);
- }
+ set headers(String value) native;
- int get rowSpan => JS("int", "#.rowSpan", this);
+ int get rowSpan native;
- set rowSpan(int value) {
- JS("void", "#.rowSpan = #", this, value);
- }
+ set rowSpan(int value) native;
}
// 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
@@ -29741,11 +29275,9 @@
*/
TableColElement.created() : super.created();
- int get span => JS("int", "#.span", this);
+ int get span native;
- set span(int value) {
- JS("void", "#.span = #", this, value);
- }
+ set span(int value) native;
}
// 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
@@ -29813,21 +29345,27 @@
*/
TableElement.created() : super.created();
- TableCaptionElement? caption;
+ TableCaptionElement? get caption native;
+
+ set caption(TableCaptionElement? value) native;
@JSName('rows')
@Returns('HtmlCollection')
@Creates('HtmlCollection')
- List<Node> get _rows => JS("HtmlCollection", "#.rows", this);
+ List<Node> get _rows native;
@JSName('tBodies')
@Returns('HtmlCollection')
@Creates('HtmlCollection')
- List<Node> get _tBodies => JS("HtmlCollection", "#.tBodies", this);
+ List<Node> get _tBodies native;
- TableSectionElement? tFoot;
+ TableSectionElement? get tFoot native;
- TableSectionElement? tHead;
+ set tFoot(TableSectionElement? value) native;
+
+ TableSectionElement? get tHead native;
+
+ set tHead(TableSectionElement? value) native;
@JSName('createCaption')
TableCaptionElement _createCaption() native;
@@ -29903,11 +29441,11 @@
@JSName('cells')
@Returns('HtmlCollection')
@Creates('HtmlCollection')
- List<Node> get _cells => JS("HtmlCollection", "#.cells", this);
+ List<Node> get _cells native;
- int get rowIndex => JS("int", "#.rowIndex", this);
+ int get rowIndex native;
- int get sectionRowIndex => JS("int", "#.sectionRowIndex", this);
+ int get sectionRowIndex native;
void deleteCell(int index) native;
@@ -29959,7 +29497,7 @@
@JSName('rows')
@Returns('HtmlCollection')
@Creates('HtmlCollection')
- List<Node> get _rows => JS("HtmlCollection", "#.rows", this);
+ List<Node> get _rows native;
void deleteRow(int index) native;
@@ -29977,16 +29515,16 @@
throw new UnsupportedError("Not supported");
}
- String get containerId => JS("String", "#.containerId", this);
+ String get containerId native;
- String get containerName => JS("String", "#.containerName", this);
+ String get containerName native;
- String get containerSrc => JS("String", "#.containerSrc", this);
+ String get containerSrc native;
- String get containerType => JS("String", "#.containerType", this);
+ String get containerType native;
@JSName('scriptURL')
- String get scriptUrl => JS("String", "#.scriptURL", this);
+ String get scriptUrl native;
}
// 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
@@ -30014,7 +29552,7 @@
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('template');
- DocumentFragment get content => JS("DocumentFragment", "#.content", this);
+ DocumentFragment get content native;
/**
* An override to place the contents into content rather than as child nodes.
@@ -30051,9 +29589,9 @@
throw new UnsupportedError("Not supported");
}
- SlotElement? get assignedSlot => JS("SlotElement", "#.assignedSlot", this);
+ SlotElement? get assignedSlot native;
- String get wholeText => JS("String", "#.wholeText", this);
+ String get wholeText native;
@Returns('NodeList')
@Creates('NodeList')
@@ -30084,130 +29622,94 @@
*/
TextAreaElement.created() : super.created();
- String get autocapitalize => JS("String", "#.autocapitalize", this);
+ String get autocapitalize native;
- set autocapitalize(String value) {
- JS("void", "#.autocapitalize = #", this, value);
- }
+ set autocapitalize(String value) native;
- bool get autofocus => JS("bool", "#.autofocus", this);
+ bool get autofocus native;
- set autofocus(bool value) {
- JS("void", "#.autofocus = #", this, value);
- }
+ set autofocus(bool value) native;
- int get cols => JS("int", "#.cols", this);
+ int get cols native;
- set cols(int value) {
- JS("void", "#.cols = #", this, value);
- }
+ set cols(int value) native;
- String get defaultValue => JS("String", "#.defaultValue", this);
+ String get defaultValue native;
- set defaultValue(String value) {
- JS("void", "#.defaultValue = #", this, value);
- }
+ set defaultValue(String value) native;
- String get dirName => JS("String", "#.dirName", this);
+ String get dirName native;
- set dirName(String value) {
- JS("void", "#.dirName = #", this, value);
- }
+ set dirName(String value) native;
- bool get disabled => JS("bool", "#.disabled", this);
+ bool get disabled native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ set disabled(bool value) native;
- FormElement? get form => JS("FormElement", "#.form", this);
+ FormElement? get form native;
@Unstable()
@Returns('NodeList')
@Creates('NodeList')
- List<Node> get labels => JS("NodeList", "#.labels", this);
+ List<Node> get labels native;
- int get maxLength => JS("int", "#.maxLength", this);
+ int get maxLength native;
- set maxLength(int value) {
- JS("void", "#.maxLength = #", this, value);
- }
+ set maxLength(int value) native;
- int get minLength => JS("int", "#.minLength", this);
+ int get minLength native;
- set minLength(int value) {
- JS("void", "#.minLength = #", this, value);
- }
+ set minLength(int value) native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- String get placeholder => JS("String", "#.placeholder", this);
+ String get placeholder native;
- set placeholder(String value) {
- JS("void", "#.placeholder = #", this, value);
- }
+ set placeholder(String value) native;
- bool get readOnly => JS("bool", "#.readOnly", this);
+ bool get readOnly native;
- set readOnly(bool value) {
- JS("void", "#.readOnly = #", this, value);
- }
+ set readOnly(bool value) native;
- bool get required => JS("bool", "#.required", this);
+ bool get required native;
- set required(bool value) {
- JS("void", "#.required = #", this, value);
- }
+ set required(bool value) native;
- int get rows => JS("int", "#.rows", this);
+ int get rows native;
- set rows(int value) {
- JS("void", "#.rows = #", this, value);
- }
+ set rows(int value) native;
- String get selectionDirection => JS("String", "#.selectionDirection", this);
+ String get selectionDirection native;
- set selectionDirection(String value) {
- JS("void", "#.selectionDirection = #", this, value);
- }
+ set selectionDirection(String value) native;
- int get selectionEnd => JS("int", "#.selectionEnd", this);
+ int get selectionEnd native;
- set selectionEnd(int value) {
- JS("void", "#.selectionEnd = #", this, value);
- }
+ set selectionEnd(int value) native;
- int get selectionStart => JS("int", "#.selectionStart", this);
+ int get selectionStart native;
- set selectionStart(int value) {
- JS("void", "#.selectionStart = #", this, value);
- }
+ set selectionStart(int value) native;
- int get textLength => JS("int", "#.textLength", this);
+ int get textLength native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- String get validationMessage => JS("String", "#.validationMessage", this);
+ String get validationMessage native;
- ValidityState get validity => JS("ValidityState", "#.validity", this);
+ ValidityState get validity native;
- String get value => JS("String", "#.value", this);
+ String get value native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(String value) native;
- bool get willValidate => JS("bool", "#.willValidate", this);
+ bool get willValidate native;
- String get wrap => JS("String", "#.wrap", this);
+ String get wrap native;
- set wrap(String value) {
- JS("void", "#.wrap = #", this, value);
- }
+ set wrap(String value) native;
bool checkValidity() native;
@@ -30267,7 +29769,7 @@
throw new UnsupportedError("Not supported");
}
- String get data => JS("String", "#.data", this);
+ String get data native;
@JSName('initTextEvent')
void _initTextEvent(String? type, bool? bubbles, bool? cancelable,
@@ -30284,31 +29786,29 @@
throw new UnsupportedError("Not supported");
}
- num get actualBoundingBoxAscent =>
- JS("num", "#.actualBoundingBoxAscent", this);
+ num get actualBoundingBoxAscent native;
- num get actualBoundingBoxDescent =>
- JS("num", "#.actualBoundingBoxDescent", this);
+ num get actualBoundingBoxDescent native;
- num get actualBoundingBoxLeft => JS("num", "#.actualBoundingBoxLeft", this);
+ num get actualBoundingBoxLeft native;
- num get actualBoundingBoxRight => JS("num", "#.actualBoundingBoxRight", this);
+ num get actualBoundingBoxRight native;
- num get alphabeticBaseline => JS("num", "#.alphabeticBaseline", this);
+ num get alphabeticBaseline native;
- num get emHeightAscent => JS("num", "#.emHeightAscent", this);
+ num get emHeightAscent native;
- num get emHeightDescent => JS("num", "#.emHeightDescent", this);
+ num get emHeightDescent native;
- num get fontBoundingBoxAscent => JS("num", "#.fontBoundingBoxAscent", this);
+ num get fontBoundingBoxAscent native;
- num get fontBoundingBoxDescent => JS("num", "#.fontBoundingBoxDescent", this);
+ num get fontBoundingBoxDescent native;
- num get hangingBaseline => JS("num", "#.hangingBaseline", this);
+ num get hangingBaseline native;
- num get ideographicBaseline => JS("num", "#.ideographicBaseline", this);
+ num get ideographicBaseline native;
- num get width => JS("num", "#.width", this);
+ num get width native;
}
// 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
@@ -30330,24 +29830,21 @@
static const EventStreamProvider<Event> cueChangeEvent =
const EventStreamProvider<Event>('cuechange');
- TextTrackCueList? get activeCues =>
- JS("TextTrackCueList", "#.activeCues", this);
+ TextTrackCueList? get activeCues native;
- TextTrackCueList? get cues => JS("TextTrackCueList", "#.cues", this);
+ TextTrackCueList? get cues native;
- String get id => JS("String", "#.id", this);
+ String get id native;
- String get kind => JS("String", "#.kind", this);
+ String get kind native;
- String get label => JS("String", "#.label", this);
+ String get label native;
- String get language => JS("String", "#.language", this);
+ String get language native;
- String get mode => JS("String", "#.mode", this);
+ String get mode native;
- set mode(String value) {
- JS("void", "#.mode = #", this, value);
- }
+ set mode(String value) native;
void addCue(TextTrackCue cue) native;
@@ -30385,31 +29882,23 @@
static const EventStreamProvider<Event> exitEvent =
const EventStreamProvider<Event>('exit');
- num get endTime => JS("num", "#.endTime", this);
+ num get endTime native;
- set endTime(num value) {
- JS("void", "#.endTime = #", this, value);
- }
+ set endTime(num value) native;
- String get id => JS("String", "#.id", this);
+ String get id native;
- set id(String value) {
- JS("void", "#.id = #", this, value);
- }
+ set id(String value) native;
- bool get pauseOnExit => JS("bool", "#.pauseOnExit", this);
+ bool get pauseOnExit native;
- set pauseOnExit(bool value) {
- JS("void", "#.pauseOnExit = #", this, value);
- }
+ set pauseOnExit(bool value) native;
- num get startTime => JS("num", "#.startTime", this);
+ num get startTime native;
- set startTime(num value) {
- JS("void", "#.startTime = #", this, value);
- }
+ set startTime(num value) native;
- TextTrack? get track => JS("TextTrack", "#.track", this);
+ TextTrack? get track native;
/// Stream of `enter` events handled by this [TextTrackCue].
Stream<Event> get onEnter => enterEvent.forTarget(this);
@@ -30575,11 +30064,9 @@
*/
TimeElement.created() : super.created();
- String get dateTime => JS("String", "#.dateTime", this);
+ String get dateTime native;
- set dateTime(String value) {
- JS("void", "#.dateTime = #", this, value);
- }
+ set dateTime(String value) native;
}
// 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
@@ -30593,7 +30080,7 @@
throw new UnsupportedError("Not supported");
}
- int get length => JS("int", "#.length", this);
+ int get length native;
double end(int index) native;
@@ -30647,42 +30134,42 @@
static Touch _create_1(initDict) => JS('Touch', 'new Touch(#)', initDict);
@JSName('clientX')
- num get _clientX => JS("num", "#.clientX", this);
+ num get _clientX native;
@JSName('clientY')
- num get _clientY => JS("num", "#.clientY", this);
+ num get _clientY native;
- num get force => JS("num", "#.force", this);
+ num get force native;
- int get identifier => JS("int", "#.identifier", this);
+ int get identifier native;
@JSName('pageX')
- num get _pageX => JS("num", "#.pageX", this);
+ num get _pageX native;
@JSName('pageY')
- num get _pageY => JS("num", "#.pageY", this);
+ num get _pageY native;
@JSName('radiusX')
- num get _radiusX => JS("num", "#.radiusX", this);
+ num get _radiusX native;
@JSName('radiusY')
- num get _radiusY => JS("num", "#.radiusY", this);
+ num get _radiusY native;
- String? get region => JS("String", "#.region", this);
+ String? get region native;
- num get rotationAngle => JS("num", "#.rotationAngle", this);
+ num get rotationAngle native;
@JSName('screenX')
- num get _screenX => JS("num", "#.screenX", this);
+ num get _screenX native;
@JSName('screenY')
- num get _screenY => JS("num", "#.screenY", this);
+ num get _screenY native;
EventTarget? get target => _convertNativeToDart_EventTarget(this._get_target);
@JSName('target')
@Creates('Element|Document')
@Returns('Element|Document')
- dynamic get _get_target => JS("", "#.target", this);
+ dynamic get _get_target native;
// As of Chrome 37, these all changed from long to double. This code
// preserves backwards compatibility for the time being.
@@ -30734,19 +30221,19 @@
static TouchEvent _create_2(type) =>
JS('TouchEvent', 'new TouchEvent(#)', type);
- bool get altKey => JS("bool", "#.altKey", this);
+ bool get altKey native;
- TouchList get changedTouches => JS("TouchList", "#.changedTouches", this);
+ TouchList get changedTouches native;
- bool get ctrlKey => JS("bool", "#.ctrlKey", this);
+ bool get ctrlKey native;
- bool get metaKey => JS("bool", "#.metaKey", this);
+ bool get metaKey native;
- bool get shiftKey => JS("bool", "#.shiftKey", this);
+ bool get shiftKey native;
- TouchList get targetTouches => JS("TouchList", "#.targetTouches", this);
+ TouchList get targetTouches native;
- TouchList get touches => JS("TouchList", "#.touches", this);
+ TouchList get touches native;
/**
* Checks if touch events supported on the current platform.
@@ -30856,15 +30343,15 @@
label,
kinds);
- String get byteStreamTrackID => JS("String", "#.byteStreamTrackID", this);
+ String get byteStreamTrackID native;
- Object get kinds => JS("Object", "#.kinds", this);
+ Object get kinds native;
- String get label => JS("String", "#.label", this);
+ String get label native;
- String get language => JS("String", "#.language", this);
+ String get language native;
- String get type => JS("String", "#.type", this);
+ String get type native;
}
// 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
@@ -30888,7 +30375,7 @@
static TrackDefaultList _create_2() =>
JS('TrackDefaultList', 'new TrackDefaultList()');
- int get length => JS("int", "#.length", this);
+ int get length native;
TrackDefault item(int index) native;
}
@@ -30926,40 +30413,30 @@
static const int NONE = 0;
@JSName('default')
- bool get defaultValue => JS("bool", "#.default", this);
+ bool get defaultValue native;
@JSName('default')
- set defaultValue(bool value) {
- JS("void", "#.default = #", this, value);
- }
+ set defaultValue(bool value) native;
- String get kind => JS("String", "#.kind", this);
+ String get kind native;
- set kind(String value) {
- JS("void", "#.kind = #", this, value);
- }
+ set kind(String value) native;
- String get label => JS("String", "#.label", this);
+ String get label native;
- set label(String value) {
- JS("void", "#.label = #", this, value);
- }
+ set label(String value) native;
- int get readyState => JS("int", "#.readyState", this);
+ int get readyState native;
- String get src => JS("String", "#.src", this);
+ String get src native;
- set src(String value) {
- JS("void", "#.src = #", this, value);
- }
+ set src(String value) native;
- String get srclang => JS("String", "#.srclang", this);
+ String get srclang native;
- set srclang(String value) {
- JS("void", "#.srclang = #", this, value);
- }
+ set srclang(String value) native;
- TextTrack get track => JS("TextTrack", "#.track", this);
+ TextTrack get track native;
}
// 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
@@ -30986,7 +30463,7 @@
JS('TrackEvent', 'new TrackEvent(#)', type);
@Creates('Null')
- Object? get track => JS("Object", "#.track", this);
+ Object? get track native;
}
// 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
@@ -31011,11 +30488,11 @@
static TransitionEvent _create_2(type) =>
JS('TransitionEvent', 'new TransitionEvent(#)', type);
- num get elapsedTime => JS("num", "#.elapsedTime", this);
+ num get elapsedTime native;
- String get propertyName => JS("String", "#.propertyName", this);
+ String get propertyName native;
- String get pseudoElement => JS("String", "#.pseudoElement", this);
+ String get pseudoElement native;
}
// 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
@@ -31032,17 +30509,15 @@
throw new UnsupportedError("Not supported");
}
- Node get currentNode => JS("Node", "#.currentNode", this);
+ Node get currentNode native;
- set currentNode(Node value) {
- JS("void", "#.currentNode = #", this, value);
- }
+ set currentNode(Node value) native;
- NodeFilter? get filter => JS("NodeFilter", "#.filter", this);
+ NodeFilter? get filter native;
- Node get root => JS("Node", "#.root", this);
+ Node get root native;
- int get whatToShow => JS("int", "#.whatToShow", this);
+ int get whatToShow native;
Node? firstChild() native;
@@ -31139,20 +30614,19 @@
JS('UIEvent', 'new UIEvent(#,#)', type, eventInitDict);
static UIEvent _create_2(type) => JS('UIEvent', 'new UIEvent(#)', type);
- int get detail => JS("int", "#.detail", this);
+ int get detail native;
- InputDeviceCapabilities? get sourceCapabilities =>
- JS("InputDeviceCapabilities", "#.sourceCapabilities", this);
+ InputDeviceCapabilities? get sourceCapabilities native;
WindowBase? get view => _convertNativeToDart_Window(this._get_view);
@JSName('view')
@Creates('Window|=Object')
@Returns('Window|=Object')
- dynamic get _get_view => JS("", "#.view", this);
+ dynamic get _get_view native;
@JSName('which')
@Unstable()
- int get _which => JS("int", "#.which", this);
+ int get _which native;
@JSName('initUIEvent')
void _initUIEvent(String type, bool bubbles, bool cancelable, Window? view,
@@ -31251,70 +30725,49 @@
throw new UnsupportedError("Not supported");
}
- String get hash => JS("String", "#.hash", this);
+ String get hash native;
- set hash(String value) {
- JS("void", "#.hash = #", this, value);
- }
+ set hash(String value) native;
- String get host => JS("String", "#.host", this);
+ String get host native;
- set host(String value) {
- JS("void", "#.host = #", this, value);
- }
+ set host(String value) native;
- String get hostname => JS("String", "#.hostname", this);
+ String get hostname native;
- set hostname(String value) {
- JS("void", "#.hostname = #", this, value);
- }
+ set hostname(String value) native;
- String get href => JS("String", "#.href", this);
+ String get href native;
- set href(String value) {
- JS("void", "#.href = #", this, value);
- }
+ set href(String value) native;
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
- String get password => JS("String", "#.password", this);
+ String get password native;
- set password(String value) {
- JS("void", "#.password = #", this, value);
- }
+ set password(String value) native;
- String get pathname => JS("String", "#.pathname", this);
+ String get pathname native;
- set pathname(String value) {
- JS("void", "#.pathname = #", this, value);
- }
+ set pathname(String value) native;
- String get port => JS("String", "#.port", this);
+ String get port native;
- set port(String value) {
- JS("void", "#.port = #", this, value);
- }
+ set port(String value) native;
- String get protocol => JS("String", "#.protocol", this);
+ String get protocol native;
- set protocol(String value) {
- JS("void", "#.protocol = #", this, value);
- }
+ set protocol(String value) native;
- String get search => JS("String", "#.search", this);
+ String get search native;
- set search(String value) {
- JS("void", "#.search = #", this, value);
- }
+ set search(String value) native;
- UrlSearchParams get searchParams =>
- JS("UrlSearchParams", "#.searchParams", this);
+ UrlSearchParams get searchParams native;
- String get username => JS("String", "#.username", this);
+ String get username native;
- set username(String value) {
- JS("void", "#.username = #", this, value);
- }
+ set username(String value) native;
}
// 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
@@ -31362,23 +30815,23 @@
throw new UnsupportedError("Not supported");
}
- String get hash => JS("String", "#.hash", this);
+ String get hash native;
- String get host => JS("String", "#.host", this);
+ String get host native;
- String get hostname => JS("String", "#.hostname", this);
+ String get hostname native;
- String get href => JS("String", "#.href", this);
+ String get href native;
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
- String get pathname => JS("String", "#.pathname", this);
+ String get pathname native;
- String get port => JS("String", "#.port", this);
+ String get port native;
- String get protocol => JS("String", "#.protocol", this);
+ String get protocol native;
- String get search => JS("String", "#.search", this);
+ String get search native;
}
// 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
@@ -31417,9 +30870,9 @@
throw new UnsupportedError("Not supported");
}
- String get deviceName => JS("String", "#.deviceName", this);
+ String get deviceName native;
- bool get isExternal => JS("bool", "#.isExternal", this);
+ bool get isExternal native;
Future requestSession([Map? options]) {
var options_dict = null;
@@ -31455,7 +30908,7 @@
static VRDeviceEvent _create_1(type, eventInitDict) =>
JS('VRDeviceEvent', 'new VRDeviceEvent(#,#)', type, eventInitDict);
- VRDevice get device => JS("VRDevice", "#.device", this);
+ VRDevice get device native;
}
// 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
@@ -31468,29 +30921,23 @@
throw new UnsupportedError("Not supported");
}
- VRDisplayCapabilities get capabilities =>
- JS("VRDisplayCapabilities", "#.capabilities", this);
+ VRDisplayCapabilities get capabilities native;
- num get depthFar => JS("num", "#.depthFar", this);
+ num get depthFar native;
- set depthFar(num value) {
- JS("void", "#.depthFar = #", this, value);
- }
+ set depthFar(num value) native;
- num get depthNear => JS("num", "#.depthNear", this);
+ num get depthNear native;
- set depthNear(num value) {
- JS("void", "#.depthNear = #", this, value);
- }
+ set depthNear(num value) native;
- int get displayId => JS("int", "#.displayId", this);
+ int get displayId native;
- String get displayName => JS("String", "#.displayName", this);
+ String get displayName native;
- bool get isPresenting => JS("bool", "#.isPresenting", this);
+ bool get isPresenting native;
- VRStageParameters get stageParameters =>
- JS("VRStageParameters", "#.stageParameters", this);
+ VRStageParameters get stageParameters native;
void cancelAnimationFrame(int handle) native;
@@ -31520,13 +30967,13 @@
throw new UnsupportedError("Not supported");
}
- bool get canPresent => JS("bool", "#.canPresent", this);
+ bool get canPresent native;
- bool get hasExternalDisplay => JS("bool", "#.hasExternalDisplay", this);
+ bool get hasExternalDisplay native;
- bool get hasPosition => JS("bool", "#.hasPosition", this);
+ bool get hasPosition native;
- int get maxLayers => JS("int", "#.maxLayers", this);
+ int get maxLayers native;
}
// 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
@@ -31551,9 +30998,9 @@
static VRDisplayEvent _create_2(type) =>
JS('VRDisplayEvent', 'new VRDisplayEvent(#)', type);
- VRDisplay get display => JS("VRDisplay", "#.display", this);
+ VRDisplay get display native;
- String get reason => JS("String", "#.reason", this);
+ String get reason native;
}
// 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
@@ -31566,11 +31013,11 @@
throw new UnsupportedError("Not supported");
}
- Float32List get offset => JS("Float32List", "#.offset", this);
+ Float32List get offset native;
- int get renderHeight => JS("int", "#.renderHeight", this);
+ int get renderHeight native;
- int get renderWidth => JS("int", "#.renderWidth", this);
+ int get renderWidth native;
}
// 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
@@ -31588,18 +31035,15 @@
}
static VRFrameData _create_1() => JS('VRFrameData', 'new VRFrameData()');
- Float32List get leftProjectionMatrix =>
- JS("Float32List", "#.leftProjectionMatrix", this);
+ Float32List get leftProjectionMatrix native;
- Float32List get leftViewMatrix => JS("Float32List", "#.leftViewMatrix", this);
+ Float32List get leftViewMatrix native;
- VRPose get pose => JS("VRPose", "#.pose", this);
+ VRPose get pose native;
- Float32List get rightProjectionMatrix =>
- JS("Float32List", "#.rightProjectionMatrix", this);
+ Float32List get rightProjectionMatrix native;
- Float32List get rightViewMatrix =>
- JS("Float32List", "#.rightViewMatrix", this);
+ Float32List get rightViewMatrix native;
}
// 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
@@ -31612,9 +31056,9 @@
throw new UnsupportedError("Not supported");
}
- VRStageBounds? get bounds => JS("VRStageBounds", "#.bounds", this);
+ VRStageBounds? get bounds native;
- num get emulatedHeight => JS("num", "#.emulatedHeight", this);
+ num get emulatedHeight native;
}
// 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
@@ -31627,21 +31071,17 @@
throw new UnsupportedError("Not supported");
}
- Float32List? get angularAcceleration =>
- JS("Float32List", "#.angularAcceleration", this);
+ Float32List? get angularAcceleration native;
- Float32List? get angularVelocity =>
- JS("Float32List", "#.angularVelocity", this);
+ Float32List? get angularVelocity native;
- Float32List? get linearAcceleration =>
- JS("Float32List", "#.linearAcceleration", this);
+ Float32List? get linearAcceleration native;
- Float32List? get linearVelocity =>
- JS("Float32List", "#.linearVelocity", this);
+ Float32List? get linearVelocity native;
- Float32List? get orientation => JS("Float32List", "#.orientation", this);
+ Float32List? get orientation native;
- Float32List? get position => JS("Float32List", "#.position", this);
+ Float32List? get position native;
}
// 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
@@ -31660,21 +31100,17 @@
static const EventStreamProvider<Event> focusEvent =
const EventStreamProvider<Event>('focus');
- num get depthFar => JS("num", "#.depthFar", this);
+ num get depthFar native;
- set depthFar(num value) {
- JS("void", "#.depthFar = #", this, value);
- }
+ set depthFar(num value) native;
- num get depthNear => JS("num", "#.depthNear", this);
+ num get depthNear native;
- set depthNear(num value) {
- JS("void", "#.depthNear = #", this, value);
- }
+ set depthNear(num value) native;
- VRDevice get device => JS("VRDevice", "#.device", this);
+ VRDevice get device native;
- bool get exclusive => JS("bool", "#.exclusive", this);
+ bool get exclusive native;
Future end() => promiseToFuture(JS("", "#.end()", this));
@@ -31709,7 +31145,7 @@
static VRSessionEvent _create_1(type, eventInitDict) =>
JS('VRSessionEvent', 'new VRSessionEvent(#,#)', type, eventInitDict);
- VRSession get session => JS("VRSession", "#.session", this);
+ VRSession get session native;
}
// 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
@@ -31722,8 +31158,7 @@
throw new UnsupportedError("Not supported");
}
- List<VRStageBoundsPoint> get geometry =>
- JS("List<VRStageBoundsPoint>", "#.geometry", this);
+ List<VRStageBoundsPoint> get geometry native;
}
// 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
@@ -31736,9 +31171,9 @@
throw new UnsupportedError("Not supported");
}
- num get x => JS("num", "#.x", this);
+ num get x native;
- num get z => JS("num", "#.z", this);
+ num get z native;
}
// 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
@@ -31751,12 +31186,11 @@
throw new UnsupportedError("Not supported");
}
- Float32List get sittingToStandingTransform =>
- JS("Float32List", "#.sittingToStandingTransform", this);
+ Float32List get sittingToStandingTransform native;
- num get sizeX => JS("num", "#.sizeX", this);
+ num get sizeX native;
- num get sizeZ => JS("num", "#.sizeZ", this);
+ num get sizeZ native;
}
// 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
@@ -31769,27 +31203,27 @@
throw new UnsupportedError("Not supported");
}
- bool get badInput => JS("bool", "#.badInput", this);
+ bool get badInput native;
- bool get customError => JS("bool", "#.customError", this);
+ bool get customError native;
- bool get patternMismatch => JS("bool", "#.patternMismatch", this);
+ bool get patternMismatch native;
- bool get rangeOverflow => JS("bool", "#.rangeOverflow", this);
+ bool get rangeOverflow native;
- bool get rangeUnderflow => JS("bool", "#.rangeUnderflow", this);
+ bool get rangeUnderflow native;
- bool get stepMismatch => JS("bool", "#.stepMismatch", this);
+ bool get stepMismatch native;
- bool get tooLong => JS("bool", "#.tooLong", this);
+ bool get tooLong native;
- bool get tooShort => JS("bool", "#.tooShort", this);
+ bool get tooShort native;
- bool get typeMismatch => JS("bool", "#.typeMismatch", this);
+ bool get typeMismatch native;
- bool get valid => JS("bool", "#.valid", this);
+ bool get valid native;
- bool get valueMissing => JS("bool", "#.valueMissing", this);
+ bool get valueMissing native;
}
// 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
@@ -31814,37 +31248,31 @@
*/
VideoElement.created() : super.created();
- int get height => JS("int", "#.height", this);
+ int get height native;
- set height(int value) {
- JS("void", "#.height = #", this, value);
- }
+ set height(int value) native;
- String get poster => JS("String", "#.poster", this);
+ String get poster native;
- set poster(String value) {
- JS("void", "#.poster = #", this, value);
- }
+ set poster(String value) native;
- int get videoHeight => JS("int", "#.videoHeight", this);
+ int get videoHeight native;
- int get videoWidth => JS("int", "#.videoWidth", this);
+ int get videoWidth native;
@JSName('webkitDecodedFrameCount')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- int get decodedFrameCount => JS("int", "#.webkitDecodedFrameCount", this);
+ int get decodedFrameCount native;
@JSName('webkitDroppedFrameCount')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
- int get droppedFrameCount => JS("int", "#.webkitDroppedFrameCount", this);
+ int get droppedFrameCount native;
- int get width => JS("int", "#.width", this);
+ int get width native;
- set width(int value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(int value) native;
VideoPlaybackQuality getVideoPlaybackQuality() native;
@@ -31869,13 +31297,13 @@
throw new UnsupportedError("Not supported");
}
- int get corruptedVideoFrames => JS("int", "#.corruptedVideoFrames", this);
+ int get corruptedVideoFrames native;
- num get creationTime => JS("num", "#.creationTime", this);
+ num get creationTime native;
- int get droppedVideoFrames => JS("int", "#.droppedVideoFrames", this);
+ int get droppedVideoFrames native;
- int get totalVideoFrames => JS("int", "#.totalVideoFrames", this);
+ int get totalVideoFrames native;
}
// 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
@@ -31888,21 +31316,19 @@
throw new UnsupportedError("Not supported");
}
- String get id => JS("String", "#.id", this);
+ String get id native;
- String get kind => JS("String", "#.kind", this);
+ String get kind native;
- String get label => JS("String", "#.label", this);
+ String get label native;
- String get language => JS("String", "#.language", this);
+ String get language native;
- bool get selected => JS("bool", "#.selected", this);
+ bool get selected native;
- set selected(bool value) {
- JS("void", "#.selected = #", this, value);
- }
+ set selected(bool value) native;
- SourceBuffer? get sourceBuffer => JS("SourceBuffer", "#.sourceBuffer", this);
+ SourceBuffer? get sourceBuffer native;
}
// 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
@@ -31918,9 +31344,9 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- int get length => JS("int", "#.length", this);
+ int get length native;
- int get selectedIndex => JS("int", "#.selectedIndex", this);
+ int get selectedIndex native;
VideoTrack __getter__(int index) native;
@@ -31945,19 +31371,19 @@
static const EventStreamProvider<Event> scrollEvent =
const EventStreamProvider<Event>('scroll');
- num get height => JS("num", "#.height", this);
+ num get height native;
- num get offsetLeft => JS("num", "#.offsetLeft", this);
+ num get offsetLeft native;
- num get offsetTop => JS("num", "#.offsetTop", this);
+ num get offsetTop native;
- num get pageLeft => JS("num", "#.pageLeft", this);
+ num get pageLeft native;
- num get pageTop => JS("num", "#.pageTop", this);
+ num get pageTop native;
- num get scale => JS("num", "#.scale", this);
+ num get scale native;
- num get width => JS("num", "#.width", this);
+ num get width native;
Stream<Event> get onResize => resizeEvent.forTarget(this);
@@ -31987,45 +31413,41 @@
static VttCue _create_1(startTime, endTime, text) =>
JS('VttCue', 'new VTTCue(#,#,#)', startTime, endTime, text);
- String get align => JS("String", "#.align", this);
+ String get align native;
- set align(String value) {
- JS("void", "#.align = #", this, value);
- }
+ set align(String value) native;
@Creates('Null')
@Returns('num|String')
- Object? line;
+ Object? get line native;
+
+ set line(Object? value) native;
@Creates('Null')
@Returns('num|String')
- Object? position;
+ Object? get position native;
- VttRegion? region;
+ set position(Object? value) native;
- num get size => JS("num", "#.size", this);
+ VttRegion? get region native;
- set size(num value) {
- JS("void", "#.size = #", this, value);
- }
+ set region(VttRegion? value) native;
- bool get snapToLines => JS("bool", "#.snapToLines", this);
+ num get size native;
- set snapToLines(bool value) {
- JS("void", "#.snapToLines = #", this, value);
- }
+ set size(num value) native;
- String get text => JS("String", "#.text", this);
+ bool get snapToLines native;
- set text(String value) {
- JS("void", "#.text = #", this, value);
- }
+ set snapToLines(bool value) native;
- String get vertical => JS("String", "#.vertical", this);
+ String get text native;
- set vertical(String value) {
- JS("void", "#.vertical = #", this, value);
- }
+ set text(String value) native;
+
+ String get vertical native;
+
+ set vertical(String value) native;
@JSName('getCueAsHTML')
DocumentFragment getCueAsHtml() native;
@@ -32046,53 +31468,37 @@
}
static VttRegion _create_1() => JS('VttRegion', 'new VTTRegion()');
- String get id => JS("String", "#.id", this);
+ String get id native;
- set id(String value) {
- JS("void", "#.id = #", this, value);
- }
+ set id(String value) native;
- int get lines => JS("int", "#.lines", this);
+ int get lines native;
- set lines(int value) {
- JS("void", "#.lines = #", this, value);
- }
+ set lines(int value) native;
- num get regionAnchorX => JS("num", "#.regionAnchorX", this);
+ num get regionAnchorX native;
- set regionAnchorX(num value) {
- JS("void", "#.regionAnchorX = #", this, value);
- }
+ set regionAnchorX(num value) native;
- num get regionAnchorY => JS("num", "#.regionAnchorY", this);
+ num get regionAnchorY native;
- set regionAnchorY(num value) {
- JS("void", "#.regionAnchorY = #", this, value);
- }
+ set regionAnchorY(num value) native;
- String get scroll => JS("String", "#.scroll", this);
+ String get scroll native;
- set scroll(String value) {
- JS("void", "#.scroll = #", this, value);
- }
+ set scroll(String value) native;
- num get viewportAnchorX => JS("num", "#.viewportAnchorX", this);
+ num get viewportAnchorX native;
- set viewportAnchorX(num value) {
- JS("void", "#.viewportAnchorX = #", this, value);
- }
+ set viewportAnchorX(num value) native;
- num get viewportAnchorY => JS("num", "#.viewportAnchorY", this);
+ num get viewportAnchorY native;
- set viewportAnchorY(num value) {
- JS("void", "#.viewportAnchorY = #", this, value);
- }
+ set viewportAnchorY(num value) native;
- num get width => JS("num", "#.width", this);
+ num get width native;
- set width(num value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(num value) native;
}
// 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
@@ -32202,21 +31608,19 @@
static const int OPEN = 1;
- String get binaryType => JS("String", "#.binaryType", this);
+ String get binaryType native;
- set binaryType(String value) {
- JS("void", "#.binaryType = #", this, value);
- }
+ set binaryType(String value) native;
- int get bufferedAmount => JS("int", "#.bufferedAmount", this);
+ int get bufferedAmount native;
- String get extensions => JS("String", "#.extensions", this);
+ String get extensions native;
- String get protocol => JS("String", "#.protocol", this);
+ String get protocol native;
- int get readyState => JS("int", "#.readyState", this);
+ int get readyState native;
- String get url => JS("String", "#.url", this);
+ String get url native;
void close([int? code, String? reason]) native;
@@ -32354,12 +31758,12 @@
static const int DOM_DELTA_PIXEL = 0x00;
@JSName('deltaX')
- num get _deltaX => JS("num", "#.deltaX", this);
+ num get _deltaX native;
@JSName('deltaY')
- num get _deltaY => JS("num", "#.deltaY", this);
+ num get _deltaY native;
- num get deltaZ => JS("num", "#.deltaZ", this);
+ num get deltaZ native;
/**
* The amount that is expected to scroll vertically, in units determined by
@@ -32591,7 +31995,7 @@
*/
int requestAnimationFrame(FrameRequestCallback callback) {
_ensureRequestAnimationFrame();
- return _requestAnimationFrame(_wrapZone(callback));
+ return _requestAnimationFrame(_wrapZone(callback)!);
}
/**
@@ -32858,7 +32262,7 @@
*/
static const int TEMPORARY = 0;
- _Worklet get animationWorklet => JS("_Worklet", "#.animationWorklet", this);
+ _Worklet get animationWorklet native;
/**
* The application cache for this window.
@@ -32873,16 +32277,15 @@
* from WHATWG.
*/
- ApplicationCache get applicationCache =>
- JS("ApplicationCache", "#.applicationCache", this);
+ ApplicationCache get applicationCache native;
- _Worklet get audioWorklet => JS("_Worklet", "#.audioWorklet", this);
+ _Worklet get audioWorklet native;
- CacheStorage get caches => JS("CacheStorage", "#.caches", this);
+ CacheStorage get caches native;
- bool get closed => JS("bool", "#.closed", this);
+ bool get closed native;
- CookieStore get cookieStore => JS("CookieStore", "#.cookieStore", this);
+ CookieStore get cookieStore native;
/**
* Entrypoint for the browser's cryptographic functions.
@@ -32892,26 +32295,21 @@
* * [Web cryptography API](http://www.w3.org/TR/WebCryptoAPI/) from W3C.
*/
- Crypto get crypto => JS("Crypto", "#.crypto", this);
+ Crypto get crypto native;
- CustomElementRegistry get customElements =>
- JS("CustomElementRegistry", "#.customElements", this);
+ CustomElementRegistry get customElements native;
/// *Deprecated*.
- String get defaultStatus => JS("String", "#.defaultStatus", this);
+ String get defaultStatus native;
- set defaultStatus(String value) {
- JS("void", "#.defaultStatus = #", this, value);
- }
+ set defaultStatus(String value) native;
/// *Deprecated*.
- String get defaultstatus => JS("String", "#.defaultstatus", this);
+ String get defaultstatus native;
- set defaultstatus(String value) {
- JS("void", "#.defaultstatus = #", this, value);
- }
+ set defaultstatus(String value) native;
/**
* The ratio between physical pixels and logical CSS pixels.
@@ -32924,9 +32322,9 @@
* from quirksmode.
*/
- num get devicePixelRatio => JS("num", "#.devicePixelRatio", this);
+ num get devicePixelRatio native;
- External get external => JS("External", "#.external", this);
+ External get external native;
/**
* The current session history for this window's newest document.
@@ -32937,7 +32335,7 @@
* from WHATWG.
*/
- History get history => JS("History", "#.history", this);
+ History get history native;
/**
* The height of the viewport including scrollbars.
@@ -32948,7 +32346,7 @@
* from MDN.
*/
- int get innerHeight => JS("int", "#.innerHeight", this);
+ int get innerHeight native;
/**
* The width of the viewport including scrollbars.
@@ -32959,9 +32357,9 @@
* from MDN.
*/
- int get innerWidth => JS("int", "#.innerWidth", this);
+ int get innerWidth native;
- bool get isSecureContext => JS("bool", "#.isSecureContext", this);
+ bool get isSecureContext native;
/**
* Storage for this window that persists across sessions.
@@ -32976,7 +32374,7 @@
* from W3C.
*/
- Storage get localStorage => JS("Storage", "#.localStorage", this);
+ Storage get localStorage native;
/**
* This window's location bar, which displays the URL.
@@ -32988,7 +32386,7 @@
* from WHATWG.
*/
- BarProp get locationbar => JS("BarProp", "#.locationbar", this);
+ BarProp get locationbar native;
/**
* This window's menu bar, which displays menu commands.
@@ -33000,7 +32398,7 @@
* from WHATWG.
*/
- BarProp get menubar => JS("BarProp", "#.menubar", this);
+ BarProp get menubar native;
/**
* The name of this window.
@@ -33011,11 +32409,9 @@
* from MDN.
*/
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
/**
* The user agent accessing this window.
@@ -33027,7 +32423,7 @@
* from WHATWG.
*/
- Navigator get navigator => JS("Navigator", "#.navigator", this);
+ Navigator get navigator native;
/**
* Whether objects are drawn offscreen before being displayed.
@@ -33038,21 +32434,19 @@
* from WebPlatform.org.
*/
- bool get offscreenBuffering => JS("bool", "#.offscreenBuffering", this);
+ bool get offscreenBuffering native;
WindowBase? get opener => _convertNativeToDart_Window(this._get_opener);
@JSName('opener')
@Creates('Window|=Object')
@Returns('Window|=Object')
- dynamic get _get_opener => JS("", "#.opener", this);
+ dynamic get _get_opener native;
- set opener(WindowBase? value) {
- JS("void", "#.opener = #", this, value);
- }
+ set opener(WindowBase? value) native;
- int get orientation => JS("int", "#.orientation", this);
+ int get orientation native;
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
/**
* The height of this window including all user interface elements.
@@ -33063,7 +32457,7 @@
* from MDN.
*/
- int get outerHeight => JS("int", "#.outerHeight", this);
+ int get outerHeight native;
/**
* The width of the window including all user interface elements.
@@ -33074,7 +32468,7 @@
* from MDN.
*/
- int get outerWidth => JS("int", "#.outerWidth", this);
+ int get outerWidth native;
@JSName('pageXOffset')
@@ -33092,7 +32486,7 @@
* from MDN.
*/
- num get _pageXOffset => JS("num", "#.pageXOffset", this);
+ num get _pageXOffset native;
@JSName('pageYOffset')
@@ -33110,13 +32504,13 @@
* from MDN.
*/
- num get _pageYOffset => JS("num", "#.pageYOffset", this);
+ num get _pageYOffset native;
WindowBase? get parent => _convertNativeToDart_Window(this._get_parent);
@JSName('parent')
@Creates('Window|=Object')
@Returns('Window|=Object')
- dynamic get _get_parent => JS("", "#.parent", this);
+ dynamic get _get_parent native;
/**
* Timing and navigation data for this window.
@@ -33132,7 +32526,7 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE)
- Performance get performance => JS("Performance", "#.performance", this);
+ Performance get performance native;
/**
* Information about the screen displaying this window.
@@ -33143,7 +32537,7 @@
* from W3C.
*/
- Screen get screen => JS("Screen", "#.screen", this);
+ Screen get screen native;
/**
* The distance from the left side of the screen to the left side of this
@@ -33155,7 +32549,7 @@
* from W3C.
*/
- int get screenLeft => JS("int", "#.screenLeft", this);
+ int get screenLeft native;
/**
* The distance from the top of the screen to the top of this window.
@@ -33166,7 +32560,7 @@
* from W3C.
*/
- int get screenTop => JS("int", "#.screenTop", this);
+ int get screenTop native;
/**
* The distance from the left side of the screen to the mouse pointer.
@@ -33177,7 +32571,7 @@
* from W3C.
*/
- int get screenX => JS("int", "#.screenX", this);
+ int get screenX native;
/**
* The distance from the top of the screen to the mouse pointer.
@@ -33188,7 +32582,7 @@
* from W3C.
*/
- int get screenY => JS("int", "#.screenY", this);
+ int get screenY native;
/**
* This window's scroll bars.
@@ -33200,7 +32594,7 @@
* from WHATWG.
*/
- BarProp get scrollbars => JS("BarProp", "#.scrollbars", this);
+ BarProp get scrollbars native;
/**
* The current window.
@@ -33222,7 +32616,7 @@
*/
@Creates('Window|=Object')
@Returns('Window|=Object')
- dynamic get _get_self => JS("", "#.self", this);
+ dynamic get _get_self native;
/**
* Storage for this window that is cleared when this session ends.
@@ -33238,7 +32632,7 @@
* specification](http://www.w3.org/TR/webstorage/#dom-sessionstorage) from W3C.
*/
- Storage get sessionStorage => JS("Storage", "#.sessionStorage", this);
+ Storage get sessionStorage native;
/**
* Access to speech synthesis in the browser.
@@ -33250,16 +32644,13 @@
* from W3C.
*/
- SpeechSynthesis get speechSynthesis =>
- JS("SpeechSynthesis", "#.speechSynthesis", this);
+ SpeechSynthesis get speechSynthesis native;
/// *Deprecated*.
- String get status => JS("String", "#.status", this);
+ String get status native;
- set status(String value) {
- JS("void", "#.status = #", this, value);
- }
+ set status(String value) native;
/**
* This window's status bar.
@@ -33271,7 +32662,7 @@
* from WHATWG.
*/
- BarProp get statusbar => JS("BarProp", "#.statusbar", this);
+ BarProp get statusbar native;
/**
* Access to CSS media queries.
@@ -33283,7 +32674,7 @@
* from Safari Developer Library.
*/
- StyleMedia get styleMedia => JS("StyleMedia", "#.styleMedia", this);
+ StyleMedia get styleMedia native;
/**
* This window's tool bar.
@@ -33295,16 +32686,15 @@
* from WHATWG.
*/
- BarProp get toolbar => JS("BarProp", "#.toolbar", this);
+ BarProp get toolbar native;
WindowBase? get top => _convertNativeToDart_Window(this._get_top);
@JSName('top')
@Creates('Window|=Object')
@Returns('Window|=Object')
- dynamic get _get_top => JS("", "#.top", this);
+ dynamic get _get_top native;
- VisualViewport get visualViewport =>
- JS("VisualViewport", "#.visualViewport", this);
+ VisualViewport get visualViewport native;
/**
* The current window.
@@ -33326,7 +32716,7 @@
*/
@Creates('Window|=Object')
@Returns('Window|=Object')
- dynamic get _get_window => JS("", "#.window", this);
+ dynamic get _get_window native;
@Creates('Window|=Object')
@Returns('Window|=Object')
@@ -34278,9 +33668,9 @@
throw new UnsupportedError("Not supported");
}
- bool get focused => JS("bool", "#.focused", this);
+ bool get focused native;
- String get visibilityState => JS("String", "#.visibilityState", this);
+ String get visibilityState native;
Future<WindowClient> focus() =>
promiseToFuture<WindowClient>(JS("", "#.focus()", this));
@@ -34421,26 +33811,25 @@
static const EventStreamProvider<Event> errorEvent =
const EventStreamProvider<Event>('error');
- String get addressSpace => JS("String", "#.addressSpace", this);
+ String get addressSpace native;
- CacheStorage get caches => JS("CacheStorage", "#.caches", this);
+ CacheStorage get caches native;
- Crypto get crypto => JS("Crypto", "#.crypto", this);
+ Crypto get crypto native;
- IdbFactory get indexedDB => JS("IdbFactory", "#.indexedDB", this);
+ IdbFactory get indexedDB native;
- bool get isSecureContext => JS("bool", "#.isSecureContext", this);
+ bool get isSecureContext native;
- _WorkerLocation get location => JS("_WorkerLocation", "#.location", this);
+ _WorkerLocation get location native;
- _WorkerNavigator get navigator => JS("_WorkerNavigator", "#.navigator", this);
+ _WorkerNavigator get navigator native;
- String get origin => JS("String", "#.origin", this);
+ String get origin native;
- WorkerPerformance get performance =>
- JS("WorkerPerformance", "#.performance", this);
+ WorkerPerformance get performance native;
- WorkerGlobalScope get self => JS("WorkerGlobalScope", "#.self", this);
+ WorkerGlobalScope get self native;
Future fetch(/*RequestInfo*/ input, [Map? init]) {
var init_dict = null;
@@ -34497,9 +33886,9 @@
throw new UnsupportedError("Not supported");
}
- MemoryInfo get memory => JS("MemoryInfo", "#.memory", this);
+ MemoryInfo get memory native;
- num get timeOrigin => JS("num", "#.timeOrigin", this);
+ num get timeOrigin native;
void clearMarks(String? markName) native;
@@ -34547,7 +33936,7 @@
JS('WorkletAnimation', 'new WorkletAnimation(#,#,#,#)', animatorName,
effects, timelines, options);
- String get playState => JS("String", "#.playState", this);
+ String get playState native;
void cancel() native;
@@ -34656,19 +34045,19 @@
static const int UNORDERED_NODE_SNAPSHOT_TYPE = 6;
- bool get booleanValue => JS("bool", "#.booleanValue", this);
+ bool get booleanValue native;
- bool get invalidIteratorState => JS("bool", "#.invalidIteratorState", this);
+ bool get invalidIteratorState native;
- num get numberValue => JS("num", "#.numberValue", this);
+ num get numberValue native;
- int get resultType => JS("int", "#.resultType", this);
+ int get resultType native;
- Node get singleNodeValue => JS("Node", "#.singleNodeValue", this);
+ Node get singleNodeValue native;
- int get snapshotLength => JS("int", "#.snapshotLength", this);
+ int get snapshotLength native;
- String get stringValue => JS("String", "#.stringValue", this);
+ String get stringValue native;
Node? iterateNext() native;
@@ -34759,18 +34148,16 @@
}
@JSName('localName')
- String get _localName => JS("String", "#.localName", this);
+ String get _localName native;
- String get name => JS("String", "#.name", this);
+ String get name native;
@JSName('namespaceURI')
- String? get _namespaceUri => JS("String", "#.namespaceURI", this);
+ String? get _namespaceUri native;
- String get value => JS("String", "#.value", this);
+ String get value native;
- set value(String value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(String value) native;
}
// 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
@@ -35148,35 +34535,27 @@
// Shadowing definition.
- num get height => JS("num", "#.height", this);
+ num get height native;
- set height(num value) {
- JS("void", "#.height = #", this, value);
- }
+ set height(num value) native;
// Shadowing definition.
- num get width => JS("num", "#.width", this);
+ num get width native;
- set width(num value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(num value) native;
// Shadowing definition.
- num get x => JS("num", "#.x", this);
+ num get x native;
- set x(num value) {
- JS("void", "#.x = #", this, value);
- }
+ set x(num value) native;
// Shadowing definition.
- num get y => JS("num", "#.y", this);
+ num get y native;
- set y(num value) {
- JS("void", "#.y = #", this, value);
- }
+ set y(num value) native;
}
/**
@@ -35640,11 +35019,11 @@
throw new UnsupportedError("Not supported");
}
- ReportBody? get body => JS("ReportBody", "#.body", this);
+ ReportBody? get body native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- String get url => JS("String", "#.url", this);
+ String get url native;
}
// 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
@@ -35668,23 +35047,23 @@
JS('_Request', 'new Request(#,#)', input, requestInitDict);
static _Request _create_2(input) => JS('_Request', 'new Request(#)', input);
- String get cache => JS("String", "#.cache", this);
+ String get cache native;
- String get credentials => JS("String", "#.credentials", this);
+ String get credentials native;
- Headers get headers => JS("Headers", "#.headers", this);
+ Headers get headers native;
- String get integrity => JS("String", "#.integrity", this);
+ String get integrity native;
- String get mode => JS("String", "#.mode", this);
+ String get mode native;
- String get redirect => JS("String", "#.redirect", this);
+ String get redirect native;
- String get referrer => JS("String", "#.referrer", this);
+ String get referrer native;
- String get referrerPolicy => JS("String", "#.referrerPolicy", this);
+ String get referrerPolicy native;
- String get url => JS("String", "#.url", this);
+ String get url native;
_Request clone() native;
}
@@ -40284,10 +39663,10 @@
}
}
- int indexOf(Object element, [int start = 0]) =>
+ int indexOf(Object? element, [int start = 0]) =>
_list.indexOf(element as Node, start);
- int lastIndexOf(Object element, [int? start]) =>
+ int lastIndexOf(Object? element, [int? start]) =>
_list.lastIndexOf(element as Node, start);
void insert(int index, E element) => _list.insert(index, element);
@@ -41234,15 +40613,17 @@
// 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.
-void Function(T) _wrapZone<T>(void Function(T) callback) {
+void Function(T)? _wrapZone<T>(void Function(T) callback) {
// For performance reasons avoid wrapping if we are in the root zone.
if (Zone.current == Zone.root) return callback;
+ if (callback == null) return null;
return Zone.current.bindUnaryCallbackGuarded(callback);
}
-void Function(T1, T2) _wrapBinaryZone<T1, T2>(void Function(T1, T2) callback) {
+void Function(T1, T2)? _wrapBinaryZone<T1, T2>(void Function(T1, T2) callback) {
// For performance reasons avoid wrapping if we are in the root zone.
if (Zone.current == Zone.root) return callback;
+ if (callback == null) return null;
return Zone.current.bindBinaryCallbackGuarded(callback);
}
diff --git a/sdk_nnbd/lib/indexed_db/dart2js/indexed_db_dart2js.dart b/sdk_nnbd/lib/indexed_db/dart2js/indexed_db_dart2js.dart
index 64eaa06..4bbd020 100644
--- a/sdk_nnbd/lib/indexed_db/dart2js/indexed_db_dart2js.dart
+++ b/sdk_nnbd/lib/indexed_db/dart2js/indexed_db_dart2js.dart
@@ -244,19 +244,19 @@
throw new UnsupportedError("Not supported");
}
- String get direction => JS("String", "#.direction", this);
+ String get direction native;
@_annotation_Creates_IDBKey
@_annotation_Returns_IDBKey
- Object? get key => JS("Object", "#.key", this);
+ Object? get key native;
@_annotation_Creates_IDBKey
@_annotation_Returns_IDBKey
- Object? get primaryKey => JS("Object", "#.primaryKey", this);
+ Object? get primaryKey native;
@Creates('Null')
@Returns('ObjectStore|Index|Null')
- Object? get source => JS("Object", "#.source", this);
+ Object? get source native;
void advance(int count) native;
@@ -289,7 +289,7 @@
@JSName('value')
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- dynamic get _get_value => JS("", "#.value", this);
+ dynamic get _get_value native;
}
// 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
@@ -400,16 +400,15 @@
static const EventStreamProvider<VersionChangeEvent> versionChangeEvent =
const EventStreamProvider<VersionChangeEvent>('versionchange');
- String get name => JS("String", "#.name", this);
+ String get name native;
@Returns('DomStringList')
@Creates('DomStringList')
- List<String> get objectStoreNames =>
- JS("DomStringList", "#.objectStoreNames", this);
+ List<String> get objectStoreNames native;
@Creates('int|String|Null')
@Returns('int|String|Null')
- int get version => JS("int", "#.version", this);
+ int get version native;
void close() native;
@@ -655,19 +654,17 @@
}
@annotation_Creates_SerializedScriptValue
- Object? get keyPath => JS("Object", "#.keyPath", this);
+ Object? get keyPath native;
- bool get multiEntry => JS("bool", "#.multiEntry", this);
+ bool get multiEntry native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- ObjectStore get objectStore => JS("ObjectStore", "#.objectStore", this);
+ ObjectStore get objectStore native;
- bool get unique => JS("bool", "#.unique", this);
+ bool get unique native;
@JSName('count')
Request _count(Object? key) native;
@@ -728,14 +725,14 @@
}
@annotation_Creates_SerializedScriptValue
- Object? get lower => JS("Object", "#.lower", this);
+ Object? get lower native;
- bool get lowerOpen => JS("bool", "#.lowerOpen", this);
+ bool get lowerOpen native;
@annotation_Creates_SerializedScriptValue
- Object? get upper => JS("Object", "#.upper", this);
+ Object? get upper native;
- bool get upperOpen => JS("bool", "#.upperOpen", this);
+ bool get upperOpen native;
@JSName('bound')
static KeyRange bound_(Object lower, Object upper,
@@ -882,22 +879,20 @@
throw new UnsupportedError("Not supported");
}
- bool get autoIncrement => JS("bool", "#.autoIncrement", this);
+ bool get autoIncrement native;
@Returns('DomStringList')
@Creates('DomStringList')
- List<String> get indexNames => JS("DomStringList", "#.indexNames", this);
+ List<String> get indexNames native;
@annotation_Creates_SerializedScriptValue
- Object? get keyPath => JS("Object", "#.keyPath", this);
+ Object? get keyPath native;
- String get name => JS("String", "#.name", this);
+ String get name native;
- set name(String value) {
- JS("void", "#.name = #", this, value);
- }
+ set name(String value) native;
- Transaction get transaction => JS("Transaction", "#.transaction", this);
+ Transaction get transaction native;
@Returns('Request')
@Creates('Request')
@@ -1031,11 +1026,11 @@
throw new UnsupportedError("Not supported");
}
- Object? get key => JS("Object", "#.key", this);
+ Object? get key native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- Object? get value => JS("Object", "#.value", this);
+ Object? get value native;
}
// 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
@@ -1077,11 +1072,11 @@
throw new UnsupportedError("Not supported");
}
- Database get database => JS("Database", "#.database", this);
+ Database get database native;
- Object? get records => JS("Object", "#.records", this);
+ Object? get records native;
- Transaction get transaction => JS("Transaction", "#.transaction", this);
+ Transaction get transaction native;
}
// 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
@@ -1150,19 +1145,19 @@
static const EventStreamProvider<Event> successEvent =
const EventStreamProvider<Event>('success');
- DomException get error => JS("DomException", "#.error", this);
+ DomException get error native;
- String get readyState => JS("String", "#.readyState", this);
+ String get readyState native;
dynamic get result => _convertNativeToDart_IDBAny(this._get_result);
@JSName('result')
@Creates('Null')
- dynamic get _get_result => JS("", "#.result", this);
+ dynamic get _get_result native;
@Creates('Null')
- Object? get source => JS("Object", "#.source", this);
+ Object? get source native;
- Transaction get transaction => JS("Transaction", "#.transaction", this);
+ Transaction get transaction native;
/// Stream of `error` events handled by this [Request].
Stream<Event> get onError => errorEvent.forTarget(this);
@@ -1237,16 +1232,15 @@
static const EventStreamProvider<Event> errorEvent =
const EventStreamProvider<Event>('error');
- Database get db => JS("Database", "#.db", this);
+ Database get db native;
- DomException get error => JS("DomException", "#.error", this);
+ DomException get error native;
- String get mode => JS("String", "#.mode", this);
+ String get mode native;
@Returns('DomStringList')
@Creates('DomStringList')
- List<String> get objectStoreNames =>
- JS("DomStringList", "#.objectStoreNames", this);
+ List<String> get objectStoreNames native;
void abort() native;
@@ -1288,18 +1282,18 @@
static VersionChangeEvent _create_2(type) =>
JS('VersionChangeEvent', 'new IDBVersionChangeEvent(#)', type);
- String get dataLoss => JS("String", "#.dataLoss", this);
+ String get dataLoss native;
- String get dataLossMessage => JS("String", "#.dataLossMessage", this);
+ String get dataLossMessage native;
@Creates('int|String|Null')
@Returns('int|String|Null')
- int? get newVersion => JS("int", "#.newVersion", this);
+ int? get newVersion native;
@Creates('int|String|Null')
@Returns('int|String|Null')
- int get oldVersion => JS("int", "#.oldVersion", this);
+ int get oldVersion native;
@JSName('target')
- final OpenDBRequest target;
+ OpenDBRequest get target native;
}
diff --git a/sdk_nnbd/lib/internal/internal.dart b/sdk_nnbd/lib/internal/internal.dart
index 17033f0..0f36976 100644
--- a/sdk_nnbd/lib/internal/internal.dart
+++ b/sdk_nnbd/lib/internal/internal.dart
@@ -204,6 +204,31 @@
const Since(this.version);
}
+/// A null-check function for function parameters in Null Safety enabled code.
+///
+/// Because Dart does not have full null safety
+/// until all legacy code has been removed from a program,
+/// a non-nullable parameter can still end up with a `null` value.
+/// This function can be used to guard those functions against null arguments.
+/// It throws a [TypeError] because we are really seeing the failure to
+/// assign `null` to a non-nullable type.
+///
+/// See http://dartbug.com/40614 for context.
+T checkNotNullable<T extends Object>(T value, String name) {
+ if ((value as dynamic) == null) {
+ throw NotNullableError<T>(name);
+ }
+ return value;
+}
+
+/// A [TypeError] thrown by [checkNotNullable].
+class NotNullableError<T> extends Error implements TypeError {
+ final String _name;
+ NotNullableError(this._name);
+ String toString() =>
+ "Null is not a valid value for the parameter '$_name' of type '$T'";
+}
+
/**
* HTTP status codes. Exported in dart:io and dart:html.
*/
diff --git a/sdk_nnbd/lib/io/directory_impl.dart b/sdk_nnbd/lib/io/directory_impl.dart
index 29342c5..06777e7 100644
--- a/sdk_nnbd/lib/io/directory_impl.dart
+++ b/sdk_nnbd/lib/io/directory_impl.dart
@@ -9,11 +9,12 @@
final Uint8List _rawPath;
_Directory(String path)
- : _path = path,
+ : _path = _checkNotNull(path, "path"),
_rawPath = FileSystemEntity._toUtf8Array(path);
_Directory.fromRawPath(Uint8List rawPath)
- : _rawPath = FileSystemEntity._toNullTerminatedUtf8Array(rawPath),
+ : _rawPath = FileSystemEntity._toNullTerminatedUtf8Array(
+ _checkNotNull(rawPath, "rawPath")),
_path = FileSystemEntity._toStringFromUtf8Array(rawPath);
String get path => _path;
@@ -269,6 +270,12 @@
return new Exception("Unknown error");
}
}
+
+ // TODO(40614): Remove once non-nullability is sound.
+ static T _checkNotNull<T>(T t, String name) {
+ ArgumentError.checkNotNull(t, name);
+ return t;
+ }
}
abstract class _AsyncDirectoryListerOps {
diff --git a/sdk_nnbd/lib/io/eventhandler.dart b/sdk_nnbd/lib/io/eventhandler.dart
index 36f54e6..cfad310 100644
--- a/sdk_nnbd/lib/io/eventhandler.dart
+++ b/sdk_nnbd/lib/io/eventhandler.dart
@@ -5,5 +5,5 @@
part of dart.io;
class _EventHandler {
- external static void _sendData(Object sender, SendPort sendPort, int data);
+ external static void _sendData(Object? sender, SendPort sendPort, int data);
}
diff --git a/sdk_nnbd/lib/io/file_impl.dart b/sdk_nnbd/lib/io/file_impl.dart
index e0b2d30..7be1bf3 100644
--- a/sdk_nnbd/lib/io/file_impl.dart
+++ b/sdk_nnbd/lib/io/file_impl.dart
@@ -202,11 +202,12 @@
final Uint8List _rawPath;
_File(String path)
- : _path = path,
+ : _path = _checkNotNull(path, "path"),
_rawPath = FileSystemEntity._toUtf8Array(path);
_File.fromRawPath(Uint8List rawPath)
- : _rawPath = FileSystemEntity._toNullTerminatedUtf8Array(rawPath),
+ : _rawPath = FileSystemEntity._toNullTerminatedUtf8Array(
+ _checkNotNull(rawPath, "rawPath")),
_path = FileSystemEntity._toStringFromUtf8Array(rawPath);
String get path => _path;
@@ -634,6 +635,12 @@
throw new FileSystemException(msg, path, result);
}
}
+
+ // TODO(40614): Remove once non-nullability is sound.
+ static T _checkNotNull<T>(T t, String name) {
+ ArgumentError.checkNotNull(t, name);
+ return t;
+ }
}
abstract class _RandomAccessFileOps {
@@ -732,7 +739,7 @@
}
Future<Uint8List> read(int bytes) {
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(bytes, "bytes");
return _dispatch(_IOService.fileRead, [null, bytes]).then((response) {
if (_isErrorResponse(response)) {
@@ -745,7 +752,7 @@
}
Uint8List readSync(int bytes) {
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(bytes, "bytes");
_checkAvailable();
var result = _ops.read(bytes);
@@ -757,7 +764,7 @@
}
Future<int> readInto(List<int> buffer, [int start = 0, int? end]) {
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(buffer, "buffer");
end = RangeError.checkValidRange(start, end, buffer.length);
if (end == start) {
@@ -777,7 +784,7 @@
}
int readIntoSync(List<int> buffer, [int start = 0, int? end]) {
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(buffer, "buffer");
_checkAvailable();
end = RangeError.checkValidRange(start, end, buffer.length);
@@ -793,7 +800,7 @@
}
Future<RandomAccessFile> writeByte(int value) {
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(value, "value");
return _dispatch(_IOService.fileWriteByte, [null, value]).then((response) {
if (_isErrorResponse(response)) {
@@ -806,7 +813,7 @@
int writeByteSync(int value) {
_checkAvailable();
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(value, "value");
var result = _ops.writeByte(value);
if (result is OSError) {
@@ -818,7 +825,7 @@
Future<RandomAccessFile> writeFrom(List<int> buffer,
[int start = 0, int? end]) {
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(buffer, "buffer");
ArgumentError.checkNotNull(start, "start");
end = RangeError.checkValidRange(start, end, buffer.length);
@@ -848,6 +855,9 @@
void writeFromSync(List<int> buffer, [int start = 0, int? end]) {
_checkAvailable();
+ // TODO(40614): Remove once non-nullability is sound.
+ ArgumentError.checkNotNull(buffer, "buffer");
+ ArgumentError.checkNotNull(start, "start");
end = RangeError.checkValidRange(start, end, buffer.length);
if (end == start) {
return;
@@ -864,11 +874,15 @@
Future<RandomAccessFile> writeString(String string,
{Encoding encoding: utf8}) {
+ // TODO(40614): Remove once non-nullability is sound.
+ ArgumentError.checkNotNull(encoding, "encoding");
var data = encoding.encode(string);
return writeFrom(data, 0, data.length);
}
void writeStringSync(String string, {Encoding encoding: utf8}) {
+ // TODO(40614): Remove once non-nullability is sound.
+ ArgumentError.checkNotNull(encoding, "encoding");
var data = encoding.encode(string);
writeFromSync(data, 0, data.length);
}
@@ -971,7 +985,7 @@
Future<RandomAccessFile> lock(
[FileLock mode = FileLock.exclusive, int start = 0, int end = -1]) {
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(mode, "mode");
ArgumentError.checkNotNull(start, "start");
ArgumentError.checkNotNull(end, "end");
@@ -989,7 +1003,7 @@
}
Future<RandomAccessFile> unlock([int start = 0, int end = -1]) {
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(start, "start");
ArgumentError.checkNotNull(end, "end");
if (start == end) {
@@ -1007,7 +1021,7 @@
void lockSync(
[FileLock mode = FileLock.exclusive, int start = 0, int end = -1]) {
_checkAvailable();
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(mode, "mode");
ArgumentError.checkNotNull(start, "start");
ArgumentError.checkNotNull(end, "end");
@@ -1023,7 +1037,7 @@
void unlockSync([int start = 0, int end = -1]) {
_checkAvailable();
- // TODO: Remove once non-nullability is sound.
+ // TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(start, "start");
ArgumentError.checkNotNull(end, "end");
if (start == end) {
diff --git a/sdk_nnbd/lib/libraries.json b/sdk_nnbd/lib/libraries.json
index 9cb0006..208de69 100644
--- a/sdk_nnbd/lib/libraries.json
+++ b/sdk_nnbd/lib/libraries.json
@@ -161,166 +161,166 @@
"dart2js": {
"libraries": {
"async": {
- "uri": "../../sdk/lib/async/async.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/async_patch.dart"
+ "uri": "async/async.dart",
+ "patches": "_internal/js_runtime/lib/async_patch.dart"
},
"collection": {
- "uri": "../../sdk/lib/collection/collection.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/collection_patch.dart"
+ "uri": "collection/collection.dart",
+ "patches": "_internal/js_runtime/lib/collection_patch.dart"
},
"convert": {
- "uri": "../../sdk/lib/convert/convert.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/convert_patch.dart"
+ "uri": "convert/convert.dart",
+ "patches": "_internal/js_runtime/lib/convert_patch.dart"
},
"core": {
- "uri": "../../sdk/lib/core/core.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/core_patch.dart"
+ "uri": "core/core.dart",
+ "patches": "_internal/js_runtime/lib/core_patch.dart"
},
"developer": {
- "uri": "../../sdk/lib/developer/developer.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/developer_patch.dart"
+ "uri": "developer/developer.dart",
+ "patches": "_internal/js_runtime/lib/developer_patch.dart"
},
"html": {
- "uri": "../../sdk/lib/html/dart2js/html_dart2js.dart"
+ "uri": "html/dart2js/html_dart2js.dart"
},
"html_common": {
- "uri": "../../sdk/lib/html/html_common/html_common_dart2js.dart"
+ "uri": "html/html_common/html_common_dart2js.dart"
},
"indexed_db": {
- "uri": "../../sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart"
+ "uri": "indexed_db/dart2js/indexed_db_dart2js.dart"
},
"_http": {
- "uri": "../../sdk/lib/_http/http.dart"
+ "uri": "_http/http.dart"
},
"io": {
- "uri": "../../sdk/lib/io/io.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/io_patch.dart",
+ "uri": "io/io.dart",
+ "patches": "_internal/js_runtime/lib/io_patch.dart",
"supported": false
},
"isolate": {
- "uri": "../../sdk/lib/isolate/isolate.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/isolate_patch.dart",
+ "uri": "isolate/isolate.dart",
+ "patches": "_internal/js_runtime/lib/isolate_patch.dart",
"supported": false
},
"js": {
- "uri": "../../sdk/lib/js/js.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/js_patch.dart"
+ "uri": "js/js.dart",
+ "patches": "_internal/js_runtime/lib/js_patch.dart"
},
"_js": {
- "uri": "../../sdk/lib/js/_js.dart",
- "patches": "../../sdk/lib/js/_js_client.dart"
+ "uri": "js/_js.dart",
+ "patches": "js/_js_client.dart"
},
"js_util": {
- "uri": "../../sdk/lib/js_util/js_util.dart"
+ "uri": "js_util/js_util.dart"
},
"math": {
- "uri": "../../sdk/lib/math/math.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/math_patch.dart"
+ "uri": "math/math.dart",
+ "patches": "_internal/js_runtime/lib/math_patch.dart"
},
"typed_data": {
- "uri": "../../sdk/lib/typed_data/typed_data.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart"
+ "uri": "typed_data/typed_data.dart",
+ "patches": "_internal/js_runtime/lib/typed_data_patch.dart"
},
"_native_typed_data": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/native_typed_data.dart"
+ "uri": "_internal/js_runtime/lib/native_typed_data.dart"
},
"svg": {
- "uri": "../../sdk/lib/svg/dart2js/svg_dart2js.dart"
+ "uri": "svg/dart2js/svg_dart2js.dart"
},
"web_audio": {
- "uri": "../../sdk/lib/web_audio/dart2js/web_audio_dart2js.dart"
+ "uri": "web_audio/dart2js/web_audio_dart2js.dart"
},
"web_gl": {
- "uri": "../../sdk/lib/web_gl/dart2js/web_gl_dart2js.dart"
+ "uri": "web_gl/dart2js/web_gl_dart2js.dart"
},
"web_sql": {
- "uri": "../../sdk/lib/web_sql/dart2js/web_sql_dart2js.dart"
+ "uri": "web_sql/dart2js/web_sql_dart2js.dart"
},
"_internal": {
- "uri": "../../sdk/lib/internal/internal.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/internal_patch.dart"
+ "uri": "internal/internal.dart",
+ "patches": "_internal/js_runtime/lib/internal_patch.dart"
},
"_js_helper": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/js_helper.dart"
+ "uri": "_internal/js_runtime/lib/js_helper.dart"
},
"_rti": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/rti.dart"
+ "uri": "_internal/js_runtime/lib/rti.dart"
},
"_interceptors": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/interceptors.dart"
+ "uri": "_internal/js_runtime/lib/interceptors.dart"
},
"_foreign_helper": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/foreign_helper.dart"
+ "uri": "_internal/js_runtime/lib/foreign_helper.dart"
},
"_js_names": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/js_names.dart"
+ "uri": "_internal/js_runtime/lib/js_names.dart"
},
"_js_primitives": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/js_primitives.dart"
+ "uri": "_internal/js_runtime/lib/js_primitives.dart"
},
"_js_embedded_names": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart"
+ "uri": "_internal/js_runtime/lib/shared/embedded_names.dart"
},
"_async_await_error_codes": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart"
+ "uri": "_internal/js_runtime/lib/shared/async_await_error_codes.dart"
},
"_recipe_syntax": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/shared/recipe_syntax.dart"
+ "uri": "_internal/js_runtime/lib/shared/recipe_syntax.dart"
},
"_metadata": {
- "uri": "../../sdk/lib/html/html_common/metadata.dart"
+ "uri": "html/html_common/metadata.dart"
}
}
},
"dart2js_server": {
"libraries": {
"async": {
- "uri": "../../sdk/lib/async/async.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/async_patch.dart"
+ "uri": "async/async.dart",
+ "patches": "_internal/js_runtime/lib/async_patch.dart"
},
"collection": {
- "uri": "../../sdk/lib/collection/collection.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/collection_patch.dart"
+ "uri": "collection/collection.dart",
+ "patches": "_internal/js_runtime/lib/collection_patch.dart"
},
"convert": {
- "uri": "../../sdk/lib/convert/convert.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/convert_patch.dart"
+ "uri": "convert/convert.dart",
+ "patches": "_internal/js_runtime/lib/convert_patch.dart"
},
"core": {
- "uri": "../../sdk/lib/core/core.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/core_patch.dart"
+ "uri": "core/core.dart",
+ "patches": "_internal/js_runtime/lib/core_patch.dart"
},
"developer": {
- "uri": "../../sdk/lib/developer/developer.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/developer_patch.dart"
+ "uri": "developer/developer.dart",
+ "patches": "_internal/js_runtime/lib/developer_patch.dart"
},
"_http": {
- "uri": "../../sdk/lib/_http/http.dart"
+ "uri": "_http/http.dart"
},
"io": {
- "uri": "../../sdk/lib/io/io.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/io_patch.dart",
+ "uri": "io/io.dart",
+ "patches": "_internal/js_runtime/lib/io_patch.dart",
"supported": false
},
"isolate": {
- "uri": "../../sdk/lib/isolate/isolate.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/isolate_patch.dart",
+ "uri": "isolate/isolate.dart",
+ "patches": "_internal/js_runtime/lib/isolate_patch.dart",
"supported": false
},
"js": {
- "uri": "../../sdk/lib/js/js.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/js_patch.dart"
+ "uri": "js/js.dart",
+ "patches": "_internal/js_runtime/lib/js_patch.dart"
},
"_js": {
- "uri": "../../sdk/lib/js/_js.dart",
- "patches": "../../sdk/lib/js/_js_server.dart"
+ "uri": "js/_js.dart",
+ "patches": "js/_js_server.dart"
},
"js_util": {
- "uri": "../../sdk/lib/js_util/js_util.dart"
+ "uri": "js_util/js_util.dart"
},
"math": {
- "uri": "../../sdk/lib/math/math.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/math_patch.dart"
+ "uri": "math/math.dart",
+ "patches": "_internal/js_runtime/lib/math_patch.dart"
},
"typed_data": {
"uri": "typed_data/typed_data.dart",
@@ -330,35 +330,35 @@
"uri": "_internal/js_runtime/lib/native_typed_data.dart"
},
"_internal": {
- "uri": "../../sdk/lib/internal/internal.dart",
- "patches": "../../sdk/lib/_internal/js_runtime/lib/internal_patch.dart"
+ "uri": "internal/internal.dart",
+ "patches": "_internal/js_runtime/lib/internal_patch.dart"
},
"_js_helper": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/js_helper.dart"
+ "uri": "_internal/js_runtime/lib/js_helper.dart"
},
"_rti": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/rti.dart"
+ "uri": "_internal/js_runtime/lib/rti.dart"
},
"_interceptors": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/interceptors.dart"
+ "uri": "_internal/js_runtime/lib/interceptors.dart"
},
"_foreign_helper": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/foreign_helper.dart"
+ "uri": "_internal/js_runtime/lib/foreign_helper.dart"
},
"_js_names": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/js_names.dart"
+ "uri": "_internal/js_runtime/lib/js_names.dart"
},
"_js_primitives": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/js_primitives.dart"
+ "uri": "_internal/js_runtime/lib/js_primitives.dart"
},
"_js_embedded_names": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart"
+ "uri": "_internal/js_runtime/lib/shared/embedded_names.dart"
},
"_async_await_error_codes": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart"
+ "uri": "_internal/js_runtime/lib/shared/async_await_error_codes.dart"
},
"_recipe_syntax": {
- "uri": "../../sdk/lib/_internal/js_runtime/lib/shared/recipe_syntax.dart"
+ "uri": "_internal/js_runtime/lib/shared/recipe_syntax.dart"
}
}
},
diff --git a/sdk_nnbd/lib/libraries.yaml b/sdk_nnbd/lib/libraries.yaml
index 16f2d05..8dd0eeb 100644
--- a/sdk_nnbd/lib/libraries.yaml
+++ b/sdk_nnbd/lib/libraries.yaml
@@ -158,164 +158,164 @@
dart2js:
libraries:
async:
- uri: "../../sdk/lib/async/async.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/async_patch.dart"
+ uri: "async/async.dart"
+ patches: "_internal/js_runtime/lib/async_patch.dart"
collection:
- uri: "../../sdk/lib/collection/collection.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/collection_patch.dart"
+ uri: "collection/collection.dart"
+ patches: "_internal/js_runtime/lib/collection_patch.dart"
convert:
- uri: "../../sdk/lib/convert/convert.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/convert_patch.dart"
+ uri: "convert/convert.dart"
+ patches: "_internal/js_runtime/lib/convert_patch.dart"
core:
- uri: "../../sdk/lib/core/core.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/core_patch.dart"
+ uri: "core/core.dart"
+ patches: "_internal/js_runtime/lib/core_patch.dart"
developer:
- uri: "../../sdk/lib/developer/developer.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/developer_patch.dart"
+ uri: "developer/developer.dart"
+ patches: "_internal/js_runtime/lib/developer_patch.dart"
html:
- uri: "../../sdk/lib/html/dart2js/html_dart2js.dart"
+ uri: "html/dart2js/html_dart2js.dart"
html_common:
- uri: "../../sdk/lib/html/html_common/html_common_dart2js.dart"
+ uri: "html/html_common/html_common_dart2js.dart"
indexed_db:
- uri: "../../sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart"
+ uri: "indexed_db/dart2js/indexed_db_dart2js.dart"
_http:
- uri: "../../sdk/lib/_http/http.dart"
+ uri: "_http/http.dart"
io:
- uri: "../../sdk/lib/io/io.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/io_patch.dart"
+ uri: "io/io.dart"
+ patches: "_internal/js_runtime/lib/io_patch.dart"
supported: false
isolate:
- uri: "../../sdk/lib/isolate/isolate.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/isolate_patch.dart"
+ uri: "isolate/isolate.dart"
+ patches: "_internal/js_runtime/lib/isolate_patch.dart"
supported: false
js:
- uri: "../../sdk/lib/js/js.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/js_patch.dart"
+ uri: "js/js.dart"
+ patches: "_internal/js_runtime/lib/js_patch.dart"
_js:
- uri: "../../sdk/lib/js/_js.dart"
- patches: "../../sdk/lib/js/_js_client.dart"
+ uri: "js/_js.dart"
+ patches: "js/_js_client.dart"
js_util:
- uri: "../../sdk/lib/js_util/js_util.dart"
+ uri: "js_util/js_util.dart"
math:
- uri: "../../sdk/lib/math/math.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/math_patch.dart"
+ uri: "math/math.dart"
+ patches: "_internal/js_runtime/lib/math_patch.dart"
typed_data:
- uri: "../../sdk/lib/typed_data/typed_data.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart"
+ uri: "typed_data/typed_data.dart"
+ patches: "_internal/js_runtime/lib/typed_data_patch.dart"
_native_typed_data:
- uri: "../../sdk/lib/_internal/js_runtime/lib/native_typed_data.dart"
+ uri: "_internal/js_runtime/lib/native_typed_data.dart"
svg:
- uri: "../../sdk/lib/svg/dart2js/svg_dart2js.dart"
+ uri: "svg/dart2js/svg_dart2js.dart"
web_audio:
- uri: "../../sdk/lib/web_audio/dart2js/web_audio_dart2js.dart"
+ uri: "web_audio/dart2js/web_audio_dart2js.dart"
web_gl:
- uri: "../../sdk/lib/web_gl/dart2js/web_gl_dart2js.dart"
+ uri: "web_gl/dart2js/web_gl_dart2js.dart"
web_sql:
- uri: "../../sdk/lib/web_sql/dart2js/web_sql_dart2js.dart"
+ uri: "web_sql/dart2js/web_sql_dart2js.dart"
_internal:
- uri: "../../sdk/lib/internal/internal.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/internal_patch.dart"
+ uri: "internal/internal.dart"
+ patches: "_internal/js_runtime/lib/internal_patch.dart"
_js_helper:
- uri: "../../sdk/lib/_internal/js_runtime/lib/js_helper.dart"
+ uri: "_internal/js_runtime/lib/js_helper.dart"
_rti:
- uri: "../../sdk/lib/_internal/js_runtime/lib/rti.dart"
+ uri: "_internal/js_runtime/lib/rti.dart"
_interceptors:
- uri: "../../sdk/lib/_internal/js_runtime/lib/interceptors.dart"
+ uri: "_internal/js_runtime/lib/interceptors.dart"
_foreign_helper:
- uri: "../../sdk/lib/_internal/js_runtime/lib/foreign_helper.dart"
+ uri: "_internal/js_runtime/lib/foreign_helper.dart"
_js_names:
- uri: "../../sdk/lib/_internal/js_runtime/lib/js_names.dart"
+ uri: "_internal/js_runtime/lib/js_names.dart"
_js_primitives:
- uri: "../../sdk/lib/_internal/js_runtime/lib/js_primitives.dart"
+ uri: "_internal/js_runtime/lib/js_primitives.dart"
_js_embedded_names:
- uri: "../../sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart"
+ uri: "_internal/js_runtime/lib/shared/embedded_names.dart"
_async_await_error_codes:
- uri: "../../sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart"
+ uri: "_internal/js_runtime/lib/shared/async_await_error_codes.dart"
_recipe_syntax:
- uri: "../../sdk/lib/_internal/js_runtime/lib/shared/recipe_syntax.dart"
+ uri: "_internal/js_runtime/lib/shared/recipe_syntax.dart"
_metadata:
- uri: "../../sdk/lib/html/html_common/metadata.dart"
+ uri: "html/html_common/metadata.dart"
dart2js_server:
libraries:
async:
- uri: "../../sdk/lib/async/async.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/async_patch.dart"
+ uri: "async/async.dart"
+ patches: "_internal/js_runtime/lib/async_patch.dart"
collection:
- uri: "../../sdk/lib/collection/collection.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/collection_patch.dart"
+ uri: "collection/collection.dart"
+ patches: "_internal/js_runtime/lib/collection_patch.dart"
convert:
- uri: "../../sdk/lib/convert/convert.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/convert_patch.dart"
+ uri: "convert/convert.dart"
+ patches: "_internal/js_runtime/lib/convert_patch.dart"
core:
- uri: "../../sdk/lib/core/core.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/core_patch.dart"
+ uri: "core/core.dart"
+ patches: "_internal/js_runtime/lib/core_patch.dart"
developer:
- uri: "../../sdk/lib/developer/developer.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/developer_patch.dart"
+ uri: "developer/developer.dart"
+ patches: "_internal/js_runtime/lib/developer_patch.dart"
_http:
- uri: "../../sdk/lib/_http/http.dart"
+ uri: "_http/http.dart"
io:
- uri: "../../sdk/lib/io/io.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/io_patch.dart"
+ uri: "io/io.dart"
+ patches: "_internal/js_runtime/lib/io_patch.dart"
supported: false
isolate:
- uri: "../../sdk/lib/isolate/isolate.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/isolate_patch.dart"
+ uri: "isolate/isolate.dart"
+ patches: "_internal/js_runtime/lib/isolate_patch.dart"
supported: false
js:
- uri: "../../sdk/lib/js/js.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/js_patch.dart"
+ uri: "js/js.dart"
+ patches: "_internal/js_runtime/lib/js_patch.dart"
_js:
- uri: "../../sdk/lib/js/_js.dart"
- patches: "../../sdk/lib/js/_js_server.dart"
+ uri: "js/_js.dart"
+ patches: "js/_js_server.dart"
js_util:
- uri: "../../sdk/lib/js_util/js_util.dart"
+ uri: "js_util/js_util.dart"
math:
- uri: "../../sdk/lib/math/math.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/math_patch.dart"
+ uri: "math/math.dart"
+ patches: "_internal/js_runtime/lib/math_patch.dart"
typed_data:
uri: "typed_data/typed_data.dart"
@@ -325,35 +325,35 @@
uri: "_internal/js_runtime/lib/native_typed_data.dart"
_internal:
- uri: "../../sdk/lib/internal/internal.dart"
- patches: "../../sdk/lib/_internal/js_runtime/lib/internal_patch.dart"
+ uri: "internal/internal.dart"
+ patches: "_internal/js_runtime/lib/internal_patch.dart"
_js_helper:
- uri: "../../sdk/lib/_internal/js_runtime/lib/js_helper.dart"
+ uri: "_internal/js_runtime/lib/js_helper.dart"
_rti:
- uri: "../../sdk/lib/_internal/js_runtime/lib/rti.dart"
+ uri: "_internal/js_runtime/lib/rti.dart"
_interceptors:
- uri: "../../sdk/lib/_internal/js_runtime/lib/interceptors.dart"
+ uri: "_internal/js_runtime/lib/interceptors.dart"
_foreign_helper:
- uri: "../../sdk/lib/_internal/js_runtime/lib/foreign_helper.dart"
+ uri: "_internal/js_runtime/lib/foreign_helper.dart"
_js_names:
- uri: "../../sdk/lib/_internal/js_runtime/lib/js_names.dart"
+ uri: "_internal/js_runtime/lib/js_names.dart"
_js_primitives:
- uri: "../../sdk/lib/_internal/js_runtime/lib/js_primitives.dart"
+ uri: "_internal/js_runtime/lib/js_primitives.dart"
_js_embedded_names:
- uri: "../../sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart"
+ uri: "_internal/js_runtime/lib/shared/embedded_names.dart"
_async_await_error_codes:
- uri: "../../sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart"
+ uri: "_internal/js_runtime/lib/shared/async_await_error_codes.dart"
_recipe_syntax:
- uri: "../../sdk/lib/_internal/js_runtime/lib/shared/recipe_syntax.dart"
+ uri: "_internal/js_runtime/lib/shared/recipe_syntax.dart"
dartdevc:
libraries:
diff --git a/sdk_nnbd/lib/svg/dart2js/svg_dart2js.dart b/sdk_nnbd/lib/svg/dart2js/svg_dart2js.dart
index 3a87ae9..8eaabef 100644
--- a/sdk_nnbd/lib/svg/dart2js/svg_dart2js.dart
+++ b/sdk_nnbd/lib/svg/dart2js/svg_dart2js.dart
@@ -54,11 +54,11 @@
*/
AElement.created() : super.created();
- AnimatedString get target => JS("AnimatedString", "#.target", this);
+ AnimatedString get target native;
// From SVGURIReference
- AnimatedString get href => JS("AnimatedString", "#.href", this);
+ AnimatedString get href native;
}
// 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
@@ -82,25 +82,19 @@
static const int SVG_ANGLETYPE_UNSPECIFIED = 1;
- int get unitType => JS("int", "#.unitType", this);
+ int get unitType native;
- num get value => JS("num", "#.value", this);
+ num get value native;
- set value(num value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(num value) native;
- String get valueAsString => JS("String", "#.valueAsString", this);
+ String get valueAsString native;
- set valueAsString(String value) {
- JS("void", "#.valueAsString = #", this, value);
- }
+ set valueAsString(String value) native;
- num get valueInSpecifiedUnits => JS("num", "#.valueInSpecifiedUnits", this);
+ num get valueInSpecifiedUnits native;
- set valueInSpecifiedUnits(num value) {
- JS("void", "#.valueInSpecifiedUnits = #", this, value);
- }
+ set valueInSpecifiedUnits(num value) native;
void convertToSpecifiedUnits(int unitType) native;
@@ -208,9 +202,9 @@
throw new UnsupportedError("Not supported");
}
- Angle get animVal => JS("Angle", "#.animVal", this);
+ Angle get animVal native;
- Angle get baseVal => JS("Angle", "#.baseVal", this);
+ Angle get baseVal native;
}
// 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
@@ -224,13 +218,11 @@
throw new UnsupportedError("Not supported");
}
- bool get animVal => JS("bool", "#.animVal", this);
+ bool get animVal native;
- bool get baseVal => JS("bool", "#.baseVal", this);
+ bool get baseVal native;
- set baseVal(bool value) {
- JS("void", "#.baseVal = #", this, value);
- }
+ set baseVal(bool value) native;
}
// 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
@@ -244,13 +236,11 @@
throw new UnsupportedError("Not supported");
}
- int get animVal => JS("int", "#.animVal", this);
+ int get animVal native;
- int get baseVal => JS("int", "#.baseVal", this);
+ int get baseVal native;
- set baseVal(int value) {
- JS("void", "#.baseVal = #", this, value);
- }
+ set baseVal(int value) native;
}
// 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
@@ -264,13 +254,11 @@
throw new UnsupportedError("Not supported");
}
- int get animVal => JS("int", "#.animVal", this);
+ int get animVal native;
- int get baseVal => JS("int", "#.baseVal", this);
+ int get baseVal native;
- set baseVal(int value) {
- JS("void", "#.baseVal = #", this, value);
- }
+ set baseVal(int value) native;
}
// 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
@@ -284,9 +272,9 @@
throw new UnsupportedError("Not supported");
}
- Length get animVal => JS("Length", "#.animVal", this);
+ Length get animVal native;
- Length get baseVal => JS("Length", "#.baseVal", this);
+ Length get baseVal native;
}
// 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
@@ -300,9 +288,9 @@
throw new UnsupportedError("Not supported");
}
- LengthList get animVal => JS("LengthList", "#.animVal", this);
+ LengthList get animVal native;
- LengthList get baseVal => JS("LengthList", "#.baseVal", this);
+ LengthList get baseVal native;
}
// 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
@@ -316,13 +304,11 @@
throw new UnsupportedError("Not supported");
}
- num get animVal => JS("num", "#.animVal", this);
+ num get animVal native;
- num get baseVal => JS("num", "#.baseVal", this);
+ num get baseVal native;
- set baseVal(num value) {
- JS("void", "#.baseVal = #", this, value);
- }
+ set baseVal(num value) native;
}
// 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
@@ -336,9 +322,9 @@
throw new UnsupportedError("Not supported");
}
- NumberList get animVal => JS("NumberList", "#.animVal", this);
+ NumberList get animVal native;
- NumberList get baseVal => JS("NumberList", "#.baseVal", this);
+ NumberList get baseVal native;
}
// 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
@@ -352,11 +338,9 @@
throw new UnsupportedError("Not supported");
}
- PreserveAspectRatio get animVal =>
- JS("PreserveAspectRatio", "#.animVal", this);
+ PreserveAspectRatio get animVal native;
- PreserveAspectRatio get baseVal =>
- JS("PreserveAspectRatio", "#.baseVal", this);
+ PreserveAspectRatio get baseVal native;
}
// 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
@@ -370,9 +354,9 @@
throw new UnsupportedError("Not supported");
}
- Rect get animVal => JS("Rect", "#.animVal", this);
+ Rect get animVal native;
- Rect get baseVal => JS("Rect", "#.baseVal", this);
+ Rect get baseVal native;
}
// 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
@@ -386,13 +370,11 @@
throw new UnsupportedError("Not supported");
}
- String get animVal => JS("String", "#.animVal", this);
+ String get animVal native;
- String get baseVal => JS("String", "#.baseVal", this);
+ String get baseVal native;
- set baseVal(String value) {
- JS("void", "#.baseVal = #", this, value);
- }
+ set baseVal(String value) native;
}
// 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
@@ -406,9 +388,9 @@
throw new UnsupportedError("Not supported");
}
- TransformList get animVal => JS("TransformList", "#.animVal", this);
+ TransformList get animVal native;
- TransformList get baseVal => JS("TransformList", "#.baseVal", this);
+ TransformList get baseVal native;
}
// 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
@@ -432,7 +414,7 @@
*/
AnimationElement.created() : super.created();
- SvgElement get targetElement => JS("SvgElement", "#.targetElement", this);
+ SvgElement get targetElement native;
void beginElement() native;
@@ -450,10 +432,9 @@
// From SVGTests
- StringList get requiredExtensions =>
- JS("StringList", "#.requiredExtensions", this);
+ StringList get requiredExtensions native;
- StringList get systemLanguage => JS("StringList", "#.systemLanguage", this);
+ StringList get systemLanguage native;
}
// 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
@@ -477,11 +458,11 @@
*/
CircleElement.created() : super.created();
- AnimatedLength get cx => JS("AnimatedLength", "#.cx", this);
+ AnimatedLength get cx native;
- AnimatedLength get cy => JS("AnimatedLength", "#.cy", this);
+ AnimatedLength get cy native;
- AnimatedLength get r => JS("AnimatedLength", "#.r", this);
+ AnimatedLength get r native;
}
// 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
@@ -505,8 +486,7 @@
*/
ClipPathElement.created() : super.created();
- AnimatedEnumeration get clipPathUnits =>
- JS("AnimatedEnumeration", "#.clipPathUnits", this);
+ AnimatedEnumeration get clipPathUnits native;
}
// 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
@@ -589,13 +569,13 @@
*/
EllipseElement.created() : super.created();
- AnimatedLength get cx => JS("AnimatedLength", "#.cx", this);
+ AnimatedLength get cx native;
- AnimatedLength get cy => JS("AnimatedLength", "#.cy", this);
+ AnimatedLength get cy native;
- AnimatedLength get rx => JS("AnimatedLength", "#.rx", this);
+ AnimatedLength get rx native;
- AnimatedLength get ry => JS("AnimatedLength", "#.ry", this);
+ AnimatedLength get ry native;
}
// 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
@@ -641,23 +621,23 @@
static const int SVG_FEBLEND_MODE_UNKNOWN = 0;
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
- AnimatedString get in2 => JS("AnimatedString", "#.in2", this);
+ AnimatedString get in2 native;
- AnimatedEnumeration get mode => JS("AnimatedEnumeration", "#.mode", this);
+ AnimatedEnumeration get mode native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -701,23 +681,23 @@
static const int SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0;
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
- AnimatedEnumeration get type => JS("AnimatedEnumeration", "#.type", this);
+ AnimatedEnumeration get type native;
- AnimatedNumberList get values => JS("AnimatedNumberList", "#.values", this);
+ AnimatedNumberList get values native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -751,19 +731,19 @@
SvgElement.isTagSupported('feComponentTransfer') &&
(new SvgElement.tag('feComponentTransfer') is FEComponentTransferElement);
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -798,32 +778,31 @@
static const int SVG_FECOMPOSITE_OPERATOR_XOR = 5;
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
- AnimatedString get in2 => JS("AnimatedString", "#.in2", this);
+ AnimatedString get in2 native;
- AnimatedNumber get k1 => JS("AnimatedNumber", "#.k1", this);
+ AnimatedNumber get k1 native;
- AnimatedNumber get k2 => JS("AnimatedNumber", "#.k2", this);
+ AnimatedNumber get k2 native;
- AnimatedNumber get k3 => JS("AnimatedNumber", "#.k3", this);
+ AnimatedNumber get k3 native;
- AnimatedNumber get k4 => JS("AnimatedNumber", "#.k4", this);
+ AnimatedNumber get k4 native;
- AnimatedEnumeration get operator =>
- JS("AnimatedEnumeration", "#.operator", this);
+ AnimatedEnumeration get operator native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -865,46 +844,41 @@
static const int SVG_EDGEMODE_WRAP = 2;
- AnimatedNumber get bias => JS("AnimatedNumber", "#.bias", this);
+ AnimatedNumber get bias native;
- AnimatedNumber get divisor => JS("AnimatedNumber", "#.divisor", this);
+ AnimatedNumber get divisor native;
- AnimatedEnumeration get edgeMode =>
- JS("AnimatedEnumeration", "#.edgeMode", this);
+ AnimatedEnumeration get edgeMode native;
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
- AnimatedNumberList get kernelMatrix =>
- JS("AnimatedNumberList", "#.kernelMatrix", this);
+ AnimatedNumberList get kernelMatrix native;
- AnimatedNumber get kernelUnitLengthX =>
- JS("AnimatedNumber", "#.kernelUnitLengthX", this);
+ AnimatedNumber get kernelUnitLengthX native;
- AnimatedNumber get kernelUnitLengthY =>
- JS("AnimatedNumber", "#.kernelUnitLengthY", this);
+ AnimatedNumber get kernelUnitLengthY native;
- AnimatedInteger get orderX => JS("AnimatedInteger", "#.orderX", this);
+ AnimatedInteger get orderX native;
- AnimatedInteger get orderY => JS("AnimatedInteger", "#.orderY", this);
+ AnimatedInteger get orderY native;
- AnimatedBoolean get preserveAlpha =>
- JS("AnimatedBoolean", "#.preserveAlpha", this);
+ AnimatedBoolean get preserveAlpha native;
- AnimatedInteger get targetX => JS("AnimatedInteger", "#.targetX", this);
+ AnimatedInteger get targetX native;
- AnimatedInteger get targetY => JS("AnimatedInteger", "#.targetY", this);
+ AnimatedInteger get targetY native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -938,31 +912,27 @@
SvgElement.isTagSupported('feDiffuseLighting') &&
(new SvgElement.tag('feDiffuseLighting') is FEDiffuseLightingElement);
- AnimatedNumber get diffuseConstant =>
- JS("AnimatedNumber", "#.diffuseConstant", this);
+ AnimatedNumber get diffuseConstant native;
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
- AnimatedNumber get kernelUnitLengthX =>
- JS("AnimatedNumber", "#.kernelUnitLengthX", this);
+ AnimatedNumber get kernelUnitLengthX native;
- AnimatedNumber get kernelUnitLengthY =>
- JS("AnimatedNumber", "#.kernelUnitLengthY", this);
+ AnimatedNumber get kernelUnitLengthY native;
- AnimatedNumber get surfaceScale =>
- JS("AnimatedNumber", "#.surfaceScale", this);
+ AnimatedNumber get surfaceScale native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1006,29 +976,27 @@
static const int SVG_CHANNEL_UNKNOWN = 0;
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
- AnimatedString get in2 => JS("AnimatedString", "#.in2", this);
+ AnimatedString get in2 native;
- AnimatedNumber get scale => JS("AnimatedNumber", "#.scale", this);
+ AnimatedNumber get scale native;
- AnimatedEnumeration get xChannelSelector =>
- JS("AnimatedEnumeration", "#.xChannelSelector", this);
+ AnimatedEnumeration get xChannelSelector native;
- AnimatedEnumeration get yChannelSelector =>
- JS("AnimatedEnumeration", "#.yChannelSelector", this);
+ AnimatedEnumeration get yChannelSelector native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1061,9 +1029,9 @@
SvgElement.isTagSupported('feDistantLight') &&
(new SvgElement.tag('feDistantLight') is FEDistantLightElement);
- AnimatedNumber get azimuth => JS("AnimatedNumber", "#.azimuth", this);
+ AnimatedNumber get azimuth native;
- AnimatedNumber get elevation => JS("AnimatedNumber", "#.elevation", this);
+ AnimatedNumber get elevation native;
}
// 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
@@ -1099,15 +1067,15 @@
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1265,27 +1233,25 @@
SvgElement.isTagSupported('feGaussianBlur') &&
(new SvgElement.tag('feGaussianBlur') is FEGaussianBlurElement);
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
- AnimatedNumber get stdDeviationX =>
- JS("AnimatedNumber", "#.stdDeviationX", this);
+ AnimatedNumber get stdDeviationX native;
- AnimatedNumber get stdDeviationY =>
- JS("AnimatedNumber", "#.stdDeviationY", this);
+ AnimatedNumber get stdDeviationY native;
void setStdDeviation(num stdDeviationX, num stdDeviationY) native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1319,24 +1285,23 @@
SvgElement.isTagSupported('feImage') &&
(new SvgElement.tag('feImage') is FEImageElement);
- AnimatedPreserveAspectRatio get preserveAspectRatio =>
- JS("AnimatedPreserveAspectRatio", "#.preserveAspectRatio", this);
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
// From SVGURIReference
- AnimatedString get href => JS("AnimatedString", "#.href", this);
+ AnimatedString get href native;
}
// 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
@@ -1372,15 +1337,15 @@
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1413,7 +1378,7 @@
SvgElement.isTagSupported('feMergeNode') &&
(new SvgElement.tag('feMergeNode') is FEMergeNodeElement);
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
}
// 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
@@ -1444,26 +1409,25 @@
static const int SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0;
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
- AnimatedEnumeration get operator =>
- JS("AnimatedEnumeration", "#.operator", this);
+ AnimatedEnumeration get operator native;
- AnimatedNumber get radiusX => JS("AnimatedNumber", "#.radiusX", this);
+ AnimatedNumber get radiusX native;
- AnimatedNumber get radiusY => JS("AnimatedNumber", "#.radiusY", this);
+ AnimatedNumber get radiusY native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1497,23 +1461,23 @@
SvgElement.isTagSupported('feOffset') &&
(new SvgElement.tag('feOffset') is FEOffsetElement);
- AnimatedNumber get dx => JS("AnimatedNumber", "#.dx", this);
+ AnimatedNumber get dx native;
- AnimatedNumber get dy => JS("AnimatedNumber", "#.dy", this);
+ AnimatedNumber get dy native;
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1546,11 +1510,11 @@
SvgElement.isTagSupported('fePointLight') &&
(new SvgElement.tag('fePointLight') is FEPointLightElement);
- AnimatedNumber get x => JS("AnimatedNumber", "#.x", this);
+ AnimatedNumber get x native;
- AnimatedNumber get y => JS("AnimatedNumber", "#.y", this);
+ AnimatedNumber get y native;
- AnimatedNumber get z => JS("AnimatedNumber", "#.z", this);
+ AnimatedNumber get z native;
}
// 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
@@ -1584,34 +1548,29 @@
SvgElement.isTagSupported('feSpecularLighting') &&
(new SvgElement.tag('feSpecularLighting') is FESpecularLightingElement);
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
- AnimatedNumber get kernelUnitLengthX =>
- JS("AnimatedNumber", "#.kernelUnitLengthX", this);
+ AnimatedNumber get kernelUnitLengthX native;
- AnimatedNumber get kernelUnitLengthY =>
- JS("AnimatedNumber", "#.kernelUnitLengthY", this);
+ AnimatedNumber get kernelUnitLengthY native;
- AnimatedNumber get specularConstant =>
- JS("AnimatedNumber", "#.specularConstant", this);
+ AnimatedNumber get specularConstant native;
- AnimatedNumber get specularExponent =>
- JS("AnimatedNumber", "#.specularExponent", this);
+ AnimatedNumber get specularExponent native;
- AnimatedNumber get surfaceScale =>
- JS("AnimatedNumber", "#.surfaceScale", this);
+ AnimatedNumber get surfaceScale native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1644,23 +1603,21 @@
SvgElement.isTagSupported('feSpotLight') &&
(new SvgElement.tag('feSpotLight') is FESpotLightElement);
- AnimatedNumber get limitingConeAngle =>
- JS("AnimatedNumber", "#.limitingConeAngle", this);
+ AnimatedNumber get limitingConeAngle native;
- AnimatedNumber get pointsAtX => JS("AnimatedNumber", "#.pointsAtX", this);
+ AnimatedNumber get pointsAtX native;
- AnimatedNumber get pointsAtY => JS("AnimatedNumber", "#.pointsAtY", this);
+ AnimatedNumber get pointsAtY native;
- AnimatedNumber get pointsAtZ => JS("AnimatedNumber", "#.pointsAtZ", this);
+ AnimatedNumber get pointsAtZ native;
- AnimatedNumber get specularExponent =>
- JS("AnimatedNumber", "#.specularExponent", this);
+ AnimatedNumber get specularExponent native;
- AnimatedNumber get x => JS("AnimatedNumber", "#.x", this);
+ AnimatedNumber get x native;
- AnimatedNumber get y => JS("AnimatedNumber", "#.y", this);
+ AnimatedNumber get y native;
- AnimatedNumber get z => JS("AnimatedNumber", "#.z", this);
+ AnimatedNumber get z native;
}
// 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
@@ -1694,19 +1651,19 @@
SvgElement.isTagSupported('feTile') &&
(new SvgElement.tag('feTile') is FETileElement);
- AnimatedString get in1 => JS("AnimatedString", "#.in1", this);
+ AnimatedString get in1 native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1752,32 +1709,29 @@
static const int SVG_TURBULENCE_TYPE_UNKNOWN = 0;
- AnimatedNumber get baseFrequencyX =>
- JS("AnimatedNumber", "#.baseFrequencyX", this);
+ AnimatedNumber get baseFrequencyX native;
- AnimatedNumber get baseFrequencyY =>
- JS("AnimatedNumber", "#.baseFrequencyY", this);
+ AnimatedNumber get baseFrequencyY native;
- AnimatedInteger get numOctaves => JS("AnimatedInteger", "#.numOctaves", this);
+ AnimatedInteger get numOctaves native;
- AnimatedNumber get seed => JS("AnimatedNumber", "#.seed", this);
+ AnimatedNumber get seed native;
- AnimatedEnumeration get stitchTiles =>
- JS("AnimatedEnumeration", "#.stitchTiles", this);
+ AnimatedEnumeration get stitchTiles native;
- AnimatedEnumeration get type => JS("AnimatedEnumeration", "#.type", this);
+ AnimatedEnumeration get type native;
// From SVGFilterPrimitiveStandardAttributes
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1810,23 +1764,21 @@
SvgElement.isTagSupported('filter') &&
(new SvgElement.tag('filter') is FilterElement);
- AnimatedEnumeration get filterUnits =>
- JS("AnimatedEnumeration", "#.filterUnits", this);
+ AnimatedEnumeration get filterUnits native;
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedEnumeration get primitiveUnits =>
- JS("AnimatedEnumeration", "#.primitiveUnits", this);
+ AnimatedEnumeration get primitiveUnits native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
// From SVGURIReference
- AnimatedString get href => JS("AnimatedString", "#.href", this);
+ AnimatedString get href native;
}
// 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
@@ -1839,15 +1791,15 @@
throw new UnsupportedError("Not supported");
}
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedString get result => JS("AnimatedString", "#.result", this);
+ AnimatedString get result native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1860,10 +1812,9 @@
throw new UnsupportedError("Not supported");
}
- AnimatedPreserveAspectRatio get preserveAspectRatio =>
- JS("AnimatedPreserveAspectRatio", "#.preserveAspectRatio", this);
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- AnimatedRect get viewBox => JS("AnimatedRect", "#.viewBox", this);
+ AnimatedRect get viewBox native;
}
// 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
@@ -1895,13 +1846,13 @@
SvgElement.isTagSupported('foreignObject') &&
(new SvgElement.tag('foreignObject') is ForeignObjectElement);
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -1941,7 +1892,7 @@
*/
GeometryElement.created() : super.created();
- AnimatedNumber get pathLength => JS("AnimatedNumber", "#.pathLength", this);
+ AnimatedNumber get pathLength native;
Point getPointAtLength(num distance) native;
@@ -1968,14 +1919,11 @@
*/
GraphicsElement.created() : super.created();
- SvgElement get farthestViewportElement =>
- JS("SvgElement", "#.farthestViewportElement", this);
+ SvgElement get farthestViewportElement native;
- SvgElement get nearestViewportElement =>
- JS("SvgElement", "#.nearestViewportElement", this);
+ SvgElement get nearestViewportElement native;
- AnimatedTransformList get transform =>
- JS("AnimatedTransformList", "#.transform", this);
+ AnimatedTransformList get transform native;
Rect getBBox() native;
@@ -1987,10 +1935,9 @@
// From SVGTests
- StringList get requiredExtensions =>
- JS("StringList", "#.requiredExtensions", this);
+ StringList get requiredExtensions native;
- StringList get systemLanguage => JS("StringList", "#.systemLanguage", this);
+ StringList get systemLanguage native;
}
// 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
@@ -2013,28 +1960,25 @@
*/
ImageElement.created() : super.created();
- String get async => JS("String", "#.async", this);
+ String get async native;
- set async(String value) {
- JS("void", "#.async = #", this, value);
- }
+ set async(String value) native;
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedPreserveAspectRatio get preserveAspectRatio =>
- JS("AnimatedPreserveAspectRatio", "#.preserveAspectRatio", this);
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
Future decode() => promiseToFuture(JS("", "#.decode()", this));
// From SVGURIReference
- AnimatedString get href => JS("AnimatedString", "#.href", this);
+ AnimatedString get href native;
}
// 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
@@ -2070,25 +2014,19 @@
static const int SVG_LENGTHTYPE_UNKNOWN = 0;
- int get unitType => JS("int", "#.unitType", this);
+ int get unitType native;
- num get value => JS("num", "#.value", this);
+ num get value native;
- set value(num value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(num value) native;
- String get valueAsString => JS("String", "#.valueAsString", this);
+ String get valueAsString native;
- set valueAsString(String value) {
- JS("void", "#.valueAsString = #", this, value);
- }
+ set valueAsString(String value) native;
- num get valueInSpecifiedUnits => JS("num", "#.valueInSpecifiedUnits", this);
+ num get valueInSpecifiedUnits native;
- set valueInSpecifiedUnits(num value) {
- JS("void", "#.valueInSpecifiedUnits = #", this, value);
- }
+ set valueInSpecifiedUnits(num value) native;
void convertToSpecifiedUnits(int unitType) native;
@@ -2110,7 +2048,7 @@
int get length => JS("int", "#.length", this);
- int get numberOfItems => JS("int", "#.numberOfItems", this);
+ int get numberOfItems native;
Length operator [](int index) {
if (JS("bool", "# >>> 0 !== # || # >= #", index, index, index, length))
@@ -2192,13 +2130,13 @@
*/
LineElement.created() : super.created();
- AnimatedLength get x1 => JS("AnimatedLength", "#.x1", this);
+ AnimatedLength get x1 native;
- AnimatedLength get x2 => JS("AnimatedLength", "#.x2", this);
+ AnimatedLength get x2 native;
- AnimatedLength get y1 => JS("AnimatedLength", "#.y1", this);
+ AnimatedLength get y1 native;
- AnimatedLength get y2 => JS("AnimatedLength", "#.y2", this);
+ AnimatedLength get y2 native;
}
// 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
@@ -2222,13 +2160,13 @@
*/
LinearGradientElement.created() : super.created();
- AnimatedLength get x1 => JS("AnimatedLength", "#.x1", this);
+ AnimatedLength get x1 native;
- AnimatedLength get x2 => JS("AnimatedLength", "#.x2", this);
+ AnimatedLength get x2 native;
- AnimatedLength get y1 => JS("AnimatedLength", "#.y1", this);
+ AnimatedLength get y1 native;
- AnimatedLength get y2 => JS("AnimatedLength", "#.y2", this);
+ AnimatedLength get y2 native;
}
// 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
@@ -2264,22 +2202,19 @@
static const int SVG_MARKER_ORIENT_UNKNOWN = 0;
- AnimatedLength get markerHeight =>
- JS("AnimatedLength", "#.markerHeight", this);
+ AnimatedLength get markerHeight native;
- AnimatedEnumeration get markerUnits =>
- JS("AnimatedEnumeration", "#.markerUnits", this);
+ AnimatedEnumeration get markerUnits native;
- AnimatedLength get markerWidth => JS("AnimatedLength", "#.markerWidth", this);
+ AnimatedLength get markerWidth native;
- AnimatedAngle get orientAngle => JS("AnimatedAngle", "#.orientAngle", this);
+ AnimatedAngle get orientAngle native;
- AnimatedEnumeration get orientType =>
- JS("AnimatedEnumeration", "#.orientType", this);
+ AnimatedEnumeration get orientType native;
- AnimatedLength get refX => JS("AnimatedLength", "#.refX", this);
+ AnimatedLength get refX native;
- AnimatedLength get refY => JS("AnimatedLength", "#.refY", this);
+ AnimatedLength get refY native;
void setOrientToAngle(Angle angle) native;
@@ -2287,10 +2222,9 @@
// From SVGFitToViewBox
- AnimatedPreserveAspectRatio get preserveAspectRatio =>
- JS("AnimatedPreserveAspectRatio", "#.preserveAspectRatio", this);
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- AnimatedRect get viewBox => JS("AnimatedRect", "#.viewBox", this);
+ AnimatedRect get viewBox native;
}
// 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
@@ -2313,26 +2247,23 @@
*/
MaskElement.created() : super.created();
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedEnumeration get maskContentUnits =>
- JS("AnimatedEnumeration", "#.maskContentUnits", this);
+ AnimatedEnumeration get maskContentUnits native;
- AnimatedEnumeration get maskUnits =>
- JS("AnimatedEnumeration", "#.maskUnits", this);
+ AnimatedEnumeration get maskUnits native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
// From SVGTests
- StringList get requiredExtensions =>
- JS("StringList", "#.requiredExtensions", this);
+ StringList get requiredExtensions native;
- StringList get systemLanguage => JS("StringList", "#.systemLanguage", this);
+ StringList get systemLanguage native;
}
// 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
@@ -2346,41 +2277,29 @@
throw new UnsupportedError("Not supported");
}
- num get a => JS("num", "#.a", this);
+ num get a native;
- set a(num value) {
- JS("void", "#.a = #", this, value);
- }
+ set a(num value) native;
- num get b => JS("num", "#.b", this);
+ num get b native;
- set b(num value) {
- JS("void", "#.b = #", this, value);
- }
+ set b(num value) native;
- num get c => JS("num", "#.c", this);
+ num get c native;
- set c(num value) {
- JS("void", "#.c = #", this, value);
- }
+ set c(num value) native;
- num get d => JS("num", "#.d", this);
+ num get d native;
- set d(num value) {
- JS("void", "#.d = #", this, value);
- }
+ set d(num value) native;
- num get e => JS("num", "#.e", this);
+ num get e native;
- set e(num value) {
- JS("void", "#.e = #", this, value);
- }
+ set e(num value) native;
- num get f => JS("num", "#.f", this);
+ num get f native;
- set f(num value) {
- JS("void", "#.f = #", this, value);
- }
+ set f(num value) native;
Matrix flipX() native;
@@ -2434,11 +2353,9 @@
throw new UnsupportedError("Not supported");
}
- num get value => JS("num", "#.value", this);
+ num get value native;
- set value(num value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(num value) native;
}
// 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
@@ -2456,7 +2373,7 @@
int get length => JS("int", "#.length", this);
- int get numberOfItems => JS("int", "#.numberOfItems", this);
+ int get numberOfItems native;
Number operator [](int index) {
if (JS("bool", "# >>> 0 !== # || # >= #", index, index, index, length))
@@ -2561,40 +2478,35 @@
*/
PatternElement.created() : super.created();
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedEnumeration get patternContentUnits =>
- JS("AnimatedEnumeration", "#.patternContentUnits", this);
+ AnimatedEnumeration get patternContentUnits native;
- AnimatedTransformList get patternTransform =>
- JS("AnimatedTransformList", "#.patternTransform", this);
+ AnimatedTransformList get patternTransform native;
- AnimatedEnumeration get patternUnits =>
- JS("AnimatedEnumeration", "#.patternUnits", this);
+ AnimatedEnumeration get patternUnits native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
// From SVGFitToViewBox
- AnimatedPreserveAspectRatio get preserveAspectRatio =>
- JS("AnimatedPreserveAspectRatio", "#.preserveAspectRatio", this);
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- AnimatedRect get viewBox => JS("AnimatedRect", "#.viewBox", this);
+ AnimatedRect get viewBox native;
// From SVGTests
- StringList get requiredExtensions =>
- JS("StringList", "#.requiredExtensions", this);
+ StringList get requiredExtensions native;
- StringList get systemLanguage => JS("StringList", "#.systemLanguage", this);
+ StringList get systemLanguage native;
// From SVGURIReference
- AnimatedString get href => JS("AnimatedString", "#.href", this);
+ AnimatedString get href native;
}
// 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
@@ -2608,17 +2520,13 @@
throw new UnsupportedError("Not supported");
}
- num get x => JS("num", "#.x", this);
+ num get x native;
- set x(num value) {
- JS("void", "#.x = #", this, value);
- }
+ set x(num value) native;
- num get y => JS("num", "#.y", this);
+ num get y native;
- set y(num value) {
- JS("void", "#.y = #", this, value);
- }
+ set y(num value) native;
Point matrixTransform(Matrix matrix) native;
}
@@ -2634,9 +2542,9 @@
throw new UnsupportedError("Not supported");
}
- int get length => JS("int", "#.length", this);
+ int get length native;
- int get numberOfItems => JS("int", "#.numberOfItems", this);
+ int get numberOfItems native;
void __setter__(int index, Point newItem) native;
@@ -2676,9 +2584,9 @@
*/
PolygonElement.created() : super.created();
- PointList get animatedPoints => JS("PointList", "#.animatedPoints", this);
+ PointList get animatedPoints native;
- PointList get points => JS("PointList", "#.points", this);
+ PointList get points native;
}
// 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
@@ -2702,9 +2610,9 @@
*/
PolylineElement.created() : super.created();
- PointList get animatedPoints => JS("PointList", "#.animatedPoints", this);
+ PointList get animatedPoints native;
- PointList get points => JS("PointList", "#.points", this);
+ PointList get points native;
}
// 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
@@ -2746,17 +2654,13 @@
static const int SVG_PRESERVEASPECTRATIO_XMINYMIN = 2;
- int get align => JS("int", "#.align", this);
+ int get align native;
- set align(int value) {
- JS("void", "#.align = #", this, value);
- }
+ set align(int value) native;
- int get meetOrSlice => JS("int", "#.meetOrSlice", this);
+ int get meetOrSlice native;
- set meetOrSlice(int value) {
- JS("void", "#.meetOrSlice = #", this, value);
- }
+ set meetOrSlice(int value) native;
}
// 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
@@ -2780,17 +2684,17 @@
*/
RadialGradientElement.created() : super.created();
- AnimatedLength get cx => JS("AnimatedLength", "#.cx", this);
+ AnimatedLength get cx native;
- AnimatedLength get cy => JS("AnimatedLength", "#.cy", this);
+ AnimatedLength get cy native;
- AnimatedLength get fr => JS("AnimatedLength", "#.fr", this);
+ AnimatedLength get fr native;
- AnimatedLength get fx => JS("AnimatedLength", "#.fx", this);
+ AnimatedLength get fx native;
- AnimatedLength get fy => JS("AnimatedLength", "#.fy", this);
+ AnimatedLength get fy native;
- AnimatedLength get r => JS("AnimatedLength", "#.r", this);
+ AnimatedLength get r native;
}
// 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
@@ -2804,29 +2708,21 @@
throw new UnsupportedError("Not supported");
}
- num get height => JS("num", "#.height", this);
+ num get height native;
- set height(num value) {
- JS("void", "#.height = #", this, value);
- }
+ set height(num value) native;
- num get width => JS("num", "#.width", this);
+ num get width native;
- set width(num value) {
- JS("void", "#.width = #", this, value);
- }
+ set width(num value) native;
- num get x => JS("num", "#.x", this);
+ num get x native;
- set x(num value) {
- JS("void", "#.x = #", this, value);
- }
+ set x(num value) native;
- num get y => JS("num", "#.y", this);
+ num get y native;
- set y(num value) {
- JS("void", "#.y = #", this, value);
- }
+ set y(num value) native;
}
// 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
@@ -2849,17 +2745,17 @@
*/
RectElement.created() : super.created();
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedLength get rx => JS("AnimatedLength", "#.rx", this);
+ AnimatedLength get rx native;
- AnimatedLength get ry => JS("AnimatedLength", "#.ry", this);
+ AnimatedLength get ry native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
}
// 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
@@ -2883,15 +2779,13 @@
*/
ScriptElement.created() : super.created();
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
// From SVGURIReference
- AnimatedString get href => JS("AnimatedString", "#.href", this);
+ AnimatedString get href native;
}
// 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
@@ -2944,7 +2838,7 @@
StopElement.created() : super.created();
@JSName('offset')
- AnimatedNumber get gradientOffset => JS("AnimatedNumber", "#.offset", this);
+ AnimatedNumber get gradientOffset native;
}
// 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
@@ -2962,7 +2856,7 @@
int get length => JS("int", "#.length", this);
- int get numberOfItems => JS("int", "#.numberOfItems", this);
+ int get numberOfItems native;
String operator [](int index) {
if (JS("bool", "# >>> 0 !== # || # >= #", index, index, index, length))
@@ -3043,28 +2937,23 @@
*/
StyleElement.created() : super.created();
- bool get disabled => JS("bool", "#.disabled", this);
+ bool get disabled native;
- set disabled(bool value) {
- JS("void", "#.disabled = #", this, value);
- }
+ set disabled(bool value) native;
- String get media => JS("String", "#.media", this);
+ String get media native;
- set media(String value) {
- JS("void", "#.media = #", this, value);
- }
+ set media(String value) native;
- StyleSheet? get sheet => JS("StyleSheet", "#.sheet", this);
+ StyleSheet? get sheet native;
// Use implementation from Element.
- // final String title;
+ // String get title native;
+ // void set title(String value) native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
}
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -3164,7 +3053,7 @@
// We create a fragment which will parse in the HTML parser
var html = '<svg version="1.1">$svg</svg>';
var fragment =
- document.body.createFragment(html, treeSanitizer: treeSanitizer);
+ document.body!.createFragment(html, treeSanitizer: treeSanitizer);
var svgFragment = new DocumentFragment();
// The root is the <svg/> element, need to pull out the contents.
@@ -3394,20 +3283,20 @@
// Shadowing definition.
- AnimatedString get _svgClassName => JS("AnimatedString", "#.className", this);
+ AnimatedString get _svgClassName native;
@JSName('ownerSVGElement')
- SvgSvgElement? get ownerSvgElement =>
- JS("SvgSvgElement", "#.ownerSVGElement", this);
+ SvgSvgElement? get ownerSvgElement native;
// Use implementation from Element.
- // final CssStyleDeclaration style;
+ // CssStyleDeclaration get style native;
+ // void set style(CssStyleDeclaration value) native;
// Use implementation from Element.
- // final int tabIndex;
+ // int get tabIndex native;
+ // void set tabIndex(int value) native;
- SvgElement? get viewportElement =>
- JS("SvgElement", "#.viewportElement", this);
+ SvgElement? get viewportElement native;
void blur() native;
@@ -3415,11 +3304,9 @@
// From NoncedElement
- String get nonce => JS("String", "#.nonce", this);
+ String get nonce native;
- set nonce(String value) {
- JS("void", "#.nonce = #", this, value);
- }
+ set nonce(String value) native;
ElementStream<Event> get onAbort => abortEvent.forElement(this);
@@ -3571,21 +3458,19 @@
*/
SvgSvgElement.created() : super.created();
- num get currentScale => JS("num", "#.currentScale", this);
+ num get currentScale native;
- set currentScale(num value) {
- JS("void", "#.currentScale = #", this, value);
- }
+ set currentScale(num value) native;
- Point get currentTranslate => JS("Point", "#.currentTranslate", this);
+ Point get currentTranslate native;
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
bool animationsPaused() native;
@@ -3648,18 +3533,15 @@
// From SVGFitToViewBox
- AnimatedPreserveAspectRatio get preserveAspectRatio =>
- JS("AnimatedPreserveAspectRatio", "#.preserveAspectRatio", this);
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- AnimatedRect get viewBox => JS("AnimatedRect", "#.viewBox", this);
+ AnimatedRect get viewBox native;
// From SVGZoomAndPan
- int get zoomAndPan => JS("int", "#.zoomAndPan", this);
+ int get zoomAndPan native;
- set zoomAndPan(int value) {
- JS("void", "#.zoomAndPan = #", this, value);
- }
+ set zoomAndPan(int value) native;
}
// 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
@@ -3707,10 +3589,9 @@
// From SVGFitToViewBox
- AnimatedPreserveAspectRatio get preserveAspectRatio =>
- JS("AnimatedPreserveAspectRatio", "#.preserveAspectRatio", this);
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- AnimatedRect get viewBox => JS("AnimatedRect", "#.viewBox", this);
+ AnimatedRect get viewBox native;
}
// 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
@@ -3744,10 +3625,9 @@
throw new UnsupportedError("Not supported");
}
- StringList get requiredExtensions =>
- JS("StringList", "#.requiredExtensions", this);
+ StringList get requiredExtensions native;
- StringList get systemLanguage => JS("StringList", "#.systemLanguage", this);
+ StringList get systemLanguage native;
}
// 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
@@ -3773,10 +3653,9 @@
static const int LENGTHADJUST_UNKNOWN = 0;
- AnimatedEnumeration get lengthAdjust =>
- JS("AnimatedEnumeration", "#.lengthAdjust", this);
+ AnimatedEnumeration get lengthAdjust native;
- AnimatedLength get textLength => JS("AnimatedLength", "#.textLength", this);
+ AnimatedLength get textLength native;
int getCharNumAtPosition(Point point) native;
@@ -3847,16 +3726,15 @@
static const int TEXTPATH_SPACINGTYPE_UNKNOWN = 0;
- AnimatedEnumeration get method => JS("AnimatedEnumeration", "#.method", this);
+ AnimatedEnumeration get method native;
- AnimatedEnumeration get spacing =>
- JS("AnimatedEnumeration", "#.spacing", this);
+ AnimatedEnumeration get spacing native;
- AnimatedLength get startOffset => JS("AnimatedLength", "#.startOffset", this);
+ AnimatedLength get startOffset native;
// From SVGURIReference
- AnimatedString get href => JS("AnimatedString", "#.href", this);
+ AnimatedString get href native;
}
// 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
@@ -3876,15 +3754,15 @@
*/
TextPositioningElement.created() : super.created();
- AnimatedLengthList get dx => JS("AnimatedLengthList", "#.dx", this);
+ AnimatedLengthList get dx native;
- AnimatedLengthList get dy => JS("AnimatedLengthList", "#.dy", this);
+ AnimatedLengthList get dy native;
- AnimatedNumberList get rotate => JS("AnimatedNumberList", "#.rotate", this);
+ AnimatedNumberList get rotate native;
- AnimatedLengthList get x => JS("AnimatedLengthList", "#.x", this);
+ AnimatedLengthList get x native;
- AnimatedLengthList get y => JS("AnimatedLengthList", "#.y", this);
+ AnimatedLengthList get y native;
}
// 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
@@ -3933,11 +3811,11 @@
static const int SVG_TRANSFORM_UNKNOWN = 0;
- num get angle => JS("num", "#.angle", this);
+ num get angle native;
- Matrix get matrix => JS("Matrix", "#.matrix", this);
+ Matrix get matrix native;
- int get type => JS("int", "#.type", this);
+ int get type native;
void setMatrix(Matrix matrix) native;
@@ -3967,7 +3845,7 @@
int get length => JS("int", "#.length", this);
- int get numberOfItems => JS("int", "#.numberOfItems", this);
+ int get numberOfItems native;
Transform operator [](int index) {
if (JS("bool", "# >>> 0 !== # || # >= #", index, index, index, length))
@@ -4062,7 +3940,7 @@
throw new UnsupportedError("Not supported");
}
- AnimatedString get href => JS("AnimatedString", "#.href", this);
+ AnimatedString get href native;
}
// 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
@@ -4085,17 +3963,17 @@
*/
UseElement.created() : super.created();
- AnimatedLength get height => JS("AnimatedLength", "#.height", this);
+ AnimatedLength get height native;
- AnimatedLength get width => JS("AnimatedLength", "#.width", this);
+ AnimatedLength get width native;
- AnimatedLength get x => JS("AnimatedLength", "#.x", this);
+ AnimatedLength get x native;
- AnimatedLength get y => JS("AnimatedLength", "#.y", this);
+ AnimatedLength get y native;
// From SVGURIReference
- AnimatedString get href => JS("AnimatedString", "#.href", this);
+ AnimatedString get href native;
}
// 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
@@ -4120,18 +3998,15 @@
// From SVGFitToViewBox
- AnimatedPreserveAspectRatio get preserveAspectRatio =>
- JS("AnimatedPreserveAspectRatio", "#.preserveAspectRatio", this);
+ AnimatedPreserveAspectRatio get preserveAspectRatio native;
- AnimatedRect get viewBox => JS("AnimatedRect", "#.viewBox", this);
+ AnimatedRect get viewBox native;
// From SVGZoomAndPan
- int get zoomAndPan => JS("int", "#.zoomAndPan", this);
+ int get zoomAndPan native;
- set zoomAndPan(int value) {
- JS("void", "#.zoomAndPan = #", this, value);
- }
+ set zoomAndPan(int value) native;
}
// 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
@@ -4150,7 +4025,9 @@
static const int SVG_ZOOMANDPAN_UNKNOWN = 0;
- int zoomAndPan;
+ int get zoomAndPan native;
+
+ set zoomAndPan(int value) native;
}
// 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
@@ -4178,18 +4055,15 @@
static const int SVG_SPREADMETHOD_UNKNOWN = 0;
- AnimatedTransformList get gradientTransform =>
- JS("AnimatedTransformList", "#.gradientTransform", this);
+ AnimatedTransformList get gradientTransform native;
- AnimatedEnumeration get gradientUnits =>
- JS("AnimatedEnumeration", "#.gradientUnits", this);
+ AnimatedEnumeration get gradientUnits native;
- AnimatedEnumeration get spreadMethod =>
- JS("AnimatedEnumeration", "#.spreadMethod", this);
+ AnimatedEnumeration get spreadMethod native;
// From SVGURIReference
- AnimatedString get href => JS("AnimatedString", "#.href", this);
+ AnimatedString get href native;
}
// 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
diff --git a/sdk_nnbd/lib/vmservice/running_isolate.dart b/sdk_nnbd/lib/vmservice/running_isolate.dart
index 38af814..9de347f 100644
--- a/sdk_nnbd/lib/vmservice/running_isolate.dart
+++ b/sdk_nnbd/lib/vmservice/running_isolate.dart
@@ -32,7 +32,13 @@
// If we've received approval to resume from all clients who care, clear
// approval state and resume.
- final pauseType = await _isolatePauseType(service, portId.toString());
+ var pauseType;
+ try {
+ pauseType = await _isolatePauseType(service, portId.toString());
+ } catch (_errorResponse) {
+ // ignore errors when attempting to retrieve isolate pause type
+ return;
+ }
if (pauseType != kInvalidPauseEvent &&
_shouldResume(service, null, pauseType)) {
_resumeApprovalsByName.clear();
@@ -74,9 +80,15 @@
..params.addAll({
'isolateId': isolateId,
});
- final result =
- (await routeRequest(service, getIsolateMessage)).decodeJson();
- final pauseEvent = result['result']['pauseEvent'];
+ final Response result = await routeRequest(service, getIsolateMessage);
+ final resultJson = result.decodeJson();
+ if (resultJson['result'] == null ||
+ resultJson['result']['pauseEvent'] == null) {
+ // Failed to send getIsolate message(due to isolate being de-registered
+ // for example).
+ throw result;
+ }
+ final pauseEvent = resultJson['result']['pauseEvent'];
const pauseEvents = <String, int>{
'PauseStart': kPauseOnStartMask,
'PausePostRequest': kPauseOnReloadMask,
@@ -90,8 +102,12 @@
VMService service, Message message) async {
// If we've received approval to resume from all clients who care, clear
// approval state and resume.
- final pauseType =
- await _isolatePauseType(service, message.params['isolateId']);
+ var pauseType;
+ try {
+ pauseType = await _isolatePauseType(service, message.params['isolateId']);
+ } catch (errorResponse) {
+ return errorResponse;
+ }
if (pauseType == kInvalidPauseEvent ||
_shouldResume(service, message.client, pauseType)) {
_resumeApprovalsByName.clear();
diff --git a/sdk_nnbd/lib/web_audio/dart2js/web_audio_dart2js.dart b/sdk_nnbd/lib/web_audio/dart2js/web_audio_dart2js.dart
index 8021d08..a0d7b1e 100644
--- a/sdk_nnbd/lib/web_audio/dart2js/web_audio_dart2js.dart
+++ b/sdk_nnbd/lib/web_audio/dart2js/web_audio_dart2js.dart
@@ -50,31 +50,23 @@
static AnalyserNode _create_2(context) =>
JS('AnalyserNode', 'new AnalyserNode(#)', context);
- int get fftSize => JS("int", "#.fftSize", this);
+ int get fftSize native;
- set fftSize(int value) {
- JS("void", "#.fftSize = #", this, value);
- }
+ set fftSize(int value) native;
- int get frequencyBinCount => JS("int", "#.frequencyBinCount", this);
+ int get frequencyBinCount native;
- num get maxDecibels => JS("num", "#.maxDecibels", this);
+ num get maxDecibels native;
- set maxDecibels(num value) {
- JS("void", "#.maxDecibels = #", this, value);
- }
+ set maxDecibels(num value) native;
- num get minDecibels => JS("num", "#.minDecibels", this);
+ num get minDecibels native;
- set minDecibels(num value) {
- JS("void", "#.minDecibels = #", this, value);
- }
+ set minDecibels(num value) native;
- num get smoothingTimeConstant => JS("num", "#.smoothingTimeConstant", this);
+ num get smoothingTimeConstant native;
- set smoothingTimeConstant(num value) {
- JS("void", "#.smoothingTimeConstant = #", this, value);
- }
+ set smoothingTimeConstant(num value) native;
void getByteFrequencyData(Uint8List array) native;
@@ -102,13 +94,13 @@
static AudioBuffer _create_1(options) =>
JS('AudioBuffer', 'new AudioBuffer(#)', options);
- num get duration => JS("num", "#.duration", this);
+ num get duration native;
- int get length => JS("int", "#.length", this);
+ int get length native;
- int get numberOfChannels => JS("int", "#.numberOfChannels", this);
+ int get numberOfChannels native;
- num get sampleRate => JS("num", "#.sampleRate", this);
+ num get sampleRate native;
void copyFromChannel(Float32List destination, int channelNumber,
[int? startInChannel]) native;
@@ -146,29 +138,25 @@
static AudioBufferSourceNode _create_2(context) =>
JS('AudioBufferSourceNode', 'new AudioBufferSourceNode(#)', context);
- AudioBuffer? buffer;
+ AudioBuffer? get buffer native;
- AudioParam get detune => JS("AudioParam", "#.detune", this);
+ set buffer(AudioBuffer? value) native;
- bool get loop => JS("bool", "#.loop", this);
+ AudioParam get detune native;
- set loop(bool value) {
- JS("void", "#.loop = #", this, value);
- }
+ bool get loop native;
- num get loopEnd => JS("num", "#.loopEnd", this);
+ set loop(bool value) native;
- set loopEnd(num value) {
- JS("void", "#.loopEnd = #", this, value);
- }
+ num get loopEnd native;
- num get loopStart => JS("num", "#.loopStart", this);
+ set loopEnd(num value) native;
- set loopStart(num value) {
- JS("void", "#.loopStart = #", this, value);
- }
+ num get loopStart native;
- AudioParam get playbackRate => JS("AudioParam", "#.playbackRate", this);
+ set loopStart(num value) native;
+
+ AudioParam get playbackRate native;
void start([num? when, num? grainOffset, num? grainDuration]) native;
}
@@ -189,7 +177,7 @@
static bool get supported =>
JS('bool', '!!(window.AudioContext || window.webkitAudioContext)');
- num get baseLatency => JS("num", "#.baseLatency", this);
+ num get baseLatency native;
Future close() => promiseToFuture(JS("", "#.close()", this));
@@ -273,7 +261,7 @@
throw new UnsupportedError("Not supported");
}
- int get maxChannelCount => JS("int", "#.maxChannelCount", this);
+ int get maxChannelCount native;
}
// 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
@@ -286,23 +274,23 @@
throw new UnsupportedError("Not supported");
}
- AudioParam get forwardX => JS("AudioParam", "#.forwardX", this);
+ AudioParam get forwardX native;
- AudioParam get forwardY => JS("AudioParam", "#.forwardY", this);
+ AudioParam get forwardY native;
- AudioParam get forwardZ => JS("AudioParam", "#.forwardZ", this);
+ AudioParam get forwardZ native;
- AudioParam get positionX => JS("AudioParam", "#.positionX", this);
+ AudioParam get positionX native;
- AudioParam get positionY => JS("AudioParam", "#.positionY", this);
+ AudioParam get positionY native;
- AudioParam get positionZ => JS("AudioParam", "#.positionZ", this);
+ AudioParam get positionZ native;
- AudioParam get upX => JS("AudioParam", "#.upX", this);
+ AudioParam get upX native;
- AudioParam get upY => JS("AudioParam", "#.upY", this);
+ AudioParam get upY native;
- AudioParam get upZ => JS("AudioParam", "#.upZ", this);
+ AudioParam get upZ native;
void setOrientation(num x, num y, num z, num xUp, num yUp, num zUp) native;
@@ -319,30 +307,23 @@
throw new UnsupportedError("Not supported");
}
- int get channelCount => JS("int", "#.channelCount", this);
+ int get channelCount native;
- set channelCount(int value) {
- JS("void", "#.channelCount = #", this, value);
- }
+ set channelCount(int value) native;
- String get channelCountMode => JS("String", "#.channelCountMode", this);
+ String get channelCountMode native;
- set channelCountMode(String value) {
- JS("void", "#.channelCountMode = #", this, value);
- }
+ set channelCountMode(String value) native;
- String get channelInterpretation =>
- JS("String", "#.channelInterpretation", this);
+ String get channelInterpretation native;
- set channelInterpretation(String value) {
- JS("void", "#.channelInterpretation = #", this, value);
- }
+ set channelInterpretation(String value) native;
- BaseAudioContext get context => JS("BaseAudioContext", "#.context", this);
+ BaseAudioContext get context native;
- int get numberOfInputs => JS("int", "#.numberOfInputs", this);
+ int get numberOfInputs native;
- int get numberOfOutputs => JS("int", "#.numberOfOutputs", this);
+ int get numberOfOutputs native;
@JSName('connect')
AudioNode _connect(destination, [int? output, int? input]) native;
@@ -368,17 +349,15 @@
throw new UnsupportedError("Not supported");
}
- num get defaultValue => JS("num", "#.defaultValue", this);
+ num get defaultValue native;
- num get maxValue => JS("num", "#.maxValue", this);
+ num get maxValue native;
- num get minValue => JS("num", "#.minValue", this);
+ num get minValue native;
- num get value => JS("num", "#.value", this);
+ num get value native;
- set value(num value) {
- JS("void", "#.value = #", this, value);
- }
+ set value(num value) native;
AudioParam cancelAndHoldAtTime(num startTime) native;
@@ -484,11 +463,11 @@
type,
eventInitDict);
- AudioBuffer get inputBuffer => JS("AudioBuffer", "#.inputBuffer", this);
+ AudioBuffer get inputBuffer native;
- AudioBuffer get outputBuffer => JS("AudioBuffer", "#.outputBuffer", this);
+ AudioBuffer get outputBuffer native;
- num get playbackTime => JS("num", "#.playbackTime", this);
+ num get playbackTime native;
}
// 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
@@ -522,21 +501,19 @@
throw new UnsupportedError("Not supported");
}
- bool get enabled => JS("bool", "#.enabled", this);
+ bool get enabled native;
- set enabled(bool value) {
- JS("void", "#.enabled = #", this, value);
- }
+ set enabled(bool value) native;
- String get id => JS("String", "#.id", this);
+ String get id native;
- String get kind => JS("String", "#.kind", this);
+ String get kind native;
- String get label => JS("String", "#.label", this);
+ String get label native;
- String get language => JS("String", "#.language", this);
+ String get language native;
- SourceBuffer? get sourceBuffer => JS("SourceBuffer", "#.sourceBuffer", this);
+ SourceBuffer? get sourceBuffer native;
}
// 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
@@ -552,7 +529,7 @@
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
- int get length => JS("int", "#.length", this);
+ int get length native;
AudioTrack __getter__(int index) native;
@@ -571,9 +548,9 @@
throw new UnsupportedError("Not supported");
}
- num get currentTime => JS("num", "#.currentTime", this);
+ num get currentTime native;
- num get sampleRate => JS("num", "#.sampleRate", this);
+ num get sampleRate native;
void registerProcessor(String name, Object processorConstructor) native;
}
@@ -605,7 +582,7 @@
static AudioWorkletNode _create_2(context, name) =>
JS('AudioWorkletNode', 'new AudioWorkletNode(#,#)', context, name);
- AudioParamMap get parameters => JS("AudioParamMap", "#.parameters", this);
+ AudioParamMap get parameters native;
}
// 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
@@ -629,16 +606,15 @@
throw new UnsupportedError("Not supported");
}
- num get currentTime => JS("num", "#.currentTime", this);
+ num get currentTime native;
- AudioDestinationNode get destination =>
- JS("AudioDestinationNode", "#.destination", this);
+ AudioDestinationNode get destination native;
- AudioListener get listener => JS("AudioListener", "#.listener", this);
+ AudioListener get listener native;
- num get sampleRate => JS("num", "#.sampleRate", this);
+ num get sampleRate native;
- String get state => JS("String", "#.state", this);
+ String get state native;
AnalyserNode createAnalyser() native;
@@ -734,19 +710,17 @@
static BiquadFilterNode _create_2(context) =>
JS('BiquadFilterNode', 'new BiquadFilterNode(#)', context);
- AudioParam get Q => JS("AudioParam", "#.Q", this);
+ AudioParam get Q native;
- AudioParam get detune => JS("AudioParam", "#.detune", this);
+ AudioParam get detune native;
- AudioParam get frequency => JS("AudioParam", "#.frequency", this);
+ AudioParam get frequency native;
- AudioParam get gain => JS("AudioParam", "#.gain", this);
+ AudioParam get gain native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
void getFrequencyResponse(Float32List frequencyHz, Float32List magResponse,
Float32List phaseResponse) native;
@@ -820,7 +794,7 @@
static ConstantSourceNode _create_2(context) =>
JS('ConstantSourceNode', 'new ConstantSourceNode(#)', context);
- AudioParam get offset => JS("AudioParam", "#.offset", this);
+ AudioParam get offset native;
}
// 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
@@ -845,13 +819,13 @@
static ConvolverNode _create_2(context) =>
JS('ConvolverNode', 'new ConvolverNode(#)', context);
- AudioBuffer? buffer;
+ AudioBuffer? get buffer native;
- bool get normalize => JS("bool", "#.normalize", this);
+ set buffer(AudioBuffer? value) native;
- set normalize(bool value) {
- JS("void", "#.normalize = #", this, value);
- }
+ bool get normalize native;
+
+ set normalize(bool value) native;
}
// 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
@@ -876,7 +850,7 @@
static DelayNode _create_2(context) =>
JS('DelayNode', 'new DelayNode(#)', context);
- AudioParam get delayTime => JS("AudioParam", "#.delayTime", this);
+ AudioParam get delayTime native;
}
// 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
@@ -904,17 +878,17 @@
static DynamicsCompressorNode _create_2(context) =>
JS('DynamicsCompressorNode', 'new DynamicsCompressorNode(#)', context);
- AudioParam get attack => JS("AudioParam", "#.attack", this);
+ AudioParam get attack native;
- AudioParam get knee => JS("AudioParam", "#.knee", this);
+ AudioParam get knee native;
- AudioParam get ratio => JS("AudioParam", "#.ratio", this);
+ AudioParam get ratio native;
- num get reduction => JS("num", "#.reduction", this);
+ num get reduction native;
- AudioParam get release => JS("AudioParam", "#.release", this);
+ AudioParam get release native;
- AudioParam get threshold => JS("AudioParam", "#.threshold", this);
+ AudioParam get threshold native;
}
// 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
@@ -939,7 +913,7 @@
static GainNode _create_2(context) =>
JS('GainNode', 'new GainNode(#)', context);
- AudioParam get gain => JS("AudioParam", "#.gain", this);
+ AudioParam get gain native;
}
// 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
@@ -983,7 +957,7 @@
context,
options);
- MediaElement get mediaElement => JS("MediaElement", "#.mediaElement", this);
+ MediaElement get mediaElement native;
}
// 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
@@ -1014,7 +988,7 @@
'new MediaStreamAudioDestinationNode(#)',
context);
- MediaStream get stream => JS("MediaStream", "#.stream", this);
+ MediaStream get stream native;
}
// 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
@@ -1037,7 +1011,7 @@
context,
options);
- MediaStream get mediaStream => JS("MediaStream", "#.mediaStream", this);
+ MediaStream get mediaStream native;
}
// 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
@@ -1060,7 +1034,7 @@
type,
eventInitDict);
- AudioBuffer get renderedBuffer => JS("AudioBuffer", "#.renderedBuffer", this);
+ AudioBuffer get renderedBuffer native;
}
// 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
@@ -1099,7 +1073,7 @@
'new OfflineAudioContext(#)',
numberOfChannels_OR_options);
- int get length => JS("int", "#.length", this);
+ int get length native;
Future<AudioBuffer> startRendering() =>
promiseToFuture<AudioBuffer>(JS("", "#.startRendering()", this));
@@ -1131,15 +1105,13 @@
static OscillatorNode _create_2(context) =>
JS('OscillatorNode', 'new OscillatorNode(#)', context);
- AudioParam get detune => JS("AudioParam", "#.detune", this);
+ AudioParam get detune native;
- AudioParam get frequency => JS("AudioParam", "#.frequency", this);
+ AudioParam get frequency native;
- String get type => JS("String", "#.type", this);
+ String get type native;
- set type(String value) {
- JS("void", "#.type = #", this, value);
- }
+ set type(String value) native;
void setPeriodicWave(PeriodicWave periodicWave) native;
}
@@ -1166,65 +1138,49 @@
static PannerNode _create_2(context) =>
JS('PannerNode', 'new PannerNode(#)', context);
- num get coneInnerAngle => JS("num", "#.coneInnerAngle", this);
+ num get coneInnerAngle native;
- set coneInnerAngle(num value) {
- JS("void", "#.coneInnerAngle = #", this, value);
- }
+ set coneInnerAngle(num value) native;
- num get coneOuterAngle => JS("num", "#.coneOuterAngle", this);
+ num get coneOuterAngle native;
- set coneOuterAngle(num value) {
- JS("void", "#.coneOuterAngle = #", this, value);
- }
+ set coneOuterAngle(num value) native;
- num get coneOuterGain => JS("num", "#.coneOuterGain", this);
+ num get coneOuterGain native;
- set coneOuterGain(num value) {
- JS("void", "#.coneOuterGain = #", this, value);
- }
+ set coneOuterGain(num value) native;
- String get distanceModel => JS("String", "#.distanceModel", this);
+ String get distanceModel native;
- set distanceModel(String value) {
- JS("void", "#.distanceModel = #", this, value);
- }
+ set distanceModel(String value) native;
- num get maxDistance => JS("num", "#.maxDistance", this);
+ num get maxDistance native;
- set maxDistance(num value) {
- JS("void", "#.maxDistance = #", this, value);
- }
+ set maxDistance(num value) native;
- AudioParam get orientationX => JS("AudioParam", "#.orientationX", this);
+ AudioParam get orientationX native;
- AudioParam get orientationY => JS("AudioParam", "#.orientationY", this);
+ AudioParam get orientationY native;
- AudioParam get orientationZ => JS("AudioParam", "#.orientationZ", this);
+ AudioParam get orientationZ native;
- String get panningModel => JS("String", "#.panningModel", this);
+ String get panningModel native;
- set panningModel(String value) {
- JS("void", "#.panningModel = #", this, value);
- }
+ set panningModel(String value) native;
- AudioParam get positionX => JS("AudioParam", "#.positionX", this);
+ AudioParam get positionX native;
- AudioParam get positionY => JS("AudioParam", "#.positionY", this);
+ AudioParam get positionY native;
- AudioParam get positionZ => JS("AudioParam", "#.positionZ", this);
+ AudioParam get positionZ native;
- num get refDistance => JS("num", "#.refDistance", this);
+ num get refDistance native;
- set refDistance(num value) {
- JS("void", "#.refDistance = #", this, value);
- }
+ set refDistance(num value) native;
- num get rolloffFactor => JS("num", "#.rolloffFactor", this);
+ num get rolloffFactor native;
- set rolloffFactor(num value) {
- JS("void", "#.rolloffFactor = #", this, value);
- }
+ set rolloffFactor(num value) native;
void setOrientation(num x, num y, num z) native;
@@ -1273,7 +1229,7 @@
static const EventStreamProvider<AudioProcessingEvent> audioProcessEvent =
const EventStreamProvider<AudioProcessingEvent>('audioprocess');
- int get bufferSize => JS("int", "#.bufferSize", this);
+ int get bufferSize native;
void setEventListener(EventListener eventListener) native;
@@ -1311,7 +1267,7 @@
static StereoPannerNode _create_2(context) =>
JS('StereoPannerNode', 'new StereoPannerNode(#)', context);
- AudioParam get pan => JS("AudioParam", "#.pan", this);
+ AudioParam get pan native;
}
// 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
@@ -1336,11 +1292,11 @@
static WaveShaperNode _create_2(context) =>
JS('WaveShaperNode', 'new WaveShaperNode(#)', context);
- Float32List? curve;
+ Float32List? get curve native;
- String get oversample => JS("String", "#.oversample", this);
+ set curve(Float32List? value) native;
- set oversample(String value) {
- JS("void", "#.oversample = #", this, value);
- }
+ String get oversample native;
+
+ set oversample(String value) native;
}
diff --git a/sdk_nnbd/lib/web_gl/dart2js/web_gl_dart2js.dart b/sdk_nnbd/lib/web_gl/dart2js/web_gl_dart2js.dart
index 46a78ec..53671df 100644
--- a/sdk_nnbd/lib/web_gl/dart2js/web_gl_dart2js.dart
+++ b/sdk_nnbd/lib/web_gl/dart2js/web_gl_dart2js.dart
@@ -32,11 +32,11 @@
throw new UnsupportedError("Not supported");
}
- String get name => JS("String", "#.name", this);
+ String get name native;
- int get size => JS("int", "#.size", this);
+ int get size native;
- int get type => JS("int", "#.type", this);
+ int get type native;
}
// 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
@@ -86,10 +86,10 @@
}
@JSName('canvas')
- final CanvasElement canvas;
+ CanvasElement get canvas native;
@JSName('canvas')
- final OffscreenCanvas offscreenCanvas;
+ OffscreenCanvas get offscreenCanvas native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -312,7 +312,7 @@
static ContextEvent _create_2(type) =>
JS('ContextEvent', 'new WebGLContextEvent(#)', type);
- String get statusMessage => JS("String", "#.statusMessage", this);
+ String get statusMessage native;
}
// 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
@@ -723,13 +723,13 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.WebGLRenderingContext)');
- CanvasElement get canvas => JS("CanvasElement", "#.canvas", this);
+ CanvasElement get canvas native;
// From WebGLRenderingContextBase
- int get drawingBufferHeight => JS("int", "#.drawingBufferHeight", this);
+ int get drawingBufferHeight native;
- int get drawingBufferWidth => JS("int", "#.drawingBufferWidth", this);
+ int get drawingBufferWidth native;
void activeTexture(int texture) native;
@@ -1363,7 +1363,7 @@
throw new UnsupportedError("Not supported");
}
- Canvas get canvas => JS("Canvas", "#.canvas", this);
+ Canvas get canvas native;
// From WebGL2RenderingContextBase
@@ -2304,9 +2304,9 @@
// From WebGLRenderingContextBase
- int get drawingBufferHeight => JS("int", "#.drawingBufferHeight", this);
+ int get drawingBufferHeight native;
- int get drawingBufferWidth => JS("int", "#.drawingBufferWidth", this);
+ int get drawingBufferWidth native;
void activeTexture(int texture) native;
@@ -2862,11 +2862,11 @@
throw new UnsupportedError("Not supported");
}
- int get precision => JS("int", "#.precision", this);
+ int get precision native;
- int get rangeMax => JS("int", "#.rangeMax", this);
+ int get rangeMax native;
- int get rangeMin => JS("int", "#.rangeMin", this);
+ int get rangeMin native;
}
// 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
@@ -2890,16 +2890,13 @@
throw new UnsupportedError("Not supported");
}
- bool get lastUploadedVideoFrameWasSkipped =>
- JS("bool", "#.lastUploadedVideoFrameWasSkipped", this);
+ bool get lastUploadedVideoFrameWasSkipped native;
- int get lastUploadedVideoHeight =>
- JS("int", "#.lastUploadedVideoHeight", this);
+ int get lastUploadedVideoHeight native;
- num get lastUploadedVideoTimestamp =>
- JS("num", "#.lastUploadedVideoTimestamp", this);
+ num get lastUploadedVideoTimestamp native;
- int get lastUploadedVideoWidth => JS("int", "#.lastUploadedVideoWidth", this);
+ int get lastUploadedVideoWidth native;
}
// 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
diff --git a/sdk_nnbd/lib/web_sql/dart2js/web_sql_dart2js.dart b/sdk_nnbd/lib/web_sql/dart2js/web_sql_dart2js.dart
index fde77d8..f97b55e 100644
--- a/sdk_nnbd/lib/web_sql/dart2js/web_sql_dart2js.dart
+++ b/sdk_nnbd/lib/web_sql/dart2js/web_sql_dart2js.dart
@@ -79,7 +79,7 @@
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.openDatabase)');
- String get version => JS("String", "#.version", this);
+ String get version native;
@JSName('changeVersion')
/**
@@ -185,9 +185,9 @@
static const int VERSION_ERR = 2;
- int get code => JS("int", "#.code", this);
+ int get code native;
- String get message => JS("String", "#.message", this);
+ String get message native;
}
// 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
@@ -200,11 +200,11 @@
throw new UnsupportedError("Not supported");
}
- int get insertId => JS("int", "#.insertId", this);
+ int get insertId native;
- SqlResultSetRowList get rows => JS("SqlResultSetRowList", "#.rows", this);
+ SqlResultSetRowList get rows native;
- int get rowsAffected => JS("int", "#.rowsAffected", this);
+ int get rowsAffected native;
}
// 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
diff --git a/tests/compiler/dart2js/analyses/analysis_helper.dart b/tests/compiler/dart2js/analyses/analysis_helper.dart
index b422f84..ba3d4bc 100644
--- a/tests/compiler/dart2js/analyses/analysis_helper.dart
+++ b/tests/compiler/dart2js/analyses/analysis_helper.dart
@@ -87,7 +87,7 @@
const Dart2jsConstantsBackend(supportsUnevaluatedConstants: true),
const {},
typeEnvironment,
- const ir.SimpleErrorReporter());
+ const ir.SimpleErrorReporter(false));
}
@override
diff --git a/tests/compiler/dart2js/annotations/data/marker.options b/tests/compiler/dart2js/annotations/data/marker.options
new file mode 100644
index 0000000..730d5c7
--- /dev/null
+++ b/tests/compiler/dart2js/annotations/data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/annotations/annotations_test.dart
+omit=tests/compiler/dart2js/annotations/annotations_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/closure/data/marker.options b/tests/compiler/dart2js/closure/data/marker.options
new file mode 100644
index 0000000..f297827
--- /dev/null
+++ b/tests/compiler/dart2js/closure/data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/closure/closure_test.dart
+omit=tests/compiler/dart2js/closure/closure_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/codegen/model_data/marker.options b/tests/compiler/dart2js/codegen/model_data/marker.options
new file mode 100644
index 0000000..f7d45f7
--- /dev/null
+++ b/tests/compiler/dart2js/codegen/model_data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/codegen/model_test.dart
+omit=tests/compiler/dart2js/codegen/model_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/deferred_loading/data/marker.options b/tests/compiler/dart2js/deferred_loading/data/marker.options
new file mode 100644
index 0000000..94f0636
--- /dev/null
+++ b/tests/compiler/dart2js/deferred_loading/data/marker.options
@@ -0,0 +1 @@
+strong=tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart b/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
index 4f3e3d1..2a1c31c 100644
--- a/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
+++ b/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
@@ -34,7 +34,7 @@
await checkTests(dataDir, const OutputUnitDataComputer(),
options: compilerOptions,
args: args,
- supportedMarkers: [strongMarker], setUpFunction: () {
+ setUpFunction: () {
importPrefixes.clear();
}, testedConfigs: allStrongConfigs);
});
diff --git a/tests/compiler/dart2js/equivalence/check_helpers.dart b/tests/compiler/dart2js/equivalence/check_helpers.dart
index 5ff9899..08e6379 100644
--- a/tests/compiler/dart2js/equivalence/check_helpers.dart
+++ b/tests/compiler/dart2js/equivalence/check_helpers.dart
@@ -426,7 +426,7 @@
StringBuffer sb = new StringBuffer();
@override
- visit(DartType type, [_]) {
+ void visit(DartType type, [_]) {
type.accept(this, null);
}
@@ -440,58 +440,55 @@
return comma;
}
- void _writeNullability(Nullability nullability, StringBuffer sb) {
- switch (nullability) {
- case Nullability.none:
- return;
- case Nullability.question:
- sb.write('?');
- return;
- case Nullability.star:
- sb.write('*');
- return;
- }
+ @override
+ void visitLegacyType(LegacyType type, _) {
+ visit(type.baseType);
+ sb.write('*');
}
@override
- visitNeverType(NeverType type, _) {
+ void visitNullableType(NullableType type, _) {
+ visit(type.baseType);
+ sb.write('?');
+ }
+
+ @override
+ void visitNeverType(NeverType type, _) {
sb.write('Never');
- _writeNullability(type.nullability, sb);
}
@override
- visitVoidType(VoidType type, _) {
+ void visitVoidType(VoidType type, _) {
sb.write('void');
}
@override
- visitDynamicType(DynamicType type, _) {
+ void visitDynamicType(DynamicType type, _) {
sb.write('dynamic');
}
@override
- visitErasedType(ErasedType type, _) {
+ void visitErasedType(ErasedType type, _) {
sb.write('erased');
}
@override
- visitAnyType(AnyType type, _) {
+ void visitAnyType(AnyType type, _) {
sb.write('any');
}
@override
- visitInterfaceType(InterfaceType type, _) {
+ void visitInterfaceType(InterfaceType type, _) {
sb.write(type.element.name);
if (type.typeArguments.any((type) => type is! DynamicType)) {
sb.write('<');
visitTypes(type.typeArguments);
sb.write('>');
}
- _writeNullability(type.nullability, sb);
}
@override
- visitFunctionType(FunctionType type, _) {
+ void visitFunctionType(FunctionType type, _) {
visit(type.returnType);
sb.write(' Function');
if (type.typeVariables.isNotEmpty) {
@@ -520,27 +517,23 @@
sb.write('}');
}
sb.write(')');
- _writeNullability(type.nullability, sb);
}
@override
- visitFunctionTypeVariable(FunctionTypeVariable type, _) {
+ void visitFunctionTypeVariable(FunctionTypeVariable type, _) {
sb.write(type);
- _writeNullability(type.nullability, sb);
}
@override
- visitTypeVariableType(TypeVariableType type, _) {
+ void visitTypeVariableType(TypeVariableType type, _) {
sb.write(type);
- _writeNullability(type.nullability, sb);
}
@override
- visitFutureOrType(FutureOrType type, _) {
+ void visitFutureOrType(FutureOrType type, _) {
sb.write('FutureOr<');
visit(type.typeArgument);
sb.write('>');
- _writeNullability(type.nullability, sb);
}
String getText() => sb.toString();
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart b/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
index fc8f5ec..341dd6e 100644
--- a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
+++ b/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
@@ -398,7 +398,6 @@
int shards: 1,
int shardIndex: 0,
void onTest(Uri uri),
- Iterable<String> supportedMarkers = allInternalMarkers,
List<TestConfig> testedConfigs = defaultInternalConfigs}) async {
Set<String> testedMarkers =
testedConfigs.map((config) => config.marker).toSet();
@@ -406,12 +405,6 @@
testedConfigs.length == testedMarkers.length,
"Unexpected test markers $testedMarkers. "
"Tested configs: $testedConfigs.");
- Iterable<String> unknownMarkers =
- testedMarkers.where((marker) => !supportedMarkers.contains(marker));
- Expect.isTrue(
- unknownMarkers.isEmpty,
- "Unexpected test markers $unknownMarkers. "
- "Supported markers: $supportedMarkers.");
dataComputer.setup();
@@ -422,6 +415,13 @@
bool printCode,
Map<String, List<String>> skipMap,
Uri nullUri}) async {
+ for (TestConfig testConfiguration in testedConfigs) {
+ Expect.isTrue(
+ testData.expectedMaps.containsKey(testConfiguration.marker),
+ "Unexpected test marker '${testConfiguration.marker}'. "
+ "Supported markers: ${testData.expectedMaps.keys}.");
+ }
+
String name = testData.name;
List<String> testOptions = options.toList();
if (name.endsWith('_ea.dart')) {
@@ -457,7 +457,6 @@
shards: shards,
shardIndex: shardIndex,
onTest: onTest,
- supportedMarkers: supportedMarkers,
createUriForFileName: createUriForFileName,
onFailure: Expect.fail,
runTest: checkTest);
diff --git a/tests/compiler/dart2js/equivalence/id_testing_test.dart b/tests/compiler/dart2js/equivalence/id_testing_test.dart
index 644fb64..e8c4022 100644
--- a/tests/compiler/dart2js/equivalence/id_testing_test.dart
+++ b/tests/compiler/dart2js/equivalence/id_testing_test.dart
@@ -24,9 +24,7 @@
Directory dataDir = new Directory.fromUri(Platform.script
.resolve('../../../../pkg/front_end/test/id_testing/data'));
await checkTests(dataDir, new IdTestingDataComputer(),
- args: args,
- testedConfigs: [sharedConfig],
- supportedMarkers: [cfeMarker, dart2jsMarker]);
+ args: args, testedConfigs: [sharedConfig]);
});
}
diff --git a/tests/compiler/dart2js/field_analysis/jdata/marker.options b/tests/compiler/dart2js/field_analysis/jdata/marker.options
new file mode 100644
index 0000000..e9de6cf
--- /dev/null
+++ b/tests/compiler/dart2js/field_analysis/jdata/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/field_analysis/jfield_analysis_test.dart
+omit=tests/compiler/dart2js/field_analysis/jfield_analysis_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/field_analysis/kdata/marker.options b/tests/compiler/dart2js/field_analysis/kdata/marker.options
new file mode 100644
index 0000000..16bd064
--- /dev/null
+++ b/tests/compiler/dart2js/field_analysis/kdata/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/field_analysis/kfield_analysis_test.dart
+omit=tests/compiler/dart2js/field_analysis/kfield_analysis_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/helpers/shared_helper.dart b/tests/compiler/dart2js/helpers/shared_helper.dart
index 77204a3..7f69eda 100644
--- a/tests/compiler/dart2js/helpers/shared_helper.dart
+++ b/tests/compiler/dart2js/helpers/shared_helper.dart
@@ -23,23 +23,27 @@
return comma;
}
- void _writeNullability(Nullability nullability, StringBuffer sb) {
- switch (nullability) {
- case Nullability.none:
- return;
- case Nullability.question:
- sb.write('?');
- return;
- case Nullability.star:
- sb.write('*');
- return;
- }
+ @override
+ void visitLegacyType(LegacyType type, StringBuffer sb) {
+ bool wrapFunction = type.baseType is FunctionType;
+ if (wrapFunction) sb.write('(');
+ visit(type.baseType, sb);
+ if (wrapFunction) sb.write(')');
+ sb.write('*');
+ }
+
+ @override
+ void visitNullableType(NullableType type, StringBuffer sb) {
+ bool wrapFunction = type.baseType is FunctionType;
+ if (wrapFunction) sb.write('(');
+ visit(type.baseType, sb);
+ if (wrapFunction) sb.write(')');
+ sb.write('?');
}
@override
void visitNeverType(NeverType type, StringBuffer sb) {
sb.write('Never');
- _writeNullability(type.nullability, sb);
}
@override
@@ -65,18 +69,15 @@
@override
void visitTypeVariableType(TypeVariableType type, StringBuffer sb) {
sb.write(type.element.name);
- _writeNullability(type.nullability, sb);
}
@override
void visitFunctionTypeVariable(FunctionTypeVariable type, StringBuffer sb) {
sb.write(type.index);
- _writeNullability(type.nullability, sb);
}
@override
void visitFunctionType(FunctionType type, StringBuffer sb) {
- if (!type.nullability.isNone) sb.write('(');
sb.write('(');
String comma = visitList(type.parameterTypes, sb);
if (type.optionalParameterTypes.isNotEmpty) {
@@ -101,8 +102,6 @@
}
sb.write(')->');
visit(type.returnType, sb);
- if (!type.nullability.isNone) sb.write(')');
- _writeNullability(type.nullability, sb);
}
@override
@@ -113,7 +112,6 @@
visitList(type.typeArguments, sb);
sb.write('>');
}
- _writeNullability(type.nullability, sb);
}
@override
@@ -121,7 +119,6 @@
sb.write('FutureOr<');
visit(type.typeArgument, sb);
sb.write('>');
- _writeNullability(type.nullability, sb);
}
}
diff --git a/tests/compiler/dart2js/helpers/type_test_helper.dart b/tests/compiler/dart2js/helpers/type_test_helper.dart
index c65f86c..35b4dbe 100644
--- a/tests/compiler/dart2js/helpers/type_test_helper.dart
+++ b/tests/compiler/dart2js/helpers/type_test_helper.dart
@@ -19,7 +19,7 @@
DartType instantiate(
DartTypes dartTypes, ClassEntity element, List<DartType> arguments) {
- return dartTypes.interfaceType(element, arguments, Nullability.none);
+ return dartTypes.interfaceType(element, arguments);
}
class TypeEnvironment {
diff --git a/tests/compiler/dart2js/impact/data/marker.options b/tests/compiler/dart2js/impact/data/marker.options
new file mode 100644
index 0000000..f001ac8
--- /dev/null
+++ b/tests/compiler/dart2js/impact/data/marker.options
@@ -0,0 +1 @@
+strong=tests/compiler/dart2js/impact/impact_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/impact/impact_test.dart b/tests/compiler/dart2js/impact/impact_test.dart
index b1d9e3d..09a1566 100644
--- a/tests/compiler/dart2js/impact/impact_test.dart
+++ b/tests/compiler/dart2js/impact/impact_test.dart
@@ -24,7 +24,6 @@
useImpactDataForTesting = false;
await checkTests(dataDir, const ImpactDataComputer(),
args: args,
- supportedMarkers: [strongMarker],
testedConfigs: [strongConfig]);
print('Testing computation of ResolutionImpact through ImpactData');
@@ -32,7 +31,6 @@
useImpactDataForTesting = true;
await checkTests(dataDir, const ImpactDataComputer(),
args: args,
- supportedMarkers: [strongMarker],
testedConfigs: [strongConfig]);
});
}
diff --git a/tests/compiler/dart2js/inference/callers/marker.options b/tests/compiler/dart2js/inference/callers/marker.options
new file mode 100644
index 0000000..10b39a7
--- /dev/null
+++ b/tests/compiler/dart2js/inference/callers/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/inference/callers_test.dart
+omit=tests/compiler/dart2js/inference/callers_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inference/data/marker.options b/tests/compiler/dart2js/inference/data/marker.options
new file mode 100644
index 0000000..ed13f42
--- /dev/null
+++ b/tests/compiler/dart2js/inference/data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/inference/inference_test_helper.dart
+omit=tests/compiler/dart2js/inference/inference_test_helper.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inference/inference_data/marker.options b/tests/compiler/dart2js/inference/inference_data/marker.options
new file mode 100644
index 0000000..c90afd3
--- /dev/null
+++ b/tests/compiler/dart2js/inference/inference_data/marker.options
@@ -0,0 +1 @@
+strong=tests/compiler/dart2js/inference/inference_data_test.dart
diff --git a/tests/compiler/dart2js/inference/inference_data_test.dart b/tests/compiler/dart2js/inference/inference_data_test.dart
index c9aad1d..e89e33e 100644
--- a/tests/compiler/dart2js/inference/inference_data_test.dart
+++ b/tests/compiler/dart2js/inference/inference_data_test.dart
@@ -24,7 +24,6 @@
await checkTests(dataDir, const InferenceDataComputer(),
args: args,
testedConfigs: [strongConfig],
- supportedMarkers: [strongMarker],
options: [stopAfterTypeInference]);
});
}
diff --git a/tests/compiler/dart2js/inference/side_effects/marker.options b/tests/compiler/dart2js/inference/side_effects/marker.options
new file mode 100644
index 0000000..03ae8ce
--- /dev/null
+++ b/tests/compiler/dart2js/inference/side_effects/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/inference/side_effects_test.dart
+omit=tests/compiler/dart2js/inference/side_effects_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inlining/data/marker.options b/tests/compiler/dart2js/inlining/data/marker.options
new file mode 100644
index 0000000..4750f8f
--- /dev/null
+++ b/tests/compiler/dart2js/inlining/data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/inlining/inlining_test.dart
+omit=tests/compiler/dart2js/inlining/inlining_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/jumps/data/marker.options b/tests/compiler/dart2js/jumps/data/marker.options
new file mode 100644
index 0000000..37aec9d
--- /dev/null
+++ b/tests/compiler/dart2js/jumps/data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/jumps/jump_test.dart
+omit=tests/compiler/dart2js/jumps/jump_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/member_usage/data/marker.options b/tests/compiler/dart2js/member_usage/data/marker.options
new file mode 100644
index 0000000..91b789d
--- /dev/null
+++ b/tests/compiler/dart2js/member_usage/data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/member_usage/member_usage_test.dart
+omit=tests/compiler/dart2js/member_usage/member_usage_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/model/cfe_constant_test.dart b/tests/compiler/dart2js/model/cfe_constant_test.dart
index 3f522df..3430988 100644
--- a/tests/compiler/dart2js/model/cfe_constant_test.dart
+++ b/tests/compiler/dart2js/model/cfe_constant_test.dart
@@ -25,8 +25,7 @@
.resolve('../../../../pkg/_fe_analyzer_shared/test/constants/data'));
await checkTests<String>(dataDir, new ConstantDataComputer(),
args: args,
- testedConfigs: [sharedConfig],
- supportedMarkers: sharedMarkers);
+ testedConfigs: [sharedConfig]);
});
}
diff --git a/tests/compiler/dart2js/model/subtype_test.dart b/tests/compiler/dart2js/model/subtype_test.dart
index c80d5e5..914d75a 100644
--- a/tests/compiler/dart2js/model/subtype_test.dart
+++ b/tests/compiler/dart2js/model/subtype_test.dart
@@ -751,8 +751,6 @@
}
}
- var types = env.types;
-
InterfaceType ClassWithCall = env['ClassWithCall'];
DartType Object_ = env['Object'];
DartType dynamic_ = env['dynamic'];
@@ -762,16 +760,11 @@
DartType ClassWithCallType =
env.getMemberType('call', ClassWithCall.element);
- InterfaceType List_Object =
- env.commonElements.listType(types.defaultNullability, Object_);
- InterfaceType List_dynamic =
- env.commonElements.listType(types.defaultNullability, dynamic_);
- InterfaceType List_void =
- env.commonElements.listType(types.defaultNullability, void_);
- InterfaceType List_Null =
- env.commonElements.listType(types.defaultNullability, Null_);
- InterfaceType List_Function =
- env.commonElements.listType(types.defaultNullability, Function_);
+ InterfaceType List_Object = env.commonElements.listType(Object_);
+ InterfaceType List_dynamic = env.commonElements.listType(dynamic_);
+ InterfaceType List_void = env.commonElements.listType(void_);
+ InterfaceType List_Null = env.commonElements.listType(Null_);
+ InterfaceType List_Function = env.commonElements.listType(Function_);
DartType returnNum = env.getMemberType('returnNum');
DartType returnInt = env.getMemberType('returnInt');
diff --git a/tests/compiler/dart2js/model/type_substitution_test.dart b/tests/compiler/dart2js/model/type_substitution_test.dart
index 4a684c3..9c25617 100644
--- a/tests/compiler/dart2js/model/type_substitution_test.dart
+++ b/tests/compiler/dart2js/model/type_substitution_test.dart
@@ -226,26 +226,23 @@
env.elementEnvironment,
arguments,
parameters,
+ types.functionType(intType, [StringType], [], [], [], []),
+ types.functionType(intType, [StringType], [], [], [], []));
+ testSubstitution(
+ types,
+ env.elementEnvironment,
+ arguments,
+ parameters,
+ types.functionType(types.voidType(), [T, S], [], [], [], []),
types.functionType(
- intType, [StringType], [], [], [], [], types.defaultNullability),
- types.functionType(
- intType, [StringType], [], [], [], [], types.defaultNullability));
+ types.voidType(), [intType, StringType], [], [], [], []));
testSubstitution(
types,
env.elementEnvironment,
arguments,
parameters,
types.functionType(
- types.voidType(), [T, S], [], [], [], [], types.defaultNullability),
- types.functionType(types.voidType(), [intType, StringType], [], [], [],
- [], types.defaultNullability));
- testSubstitution(
- types,
- env.elementEnvironment,
- arguments,
- parameters,
- types.functionType(types.voidType(), [types.dynamicType()], [], [], [],
- [], types.defaultNullability),
- types.functionType(types.voidType(), [types.dynamicType()], [], [], [],
- [], types.defaultNullability));
+ types.voidType(), [types.dynamicType()], [], [], [], []),
+ types.functionType(
+ types.voidType(), [types.dynamicType()], [], [], [], []));
}
diff --git a/tests/compiler/dart2js/optimization/data/marker.options b/tests/compiler/dart2js/optimization/data/marker.options
new file mode 100644
index 0000000..3b03def
--- /dev/null
+++ b/tests/compiler/dart2js/optimization/data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/optimization/optimization_test.dart
+omit=tests/compiler/dart2js/optimization/optimization_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/rti/data/marker.options b/tests/compiler/dart2js/rti/data/marker.options
new file mode 100644
index 0000000..b77684b
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/rti/rti_need_test_helper.dart
+omit=tests/compiler/dart2js/rti/rti_need_test_helper.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/rti/emission/marker.options b/tests/compiler/dart2js/rti/emission/marker.options
new file mode 100644
index 0000000..bc69057
--- /dev/null
+++ b/tests/compiler/dart2js/rti/emission/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/rti/rti_emission_test.dart
+omit=tests/compiler/dart2js/rti/rti_emission_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/rti/rti_need_test_helper.dart b/tests/compiler/dart2js/rti/rti_need_test_helper.dart
index d3ae7f4..168a383 100644
--- a/tests/compiler/dart2js/rti/rti_need_test_helper.dart
+++ b/tests/compiler/dart2js/rti/rti_need_test_helper.dart
@@ -204,6 +204,12 @@
bool visitType(DartType type, _) => false;
@override
+ bool visitLegacyType(LegacyType type, _) => visit(type.baseType, _);
+
+ @override
+ bool visitNullableType(NullableType type, _) => visit(type.baseType, _);
+
+ @override
bool visitInterfaceType(InterfaceType type, _) {
if (type.element == entity) return true;
return visitTypes(type.typeArguments);
diff --git a/tests/compiler/dart2js/static_type/data/marker.options b/tests/compiler/dart2js/static_type/data/marker.options
new file mode 100644
index 0000000..95c2117
--- /dev/null
+++ b/tests/compiler/dart2js/static_type/data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/static_type/static_type_test.dart
+omit=tests/compiler/dart2js/static_type/static_type_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/static_type/type_promotion_data/marker.options b/tests/compiler/dart2js/static_type/type_promotion_data/marker.options
new file mode 100644
index 0000000..c280594
--- /dev/null
+++ b/tests/compiler/dart2js/static_type/type_promotion_data/marker.options
@@ -0,0 +1,2 @@
+strong=tests/compiler/dart2js/static_type/type_promotion_test.dart
+omit=tests/compiler/dart2js/static_type/type_promotion_test.dart
\ No newline at end of file
diff --git a/tests/corelib/type_tostring_test.dart b/tests/corelib/type_tostring_test.dart
index dab89c9..8e1c2d1 100644
--- a/tests/corelib/type_tostring_test.dart
+++ b/tests/corelib/type_tostring_test.dart
@@ -55,10 +55,10 @@
// Generic non-class, non-function type.
expect<FutureOr<int>>("FutureOr<int>");
- expect<FutureOr<Object>>("FutureOr<Object>");
+ expect<FutureOr<Object>>("Object");
expect<FutureOr<FutureOr<Future<Object>>>>(
"FutureOr<FutureOr<Future<Object>>>");
- expect<FutureOr<Null>>("FutureOr<Null>");
+ expect<FutureOr<Null>>("Future<Null>?");
// TODO: Add nullable types with NNBD.
// Private names may be mangled.
diff --git a/tests/corelib_2/type_tostring_test.dart b/tests/corelib_2/type_tostring_test.dart
index dab89c9..8e1c2d1 100644
--- a/tests/corelib_2/type_tostring_test.dart
+++ b/tests/corelib_2/type_tostring_test.dart
@@ -55,10 +55,10 @@
// Generic non-class, non-function type.
expect<FutureOr<int>>("FutureOr<int>");
- expect<FutureOr<Object>>("FutureOr<Object>");
+ expect<FutureOr<Object>>("Object");
expect<FutureOr<FutureOr<Future<Object>>>>(
"FutureOr<FutureOr<Future<Object>>>");
- expect<FutureOr<Null>>("FutureOr<Null>");
+ expect<FutureOr<Null>>("Future<Null>?");
// TODO: Add nullable types with NNBD.
// Private names may be mangled.
diff --git a/tests/ffi/structs_test.dart b/tests/ffi/structs_test.dart
index 263d562..83e617d 100644
--- a/tests/ffi/structs_test.dart
+++ b/tests/ffi/structs_test.dart
@@ -4,7 +4,7 @@
//
// Dart test program for testing dart:ffi struct pointers.
//
-// VMOptions=--deterministic --optimization-counter-threshold=50 --enable-inlining-annotations
+// VMOptions=--deterministic --optimization-counter-threshold=50
import 'dart:ffi';
diff --git a/tests/language/assert/assert_test.dart b/tests/language/assert/assert_test.dart
index 85d0373..b99f5d6 100644
--- a/tests/language/assert/assert_test.dart
+++ b/tests/language/assert/assert_test.dart
@@ -8,7 +8,7 @@
import "package:expect/expect.dart";
-testTrue() {
+int testTrue() {
int i = 0;
try {
assert(true);
@@ -18,7 +18,7 @@
return i;
}
-testFalse() {
+int testFalse() {
int i = 0;
try {
assert(false);
@@ -32,7 +32,7 @@
return a ? true : false;
}
-testBoolean(bool value) {
+int testBoolean(bool value) {
int i = 0;
try {
assert(value);
@@ -42,7 +42,7 @@
return i;
}
-testDynamic(dynamic value) {
+int testDynamic(dynamic value) {
int i = 0;
try {
assert(value);
@@ -56,11 +56,10 @@
try {
assert(value, message);
return null;
- } catch (error) {
- // Catch any type to allow the Boolean conversion to throw either
- // AssertionError or TypeError.
+ } on AssertionError catch (error) {
return error;
}
+ return null;
}
main() {
@@ -72,20 +71,20 @@
Expect.equals(1, testBoolean(false));
Expect.equals(1, testDynamic(unknown(false)));
- Expect.equals(1, testDynamic(null));
- Expect.equals(1, testDynamic(42));
- Expect.equals(1, testDynamic(() => true));
- Expect.equals(1, testDynamic(() => false));
- Expect.equals(1, testDynamic(() => 42));
- Expect.equals(1, testDynamic(() => null));
+ Expect.throwsTypeError(() => testDynamic(null));
+ Expect.throwsTypeError(() => testDynamic(42));
+ Expect.throwsTypeError(() => testDynamic(() => true));
+ Expect.throwsTypeError(() => testDynamic(() => false));
+ Expect.throwsTypeError(() => testDynamic(() => 42));
+ Expect.throwsTypeError(() => testDynamic(() => null));
Expect.equals(1234, testMessage(false, 1234).message);
Expect.equals('hi', testMessage(false, 'hi').message);
- // These errors do not have the message because boolean conversion failed.
- Expect.notEquals(1234, testMessage(null, 1234).message);
- Expect.notEquals('hi', testMessage(null, 'hi').message);
- Expect.notEquals('hi', testMessage(() => null, 'hi').message);
- Expect.notEquals('hi', testMessage(() => false, 'hi').message);
- Expect.notEquals('hi', testMessage(() => true, 'hi').message);
+ // These assertions throw a type error because boolean conversion failed.
+ Expect.throwsTypeError(() => testMessage(null, 1234));
+ Expect.throwsTypeError(() => testMessage(null, 'hi'));
+ Expect.throwsTypeError(() => testMessage(() => null, 'hi'));
+ Expect.throwsTypeError(() => testMessage(() => false, 'hi'));
+ Expect.throwsTypeError(() => testMessage(() => true, 'hi'));
}
diff --git a/tests/language/async/and_or_test.dart b/tests/language/async/and_or_test.dart
new file mode 100644
index 0000000..be24bb1
--- /dev/null
+++ b/tests/language/async/and_or_test.dart
@@ -0,0 +1,89 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+@pragma('dart2js:noInline')
+@pragma('dart2js:assumeDynamic')
+confuse(x) {
+ return x;
+}
+
+test1() async {
+ Expect.isFalse(await confuse(false) && await confuse(false));
+ Expect.isFalse(await confuse(false) && await confuse(true));
+ Expect.isFalse(await confuse(true) && await confuse(false));
+ Expect.isTrue(await confuse(true) && await confuse(true));
+
+ Expect.isFalse(await confuse(false) || await confuse(false));
+ Expect.isTrue(await confuse(false) || await confuse(true));
+ Expect.isTrue(await confuse(true) || await confuse(false));
+ Expect.isTrue(await confuse(true) || await confuse(true));
+}
+
+String trace = "";
+
+traceA(x) {
+ trace += "a";
+ return x;
+}
+
+traceB(x) {
+ trace += "b";
+ return x;
+}
+
+testEvaluation(Future<void> fn()) async {
+ trace = "";
+ await fn();
+}
+
+test2() async {
+ await testEvaluation(() async {
+ Expect.isFalse(
+ await confuse(traceA(false)) && await confuse(traceB(false)));
+ Expect.equals("a", trace);
+ });
+ await testEvaluation(() async {
+ Expect.isFalse(await confuse(traceA(false)) && await confuse(traceB(true)));
+ Expect.equals("a", trace);
+ });
+ await testEvaluation(() async {
+ Expect.isFalse(await confuse(traceA(true)) && await confuse(traceB(false)));
+ Expect.equals("ab", trace);
+ });
+ await testEvaluation(() async {
+ Expect.isTrue(await confuse(traceA(true)) && await confuse(traceB(true)));
+ Expect.equals("ab", trace);
+ });
+
+ await testEvaluation(() async {
+ Expect.isFalse(
+ await confuse(traceA(false)) || await confuse(traceB(false)));
+ Expect.equals("ab", trace);
+ });
+ await testEvaluation(() async {
+ Expect.isTrue(await confuse(traceA(false)) || await confuse(traceB(true)));
+ Expect.equals("ab", trace);
+ });
+ await testEvaluation(() async {
+ Expect.isTrue(await confuse(traceA(true)) || await confuse(traceB(false)));
+ Expect.equals("a", trace);
+ });
+ await testEvaluation(() async {
+ Expect.isTrue(await confuse(traceA(true)) || await confuse(traceB(true)));
+ Expect.equals("a", trace);
+ });
+}
+
+test() async {
+ await test1();
+ await test2();
+}
+
+main() {
+ asyncStart();
+ test().then((_) => asyncEnd());
+}
diff --git a/tests/language/async/async_test.dart b/tests/language/async/async_test.dart
new file mode 100644
index 0000000..9d1c01d
--- /dev/null
+++ b/tests/language/async/async_test.dart
@@ -0,0 +1,141 @@
+// Copyright (c) 2014, 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:async_helper/async_helper.dart';
+import 'package:expect/expect.dart';
+
+import 'dart:async';
+
+topLevelFunction() async {}
+
+Future<int> topLevelWithParameter(int a) async {
+ return 7 + a;
+}
+
+topLevelWithParameterWrongType(int a) async {
+ return 7 + a;
+}
+
+var what = 'async getter';
+Future<String> get topLevelGetter async {
+ return 'I want to be an ${what}';
+}
+
+class A {
+ static int staticVar = 1;
+
+ static staticMethod(int param) async => staticVar + param;
+ static get staticGetter async => staticVar + 3;
+
+ int _x;
+ A(this._x);
+
+ operator +(A other) async {
+ return new A(_x + other._x);
+ }
+
+ get value => _x;
+}
+
+class B {
+ final _y;
+ const B._internal(this._y);
+
+ B() : _y = null;
+}
+
+main() {
+ Future<Object?> asyncReturn;
+
+ asyncReturn = topLevelFunction();
+ asyncStart();
+ asyncReturn.then((Object? result) {
+ Expect.isNull(result);
+ asyncEnd();
+ });
+
+ asyncReturn = topLevelWithParameter(4);
+ Expect.isTrue(asyncReturn is Future);
+ asyncStart();
+ asyncReturn.then((Object? result) {
+ Expect.equals(result, 11);
+ asyncEnd();
+ });
+
+ asyncReturn = topLevelGetter;
+ Expect.isTrue(asyncReturn is Future);
+ asyncStart();
+ asyncReturn.then((Object? result) {
+ Expect.equals(result, 'I want to be an async getter');
+ asyncEnd();
+ });
+
+ asyncReturn = A.staticMethod(2);
+ Expect.isTrue(asyncReturn is Future);
+ asyncStart();
+ asyncReturn.then((Object? result) {
+ Expect.equals(result, 3);
+ asyncEnd();
+ });
+
+ asyncReturn = A.staticGetter;
+ Expect.isTrue(asyncReturn is Future);
+ asyncStart();
+ asyncReturn.then((Object? result) {
+ Expect.equals(result, 4);
+ asyncEnd();
+ });
+
+ A a = new A(13);
+
+ var b = new A(9);
+ asyncReturn = a + b;
+ Expect.isTrue(asyncReturn is Future);
+ asyncStart();
+ asyncReturn.then((Object? result) {
+ Expect.equals((result as A).value, 22);
+ asyncEnd();
+ });
+
+ var foo = 17;
+ bar(int p1, p2) async {
+ var z = 8;
+ return p2 + z + foo;
+ }
+
+ asyncReturn = bar(1, 2);
+ Expect.isTrue(asyncReturn is Future);
+ asyncStart();
+ asyncReturn.then((Object? result) {
+ Expect.equals(result, 27);
+ asyncEnd();
+ });
+
+ var moreNesting = (int shadowP1, String p2, num p3) {
+ var z = 3;
+ aa(int shadowP1) async {
+ return foo + z + p3 + shadowP1;
+ }
+
+ return aa(6);
+ };
+ asyncReturn = moreNesting(1, "ignore", 2);
+ Expect.isTrue(asyncReturn is Future);
+ asyncStart();
+ asyncReturn.then((Object? result) {
+ Expect.equals(result, 28);
+ asyncEnd();
+ });
+
+ var checkAsync = (var someFunc) {
+ var toTest = someFunc();
+ Expect.isTrue(toTest is Future);
+ asyncStart();
+ toTest.then((int result) {
+ Expect.equals(result, 4);
+ asyncEnd();
+ });
+ };
+ checkAsync(() async => 4);
+}
diff --git a/tests/language/async/await_catch_regression_test.dart b/tests/language/async/await_catch_regression_test.dart
new file mode 100644
index 0000000..b83b0b1
--- /dev/null
+++ b/tests/language/async/await_catch_regression_test.dart
@@ -0,0 +1,26 @@
+// 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:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+foo() async {
+ throw 42;
+}
+
+test() async {
+ var exception;
+ try {
+ await foo();
+ } catch (e) {
+ print(await (e));
+ await (exception = await e);
+ }
+ Expect.equals(42, exception);
+}
+
+main() {
+ asyncStart();
+ test().then((_) => asyncEnd());
+}
diff --git a/tests/language/async/await_foreign_test.dart b/tests/language/async/await_foreign_test.dart
new file mode 100644
index 0000000..1379421
--- /dev/null
+++ b/tests/language/async/await_foreign_test.dart
@@ -0,0 +1,77 @@
+// 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 'dart:async';
+import 'package:expect/expect.dart';
+import 'package:async_helper/async_helper.dart';
+
+typedef Future<Null> Task();
+
+class ForeignFuture implements Future<Null> {
+ ForeignFuture(List<Task> tasks) {
+ tasks.forEach(_addTask);
+ }
+
+ Future<Null>? _future;
+
+ void _addTask(Task task) {
+ _future = (_future == null) ? task() : _future!.then((_) => task());
+ }
+
+ Future<S> then<S>(FutureOr<S> onValue(Null _), {Function? onError}) {
+ assert(_future != null);
+ return _future!.then((_) {
+ _future = null;
+ return onValue(null);
+ }, onError: (error, trace) {
+ _future = null;
+ if (onError != null) {
+ onError(error, trace);
+ }
+ });
+ }
+
+ Stream<Null> asStream() {
+ return new Stream.fromFuture(this);
+ }
+
+ Future<Null> catchError(onError, {bool test(Object error)?}) {
+ print('Unimplemented catchError');
+ return Future.value();
+ }
+
+ Future<Null> timeout(Duration timeLimit, {onTimeout()?}) {
+ print('Unimplemented timeout');
+ return Future.value();
+ }
+
+ Future<Null> whenComplete(action()) {
+ print('Unimplemented whenComplete');
+ return Future.value();
+ }
+}
+
+var r1;
+
+Future<Null> hello() async {
+ r1 = 'hello';
+ throw new Exception('error');
+}
+
+Future<String> world() async {
+ try {
+ await new ForeignFuture([hello]);
+ } catch (e) {}
+ return 'world';
+}
+
+void main() {
+ asyncStart();
+ () async {
+ var r2 = await world();
+ Expect.equals('hello', r1);
+ Expect.equals('world', r2);
+ asyncEnd();
+ }();
+}
diff --git a/tests/language/async/await_syntax_test.dart b/tests/language/async/await_syntax_test.dart
new file mode 100644
index 0000000..c7fc8f5
--- /dev/null
+++ b/tests/language/async/await_syntax_test.dart
@@ -0,0 +1,301 @@
+// 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.
+
+// Test async/await syntax.
+
+import 'dart:async' show Stream;
+
+var yield = 0;
+var await = 0;
+get st => new Stream.fromIterable([]);
+
+a01a() async => null; // //# a01a: ok
+a01b() async* => null; // //# a01b: syntax error
+a01c() sync* => null; // //# a01c: syntax error
+a01d() async => yield 5; // //# a01d: syntax error
+a02a() async {} // //# a02a: ok
+a03a() async* {} // //# a03a: ok
+a03b() async * {} // //# a03b: ok
+a04a() sync* {} // //# a04a: ok
+a04b() sync {} // //# a04b: syntax error
+a04c() sync * {} // //# a04c: ok
+a05a() async { await 0; } // //# a05a: ok
+a05b() async { // //# a05b: ok
+ await(a) {}; // //# a05b: continued
+ await(0); // //# a05b: continued
+} // //# a05b: continued
+a05c() { // //# a05c: ok
+ await(a) {}; // //# a05c: continued
+ await(0); // //# a05c: continued
+} // //# a05c: continued
+a05d() async { // //# a05d: syntax error
+ await(a) {} // //# a05d: continued
+ await(0); // //# a05d: continued
+} // //# a05d: continued
+a05e() { // //# a05e: ok
+ await(a) {} // //# a05e: continued
+ await(0); // //# a05e: continued
+} // //# a05e: continued
+a05f() async { // //# a05f: syntax error
+ var await = (a) {}; // //# a05f: continued
+ await(0); // //# a05f: continued
+} // //# a05f: continued
+a05g() async { // //# a05g: compile-time error
+ yield 5; // //# a05g: continued
+} // //# a05g: continued
+a05h() async { // //# a05h: continued
+ yield* st; // //# a05h: compile-time error
+} // //# a05h: continued
+a06a() async { await for (var o in st) {} } // //# a06a: ok
+a06b() sync* { await for (var o in st) {} } // //# a06b: compile-time error
+a07a() sync* { yield 0; } // //# a07a: ok
+a07b() sync { yield 0; } // //# a07b: syntax error
+a08a() sync* { yield* []; } // //# a08a: ok
+a08b() sync { yield 0; } // //# a08b: syntax error
+a09a() async* { yield 0; } // //# a09a: ok
+a10a() async* { yield* []; } // //# a10a: compile-time error
+
+get sync sync {} // //# a11a: syntax error
+get sync sync* {} // //# a11b: ok
+get async async {} // //# a11c: ok
+get async async* {} // //# a11d: ok
+
+get sync {} // //# a12a: ok
+get sync* {} // //# a12b: syntax error
+get async {} // //# a12c: ok
+get async* {} // //# a12d: syntax error
+get a12e sync* => null; // //# a12e: syntax error
+get a12f async* => null; // //# a12f: syntax error
+get a12g async => null; // //# a12g: ok
+
+int sync = 0; // //# a13a: ok
+int sync* = 0; // //# a13b: syntax error
+int async = 0; // //# a13c: ok
+int async* = 0; // //# a13d: syntax error
+
+var sync; // //# a14a: ok
+var sync*; // //# a14b: syntax error
+var async; // //# a14c: ok
+var async*; // //# a14d: syntax error
+
+sync() {} // //# a15a: ok
+sync*() {} // //# a15b: syntax error
+async() {} // //# a15c: ok
+async*() {} // //# a15d: syntax error
+
+abstract class B {
+ b00a() async; // //# b00a: syntax error
+ b00b() async*; // //# b00b: syntax error
+ b00c() sync*; // //# b00c: syntax error
+ b00d() sync; // //# b00d: syntax error
+}
+
+class C extends B {
+ C();
+
+ factory C.e1() async { return null; } // //# e1: compile-time error
+ factory C.e2() async* { return null; } // //# e2: compile-time error
+ factory C.e3() sync* { return null; } // //# e3: compile-time error
+ factory C.e4() async = C; // //# e4: syntax error
+ factory C.e5() async* = C; // //# e5: syntax error
+ factory C.e6() sync* = C; // //# e6: syntax error
+ C.e7() async {} // //# e7: compile-time error
+ C.e8() async* {} // //# e8: compile-time error
+ C.e9() sync* {} // //# e9: compile-time error
+
+ b00a() {} // //# b00a: continued
+ b00b() {} // //# b00b: continued
+ b00c() {} // //# b00c: continued
+ b00d() {} // //# b00d: continued
+
+ b01a() async => null; // //# b01a: ok
+ b01b() async* => null; // //# b01b: syntax error
+ b01c() sync* => null; // //# b01c: syntax error
+ b02a() async {} // //# b02a: ok
+ b03a() async* {} // //# b03a: ok
+ b04a() sync* {} // //# b04a: ok
+ b04b() sync {} // //# b04b: syntax error
+ b05a() async { await 0; } // //# b05a: ok
+ b06a() async { await for (var o in st) {} } // //# b06a: ok
+ b06b() async { await for ( ; ; ) {} } // //# b06b: compile-time error
+ b07a() sync* { yield 0; } // //# b07a: ok
+ b08a() sync* { yield* []; } // //# b08a: ok
+ b09a() async* { yield 0; } // //# b09a: ok
+ b10a() async* { yield* []; } // //# b10a: compile-time error
+ b10b() async { yield 0; } // //# b10b: compile-time error
+
+ get sync sync {} // //# b11a: syntax error
+ get sync sync* {} // //# b11b: ok
+ get async async {} // //# b11c: ok
+ get async async* {} // //# b11d: ok
+
+ get sync {} // //# b12a: ok
+ get sync* {} // //# b12b: syntax error
+ get async {} // //# b12c: ok
+ get async* {} // //# b12d: syntax error
+ get b12e sync* => null; // //# b12e: syntax error
+ get b12f async* => null; // //# b12f: syntax error
+ get b12g async => null; // //# b12g: ok
+
+ int sync = 0; // //# b13a: ok
+ int sync* = 0; // //# b13b: syntax error
+ int async = 0; // //# b13c: ok
+ int async* = 0; // //# b13d: syntax error
+
+ var sync; // //# b14a: ok
+ var sync*; // //# b14b: syntax error
+ var async; // //# b14c: ok
+ var async*; // //# b14d: syntax error
+
+ sync() {} // //# b15a: ok
+ sync*() {} // //# b15b: syntax error
+ async() {} // //# b15c: ok
+ async*() {} // //# b15d: syntax error
+}
+
+method1() {
+ c01a() async => null; c01a(); // //# c01a: ok
+ c01b() async* => null; c01b(); // //# c01b: syntax error
+ c01c() sync* => null; c01c(); // //# c01c: syntax error
+ c02a() async {} c02a(); // //# c02a: ok
+ c03a() async* {} c03a(); // //# c03a: ok
+ c04a() sync* {} c04a(); // //# c04a: ok
+ c04b() sync {} c04b(); // //# c04b: syntax error
+ c05a() async { await 0; } c05a(); // //# c05a: ok
+ c06a() async { await for (var o in st) {} } c06a(); // //# c06a: ok
+ c07a() sync* { yield 0; } c07a(); // //# c07a: ok
+ c08a() sync* { yield* []; } c08a(); // //# c08a: ok
+ c09a() async* { yield 0; } c09a(); // //# c09a: ok
+ c10a() async* { yield* []; } c10a(); // //# c10a: compile-time error
+ c11a() async { yield -5; } c11a(); // //# c11a: compile-time error
+ c11b() async { yield* st; } c11b(); // //# c11b: compile-time error
+}
+
+method2() {
+ var d01a = () async => null; d01a(); // //# d01a: ok
+ var d01b = () async* => null; d01b(); // //# d01b: syntax error
+ var d01c = () sync* => null; d01c(); // //# d01c: syntax error
+ var d02a = () async {}; d02a(); // //# d02a: ok
+ var d03a = () async* {}; d03a(); // //# d03a: ok
+ var d04a = () sync* {}; d04a(); // //# d04a: ok
+ var d04b = () sync {}; d04b(); // //# d04b: syntax error
+ var d05a = () async { await 0; }; d05a(); // //# d05a: ok
+ var d06a = () async { await for (var o in st) {} }; d06a(); // //# d06a: ok
+ var d07a = () sync* { yield 0; }; d07a(); // //# d07a: ok
+ var d08a = () sync* { yield* []; }; d08a(); // //# d08a: ok
+ var d08b = () sync* { yield*0+1; }; d08b(); // //# d08b: compile-time error
+ var d08c = () { yield*0+1; }; d08c(); // //# d08c: ok
+ var d09a = () async* { yield 0; }; d09a(); // //# d09a: ok
+ var d10a = () async* { yield* []; }; d10a(); // //# d10a: compile-time error
+}
+
+void main() {
+ var a;
+ var c = new C();
+ c = new C.e1(); //# e1: continued
+ c = new C.e2(); //# e2: continued
+ c = new C.e3(); //# e3: continued
+ c = new C.e4(); //# e4: continued
+ c = new C.e5(); //# e5: continued
+ c = new C.e6(); //# e6: continued
+ c = new C.e7(); //# e7: continued
+ c = new C.e8(); //# e8: continued
+ c = new C.e9(); //# e9: continued
+
+ a01a(); // //# a01a: continued
+ a01b(); // //# a01b: continued
+ a01c(); // //# a01c: continued
+ a01d(); // //# a01d: continued
+ a02a(); // //# a02a: continued
+ a03a(); // //# a03a: continued
+ a03b(); // //# a03b: continued
+ a04a(); // //# a04a: continued
+ a04b(); // //# a04b: continued
+ a04c(); // //# a04c: continued
+ a05a(); // //# a05a: continued
+ a05b(); // //# a05b: continued
+ a05c(); // //# a05c: continued
+ a05d(); // //# a05d: continued
+ a05e(); // //# a05e: continued
+ a05f(); // //# a05f: continued
+ a05g(); // //# a05g: continued
+ a05h(); // //# a05h: continued
+ a06a(); // //# a06a: continued
+ a06b(); // //# a06b: continued
+ a07a(); // //# a07a: continued
+ a07b(); // //# a07b: continued
+ a08a(); // //# a08a: continued
+ a08b(); // //# a08b: continued
+ a09a(); // //# a09a: continued
+ a10a(); // //# a10a: continued
+ a = sync; // //# a11a: continued
+ a = sync; // //# a11b: continued
+ a = async; // //# a11c: continued
+ a = async; // //# a11d: continued
+ a = sync; // //# a12a: continued
+ a = sync; // //# a12b: continued
+ a = async; // //# a12c: continued
+ a = async; // //# a12d: continued
+ a = a12e; // //# a12e: continued
+ a = a12f; // //# a12f: continued
+ a = a12g; // //# a12g: continued
+ a = sync; // //# a13a: continued
+ a = sync; // //# a13b: continued
+ a = async; // //# a13c: continued
+ a = async; // //# a13d: continued
+ a = sync; // //# a14a: continued
+ a = sync; // //# a14b: continued
+ a = async; // //# a14c: continued
+ a = async; // //# a14d: continued
+ sync(); // //# a15a: continued
+ sync(); // //# a15b: continued
+ async(); // //# a15c: continued
+ async(); // //# a15d: continued
+
+ c.b00a(); // //# b00a: continued
+ c.b00b(); // //# b00b: continued
+ c.b00c(); // //# b00c: continued
+ c.b00d(); // //# b00d: continued
+ c.b01a(); // //# b01a: continued
+ c.b01b(); // //# b01b: continued
+ c.b01c(); // //# b01c: continued
+ c.b02a(); // //# b02a: continued
+ c.b03a(); // //# b03a: continued
+ c.b04a(); // //# b04a: continued
+ c.b04b(); // //# b04b: continued
+ c.b05a(); // //# b05a: continued
+ c.b06a(); // //# b06a: continued
+ c.b06b(); // //# b06b: continued
+ c.b07a(); // //# b07a: continued
+ c.b08a(); // //# b08a: continued
+ c.b09a(); // //# b09a: continued
+ c.b10a(); // //# b10a: continued
+ c.b10b(); // //# b10b: continued
+ a = c.sync; // //# b11a: continued
+ a = c.sync; // //# b11b: continued
+ a = c.async; // //# b11c: continued
+ a = c.async; // //# b11d: continued
+ a = c.sync; // //# b12a: continued
+ a = c.sync; // //# b12b: continued
+ a = c.async; // //# b12c: continued
+ a = c.async; // //# b12d: continued
+ a = c.b12e; // //# b12e: continued
+ a = c.b12f; // //# b12f: continued
+ a = c.b12g; // //# b12g: continued
+ a = c.sync; // //# b13a: continued
+ a = c.sync; // //# b13b: continued
+ a = c.async; // //# b13c: continued
+ a = c.async; // //# b13d: continued
+ a = c.sync; // //# b14a: continued
+ a = c.sync; // //# b14b: continued
+ a = c.async; // //# b14c: continued
+ a = c.async; // //# b14d: continued
+ c.sync(); // //# b15a: continued
+ c.sync(); // //# b15b: continued
+ c.async(); // //# b15c: continued
+ c.async(); // //# b15d: continued
+
+ method1();
+ method2();
+}
diff --git a/tests/language/async/await_test.dart b/tests/language/async/await_test.dart
new file mode 100644
index 0000000..6803b91
--- /dev/null
+++ b/tests/language/async/await_test.dart
@@ -0,0 +1,2290 @@
+// 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 async_await_test;
+
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+import "dart:async";
+
+typedef dynamic DynamicToDynamic(dynamic d);
+
+main() {
+ asyncStart();
+ group("basic", () {
+ test("async w/o await", () {
+ f() async {
+ return id(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("async starts synchronously", () {
+ // Calling an "async" function starts immediately.
+ var result = [];
+ f() async {
+ result.add(1);
+ return id(42);
+ }
+
+ ;
+ var future = f();
+ result.add(0);
+ return future.whenComplete(() {
+ expect(result, equals([1, 0]));
+ });
+ });
+
+ test("async throws", () {
+ f() async {
+ throw "err";
+ return id(42);
+ }
+
+ return throwsErr(f());
+ });
+
+ test("await future", () {
+ f() async {
+ var v = await new Future.value(42);
+ return v;
+ }
+
+ ;
+ return expect42(f());
+ });
+
+ test("await value", () {
+ f() async {
+ var v = await id(42);
+ return v;
+ }
+
+ ;
+ return expect42(f());
+ });
+
+ test("await null", () {
+ f() async {
+ var v = await null;
+ expect(v, equals(null));
+ }
+
+ ;
+ return f();
+ });
+
+ test("await await", () {
+ f() async {
+ return await await new Future.value(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("await fake value future", () {
+ f() async {
+ return await new FakeValueFuture(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("await fake error future", () {
+ f() async {
+ return await new FakeErrorFuture("err");
+ }
+
+ return throwsErr(f());
+ });
+
+ test("await value is delayed", () {
+ f() async {
+ bool x = false;
+ scheduleMicrotask(() {
+ x = true;
+ });
+ var y = await true;
+ expect(x, equals(y));
+ }
+
+ return f();
+ });
+
+ test("await throw", () {
+ f() async {
+ await (throw "err"); // Check grammar: Are parentheses necessary?
+ return id(42);
+ }
+
+ return throwsErr(f());
+ });
+
+ test("throw before await", () {
+ f() async {
+ var x = throw "err";
+ await x; // Check grammar: Are parentheses necessary?
+ return id(42);
+ }
+
+ return throwsErr(f());
+ });
+
+ if (assertStatementsEnabled) {
+ test("assert before await", () {
+ f(v) async {
+ assert(v == 87);
+ return await new Future.microtask(() => 42);
+ }
+
+ return f(42).then((_) {
+ fail("assert didn't throw");
+ }, onError: (e, s) {
+ expect(e is AssertionError, isTrue);
+ });
+ });
+
+ test("assert after await", () {
+ f(v) async {
+ var x = await new Future.microtask(() => 42);
+ assert(v == 87);
+ return x;
+ }
+
+ return f(42).then((_) {
+ fail("assert didn't throw");
+ }, onError: (e, s) {
+ expect(e is AssertionError, isTrue);
+ });
+ });
+ }
+
+ test("async await error", () {
+ f() async {
+ await new Future.error("err");
+ return id(42);
+ }
+
+ return throwsErr(f());
+ });
+
+ test("async flattens futures", () {
+ f() async {
+ return new Future.value(42); // Not awaited.
+ }
+
+ ;
+ return f().then((v) {
+ expect(v, equals(42)); // And not a Future with value 42.
+ });
+ });
+
+ test("async flattens futures, error", () {
+ f() async {
+ return new Future.error("err"); // Not awaited.
+ }
+
+ return throwsErr(f());
+ });
+
+ test("await for", () {
+ f(Stream<int> s) async {
+ int i = 0;
+ await for (int v in s) {
+ i += v;
+ }
+ return i;
+ }
+
+ return f(mkStream()).then((v) {
+ expect(v, equals(45)); // 0 + 1 + ... + 9
+ });
+ });
+
+ test("await for w/ await", () {
+ f(Stream<int> s) async {
+ int i = 0;
+ await for (int v in s) {
+ i += await new Future<int>.value(v);
+ }
+ return i;
+ }
+
+ return f(mkStream()).then((v) {
+ expect(v, equals(45)); // 0 + 1 + ... + 9
+ });
+ });
+
+ test("await for empty", () {
+ f(Stream<int> s) async {
+ int v = 0;
+ await for (int i in s) {
+ v += i;
+ }
+ return v;
+ }
+
+ var s = (new StreamController<int>()..close()).stream;
+ return f(s).then((v) {
+ expect(v, equals(0));
+ });
+ });
+
+ if (assertStatementsEnabled) {
+ test("await for w/ await, asseert", () {
+ f(Stream<int> s) async {
+ int i = 0;
+ await for (int v in s) {
+ i += await new Future<int>.microtask(() => v);
+ assert(v < 8);
+ }
+ return i;
+ }
+
+ return f(mkStream()).then((v) {
+ fail("assert didn't throw");
+ }, onError: (e, s) {
+ expect(e is AssertionError, isTrue);
+ });
+ });
+ }
+ });
+
+ group("for", () {
+ test("await in for-loop", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i < 10; i++) {
+ v += await new Future<int>.value(42);
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(10 * id(42)));
+ });
+ });
+
+ test("await in for-init", () {
+ f() async {
+ int v = 0;
+ for (int i = await new Future.value(42); i >= 0; i -= 10) {
+ v += 10;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(10 * 5));
+ });
+ });
+
+ test("await in for-test", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i < await new Future.value(42); i += 10) {
+ v += 10;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(10 * 5));
+ });
+ });
+
+ test("await in for-incr", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i < 100; i += await new Future<int>.value(42)) {
+ v += 10;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(10 * 3));
+ });
+ });
+
+ test("await err in for-loop", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i < 10; i++) {
+ v += await new Future<int>.error("err");
+ }
+ return v;
+ }
+
+ return throwsErr(f());
+ });
+
+ test("await err in for-init", () {
+ f() async {
+ int v = 0;
+ for (int i = await new Future.error("err"); i >= 0; i -= 10) {
+ v += 10;
+ }
+ return v;
+ }
+
+ return throwsErr(f());
+ });
+
+ test("await err in for-test", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i < await new Future.error("err"); i += 10) {
+ v += 10;
+ }
+ return v;
+ }
+
+ return throwsErr(f());
+ });
+
+ test("await err in for-incr", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i < 100; i += await new Future<int>.error("err")) {
+ v += 10;
+ }
+ return v;
+ }
+
+ return throwsErr(f());
+ });
+
+ test("await in empty for-loop", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i > 0; i += 1) {
+ v += await new Future<int>.value(42);
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(0));
+ });
+ });
+
+ test("await in empty for-loop 2", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i > 0; i += await new Future<int>.value(1)) {
+ v += 1;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(0));
+ });
+ });
+
+ test("break before await in for-loop", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i < 10; i += 1) {
+ if (i == 2) break;
+ v += await new Future<int>.value(42);
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 2));
+ });
+ });
+
+ test("break before await in for-loop 2", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i < 10; i += await new Future<int>.value(1)) {
+ if (i == 2) break;
+ v += id(42) as int;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 2));
+ });
+ });
+
+ test("continue before await", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i < 10; i += 1) {
+ if (i == 2) continue;
+ v += await new Future<int>.value(42);
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 9));
+ });
+ });
+
+ test("continue after await", () {
+ f() async {
+ int v = 0;
+ for (int i = 0; i < 10; i += 1) {
+ var j = await new Future.value(42);
+ if (i == 2) continue;
+ v += j;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 9));
+ });
+ });
+ });
+
+ group("while", () {
+ test("await in while-loop", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ while (i < 10) {
+ v += await new Future<int>.value(42);
+ i++;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(10 * id(42)));
+ });
+ });
+
+ test("await in while-test", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ while (i < await new Future.value(42)) {
+ v += 10;
+ i += 10;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(10 * 5));
+ });
+ });
+
+ test("await err in loop", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ while (i < 10) {
+ v += await new Future<int>.error("err");
+ i++;
+ }
+ return v;
+ }
+
+ return throwsErr(f());
+ });
+
+ test("await err in test", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ while (i < await new Future.error("err")) {
+ v += 10;
+ i += 10;
+ }
+ return v;
+ }
+
+ return throwsErr(f());
+ });
+
+ test("break before await", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ while (i < 10) {
+ if (i == 2) break;
+ v += await new Future<int>.value(42);
+ i += 1;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 2));
+ });
+ });
+
+ test("break after await", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ while (i < 10) {
+ v += await new Future<int>.value(42);
+ if (i == 2) break;
+ i += 1;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 3));
+ });
+ });
+
+ test("continue before await", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ while (i < 10) {
+ i += 1;
+ if (i == 2) continue;
+ v += await new Future<int>.value(42);
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 9));
+ });
+ });
+
+ test("continue after await", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ while (i < 10) {
+ i += 1;
+ int j = await new Future.value(42);
+ if (i == 2) continue;
+ v += j;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 9));
+ });
+ });
+ });
+
+ group("do-while", () {
+ test("await in loop", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ do {
+ v += await new Future<int>.value(42);
+ i++;
+ } while (i < 10);
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(10 * id(42)));
+ });
+ });
+
+ test("await in test", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ do {
+ v += 10;
+ i += 10;
+ } while (i < await new Future.value(42));
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(10 * 5));
+ });
+ });
+
+ test("await err in loop", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ do {
+ v += await new Future<int>.error("err");
+ i++;
+ } while (i < 10);
+ return v;
+ }
+
+ return f().then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ });
+ });
+
+ test("await err in test", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ do {
+ v += 10;
+ i += 10;
+ } while (i < await new Future.error("err"));
+ return v;
+ }
+
+ return f().then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ });
+ });
+
+ test("break before await", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ do {
+ if (i == 2) break;
+ v += await new Future<int>.value(42);
+ i += 1;
+ } while (i < 10);
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 2));
+ });
+ });
+
+ test("break after await", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ do {
+ v += await new Future<int>.value(42);
+ if (i == 2) break;
+ i += 1;
+ } while (i < 10);
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 3));
+ });
+ });
+
+ test("continue before await", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ do {
+ i += 1;
+ if (i == 2) continue;
+ v += await new Future<int>.value(42);
+ } while (i < 10);
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 9));
+ });
+ });
+
+ test("continue after await", () {
+ f() async {
+ int v = 0;
+ int i = 0;
+ do {
+ i += 1;
+ int j = await new Future.value(42);
+ if (i == 2) continue;
+ v += j;
+ } while (i < 10);
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42 * 9));
+ });
+ });
+ });
+
+ group("for-in", () {
+ test("await in for-in", () {
+ f() async {
+ var v = 0;
+ for (var fut in [1, 2, 3].map((v) => new Future.value(v))) {
+ v += await fut;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(6));
+ });
+ });
+
+ test("await in for-in iterable", () {
+ f() async {
+ var v = 0;
+ for (var i in await new Future.value([1, 2, 3])) {
+ v += i;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(6));
+ });
+ });
+
+ test("await err in for-in", () {
+ f() async {
+ var v = 0;
+ for (var fut in [1, 2, 3].map((v) => (v != 1)
+ ? new Future<int>.value(v)
+ : new Future<int>.error("err"))) {
+ v += await fut;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ });
+ });
+
+ test("await err in for-in iterable", () {
+ f() async {
+ var v = 0;
+ for (var i in await new Future<Iterable<int>>.error("err")) {
+ v += i;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ });
+ });
+
+ test("break before await in for-in", () {
+ f() async {
+ var v = 0;
+ for (var fut in [1, 2, 3].map((v) => new Future.value(v))) {
+ if (v == 3) break;
+ v += await fut;
+ }
+ return v;
+ }
+
+ return f().then((v) {
+ expect(v, equals(3));
+ });
+ });
+ });
+
+ group("try-catch", () {
+ test("try-no-catch", () {
+ f() async {
+ try {
+ return await id(42);
+ } catch (e) {
+ return 37;
+ }
+ }
+
+ return expect42(f());
+ });
+
+ test("await in body", () {
+ f() async {
+ try {
+ await new Future.error(42);
+ } catch (e) {
+ return e;
+ }
+ }
+
+ return expect42(f());
+ });
+
+ test("throw before await in body", () {
+ int i = id(0);
+ f() async {
+ try {
+ if (i >= 0) throw id(42);
+ return await new Future.value(10);
+ } catch (e) {
+ return e;
+ }
+ }
+
+ return expect42(f());
+ });
+
+ test("try-catch await in catch", () {
+ f() async {
+ try {
+ throw id(42);
+ } catch (e) {
+ return await new Future.value(e);
+ }
+ }
+
+ return expect42(f());
+ });
+
+ test("try-catch await error in catch", () {
+ f() async {
+ try {
+ throw id(42);
+ } catch (e) {
+ await new Future.error("err");
+ }
+ }
+
+ return f().then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ });
+ });
+
+ test("try-catch-rethrow", () {
+ f() async {
+ try {
+ await new Future.error("err");
+ } catch (e) {
+ if (e == id(42)) return;
+ rethrow;
+ }
+ }
+
+ return f().then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ });
+ });
+ });
+
+ group("try-finally", () {
+ test("await in body", () {
+ f() async {
+ try {
+ return await new Future.value(42);
+ } finally {
+ // Don't do anything.
+ }
+ }
+
+ return expect42(f());
+ });
+
+ test("await in finally", () {
+ var x = 0;
+ f() async {
+ try {
+ return id(42);
+ } finally {
+ x = await new Future.value(37);
+ }
+ }
+
+ return f().then((v) {
+ expect(v, equals(42));
+ expect(x, equals(37));
+ });
+ });
+
+ test("await err in body", () {
+ f() async {
+ try {
+ return await new Future.error("err");
+ } finally {
+ // Don't do anything.
+ }
+ }
+
+ return f().then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ });
+ });
+
+ test("await err in finally", () {
+ f() async {
+ try {
+ return id(42);
+ } finally {
+ await new Future.error("err");
+ }
+ }
+
+ return f().then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ });
+ });
+
+ test("await err in both", () {
+ f() async {
+ try {
+ await new Future.error("not err");
+ } finally {
+ await new Future.error("err");
+ }
+ }
+
+ return f().then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ });
+ });
+
+ test("await err in body, override in finally", () {
+ f() async {
+ try {
+ return await new Future.error("err");
+ } finally {
+ return id(42);
+ }
+ }
+
+ return expect42(f());
+ });
+
+ test("await in body, override in finally", () {
+ f() async {
+ label:
+ try {
+ return await new Future.value(37);
+ } finally {
+ break label;
+ }
+ return id(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("await, override in finally", () {
+ var x = 0;
+ f() async {
+ label:
+ try {
+ return 87;
+ } finally {
+ x = await new Future.value(37);
+ break label;
+ }
+ return id(42);
+ }
+
+ return f().then((v) {
+ expect(v, equals(42));
+ expect(x, equals(37));
+ });
+ });
+
+ test("throw in body, await, override in finally 3", () {
+ var x = 0;
+ f() async {
+ label:
+ try {
+ throw "err";
+ } finally {
+ x = await new Future.value(37);
+ break label;
+ }
+ return id(42);
+ }
+
+ return f().then((v) {
+ expect(v, equals(42));
+ expect(x, equals(37));
+ });
+ });
+
+ test("await err in body, override in finally 2", () {
+ f() async {
+ label:
+ try {
+ return await new Future.error("err");
+ } finally {
+ break label;
+ }
+ return id(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("await in body, no-exit in finally", () {
+ f() async {
+ for (int i = 0; i < 10; i++) {
+ try {
+ return await i;
+ } finally {
+ continue;
+ }
+ }
+ return id(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("no-exit after await in finally", () {
+ f() async {
+ int i = 0;
+ for (; i < 10; i++) {
+ try {
+ break;
+ } finally {
+ await new Future.value(42);
+ continue;
+ }
+ }
+ return id(i);
+ }
+
+ return f().then((v) {
+ expect(v, equals(10));
+ });
+ });
+
+ test("exit after continue, await in finally", () {
+ f() async {
+ int i = 0;
+ for (; i < 10; i++) {
+ try {
+ continue;
+ } finally {
+ await new Future.value(42);
+ break;
+ }
+ }
+ return id(i);
+ }
+
+ return f().then((v) {
+ expect(v, equals(0));
+ });
+ });
+
+ test("no-exit before await in finally 2", () {
+ f() async {
+ for (int i = 0; i < 10; i++) {
+ try {
+ return i;
+ } finally {
+ if (i >= 0) continue;
+ await new Future.value(42);
+ }
+ }
+ return id(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("no-exit after await in finally", () {
+ f() async {
+ for (int i = 0; i < 10; i++) {
+ try {
+ return i;
+ } finally {
+ await new Future.value(42);
+ continue;
+ }
+ }
+ return id(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("nested finallies", () {
+ var x = 0;
+ f() async {
+ try {
+ try {
+ return 42;
+ } finally {
+ x = await new Future.value(37);
+ }
+ } finally {
+ x += await new Future<int>.value(37);
+ }
+ }
+
+ return f().then((v) {
+ expect(v, equals(42));
+ expect(x, equals(74));
+ });
+ });
+
+ test("nested finallies 2", () {
+ var x = 0;
+ f() async {
+ label:
+ try {
+ try {
+ break label;
+ } finally {
+ x = await new Future.value(37);
+ }
+ } finally {
+ x += await new Future<int>.value(37);
+ }
+ return 42;
+ }
+
+ return f().then((v) {
+ expect(v, equals(42));
+ expect(x, equals(74));
+ });
+ });
+
+ test("nested finallies 3", () {
+ var x = 0;
+ f() async {
+ label:
+ try {
+ try {
+ break label;
+ } finally {
+ return await new Future.value(42);
+ }
+ } finally {
+ break label;
+ }
+ return 42;
+ }
+
+ return expect42(f());
+ });
+
+ test("nested finallies, throw", () {
+ var x = 0;
+ f() async {
+ try {
+ try {
+ throw "err";
+ } finally {
+ x = await new Future.value(37);
+ }
+ } finally {
+ x += await new Future<int>.value(37);
+ }
+ }
+
+ return f().then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ expect(x, equals(2 * 37));
+ });
+ });
+ });
+
+ group("try-catch-finally", () {
+ test("await in body", () {
+ f() async {
+ try {
+ return await new Future.value(42);
+ } catch (e) {
+ throw "!";
+ } finally {
+ if (id(42) == id(10)) return 10;
+ }
+ }
+
+ return expect42(f());
+ });
+
+ test("await in catch, not hit", () {
+ f() async {
+ try {
+ return id(42);
+ } catch (e) {
+ await new Future.error("err");
+ } finally {
+ if (id(42) == id(10)) return 10;
+ }
+ }
+
+ return expect42(f());
+ });
+
+ test("await in catch, hit", () {
+ f() async {
+ try {
+ return throw id(42);
+ } catch (e) {
+ return await new Future.value(e);
+ } finally {
+ if (id(42) == id(10)) return 10;
+ }
+ }
+
+ return expect42(f());
+ });
+
+ test("await in finally", () {
+ var x = 0;
+ f() async {
+ try {
+ return id(42);
+ } catch (e) {
+ throw "!";
+ } finally {
+ x = await new Future.value(37);
+ if (id(42) == id(10)) return 10;
+ }
+ }
+
+ return f().then((v) {
+ expect(v, equals(42));
+ expect(x, equals(37));
+ });
+ });
+ });
+
+ group("switch", () {
+ test("await in expression", () {
+ f(v) async {
+ switch (await new Future.value(v)) {
+ case 1:
+ return 1;
+ case 2:
+ return 42;
+ default:
+ return 3;
+ }
+ return null;
+ }
+
+ return expect42(f(2));
+ });
+
+ test("await err in expression", () {
+ f(v) async {
+ switch (await new Future.error("err")) {
+ case 1:
+ return 1;
+ case 2:
+ return 42;
+ default:
+ return 3;
+ }
+ return null;
+ }
+
+ return throwsErr(f(2));
+ });
+
+ test("await in case", () {
+ f(v) async {
+ switch (v) {
+ case 1:
+ return 1;
+ case 2:
+ return await new Future.value(42);
+ default:
+ return 3;
+ }
+ return null;
+ }
+
+ return expect42(f(2));
+ });
+
+ test("await err in case", () {
+ f(v) async {
+ switch (v) {
+ case 1:
+ return 1;
+ case 2:
+ return await new Future.error("err");
+ default:
+ return 3;
+ }
+ return null;
+ }
+
+ return throwsErr(f(2));
+ });
+ // TODO(jmesserly): restore this when we fix
+ // https://github.com/dart-lang/dev_compiler/issues/263
+ /*test("continue before await in case", () {
+ f(v) async {
+ switch (v) {
+ label:
+ case 1: return 42;
+ case 2:
+ if (v <= 2) continue label;
+ return await new Future.value(10);
+ default: return 3;
+ }
+ return null;
+ }
+ return expect42(f(2));
+ });
+
+ test("continue after await in case", () {
+ f(v) async {
+ switch (v) {
+ label:
+ case 1: return 42;
+ case 2:
+ await new Future.value(10);
+ continue label;
+ default: return 3;
+ }
+ return null;
+ }
+ return expect42(f(2));
+ });*/
+ });
+
+ group("if", () {
+ test("await in test", () {
+ f(v) async {
+ if (await new Future.value(v)) {
+ return 42;
+ } else {
+ return 37;
+ }
+ }
+
+ return expect42(f(true));
+ });
+
+ test("await err in test", () {
+ f(v) async {
+ if (await new Future.error("err")) {
+ return 42;
+ } else {
+ return 37;
+ }
+ }
+
+ return throwsErr(f(true));
+ });
+
+ test("await in then", () {
+ f(v) async {
+ if (v) {
+ return await new Future.value(42);
+ }
+ return 37;
+ }
+
+ return expect42(f(true));
+ });
+
+ test("await err in then", () {
+ f(v) async {
+ if (v) {
+ return await new Future.error("err");
+ }
+ return 37;
+ }
+
+ return throwsErr(f(true));
+ });
+
+ test("await in then with else", () {
+ f(v) async {
+ if (v) {
+ return await new Future.value(42);
+ } else {
+ return 87;
+ }
+ return 37;
+ }
+
+ return expect42(f(true));
+ });
+
+ test("await err in then with else", () {
+ f(v) async {
+ if (v) {
+ return await new Future.error("err");
+ } else {
+ return 87;
+ }
+ return 37;
+ }
+
+ return throwsErr(f(true));
+ });
+
+ test("await in else", () {
+ f(v) async {
+ if (v) {
+ return 37;
+ } else {
+ return await new Future.value(42);
+ }
+ return 87;
+ }
+
+ return expect42(f(false));
+ });
+
+ test("await err in else", () {
+ f(v) async {
+ if (v) {
+ return 37;
+ } else {
+ return await new Future.error("err");
+ }
+ return 87;
+ }
+
+ return throwsErr(f(false));
+ });
+
+ test("await in else-if test", () {
+ f(v) async {
+ if (v) {
+ return 37;
+ } else if (!await new Future.value(v)) {
+ return 42;
+ } else {
+ return 37;
+ }
+ return 87;
+ }
+
+ return expect42(f(false));
+ });
+
+ test("await in else-if then", () {
+ f(v) async {
+ if (v) {
+ return 37;
+ } else if (!v) {
+ return await new Future.value(42);
+ } else {
+ return 37;
+ }
+ return 87;
+ }
+
+ return expect42(f(false));
+ });
+ });
+
+ group("conditional operator", () {
+ test("await in test", () {
+ f(v) async {
+ return (await new Future.value(v)) ? 42 : 37;
+ }
+
+ return expect42(f(true));
+ });
+
+ test("await err in test", () {
+ f(v) async {
+ return (await new Future.error("err")) ? 42 : 37;
+ }
+
+ return throwsErr(f(true));
+ });
+
+ test("await in then", () {
+ f(v) async {
+ return v ? (await new Future.value(42)) : 37;
+ }
+
+ return expect42(f(true));
+ });
+
+ test("await err in then", () {
+ f(v) async {
+ return v ? (await new Future.error("err")) : 37;
+ }
+
+ return throwsErr(f(true));
+ });
+
+ test("await in else", () {
+ f(v) async {
+ return v ? 37 : (await new Future.value(42));
+ }
+
+ return expect42(f(false));
+ });
+
+ test("await err in else", () {
+ f(v) async {
+ return v ? 37 : (await new Future.error("err"));
+ }
+
+ return throwsErr(f(false));
+ });
+ });
+
+ group("async declarations", () {
+ var f42 = new Future.value(42);
+
+ // Top-level declarations or local declarations in top-level functions.
+ test("topMethod", () {
+ return expect42(topMethod(f42));
+ });
+
+ test("topArrowMethod", () {
+ return expect42(topArrowMethod(f42));
+ });
+
+ test("topGetter", () {
+ return expect42(topGetter);
+ });
+
+ test("topArrowGetter", () {
+ return expect42(topArrowGetter);
+ });
+
+ test("topLocal", () {
+ return expect42(topLocal(f42));
+ });
+
+ test("topArrowLocal", () {
+ return expect42(topArrowLocal(f42));
+ });
+
+ test("topExpression", () {
+ return expect42(topExpression(f42));
+ });
+
+ test("topArrowExpression", () {
+ return expect42(topArrowExpression(f42));
+ });
+
+ test("topVarExpression", () {
+ return expect42(topVarExpression(f42));
+ });
+
+ test("topVarArrowExpression", () {
+ return expect42(topVarArrowExpression(f42));
+ });
+
+ // Static declarations or local declarations in static functions.
+ test("staticMethod", () {
+ return expect42(Async.staticMethod(f42));
+ });
+
+ test("staticArrowMethod", () {
+ return expect42(Async.staticArrowMethod(f42));
+ });
+
+ test("staticGetter", () {
+ return expect42(Async.staticGetter);
+ });
+
+ test("staticArrowGetter", () {
+ return expect42(Async.staticArrowGetter);
+ });
+
+ test("staticLocal", () {
+ return expect42(Async.staticLocal(f42));
+ });
+
+ test("staticArrowLocal", () {
+ return expect42(Async.staticArrowLocal(f42));
+ });
+
+ test("staticExpression", () {
+ return expect42(Async.staticExpression(f42));
+ });
+
+ test("staticArrowExpression", () {
+ return expect42(Async.staticArrowExpression(f42));
+ });
+
+ test("staticVarExpression", () {
+ return expect42(Async.staticVarExpression(f42));
+ });
+
+ test("staticVarArrowExpression", () {
+ return expect42(Async.staticVarArrowExpression(f42));
+ });
+
+ // Instance declarations or local declarations in instance functions.
+ var async = new Async();
+
+ test("instanceMethod", () {
+ return expect42(async.instanceMethod(f42));
+ });
+
+ test("instanceArrowMethod", () {
+ return expect42(async.instanceArrowMethod(f42));
+ });
+
+ test("instanceGetter", () {
+ return expect42(async.instanceGetter);
+ });
+
+ test("instanceArrowGetter", () {
+ return expect42(async.instanceArrowGetter);
+ });
+
+ test("instanceLocal", () {
+ return expect42(async.instanceLocal(f42));
+ });
+
+ test("instanceArrowLocal", () {
+ return expect42(async.instanceArrowLocal(f42));
+ });
+
+ test("instanceExpression", () {
+ return expect42(async.instanceExpression(f42));
+ });
+
+ test("instanceArrowExpression", () {
+ return expect42(async.instanceArrowExpression(f42));
+ });
+
+ test("instanceVarExpression", () {
+ return expect42(async.instanceVarExpression(f42));
+ });
+
+ test("instanceVarArrowExpression", () {
+ return expect42(async.instanceVarArrowExpression(f42));
+ });
+
+ // Local functions in constructor initializer list.
+ test("initializerExpression", () {
+ var async = new Async.initializer(f42);
+ return expect42(async.initValue);
+ });
+
+ test("initializerArrowExpression", () {
+ var async = new Async.initializerArrow(f42);
+ return expect42(async.initValue);
+ });
+
+ test("async in async", () {
+ return expect42(asyncInAsync(f42));
+ });
+
+ test("sync in async", () {
+ return expect42(syncInAsync(f42));
+ });
+
+ test("async in sync", () {
+ return expect42(asyncInSync(f42));
+ });
+
+ test("Identical and equals", () {
+ expect(async.instanceMethod, equals(async.instanceMethod));
+ expect(Async.staticMethod, same(Async.staticMethod));
+ expect(topMethod, same(topMethod));
+ });
+ });
+
+ group("await expression", () {
+ const c42 = 42;
+ final v42 = 42;
+
+ test("local variable", () {
+ var l42 = 42;
+ f() async {
+ return await l42;
+ }
+
+ return expect42(f());
+ });
+
+ test("parameter", () {
+ f(p) async {
+ return await p;
+ }
+
+ return expect42(f(42));
+ });
+
+ test("final local variable", () {
+ f() async {
+ return await v42;
+ }
+
+ return expect42(f());
+ });
+
+ test("const local variable", () {
+ f() async {
+ return await c42;
+ }
+
+ return expect42(f());
+ });
+
+ test("unary prefix operator", () {
+ f() async {
+ return -await -42;
+ }
+
+ return expect42(f());
+ });
+
+ test("suffix operator", () {
+ f() async {
+ var v = [42];
+ return await v[0];
+ }
+
+ return expect42(f());
+ });
+
+ test("unary postfix operator", () {
+ f() async {
+ var x = 42;
+ return await x++;
+ }
+
+ return expect42(f());
+ });
+
+ test("suffix operator + increment", () {
+ f() async {
+ var v = [42];
+ return await v[0]++;
+ }
+
+ return expect42(f());
+ });
+
+ test("suffix operator + increment 2", () {
+ f() async {
+ var v = [42];
+ return await v[await 0]++;
+ }
+
+ return expect42(f());
+ });
+
+ test("unary pre-increment operator", () {
+ f() async {
+ var x = 41;
+ return await ++x;
+ }
+
+ return expect42(f());
+ });
+
+ test("suffix operator + pre-increment", () {
+ f() async {
+ var v = [41];
+ return await ++v[0];
+ }
+
+ return expect42(f());
+ });
+
+ test("assignment operator", () {
+ f() async {
+ var x = 37;
+ return await (x = 42);
+ }
+
+ return expect42(f());
+ });
+
+ test("assignment-op operator", () {
+ f() async {
+ var x = 37;
+ return await (x += 5);
+ }
+
+ return expect42(f());
+ });
+
+ test("binary operator", () {
+ f() async {
+ return await (10 + 11) + await (10 + 11);
+ }
+
+ return expect42(f());
+ });
+
+ test("ternary operator", () {
+ f(v) async {
+ return await ((v == 10) ? new Future.value(42) : 37);
+ }
+
+ return expect42(f(10));
+ });
+
+ test("top-level function call", () {
+ f() async {
+ return await topMethod(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("static function call", () {
+ f() async {
+ return await Async.staticMethod(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("instance function call", () {
+ f() async {
+ var a = new Async();
+ return await a.instanceMethod(42);
+ }
+
+ return expect42(f());
+ });
+
+ test("top-level function call w/ await", () {
+ f() async {
+ return await topMethod(await 42);
+ }
+
+ return expect42(f());
+ });
+
+ test("static function call w/ await", () {
+ f() async {
+ return await Async.staticMethod(await 42);
+ }
+
+ return expect42(f());
+ });
+
+ test("instance function call w/ await", () {
+ f() async {
+ var a = new Async();
+ return await a.instanceMethod(await 42);
+ }
+
+ return expect42(f());
+ });
+
+ test("top-level getter call", () {
+ f() async {
+ return await topGetter;
+ }
+
+ return expect42(f());
+ });
+
+ test("static getter call", () {
+ f() async {
+ return await Async.staticGetter;
+ }
+
+ return expect42(f());
+ });
+
+ test("top-level getter call", () {
+ f() async {
+ var a = new Async();
+ return await a.instanceGetter;
+ }
+
+ return expect42(f());
+ });
+
+ if (!assertStatementsEnabled) return;
+
+ test("inside assert, true", () { // //# 03: ok
+ f() async { // //# 03: continued
+ assert(await new Future.microtask(() => true)); // //# 03: continued
+ return 42; // //# 03: continued
+ } // //# 03: continued
+ return expect42(f()); // //# 03: continued
+ }); // //# 03: continued
+
+ test("inside assert, false", () { // //# 03: continued
+ f() async { // //# 03: continued
+ assert(await new Future.microtask(() => false)); // //# 03: continued
+ return 42; // //# 03: continued
+ } // //# 03: continued
+ return f().then((_) { // //# 03: continued
+ fail("assert didn't throw"); // //# 03: continued
+ }, onError: (e, s) { // //# 03: continued
+ expect(e is AssertionError, isTrue); // //# 03: continued
+ }); // //# 03: continued
+ }); // //# 03: continued
+
+ test("inside assert, function -> false", () { // //# 03: continued
+ f() async { // //# 03: continued
+ assert(await new Future.microtask(() => false)); // //# 03: continued
+ return 42; // //# 03: continued
+ } // //# 03: continued
+ return f().then((_) { // //# 03: continued
+ fail("assert didn't throw"); // //# 03: continued
+ }, onError: (e, s) { // //# 03: continued
+ expect(e is AssertionError, isTrue); // //# 03: continued
+ }); // //# 03: continued
+ }); // //# 03: continued
+ });
+
+ group("syntax", () {
+ test("async as variable", () {
+ // Valid identifiers outside of async function.
+ var async = 42;
+ expect(async, equals(42));
+ });
+
+ test("await as variable", () { // //# 02: ok
+ // Valid identifiers outside of async function. // //# 02: continued
+ var await = 42; // //# 02: continued
+ expect(await, equals(42)); // //# 02: continued
+ }); // //# 02: continued
+
+ test("yield as variable", () {
+ // Valid identifiers outside of async function.
+ var yield = 42;
+ expect(yield, equals(42));
+ });
+ });
+ asyncEnd();
+}
+
+// Mock test framework sufficient to run tests.
+
+String _currentName = "";
+
+test(name, action()) {
+ var oldName = _currentName;
+ _currentName = [oldName, name].join(" ");
+ runZoned(() {
+ asyncTest(() => new Future.sync(action));
+ }, zoneValues: {#testName: _currentName});
+ _currentName = oldName;
+}
+
+group(name, entries()) {
+ var oldName = _currentName;
+ _currentName = [oldName, name].join(" ");
+ entries();
+ _currentName = oldName;
+}
+
+expect(value, expectation) {
+ var name = Zone.current[#testName];
+ if (expectation is bool) {
+ // Just for better error message.
+ (expectation ? Expect.isTrue : Expect.isFalse)(value, name);
+ return;
+ }
+ if (expectation is List) {
+ Expect.listEquals(expectation, value, name);
+ return;
+ }
+ if (expectation is Function(Object, String)) {
+ expectation(value, name);
+ return;
+ }
+ Expect.equals(expectation, value, name);
+}
+
+equals(x) => x;
+final isTrue = true;
+same(v) => (Object o, String name) => Expect.identical(v, o, name);
+fail(message) {
+ var name = Zone.current[#testName];
+ Expect.fail("$name: $message");
+}
+
+// End mock.
+
+// Attempt to obfuscates value to avoid too much constant folding.
+id(v) {
+ try {
+ if (v != null) throw v;
+ } catch (e) {
+ return e;
+ }
+ return null;
+}
+
+// Create a stream for testing "async for-in".
+Stream<int> mkStream() {
+ late StreamController<int> c;
+ int i = 0;
+ next() {
+ c.add(i++);
+ if (i == 10) {
+ c.close();
+ } else {
+ scheduleMicrotask(next);
+ }
+ }
+
+ c = new StreamController(onListen: () {
+ scheduleMicrotask(next);
+ });
+ return c.stream;
+}
+
+// Check that future contains the error "err".
+Future throwsErr(Future future) {
+ return future.then((v) {
+ fail("didn't throw");
+ }, onError: (e) {
+ expect(e, equals("err"));
+ });
+}
+
+// Check that future contains the value 42.
+Future expect42(Future future) {
+ return future.then((v) {
+ expect(v, equals(42));
+ });
+}
+
+// Various async declarations.
+
+Future topMethod(f) async {
+ return await f;
+}
+
+Future topArrowMethod(f) async => await f;
+
+Future get topGetter async {
+ return await new Future.value(42);
+}
+
+Future get topArrowGetter async => await new Future.value(42);
+
+Future topLocal(f) {
+ local() async {
+ return await f;
+ }
+
+ return local();
+}
+
+Future topArrowLocal(f) {
+ local() async => await f;
+ return local();
+}
+
+Future topExpression(f) {
+ return () async {
+ return await f;
+ }();
+}
+
+Future topArrowExpression(f) {
+ return (() async => await f)();
+}
+
+DynamicToDynamic topVarExpression = (f) async {
+ return await f;
+};
+
+var topVarArrowExpression = (f) async => await f;
+
+class Async {
+ var initValue;
+ Async();
+
+ Async.initializer(f)
+ : initValue = (() async {
+ return await f;
+ }());
+
+ Async.initializerArrow(f) : initValue = ((() async => await f)());
+
+ /* static */
+ static Future staticMethod(f) async {
+ return await f;
+ }
+
+ static Future staticArrowMethod(f) async => await f;
+
+ static Future get staticGetter async {
+ return await new Future.value(42);
+ }
+
+ static Future get staticArrowGetter async => await new Future.value(42);
+
+ static Future staticLocal(f) {
+ local() async {
+ return await f;
+ }
+
+ return local();
+ }
+
+ static Future staticArrowLocal(f) {
+ local() async => await f;
+ return local();
+ }
+
+ static Future staticExpression(f) {
+ return () async {
+ return await f;
+ }();
+ }
+
+ static Future staticArrowExpression(f) {
+ return (() async => await f)();
+ }
+
+ static DynamicToDynamic staticVarExpression = (f) async {
+ return await f;
+ };
+
+ static var staticVarArrowExpression = (f) async => await f;
+
+ /* instance */
+ Future instanceMethod(f) async {
+ return await f;
+ }
+
+ Future instanceArrowMethod(f) async => await f;
+
+ Future get instanceGetter async {
+ return await new Future.value(42);
+ }
+
+ Future get instanceArrowGetter async => await new Future.value(42);
+
+ Future instanceLocal(f) {
+ local() async {
+ return await f;
+ }
+
+ return local();
+ }
+
+ Future instanceArrowLocal(f) {
+ local() async => await f;
+ return local();
+ }
+
+ Future instanceExpression(f) {
+ return () async {
+ return await f;
+ }();
+ }
+
+ Future instanceArrowExpression(f) {
+ return (() async => await f)();
+ }
+
+ DynamicToDynamic instanceVarExpression = (f) async {
+ return await f;
+ };
+
+ var instanceVarArrowExpression = (f) async => await f;
+}
+
+Future asyncInAsync(f) async {
+ inner(f) async {
+ return await f;
+ }
+
+ return await inner(f);
+}
+
+Future asyncInSync(f) {
+ inner(f) async {
+ return await f;
+ }
+
+ return inner(f);
+}
+
+Future syncInAsync(f) async {
+ inner(f) {
+ return f;
+ }
+
+ return await inner(f);
+}
+
+/**
+ * A non-standard implementation of Future with a value.
+ */
+class FakeValueFuture implements Future {
+ final _value;
+ FakeValueFuture(this._value);
+ Future<S> then<S>(callback(value), {Function? onError}) {
+ return new Future<S>.microtask(() => callback(_value));
+ }
+
+ Future whenComplete(callback()) {
+ return new Future.microtask(() {
+ callback();
+ });
+ }
+
+ Future catchError(Function onError, {bool test(Object error)?}) => this;
+ Stream asStream() => (new StreamController()
+ ..add(_value)
+ ..close())
+ .stream;
+ Future timeout(Duration duration, {onTimeout()?}) => this;
+}
+
+typedef BinaryFunction(a, b);
+
+/**
+ * A non-standard implementation of Future with an error.
+ */
+class FakeErrorFuture implements Future {
+ final _error;
+ FakeErrorFuture(this._error);
+ Future<S> then<S>(callback(value), {Function? onError}) {
+ if (onError != null) {
+ if (onError is BinaryFunction) {
+ return new Future<S>.microtask(() => onError(_error, null));
+ }
+ return new Future<S>.microtask(() => onError(_error));
+ }
+ return new Future<S>.error(_error);
+ }
+
+ Future whenComplete(callback()) {
+ return new Future.microtask(() {
+ callback();
+ }).then((_) => this);
+ }
+
+ Future catchError(Function onError, {bool test(Object error)?}) {
+ return new Future.microtask(() {
+ if (test != null && !test(_error)) return this;
+ if (onError is BinaryFunction) {
+ return onError(_error, null);
+ }
+ return onError(_error);
+ });
+ }
+
+ Stream asStream() => (new StreamController()
+ ..addError(_error)
+ ..close())
+ .stream;
+ Future timeout(Duration duration, {onTimeout()?}) => this;
+}
diff --git a/tests/language/async/backwards_compatibility_1_test.dart b/tests/language/async/backwards_compatibility_1_test.dart
new file mode 100644
index 0000000..6a45da1
--- /dev/null
+++ b/tests/language/async/backwards_compatibility_1_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2014, 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:async';
+import 'helper_lib.dart' as async;
+
+class A {
+ async.async get x => async.async();
+}
+
+class B {
+ int get async => 0;
+}
+
+async.async topLevel() => async.async();
+
+main() {
+ var a = new A();
+ var b = a.x;
+ var c = topLevel();
+ var d = new B();
+ var e = d.async;
+}
diff --git a/tests/language/async/backwards_compatibility_2_test.dart b/tests/language/async/backwards_compatibility_2_test.dart
new file mode 100644
index 0000000..7fe1a9e
--- /dev/null
+++ b/tests/language/async/backwards_compatibility_2_test.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2014, 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.
+
+int get async {
+ return 1;
+}
+
+class A {
+ async() => null;
+}
+
+main() {
+ var a = async;
+ var b = new A();
+ var c = b.async();
+}
diff --git a/tests/language/async/break_in_finally_test.dart b/tests/language/async/break_in_finally_test.dart
new file mode 100644
index 0000000..c7af117
--- /dev/null
+++ b/tests/language/async/break_in_finally_test.dart
@@ -0,0 +1,54 @@
+// 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:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+then43() async {
+ label:
+ try {
+ return await 42;
+ } finally {
+ break label;
+ }
+ return await 43;
+}
+
+then42() async {
+ label:
+ try {
+ return await 42;
+ } finally {}
+ return await 43;
+}
+
+now43() {
+ label:
+ try {
+ return 42;
+ } finally {
+ break label;
+ }
+ return 43;
+}
+
+now42() {
+ label:
+ try {
+ return 42;
+ } finally {}
+ return 43;
+}
+
+test() async {
+ Expect.equals(42, await then42());
+ Expect.equals(43, await then43());
+ Expect.equals(42, now42());
+ Expect.equals(43, now43());
+}
+
+main() {
+ asyncStart();
+ test().then((_) => asyncEnd());
+}
diff --git a/tests/language/async/call_test.dart b/tests/language/async/call_test.dart
new file mode 100644
index 0000000..bc107b6
--- /dev/null
+++ b/tests/language/async/call_test.dart
@@ -0,0 +1,35 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+var result = "";
+
+foo() {
+ result += "foo";
+}
+
+bar() async {
+ result += "bar";
+ await null;
+ result += "bar2";
+}
+
+main() {
+ asyncStart();
+ () async {
+ var f = new Future(foo);
+ var b = bar();
+ Expect.equals("bar", result);
+ scheduleMicrotask(() => result += "micro");
+ await b;
+ await f;
+
+ // Validates that bar is scheduled as a microtask, before foo.
+ Expect.equals("barbar2microfoo", result);
+ asyncEnd();
+ }();
+}
diff --git a/tests/language/async/cascade_test.dart b/tests/language/async/cascade_test.dart
new file mode 100644
index 0000000..9a06195
--- /dev/null
+++ b/tests/language/async/cascade_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2014, 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:async';
+
+import 'package:expect/expect.dart';
+
+// Note, this is a regression test for:
+// https://github.com/dart-lang/sdk/issues/29252
+class Foo {
+ Future? _x;
+ int z = -1;
+ List list = [];
+
+ Future foo() async {
+ _x ??= new Future(() async {
+ z = await new Future.value(42);
+ list = list.toList()..add(z);
+ });
+ await _x;
+ return list[0];
+ }
+}
+
+main() async {
+ var f = new Foo();
+ var result = await f.foo();
+ Expect.equals(42, result);
+}
diff --git a/tests/language/async/congruence_local_runtime_test.dart b/tests/language/async/congruence_local_runtime_test.dart
new file mode 100644
index 0000000..ee37f90
--- /dev/null
+++ b/tests/language/async/congruence_local_runtime_test.dart
@@ -0,0 +1,121 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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.
+
+// This test verifies that for a local async function, the following three
+// types are all appropriately matched:
+// - The static return type
+// - The return type of reified runtime type of a tearoff of the function or
+// method
+// - The reified type of the future returned by the function or method
+//
+// Specific attention is paid to the following conditions:
+// - The static return type is determined by type inference
+// - The static return type is `dynamic`
+// - The function or method immediately returns a value or future with a
+// different type (possibly using `=>` syntax)
+
+import 'dart:async';
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class B extends A {}
+
+Future quick() async {}
+
+Future<B> futureB() => new Future<B>.value(new B());
+
+void checkDynamic(dynamic tearoff) {
+ Expect.isTrue(tearoff is dynamic Function());
+ Expect.isFalse(tearoff is Future<dynamic> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<dynamic>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureObject(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<Object> Function());
+ Expect.isFalse(tearoff is Future<A> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<Object>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureA(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<A> Function());
+ Expect.isFalse(tearoff is Future<B> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<A>);
+ Expect.isFalse(f is Future<B>);
+}
+
+main() {
+ f_inferred_futureObject() async {
+ await quick();
+ if (false) {
+ return 0;
+ } else {
+ return new A();
+ }
+ }
+
+ f_inferred_A() async {
+ await quick();
+ if (false) {
+ return new A();
+ } else {
+ return new B();
+ }
+ }
+
+ dynamic f_dynamic() async {
+ await quick();
+ return new B();
+ }
+
+ Future<A> f_A() async {
+ await quick();
+ return new B();
+ }
+
+ Future<A> f_immediateReturn_B() async {
+ return new B();
+ }
+
+ Future<A> f_immediateReturn_FutureB() async {
+ return futureB();
+ }
+
+ Future<A> f_expressionSyntax_B() async => new B();
+
+ Future<A> f_expressionSyntax_FutureB() async => futureB();
+
+ // Not executed
+ void checkStaticTypes() {
+ // Check that f_inferred_futureObject's static return type is
+ // `Future<Object>`, by verifying that its return value can be assigned to
+ // `Future<Object>` but not `Future<int>`.
+ Future<Object> v1 = f_inferred_futureObject();
+
+
+ // Check that f_inferred_A's static return type is `Future<A>`, by verifying
+ // that its return value can be assigned to `Future<A>` but not
+ // `Future<B>`.
+ Future<A> v3 = f_inferred_A();
+
+ }
+
+ checkFutureObject(f_inferred_futureObject);
+ checkFutureA(f_inferred_A);
+ checkDynamic(f_dynamic);
+ checkFutureA(f_A);
+ checkFutureA(f_immediateReturn_B);
+ checkFutureA(f_immediateReturn_FutureB);
+ checkFutureA(f_expressionSyntax_B);
+ checkFutureA(f_expressionSyntax_FutureB);
+}
diff --git a/tests/language/async/congruence_local_test.dart b/tests/language/async/congruence_local_test.dart
new file mode 100644
index 0000000..6ea20da
--- /dev/null
+++ b/tests/language/async/congruence_local_test.dart
@@ -0,0 +1,126 @@
+// 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.
+
+// This test verifies that for a local async function, the following three
+// types are all appropriately matched:
+// - The static return type
+// - The return type of reified runtime type of a tearoff of the function or
+// method
+// - The reified type of the future returned by the function or method
+//
+// Specific attention is paid to the following conditions:
+// - The static return type is determined by type inference
+// - The static return type is `dynamic`
+// - The function or method immediately returns a value or future with a
+// different type (possibly using `=>` syntax)
+
+import 'dart:async';
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class B extends A {}
+
+Future quick() async {}
+
+Future<B> futureB() => new Future<B>.value(new B());
+
+void checkDynamic(dynamic tearoff) {
+ Expect.isTrue(tearoff is dynamic Function());
+ Expect.isFalse(tearoff is Future<dynamic> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<dynamic>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureObject(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<Object> Function());
+ Expect.isFalse(tearoff is Future<A> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<Object>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureA(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<A> Function());
+ Expect.isFalse(tearoff is Future<B> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<A>);
+ Expect.isFalse(f is Future<B>);
+}
+
+main() {
+ f_inferred_futureObject() async {
+ await quick();
+ if (false) {
+ return 0;
+ } else {
+ return new A();
+ }
+ }
+
+ f_inferred_A() async {
+ await quick();
+ if (false) {
+ return new A();
+ } else {
+ return new B();
+ }
+ }
+
+ dynamic f_dynamic() async {
+ await quick();
+ return new B();
+ }
+
+ Future<A> f_A() async {
+ await quick();
+ return new B();
+ }
+
+ Future<A> f_immediateReturn_B() async {
+ return new B();
+ }
+
+ Future<A> f_immediateReturn_FutureB() async {
+ return futureB();
+ }
+
+ Future<A> f_expressionSyntax_B() async => new B();
+
+ Future<A> f_expressionSyntax_FutureB() async => futureB();
+
+ // Not executed
+ void checkStaticTypes() {
+ // Check that f_inferred_futureObject's static return type is
+ // `Future<Object>`, by verifying that its return value can be assigned to
+ // `Future<Object>` but not `Future<int>`.
+ Future<Object> v1 = f_inferred_futureObject();
+ Future<int> v2 = f_inferred_futureObject();
+ // ^^^^^^^^^^^^^^^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] A value of type 'Future<Object>' can't be assigned to a variable of type 'Future<int>'.
+
+ // Check that f_inferred_A's static return type is `Future<A>`, by verifying
+ // that its return value can be assigned to `Future<A>` but not
+ // `Future<B>`.
+ Future<A> v3 = f_inferred_A();
+ Future<B> v4 = f_inferred_A();
+ // ^^^^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] A value of type 'Future<A>' can't be assigned to a variable of type 'Future<B>'.
+ }
+
+ checkFutureObject(f_inferred_futureObject);
+ checkFutureA(f_inferred_A);
+ checkDynamic(f_dynamic);
+ checkFutureA(f_A);
+ checkFutureA(f_immediateReturn_B);
+ checkFutureA(f_immediateReturn_FutureB);
+ checkFutureA(f_expressionSyntax_B);
+ checkFutureA(f_expressionSyntax_FutureB);
+}
diff --git a/tests/language/async/congruence_method_runtime_test.dart b/tests/language/async/congruence_method_runtime_test.dart
new file mode 100644
index 0000000..04bc6de
--- /dev/null
+++ b/tests/language/async/congruence_method_runtime_test.dart
@@ -0,0 +1,114 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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.
+
+// This test verifies that for an async method, the following three
+// types are all appropriately matched:
+// - The static return type
+// - The return type of reified runtime type of a tearoff of the function or
+// method
+// - The reified type of the future returned by the function or method
+//
+// Specific attention is paid to the following conditions:
+// - The static return type is determined by type inference
+// - The static return type is `dynamic`
+// - The function or method immediately returns a value or future with a
+// different type (possibly using `=>` syntax)
+
+import 'dart:async';
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class B extends A {}
+
+Future quick() async {}
+
+Future<B> futureB() => new Future<B>.value(new B());
+
+abstract class I {
+ dynamic f_inferred_dynamic();
+ Future<A> f_inferred_A();
+}
+
+class C implements I {
+ f_inferred_dynamic() async {
+ await quick();
+ return new B();
+ }
+
+ f_inferred_A() async {
+ await quick();
+ return new B();
+ }
+
+ dynamic f_dynamic() async {
+ await quick();
+ return new B();
+ }
+
+ Future<A> f_A() async {
+ await quick();
+ return new B();
+ }
+
+ Future<A> f_immediateReturn_B() async {
+ return new B();
+ }
+
+ Future<A> f_immediateReturn_FutureB() async {
+ return futureB();
+ }
+
+ Future<A> f_expressionSyntax_B() async => new B();
+
+ Future<A> f_expressionSyntax_FutureB() async => futureB();
+}
+
+// Not executed
+void checkStaticTypes(C c) {
+ // Check that f_inferred_dynamic's static return type is `dynamic`, by
+ // verifying that no error occurs if we try to call `foo` on its return value.
+ c.f_inferred_dynamic().foo();
+
+ // Check that f_inferred_A's static return type is `Future<A>`, by verifying
+ // that its return value can be assigned to `Future<A>` but not
+ // `Future<B>`.
+ Future<A> v1 = c.f_inferred_A();
+
+}
+
+void checkDynamic(dynamic tearoff) {
+ Expect.isTrue(tearoff is dynamic Function());
+ Expect.isFalse(tearoff is Future<dynamic> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<dynamic>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureA(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<A> Function());
+ Expect.isFalse(tearoff is Future<B> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<A>);
+ Expect.isFalse(f is Future<B>);
+}
+
+void test(C c) {
+ checkDynamic(c.f_inferred_dynamic);
+ checkFutureA(c.f_inferred_A);
+ checkDynamic(c.f_dynamic);
+ checkFutureA(c.f_A);
+ checkFutureA(c.f_immediateReturn_B);
+ checkFutureA(c.f_immediateReturn_FutureB);
+ checkFutureA(c.f_expressionSyntax_B);
+ checkFutureA(c.f_expressionSyntax_FutureB);
+}
+
+main() {
+ test(new C());
+}
diff --git a/tests/language/async/congruence_method_test.dart b/tests/language/async/congruence_method_test.dart
new file mode 100644
index 0000000..5732013
--- /dev/null
+++ b/tests/language/async/congruence_method_test.dart
@@ -0,0 +1,115 @@
+// 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.
+
+// This test verifies that for an async method, the following three
+// types are all appropriately matched:
+// - The static return type
+// - The return type of reified runtime type of a tearoff of the function or
+// method
+// - The reified type of the future returned by the function or method
+//
+// Specific attention is paid to the following conditions:
+// - The static return type is determined by type inference
+// - The static return type is `dynamic`
+// - The function or method immediately returns a value or future with a
+// different type (possibly using `=>` syntax)
+
+import 'dart:async';
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class B extends A {}
+
+Future quick() async {}
+
+Future<B> futureB() => new Future<B>.value(new B());
+
+abstract class I {
+ dynamic f_inferred_dynamic();
+ Future<A> f_inferred_A();
+}
+
+class C implements I {
+ f_inferred_dynamic() async {
+ await quick();
+ return new B();
+ }
+
+ f_inferred_A() async {
+ await quick();
+ return new B();
+ }
+
+ dynamic f_dynamic() async {
+ await quick();
+ return new B();
+ }
+
+ Future<A> f_A() async {
+ await quick();
+ return new B();
+ }
+
+ Future<A> f_immediateReturn_B() async {
+ return new B();
+ }
+
+ Future<A> f_immediateReturn_FutureB() async {
+ return futureB();
+ }
+
+ Future<A> f_expressionSyntax_B() async => new B();
+
+ Future<A> f_expressionSyntax_FutureB() async => futureB();
+}
+
+// Not executed
+void checkStaticTypes(C c) {
+ // Check that f_inferred_dynamic's static return type is `dynamic`, by
+ // verifying that no error occurs if we try to call `foo` on its return value.
+ c.f_inferred_dynamic().foo();
+
+ // Check that f_inferred_A's static return type is `Future<A>`, by verifying
+ // that its return value can be assigned to `Future<A>` but not
+ // `Future<B>`.
+ Future<A> v1 = c.f_inferred_A();
+ Future<B> v2 = c.f_inferred_A();
+ // ^^^^^^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] A value of type 'Future<A>' can't be assigned to a variable of type 'Future<B>'.
+}
+
+void checkDynamic(dynamic tearoff) {
+ Expect.isTrue(tearoff is dynamic Function());
+ Expect.isFalse(tearoff is Future<dynamic> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<dynamic>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureA(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<A> Function());
+ Expect.isFalse(tearoff is Future<B> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<A>);
+ Expect.isFalse(f is Future<B>);
+}
+
+void test(C c) {
+ checkDynamic(c.f_inferred_dynamic);
+ checkFutureA(c.f_inferred_A);
+ checkDynamic(c.f_dynamic);
+ checkFutureA(c.f_A);
+ checkFutureA(c.f_immediateReturn_B);
+ checkFutureA(c.f_immediateReturn_FutureB);
+ checkFutureA(c.f_expressionSyntax_B);
+ checkFutureA(c.f_expressionSyntax_FutureB);
+}
+
+main() {
+ test(new C());
+}
diff --git a/tests/language/async/congruence_top_level_test.dart b/tests/language/async/congruence_top_level_test.dart
new file mode 100644
index 0000000..20b7b54
--- /dev/null
+++ b/tests/language/async/congruence_top_level_test.dart
@@ -0,0 +1,88 @@
+// 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.
+
+// This test verifies that for a top level async function, the following three
+// types are all appropriately matched:
+// - The static return type
+// - The return type of reified runtime type of a tearoff of the function or
+// method
+// - The reified type of the future returned by the function or method
+//
+// Specific attention is paid to the following conditions:
+// - The static return type is determined by type inference
+// - The static return type is `dynamic`
+// - The function or method immediately returns a value or future with a
+// different type (possibly using `=>` syntax)
+
+import 'dart:async';
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class B extends A {}
+
+Future quick() async {}
+
+Future<B> futureB() => new Future<B>.value(new B());
+
+f_inferred() async {
+ await quick();
+ return new B();
+}
+
+dynamic f_dynamic() async {
+ await quick();
+ return new B();
+}
+
+Future<A> f_A() async {
+ await quick();
+ return new B();
+}
+
+Future<A> f_immediateReturn_B() async {
+ return new B();
+}
+
+Future<A> f_immediateReturn_FutureB() async {
+ return futureB();
+}
+
+Future<A> f_expressionSyntax_B() async => new B();
+
+Future<A> f_expressionSyntax_FutureB() async => futureB();
+
+// Not executed
+void checkStaticTypes() {
+ // Check that f_inferred's static return type is `dynamic`, by verifying that
+ // no error occurs if we try to call `foo` on its return value.
+ f_inferred().foo();
+}
+
+void checkDynamic(dynamic tearoff) {
+ Expect.isTrue(tearoff is dynamic Function());
+ Expect.isFalse(tearoff is Future<dynamic> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<dynamic>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureA(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<A> Function());
+ Expect.isFalse(tearoff is Future<B> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<A>);
+ Expect.isFalse(f is Future<B>);
+}
+
+main() {
+ checkDynamic(f_inferred);
+ checkDynamic(f_dynamic);
+ checkFutureA(f_A);
+ checkFutureA(f_immediateReturn_B);
+ checkFutureA(f_immediateReturn_FutureB);
+ checkFutureA(f_expressionSyntax_B);
+ checkFutureA(f_expressionSyntax_FutureB);
+}
diff --git a/tests/language/async/congruence_unnamed_runtime_test.dart b/tests/language/async/congruence_unnamed_runtime_test.dart
new file mode 100644
index 0000000..905b449
--- /dev/null
+++ b/tests/language/async/congruence_unnamed_runtime_test.dart
@@ -0,0 +1,141 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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.
+
+// This test verifies that for an unnamed async closure, the following three
+// types are all appropriately matched:
+// - The static return type
+// - The return type of reified runtime type of a tearoff of the function or
+// method
+// - The reified type of the future returned by the function or method
+//
+// Specific attention is paid to the following conditions:
+// - The static return type is determined by type inference
+// - The static return type is `dynamic`
+// - The function or method immediately returns a value or future with a
+// different type (possibly using `=>` syntax)
+
+import 'dart:async';
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class B extends A {}
+
+Future quick() async {}
+
+Future<A> futureA() => new Future<A>.value(new A());
+
+Future<B> futureB() => new Future<B>.value(new B());
+
+void checkFutureObject(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<Object> Function());
+ Expect.isFalse(tearoff is Future<A> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<Object>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureDynamic(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<dynamic> Function());
+ Expect.isFalse(tearoff is Future<A> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<dynamic>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureA(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<A> Function());
+ Expect.isFalse(tearoff is Future<B> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<A>);
+ Expect.isFalse(f is Future<B>);
+}
+
+main() {
+ var f_inferred_futureObject = () async {
+ await quick();
+ if (false) {
+ return 0;
+ } else {
+ return new A();
+ }
+ };
+
+ var f_inferred_A = () async {
+ await quick();
+ if (false) {
+ return new A();
+ } else {
+ return new B();
+ }
+ };
+
+ Future<dynamic> Function() f_futureDynamic = () async {
+ await quick();
+ if (false) {
+ return 0;
+ } else {
+ return new B();
+ }
+ };
+
+ Future<A> Function() f_A = () async {
+ await quick();
+ if (false) {
+ return new A();
+ } else {
+ return new B();
+ }
+ };
+
+ Future<A> Function() f_immediateReturn_B = () async {
+ if (false) {
+ return new A();
+ } else {
+ return new B();
+ }
+ };
+
+ Future<A> Function() f_immediateReturn_FutureB = () async {
+ if (false) {
+ return new A();
+ } else {
+ return futureB();
+ }
+ };
+
+ Future<A> Function() f_expressionSyntax_B =
+ () async => false ? new A() : new B();
+
+ Future<A> Function() f_expressionSyntax_FutureB =
+ () async => false ? futureA() : futureB();
+
+ // Not executed
+ void checkStaticTypes() {
+ // Check that f_inferred_futureObject's static return type is
+ // `Future<Object>`, by verifying that its return value can be assigned to
+ // `Future<Object>` but not `Future<int>`.
+ Future<Object> v1 = f_inferred_futureObject();
+
+
+ // Check that f_inferred_A's static return type is `Future<A>`, by verifying
+ // that its return value can be assigned to `Future<A>` but not
+ // `Future<B>`.
+ Future<A> v3 = f_inferred_A();
+
+ }
+
+ checkFutureObject(f_inferred_futureObject);
+ checkFutureA(f_inferred_A);
+ checkFutureDynamic(f_futureDynamic);
+ checkFutureA(f_A);
+ checkFutureA(f_immediateReturn_B);
+ checkFutureA(f_immediateReturn_FutureB);
+ checkFutureA(f_expressionSyntax_B);
+ checkFutureA(f_expressionSyntax_FutureB);
+}
diff --git a/tests/language/async/congruence_unnamed_test.dart b/tests/language/async/congruence_unnamed_test.dart
new file mode 100644
index 0000000..274588b
--- /dev/null
+++ b/tests/language/async/congruence_unnamed_test.dart
@@ -0,0 +1,146 @@
+// 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.
+
+// This test verifies that for an unnamed async closure, the following three
+// types are all appropriately matched:
+// - The static return type
+// - The return type of reified runtime type of a tearoff of the function or
+// method
+// - The reified type of the future returned by the function or method
+//
+// Specific attention is paid to the following conditions:
+// - The static return type is determined by type inference
+// - The static return type is `dynamic`
+// - The function or method immediately returns a value or future with a
+// different type (possibly using `=>` syntax)
+
+import 'dart:async';
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class B extends A {}
+
+Future quick() async {}
+
+Future<A> futureA() => new Future<A>.value(new A());
+
+Future<B> futureB() => new Future<B>.value(new B());
+
+void checkFutureObject(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<Object> Function());
+ Expect.isFalse(tearoff is Future<A> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<Object>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureDynamic(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<dynamic> Function());
+ Expect.isFalse(tearoff is Future<A> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<dynamic>);
+ Expect.isFalse(f is Future<A>);
+}
+
+void checkFutureA(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<A> Function());
+ Expect.isFalse(tearoff is Future<B> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<A>);
+ Expect.isFalse(f is Future<B>);
+}
+
+main() {
+ var f_inferred_futureObject = () async {
+ await quick();
+ if (false) {
+ return 0;
+ } else {
+ return new A();
+ }
+ };
+
+ var f_inferred_A = () async {
+ await quick();
+ if (false) {
+ return new A();
+ } else {
+ return new B();
+ }
+ };
+
+ Future<dynamic> Function() f_futureDynamic = () async {
+ await quick();
+ if (false) {
+ return 0;
+ } else {
+ return new B();
+ }
+ };
+
+ Future<A> Function() f_A = () async {
+ await quick();
+ if (false) {
+ return new A();
+ } else {
+ return new B();
+ }
+ };
+
+ Future<A> Function() f_immediateReturn_B = () async {
+ if (false) {
+ return new A();
+ } else {
+ return new B();
+ }
+ };
+
+ Future<A> Function() f_immediateReturn_FutureB = () async {
+ if (false) {
+ return new A();
+ } else {
+ return futureB();
+ }
+ };
+
+ Future<A> Function() f_expressionSyntax_B =
+ () async => false ? new A() : new B();
+
+ Future<A> Function() f_expressionSyntax_FutureB =
+ () async => false ? futureA() : futureB();
+
+ // Not executed
+ void checkStaticTypes() {
+ // Check that f_inferred_futureObject's static return type is
+ // `Future<Object>`, by verifying that its return value can be assigned to
+ // `Future<Object>` but not `Future<int>`.
+ Future<Object> v1 = f_inferred_futureObject();
+ Future<int> v2 = f_inferred_futureObject();
+ // ^^^^^^^^^^^^^^^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] A value of type 'Future<Object>' can't be assigned to a variable of type 'Future<int>'.
+
+ // Check that f_inferred_A's static return type is `Future<A>`, by verifying
+ // that its return value can be assigned to `Future<A>` but not
+ // `Future<B>`.
+ Future<A> v3 = f_inferred_A();
+ Future<B> v4 = f_inferred_A();
+ // ^^^^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+ // ^
+ // [cfe] A value of type 'Future<A>' can't be assigned to a variable of type 'Future<B>'.
+ }
+
+ checkFutureObject(f_inferred_futureObject);
+ checkFutureA(f_inferred_A);
+ checkFutureDynamic(f_futureDynamic);
+ checkFutureA(f_A);
+ checkFutureA(f_immediateReturn_B);
+ checkFutureA(f_immediateReturn_FutureB);
+ checkFutureA(f_expressionSyntax_B);
+ checkFutureA(f_expressionSyntax_FutureB);
+}
diff --git a/tests/language/async/continue_label_test.dart b/tests/language/async/continue_label_test.dart
new file mode 100644
index 0000000..c33fa53
--- /dev/null
+++ b/tests/language/async/continue_label_test.dart
@@ -0,0 +1,116 @@
+// 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:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+// Two loop variables
+test1() async {
+ var r = 0;
+ label:
+ for (var i = 1,
+ j =
+ await //# await_in_init: ok
+ 10;
+ i < 10 &&
+ j >
+ await //# await_in_condition: ok
+ -5;
+ j--,
+ i +=
+ await //# await_in_update: ok
+ 1) {
+ if (i <
+ await //# await_in_body: ok
+ 5 ||
+ j < -5) {
+ continue label;
+ }
+ r++;
+ }
+ Expect.equals(5, r);
+}
+
+// One loop variable
+test2() async {
+ var r = 0;
+ label:
+ for (var i =
+ await //# await_in_init: ok
+ 0;
+ i <
+ await //# await_in_condition: ok
+ 10;
+ i +=
+ await //# await_in_update: ok
+ 1) {
+ if (i <
+ await //# await_in_body: ok
+ 5) {
+ continue label;
+ }
+ r++;
+ }
+ Expect.equals(5, r);
+}
+
+// Variable not declared in initializer;
+test3() async {
+ var r = 0, i, j;
+ label:
+ for (i =
+ await //# await_in_init: ok
+ 0;
+ i <
+ await //# await_in_condition: ok
+ 10;
+ i +=
+ await //# await_in_update: ok
+ 1) {
+ if (i <
+ await //# await_in_body: ok
+ 5) {
+ continue label;
+ }
+ r++;
+ }
+ Expect.equals(5, r);
+}
+
+// Nested loop
+test4() async {
+ var r = 0;
+ label:
+ for (var i =
+ await //# await_in_init: ok
+ 0;
+ i <
+ await //# await_in_condition: ok
+ 10;
+ i +=
+ await //# await_in_update: ok
+ 1) {
+ if (i <
+ await //# await_in_body: ok
+ 5) {
+ for (int i = 0; i < 10; i++) {
+ continue label;
+ }
+ }
+ r++;
+ }
+ Expect.equals(5, r);
+}
+
+test() async {
+ await test1();
+ await test2();
+ await test3();
+ await test4();
+}
+
+main() {
+ asyncStart();
+ test().then((_) => asyncEnd());
+}
diff --git a/tests/language/async/control_structures_test.dart b/tests/language/async/control_structures_test.dart
new file mode 100644
index 0000000..592ff5a
--- /dev/null
+++ b/tests/language/async/control_structures_test.dart
@@ -0,0 +1,97 @@
+// Copyright (c) 2014, 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.
+
+// VMOptions=--optimization-counter-threshold=10 --no-background-compilation
+
+import 'package:expect/expect.dart';
+
+import 'dart:async';
+
+expectThenValue(future, value) {
+ Expect.isTrue(future is Future);
+ future.then((result) {
+ Expect.equals(value, result);
+ });
+}
+
+asyncIf(condition) async {
+ if (condition) {
+ return 1;
+ } else {
+ return 2;
+ }
+ // This return is never reached as the finally block returns from the
+ // function.
+ return 3;
+}
+
+asyncFor(condition) async {
+ for (int i = 0; i < 10; i++) {
+ if (i == 5 && condition) {
+ return 1;
+ }
+ }
+ return 2;
+}
+
+asyncTryCatchFinally(overrideInFinally, doThrow) async {
+ try {
+ if (doThrow) throw 444;
+ return 1;
+ } catch (e) {
+ return e;
+ } finally {
+ if (overrideInFinally) return 3;
+ }
+}
+
+asyncTryCatchLoop() async {
+ var i = 0;
+ var throws = 13;
+ while (true) {
+ try {
+ throw throws;
+ } catch (e) {
+ if (i == throws) {
+ return e;
+ }
+ } finally {
+ i++;
+ }
+ }
+}
+
+asyncImplicitReturn() async {
+ try {} catch (e) {} finally {}
+}
+
+main() {
+ var asyncReturn;
+
+ for (int i = 0; i < 10; i++) {
+ asyncReturn = asyncIf(true);
+ expectThenValue(asyncReturn, 1);
+ asyncReturn = asyncIf(false);
+ expectThenValue(asyncReturn, 2);
+
+ asyncReturn = asyncFor(true);
+ expectThenValue(asyncReturn, 1);
+ asyncReturn = asyncFor(false);
+ expectThenValue(asyncReturn, 2);
+
+ asyncReturn = asyncTryCatchFinally(true, false);
+ expectThenValue(asyncReturn, 3);
+ asyncReturn = asyncTryCatchFinally(false, false);
+ expectThenValue(asyncReturn, 1);
+ asyncReturn = asyncTryCatchFinally(true, true);
+ expectThenValue(asyncReturn, 3);
+ asyncReturn = asyncTryCatchFinally(false, true);
+ expectThenValue(asyncReturn, 444);
+ asyncReturn = asyncTryCatchLoop();
+ expectThenValue(asyncReturn, 13);
+
+ asyncReturn = asyncImplicitReturn();
+ expectThenValue(asyncReturn, null);
+ }
+}
diff --git a/tests/language/async/covariant_type_test.dart b/tests/language/async/covariant_type_test.dart
new file mode 100644
index 0000000..c619673
--- /dev/null
+++ b/tests/language/async/covariant_type_test.dart
@@ -0,0 +1,20 @@
+// 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 that TypeErrors happen for async methods without using returned Future.
+
+import 'dart:async';
+import 'package:expect/expect.dart';
+
+class D<T> {
+ // Parametric covariance check is usually compiled into method.
+ Future<T> add(T n) async {
+ return n;
+ }
+}
+
+main() async {
+ D<num> d = new D<int>();
+ Expect.throwsTypeError(() => d.add(4.6));
+}
diff --git a/tests/language/async/dcall_type_test.dart b/tests/language/async/dcall_type_test.dart
new file mode 100644
index 0000000..b3ffbe6
--- /dev/null
+++ b/tests/language/async/dcall_type_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 that TypeErrors happen for async methods without using returned Future.
+
+import 'dart:async';
+import 'package:expect/expect.dart';
+
+Future<int> iota(int n) async {
+ await null;
+ return n;
+}
+
+class C {
+ Future<int> add(int n) async {
+ await null;
+ return n;
+ }
+}
+
+main() async {
+ dynamic f = iota;
+ Expect.throwsTypeError(() => f('ten'));
+ Expect.throwsTypeError(() => f(4.7));
+
+ dynamic o = new C();
+ Expect.throwsTypeError(() => o.add('ten'));
+ Expect.throwsTypeError(() => o.add(4.7));
+}
diff --git a/tests/language/async/error_timing_test.dart b/tests/language/async/error_timing_test.dart
new file mode 100644
index 0000000..5014233
--- /dev/null
+++ b/tests/language/async/error_timing_test.dart
@@ -0,0 +1,254 @@
+// 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 'dart:async';
+import 'package:expect/expect.dart';
+import 'package:async_helper/async_helper.dart';
+
+class AsyncTracker {
+ int runningAsyncs = 0;
+ List expectedEvents;
+ final List actualEvents = [];
+
+ AsyncTracker(this.expectedEvents) {
+ asyncStart();
+ }
+
+ void start(String event) {
+ actualEvents.add("start $event");
+ runningAsyncs++;
+ }
+
+ void stop(String event) {
+ actualEvents.add("stop $event");
+ if (--runningAsyncs == 0) {
+ Expect.listEquals(expectedEvents, actualEvents);
+ asyncEnd();
+ }
+ }
+
+ void add(e) {
+ actualEvents.add(e);
+ }
+}
+
+void test1() {
+ var tracker = new AsyncTracker([
+ "start micro1",
+ "start foo",
+ "error-foo",
+ "start micro3",
+ "start micro2",
+ "stop micro1",
+ "stop foo",
+ "stop micro3",
+ "stop micro2",
+ ]);
+
+ Future foo() async {
+ tracker.add("error-foo");
+ throw "foo";
+ }
+
+ tracker.start("micro1");
+ scheduleMicrotask(() {
+ tracker.start("micro2");
+ scheduleMicrotask(() {
+ tracker.stop("micro2");
+ });
+ tracker.stop("micro1");
+ });
+
+ tracker.start("foo");
+ foo().catchError((e) {
+ tracker.stop("foo");
+ });
+ tracker.start("micro3");
+ scheduleMicrotask(() {
+ tracker.stop("micro3");
+ });
+}
+
+void test2() {
+ var tracker = new AsyncTracker([
+ "start micro1",
+ "start bar",
+ "await null",
+ "start micro4",
+ "start micro2",
+ "stop micro1",
+ "error-bar",
+ "stop bar",
+ "start micro5",
+ "stop micro4",
+ "start micro3",
+ "stop micro2",
+ "stop micro5",
+ "stop micro3",
+ ]);
+
+ Future bar() async {
+ tracker.add("await null");
+ await null;
+ tracker.add("error-bar");
+ throw "bar";
+ }
+
+ tracker.start("micro1");
+ scheduleMicrotask(() {
+ tracker.start("micro2");
+ scheduleMicrotask(() {
+ tracker.start("micro3");
+ scheduleMicrotask(() {
+ tracker.stop("micro3");
+ });
+ tracker.stop("micro2");
+ });
+ tracker.stop("micro1");
+ });
+
+ tracker.start("bar");
+ bar().catchError((e) {
+ tracker.stop("bar");
+ });
+ tracker.start("micro4");
+ scheduleMicrotask(() {
+ tracker.start("micro5");
+ scheduleMicrotask(() {
+ tracker.stop("micro5");
+ });
+ tracker.stop("micro4");
+ });
+}
+
+void test3() {
+ var tracker = new AsyncTracker([
+ "start micro1",
+ "start gee",
+ "error-gee",
+ "start micro3",
+ "start micro2",
+ "stop micro1",
+ "stop gee",
+ "stop micro3",
+ "stop micro2",
+ ]);
+
+ Future gee() async {
+ tracker.add("error-gee");
+ return new Future.error("gee");
+ }
+
+ tracker.start("micro1");
+ scheduleMicrotask(() {
+ tracker.start("micro2");
+ scheduleMicrotask(() {
+ tracker.stop("micro2");
+ });
+ tracker.stop("micro1");
+ });
+
+ tracker.start("gee");
+ gee().catchError((e) {
+ tracker.stop("gee");
+ });
+ tracker.start("micro3");
+ scheduleMicrotask(() {
+ tracker.stop("micro3");
+ });
+}
+
+void test4() {
+ var tracker = new AsyncTracker([
+ "start micro1",
+ "start toto",
+ "await null",
+ "start micro4",
+ "start micro2",
+ "stop micro1",
+ "error-toto",
+ "start micro5",
+ "stop micro4",
+ "start micro3",
+ "stop micro2",
+ "stop toto",
+ "stop micro5",
+ "stop micro3",
+ ]);
+
+ Future toto() async {
+ tracker.add("await null");
+ await null;
+ tracker.add("error-toto");
+ return new Future.error("toto");
+ }
+
+ tracker.start("micro1");
+ scheduleMicrotask(() {
+ tracker.start("micro2");
+ scheduleMicrotask(() {
+ tracker.start("micro3");
+ scheduleMicrotask(() {
+ tracker.stop("micro3");
+ });
+ tracker.stop("micro2");
+ });
+ tracker.stop("micro1");
+ });
+
+ tracker.start("toto");
+ toto().catchError((e) {
+ tracker.stop("toto");
+ });
+ tracker.start("micro4");
+ scheduleMicrotask(() {
+ tracker.start("micro5");
+ scheduleMicrotask(() {
+ tracker.stop("micro5");
+ });
+ tracker.stop("micro4");
+ });
+}
+
+void test5() {
+ var tracker = new AsyncTracker([
+ "start bar",
+ "start micro",
+ "start foo",
+ "throw",
+ "stop micro",
+ "stop foo",
+ "stop bar",
+ ]);
+
+ Future foo() async {
+ tracker.add("throw");
+ throw "foo";
+ }
+
+ bar() async {
+ tracker.start('micro');
+ scheduleMicrotask(() {
+ tracker.stop('micro');
+ });
+ try {
+ tracker.start('foo');
+ await foo();
+ } catch (e) {
+ tracker.stop('foo');
+ }
+ tracker.stop("bar");
+ }
+
+ tracker.start('bar');
+}
+
+main() {
+ asyncStart();
+ test1();
+ test2();
+ test3();
+ test4();
+ asyncEnd();
+}
diff --git a/tests/language/async/finally_rethrow_test.dart b/tests/language/async/finally_rethrow_test.dart
new file mode 100644
index 0000000..50b1cb3
--- /dev/null
+++ b/tests/language/async/finally_rethrow_test.dart
@@ -0,0 +1,28 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+
+foo() async {
+ try {
+ await 1;
+ throw "error";
+ } on String catch (e) {
+ await 2;
+ throw e;
+ } finally {
+ await 3;
+ }
+}
+
+main() async {
+ var error = "no error";
+ try {
+ await foo();
+ } catch (e) {
+ error = e;
+ }
+ Expect.equals("error", error);
+}
diff --git a/tests/language/async/helper_lib.dart b/tests/language/async/helper_lib.dart
new file mode 100644
index 0000000..e91efac
--- /dev/null
+++ b/tests/language/async/helper_lib.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2014, 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 async;
+
+class async {}
diff --git a/tests/language/async/identifier_test.dart b/tests/language/async/identifier_test.dart
new file mode 100644
index 0000000..dec9c55
--- /dev/null
+++ b/tests/language/async/identifier_test.dart
@@ -0,0 +1,211 @@
+// Copyright (c) 2019, 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:async' as async;
+import 'lib.dart' as l; // Minimal library containing "int async;".
+
+// Adapted from Analyzer test testing where `async` was not previously allowed.
+
+// Helpers
+void ignore(argument) {}
+
+class GNamed {
+ void g({Object? async = null}) {}
+}
+
+class AGet {
+ int get async => 1;
+ set async(int i) {}
+}
+
+class ACall {
+ int async() => 1;
+}
+
+main() {
+ // Each test declares a spearate async function, tests that `async`
+ // can occur in it, and makes sure the function is run.
+ {
+ const int async = 0;
+ f() async {
+ g(@async x) {}
+ g(0);
+ }
+
+ f();
+ }
+ {
+ f(c) async {
+ c.g(async: 0);
+ }
+
+ f(GNamed());
+ }
+ {
+ f() async {
+ var async = 1;
+ ignore(async);
+ }
+
+ f();
+ }
+ {
+ f() async* {
+ var async = 1;
+ ignore(async);
+ }
+
+ f().forEach(ignore);
+ }
+ {
+ f() async {
+ async:
+ while (true) {
+ break async;
+ }
+ }
+
+ f();
+ }
+ {
+ g() {}
+ f() async {
+ try {
+ g();
+ } catch (async) {}
+ }
+
+ f();
+ }
+ {
+ g() {}
+ f() async {
+ try {
+ g();
+ } catch (e, async) {}
+ }
+
+ f();
+ }
+ {
+ f() async {
+ async:
+ while (true) {
+ if (false) continue async;
+ break;
+ }
+ }
+
+ f();
+ }
+ {
+ var async;
+ f() async {
+ for (async in []) {}
+ }
+
+ f();
+ }
+ {
+ f() async {
+ g(int async) {}
+ g(0);
+ }
+
+ f();
+ }
+ {
+ f() async {
+ return new AGet().async;
+ }
+
+ f();
+ }
+ {
+ f() async {
+ return new ACall().async();
+ }
+
+ f();
+ }
+ {
+ f() async {
+ return new ACall()..async();
+ }
+
+ f();
+ }
+ {
+ g() {}
+ f() async {
+ async:
+ g();
+ }
+
+ f();
+ }
+ {
+ f() async {
+ int async() => 0;
+ async();
+ }
+
+ f();
+ }
+ {
+ f() async {
+ return async.Future.value(0);
+ }
+
+ f();
+ }
+ {
+ f() async {
+ new AGet().async = 1;
+ }
+
+ f();
+ }
+ {
+ f() async {
+ return new AGet()..async = 1;
+ }
+
+ f();
+ }
+ {
+ int async = 1;
+ f() async {
+ return "$async";
+ }
+
+ f();
+ }
+ {
+ f() async {
+ return l.async;
+ }
+
+ f();
+ }
+ {
+ f() async {
+ switch (0) {
+ async:
+ case 0:
+ break;
+ }
+ }
+
+ f();
+ }
+ {
+ f() sync* {
+ var async = 1;
+ ignore(async);
+ }
+
+ f();
+ }
+}
diff --git a/tests/language/async/lib.dart b/tests/language/async/lib.dart
new file mode 100644
index 0000000..3b052cd
--- /dev/null
+++ b/tests/language/async/lib.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2019, 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 library for async_identifier_test.dart
+
+int async = -1;
diff --git a/tests/language/async/or_generator_return_type_stacktrace_runtime_test.dart b/tests/language/async/or_generator_return_type_stacktrace_runtime_test.dart
new file mode 100644
index 0000000..e41973a
--- /dev/null
+++ b/tests/language/async/or_generator_return_type_stacktrace_runtime_test.dart
@@ -0,0 +1,14 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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:expect/expect.dart";
+
+
+
+
+
+void main() {}
diff --git a/tests/language/async/or_generator_return_type_stacktrace_test.dart b/tests/language/async/or_generator_return_type_stacktrace_test.dart
new file mode 100644
index 0000000..39fdb56
--- /dev/null
+++ b/tests/language/async/or_generator_return_type_stacktrace_test.dart
@@ -0,0 +1,23 @@
+// 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:expect/expect.dart";
+
+int badReturnTypeAsync() async {}
+// [error line 7, column 1, length 3]
+// [analyzer] STATIC_TYPE_WARNING.ILLEGAL_ASYNC_RETURN_TYPE
+// ^
+// [cfe] Functions marked 'async' must have a return type assignable to 'Future'.
+int badReturnTypeAsyncStar() async* {}
+// [error line 12, column 1, length 3]
+// [analyzer] STATIC_TYPE_WARNING.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE
+// ^
+// [cfe] Functions marked 'async*' must have a return type assignable to 'Stream'.
+int badReturnTypeSyncStar() sync* {}
+// [error line 17, column 1, length 3]
+// [analyzer] STATIC_TYPE_WARNING.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE
+// ^
+// [cfe] Functions marked 'sync*' must have a return type assignable to 'Iterable'.
+
+void main() {}
diff --git a/tests/language/async/regression_23058_test.dart b/tests/language/async/regression_23058_test.dart
new file mode 100644
index 0000000..088dac6
--- /dev/null
+++ b/tests/language/async/regression_23058_test.dart
@@ -0,0 +1,36 @@
+// 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.
+
+// Regression test for issue 23058.
+
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+class A {
+ var x = new B();
+
+ foo() async {
+ return x.foo == 2 ? 42 : x.foo;
+ }
+}
+
+class B {
+ var x = 0;
+
+ get foo {
+ if (x == -1) {
+ return 0;
+ } else {
+ return x++;
+ }
+ }
+}
+
+main() {
+ asyncStart();
+ new A().foo().then((result) {
+ Expect.equals(1, result);
+ asyncEnd();
+ });
+}
diff --git a/tests/language/async/rethrow_test.dart b/tests/language/async/rethrow_test.dart
new file mode 100644
index 0000000..9ed117c
--- /dev/null
+++ b/tests/language/async/rethrow_test.dart
@@ -0,0 +1,49 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+
+const String exceptionString = "exceptionalString";
+
+throwString() async {
+ try {
+ throw exceptionString;
+ } catch (e) {
+ await 1;
+ throw e;
+ }
+}
+
+rethrowString() async {
+ try {
+ throw exceptionString;
+ } catch (e) {
+ await 1;
+ rethrow;
+ }
+}
+
+testThrow() {
+ Future f = throwString();
+ f.then((v) {
+ Expect.fail("Exception not thrown");
+ }, onError: (e) {
+ Expect.equals(exceptionString, e);
+ });
+}
+
+testRethrow() {
+ Future f = rethrowString();
+ f.then((v) {
+ Expect.fail("Exception not thrown");
+ }, onError: (e) {
+ Expect.equals(exceptionString, e);
+ });
+}
+
+main() {
+ testThrow();
+ testRethrow();
+}
diff --git a/tests/language/async/return_types_runtime_test.dart b/tests/language/async/return_types_runtime_test.dart
new file mode 100644
index 0000000..b8c1de6
--- /dev/null
+++ b/tests/language/async/return_types_runtime_test.dart
@@ -0,0 +1,75 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+Future foo1() async {
+ return 3;
+}
+
+Future<int> foo2() async {
+ return 3;
+}
+
+
+foo3() async {
+ return "String";
+}
+
+
+foo4() async {
+ return "String";
+}
+
+
+foo5() async {
+ return 3;
+}
+
+Future<int> foo6() async {
+ // This is fine, the future is flattened
+ return new Future<int>.value(3);
+}
+
+
+foo7() async {
+ return new Future<int>.value(3);
+}
+
+Iterable<int> foo8() sync* {
+ yield 1;
+ // Can only have valueless return in sync* functions.
+ return
+
+ ;
+}
+
+Stream<int> foo9() async* {
+ yield 1;
+ // Can only have valueless return in async* functions.
+ return
+
+ ;
+}
+
+test() async {
+ Expect.equals(3, await foo1());
+ Expect.equals(3, await foo2());
+ Expect.equals("String", await foo3());
+ Expect.equals("String", await foo4());
+ Expect.equals(3, await foo5());
+ Expect.equals(3, await await foo6());
+ Expect.equals(3, await await foo7());
+ Expect.listEquals([1], foo8().toList());
+ Expect.listEquals([1], await foo9().toList());
+}
+
+main() {
+ asyncTest(test);
+}
diff --git a/tests/language/async/return_types_test.dart b/tests/language/async/return_types_test.dart
new file mode 100644
index 0000000..473150f
--- /dev/null
+++ b/tests/language/async/return_types_test.dart
@@ -0,0 +1,96 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+Future foo1() async {
+ return 3;
+}
+
+Future<int> foo2() async {
+ return 3;
+}
+
+Future<int>
+foo3() async {
+ return "String";
+ // ^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.RETURN_OF_INVALID_TYPE
+ // [cfe] A value of type 'String' can't be assigned to a variable of type 'FutureOr<int>'.
+}
+
+Future<int, String>
+// [error line 25, column 1, length 19]
+// [analyzer] STATIC_TYPE_WARNING.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+// [cfe] Expected 1 type arguments.
+foo4() async {
+// [error line 29, column 1]
+// [cfe] Functions marked 'async' must have a return type assignable to 'Future'.
+ return "String";
+ // ^
+ // [cfe] A value of type 'String' can't be assigned to a variable of type 'FutureOr<invalid-type>'.
+}
+
+int
+// [error line 37, column 1, length 3]
+// [analyzer] STATIC_TYPE_WARNING.ILLEGAL_ASYNC_RETURN_TYPE
+foo5() async {
+// [error line 40, column 1]
+// [cfe] Functions marked 'async' must have a return type assignable to 'Future'.
+ return 3;
+ // ^
+ // [analyzer] STATIC_TYPE_WARNING.RETURN_OF_INVALID_TYPE
+}
+
+Future<int> foo6() async {
+ // This is fine, the future is flattened
+ return new Future<int>.value(3);
+}
+
+Future<Future<int>>
+foo7() async {
+ return new Future<int>.value(3);
+ // ^^^^^^^^^^^^^^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.RETURN_OF_INVALID_TYPE
+}
+
+Iterable<int> foo8() sync* {
+ yield 1;
+ // Can only have valueless return in sync* functions.
+ return 8;
+//^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.RETURN_IN_GENERATOR
+// [cfe] 'sync*' and 'async*' can't return a value.
+//^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.RETURN_IN_GENERATOR
+}
+
+Stream<int> foo9() async* {
+ yield 1;
+ // Can only have valueless return in async* functions.
+ return 8;
+//^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.RETURN_IN_GENERATOR
+// [cfe] 'sync*' and 'async*' can't return a value.
+//^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.RETURN_IN_GENERATOR
+}
+
+test() async {
+ Expect.equals(3, await foo1());
+ Expect.equals(3, await foo2());
+ Expect.equals("String", await foo3());
+ Expect.equals("String", await foo4());
+ Expect.equals(3, await foo5());
+ Expect.equals(3, await await foo6());
+ Expect.equals(3, await await foo7());
+ Expect.listEquals([1], foo8().toList());
+ Expect.listEquals([1], await foo9().toList());
+}
+
+main() {
+ asyncTest(test);
+}
diff --git a/tests/language/async/switch_test.dart b/tests/language/async/switch_test.dart
new file mode 100644
index 0000000..6f12c2a
--- /dev/null
+++ b/tests/language/async/switch_test.dart
@@ -0,0 +1,91 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+foo1(int a) async {
+ int k = 0;
+ switch (a) {
+ case 1:
+ await 3;
+ k += 1;
+ break;
+ case 2:
+ k += a;
+ return k + 2;
+ default: k = 2; //# withDefault: ok
+ }
+ return k;
+}
+
+foo2(Future<int> a) async {
+ int k = 0;
+ switch (await a) {
+ case 1:
+ await 3;
+ k += 1;
+ break;
+ case 2:
+ k += await a;
+ return k + 2;
+ default: k = 2; //# withDefault: ok
+ }
+ return k;
+}
+
+foo3(int a) async {
+ int k = 0;
+ switch (a) {
+ case 1:
+ k += 1;
+ break;
+ case 2:
+ k += a;
+ return k + 2;
+ default: k = 2; //# withDefault: ok
+ }
+ return k;
+}
+
+foo4(value) async {
+ int k = 0;
+ switch (await value) {
+ case 1:
+ k += 1;
+ break;
+ case 2:
+ k += 2;
+ return 2 + k;
+ default: k = 2; //# withDefault: ok
+ }
+ return k;
+}
+
+Future<int> futureOf(int a) async => await a;
+
+test() async {
+ Expect.equals(1, await foo1(1));
+ Expect.equals(4, await foo1(2));
+ Expect.equals(2, await foo1(3)); //# withDefault: ok
+ Expect.equals(0, await foo1(3)); //# none: ok
+ Expect.equals(1, await foo2(futureOf(1)));
+ Expect.equals(4, await foo2(futureOf(2)));
+ Expect.equals(2, await foo2(futureOf(3))); //# withDefault: ok
+ Expect.equals(0, await foo2(futureOf(3))); //# none: ok
+ Expect.equals(1, await foo3(1));
+ Expect.equals(4, await foo3(2));
+ Expect.equals(2, await foo3(3)); //# withDefault: ok
+ Expect.equals(0, await foo3(3)); //# none: ok
+ Expect.equals(1, await foo4(futureOf(1)));
+ Expect.equals(4, await foo4(futureOf(2)));
+ Expect.equals(2, await foo4(futureOf(3))); //# withDefault: ok
+ Expect.equals(0, await foo4(futureOf(3))); //# none: ok
+}
+
+void main() {
+ asyncStart();
+ test().then((_) => asyncEnd());
+}
diff --git a/tests/language/async/this_bound_test.dart b/tests/language/async/this_bound_test.dart
new file mode 100644
index 0000000..50d31a4
--- /dev/null
+++ b/tests/language/async/this_bound_test.dart
@@ -0,0 +1,59 @@
+// 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:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+class A {
+ int a = -1;
+
+ @pragma('dart2js:noInline')
+ foo(ignored, val) {
+ Expect.equals(val, this.a);
+ }
+}
+
+testA() async {
+ var a = new A();
+ a.foo(await false, -1);
+ a.a = 0;
+ a.foo(await false, 0);
+}
+
+@pragma('dart2js:noInline')
+@pragma('dart2js:assumeDynamic')
+confuse(x) => x;
+
+class B {
+ var f;
+ var b = 10;
+
+ B(this.f);
+
+ bar(x) => b;
+}
+
+foo(x) => 499;
+bar(x) => 42;
+
+change(x) {
+ x.f = (x) => 99;
+}
+
+testB() async {
+ var b = confuse(new B(foo));
+ Expect.equals(99, b.f(await change(b)));
+ var b2 = confuse(new B(bar));
+ Expect.equals(10, b2.f(await (b2.f = b2.bar)));
+}
+
+test() async {
+ await testA();
+ await testB();
+}
+
+void main() {
+ asyncStart();
+ test().then((_) => asyncEnd());
+}
diff --git a/tests/language/async/throw_in_catch_test.dart b/tests/language/async/throw_in_catch_test.dart
new file mode 100644
index 0000000..231f053
--- /dev/null
+++ b/tests/language/async/throw_in_catch_test.dart
@@ -0,0 +1,471 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+class Tracer {
+ final String expected;
+ final String name;
+ int counter = 0;
+
+ Tracer(this.expected, this.name);
+
+ void trace(msg) {
+ Expect.equals(expected[counter], msg);
+ counter++;
+ }
+
+ void done() {
+ Expect.equals(expected.length, counter, "Received too few traces");
+ }
+}
+
+foo1(Tracer tracer) async {
+ try {
+ tracer.trace("a");
+ // This await forces dart2js to rewrite the try into a state machine
+ // instead of relying on the existing structure.
+ await new Future.value(3); //# forceAwait: ok
+ tracer.trace("b");
+ throw "Error";
+ } catch (error) {
+ tracer.trace("c");
+ Expect.equals("Error", error);
+ throw "Error2";
+ tracer.trace("d");
+ } finally {
+ tracer.trace("e");
+ }
+ tracer.trace("f");
+}
+
+foo2(Tracer tracer) async {
+ try {
+ tracer.trace("a");
+ await new Future.value(3); //# forceAwait: continued
+ tracer.trace("b");
+ throw "Error";
+ tracer.trace("c");
+ } catch (error) {
+ tracer.trace("d");
+ Expect.equals("Error", error);
+ await new Future.error("Error2");
+ } finally {
+ tracer.trace("e");
+ }
+ tracer.trace("f");
+}
+
+foo3(Tracer tracer) async {
+ try {
+ tracer.trace("a");
+ await new Future.value(3); //# forceAwait: continued
+ tracer.trace("b");
+ throw "Error";
+ tracer.trace("c");
+ } catch (error) {
+ Expect.equals("Error", error);
+ tracer.trace("d");
+ return;
+ } finally {
+ tracer.trace("e");
+ }
+ tracer.trace("f");
+}
+
+foo4(Tracer tracer) async {
+ try {
+ try {
+ await new Future.value(3); //# forceAwait: continued
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ tracer.trace("b");
+ Expect.equals("Error", error);
+ throw "Error2";
+ }
+ } catch (error) {
+ Expect.equals("Error2", error);
+ tracer.trace("c");
+ }
+ tracer.trace("d");
+}
+
+foo5(Tracer tracer) async {
+ try {
+ tracer.trace("a");
+ try {
+ await new Future.value(3); //# forceAwait: continued
+ tracer.trace("b");
+ throw "Error";
+ } catch (error) {
+ tracer.trace("c");
+ Expect.equals("Error", error);
+ throw "Error2";
+ }
+ } finally {
+ tracer.trace("d");
+ }
+ tracer.trace("e");
+}
+
+foo6(Tracer tracer) async {
+ try {
+ try {
+ await new Future.value(3); //# forceAwait: continued
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ tracer.trace("b");
+ Expect.equals("Error", error);
+ throw "Error2";
+ } finally {
+ tracer.trace("c");
+ throw "Error3";
+ }
+ } catch (error) {
+ tracer.trace("d");
+ Expect.equals("Error3", error);
+ }
+ tracer.trace("e");
+}
+
+foo7(Tracer tracer) async {
+ try {
+ try {
+ await new Future.value(3); //# forceAwait: continued
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ Expect.equals("Error", error);
+ tracer.trace("b");
+ throw "Error2";
+ } finally {
+ tracer.trace("c");
+ throw "Error3";
+ }
+ } finally {
+ tracer.trace("d");
+ }
+ tracer.trace("e");
+}
+
+foo8(Tracer tracer) async {
+ try {
+ try {
+ await new Future.value(3); //# forceAwait: continued
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ Expect.equals("Error", error);
+ tracer.trace("b");
+ return;
+ } finally {
+ tracer.trace("c");
+ throw "Error3";
+ }
+ } finally {
+ tracer.trace("d");
+ }
+ tracer.trace("e");
+}
+
+foo9(Tracer tracer) async {
+ try {
+ while (true) {
+ try {
+ await new Future.value(3); //# forceAwait: continued
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ Expect.equals("Error", error);
+ tracer.trace("b");
+ return;
+ } finally {
+ tracer.trace("c");
+ break;
+ }
+ tracer.trace("d");
+ }
+ } finally {
+ tracer.trace("e");
+ }
+ tracer.trace("f");
+}
+
+foo10(Tracer tracer) async {
+ try {
+ int i = 0;
+ while (true) {
+ try {
+ try {
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ tracer.trace("b");
+ try {
+ await new Future.value(3); // //# forceAwait: continued
+ throw "Error2";
+ } catch (error) {
+ tracer.trace("c");
+ } finally {
+ tracer.trace("d");
+ }
+ tracer.trace("e");
+ throw "Error3";
+ } finally {
+ tracer.trace("f");
+ // Continue and breaks 'eats' Error3.
+ if (i == 0) continue;
+ if (i == 1) break;
+ }
+ } finally {
+ tracer.trace("g");
+ i++;
+ }
+ }
+ } finally {
+ tracer.trace("h");
+ }
+ tracer.trace("i");
+}
+
+foo11(Tracer tracer) async {
+ try {
+ bool firstTime = true;
+ while (true) {
+ tracer.trace("a");
+ if (firstTime) {
+ try {
+ await new Future.value(3); //# forceAwait: continued
+ tracer.trace("b");
+ throw "Error";
+ } catch (error) {
+ Expect.equals("Error", error);
+ tracer.trace("c");
+ firstTime = false;
+ continue;
+ } finally {
+ tracer.trace("d");
+ }
+ } else {
+ tracer.trace("e");
+ return;
+ }
+ }
+ } finally {
+ tracer.trace("f");
+ }
+ tracer.trace("g");
+}
+
+foo12(Tracer tracer) async {
+ try {
+ bool firstTime = true;
+ while (true) {
+ tracer.trace("a");
+ if (firstTime) {
+ try {
+ await new Future.value(3); //# forceAwait: continued
+ tracer.trace("b");
+ throw "Error";
+ } catch (error) {
+ Expect.equals("Error", error);
+ tracer.trace("c");
+ firstTime = false;
+ continue;
+ } finally {
+ tracer.trace("d");
+ break;
+ }
+ } else {
+ tracer.trace("e");
+ return;
+ }
+ }
+ } finally {
+ tracer.trace("f");
+ }
+ tracer.trace("g");
+}
+
+foo13(Tracer tracer) async {
+ try {
+ try {
+ tracer.trace("a");
+ return;
+ } catch (error) {
+ tracer.trace("b");
+ } finally {
+ tracer.trace("c");
+ try {
+ try {
+ await new Future.value(3); // //# forceAwait: continued
+ tracer.trace("d");
+ throw "Error";
+ } finally {
+ tracer.trace("e");
+ }
+ } finally {
+ tracer.trace("f");
+ }
+ }
+ } finally {
+ tracer.trace("g");
+ }
+ tracer.trace("h");
+}
+
+foo14(Tracer tracer) async {
+ try {
+ try {
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ tracer.trace("b");
+ try {
+ await new Future.value(3); // //# forceAwait: continued
+ throw "Error2";
+ } catch (error) {
+ tracer.trace("c");
+ } finally {
+ tracer.trace("d");
+ }
+ tracer.trace("e");
+ throw "Error3";
+ } finally {
+ tracer.trace("f");
+ }
+ } finally {
+ tracer.trace("g");
+ }
+ tracer.trace("h");
+}
+
+foo15(Tracer tracer) async {
+ try {
+ try {
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ tracer.trace("b");
+ try {
+ await new Future.value(3); // //# forceAwait: continued
+ throw "Error2";
+ } catch (error) {
+ tracer.trace("c");
+ } finally {
+ tracer.trace("d");
+ }
+ tracer.trace("e");
+ throw "Error3";
+ } finally {
+ tracer.trace("f");
+ return;
+ }
+ } finally {
+ tracer.trace("g");
+ }
+ tracer.trace("h");
+}
+
+foo16(Tracer tracer) async {
+ try {
+ try {
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ tracer.trace("b");
+ try {
+ await new Future.value(3); // //# forceAwait: continued
+ throw "Error2";
+ } catch (error) {
+ tracer.trace("c");
+ } finally {
+ tracer.trace("d");
+ return;
+ }
+ tracer.trace("e");
+ throw "Error3";
+ } finally {
+ tracer.trace("f");
+ }
+ } finally {
+ tracer.trace("g");
+ }
+ tracer.trace("h");
+}
+
+foo17(Tracer tracer) async {
+ try {
+ tracer.trace("a");
+ } finally {
+ try {
+ tracer.trace("b");
+ throw "Error";
+ } catch (error) {
+ await new Future.value(3); // //# forceAwait: continued
+ Expect.equals("Error", error);
+ tracer.trace("c");
+ } finally {
+ tracer.trace("d");
+ }
+ tracer.trace("e");
+ }
+ tracer.trace("f");
+}
+
+foo18(Tracer tracer) async {
+ try {
+ tracer.trace("a");
+ } finally {
+ try {
+ tracer.trace("b");
+ } finally {
+ await new Future.value(3); // //# forceAwait: continued
+ tracer.trace("c");
+ }
+ tracer.trace("d");
+ }
+ tracer.trace("e");
+}
+
+runTest(expectedTrace, fun, [expectedError]) async {
+ Tracer tracer = new Tracer(expectedTrace, expectedTrace);
+ try {
+ await fun(tracer);
+ } catch (error) {
+ Expect.equals(expectedError, error);
+ tracer.trace("X");
+ }
+ tracer.done();
+}
+
+test() async {
+ await runTest("abceX", foo1, "Error2");
+ await runTest("abdeX", foo2, "Error2");
+ await runTest("abde", foo3);
+ await runTest("abcd", foo4);
+ await runTest("abcdX", foo5, "Error2");
+ await runTest("abcde", foo6);
+ await runTest("abcdX", foo7, "Error3");
+ await runTest("abcdX", foo8, "Error3");
+ await runTest("abcef", foo9);
+ await runTest("abcdefgabcdefghi", foo10);
+ await runTest("abcdaef", foo11);
+ await runTest("abcdfg", foo12);
+ await runTest("acdefgX", foo13, "Error");
+ await runTest("abcdefgX", foo14, "Error3");
+ await runTest("abcdefgX", foo14, "Error3");
+ await runTest("abcdefg", foo15);
+ await runTest("abcdfg", foo16);
+ await runTest("abcdef", foo17);
+ await runTest("abcde", foo18);
+}
+
+void main() {
+ asyncTest(test);
+}
diff --git a/tests/language/async_star/async_star2_regression_test.dart b/tests/language/async_star/async_star2_regression_test.dart
new file mode 100644
index 0000000..7c8acfc
--- /dev/null
+++ b/tests/language/async_star/async_star2_regression_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2020, 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 async_start_test;
+
+import "dart:async";
+
+import "package:expect/expect.dart";
+
+void main() async {
+ var results = [];
+
+ f() async* {
+ yield 0;
+ yield 1;
+ yield 2;
+ }
+
+ //Broken, the value 1 was lost.
+ await for (var i in f()) {
+ results.add(i);
+ if (i == 0) {
+ // This should pause the stream subscription.
+ await Future.delayed(Duration(milliseconds: 500));
+ }
+ }
+
+ Expect.listEquals([0, 1, 2], results);
+}
diff --git a/tests/language/async_star/async_star_await_for_test.dart b/tests/language/async_star/async_star_await_for_test.dart
new file mode 100644
index 0000000..0493a1f
--- /dev/null
+++ b/tests/language/async_star/async_star_await_for_test.dart
@@ -0,0 +1,376 @@
+// 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 that `await for` and `async*` interact correctly.
+
+// An `await for` must pause its subscription immediately
+// if the `await for` body does anything asynchronous
+// (any `await`, `await for`, or pausing at a `yield`/`yield*`)
+// A pause happening synchronously in an event delivery
+// must pause the `sync*` method at the `yield` sending the event.
+// A break happening synchronously in an event delivery,
+// or while paused at a `yield`, must exit at that `yield`.
+
+import "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+Stream<int> stream(List<String> log) async* {
+ log.add("^");
+ try {
+ log.add("?1");
+ yield 1;
+ log.add("?2");
+ yield 2;
+ log.add("?3");
+ yield 3;
+ } finally {
+ log.add(r"$");
+ }
+}
+
+Stream<int> consume(List<String> log,
+ {int breakAt = -1,
+ int yieldAt = -1,
+ int yieldStarAt = -1,
+ int pauseAt = -1}) async* {
+ // Create stream.
+ var s = stream(log);
+ log.add("(");
+ // The "consume loop".
+ await for (var event in s) {
+ // Should be acting synchronously wrt. the delivery of the event.
+ // The source stream should be at the yield now.
+ log.add("!$event");
+ if (event == pauseAt) {
+ log.add("p$event[");
+ // Async operation causes subscription to pause.
+ // Nothing should happen in the source stream
+ // until the end of the loop body where the subscription is resumed.
+ await Future.delayed(Duration(microseconds: 1));
+ log.add("]");
+ }
+ if (event == yieldAt) {
+ log.add("y$event[");
+ // Yield may cause subscription to pause or cancel.
+ // This loop should stay at the yield until the event has been delieverd.
+ // If the receiver pauses or cancels, we delay or break the loop here.
+ yield event;
+ log.add("]");
+ }
+ if (event == yieldStarAt) {
+ log.add("Y$event[");
+ // Yield* will always cause the subscription for this loop to pause.
+ // If the listener pauses, this stream is paused. If the listener cancels,
+ // this stream is cancelled, and the yield* acts like return, cancelling
+ // the loop subscription and waiting for the cancel future.
+ yield* Stream<int>.fromIterable([event]);
+ log.add("]");
+ }
+ if (event == breakAt) {
+ log.add("b$event");
+ // Breaks the loop. This cancels the loop subscription and waits for the
+ // cancel future.
+ break;
+ }
+ }
+ // Done event from stream or cancel future has completed.
+ log.add(")");
+}
+
+main() async {
+ asyncStart();
+
+ // Just run the loop over the stream. The consume stream emits no events.
+ {
+ var log = <String>[];
+ await for (var _ in consume(log)) {
+ throw "unreachable";
+ }
+ await Future.delayed(Duration(milliseconds: 1));
+ var trace = log.join("");
+ Expects.equals(r"(^?1!1?2!2?3!3$)", trace, "straight through");
+ }
+
+ // Pause at 1, then resume.
+ // Consume loop forces a pause when it receives the 1 event.
+ // Nothing should happen until that pause is resumed.
+ {
+ var log = <String>[];
+ await for (var _ in consume(log, pauseAt: 1)) {
+ throw "unreachable";
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "pause at 1";
+ if (trace.contains("p1[?2")) {
+ message += " (did not pause in time)";
+ }
+ Expects.equals(r"(^?1!1p1[]?2!2?3!3$)", trace, message);
+ }
+
+ // Break at 1.
+ // Consume loop breaks after receiving the 1 event.
+ // The consume stream emits no events.
+ {
+ var log = <String>[];
+ await for (var _ in consume(log, breakAt: 1)) {
+ throw "unreachable";
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "break at 1";
+ if (trace.contains("b1?2")) {
+ message += " (did not cancel in time)";
+ }
+ Expects.equals(r"(^?1!1b1$)", trace, message);
+ }
+
+ // Pause then break at 1.
+ // Consume loop pauses after receiving the 1 event,
+ // then breaks before resuming. It should still be at the yield.
+ // The consume stream emits no events.
+ {
+ var log = <String>[];
+ await for (var _ in consume(log, pauseAt: 1, breakAt: 1)) {
+ throw "unreachable";
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "pause then break at 1";
+ if (trace.contains("p1[?2")) {
+ message += " (did not pause in time)";
+ }
+ if (trace.contains("b1?2")) {
+ message += " (did not cancel in time)";
+ }
+ Expects.equals(r"(^?1!1p1[]b1$)", trace, message);
+ }
+
+ // Yield at 1.
+ // The consume loop re-emits the 1 event.
+ // The test loop should receive that event while the consume loop is still
+ // at the yield statement.
+ // The consume loop may or may not pause, it should make no difference.
+ {
+ var log = <String>[];
+ await for (var s in consume(log, yieldAt: 1)) {
+ log.add("e$s");
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "yield at 1";
+ if (trace.contains("y1[?2")) {
+ message += " (did not wait for delivery)";
+ }
+ Expects.equals(r"(^?1!1y1[e1]?2!2?3!3$)", trace, message);
+ }
+
+ // Yield at 1, then pause at yield.
+ // The consume loop re-emits the 1 event.
+ // The test loop should receive that event while the consume loop is still
+ // at the yield statement.
+ // The test loop then pauses.
+ // Nothing should happen in either the original yield
+ // or the consume-function yield until the test loop ends.
+ {
+ var log = <String>[];
+ await for (var s in consume(log, yieldAt: 1)) {
+ log.add("e$s<");
+ // Force pause at yield.
+ await Future.delayed(Duration(milliseconds: 1));
+ log.add(">");
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "yield at 1, pause at yield";
+ if (trace.contains("y1[?2")) {
+ message += " (did not wait for delivery)";
+ }
+ if (trace.contains("e1<?2")) {
+ message += " (did not pause in time)";
+ }
+ Expects.equals(r"(^?1!1y1[e1<>]?2!2?3!3$)", trace, message);
+ }
+
+ // Yield at 1, then break at yield.
+ // The consume loop re-emits the 1 event.
+ // The test loop should receive that event while the consume loop is still
+ // at the yield statement.
+ // The test loop then breaks. That makes the consume loop yield return,
+ // breaking the consume loop, which makes the source yield return.
+ {
+ var log = <String>[];
+ await for (var s in consume(log, yieldAt: 1)) {
+ log.add("e${s}B$s");
+ break; // Force break at yield*.
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "yield at 1, break at yield";
+ if (trace.contains("y1[?2")) {
+ message += " (did not wait for delivery)";
+ }
+ if (trace.contains("B1?2")) {
+ message += " (did not break in time)";
+ }
+ Expects.equals(r"(^?1!1y1[e1B1$)", trace, message);
+ }
+
+ // Yield* at 1.
+ // The consume loop re-emits a stream containing the 1 event.
+ // The test loop should receive that event before the consume loop
+ // continues from the `yield*`, which again happens before the source
+ // stream continues from its `yield`.
+ {
+ var log = <String>[];
+ await for (var s in consume(log, yieldStarAt: 1)) {
+ log.add("e$s");
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "yield* at 1";
+ if (trace.contains("Y1[?2")) {
+ message += " (did not wait for delivery)";
+ }
+ Expects.equals(r"(^?1!1Y1[e1]?2!2?3!3$)", trace, message);
+ }
+
+ // Yield* at 1, pause at yield.
+ // The consume loop re-emits a stream containing the 1 event.
+ // The test loop should receive that event before the consume loop
+ // continues from the `yield*`. The test loop then force a pause.
+ // Nothing further should happen during that pause.
+ {
+ var log = <String>[];
+ await for (var s in consume(log, yieldStarAt: 1)) {
+ log.add("e$s<");
+ await Future.delayed(Duration(milliseconds: 1)); // force pause.
+ log.add(">");
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "yield* then pause at 1";
+ if (trace.contains("Y1[?2")) {
+ message += " (did not wait for delivery)";
+ }
+ if (trace.contains("e1<?2")) {
+ message += " (did not pause in time)";
+ }
+ Expects.equals(r"(^?1!1Y1[e1<>]?2!2?3!3$)", trace, message);
+ }
+
+ // Yield* at 1, then break at 1.
+ // The consume loop re-emits a stream containing the 1 event.
+ // The test loop should receive that event before the consume loop
+ // continues from the `yield*`.
+ // When the consume loop continues, it breaks,
+ // forcing the waiting source yield to return.
+ {
+ var log = <String>[];
+ await for (var s in consume(log, yieldStarAt: 1, breakAt: 1)) {
+ log.add("e$s");
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "yield* then pause at 1";
+ if (trace.contains("Y1[?2")) {
+ message += " (did not wait for delivery)";
+ }
+ Expects.equals(r"(^?1!1Y1[e1]b1$)", trace, message);
+ }
+
+ // Yield* at 1, pause at yield, then break at 1.
+ // The consume loop re-emits a stream containing the 1 event.
+ // The test loop should receive that event before the consume loop
+ // continues from the `yield*`. After the `yield*`, the consume loop breaks.
+ // This forces the waiting source yield to return.
+ {
+ var log = <String>[];
+ await for (var s in consume(log, yieldStarAt: 1, breakAt: 1)) {
+ log.add("e$s<");
+ await Future.delayed(Duration(milliseconds: 1)); // force pause.
+ log.add(">");
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "yield* then pause at 1";
+ Expects.equals(r"(^?1!1Y1[e1<>]b1$)", trace, message);
+ }
+
+ // Yield* at 1, break at yield.
+ // The consume loop re-emits a stream containing the 1 event.
+ // The test loop should receive that event before the consume loop
+ // continues from the `yield*`. The test loop then breaks,
+ // forcing the two waiting yields to return.
+ {
+ var log = <String>[];
+ await for (var s in consume(log, yieldStarAt: 1)) {
+ log.add("e${s}B$s");
+ break;
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "yield* then break at 1";
+ if (trace.contains("Y1[?2")) {
+ message += " (did not deliver event in time)";
+ }
+ if (trace.contains("e1?2")) {
+ message += " (did not cancel in time)";
+ }
+ Expects.equals(r"(^?1!1Y1[e1B1$)", trace, message);
+ }
+
+ // Yield* at 1, pause at yield, then break at yield.
+ // The consume loop re-emits a stream containing the 1 event.
+ // The test loop should receive that event before the consume loop
+ // continues from the `yield*`. The test loop then forces a pause,
+ // and then breaks before that pause is resumed.
+ // This forces the two waiting yields to return.
+ {
+ var log = <String>[];
+ await for (var s in consume(log, yieldStarAt: 1)) {
+ log.add("e$s<");
+ await Future.delayed(Duration(milliseconds: 1)); // force pause.
+ log.add(">B$s");
+ break; // And break.
+ }
+ await Future.delayed(Duration(milliseconds: 10));
+ var trace = log.join("");
+ String message = "yield* then pause then break at 1";
+ Expects.equals(r"(^?1!1Y1[e1<>B1$)", trace, message);
+ }
+
+ Expects.summarize();
+ asyncEnd();
+}
+
+class Expects {
+ static var _errors = [];
+ static int _tests = 0;
+ static void summarize() {
+ if (_errors.isNotEmpty) {
+ var buffer = StringBuffer();
+ for (var es in _errors) {
+ buffer.writeln("FAILURE:");
+ buffer.writeln(es[0]); // error
+ buffer.writeln(es[1]); // stack trace
+ }
+ ;
+ buffer.writeln("Expectations failed: ${_errors.length}"
+ ", succeeded: ${_tests - _errors.length}");
+ throw ExpectException(buffer.toString());
+ }
+ }
+
+ static void equals(o1, o2, String message) {
+ _tests++;
+ try {
+ Expect.equals(o1, o2, message);
+ } on ExpectException catch (e) {
+ var stack = StackTrace.current;
+ _errors.add([e, stack]);
+ }
+ }
+}
diff --git a/tests/language/async_star/async_star_cancel_test.dart b/tests/language/async_star/async_star_cancel_test.dart
new file mode 100644
index 0000000..c23c6ba
--- /dev/null
+++ b/tests/language/async_star/async_star_cancel_test.dart
@@ -0,0 +1,46 @@
+// 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 that stream cancellation is checked immediately after delivering the
+// event, and before continuing after the yield.
+
+import "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+main() async {
+ asyncStart();
+ var log = [];
+ Stream<int> f() async* {
+ try {
+ log.add("-1");
+ yield 1;
+ log.add("-2");
+ yield 2;
+ } finally {
+ log.add("x");
+ }
+ }
+
+ var completer = Completer();
+ var s;
+ s = f().listen((e) {
+ log.add("+$e");
+ // The `cancel` operation makes all `yield` operations act as returns.
+ // It should make the `finally` block in `f` log an "x",
+ // and nothing else.
+ completer.complete(s.cancel());
+ }, onError: (e) {
+ // Should never be reached, but if it does, we'll make the await
+ // below terminate.
+ completer.complete(new Future.sync(() {
+ Expect.fail("$e");
+ }));
+ }, onDone: () {
+ completer.complete(null);
+ });
+ await completer.future;
+ Expect.listEquals(["-1", "+1", "x"], log, "cancel");
+ asyncEnd();
+}
diff --git a/tests/language/async_star/async_star_invalid_test.dart b/tests/language/async_star/async_star_invalid_test.dart
new file mode 100644
index 0000000..0c5199f
--- /dev/null
+++ b/tests/language/async_star/async_star_invalid_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 that various invalid uses of `yield` are disallowed.
+
+import "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+var yield = 42;
+
+main() async {
+ asyncStart();
+ Stream<String> f() async* {
+ // Invalid syntax.
+ yield ("a", "b"); //# 01: syntax error
+ yield yield "twice"; //# 02: syntax error
+
+ // Valid but curious syntax.
+ yield throw "throw"; //# 03: runtime error
+
+ // Type error.
+ yield* "one"; //# 04: compile-time error
+
+ label: yield "ok";
+ }
+ var completer = Completer();
+ f().listen(completer.complete, onError: completer.completeError,
+ onDone: () {
+ if (!completer.isCompleted) completer.completeError("not ok?");
+ });
+ Expect.equals("ok", await completer.future);
+ asyncEnd();
+}
diff --git a/tests/language/async_star/async_star_test.dart b/tests/language/async_star/async_star_test.dart
new file mode 100644
index 0000000..47813ab
--- /dev/null
+++ b/tests/language/async_star/async_star_test.dart
@@ -0,0 +1,195 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+main() async {
+ asyncStart();
+ // Normal operations.
+ {
+ Stream<int> f() async* {
+ yield 1;
+ yield 2;
+ yield 3;
+ }
+
+ Expect.listEquals([1, 2, 3], await f().toList(), "basic1");
+ }
+
+ {
+ Stream<int> f() async* {
+ yield 1;
+ yield 2;
+ yield 3;
+ }
+
+ var log = [];
+ var completer = Completer();
+ f().listen(log.add,
+ onError: (e) {
+ // Shouldn't be reached.
+ completer.complete(new Future.sync(() {
+ Expect.fail("$e");
+ }));
+ },
+ onDone: () => completer.complete(null));
+ await completer.future;
+ Expect.listEquals([1, 2, 3], log, "basic2");
+ }
+
+ {
+ var log = [];
+ Stream<int> f() async* {
+ log.add("-1");
+ yield 1;
+ log.add("-2");
+ yield 2;
+ }
+
+ await f().forEach((e) {
+ log.add("+$e");
+ });
+ Expect.listEquals(["-1", "+1", "-2", "+2"], log, "basic3");
+ }
+
+ {
+ var log = [];
+ Stream<int> f() async* {
+ log.add("-1");
+ yield 1;
+ log.add("-2");
+ yield 2;
+ }
+
+ await for (var e in f()) {
+ log.add("+$e");
+ }
+ Expect.listEquals(["-1", "+1", "-2", "+2"], log, "basic4");
+ }
+
+ // async
+ {
+ Stream<int> f() async* {
+ yield 1;
+ await Future(() {});
+ yield 2;
+ await Future(() {});
+ yield 3;
+ }
+
+ Expect.listEquals([1, 2, 3], await f().toList(), "async");
+ }
+
+ // Yield*
+ {
+ Stream<int> f(int n) async* {
+ yield n;
+ if (n == 0) return;
+ yield* f(n - 1);
+ yield n;
+ }
+
+ Expect.listEquals([3, 2, 1, 0, 1, 2, 3], await f(3).toList(), "yield*");
+ }
+
+ // Errors
+ {
+ var log = [];
+ Stream<int> f() async* {
+ yield 1;
+ throw "error";
+ }
+
+ await f().handleError((e) {
+ log.add(e);
+ }).forEach(log.add);
+ Expect.listEquals([1, "error"], log, "error");
+ }
+
+ {
+ var log = [];
+ Stream<int> f() async* {
+ yield 1;
+ yield* Future<int>.error("error").asStream(); // Emits error as error.
+ yield 3;
+ }
+
+ await f().handleError((e) {
+ log.add(e);
+ }).forEach(log.add);
+ Expect.listEquals([1, "error", 3], log, "error2");
+ }
+
+ // Pause is checked after delivering event.
+ {
+ var log = [];
+ Stream<int> f() async* {
+ log.add("-1");
+ yield 1;
+ log.add("-2");
+ yield 2;
+ }
+
+ var completer = Completer();
+ var s;
+ s = f().listen((e) {
+ log.add("+$e");
+ s.pause(Future(() {}));
+ log.add("++$e");
+ }, onError: (e) {
+ completer.complete(new Future.sync(() {
+ Expect.fail("$e");
+ }));
+ }, onDone: () => completer.complete(null));
+ await completer.future;
+ Expect.listEquals(["-1", "+1", "++1", "-2", "+2", "++2"], log, "pause");
+ }
+
+ // Await for-loop pauses between events.
+ {
+ var log = [];
+ Stream<int> f() async* {
+ log.add("-1");
+ yield 1;
+ log.add("-2");
+ yield 2;
+ }
+
+ await for (var e in f()) {
+ log.add("+$e");
+ await Future(() {}); // One timer tick.
+ log.add("++$e");
+ }
+ Expect.listEquals(["-1", "+1", "++1", "-2", "+2", "++2"], log, "looppause");
+ }
+
+ // Await for-loop break works immediately.
+ {
+ var log = [];
+ Stream<int> f() async* {
+ try {
+ log.add("-1");
+ yield 1;
+ log.add("-2");
+ yield 2;
+ log.add("-3");
+ yield 3;
+ } finally {
+ log.add("x");
+ }
+ }
+
+ await for (var e in f()) {
+ log.add("+$e");
+ await Future(() {}); // One timer tick, pauses function at yield.
+ log.add("++$e");
+ if (e == 2) break;
+ }
+ Expect.listEquals(
+ ["-1", "+1", "++1", "-2", "+2", "++2", "x"], log, "loop-pause-break");
+ }
+ asyncEnd();
+}
diff --git a/tests/language/async_star/await_for_test.dart b/tests/language/async_star/await_for_test.dart
new file mode 100644
index 0000000..13d8fc8
--- /dev/null
+++ b/tests/language/async_star/await_for_test.dart
@@ -0,0 +1,148 @@
+// Copyright (c) 2020, 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:async';
+
+import 'package:async_helper/async_minitest.dart';
+
+import 'utils.dart';
+
+main() {
+ test('simple stream', () {
+ f(Stream<int> s) async {
+ var r = 0;
+ await for (var v in s) r += v;
+ return r;
+ }
+
+ return f(mkStream(5)).then((v) {
+ expect(v, equals(10));
+ });
+ });
+
+ test('simple stream, await', () {
+ f(Stream<int> s) async {
+ var r = 0;
+ await for (var v in s) r += await Future.microtask(() => v);
+ return r;
+ }
+
+ return f(mkStream(5)).then((v) {
+ expect(v, equals(10));
+ });
+ });
+
+ test('simple stream - take', () {
+ f(Stream<int> s) async {
+ var r = 0;
+ await for (var v in s.take(5)) r += v;
+ return r;
+ }
+
+ return f(mkStream(10)).then((v) {
+ expect(v, equals(10));
+ });
+ });
+
+ test('simple stream reyield', () {
+ f(Stream<int> s) async* {
+ var r = 0;
+ await for (var v in s) yield r += v;
+ }
+
+ return expectList(f(mkStream(5)), [0, 1, 3, 6, 10]);
+ });
+
+ test('simple stream, await, reyield', () {
+ f(Stream<int> s) async* {
+ var r = 0;
+ await for (var v in s) yield r += await Future.microtask(() => v);
+ }
+
+ return expectList(f(mkStream(5)), [0, 1, 3, 6, 10]);
+ });
+
+ test('simple stream - take, reyield', () {
+ f(Stream<int> s) async* {
+ var r = 0;
+ await for (var v in s.take(5)) yield r += v;
+ }
+
+ return expectList(f(mkStream(10)), [0, 1, 3, 6, 10]);
+ });
+
+ test('nested', () {
+ f() async {
+ var r = 0;
+ await for (var i in mkStream(5)) {
+ await for (var j in mkStream(3)) {
+ r += i * j;
+ }
+ }
+ return r;
+ }
+
+ return f().then((v) {
+ expect(v, equals((1 + 2 + 3 + 4) * (1 + 2)));
+ });
+ });
+
+ test('nested, await', () {
+ f() async {
+ var r = 0;
+ await for (var i in mkStream(5)) {
+ await for (var j in mkStream(3)) {
+ r += await Future.microtask(() => i * j);
+ }
+ }
+ return r;
+ }
+
+ return f().then((v) {
+ expect(v, equals((1 + 2 + 3 + 4) * (1 + 2)));
+ });
+ });
+
+ test('nested, await * 2', () {
+ f() async {
+ var r = 0;
+ await for (var i in mkStream(5)) {
+ var ai = await Future.microtask(() => i);
+ await for (var j in mkStream(3)) {
+ r += await Future.microtask(() => ai * j);
+ }
+ }
+ return r;
+ }
+
+ return f().then((v) {
+ expect(v, equals((1 + 2 + 3 + 4) * (1 + 2)));
+ });
+ });
+
+ test('await pauses loop', () {
+ var sc;
+ var i = 0;
+ void send() {
+ if (i == 5) {
+ sc.close();
+ } else {
+ sc.add(i++);
+ }
+ }
+
+ sc = StreamController<int>(onListen: send, onResume: send);
+ f(Stream<int> s) async {
+ var r = 0;
+ await for (var i in s) {
+ r += await Future.delayed(ms * 10, () => i);
+ }
+ return r;
+ }
+
+ return f(sc.stream).then((v) {
+ expect(v, equals(10));
+ });
+ });
+}
diff --git a/tests/language/async_star/await_pauses_test.dart b/tests/language/async_star/await_pauses_test.dart
new file mode 100644
index 0000000..a7bcf3a
--- /dev/null
+++ b/tests/language/async_star/await_pauses_test.dart
@@ -0,0 +1,35 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+main() {
+ var sc;
+ var i = 0;
+ void send() {
+ if (i == 5) {
+ sc.close();
+ } else {
+ sc.add(i++);
+ }
+ }
+
+ sc = new StreamController<int>(onListen: send, onResume: send);
+
+ f(Stream<int> s) async {
+ var r = 0;
+ await for (var i in s) {
+ r += await new Future.delayed(new Duration(milliseconds: 10), () => i);
+ }
+ return r;
+ }
+
+ asyncStart();
+ f(sc.stream).then((v) {
+ Expect.equals(10, v);
+ asyncEnd();
+ });
+}
diff --git a/tests/language/async_star/basic_test.dart b/tests/language/async_star/basic_test.dart
new file mode 100644
index 0000000..cd0cfca
--- /dev/null
+++ b/tests/language/async_star/basic_test.dart
@@ -0,0 +1,153 @@
+// Copyright (c) 2020, 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:async';
+
+import 'package:async_helper/async_minitest.dart';
+
+import 'utils.dart';
+
+class NotAStream {
+ listen(oData, {onError, onDone, cancelOnError}) {
+ fail('Not implementing Stream.');
+ }
+}
+
+StreamTransformer getErrors =
+ StreamTransformer.fromHandlers(handleData: (data, sink) {
+ fail('Unexpected value');
+}, handleError: (e, s, sink) {
+ sink.add(e);
+}, handleDone: (sink) {
+ sink.close();
+});
+
+// Obscuring identity function.
+id(x) {
+ try {
+ if (x != null) throw x;
+ } catch (e) {
+ return e;
+ }
+ return null;
+}
+
+main() {
+ test('empty', () {
+ f() async* {}
+ return f().toList().then((v) {
+ expect(v, equals([]));
+ });
+ });
+
+ test('single', () {
+ f() async* {
+ yield 42;
+ }
+
+ return f().toList().then((v) {
+ expect(v, equals([42]));
+ });
+ });
+
+ test('call delays', () {
+ var list = [];
+ f() async* {
+ list.add(1);
+ yield 2;
+ }
+
+ var res = f().forEach(list.add);
+ list.add(0);
+ return res.whenComplete(() {
+ expect(list, equals([0, 1, 2]));
+ });
+ });
+
+ test('throws', () {
+ f() async* {
+ yield 1;
+ throw 2;
+ }
+
+ var completer = Completer();
+ var list = [];
+ f().listen(list.add,
+ onError: (v) => list.add('$v'), onDone: completer.complete);
+ return completer.future.whenComplete(() {
+ expect(list, equals([1, '2']));
+ });
+ });
+
+ test('multiple', () {
+ f() async* {
+ for (int i = 0; i < 10; i++) {
+ yield i;
+ }
+ }
+
+ return expectList(f(), List.generate(10, id));
+ });
+
+ test('allows await', () {
+ f() async* {
+ var x = await Future.value(42);
+ yield x;
+ x = await Future.value(42);
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('allows await in loop', () {
+ f() async* {
+ for (int i = 0; i < 10; i++) {
+ yield await i;
+ }
+ }
+
+ return expectList(f(), List.generate(10, id));
+ });
+
+ test('allows yield*', () {
+ f() async* {
+ yield* Stream.fromIterable([1, 2, 3]);
+ }
+
+ return expectList(f(), [1, 2, 3]);
+ });
+
+ test('allows yield* of async*', () {
+ f(n) async* {
+ yield n;
+ if (n == 0) return;
+ yield* f(n - 1);
+ yield n;
+ }
+
+ return expectList(f(3), [3, 2, 1, 0, 1, 2, 3]);
+ });
+
+ test('Cannot yield* non-stream', () {
+ f(dynamic s) async* {
+ yield* s;
+ }
+
+ return f(42).transform(getErrors).single.then((v) {
+ // Not implementing Stream.
+ expect(v is Error, isTrue);
+ });
+ });
+
+ test('Cannot yield* non-stream 2', () {
+ f(dynamic s) async* {
+ yield* s;
+ }
+
+ return f(NotAStream()).transform(getErrors).single.then((v) {
+ // Not implementing Stream.
+ expect(v is Error, isTrue);
+ });
+ });
+}
diff --git a/tests/language/async_star/cancel_and_throw_in_finally_test.dart b/tests/language/async_star/cancel_and_throw_in_finally_test.dart
new file mode 100644
index 0000000..cd7a68a
--- /dev/null
+++ b/tests/language/async_star/cancel_and_throw_in_finally_test.dart
@@ -0,0 +1,42 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+// When an exception is thrown in the finally block cleaning up after a cancel,
+// the future returned from cancel should complete with an error.
+
+foo() async* {
+ try {
+ int i = 0;
+ while (true) {
+ yield i++;
+ }
+ } finally {
+ throw "Error";
+ }
+}
+
+test() async {
+ var completer = new Completer();
+ var s;
+ s = foo().listen((e) async {
+ Expect.equals(0, e);
+ try {
+ await s.cancel();
+ Expect.fail("Did not throw");
+ } catch (e) {
+ Expect.equals("Error", e);
+ completer.complete();
+ }
+ });
+ await completer.future;
+}
+
+main() {
+ asyncStart();
+ test().then((_) => asyncEnd());
+}
diff --git a/tests/language/async_star/cancel_test.dart b/tests/language/async_star/cancel_test.dart
new file mode 100644
index 0000000..4eba9c6
--- /dev/null
+++ b/tests/language/async_star/cancel_test.dart
@@ -0,0 +1,142 @@
+// Copyright (c) 2020, 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:async';
+
+import 'package:async_helper/async_minitest.dart';
+
+import 'utils.dart';
+
+main() {
+ // Stream.take(n) automatically cancels after seeing the n'th value.
+ test('cancels at yield', () {
+ Completer exits = Completer();
+ var list = [];
+ f() async* {
+ try {
+ list.add(0);
+ list.add(1);
+ yield null;
+ list.add(2);
+ } finally {
+ exits.complete(3);
+ }
+ }
+
+ // No events must be fired synchronously in response to a listen.
+ var subscription = f().listen((Null v) {
+ fail('Received event $v');
+ }, onDone: () {
+ fail('Received done');
+ });
+ // No events must be delivered after a cancel.
+ subscription.cancel();
+ return exits.future.then((v) {
+ expect(v, equals(3));
+ expect(list, equals([0, 1]));
+ });
+ });
+
+ test('does cancel eventually', () {
+ var exits = Completer();
+ var list = [];
+ f() async* {
+ int i = 0;
+ try {
+ while (true) yield i++;
+ } finally {
+ list.add('a');
+ exits.complete(i);
+ }
+ }
+
+ return expectList(f().take(5), [0, 1, 2, 3, 4])
+ .then((_) => exits.future)
+ .then((v) {
+ expect(v, greaterThan(4));
+ expect(list, ['a']);
+ });
+ });
+
+ group('at index', () {
+ f() async* {
+ try {
+ yield await Future.microtask(() => 1);
+ } finally {
+ try {
+ yield await Future.microtask(() => 2);
+ } finally {
+ yield await Future.microtask(() => 3);
+ }
+ }
+ }
+
+ test('- all, sanity check', () {
+ return expectList(f(), [1, 2, 3]);
+ });
+ test('after end', () {
+ return expectList(f().take(4), [1, 2, 3]);
+ });
+ test('at end', () {
+ return expectList(f().take(3), [1, 2, 3]);
+ });
+ test('before end', () {
+ return expectList(f().take(2), [1, 2]);
+ });
+ test('early', () {
+ return expectList(f().take(1), [1]);
+ });
+ test('at start', () {
+ return expectList(f().take(0), []);
+ });
+ });
+
+ test('regression-fugl/fisk', () {
+ var res = [];
+ fisk() async* {
+ res.add('+fisk');
+ try {
+ for (int i = 0; i < 2; i++) {
+ yield await Future.microtask(() => i);
+ }
+ } finally {
+ res.add('-fisk');
+ }
+ }
+
+ fugl(int count) async {
+ res.add('fisk $count');
+ try {
+ await for (int? i in fisk().take(count)) res.add(i);
+ } finally {
+ res.add('done');
+ }
+ }
+
+ return fugl(3)
+ .whenComplete(() => fugl(2))
+ .whenComplete(() => fugl(1))
+ .whenComplete(() {
+ expect(res, [
+ 'fisk 3',
+ '+fisk',
+ 0,
+ 1,
+ '-fisk',
+ 'done',
+ 'fisk 2',
+ '+fisk',
+ 0,
+ 1,
+ '-fisk',
+ 'done',
+ 'fisk 1',
+ '+fisk',
+ 0,
+ '-fisk',
+ 'done',
+ ]);
+ });
+ });
+}
diff --git a/tests/language/async_star/cancel_while_paused_at_yield_test.dart b/tests/language/async_star/cancel_while_paused_at_yield_test.dart
new file mode 100644
index 0000000..af7e846
--- /dev/null
+++ b/tests/language/async_star/cancel_while_paused_at_yield_test.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2020, 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:async';
+
+import 'package:async_helper/async_minitest.dart';
+
+import 'utils.dart';
+
+main() {
+ test('canceling while paused at yield', () {
+ var list = [];
+ var sync = Sync();
+ f() async* {
+ list.add('*1');
+ yield 1;
+ await sync.wait();
+ sync.release();
+ list.add('*2');
+ yield 2;
+ list.add('*3');
+ }
+
+ var stream = f();
+ // TODO(jmesserly): added workaround for:
+ // https://github.com/dart-lang/dev_compiler/issues/269
+ var sub = stream.listen((x) => list.add(x));
+ return sync.wait().whenComplete(() {
+ expect(list, equals(['*1', 1]));
+ sub.pause();
+ return sync.wait();
+ }).whenComplete(() {
+ expect(list, equals(['*1', 1, '*2']));
+ sub.cancel();
+ return Future.delayed(ms * 200, () {
+ // Should not have yielded 2 or added *3 while paused.
+ expect(list, equals(['*1', 1, '*2']));
+ });
+ });
+ });
+}
diff --git a/tests/language/async_star/cancel_while_paused_test.dart b/tests/language/async_star/cancel_while_paused_test.dart
new file mode 100644
index 0000000..476d946
--- /dev/null
+++ b/tests/language/async_star/cancel_while_paused_test.dart
@@ -0,0 +1,66 @@
+// 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.
+
+// This is a regression test for issue 22853.
+
+import "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+main() {
+ var list = [];
+ var sync = new Sync();
+ f() async* {
+ list.add("*1");
+ yield 1;
+ await sync.wait();
+ sync.release();
+ list.add("*2");
+ yield 2;
+ list.add("*3");
+ }
+
+ ;
+ var stream = f();
+ var sub = stream.listen(list.add);
+
+ asyncStart();
+ return sync.wait().whenComplete(() {
+ Expect.listEquals(["*1", 1], list);
+ sub.pause();
+ return sync.wait();
+ }).whenComplete(() {
+ Expect.listEquals(["*1", 1, "*2"], list);
+ sub.cancel();
+ new Future.delayed(new Duration(milliseconds: 200), () {
+ // Should not have yielded 2 or added *3 while paused.
+ Expect.listEquals(["*1", 1, "*2"], list);
+ asyncEnd();
+ });
+ });
+}
+
+/**
+ * Allows two asynchronous executions to synchronize.
+ *
+ * Calling [wait] and waiting for the returned future to complete will
+ * wait for the other executions to call [wait] again. At that point,
+ * the waiting execution is allowed to continue (the returned future completes),
+ * and the more recent call to [wait] is now the waiting execution.
+ */
+class Sync {
+ Completer? _completer = null;
+ // Release whoever is currently waiting and start waiting yourself.
+ Future wait([v]) {
+ _completer?.complete(v);
+ _completer = new Completer();
+ return _completer!.future;
+ }
+
+ // Release whoever is currently waiting.
+ void release([v]) {
+ _completer?.complete(v);
+ _completer = null;
+ }
+}
diff --git a/tests/language/async_star/concat_test.dart b/tests/language/async_star/concat_test.dart
new file mode 100644
index 0000000..222e3cf
--- /dev/null
+++ b/tests/language/async_star/concat_test.dart
@@ -0,0 +1,29 @@
+// 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:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+range(start, end) async* {
+ for (int i = start; i < end; i++) {
+ yield i;
+ }
+}
+
+concat(a, b) async* {
+ yield* a;
+ yield* b;
+}
+
+test() async {
+ Expect.listEquals(
+ [1, 2, 3, 11, 12, 13], await concat(range(1, 4), range(11, 14)).toList());
+}
+
+main() {
+ asyncStart();
+ test().then((_) {
+ asyncEnd();
+ });
+}
diff --git a/tests/language/async_star/covariant_type_test.dart b/tests/language/async_star/covariant_type_test.dart
new file mode 100644
index 0000000..836daf0
--- /dev/null
+++ b/tests/language/async_star/covariant_type_test.dart
@@ -0,0 +1,20 @@
+// 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 that TypeErrors for async* methods happen without using returned Stream.
+
+import 'dart:async';
+import 'package:expect/expect.dart';
+
+class D<T> {
+ // Parametric covariance check is usually compiled into method.
+ Stream<T> add(T n) async* {
+ yield n;
+ }
+}
+
+main() async {
+ D<num> d = new D<int>();
+ Expect.throwsTypeError(() => d.add(4.6));
+}
diff --git a/tests/language/async_star/dcall_type_test.dart b/tests/language/async_star/dcall_type_test.dart
new file mode 100644
index 0000000..1330a6d
--- /dev/null
+++ b/tests/language/async_star/dcall_type_test.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.
+
+// Test that TypeErrors for async* methods happen without using returned Stream.
+
+import 'dart:async';
+import 'package:expect/expect.dart';
+
+Stream<int> iota(int n) async* {
+ yield n;
+}
+
+class C {
+ Stream<int> add(int n) async* {
+ yield n;
+ }
+}
+
+main() async {
+ dynamic f = iota;
+ Expect.throwsTypeError(() => f('ten'));
+ Expect.throwsTypeError(() => f(4.7));
+
+ dynamic o = new C();
+ Expect.throwsTypeError(() => o.add('ten'));
+ Expect.throwsTypeError(() => o.add(4.7));
+}
diff --git a/tests/language/async_star/error_test.dart b/tests/language/async_star/error_test.dart
new file mode 100644
index 0000000..dc06e5a
--- /dev/null
+++ b/tests/language/async_star/error_test.dart
@@ -0,0 +1,33 @@
+// 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 "dart:async";
+import "package:async_helper/async_minitest.dart";
+
+/// Tests for exceptions raised in async*
+main() {
+ test('async* with Stream.first should complete with an error', () async {
+ var expectedStack;
+ Stream<int> foo() async* {
+ try {
+ throw 'oops';
+ } catch (e, s) {
+ expectedStack = s;
+ try {
+ throw 'oops again!';
+ } catch (e2, _) {}
+ await new Future.error(e, s);
+ }
+ yield 42;
+ }
+
+ try {
+ await foo().first;
+ fail('should not get here, an error should be thrown');
+ } catch (e, s) {
+ expect(e, 'oops');
+ expect(s, expectedStack);
+ }
+ });
+}
diff --git a/tests/language/async_star/loops_test.dart b/tests/language/async_star/loops_test.dart
new file mode 100644
index 0000000..8d6df7c
--- /dev/null
+++ b/tests/language/async_star/loops_test.dart
@@ -0,0 +1,100 @@
+// Copyright (c) 2020, 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:async_helper/async_minitest.dart';
+
+import 'utils.dart';
+
+main() {
+ test('simple yield', () {
+ f() async* {
+ for (int i = 0; i < 3; i++) {
+ yield i;
+ }
+ }
+
+ return expectList(f(), [0, 1, 2]);
+ });
+
+ test('yield in double loop', () {
+ f() async* {
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 2; j++) {
+ yield i * 2 + j;
+ }
+ }
+ }
+
+ return expectList(f(), [0, 1, 2, 3, 4, 5]);
+ });
+
+ test('yield in try body', () {
+ var list = [];
+ f() async* {
+ for (int i = 0; i < 3; i++) {
+ try {
+ yield i;
+ } finally {
+ list.add('$i');
+ }
+ }
+ }
+
+ return expectList(f(), [0, 1, 2]).whenComplete(() {
+ expect(list, equals(['0', '1', '2']));
+ });
+ });
+
+ test('yield in catch', () {
+ var list = [];
+ f() async* {
+ for (int i = 0; i < 3; i++) {
+ try {
+ throw i;
+ } catch (e) {
+ yield e;
+ } finally {
+ list.add('$i');
+ }
+ }
+ }
+
+ return expectList(f(), [0, 1, 2]).whenComplete(() {
+ expect(list, equals(['0', '1', '2']));
+ });
+ });
+
+ test('yield in finally', () {
+ var list = [];
+ f() async* {
+ for (int i = 0; i < 3; i++) {
+ try {
+ throw i;
+ } finally {
+ yield i;
+ list.add('$i');
+ continue;
+ }
+ }
+ }
+
+ return expectList(f(), [0, 1, 2]).whenComplete(() {
+ expect(list, equals(['0', '1', '2']));
+ });
+ });
+
+ test('keep yielding after cancel', () {
+ f() async* {
+ for (int i = 0; i < 10; i++) {
+ try {
+ yield i;
+ } finally {
+ continue;
+ }
+ }
+ }
+
+ return expectList(f().take(3), [0, 1, 2]);
+ });
+}
diff --git a/tests/language/async_star/no_cancel2_test.dart b/tests/language/async_star/no_cancel2_test.dart
new file mode 100644
index 0000000..d98b158
--- /dev/null
+++ b/tests/language/async_star/no_cancel2_test.dart
@@ -0,0 +1,59 @@
+// 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:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+var events = [];
+
+var timer;
+ticker(period) async* {
+ var sc;
+ sc = new StreamController(onListen: () {
+ events.add("listen");
+ timer = new Timer.periodic(period, (_) {
+ sc.add(null);
+ });
+ }, onCancel: () {
+ events.add("cancel");
+ timer.cancel();
+ });
+
+ try {
+ var counter = 0;
+ await for (var tick in sc.stream) {
+ counter++;
+ }
+ } finally {
+ events.add("finally");
+ }
+}
+
+void main() {
+ asyncStart();
+ events.add("main");
+ final subscription =
+ ticker(const Duration(milliseconds: 20)).listen((val) {});
+
+ bool cancelFinished = false;
+ new Timer(const Duration(milliseconds: 100), () async {
+ // Despite the cancel call below, the stream doesn't stop.
+ // The async* function is not blocked at any await (since the inner timer
+ // continuously ticks), but since there/ is no yield-point in the function
+ // it won't cancel.
+ new Timer(const Duration(milliseconds: 30), () {
+ Expect.isFalse(cancelFinished);
+ Expect.listEquals(["main", "listen", "invoke cancel"], events);
+ timer.cancel();
+ asyncEnd();
+ });
+
+ events.add("invoke cancel");
+ await subscription.cancel();
+ // This line should never be reached, since the cancel-future doesn't
+ // complete.
+ cancelFinished = true;
+ });
+}
diff --git a/tests/language/async_star/no_cancel_test.dart b/tests/language/async_star/no_cancel_test.dart
new file mode 100644
index 0000000..453005f
--- /dev/null
+++ b/tests/language/async_star/no_cancel_test.dart
@@ -0,0 +1,49 @@
+// 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:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+var events = [];
+
+ticker() async* {
+ var sc;
+ var sentTickCount = 0;
+ sc = new StreamController(onListen: () {
+ events.add("listen");
+ }, onCancel: () {
+ events.add("cancel");
+ });
+
+ try {
+ var counter = 0;
+ await for (var tick in sc.stream) {
+ counter++;
+ }
+ } finally {
+ events.add("finally");
+ }
+}
+
+void main() {
+ asyncStart();
+ events.add("main");
+ final subscription = ticker().listen((val) {});
+
+ bool cancelFinished = false;
+ // Cancel the subscription.
+ // The async* function is blocked on an `await` (the inner stream) and won't
+ // be able to complete.
+ Timer.run(() {
+ events.add("invoke cancel");
+ subscription.cancel().then((_) => cancelFinished = true);
+ });
+
+ new Timer(const Duration(milliseconds: 100), () {
+ Expect.isFalse(cancelFinished);
+ Expect.listEquals(["main", "listen", "invoke cancel"], events);
+ asyncEnd();
+ });
+}
diff --git a/tests/language/async_star/pause_test.dart b/tests/language/async_star/pause_test.dart
new file mode 100644
index 0000000..4950e89
--- /dev/null
+++ b/tests/language/async_star/pause_test.dart
@@ -0,0 +1,46 @@
+// 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 async_star_pause_test;
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "dart:async";
+
+main() {
+ // await for pauses stream during body.
+ asyncTest(() async {
+ // Assumes await-for uses streamIterator.
+ var log = [];
+ var s = () async* {
+ for (int i = 0; i < 3; i++) {
+ log.add("$i-");
+ yield i;
+ // Should pause here until next iteration of await-for loop.
+ log.add("$i+");
+ }
+ }();
+ await for (var i in s) {
+ log.add("$i?");
+ await nextMicrotask();
+ log.add("$i!");
+ }
+ Expect.listEquals([
+ "0-",
+ "0?",
+ "0!",
+ "0+",
+ "1-",
+ "1?",
+ "1!",
+ "1+",
+ "2-",
+ "2?",
+ "2!",
+ "2+"
+ ], log);
+ });
+}
+
+Future nextMicrotask() => new Future.microtask(() {});
diff --git a/tests/language/async_star/pause_test2.dart b/tests/language/async_star/pause_test2.dart
new file mode 100644
index 0000000..a240d3d
--- /dev/null
+++ b/tests/language/async_star/pause_test2.dart
@@ -0,0 +1,99 @@
+// Copyright (c) 2020, 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:async';
+
+import 'package:async_helper/async_minitest.dart';
+
+import 'utils.dart';
+
+main() {
+ test('pauses execution at yield for at least a microtask', () {
+ var list = [];
+ f() async* {
+ list.add(1);
+ yield 2;
+ list.add(3);
+ yield 4;
+ list.add(5);
+ }
+
+ var done = Completer();
+ var sub = f().listen((v) {
+ if (v == 2) {
+ expect(list, equals([1]));
+ } else if (v == 4) {
+ expect(list, equals([1, 3]));
+ } else {
+ fail('Unexpected value $v');
+ }
+ }, onDone: () {
+ expect(list, equals([1, 3, 5]));
+ done.complete();
+ });
+ return done.future;
+ });
+
+ test('pause stops execution at yield', () {
+ var list = [];
+ f() async* {
+ list.add(1);
+ yield 2;
+ list.add(3);
+ yield 4;
+ list.add(5);
+ }
+
+ var done = Completer();
+ var sub;
+ sub = f().listen((v) {
+ if (v == 2) {
+ expect(list, equals([1]));
+ sub.pause();
+ Timer(ms * 300, () {
+ expect(list.length, lessThan(3));
+ sub.resume();
+ });
+ } else if (v == 4) {
+ expect(list, equals([1, 3]));
+ } else {
+ fail('Unexpected value $v');
+ }
+ }, onDone: () {
+ expect(list, equals([1, 3, 5]));
+ done.complete();
+ });
+ return done.future;
+ });
+
+ test('pause stops execution at yield 2', () {
+ var list = [];
+ f() async* {
+ int i = 0;
+ while (true) {
+ yield i;
+ list.add(i);
+ i++;
+ }
+ }
+
+ int expected = 0;
+ var done = Completer();
+ var sub;
+ sub = f().listen((v) {
+ expect(v, equals(expected++));
+ if (v % 5 == 0) {
+ sub.pause(Future.delayed(ms * 300));
+ } else if (v == 17) {
+ sub.cancel();
+ done.complete();
+ }
+ }, onDone: () {
+ fail('Unexpected done!');
+ });
+ return done.future.whenComplete(() {
+ expect(list.length == 18 || list.length == 19, isTrue);
+ });
+ });
+}
diff --git a/tests/language/async_star/regression_2238_test.dart b/tests/language/async_star/regression_2238_test.dart
new file mode 100644
index 0000000..9cfffa6
--- /dev/null
+++ b/tests/language/async_star/regression_2238_test.dart
@@ -0,0 +1,22 @@
+// 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.
+
+// This is a regression test for issue 2238
+import "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+main() {
+ f() async* {
+ label1:
+ label2:
+ yield 0;
+ }
+
+ asyncStart();
+ f().toList().then((list) {
+ Expect.listEquals([0], list);
+ asyncEnd();
+ });
+}
diff --git a/tests/language/async_star/regression_23116_test.dart b/tests/language/async_star/regression_23116_test.dart
new file mode 100644
index 0000000..d1c6390
--- /dev/null
+++ b/tests/language/async_star/regression_23116_test.dart
@@ -0,0 +1,33 @@
+// 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.
+
+// Regression test for https://code.google.com/p/dart/issues/detail?id=23116
+
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+import 'dart:async';
+
+Stream<int> foo(Completer completer, Future future) async* {
+ completer.complete(100);
+ int x = await future;
+ Expect.equals(42, x);
+}
+
+test() async {
+ Completer completer1 = new Completer();
+ Completer completer2 = new Completer();
+ StreamSubscription s = foo(completer1, completer2.future).listen((v) => null);
+ await completer1.future;
+ // At this moment foo is waiting on the given future.
+ s.pause();
+ // Ensure that execution of foo is not resumed - the future is not completed
+ // yet.
+ s.resume();
+ completer2.complete(42);
+}
+
+main() {
+ asyncStart();
+ test().then((_) => asyncEnd());
+}
diff --git a/tests/language/async_star/regression_fisk_test.dart b/tests/language/async_star/regression_fisk_test.dart
new file mode 100644
index 0000000..b8b97f5
--- /dev/null
+++ b/tests/language/async_star/regression_fisk_test.dart
@@ -0,0 +1,59 @@
+// 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.
+
+// This test may crash dart2js.
+
+import "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+main() {
+ var res = [];
+ Stream<int> fisk() async* {
+ res.add("+fisk");
+ try {
+ for (int i = 0; i < 2; i++) {
+ yield await new Future.microtask(() => i);
+ }
+ } finally {
+ res.add("-fisk");
+ }
+ }
+
+ fugl(int count) async {
+ res.add("fisk $count");
+ try {
+ await for (int i in fisk().take(count)) res.add(i);
+ } finally {
+ res.add("done");
+ }
+ }
+
+ asyncStart();
+ fugl(3)
+ .whenComplete(() => fugl(2))
+ .whenComplete(() => fugl(1))
+ .whenComplete(() {
+ Expect.listEquals([
+ "fisk 3",
+ "+fisk",
+ 0,
+ 1,
+ "-fisk",
+ "done",
+ "fisk 2",
+ "+fisk",
+ 0,
+ 1,
+ "-fisk",
+ "done",
+ "fisk 1",
+ "+fisk",
+ 0,
+ "-fisk",
+ "done"
+ ], res);
+ asyncEnd();
+ });
+}
diff --git a/tests/language/async_star/stream_take_test.dart b/tests/language/async_star/stream_take_test.dart
new file mode 100644
index 0000000..2a3a0d9
--- /dev/null
+++ b/tests/language/async_star/stream_take_test.dart
@@ -0,0 +1,25 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+Stream<int> makeStream(int n) async* {
+ for (int i = 0; i < n; i++) yield i;
+}
+
+main() {
+ f(Stream<int> s) async {
+ var r = 0;
+ await for (var v in s.take(5)) r += v;
+ return r;
+ }
+
+ asyncStart();
+ f(makeStream(10)).then((v) {
+ Expect.equals(10, v);
+ asyncEnd();
+ });
+}
diff --git a/tests/language/async_star/take_reyield_test.dart b/tests/language/async_star/take_reyield_test.dart
new file mode 100644
index 0000000..fe21ddb
--- /dev/null
+++ b/tests/language/async_star/take_reyield_test.dart
@@ -0,0 +1,28 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+expectList(actualStream, expectedList) {
+ return actualStream.toList().then((v) {
+ Expect.listEquals(expectedList, v);
+ });
+}
+
+Stream<int> makeStream(int n) async* {
+ for (int i = 0; i < n; i++) yield i;
+}
+
+main() {
+ fivePartialSums(Stream<int> s) async* {
+ var r = 0;
+ await for (var v in s.take(5)) yield r += v;
+ }
+
+ asyncStart();
+ expectList(fivePartialSums(makeStream(10)), [0, 1, 3, 6, 10])
+ .then(asyncSuccess);
+}
diff --git a/tests/language/async_star/throw_in_catch_test.dart b/tests/language/async_star/throw_in_catch_test.dart
new file mode 100644
index 0000000..88982e5
--- /dev/null
+++ b/tests/language/async_star/throw_in_catch_test.dart
@@ -0,0 +1,126 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+class Tracer {
+ final String expected;
+ String _trace = "";
+ int counter = 0;
+
+ Tracer(this.expected);
+
+ void trace(msg) {
+ _trace += msg;
+ counter++;
+ }
+
+ void done() {
+ Expect.equals(expected, _trace);
+ }
+}
+
+foo1(Tracer tracer) async* {
+ try {
+ tracer.trace("a");
+ await new Future.value(3);
+ tracer.trace("b");
+ throw "Error";
+ } catch (e) {
+ Expect.equals("Error", e);
+ tracer.trace("c");
+ yield 1;
+ tracer.trace("d");
+ yield 2;
+ tracer.trace("e");
+ yield 3;
+ tracer.trace("f");
+ } finally {
+ tracer.trace("g");
+ }
+ tracer.trace("h");
+}
+
+foo2(Tracer tracer) async* {
+ try {
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ Expect.equals("Error", error);
+ tracer.trace("b");
+ rethrow;
+ } finally {
+ tracer.trace("c");
+ }
+}
+
+foo3(Tracer tracer) async* {
+ try {
+ tracer.trace("a");
+ throw "Error";
+ } catch (error) {
+ Expect.equals("Error", error);
+ tracer.trace("b");
+ rethrow;
+ } finally {
+ tracer.trace("c");
+ yield 1;
+ }
+}
+
+foo4(Tracer tracer) async* {
+ try {
+ tracer.trace("a");
+ await new Future.value(3);
+ tracer.trace("b");
+ throw "Error";
+ } catch (e) {
+ Expect.equals("Error", e);
+ tracer.trace("c");
+ yield 1;
+ tracer.trace("d");
+ yield 2;
+ tracer.trace("e");
+ await new Future.error("Error2");
+ } finally {
+ tracer.trace("f");
+ }
+ tracer.trace("g");
+}
+
+runTest(test, expectedTrace, expectedError, shouldCancel) {
+ Tracer tracer = new Tracer(expectedTrace);
+ Completer done = new Completer();
+ var subscription;
+ subscription = test(tracer).listen((event) async {
+ tracer.trace("Y");
+ if (shouldCancel) {
+ await subscription.cancel();
+ tracer.trace("C");
+ done.complete(null);
+ }
+ }, onError: (error) {
+ Expect.equals(expectedError, error);
+ tracer.trace("X");
+ }, onDone: () {
+ tracer.done();
+ done.complete(null);
+ });
+ return done.future.then((_) => tracer.done());
+}
+
+test() async {
+ // TODO(sigurdm): These tests are too dependent on scheduling, and buffering
+ // behavior.
+ await runTest(foo1, "abcYdgC", null, true);
+ await runTest(foo2, "abcX", "Error", false);
+ await runTest(foo3, "abcYX", "Error", false);
+ await runTest(foo4, "abcYdYefX", "Error2", false);
+}
+
+void main() {
+ asyncTest(test);
+}
diff --git a/tests/language/async_star/utils.dart b/tests/language/async_star/utils.dart
new file mode 100644
index 0000000..29359aa
--- /dev/null
+++ b/tests/language/async_star/utils.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2020, 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:async';
+
+import 'package:async_helper/async_minitest.dart';
+
+const ms = const Duration(milliseconds: 1);
+
+/// Allows two asynchronous executions to synchronize.
+///
+/// Calling [wait] and waiting for the returned future to complete will wait for
+/// the other executions to call [wait] again. At that point, the waiting
+/// execution is allowed to continue (the returned future completes), and the
+/// more resent call to [wait] is now the waiting execution.
+class Sync {
+ Completer? _completer = null;
+ // Release whoever is currently waiting and start waiting yourself.
+ Future wait([v]) {
+ _completer?.complete(v);
+ _completer = Completer();
+ return _completer!.future;
+ }
+
+ // Release whoever is currently waiting.
+ void release([v]) {
+ _completer?.complete(v);
+ _completer = null;
+ }
+}
+
+expectList(stream, list) {
+ return stream.toList().then((v) {
+ expect(v, equals(list));
+ });
+}
+
+Stream<int> mkStream(int n) async* {
+ for (int i = 0; i < n; i++) yield i;
+}
diff --git a/tests/language/async_star/yield_expressions_test.dart b/tests/language/async_star/yield_expressions_test.dart
new file mode 100644
index 0000000..fe3578e
--- /dev/null
+++ b/tests/language/async_star/yield_expressions_test.dart
@@ -0,0 +1,177 @@
+// Copyright (c) 2020, 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:async_helper/async_minitest.dart';
+
+import 'utils.dart';
+
+main() {
+ test('local variable', () {
+ f() async* {
+ var x = 42;
+ yield x;
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('constant variable', () {
+ f() async* {
+ const x = 42;
+ yield x;
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('function call', () {
+ g() => 42;
+ f() async* {
+ yield g();
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('unary operator', () {
+ f() async* {
+ var x = -42;
+ yield -x;
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('binary operator', () {
+ f() async* {
+ var x = 21;
+ yield x + x;
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('ternary operator', () {
+ f() async* {
+ var x = 21;
+ yield x == 21 ? x + x : x;
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('suffix post-increment', () {
+ f() async* {
+ var x = 42;
+ yield x++;
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('suffix pre-increment', () {
+ f() async* {
+ var x = 41;
+ yield ++x;
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('assignment', () {
+ f() async* {
+ var x = 37;
+ yield x = 42;
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('assignment op', () {
+ f() async* {
+ var x = 41;
+ yield x += 1;
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('await', () {
+ f() async* {
+ yield await Future.value(42);
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('index operator', () {
+ f() async* {
+ var x = [42];
+ yield x[0];
+ }
+
+ return expectList(f(), [42]);
+ });
+
+ test('function expression block', () {
+ var o = Object();
+ f() async* {
+ yield () {
+ return o;
+ };
+ }
+
+ return f().first.then((v) {
+ expect(v(), same(o));
+ });
+ });
+
+ test('function expression arrow', () {
+ var o = Object();
+ f() async* {
+ yield () => o;
+ }
+
+ return f().first.then((v) {
+ expect(v(), same(o));
+ });
+ });
+
+ test('function expression block async', () {
+ var o = Object();
+ f() async* {
+ yield () async {
+ return o;
+ };
+ }
+
+ return f().first.then((v) => v()).then((v) {
+ expect(v, same(o));
+ });
+ });
+
+ test('function expression arrow async', () {
+ var o = Object();
+ f() async* {
+ yield () async => o;
+ }
+
+ return f().first.then((v) => v()).then((v) {
+ expect(v, same(o));
+ });
+ });
+
+ test('function expression block async*', () {
+ var o = Object();
+ f() async* {
+ yield () async* {
+ yield o;
+ };
+ }
+
+ return f().first.then((v) => v().first).then((v) {
+ expect(v, same(o));
+ });
+ });
+}
diff --git a/tests/language/async_star/yield_statement_context_test.dart b/tests/language/async_star/yield_statement_context_test.dart
new file mode 100644
index 0000000..7320f02
--- /dev/null
+++ b/tests/language/async_star/yield_statement_context_test.dart
@@ -0,0 +1,207 @@
+// Copyright (c) 2020, 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:async_helper/async_minitest.dart';
+
+import 'utils.dart';
+
+void main() {
+ test('plain', () {
+ f() async* {
+ yield 0;
+ }
+
+ return expectList(f(), [0]);
+ });
+
+ test('if-then-else', () {
+ f(b) async* {
+ if (b)
+ yield 0;
+ else
+ yield 1;
+ }
+
+ return expectList(f(true), [0]).whenComplete(() {
+ expectList(f(false), [1]);
+ });
+ });
+
+ test('block', () {
+ f() async* {
+ yield 0;
+ {
+ yield 1;
+ }
+ yield 2;
+ }
+
+ return expectList(f(), [0, 1, 2]);
+ });
+
+ test('labeled', () {
+ f() async* {
+ label1:
+ yield 0;
+ }
+
+ return expectList(f(), [0]);
+ });
+
+ test('two labels on same line', () {
+ f() async* {
+ // DO NOT RUN dartfmt on this file. The labels should be on the same.
+ // line. Originally VM issue #2238.
+ label1: label2: yield 0;
+ }
+
+ return expectList(f(), [0]);
+ });
+
+ test('for-loop', () {
+ f() async* {
+ for (int i = 0; i < 3; i++) yield i;
+ }
+
+ return expectList(f(), [0, 1, 2]);
+ });
+
+ test('for-in-loop', () {
+ f() async* {
+ for (var i in [0, 1, 2]) yield i;
+ }
+
+ return expectList(f(), [0, 1, 2]);
+ });
+
+ test('await for-in-loop', () {
+ f() async* {
+ await for (var i in Stream.fromIterable([0, 1, 2])) yield i;
+ }
+
+ return expectList(f(), [0, 1, 2]);
+ });
+
+ test('while-loop', () {
+ f() async* {
+ int i = 0;
+ while (i < 3) yield i++;
+ }
+
+ return expectList(f(), [0, 1, 2]);
+ });
+
+ test('do-while-loop', () {
+ f() async* {
+ int i = 0;
+ do yield i++; while (i < 3);
+ }
+
+ return expectList(f(), [0, 1, 2]);
+ });
+
+ test('try-catch-finally', () {
+ f() async* {
+ try {
+ yield 0;
+ } catch (e) {
+ yield 1;
+ } finally {
+ yield 2;
+ }
+ }
+
+ return expectList(f(), [0, 2]);
+ });
+
+ test('try-catch-finally 2', () {
+ f() async* {
+ try {
+ yield throw 0;
+ } catch (e) {
+ yield 1;
+ } finally {
+ yield 2;
+ }
+ }
+
+ return expectList(f(), [1, 2]);
+ });
+
+ test('switch-case', () {
+ f(v) async* {
+ switch (v) {
+ case 0:
+ yield 0;
+ continue label1;
+ label1:
+ case 1:
+ yield 1;
+ break;
+ default:
+ yield 2;
+ }
+ }
+
+ return expectList(f(0), [0, 1]).whenComplete(() {
+ return expectList(f(1), [1]);
+ }).whenComplete(() {
+ return expectList(f(2), [2]);
+ });
+ });
+
+ test('dead-code return', () {
+ f() async* {
+ return;
+ yield 1;
+ }
+
+ return expectList(f(), []);
+ });
+
+ test('dead-code throw', () {
+ f() async* {
+ try {
+ throw 0;
+ yield 1;
+ } catch (_) {}
+ }
+
+ return expectList(f(), []);
+ });
+
+ test('dead-code break', () {
+ f() async* {
+ while (true) {
+ break;
+ yield 1;
+ }
+ }
+
+ return expectList(f(), []);
+ });
+
+ test('dead-code break 2', () {
+ f() async* {
+ label:
+ {
+ break label;
+ yield 1;
+ }
+ }
+
+ return expectList(f(), []);
+ });
+
+ test('dead-code continue', () {
+ f() async* {
+ do {
+ continue;
+ yield 1;
+ } while (false);
+ }
+
+ return expectList(f(), []);
+ });
+}
diff --git a/tests/language/async_star/yield_test.dart b/tests/language/async_star/yield_test.dart
new file mode 100644
index 0000000..797de63
--- /dev/null
+++ b/tests/language/async_star/yield_test.dart
@@ -0,0 +1,76 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+Stream<int> foo1() async* {
+ yield 1;
+ var p = await new Future.value(10);
+ yield p + 10;
+}
+
+Stream<int> foo2() async* {
+ int i = 0;
+ while (true) {
+ await (new Future.delayed(new Duration(milliseconds: 0), () {}));
+ if (i > 10) return;
+ yield i;
+ i++;
+ }
+}
+
+Stream<int?> foo3(p) async* {
+ int i = 0;
+ bool t = false;
+ yield null;
+ while (true) {
+ i++;
+ a:
+ for (int i = 0; i < p; i++) {
+ if (!t) {
+ for (int j = 0; j < 3; j++) {
+ yield -1;
+ t = true;
+ break a;
+ }
+ }
+ await 4;
+ yield i;
+ }
+ }
+}
+
+Completer<bool> finalized = new Completer<bool>();
+
+Stream<int> foo4() async* {
+ int i = 0;
+ try {
+ while (true) {
+ yield i;
+ i++;
+ }
+ } finally {
+ // Canceling the stream-subscription should run the finalizer.
+ finalized.complete(true);
+ }
+}
+
+test() async {
+ Expect.listEquals([1, 20], await (foo1().toList()));
+ Expect.listEquals([0, 1, 2, 3], await (foo2().take(4).toList()));
+ Expect.listEquals(
+ [null, -1, 0, 1, 2, 3, 0, 1, 2, 3], await (foo3(4).take(10).toList()));
+ Expect.listEquals(
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], await (foo4().take(10).toList()));
+ Expect.isTrue(await (finalized.future));
+}
+
+main() {
+ asyncStart();
+ test().then((_) {
+ asyncEnd();
+ });
+}
diff --git a/tests/language/async_star/yieldstar_test.dart b/tests/language/async_star/yieldstar_test.dart
new file mode 100644
index 0000000..e28c0de
--- /dev/null
+++ b/tests/language/async_star/yieldstar_test.dart
@@ -0,0 +1,99 @@
+// 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 "dart:async";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+Stream<int> subStream(int p) async* {
+ yield p;
+ yield p + 1;
+}
+
+Stream foo(Completer<bool> finalized) async* {
+ int i = 0;
+ try {
+ while (true) {
+ yield "outer";
+ yield* subStream(i);
+ i++;
+ }
+ } finally {
+ // See that we did not run too many iterations.
+ Expect.isTrue(i < 10);
+ // Canceling the stream-subscription should run the finalizer.
+ finalized.complete(true);
+ }
+}
+
+foo2(Stream subStream) async* {
+ yield* subStream;
+}
+
+test() async {
+ Expect.listEquals([0, 1], await (subStream(0).toList()));
+ Completer<bool> finalized = new Completer<bool>();
+ Expect.listEquals(["outer", 0, 1, "outer", 1, 2, "outer", 2],
+ await (foo(finalized).take(8).toList()));
+ Expect.isTrue(await (finalized.future));
+
+ finalized = new Completer<bool>();
+ // Canceling the stream while it is yield*-ing from the sub-stream.
+ Expect.listEquals(["outer", 0, 1, "outer", 1, 2, "outer"],
+ await (foo(finalized).take(7).toList()));
+ Expect.isTrue(await (finalized.future));
+ finalized = new Completer<bool>();
+
+ Completer<bool> pausedCompleter = new Completer<bool>();
+ Completer<bool> resumedCompleter = new Completer<bool>();
+ Completer<bool> canceledCompleter = new Completer<bool>();
+
+ late StreamController controller;
+ int i = 0;
+ addNext() {
+ if (i >= 10) return;
+ controller.add(i);
+ i++;
+ if (!controller.isPaused) {
+ scheduleMicrotask(addNext);
+ }
+ }
+
+ controller = new StreamController(onListen: () {
+ scheduleMicrotask(addNext);
+ }, onPause: () {
+ pausedCompleter.complete(true);
+ }, onResume: () {
+ resumedCompleter.complete(true);
+ scheduleMicrotask(addNext);
+ }, onCancel: () {
+ canceledCompleter.complete(true);
+ });
+
+ late StreamSubscription subscription;
+ // Test that the yield*'ed stream is paused and resumed.
+ subscription = foo2(controller.stream).listen((event) {
+ if (event == 2) {
+ subscription.pause();
+ scheduleMicrotask(() {
+ subscription.resume();
+ });
+ }
+ if (event == 5) {
+ subscription.cancel();
+ }
+ });
+ // Test that the yield*'ed streamSubscription is paused, resumed and canceled
+ // by the async* stream.
+ Expect.isTrue(await pausedCompleter.future);
+ Expect.isTrue(await resumedCompleter.future);
+ Expect.isTrue(await canceledCompleter.future);
+}
+
+main() {
+ asyncStart();
+ test().then((_) {
+ asyncEnd();
+ });
+}
diff --git a/tests/language/instantiate_to_bound/README.md b/tests/language/instantiate_to_bound/README.md
new file mode 100644
index 0000000..0c24c51
--- /dev/null
+++ b/tests/language/instantiate_to_bound/README.md
@@ -0,0 +1,12 @@
+# Feature tests for instantiation to bounds, and super-bounded types
+
+This directory was created in order to hold tests pertaining to the
+Dart feature _instantiate to bound_, which provides inference of
+default values for omitted type arguments. In order to handle
+F-bounded type parameters without introducing infinite types, this
+feature relies on another feature, _super-bounded types_, which is
+therefore also in focus for tests in this directory. For more details,
+please check the feature specifications on
+[super-bounded types](https://github.com/dart-lang/sdk/blob/master/docs/language/informal/super-bounded-types.md)
+and on
+[instantiate to bound](https://github.com/dart-lang/sdk/blob/master/docs/language/informal/instantiate-to-bound.md).
\ No newline at end of file
diff --git a/tests/language/instantiate_to_bound/issue40764_test.dart b/tests/language/instantiate_to_bound/issue40764_test.dart
new file mode 100644
index 0000000..1a0ed8f
--- /dev/null
+++ b/tests/language/instantiate_to_bound/issue40764_test.dart
@@ -0,0 +1,5 @@
+class A<X extends A<X>> {}
+
+A get g => throw 0;
+
+main() {}
diff --git a/tests/language/language_kernel.status b/tests/language/language_kernel.status
index 8ca708b..f867681 100644
--- a/tests/language/language_kernel.status
+++ b/tests/language/language_kernel.status
@@ -12,8 +12,6 @@
number/web_int_literals_test/*: SkipByDesign # Test applies only to JavaScript targets
[ $compiler == fasta ]
-async/await_syntax_test/e5: Crash # Assertion error: continuation.dart: Failed assertion: 'node.expression == null || node.expression is NullLiteral': is not true.
-async/await_syntax_test/e6: Crash # Assertion error: continuation.dart: Failed assertion: 'node.expression == null || node.expression is NullLiteral': is not true.
number/web_int_literals_test/*: SkipByDesign # Test applies only to JavaScript targets
[ $fasta ]
diff --git a/tests/language/nnbd/required_named_parameters/required_named_args_legacy_test.dart b/tests/language/nnbd/required_named_parameters/required_named_args_legacy_test.dart
new file mode 100644
index 0000000..8dee572
--- /dev/null
+++ b/tests/language/nnbd/required_named_parameters/required_named_args_legacy_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2020, 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.
+
+// @dart = 2.6
+
+// Requirements=nnbd-weak
+// Tests runtime type semantics for functions with required named parameters
+// imported into a legacy library from an opted-in library.
+import 'package:expect/expect.dart';
+import 'required_named_args_lib.dart';
+
+main() {
+ dynamic f = func;
+
+ // Valid: Invocation with all arguments provided.
+ f("", p1: 100, p2: "", p3: true);
+
+ // Valid: Invocation that omits non-required named arguments.
+ f("", p1: 100, p2: "");
+
+ // Valid: Invocation may pass null as a required named argument.
+ f("", p1: null, p2: null);
+
+ // Valid: Invocation may omit a required named argument.
+ f("", p1: 100);
+}
diff --git a/tests/language/nnbd/required_named_parameters/required_named_args_lib.dart b/tests/language/nnbd/required_named_parameters/required_named_args_lib.dart
new file mode 100644
index 0000000..ba5b79d
--- /dev/null
+++ b/tests/language/nnbd/required_named_parameters/required_named_args_lib.dart
@@ -0,0 +1,5 @@
+// Copyright (c) 2020, 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.
+
+func(String q0, {bool p3 = false, required int p1, required String p2}) => "";
diff --git a/tests/language/nnbd/required_named_parameters/required_named_args_strong_test.dart b/tests/language/nnbd/required_named_parameters/required_named_args_strong_test.dart
new file mode 100644
index 0000000..c066411
--- /dev/null
+++ b/tests/language/nnbd/required_named_parameters/required_named_args_strong_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2020, 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.
+
+// Requirements=nnbd-strong
+// Tests runtime type semantics for functions with required named parameters
+// in strong mode.
+import 'package:expect/expect.dart';
+import 'required_named_args_lib.dart';
+
+main() {
+ dynamic f = func;
+
+ // Invalid: Subtype may not redeclare optional parameters as required.
+ Expect.throws(() {
+ Function(
+ String p0, {
+ required int p1,
+ String p2,
+ }) t2 = f;
+ });
+
+ // Invalid: Subtype may not declare new required named parameters.
+ Expect.throws(() {
+ Function(
+ String p0, {
+ required int p1,
+ }) t3 = f;
+ });
+
+ // Invalid: Invocation with explicit null required named argument.
+ Expect.throws(() {
+ f("", p1: null, p2: null);
+ });
+
+ // Invalid: Invocation that omits a required named argument.
+ Expect.throws(() {
+ f("", p1: 100);
+ });
+}
diff --git a/tests/language/nnbd/required_named_parameters/required_named_args_test.dart b/tests/language/nnbd/required_named_parameters/required_named_args_test.dart
new file mode 100644
index 0000000..c6c6f68
--- /dev/null
+++ b/tests/language/nnbd/required_named_parameters/required_named_args_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2020, 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 runtime type semantics for functions with required named parameters
+// in strong and weak mode.
+import 'package:expect/expect.dart';
+import 'required_named_args_lib.dart';
+
+main() {
+ dynamic f = func;
+
+ // Valid: Subtype may contain additional named optional parameters.
+ Function(String p0, {required int p1, required String p2}) t0 = f;
+
+ // Valid: Subtype may redeclare required named parameters as optional.
+ Function(String p0, {required int p1, required String p2, required bool p3})
+ t1 = f;
+
+ // Valid: Invocation with all arguments provided.
+ f("", p1: 100, p2: "", p3: true);
+
+ // Valid: Invocation that omits non-required named arguments.
+ f("", p1: 100, p2: "");
+}
diff --git a/tests/language/nnbd/required_named_parameters/required_named_args_weak_test.dart b/tests/language/nnbd/required_named_parameters/required_named_args_weak_test.dart
new file mode 100644
index 0000000..5468b69
--- /dev/null
+++ b/tests/language/nnbd/required_named_parameters/required_named_args_weak_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2020, 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.
+
+// Requirements=nnbd-weak
+// Tests runtime type semantics for functions with required named parameters
+// in weak mode.
+import 'package:expect/expect.dart';
+import 'required_named_args_lib.dart';
+
+main() {
+ dynamic f = func;
+
+ // Valid: Subtype may redeclare optional parameters as required in weak mode.
+ Function(
+ String p0, {
+ required int p1,
+ String p2,
+ }) t2 = f;
+
+ // Valid: Subtype may declare new required named parameters in weak mode.
+ Function(
+ String p0, {
+ required int p1,
+ }) t3 = f;
+
+ // Valid: Invocation may pass null as a required named argument in weak mode.
+ f("", p1: null, p2: null);
+
+ // Valid: Invocation may omit a required named argument in weak mode.
+ f("", p1: 100);
+}
diff --git a/tests/language/nnbd/resolution/question_question_lub_test.dart b/tests/language/nnbd/resolution/question_question_lub_test.dart
index 2781b31..830c848 100644
--- a/tests/language/nnbd/resolution/question_question_lub_test.dart
+++ b/tests/language/nnbd/resolution/question_question_lub_test.dart
@@ -20,13 +20,13 @@
// [cfe] unspecified
(nonNullInt ?? nullableInt) + 1;
// ^^^^^^^^^^^
-// [analyzer] STATIC_WARNING.DEAD_NULL_COALESCE
+// [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION
//^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] STATIC_WARNING.UNCHECKED_USE_OF_NULLABLE_VALUE
// [cfe] unspecified
(nonNullInt ?? nonNullInt) + 1;
// ^^^^^^^^^^
-// [analyzer] STATIC_WARNING.DEAD_NULL_COALESCE
+// [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION
}
// TODO(mfairhurst) add cases with type parameter types
diff --git a/tests/language/nnbd/subtyping/function_type_required_params_test.dart b/tests/language/nnbd/subtyping/function_type_required_params_test.dart
new file mode 100644
index 0000000..b30232c
--- /dev/null
+++ b/tests/language/nnbd/subtyping/function_type_required_params_test.dart
@@ -0,0 +1,101 @@
+// Copyright (c) 2020, 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.
+
+// Requirements=nnbd-strong
+import 'package:expect/expect.dart';
+
+int f({required int i}) {
+ return i + 1;
+}
+
+int g({int i = 1}) {
+ return i + 1;
+}
+
+typedef int fType({required int i});
+typedef int gType({int i});
+typedef int bigType(
+ {required int i1,
+ required int i2,
+ required int i3,
+ required int i4,
+ required int i5,
+ required int i6,
+ required int i7,
+ required int i8,
+ required int i9,
+ required int i10,
+ required int i11,
+ required int i12,
+ required int i13,
+ required int i14,
+ required int i15,
+ required int i16,
+ required int i17,
+ required int i18,
+ required int i19,
+ required int i20,
+ required int i21,
+ required int i22,
+ required int i23,
+ required int i24,
+ required int i25,
+ required int i26,
+ required int i27,
+ required int i28,
+ required int i29,
+ required int i30,
+ required int i31,
+ required int i32,
+ required int i33,
+ required int i34,
+ required int i35,
+ required int i36,
+ required int i37,
+ required int i38,
+ required int i39,
+ required int i40,
+ required int i41,
+ required int i42,
+ required int i43,
+ required int i44,
+ required int i45,
+ required int i46,
+ required int i47,
+ required int i48,
+ required int i49,
+ required int i50,
+ required int i51,
+ required int i52,
+ required int i53,
+ required int i54,
+ required int i55,
+ required int i56,
+ required int i57,
+ required int i58,
+ required int i59,
+ required int i60,
+ required int i61,
+ required int i62,
+ required int i63,
+ required int i64,
+ required int i65,
+ required int i66,
+ required int i67,
+ required int i68,
+ required int i69,
+ required int i70});
+
+main() {
+ Expect.equals(f.runtimeType, f.runtimeType);
+ Expect.notEquals(f.runtimeType, g.runtimeType);
+ Expect.equals(g.runtimeType, g.runtimeType);
+ Expect.notEquals(f.runtimeType, bigType);
+
+ Expect.isTrue(f is fType);
+ Expect.isFalse(f is gType);
+ Expect.isTrue(g is fType);
+ Expect.isTrue(g is gType);
+ Expect.isFalse(f is bigType);
+}
diff --git a/tests/language/nnbd/subtyping/non_nullable_instantiation_with_nullable_lib.dart b/tests/language/nnbd/subtyping/non_nullable_instantiation_with_nullable_lib.dart
new file mode 100644
index 0000000..39b8cb0
--- /dev/null
+++ b/tests/language/nnbd/subtyping/non_nullable_instantiation_with_nullable_lib.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2020, 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.
+
+/// An opted-in library instantiating a non-nullable type parameter.
+
+class A<T extends Object> {
+ foo(x) => x is T;
+}
diff --git a/tests/language/nnbd/subtyping/non_nullable_instantiation_with_nullable_test.dart b/tests/language/nnbd/subtyping/non_nullable_instantiation_with_nullable_test.dart
new file mode 100644
index 0000000..7dc4d3f
--- /dev/null
+++ b/tests/language/nnbd/subtyping/non_nullable_instantiation_with_nullable_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2020, 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.
+
+// @dart = 2.6
+
+// Requirements=nnbd
+
+import 'package:expect/expect.dart';
+
+import 'non_nullable_instantiation_with_nullable_lib.dart';
+
+main() {
+ Expect.isTrue(A<int>().foo(42));
+ Expect.isFalse(A<bool>().foo(42));
+ Expect.isTrue(A<Null>().foo(null));
+ Expect.isTrue(A<dynamic>().foo(null));
+ Expect.isTrue(A<dynamic>().foo("anything"));
+}
diff --git a/tests/language/nnbd/subtyping/recursive_legacy_type_bounds_lib.dart b/tests/language/nnbd/subtyping/recursive_legacy_type_bounds_lib.dart
new file mode 100644
index 0000000..317225c
--- /dev/null
+++ b/tests/language/nnbd/subtyping/recursive_legacy_type_bounds_lib.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2020, 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.
+
+// Opt out of NNBD:
+// @dart = 2.6
+
+class Legacy_A extends Legacy_B<Legacy_A> {}
+
+class Legacy_B<T extends Legacy_B<T>> extends Legacy_C<Legacy_B> {}
+
+class Legacy_C<U extends Legacy_C<U>> {}
diff --git a/tests/language/nnbd/subtyping/recursive_legacy_type_bounds_test.dart b/tests/language/nnbd/subtyping/recursive_legacy_type_bounds_test.dart
new file mode 100644
index 0000000..6cf9b28
--- /dev/null
+++ b/tests/language/nnbd/subtyping/recursive_legacy_type_bounds_test.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2020, 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 'recursive_legacy_type_bounds_lib.dart';
+
+main() {
+ dynamic classWithRecursiveLegacyTypeBoundsInSupertype = Legacy_A();
+ Expect.isTrue(classWithRecursiveLegacyTypeBoundsInSupertype is Legacy_C);
+}
diff --git a/tests/language/nnbd/subtyping/type_casts_legacy_library.dart b/tests/language/nnbd/subtyping/type_casts_legacy_library.dart
new file mode 100644
index 0000000..1e22641
--- /dev/null
+++ b/tests/language/nnbd/subtyping/type_casts_legacy_library.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2020, 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.
+
+// Opt out of Null Safety:
+// @dart = 2.6
+
+import 'type_casts_null_safe_library.dart';
+
+class A<T> {
+ @pragma('vm:never-inline')
+ asT(arg) => arg as T;
+
+ @pragma('vm:never-inline')
+ asBT(arg) => arg as B<T>;
+}
+
+class B<T> {}
+
+class C {}
+
+class D extends C {}
+
+newAOfLegacyC() => new A<C>();
+newAOfLegacyBOfLegacyC() => new A<B<C>>();
+newWOfLegacyC() => new W<C>();
+newWOfLegacyBOfLegacyC() => new W<B<C>>();
+newXOfLegacyY() => new X<Y>();
diff --git a/tests/language/nnbd/subtyping/type_casts_null_safe_library.dart b/tests/language/nnbd/subtyping/type_casts_null_safe_library.dart
new file mode 100644
index 0000000..fedcfc1
--- /dev/null
+++ b/tests/language/nnbd/subtyping/type_casts_null_safe_library.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2020, 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.
+
+class W<T> {
+ @pragma('vm:never-inline')
+ asT(arg) => arg as T;
+
+ @pragma('vm:never-inline')
+ asNullableT(arg) => arg as T?;
+
+ @pragma('vm:never-inline')
+ asXT(arg) => arg as X<T>;
+
+ @pragma('vm:never-inline')
+ asNullableXT(arg) => arg as X<T>?;
+
+ @pragma('vm:never-inline')
+ asXNullableT(arg) => arg as X<T?>;
+}
+
+class X<T> {}
+
+class Y {}
+
+class Z extends Y {}
diff --git a/tests/language/nnbd/subtyping/type_casts_strong_test.dart b/tests/language/nnbd/subtyping/type_casts_strong_test.dart
new file mode 100644
index 0000000..c38b217
--- /dev/null
+++ b/tests/language/nnbd/subtyping/type_casts_strong_test.dart
@@ -0,0 +1,170 @@
+// Copyright (c) 2020, 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.
+
+// VMOptions=--optimization_counter_threshold=10 --deterministic
+
+// Requirements=nnbd-strong
+
+import 'package:expect/expect.dart';
+import 'type_casts_legacy_library.dart'; // A, B, C, D
+import 'type_casts_null_safe_library.dart'; // W, X, Y, Z
+
+doTests() {
+ // Testing 'arg as T*', T = C*
+ final ac = newAOfLegacyC();
+ ac.asT(new C());
+ ac.asT(new D());
+ ac.asT(null);
+ Expect.throwsCastError(() {
+ ac.asT(new Y());
+ });
+
+ // Testing 'arg as T*', T = B<C*>*
+ final abc = newAOfLegacyBOfLegacyC();
+ abc.asT(new B<C>());
+ abc.asT(new B<D>());
+ abc.asT(null);
+ Expect.throwsCastError(() {
+ abc.asT(new B<dynamic>());
+ });
+ Expect.throwsCastError(() {
+ abc.asT(new B<Y>());
+ });
+
+ // Testing 'arg as T*', T = Y
+ final ay = new A<Y>();
+ ay.asT(new Y());
+ ay.asT(new Z());
+ ay.asT(null);
+ Expect.throwsCastError(() {
+ ay.asT(new C());
+ });
+
+ // Testing 'arg as T', T = C*
+ final wc = newWOfLegacyC();
+ wc.asT(new C());
+ wc.asT(new D());
+ wc.asT(null);
+ Expect.throwsCastError(() {
+ wc.asT(new Y());
+ });
+
+ // Testing 'arg as T?', T = C*
+ wc.asNullableT(new C());
+ wc.asNullableT(new D());
+ wc.asNullableT(null);
+ Expect.throwsCastError(() {
+ wc.asNullableT(new Y());
+ });
+
+ // Testing 'arg as T', T = B<C*>*
+ final wby = newWOfLegacyBOfLegacyC();
+ wby.asT(new B<C>());
+ wby.asT(new B<D>());
+ wby.asT(null);
+ Expect.throwsCastError(() {
+ wby.asT(new B<dynamic>());
+ });
+ Expect.throwsCastError(() {
+ wby.asT(new B<Y>());
+ });
+
+ // Testing 'arg as T?', T = B<C*>*
+ wby.asNullableT(new B<C>());
+ wby.asNullableT(new B<D>());
+ wby.asNullableT(null);
+ Expect.throwsCastError(() {
+ wby.asNullableT(new B<dynamic>());
+ });
+ Expect.throwsCastError(() {
+ wby.asNullableT(new B<Y>());
+ });
+
+ // Testing 'arg as T', T = Y
+ final wy = new W<Y>();
+ wy.asT(new Y());
+ wy.asT(new Z());
+ Expect.throwsCastError(() {
+ wy.asT(null);
+ });
+ Expect.throwsCastError(() {
+ wy.asT(new C());
+ });
+
+ // Testing 'arg as T?', T = Y
+ wy.asNullableT(new Y());
+ wy.asNullableT(new Z());
+ wy.asNullableT(null);
+ Expect.throwsCastError(() {
+ wy.asNullableT(new C());
+ });
+
+ // Testing 'arg as B<T*>*', T = Y
+ ay.asBT(new B<Y>());
+ ay.asBT(new B<Z>());
+ ay.asBT(null);
+ Expect.throwsCastError(() {
+ ay.asBT(new B<dynamic>());
+ });
+ Expect.throwsCastError(() {
+ ay.asBT(new B<C>());
+ });
+
+ // Testing 'arg as X<T>', T = Y
+ wy.asXT(new X<Y>());
+ wy.asXT(new X<Z>());
+ wy.asXT(newXOfLegacyY());
+ Expect.throwsCastError(() {
+ wy.asXT(null);
+ });
+ Expect.throwsCastError(() {
+ wy.asXT(new X<dynamic>());
+ });
+ Expect.throwsCastError(() {
+ wy.asXT(new X<Y?>());
+ });
+
+ // Testing 'arg as X<T>?', T = Y
+ wy.asNullableXT(new X<Y>());
+ wy.asNullableXT(new X<Z>());
+ wy.asNullableXT(newXOfLegacyY());
+ wy.asNullableXT(null);
+ Expect.throwsCastError(() {
+ wy.asNullableXT(new X<dynamic>());
+ });
+ Expect.throwsCastError(() {
+ wy.asNullableXT(new X<Y?>());
+ });
+
+ // Testing 'arg as X<T?>', T = Y
+ wy.asXNullableT(new X<Y>());
+ wy.asXNullableT(new X<Z>());
+ wy.asXNullableT(new X<Y?>());
+ wy.asXNullableT(newXOfLegacyY());
+ Expect.throwsCastError(() {
+ wy.asXNullableT(null);
+ });
+ Expect.throwsCastError(() {
+ wy.asXNullableT(new X<dynamic>());
+ });
+
+ // Testing 'arg as X<T>', T = Y?
+ final wny = new W<Y?>();
+ wny.asXT(new X<Y>());
+ wny.asXT(new X<Z>());
+ wny.asXT(new X<Y?>());
+ wny.asXT(newXOfLegacyY());
+ Expect.throwsCastError(() {
+ wny.asXT(null);
+ });
+ Expect.throwsCastError(() {
+ wny.asXT(new X<dynamic>());
+ });
+}
+
+main() {
+ for (int i = 0; i < 20; ++i) {
+ doTests();
+ }
+}
diff --git a/tests/language/nnbd/syntax/nullable_type_ambiguous_test.dart b/tests/language/nnbd/syntax/nullable_type_ambiguous_test.dart
index 89ddbd5..753cff9 100644
--- a/tests/language/nnbd/syntax/nullable_type_ambiguous_test.dart
+++ b/tests/language/nnbd/syntax/nullable_type_ambiguous_test.dart
@@ -38,7 +38,7 @@
a = true;
var x5 = {a is bool ?? true : 3};
// ^^^^
- // [analyzer] STATIC_WARNING.DEAD_NULL_COALESCE
+ // [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION
Expect.type<Map<dynamic, dynamic>>(x5);
Map<dynamic, dynamic> y5 = x5;
}
diff --git a/tests/language/nnbd/syntax/nullable_type_test.dart b/tests/language/nnbd/syntax/nullable_type_test.dart
index 8ed8fc3..7dabed9 100644
--- a/tests/language/nnbd/syntax/nullable_type_test.dart
+++ b/tests/language/nnbd/syntax/nullable_type_test.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.
-// SharedOptions=--enable-experiment=non-nullable
+// Requirements=nnbd-strong
// Test that the trailing "?" is accepted after all type syntaxes. Verify that
// the compiler understands the resulting type to be nullable by trying to
diff --git a/tests/language/nnbd/type_equality/function_type_equality_legacy_lib.dart b/tests/language/nnbd/type_equality/function_type_equality_legacy_lib.dart
new file mode 100644
index 0000000..b847c4c
--- /dev/null
+++ b/tests/language/nnbd/type_equality/function_type_equality_legacy_lib.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2020, 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.
+
+// Opt out of Null Safety:
+// @dart = 2.6
+
+void fn() => null;
+int voidToInt() => 42;
+void positionalIntToVoid(int i) => null;
+void optionalIntToVoid([int i]) => null;
+void namedIntToVoid({int i}) => null;
+void gn(bool b, [int i]) => null;
+void hn(bool b, {int i}) => null;
diff --git a/tests/language/nnbd/type_equality/function_type_equality_test.dart b/tests/language/nnbd/type_equality/function_type_equality_test.dart
new file mode 100644
index 0000000..cbf5b0d
--- /dev/null
+++ b/tests/language/nnbd/type_equality/function_type_equality_test.dart
@@ -0,0 +1,74 @@
+// Copyright (c) 2020, 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 'function_type_equality_legacy_lib.dart' as legacy;
+
+void fn() => null;
+void fn2() => null;
+int voidToInt() => 42;
+int voidToInt2() => 42;
+int? voidToNullableInt() => 42;
+int? voidToNullableInt2() => 42;
+void positionalIntToVoid(int i) => null;
+void positionalNullableIntToVoid(int? i) => null;
+void positionalNullableIntToVoid2(int? i) => null;
+void optionalIntToVoid([int i]) => null;
+void optionalIntToVoid2([int i]) => null;
+void optionalNullableIntToVoid([int? i]) => null;
+void optionalNullableIntToVoid2([int? i]) => null;
+void namedIntToVoid({int i}) => null;
+void namedIntToVoid2({int i}) => null;
+void namedNullableIntToVoid({int? i}) => null;
+void namedNullableIntToVoid2({int? i}) => null;
+void requiredIntToVoid({required int i}) => null;
+void requiredIntToVoid2({required int i}) => null;
+void requiredNullableIntToVoid({required int? i}) => null;
+void requiredNullableIntToVoid2({required int? i}) => null;
+void gn(bool b, [int i]) => null;
+void hn(bool b, {int i}) => null;
+
+main() {
+ // Same functions with different names.
+ Expect.equals(fn.runtimeType, fn2.runtimeType);
+ Expect.equals(voidToInt.runtimeType, voidToInt2.runtimeType);
+ Expect.equals(voidToNullableInt.runtimeType, voidToNullableInt2.runtimeType);
+ Expect.equals(positionalNullableIntToVoid.runtimeType,
+ positionalNullableIntToVoid2.runtimeType);
+ Expect.equals(optionalIntToVoid.runtimeType, optionalIntToVoid2.runtimeType);
+ Expect.equals(optionalNullableIntToVoid.runtimeType,
+ optionalNullableIntToVoid2.runtimeType);
+ Expect.equals(namedIntToVoid.runtimeType, namedIntToVoid2.runtimeType);
+ Expect.equals(
+ namedNullableIntToVoid.runtimeType, namedNullableIntToVoid2.runtimeType);
+ Expect.equals(requiredIntToVoid.runtimeType, requiredIntToVoid2.runtimeType);
+ Expect.equals(requiredNullableIntToVoid.runtimeType,
+ requiredNullableIntToVoid2.runtimeType);
+
+ // Same signatures but one is from a legacy library.
+ Expect.equals(fn.runtimeType, legacy.fn.runtimeType);
+ Expect.equals(voidToInt.runtimeType, legacy.voidToInt.runtimeType);
+ Expect.equals(
+ positionalIntToVoid.runtimeType, legacy.positionalIntToVoid.runtimeType);
+ Expect.equals(
+ optionalIntToVoid.runtimeType, legacy.optionalIntToVoid.runtimeType);
+ Expect.equals(namedIntToVoid.runtimeType, legacy.namedIntToVoid.runtimeType);
+ Expect.equals(gn.runtimeType, legacy.gn.runtimeType);
+ Expect.equals(hn.runtimeType, legacy.hn.runtimeType);
+
+ // Nullable types are not equal to legacy types.
+ Expect.notEquals(positionalNullableIntToVoid.runtimeType,
+ legacy.positionalIntToVoid.runtimeType);
+ Expect.notEquals(optionalNullableIntToVoid.runtimeType,
+ legacy.optionalIntToVoid.runtimeType);
+ Expect.notEquals(
+ namedNullableIntToVoid.runtimeType, legacy.namedIntToVoid.runtimeType);
+ Expect.notEquals(voidToNullableInt.runtimeType, legacy.voidToInt.runtimeType);
+
+ // Required named arguments are not equal to named arguments.
+ Expect.notEquals(requiredIntToVoid.runtimeType, namedIntToVoid.runtimeType);
+ Expect.notEquals(
+ requiredIntToVoid.runtimeType, legacy.namedIntToVoid.runtimeType);
+}
diff --git a/tests/language/nnbd/type_equality/generic_function_type_equality_legacy_lib.dart b/tests/language/nnbd/type_equality/generic_function_type_equality_legacy_lib.dart
new file mode 100644
index 0000000..d19128f
--- /dev/null
+++ b/tests/language/nnbd/type_equality/generic_function_type_equality_legacy_lib.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2020, 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.
+
+// Opt out of Null Safety:
+// @dart = 2.6
+
+import 'generic_function_type_equality_null_safe_lib.dart';
+
+void fn<X>() => null;
+R voidToR<R>() => null as R;
+void positionalRToVoid<R>(R i) => null;
+void optionalRToVoid<R>([R i]) => null;
+void namedRToVoid<R>({R i}) => null;
+void hn<T, S>(T b, [S i]) => null;
+void kn<T, S>(T b, {S i}) => null;
+
+void positionalTToVoidWithBound<T extends B>(T i) => null;
+void optionalTToVoidWithBound<T extends B>([T i]) => null;
+void namedTToVoidWithBound<T extends B>({T i}) => null;
+
+class A<T extends B> {
+ void fn(T i) => null;
+}
+
+var rawAFnTearoff = A().fn;
diff --git a/tests/language/nnbd/type_equality/generic_function_type_equality_null_safe_lib.dart b/tests/language/nnbd/type_equality/generic_function_type_equality_null_safe_lib.dart
new file mode 100644
index 0000000..bda1426
--- /dev/null
+++ b/tests/language/nnbd/type_equality/generic_function_type_equality_null_safe_lib.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2020, 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.
+
+class B {}
+
+class C extends B {}
diff --git a/tests/language/nnbd/type_equality/generic_function_type_equality_test.dart b/tests/language/nnbd/type_equality/generic_function_type_equality_test.dart
new file mode 100644
index 0000000..b830ba3
--- /dev/null
+++ b/tests/language/nnbd/type_equality/generic_function_type_equality_test.dart
@@ -0,0 +1,84 @@
+// Copyright (c) 2020, 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 'generic_function_type_equality_legacy_lib.dart' as legacy;
+import 'generic_function_type_equality_null_safe_lib.dart';
+
+void fn<T>() => null;
+void fn2<R>() => null;
+T voidToT<T>() => null as T;
+S voidToS<S>() => null as S;
+void positionalTToVoid<T>(T i) => null;
+void positionalSToVoid<S>(S i) => null;
+void positionalNullableTToVoid<T>(T? i) => null;
+void positionalNullableSToVoid<S>(S? i) => null;
+void optionalTToVoid<T>([T i]) => null;
+void optionalSToVoid<S>([S i]) => null;
+void optionalNullableTToVoid<T>([T? i]) => null;
+void optionalNullableSToVoid<S>([S? i]) => null;
+void namedTToVoid<T>({T i}) => null;
+void namedSToVoid<S>({S i}) => null;
+void namedNullableTToVoid<T>({T? i}) => null;
+void namedNullableSToVoid<S>({S? i}) => null;
+void requiredTToVoid<T>({required T i}) => null;
+void requiredSToVoid<S>({required S i}) => null;
+void requiredNullableTToVoid<T>({required T? i}) => null;
+void requiredNullableSToVoid<S>({required S? i}) => null;
+
+void positionalTToVoidWithBound<T extends B>(T i) => null;
+void optionalTToVoidWithBound<T extends B>([T i]) => null;
+void namedTToVoidWithBound<T extends B>({T i}) => null;
+
+class A<T extends B> {
+ void fn(T i) => null;
+}
+
+main() {
+ // Same functions with different names.
+ Expect.equals(fn.runtimeType, fn2.runtimeType);
+ Expect.equals(voidToT.runtimeType, voidToT.runtimeType);
+ Expect.equals(positionalTToVoid.runtimeType, positionalSToVoid.runtimeType);
+ Expect.equals(positionalNullableTToVoid.runtimeType,
+ positionalNullableSToVoid.runtimeType);
+ Expect.equals(optionalTToVoid.runtimeType, optionalSToVoid.runtimeType);
+ Expect.equals(
+ optionalNullableTToVoid.runtimeType, optionalNullableSToVoid.runtimeType);
+ Expect.equals(namedTToVoid.runtimeType, namedSToVoid.runtimeType);
+ Expect.equals(
+ namedNullableTToVoid.runtimeType, namedNullableSToVoid.runtimeType);
+ Expect.equals(requiredTToVoid.runtimeType, requiredSToVoid.runtimeType);
+ Expect.equals(
+ requiredNullableTToVoid.runtimeType, requiredNullableSToVoid.runtimeType);
+
+ // Default type bounds are not equal. T extends Object? vs T extends Object*
+ Expect.notEquals(fn.runtimeType, legacy.fn.runtimeType);
+ Expect.notEquals(voidToT.runtimeType, legacy.voidToR.runtimeType);
+ Expect.notEquals(
+ positionalTToVoid.runtimeType, legacy.positionalRToVoid.runtimeType);
+ Expect.notEquals(
+ optionalTToVoid.runtimeType, legacy.optionalRToVoid.runtimeType);
+ Expect.notEquals(namedTToVoid.runtimeType, legacy.namedRToVoid.runtimeType);
+
+ // Type arguments in methods tear-offs from null safe libraries become Object?
+ // and Object* from legacy libraries and are not equal.
+ Expect.notEquals(A().fn.runtimeType, legacy.A().fn.runtimeType);
+ Expect.notEquals(A().fn.runtimeType, legacy.rawAFnTearoff.runtimeType);
+ Expect.notEquals(A<C>().fn.runtimeType, legacy.A<C>().fn.runtimeType);
+
+ // Same signatures but one is from a legacy library.
+ Expect.equals(positionalTToVoidWithBound.runtimeType,
+ legacy.positionalTToVoidWithBound.runtimeType);
+ Expect.equals(optionalTToVoidWithBound.runtimeType,
+ legacy.optionalTToVoidWithBound.runtimeType);
+ Expect.equals(namedTToVoidWithBound.runtimeType,
+ legacy.namedTToVoidWithBound.runtimeType);
+
+ // Required named arguments are not equal to named arguments.
+ Expect.notEquals(namedTToVoid.runtimeType, requiredTToVoid.runtimeType);
+ Expect.notEquals(
+ namedNullableTToVoid.runtimeType, requiredNullableTToVoid.runtimeType);
+ Expect.notEquals(
+ requiredTToVoid.runtimeType, legacy.namedRToVoid.runtimeType);
+}
diff --git a/tests/language_2/assert/assert_test.dart b/tests/language_2/assert/assert_test.dart
index 162c270..0e12116 100644
--- a/tests/language_2/assert/assert_test.dart
+++ b/tests/language_2/assert/assert_test.dart
@@ -8,7 +8,7 @@
import "package:expect/expect.dart";
-testTrue() {
+int testTrue() {
int i = 0;
try {
assert(true);
@@ -18,7 +18,7 @@
return i;
}
-testFalse() {
+int testFalse() {
int i = 0;
try {
assert(false);
@@ -28,11 +28,11 @@
return i;
}
-unknown(dynamic a) {
+dynamic unknown(dynamic a) {
return a ? true : false;
}
-testBoolean(bool value) {
+int testBoolean(bool value) {
int i = 0;
try {
assert(value);
@@ -42,7 +42,7 @@
return i;
}
-testDynamic(dynamic value) {
+int testDynamic(dynamic value) {
int i = 0;
try {
assert(value);
@@ -52,13 +52,13 @@
return i;
}
-testMessage(value, message) {
+AssertionError testMessage(value, message) {
try {
assert(value, message);
- return null;
} on AssertionError catch (error) {
return error;
}
+ return null;
}
main() {
@@ -70,13 +70,13 @@
Expect.equals(1, testBoolean(false));
Expect.equals(1, testDynamic(unknown(false)));
- Expect.equals(1, testBoolean(null));
- Expect.equals(1, testDynamic(null));
- Expect.equals(1, testDynamic(42));
- Expect.equals(1, testDynamic(() => true));
- Expect.equals(1, testDynamic(() => false));
- Expect.equals(1, testDynamic(() => 42));
- Expect.equals(1, testDynamic(() => null));
+ Expect.throwsTypeError(() => testBoolean(null));
+ Expect.throwsTypeError(() => testDynamic(null));
+ Expect.throwsTypeError(() => testDynamic(42));
+ Expect.throwsTypeError(() => testDynamic(() => true));
+ Expect.throwsTypeError(() => testDynamic(() => false));
+ Expect.throwsTypeError(() => testDynamic(() => 42));
+ Expect.throwsTypeError(() => testDynamic(() => null));
Expect.equals(1234, testMessage(false, 1234).message);
Expect.equals('hi', testMessage(false, 'hi').message);
diff --git a/tests/language_2/async/async_test.dart b/tests/language_2/async/async_test.dart
index e90b4f78..4093ffd 100644
--- a/tests/language_2/async/async_test.dart
+++ b/tests/language_2/async/async_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 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
import 'dart:async';
@@ -52,27 +53,46 @@
asyncReturn = topLevelWithParameter(4);
Expect.isTrue(asyncReturn is Future);
- asyncReturn.then((Object result) => Expect.equals(result, 11));
+ asyncStart();
+ asyncReturn.then((Object result) {
+ Expect.equals(result, 11);
+ asyncEnd();
+ });
asyncReturn = topLevelGetter;
Expect.isTrue(asyncReturn is Future);
- asyncReturn.then((Object result) =>
- Expect.stringEquals(result, 'I want to be an async getter'));
+ asyncStart();
+ asyncReturn.then((Object result) {
+ Expect.stringEquals(result, 'I want to be an async getter');
+ asyncEnd();
+ });
asyncReturn = A.staticMethod(2);
Expect.isTrue(asyncReturn is Future);
- asyncReturn.then((Object result) => Expect.equals(result, 3));
+ asyncStart();
+ asyncReturn.then((Object result) {
+ Expect.equals(result, 3);
+ asyncEnd();
+ });
asyncReturn = A.staticGetter;
Expect.isTrue(asyncReturn is Future);
- asyncReturn.then((Object result) => Expect.equals(result, 4));
+ asyncStart();
+ asyncReturn.then((Object result) {
+ Expect.equals(result, 4);
+ asyncEnd();
+ });
A a = new A(13);
var b = new A(9);
asyncReturn = a + b;
Expect.isTrue(asyncReturn is Future);
- asyncReturn.then((Object result) => Expect.equals((result as A).value, 22));
+ asyncStart();
+ asyncReturn.then((Object result) {
+ Expect.equals((result as A).value, 22);
+ asyncEnd();
+ });
var foo = 17;
bar(int p1, p2) async {
@@ -82,7 +102,11 @@
asyncReturn = bar(1, 2);
Expect.isTrue(asyncReturn is Future);
- asyncReturn.then((Object result) => Expect.equals(result, 27));
+ asyncStart();
+ asyncReturn.then((Object result) {
+ Expect.equals(result, 27);
+ asyncEnd();
+ });
var moreNesting = (int shadowP1, String p2, num p3) {
var z = 3;
@@ -94,12 +118,20 @@
};
asyncReturn = moreNesting(1, "ignore", 2);
Expect.isTrue(asyncReturn is Future);
- asyncReturn.then((Object result) => Expect.equals(result, 28));
+ asyncStart();
+ asyncReturn.then((Object result) {
+ Expect.equals(result, 28);
+ asyncEnd();
+ });
var checkAsync = (var someFunc) {
var toTest = someFunc();
Expect.isTrue(toTest is Future);
- toTest.then((int result) => Expect.equals(result, 4));
+ asyncStart();
+ toTest.then((int result) {
+ Expect.equals(result, 4);
+ asyncEnd();
+ });
};
checkAsync(() async => 4);
}
diff --git a/tests/language_2/async/congruence_local_runtime_test.dart b/tests/language_2/async/congruence_local_runtime_test.dart
index 4c8e013..55ade03 100644
--- a/tests/language_2/async/congruence_local_runtime_test.dart
+++ b/tests/language_2/async/congruence_local_runtime_test.dart
@@ -40,11 +40,11 @@
Expect.isFalse(f is Future<A>);
}
-void checkFutureDynamic(dynamic tearoff) {
- Expect.isTrue(tearoff is Future<dynamic> Function());
+void checkFutureObject(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<Object> Function());
Expect.isFalse(tearoff is Future<A> Function());
dynamic f = tearoff();
- Expect.isTrue(f is Future<dynamic>);
+ Expect.isTrue(f is Future<Object>);
Expect.isFalse(f is Future<A>);
}
@@ -57,7 +57,7 @@
}
main() {
- f_inferred_futureDynamic() async {
+ f_inferred_futureObject() async {
await quick();
if (false) {
return 0;
@@ -99,10 +99,10 @@
// Not executed
void checkStaticTypes() {
- // Check that f_inferred_futureDynamic's static return type is
- // `Future<dynamic>`, by verifying that its return value can be assigned to
+ // Check that f_inferred_futureObject's static return type is
+ // `Future<Object>`, by verifying that its return value can be assigned to
// `Future<int>` but not `int`.
- Future<int> v1 = f_inferred_futureDynamic();
+ Future<int> v1 = f_inferred_futureObject();
// Check that f_inferred_A's static return type is `Future<A>`, by verifying
@@ -112,7 +112,7 @@
}
- checkFutureDynamic(f_inferred_futureDynamic);
+ checkFutureObject(f_inferred_futureObject);
checkFutureA(f_inferred_A);
checkDynamic(f_dynamic);
checkFutureA(f_A);
diff --git a/tests/language_2/async/congruence_local_test.dart b/tests/language_2/async/congruence_local_test.dart
index e51ba25..8d8a03d 100644
--- a/tests/language_2/async/congruence_local_test.dart
+++ b/tests/language_2/async/congruence_local_test.dart
@@ -37,11 +37,11 @@
Expect.isFalse(f is Future<A>);
}
-void checkFutureDynamic(dynamic tearoff) {
- Expect.isTrue(tearoff is Future<dynamic> Function());
+void checkFutureObject(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<Object> Function());
Expect.isFalse(tearoff is Future<A> Function());
dynamic f = tearoff();
- Expect.isTrue(f is Future<dynamic>);
+ Expect.isTrue(f is Future<Object>);
Expect.isFalse(f is Future<A>);
}
@@ -54,7 +54,7 @@
}
main() {
- f_inferred_futureDynamic() async {
+ f_inferred_futureObject() async {
await quick();
if (false) {
return 0;
@@ -96,14 +96,14 @@
// Not executed
void checkStaticTypes() {
- // Check that f_inferred_futureDynamic's static return type is
- // `Future<dynamic>`, by verifying that its return value can be assigned to
+ // Check that f_inferred_futureObject's static return type is
+ // `Future<Object>`, by verifying that its return value can be assigned to
// `Future<int>` but not `int`.
- Future<int> v1 = f_inferred_futureDynamic();
- int v2 = f_inferred_futureDynamic();
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ Future<int> v1 = f_inferred_futureObject();
+ int v2 = f_inferred_futureObject();
+ // ^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
- // ^
+ // ^
// [cfe] A value of type 'Future<Object>' can't be assigned to a variable of type 'int'.
// Check that f_inferred_A's static return type is `Future<A>`, by verifying
@@ -117,7 +117,7 @@
// [cfe] A value of type 'Future<A>' can't be assigned to a variable of type 'Future<int>'.
}
- checkFutureDynamic(f_inferred_futureDynamic);
+ checkFutureObject(f_inferred_futureObject);
checkFutureA(f_inferred_A);
checkDynamic(f_dynamic);
checkFutureA(f_A);
diff --git a/tests/language_2/async/congruence_unnamed_runtime_test.dart b/tests/language_2/async/congruence_unnamed_runtime_test.dart
index 66961b2..ae0d9d2 100644
--- a/tests/language_2/async/congruence_unnamed_runtime_test.dart
+++ b/tests/language_2/async/congruence_unnamed_runtime_test.dart
@@ -34,6 +34,14 @@
Future<B> futureB() => new Future<B>.value(new B());
+void checkFutureObject(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<Object> Function());
+ Expect.isFalse(tearoff is Future<A> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<Object>);
+ Expect.isFalse(f is Future<A>);
+}
+
void checkFutureDynamic(dynamic tearoff) {
Expect.isTrue(tearoff is Future<dynamic> Function());
Expect.isFalse(tearoff is Future<A> Function());
@@ -51,7 +59,7 @@
}
main() {
- var f_inferred_futureDynamic = () async {
+ var f_inferred_futureObject = () async {
await quick();
if (false) {
return 0;
@@ -111,10 +119,10 @@
// Not executed
void checkStaticTypes() {
- // Check that f_inferred_futureDynamic's static return type is
- // `Future<dynamic>`, by verifying that its return value can be assigned to
+ // Check that f_inferred_futureObject's static return type is
+ // `Future<Object>`, by verifying that its return value can be assigned to
// `Future<int>` but not `int`.
- Future<int> v1 = f_inferred_futureDynamic();
+ Future<int> v1 = f_inferred_futureObject();
// Check that f_inferred_A's static return type is `Future<A>`, by verifying
@@ -124,7 +132,7 @@
}
- checkFutureDynamic(f_inferred_futureDynamic);
+ checkFutureObject(f_inferred_futureObject);
checkFutureA(f_inferred_A);
checkFutureDynamic(f_futureDynamic);
checkFutureA(f_A);
diff --git a/tests/language_2/async/congruence_unnamed_test.dart b/tests/language_2/async/congruence_unnamed_test.dart
index 7bb0228..5e5ccd2 100644
--- a/tests/language_2/async/congruence_unnamed_test.dart
+++ b/tests/language_2/async/congruence_unnamed_test.dart
@@ -31,6 +31,14 @@
Future<B> futureB() => new Future<B>.value(new B());
+void checkFutureObject(dynamic tearoff) {
+ Expect.isTrue(tearoff is Future<Object> Function());
+ Expect.isFalse(tearoff is Future<A> Function());
+ dynamic f = tearoff();
+ Expect.isTrue(f is Future<Object>);
+ Expect.isFalse(f is Future<A>);
+}
+
void checkFutureDynamic(dynamic tearoff) {
Expect.isTrue(tearoff is Future<dynamic> Function());
Expect.isFalse(tearoff is Future<A> Function());
@@ -48,7 +56,7 @@
}
main() {
- var f_inferred_futureDynamic = () async {
+ var f_inferred_futureObject = () async {
await quick();
if (false) {
return 0;
@@ -108,14 +116,14 @@
// Not executed
void checkStaticTypes() {
- // Check that f_inferred_futureDynamic's static return type is
- // `Future<dynamic>`, by verifying that its return value can be assigned to
+ // Check that f_inferred_futureObject's static return type is
+ // `Future<Object>`, by verifying that its return value can be assigned to
// `Future<int>` but not `int`.
- Future<int> v1 = f_inferred_futureDynamic();
- int v2 = f_inferred_futureDynamic();
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ Future<int> v1 = f_inferred_futureObject();
+ int v2 = f_inferred_futureObject();
+ // ^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
- // ^
+ // ^
// [cfe] A value of type 'Future<Object>' can't be assigned to a variable of type 'int'.
// Check that f_inferred_A's static return type is `Future<A>`, by verifying
@@ -129,7 +137,7 @@
// [cfe] A value of type 'Future<A>' can't be assigned to a variable of type 'Future<int>'.
}
- checkFutureDynamic(f_inferred_futureDynamic);
+ checkFutureObject(f_inferred_futureObject);
checkFutureA(f_inferred_A);
checkFutureDynamic(f_futureDynamic);
checkFutureA(f_A);
diff --git a/tests/language_2/async/identifier_test.dart b/tests/language_2/async/identifier_test.dart
index a5d3f9d..cc299a1 100644
--- a/tests/language_2/async/identifier_test.dart
+++ b/tests/language_2/async/identifier_test.dart
@@ -150,6 +150,8 @@
int async() => null;
async();
}
+
+ f();
}
{
f() async {
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 1d10def..a8603f8 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -12,8 +12,6 @@
number/web_int_literals_test/*: SkipByDesign # Test applies only to JavaScript targets
[ $compiler == fasta ]
-async/await_syntax_test/e5: Crash # Assertion error: continuation.dart: Failed assertion: 'node.expression == null || node.expression is NullLiteral': is not true.
-async/await_syntax_test/e6: Crash # Assertion error: continuation.dart: Failed assertion: 'node.expression == null || node.expression is NullLiteral': is not true.
number/web_int_literals_test/*: SkipByDesign # Test applies only to JavaScript targets
[ $fasta ]
diff --git a/tests/language_2/type_object/runtime_type_function_test.dart b/tests/language_2/type_object/runtime_type_function_test.dart
index 78d5422..b1c30c6 100644
--- a/tests/language_2/type_object/runtime_type_function_test.dart
+++ b/tests/language_2/type_object/runtime_type_function_test.dart
@@ -68,7 +68,7 @@
check(fn('dynamic', ''), main); // Top-level tear-off.
check(fn('void', ''), Xyzzy.foo); // Class static member tear-off.
- check(fn('void', 'Object'), [].add); // Instance tear-off.
+ check(fn('void', 'Object'), new MyList().add); // Instance tear-off.
check(fn('int', ''), () => 1); // closure.
var s = new Xyzzy().runtimeType.toString();
@@ -83,8 +83,8 @@
check(fn('String', 'String', {'a': 'String', 'b': 'dynamic'}), Xyzzy.nam);
// Instance method tear-offs.
- check(fn('void', 'Object'), <String>[].add);
- check(fn('void', 'Object'), <int>[].add);
+ check(fn('void', 'Object'), new MyList<String>().add);
+ check(fn('void', 'Object'), new MyList<int>().add);
check(fn('void', 'int'), new Xyzzy().intAdd);
check(fn('String', 'Object'), new G<String, int>().foo);
@@ -122,6 +122,12 @@
void intAdd(int x) {}
}
+// Using 'MyList' instead of core lib 'List' keeps covariant parameter type of
+// tear-offs 'Object' (legacy lib) instead of 'Object?' (opted-in lib).
+class MyList<E> {
+ void add(E value) {}
+}
+
class G<U, V> {
U foo(V x) => null;
U moo(V f(U x)) => null;
diff --git a/tests/language_2/unsorted/checked_method_error_order_test.dart b/tests/language_2/unsorted/checked_method_error_order_test.dart
index 04279f8..2d35087 100644
--- a/tests/language_2/unsorted/checked_method_error_order_test.dart
+++ b/tests/language_2/unsorted/checked_method_error_order_test.dart
@@ -20,7 +20,7 @@
dynamic y = 3;
Expect.throws(() => new Bar().foo(i: x, a: y), (e) {
if (e is TypeError) {
- var m = e.message.toString();
+ var m = e.toString();
return m.contains("is not a subtype of type 'int'") ||
m.contains(
"Expected a value of type 'int', but got one of type 'String'");
diff --git a/tests/language_2/vm/regress_22621_vm_test.dart b/tests/language_2/vm/regress_22621_vm_test.dart
index f8e39a7..5b5b27d 100644
--- a/tests/language_2/vm/regress_22621_vm_test.dart
+++ b/tests/language_2/vm/regress_22621_vm_test.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.
// Test that BoxAllocationSlowPath for Mint emits stackmap in unoptimized code.
-// VMOptions=--gc_at_instance_allocation=_Mint --inline_alloc=false
+// VMOptions=--inline_alloc=false
main() {
var re = new RegExp(r"IsolateStubs (.*)");
diff --git a/tests/language_2/vm/regress_40792_test.dart b/tests/language_2/vm/regress_40792_test.dart
new file mode 100644
index 0000000..310e084
--- /dev/null
+++ b/tests/language_2/vm/regress_40792_test.dart
@@ -0,0 +1,129 @@
+// Copyright (c) 2020, 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.
+
+// VMOptions=--optimization_counter_threshold=10 --deterministic
+
+// Regression test for https://dartbug.com/40792 and https://dartbug.com/40795.
+// Verifies that non-nullability is not inferred from 'is' tests which
+// accept null.
+
+import "package:expect/expect.dart";
+
+dynamic result;
+
+// Use separate functions so their parameter types can be inferred separately.
+setResult1(x) {
+ result = (x == null) ? 'null' : 'not null';
+}
+
+setResult2(x) {
+ result = (x == null) ? 'null' : 'not null';
+}
+
+setResult3(x) {
+ result = (x == null) ? 'null' : 'not null';
+}
+
+setResult4(x) {
+ result = (x == null) ? 'null' : 'not null';
+}
+
+setResult5(x) {
+ result = (x == null) ? 'null' : 'not null';
+}
+
+setResult6(x) {
+ result = (x == null) ? 'null' : 'not null';
+}
+
+setResult7(x) {
+ result = (x == null) ? 'null' : 'not null';
+}
+
+class A<S, T extends S> {
+ @pragma('vm:never-inline')
+ test1(S x) {
+ if (x is T) {
+ setResult1(x);
+ }
+ }
+
+ @pragma('vm:never-inline')
+ test2(S x) {
+ if (x is T) {
+ setResult2(x);
+ }
+ }
+
+ @pragma('vm:never-inline')
+ test3(S x) {
+ if (x is T) {
+ setResult2(x);
+ }
+ }
+
+ @pragma('vm:never-inline')
+ test4(S x) {
+ if (x is T) {
+ setResult2(x);
+ }
+ }
+}
+
+@pragma('vm:never-inline')
+test5(x) {
+ if (x is Null) {
+ setResult5(x);
+ }
+}
+
+@pragma('vm:never-inline')
+test6(x) {
+ if (x is Object) {
+ setResult6(x);
+ }
+}
+
+@pragma('vm:never-inline')
+test7(x) {
+ if (x is dynamic) {
+ setResult7(x);
+ }
+}
+
+void doTests() {
+ result = 'unexpected';
+ new A<Null, Null>().test1(null);
+ Expect.equals('null', result);
+
+ result = 'unexpected';
+ new A<Object, Object>().test2(null);
+ Expect.equals('null', result);
+
+ result = 'unexpected';
+ new A<dynamic, dynamic>().test3(null);
+ Expect.equals('null', result);
+
+ result = 'unexpected';
+ new A<void, void>().test4(null);
+ Expect.equals('null', result);
+
+ result = 'unexpected';
+ test5(null);
+ Expect.equals('null', result);
+
+ result = 'unexpected';
+ test6(null);
+ Expect.equals('null', result);
+
+ result = 'unexpected';
+ test7(null);
+ Expect.equals('null', result);
+}
+
+main(List<String> args) {
+ for (int i = 0; i < 20; ++i) {
+ doTests();
+ }
+}
diff --git a/tests/language_2/vm/regression_37633_test.dart b/tests/language_2/vm/regression_37633_test.dart
index 3de7315..da7471a 100755
--- a/tests/language_2/vm/regression_37633_test.dart
+++ b/tests/language_2/vm/regression_37633_test.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.
-// VMOptions=--deterministic --enable-inlining-annotations
+// VMOptions=--deterministic
// Issue #37633 found with fuzzing: internal compiler crash (parallel move).
@@ -10,13 +10,11 @@
import "package:expect/expect.dart";
-const String NeverInline = 'NeverInline';
-
double foo0() {
return acos(0.9474715118880382);
}
-@NeverInline
+@pragma('vm:never-inline')
double foo() {
return atan2(foo0(), foo0());
}
diff --git a/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart b/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
index 4da235b..8e1f50d 100644
--- a/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
+++ b/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
@@ -6,6 +6,7 @@
// VMOptions=--verify_before_gc
// VMOptions=--verify_after_gc
// VMOptions=--verify_before_gc --verify_after_gc
+// VMOptions=--verify_store_buffer
import "package:expect/expect.dart";
import 'dart:async';
diff --git a/tests/lib_2/convert/streamed_conversion_json_utf8_decode_test.dart b/tests/lib_2/convert/streamed_conversion_json_utf8_decode_test.dart
index 012ddde..baf4322 100644
--- a/tests/lib_2/convert/streamed_conversion_json_utf8_decode_test.dart
+++ b/tests/lib_2/convert/streamed_conversion_json_utf8_decode_test.dart
@@ -6,6 +6,7 @@
// VMOptions=--verify_before_gc
// VMOptions=--verify_after_gc
// VMOptions=--verify_before_gc --verify_after_gc
+// VMOptions=--verify_store_buffer
import "package:expect/expect.dart";
import 'dart:async';
diff --git a/tests/lib_2/html/canvasrendering/arc_test.dart b/tests/lib_2/html/canvasrendering/arc_test.dart
new file mode 100644
index 0000000..c005459
--- /dev/null
+++ b/tests/lib_2/html/canvasrendering/arc_test.dart
@@ -0,0 +1,103 @@
+// Copyright (c) 2020, 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 canvas_rendering_context_2d_test;
+
+import 'dart:html';
+import 'dart:math';
+
+import 'canvas_rendering_util.dart';
+import 'package:unittest/unittest.dart';
+
+main() {
+ setUp(setupFunc);
+ tearDown(tearDownFunc);
+
+ test('default arc should be clockwise', () {
+ context.beginPath();
+ final r = 10;
+
+ // Center of arc.
+ final cx = 20;
+ final cy = 20;
+ // Arc centered at (20, 20) with radius 10 will go clockwise
+ // from (20 + r, 20) to (20, 20 + r), which is 1/4 of a circle.
+ context.arc(cx, cy, r, 0, pi / 2);
+
+ context.strokeStyle = 'green';
+ context.lineWidth = 2;
+ context.stroke();
+
+ // Center should not be filled.
+ expectPixelUnfilled(cx, cy);
+
+ // (cx + r, cy) should be filled.
+ expectPixelFilled(cx + r, cy, true);
+ // (cx, cy + r) should be filled.
+ expectPixelFilled(cx, cy + r, true);
+ // (cx - r, cy) should be empty.
+ expectPixelFilled(cx - r, cy, false);
+ // (cx, cy - r) should be empty.
+ expectPixelFilled(cx, cy - r, false);
+
+ // (cx + r/SQRT2, cy + r/SQRT2) should be filled.
+ expectPixelFilled((cx + r / sqrt2).toInt(), (cy + r / sqrt2).toInt(), true);
+
+ // (cx - r/SQRT2, cy - r/SQRT2) should be empty.
+ expectPixelFilled(
+ (cx - r / sqrt2).toInt(), (cy + r / sqrt2).toInt(), false);
+
+ // (cx + r/SQRT2, cy + r/SQRT2) should be empty.
+ expectPixelFilled(
+ (cx - r / sqrt2).toInt(), (cy - r / sqrt2).toInt(), false);
+
+ // (cx - r/SQRT2, cy - r/SQRT2) should be empty.
+ expectPixelFilled(
+ (cx + r / sqrt2).toInt(), (cy - r / sqrt2).toInt(), false);
+ });
+
+ test('arc anticlockwise', () {
+ context.beginPath();
+ final r = 10;
+
+ // Center of arc.
+ final cx = 20;
+ final cy = 20;
+ // Arc centered at (20, 20) with radius 10 will go anticlockwise
+ // from (20 + r, 20) to (20, 20 + r), which is 3/4 of a circle.
+ // Because of the way arc work, when going anti-clockwise, the end points
+ // are not included, so small values are added to radius to make a little
+ // more than a 3/4 circle.
+ context.arc(cx, cy, r, .1, pi / 2 - .1, true);
+
+ context.strokeStyle = 'green';
+ context.lineWidth = 2;
+ context.stroke();
+
+ // Center should not be filled.
+ expectPixelUnfilled(cx, cy);
+
+ // (cx + r, cy) should be filled.
+ expectPixelFilled(cx + r, cy, true);
+ // (cx, cy + r) should be filled.
+ expectPixelFilled(cx, cy + r, true);
+ // (cx - r, cy) should be filled.
+ expectPixelFilled(cx - r, cy, true);
+ // (cx, cy - r) should be filled.
+ expectPixelFilled(cx, cy - r, true);
+
+ // (cx + r/SQRT2, cy + r/SQRT2) should be empty.
+ expectPixelFilled(
+ (cx + r / sqrt2).toInt(), (cy + r / sqrt2).toInt(), false);
+
+ // (cx - r/SQRT2, cy - r/SQRT2) should be filled.
+ expectPixelFilled((cx - r / sqrt2).toInt(), (cy + r / sqrt2).toInt(), true);
+
+ // (cx + r/SQRT2, cy + r/SQRT2) should be filled.
+ expectPixelFilled((cx - r / sqrt2).toInt(), (cy - r / sqrt2).toInt(), true);
+
+ // (cx - r/SQRT2, cy - r/SQRT2) should be filled.
+ expectPixelFilled((cx + r / sqrt2).toInt(), (cy - r / sqrt2).toInt(), true);
+ });
+}
diff --git a/tests/lib_2/html/canvasrendering/canvas_rendering_util.dart b/tests/lib_2/html/canvasrendering/canvas_rendering_util.dart
new file mode 100644
index 0000000..342178b
--- /dev/null
+++ b/tests/lib_2/html/canvasrendering/canvas_rendering_util.dart
@@ -0,0 +1,80 @@
+// 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 canvas_rendering_context_2d_test;
+
+import 'dart:html';
+import 'dart:math';
+
+import 'package:unittest/unittest.dart';
+
+// Some rounding errors in the browsers.
+checkPixel(List<int> pixel, List<int> expected) {
+ expect(pixel[0], closeTo(expected[0], 2));
+ expect(pixel[1], closeTo(expected[1], 2));
+ expect(pixel[2], closeTo(expected[2], 2));
+ expect(pixel[3], closeTo(expected[3], 2));
+}
+
+var canvas;
+var context;
+var otherCanvas;
+var otherContext;
+var video;
+
+void createCanvas() {
+ canvas = new CanvasElement();
+ canvas.width = 100;
+ canvas.height = 100;
+
+ context = canvas.context2D;
+}
+
+void createOtherCanvas() {
+ otherCanvas = new CanvasElement();
+ otherCanvas.width = 10;
+ otherCanvas.height = 10;
+ otherContext = otherCanvas.context2D;
+ otherContext.fillStyle = "red";
+ otherContext.fillRect(0, 0, otherCanvas.width, otherCanvas.height);
+}
+
+void setupFunc() {
+ createCanvas();
+ createOtherCanvas();
+ video = new VideoElement();
+}
+
+void tearDownFunc() {
+ canvas = null;
+ context = null;
+ otherCanvas = null;
+ otherContext = null;
+ video = null;
+}
+
+List<int> readPixel(int x, int y) {
+ var imageData = context.getImageData(x, y, 1, 1);
+ return imageData.data;
+}
+
+/// Returns true if the pixel has some data in it, false otherwise.
+bool isPixelFilled(int x, int y) => readPixel(x, y).any((p) => p != 0);
+
+String pixelDataToString(List<int> data, int x, int y) {
+ return '[${data.join(", ")}]';
+}
+
+String _filled(bool v) => v ? "filled" : "unfilled";
+
+void expectPixelFilled(int x, int y, [bool filled = true]) {
+ expect(isPixelFilled(x, y), filled,
+ reason: 'Pixel at ($x, $y) was expected to'
+ ' be: <${_filled(filled)}> but was: <${_filled(!filled)}> with data: '
+ '${pixelDataToString(readPixel(x, y), x, y)}');
+}
+
+void expectPixelUnfilled(int x, int y) {
+ expectPixelFilled(x, y, false);
+}
diff --git a/tests/lib_2/html/canvasrendering/draw_image_canvas_element_test.dart b/tests/lib_2/html/canvasrendering/draw_image_canvas_element_test.dart
new file mode 100644
index 0000000..2f47f31
--- /dev/null
+++ b/tests/lib_2/html/canvasrendering/draw_image_canvas_element_test.dart
@@ -0,0 +1,77 @@
+// Copyright (c) 2020, 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 canvas_rendering_context_2d_test;
+
+import 'dart:html';
+import 'dart:math';
+
+import 'canvas_rendering_util.dart';
+import 'package:unittest/unittest.dart';
+
+main() {
+ setUp(setupFunc);
+ tearDown(tearDownFunc);
+
+ test('with 3 params', () {
+ // Draw an image to the canvas from a canvas element.
+ context.drawImage(otherCanvas, 50, 50);
+
+ expectPixelFilled(50, 50);
+ expectPixelFilled(55, 55);
+ expectPixelFilled(59, 59);
+ expectPixelUnfilled(60, 60);
+ expectPixelUnfilled(0, 0);
+ expectPixelUnfilled(70, 70);
+ });
+ test('with 5 params', () {
+ // Draw an image to the canvas from a canvas element.
+ context.drawImageToRect(otherCanvas, new Rectangle(50, 50, 20, 20));
+
+ expectPixelFilled(50, 50);
+ expectPixelFilled(55, 55);
+ expectPixelFilled(59, 59);
+ expectPixelFilled(60, 60);
+ expectPixelFilled(69, 69);
+ expectPixelUnfilled(70, 70);
+ expectPixelUnfilled(0, 0);
+ expectPixelUnfilled(80, 80);
+ });
+ test('with 9 params', () {
+ // Draw an image to the canvas from a canvas element.
+ otherContext.fillStyle = "blue";
+ otherContext.fillRect(5, 5, 5, 5);
+ context.drawImageToRect(otherCanvas, new Rectangle(50, 50, 20, 20),
+ sourceRect: new Rectangle(2, 2, 6, 6));
+
+ checkPixel(readPixel(50, 50), [255, 0, 0, 255]);
+ checkPixel(readPixel(55, 55), [255, 0, 0, 255]);
+ checkPixel(readPixel(60, 50), [255, 0, 0, 255]);
+ checkPixel(readPixel(65, 65), [0, 0, 255, 255]);
+ checkPixel(readPixel(69, 69), [0, 0, 255, 255]);
+ expectPixelFilled(50, 50);
+ expectPixelFilled(55, 55);
+ expectPixelFilled(59, 59);
+ expectPixelFilled(60, 60);
+ expectPixelFilled(69, 69);
+ expectPixelUnfilled(70, 70);
+ expectPixelUnfilled(0, 0);
+ expectPixelUnfilled(80, 80);
+ });
+
+ test('createImageData', () {
+ var imageData = context.createImageData(15, 15);
+ expect(imageData.width, 15);
+ expect(imageData.height, 15);
+
+ var other = context.createImageDataFromImageData(imageData);
+ expect(other.width, 15);
+ expect(other.height, 15);
+ });
+
+ test('createPattern', () {
+ var pattern = context.createPattern(new CanvasElement(), '');
+ //var pattern2 = context.createPatternFromImage(new ImageElement(), '');
+ });
+}
diff --git a/tests/lib_2/html/canvasrendering/draw_image_video_element_test.dart b/tests/lib_2/html/canvasrendering/draw_image_video_element_test.dart
new file mode 100644
index 0000000..5fad4d2
--- /dev/null
+++ b/tests/lib_2/html/canvasrendering/draw_image_video_element_test.dart
@@ -0,0 +1,192 @@
+// Copyright (c) 2020, 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 canvas_rendering_context_2d_test;
+
+import 'dart:html';
+import 'dart:math';
+
+import 'canvas_rendering_util.dart';
+import 'package:unittest/unittest.dart';
+
+main() {
+ // These videos and base64 strings are the same video, representing 2
+ // frames of 8x8 red pixels.
+ // The videos were created with:
+ // convert -size 8x8 xc:red blank1.jpg
+ // convert -size 8x8 xc:red blank2.jpg
+ // avconv -f image2 -i "blank%d.jpg" -c:v libx264 small.mp4
+ // avconv -i small.mp4 small.webm
+ // python -m base64 -e small.mp4
+ // python -m base64 -e small.webm
+ var mp4VideoUrl = '/root_dart/tests/lib_2/html/small.mp4';
+ var webmVideoUrl = '/root_dart/tests/lib_2/html/small.webm';
+ var mp4VideoDataUrl =
+ 'data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAA'
+ 'AIZnJlZQAAAsdtZGF0AAACmwYF//+X3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlID'
+ 'EyMCByMjE1MSBhM2Y0NDA3IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZW'
+ 'Z0IDIwMDMtMjAxMSAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG'
+ '9wdGlvbnM6IGNhYmFjPTEgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweD'
+ 'ExMSBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj'
+ '0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MCBjcW09MC'
+ 'BkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aH'
+ 'JlYWRzPTE4IHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZW'
+ 'Q9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl'
+ '9weXJhbWlkPTAgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MCBvcG'
+ 'VuX2dvcD0xIHdlaWdodHA9MiBrZXlpbnQ9MjUwIGtleWludF9taW49MjUgc2NlbmVjdX'
+ 'Q9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD00MCByYz1jcmYgbWJ0cmVlPT'
+ 'EgY3JmPTUxLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IGlwX3'
+ 'JhdGlvPTEuMjUgYXE9MToxLjAwAIAAAAARZYiEB//3aoK5/tP9+8yeuIEAAAAHQZoi2P'
+ '/wgAAAAzxtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAAUAABAAABAAAAAAAAAA'
+ 'AAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAA'
+ 'AAAAAAAAAAAAAAAAAAAAACAAAAGGlvZHMAAAAAEICAgAcAT/////7/AAACUHRyYWsAAA'
+ 'BcdGtoZAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAQAAAA'
+ 'AAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAACAAAAAgAAAAAACRlZHRzAAAAHG'
+ 'Vsc3QAAAAAAAAAAQAAAFAAAAABAAEAAAAAAchtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAA'
+ 'AAAAAZAAAAAlXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSG'
+ 'FuZGxlcgAAAAFzbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZg'
+ 'AAAAAAAAABAAAADHVybCAAAAABAAABM3N0YmwAAACXc3RzZAAAAAAAAAABAAAAh2F2Yz'
+ 'EAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAACAAIAEgAAABIAAAAAAAAAAEAAAAAAAAAAA'
+ 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAxYXZjQwFNQAr/4QAYZ01ACuiPyy'
+ '4C2QAAAwABAAADADIPEiUSAQAGaOvAZSyAAAAAGHN0dHMAAAAAAAAAAQAAAAIAAAABAA'
+ 'AAFHN0c3MAAAAAAAAAAQAAAAEAAAAYY3R0cwAAAAAAAAABAAAAAgAAAAEAAAAcc3RzYw'
+ 'AAAAAAAAABAAAAAQAAAAEAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAK0AAAACwAAAB'
+ 'hzdGNvAAAAAAAAAAIAAAAwAAAC5AAAAGB1ZHRhAAAAWG1ldGEAAAAAAAAAIWhkbHIAAA'
+ 'AAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAK2lsc3QAAAAjqXRvbwAAABtkYXRhAAAAAQ'
+ 'AAAABMYXZmNTMuMjEuMQ==';
+ var webmVideoDataUrl =
+ 'data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlY'
+ 'm1Ch4ECQoWBAhhTgGcBAAAAAAAB/hFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua'
+ '1OsggEsTbuMU6uEHFO7a1OsggHk7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+ 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+ 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+ 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAA'
+ 'EEq17GDD0JATYCLTGF2ZjUzLjIxLjFXQYtMYXZmNTMuMjEuMXOkkJatuHwTJ7cvFLSzB'
+ 'Smxbp5EiYhAVAAAAAAAABZUrmsBAAAAAAAAR64BAAAAAAAAPteBAXPFgQGcgQAitZyDd'
+ 'W5khoVWX1ZQOIOBASPjg4QCYloA4AEAAAAAAAASsIEIuoEIVLCBCFS6gQhUsoEDH0O2d'
+ 'QEAAAAAAABZ54EAo72BAACA8AIAnQEqCAAIAABHCIWFiIWEiAICAnWqA/gD+gINTRgA/'
+ 'v0hRf/kb+PnRv/I4//8WE8DijI//FRAo5WBACgAsQEAARAQABgAGFgv9AAIAAAcU7trA'
+ 'QAAAAAAAA67jLOBALeH94EB8YIBfw==';
+
+ setUp(setupFunc);
+ tearDown(tearDownFunc);
+
+ test('with 3 params', () {
+ video.onCanPlay.listen(expectAsync((_) {
+ context.drawImage(video, 50, 50);
+
+ expectPixelFilled(50, 50);
+ expectPixelFilled(54, 54);
+ expectPixelFilled(57, 57);
+ expectPixelUnfilled(58, 58);
+ expectPixelUnfilled(0, 0);
+ expectPixelUnfilled(70, 70);
+ }));
+
+ video.onError.listen((_) {
+ fail('URL failed to load.');
+ });
+
+ if (video.canPlayType('video/webm; codecs="vp8.0, vorbis"', '') != '') {
+ video.src = webmVideoUrl;
+ } else if (video.canPlayType(
+ 'video/mp4; codecs="avc1.4D401E, mp4a.40.2"', null) !=
+ '') {
+ video.src = mp4VideoUrl;
+ } else {
+ window.console.log('Video is not supported on this system.');
+ }
+ });
+
+ test('with 5 params', () {
+ video.onCanPlay.listen(expectAsync((_) {
+ context.drawImageToRect(video, new Rectangle(50, 50, 20, 20));
+
+ expectPixelFilled(50, 50);
+ expectPixelFilled(55, 55);
+ expectPixelFilled(59, 59);
+ expectPixelFilled(60, 60);
+ expectPixelFilled(69, 69);
+ expectPixelUnfilled(70, 70);
+ expectPixelUnfilled(0, 0);
+ expectPixelUnfilled(80, 80);
+ }));
+ video.onError.listen((_) {
+ fail('URL failed to load.');
+ });
+
+ if (video.canPlayType('video/webm; codecs="vp8.0, vorbis"', '') != '') {
+ video.src = webmVideoUrl;
+ } else if (video.canPlayType(
+ 'video/mp4; codecs="avc1.4D401E, mp4a.40.2"', null) !=
+ '') {
+ video.src = mp4VideoUrl;
+ } else {
+ // TODO(amouravski): Better fallback?
+ window.console.log('Video is not supported on this system.');
+ }
+ });
+
+ test('with 9 params', () {
+ video.onCanPlay.listen(expectAsync((_) {
+ context.drawImageToRect(video, new Rectangle(50, 50, 20, 20),
+ sourceRect: new Rectangle(2, 2, 6, 6));
+
+ expectPixelFilled(50, 50);
+ expectPixelFilled(55, 55);
+ expectPixelFilled(59, 59);
+ expectPixelFilled(60, 60);
+ expectPixelFilled(69, 69);
+ expectPixelUnfilled(70, 70);
+ expectPixelUnfilled(0, 0);
+ expectPixelUnfilled(80, 80);
+ }));
+ video.onError.listen((_) {
+ fail('URL failed to load.');
+ });
+
+ if (video.canPlayType('video/webm; codecs="vp8.0, vorbis"', '') != '') {
+ video.src = webmVideoUrl;
+ } else if (video.canPlayType(
+ 'video/mp4; codecs="avc1.4D401E, mp4a.40.2"', null) !=
+ '') {
+ video.src = mp4VideoUrl;
+ } else {
+ // TODO(amouravski): Better fallback?
+ window.console.log('Video is not supported on this system.');
+ }
+ });
+
+ test('dataurl with 9 params', () {
+ video = new VideoElement();
+ canvas = new CanvasElement();
+ video.onCanPlay.listen(expectAsync((_) {
+ context.drawImageToRect(video, new Rectangle(50, 50, 20, 20),
+ sourceRect: new Rectangle(2, 2, 6, 6));
+
+ expectPixelFilled(50, 50);
+ expectPixelFilled(55, 55);
+ expectPixelFilled(59, 59);
+ expectPixelFilled(60, 60);
+ expectPixelFilled(69, 69);
+ expectPixelUnfilled(70, 70);
+ expectPixelUnfilled(0, 0);
+ expectPixelUnfilled(80, 80);
+ }));
+ video.onError.listen((_) {
+ fail('URL failed to load.');
+ });
+
+ if (video.canPlayType('video/webm; codecs="vp8.0, vorbis"', '') != '') {
+ video.src = webmVideoDataUrl;
+ } else if (video.canPlayType(
+ 'video/mp4; codecs="avc1.4D401E, mp4a.40.2"', null) !=
+ '') {
+ video.src = mp4VideoDataUrl;
+ } else {
+ // TODO(amouravski): Better fallback?
+ window.console.log('Video is not supported on this system.');
+ }
+ });
+}
diff --git a/tests/lib_2/html/canvasrendering/fill_text_test.dart b/tests/lib_2/html/canvasrendering/fill_text_test.dart
new file mode 100644
index 0000000..9073bce
--- /dev/null
+++ b/tests/lib_2/html/canvasrendering/fill_text_test.dart
@@ -0,0 +1,85 @@
+// Copyright (c) 2020, 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 canvas_rendering_context_2d_test;
+
+import 'dart:html';
+import 'dart:math';
+
+import 'canvas_rendering_util.dart';
+import 'package:unittest/unittest.dart';
+
+main() {
+ setUp(setupFunc);
+ tearDown(tearDownFunc);
+
+ final x = 20;
+ final y = 20;
+
+ test('without maxWidth', () {
+ context.font = '40pt Garamond';
+ context.fillStyle = 'blue';
+
+ // Draw a blue box.
+ context.fillText('â–ˆ', x, y);
+
+ var width = context.measureText('â–ˆ').width.ceil();
+
+ checkPixel(readPixel(x, y), [0, 0, 255, 255]);
+ checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
+
+ expectPixelUnfilled(x - 10, y);
+ expectPixelFilled(x, y);
+ expectPixelFilled(x + 10, y);
+
+ // The box does not draw after `width` pixels.
+ // Check -2 rather than -1 because this seems
+ // to run into a rounding error on Mac bots.
+ expectPixelFilled(x + width - 2, y);
+ expectPixelUnfilled(x + width + 1, y);
+ });
+
+ test('with maxWidth null', () {
+ context.font = '40pt Garamond';
+ context.fillStyle = 'blue';
+
+ // Draw a blue box with null maxWidth.
+ context.fillText('â–ˆ', x, y, null);
+
+ var width = context.measureText('â–ˆ').width.ceil();
+
+ checkPixel(readPixel(x, y), [0, 0, 255, 255]);
+ checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
+
+ expectPixelUnfilled(x - 10, y);
+ expectPixelFilled(x, y);
+ expectPixelFilled(x + 10, y);
+
+ // The box does not draw after `width` pixels.
+ // Check -2 rather than -1 because this seems
+ // to run into a rounding error on Mac bots.
+ expectPixelFilled(x + width - 2, y);
+ expectPixelUnfilled(x + width + 1, y);
+ });
+
+ test('with maxWidth defined', () {
+ context.font = '40pt Garamond';
+ context.fillStyle = 'blue';
+
+ final maxWidth = 20;
+
+ // Draw a blue box that's at most 20 pixels wide.
+ context.fillText('â–ˆ', x, y, maxWidth);
+
+ checkPixel(readPixel(x, y), [0, 0, 255, 255]);
+ checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
+
+ // The box does not draw after 20 pixels.
+ expectPixelUnfilled(x - 10, y);
+ expectPixelUnfilled(x + maxWidth + 1, y);
+ expectPixelUnfilled(x + maxWidth + 20, y);
+ expectPixelFilled(x, y);
+ expectPixelFilled(x + 10, y);
+ });
+}
diff --git a/tests/lib_2/html/canvasrendering/image_element_test.dart b/tests/lib_2/html/canvasrendering/image_element_test.dart
new file mode 100644
index 0000000..1eac2b9
--- /dev/null
+++ b/tests/lib_2/html/canvasrendering/image_element_test.dart
@@ -0,0 +1,94 @@
+// Copyright (c) 2020, 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 canvas_rendering_context_2d_test;
+
+import 'dart:html';
+import 'dart:math';
+
+import 'canvas_rendering_util.dart';
+import 'package:unittest/unittest.dart';
+
+main() {
+ setUp(setupFunc);
+ tearDown(tearDownFunc);
+ // Draw an image to the canvas from an image element.
+ test('with 3 params', () {
+ var dataUrl = otherCanvas.toDataUrl('image/gif');
+ var img = new ImageElement();
+
+ img.onLoad.listen(expectAsync((_) {
+ context.drawImage(img, 50, 50);
+
+ expectPixelFilled(50, 50);
+ expectPixelFilled(55, 55);
+ expectPixelFilled(59, 59);
+ expectPixelUnfilled(60, 60);
+ expectPixelUnfilled(0, 0);
+ expectPixelUnfilled(70, 70);
+ }));
+ img.onError.listen((_) {
+ fail('URL failed to load.');
+ });
+ img.src = dataUrl;
+ });
+
+ // Draw an image to the canvas from an image element and scale it.
+ test('with 5 params', () {
+ var dataUrl = otherCanvas.toDataUrl('image/gif');
+ var img = new ImageElement();
+
+ img.onLoad.listen(expectAsync((_) {
+ context.drawImageToRect(img, new Rectangle(50, 50, 20, 20));
+
+ expectPixelFilled(50, 50);
+ expectPixelFilled(55, 55);
+ expectPixelFilled(59, 59);
+ expectPixelFilled(60, 60);
+ expectPixelFilled(69, 69);
+ expectPixelUnfilled(70, 70);
+ expectPixelUnfilled(0, 0);
+ expectPixelUnfilled(80, 80);
+ }));
+ img.onError.listen((_) {
+ fail('URL failed to load.');
+ });
+ img.src = dataUrl;
+ });
+
+ // Draw an image to the canvas from an image element and scale it.
+ test('with 9 params', () {
+ otherContext.fillStyle = "blue";
+ otherContext.fillRect(5, 5, 5, 5);
+ var dataUrl = otherCanvas.toDataUrl('image/gif');
+ var img = new ImageElement();
+
+ img.onLoad.listen(expectAsync((_) {
+ // This will take a 6x6 square from the first canvas from position 2,2
+ // and then scale it to a 20x20 square and place it to the second
+ // canvas at 50,50.
+ context.drawImageToRect(img, new Rectangle(50, 50, 20, 20),
+ sourceRect: new Rectangle(2, 2, 6, 6));
+
+ checkPixel(readPixel(50, 50), [255, 0, 0, 255]);
+ checkPixel(readPixel(55, 55), [255, 0, 0, 255]);
+ checkPixel(readPixel(60, 50), [255, 0, 0, 255]);
+ checkPixel(readPixel(65, 65), [0, 0, 255, 255]);
+ checkPixel(readPixel(69, 69), [0, 0, 255, 255]);
+
+ expectPixelFilled(50, 50);
+ expectPixelFilled(55, 55);
+ expectPixelFilled(59, 59);
+ expectPixelFilled(60, 60);
+ expectPixelFilled(69, 69);
+ expectPixelUnfilled(70, 70);
+ expectPixelUnfilled(0, 0);
+ expectPixelUnfilled(80, 80);
+ }));
+ img.onError.listen((_) {
+ fail('URL failed to load.');
+ });
+ img.src = dataUrl;
+ });
+}
diff --git a/tests/lib_2/html/canvasrendering/pixel_manipulation_test.dart b/tests/lib_2/html/canvasrendering/pixel_manipulation_test.dart
new file mode 100644
index 0000000..68fa647
--- /dev/null
+++ b/tests/lib_2/html/canvasrendering/pixel_manipulation_test.dart
@@ -0,0 +1,171 @@
+// Copyright (c) 2020, 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 canvas_rendering_context_2d_test;
+
+import 'dart:html';
+import 'dart:math';
+
+import 'canvas_rendering_util.dart';
+import 'package:unittest/unittest.dart';
+
+main() {
+ setUp(setupFunc);
+ tearDown(tearDownFunc);
+
+ test('setFillColorRgb', () {
+ context.setFillColorRgb(255, 0, 255, 1);
+ context.fillRect(0, 0, canvas.width, canvas.height);
+ expect(readPixel(2, 2), [255, 0, 255, 255]);
+ });
+
+ test('setFillColorHsl hue', () {
+ context.setFillColorHsl(0, 100, 50);
+ context.fillRect(0, 0, canvas.width, canvas.height);
+ checkPixel(readPixel(2, 2), [255, 0, 0, 255]);
+ });
+
+ test('setFillColorHsl hue 2', () {
+ context.setFillColorHsl(240, 100, 50);
+ context.fillRect(0, 0, canvas.width, canvas.height);
+ checkPixel(readPixel(2, 2), [0, 0, 255, 255]);
+ });
+
+ test('setFillColorHsl sat', () {
+ context.setFillColorHsl(0, 0, 50);
+ context.fillRect(0, 0, canvas.width, canvas.height);
+ checkPixel(readPixel(2, 2), [127, 127, 127, 255]);
+ });
+
+ test('setStrokeColorRgb', () {
+ context.setStrokeColorRgb(255, 0, 255, 1);
+ context.lineWidth = 10;
+ context.strokeRect(0, 0, canvas.width, canvas.height);
+ expect(readPixel(2, 2), [255, 0, 255, 255]);
+ });
+
+ test('setStrokeColorHsl hue', () {
+ context.setStrokeColorHsl(0, 100, 50);
+ context.lineWidth = 10;
+ context.strokeRect(0, 0, canvas.width, canvas.height);
+ expect(readPixel(2, 2), [255, 0, 0, 255]);
+ });
+
+ test('setStrokeColorHsl hue 2', () {
+ context.setStrokeColorHsl(240, 100, 50);
+ context.lineWidth = 10;
+ context.strokeRect(0, 0, canvas.width, canvas.height);
+ expect(readPixel(2, 2), [0, 0, 255, 255]);
+ });
+
+ test('setStrokeColorHsl sat', () {
+ context.setStrokeColorHsl(0, 0, 50);
+ context.lineWidth = 10;
+ context.strokeRect(0, 0, canvas.width, canvas.height);
+ checkPixel(readPixel(2, 2), [127, 127, 127, 255]);
+ });
+
+ test('fillStyle', () {
+ context.fillStyle = "red";
+ context.fillRect(0, 0, canvas.width, canvas.height);
+ checkPixel(readPixel(2, 2), [255, 0, 0, 255]);
+ });
+
+ test('strokeStyle', () {
+ context.strokeStyle = "blue";
+ context.lineWidth = 10;
+ context.strokeRect(0, 0, canvas.width, canvas.height);
+ expect(readPixel(2, 2), [0, 0, 255, 255]);
+ });
+
+ test('fillStyle linearGradient', () {
+ var gradient = context.createLinearGradient(0, 0, 20, 20);
+ gradient.addColorStop(0, 'red');
+ gradient.addColorStop(1, 'blue');
+ context.fillStyle = gradient;
+ context.fillRect(0, 0, canvas.width, canvas.height);
+ expect(context.fillStyle is CanvasGradient, isTrue);
+ });
+
+ test('putImageData', () {
+ context.fillStyle = 'green';
+ context.fillRect(0, 0, canvas.width, canvas.height);
+
+ ImageData expectedData = context.getImageData(0, 0, 10, 10);
+ expectedData.data[0] = 25;
+ expectedData.data[1] = 65;
+ expectedData.data[2] = 255;
+ // Set alpha to 255 to make the pixels show up.
+ expectedData.data[3] = 255;
+
+ context.putImageData(expectedData, 0, 0);
+
+ var resultingData = context.getImageData(0, 0, 10, 10);
+ // Make sure that we read back what we wrote.
+ expect(resultingData.data, expectedData.data);
+ });
+
+ test('putImageData dirty rectangle', () {
+ context.fillStyle = 'green';
+ context.fillRect(0, 0, canvas.width, canvas.height);
+
+ ImageData drawnData = context.getImageData(0, 0, 10, 10);
+ drawnData.data[0] = 25;
+ drawnData.data[1] = 65;
+ drawnData.data[2] = 255;
+ drawnData.data[3] = 255;
+
+ // Draw these pixels to the 2nd pixel.
+ drawnData.data[2 * 4 + 0] = 25;
+ drawnData.data[2 * 4 + 1] = 65;
+ drawnData.data[2 * 4 + 2] = 255;
+ drawnData.data[2 * 4 + 3] = 255;
+
+ // Draw these pixels to the 8th pixel.
+ drawnData.data[7 * 4 + 0] = 25;
+ drawnData.data[7 * 4 + 1] = 65;
+ drawnData.data[7 * 4 + 2] = 255;
+ drawnData.data[7 * 4 + 3] = 255;
+
+ // Use a dirty rectangle to limit what pixels are drawn.
+ context.putImageData(drawnData, 0, 0, 1, 0, 5, 5);
+
+ // Expect the data to be all green, as we skip all drawn pixels.
+ ImageData expectedData = context.createImageData(10, 10);
+ for (int i = 0; i < expectedData.data.length; i++) {
+ switch (i % 4) {
+ case 0:
+ expectedData.data[i] = 0;
+ break;
+ case 1:
+ expectedData.data[i] = 128;
+ break;
+ case 2:
+ expectedData.data[i] = 0;
+ break;
+ case 3:
+ expectedData.data[i] = 255;
+ break;
+ }
+ }
+ // Third pixel was copied.
+ expectedData.data[2 * 4 + 0] = 25;
+ expectedData.data[2 * 4 + 1] = 65;
+ expectedData.data[2 * 4 + 2] = 255;
+ expectedData.data[2 * 4 + 3] = 255;
+
+ // Make sure that our data is all green.
+ var resultingData = context.getImageData(0, 0, 10, 10);
+ expect(resultingData.data, expectedData.data);
+ });
+
+ test('putImageData throws with wrong number of arguments', () {
+ ImageData expectedData = context.getImageData(0, 0, 10, 10);
+
+ // TODO(antonm): in Dartium ArgumentError should be thrown too.
+ expect(() => context.putImageData(expectedData, 0, 0, 1), throws);
+ expect(() => context.putImageData(expectedData, 0, 0, 1, 1), throws);
+ expect(() => context.putImageData(expectedData, 0, 0, 1, 1, 5), throws);
+ });
+}
diff --git a/tests/lib_2/html/canvasrenderingcontext2d_test.dart b/tests/lib_2/html/canvasrenderingcontext2d_test.dart
deleted file mode 100644
index c563509..0000000
--- a/tests/lib_2/html/canvasrenderingcontext2d_test.dart
+++ /dev/null
@@ -1,749 +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 canvas_rendering_context_2d_test;
-
-import 'dart:html';
-import 'dart:math';
-
-import 'package:unittest/html_individual_config.dart';
-import 'package:unittest/unittest.dart';
-
-// Some rounding errors in the browsers.
-checkPixel(List<int> pixel, List<int> expected) {
- expect(pixel[0], closeTo(expected[0], 2));
- expect(pixel[1], closeTo(expected[1], 2));
- expect(pixel[2], closeTo(expected[2], 2));
- expect(pixel[3], closeTo(expected[3], 2));
-}
-
-var canvas;
-var context;
-var otherCanvas;
-var otherContext;
-var video;
-
-void createCanvas() {
- canvas = new CanvasElement();
- canvas.width = 100;
- canvas.height = 100;
-
- context = canvas.context2D;
-}
-
-void createOtherCanvas() {
- otherCanvas = new CanvasElement();
- otherCanvas.width = 10;
- otherCanvas.height = 10;
- otherContext = otherCanvas.context2D;
- otherContext.fillStyle = "red";
- otherContext.fillRect(0, 0, otherCanvas.width, otherCanvas.height);
-}
-
-void setupFunc() {
- createCanvas();
- createOtherCanvas();
- video = new VideoElement();
-}
-
-void tearDownFunc() {
- canvas = null;
- context = null;
- otherCanvas = null;
- otherContext = null;
- video = null;
-}
-
-List<int> readPixel(int x, int y) {
- var imageData = context.getImageData(x, y, 1, 1);
- return imageData.data;
-}
-
-/// Returns true if the pixel has some data in it, false otherwise.
-bool isPixelFilled(int x, int y) => readPixel(x, y).any((p) => p != 0);
-
-String pixelDataToString(List<int> data, int x, int y) {
- return '[${data.join(", ")}]';
-}
-
-String _filled(bool v) => v ? "filled" : "unfilled";
-
-void expectPixelFilled(int x, int y, [bool filled = true]) {
- expect(isPixelFilled(x, y), filled,
- reason: 'Pixel at ($x, $y) was expected to'
- ' be: <${_filled(filled)}> but was: <${_filled(!filled)}> with data: '
- '${pixelDataToString(readPixel(x, y), x, y)}');
-}
-
-void expectPixelUnfilled(int x, int y) {
- expectPixelFilled(x, y, false);
-}
-
-main() {
- useHtmlIndividualConfiguration();
-
- group('pixel_manipulation', () {
- setUp(setupFunc);
- tearDown(tearDownFunc);
-
- test('setFillColorRgb', () {
- context.setFillColorRgb(255, 0, 255, 1);
- context.fillRect(0, 0, canvas.width, canvas.height);
- expect(readPixel(2, 2), [255, 0, 255, 255]);
- });
-
- test('setFillColorHsl hue', () {
- context.setFillColorHsl(0, 100, 50);
- context.fillRect(0, 0, canvas.width, canvas.height);
- checkPixel(readPixel(2, 2), [255, 0, 0, 255]);
- });
-
- test('setFillColorHsl hue 2', () {
- context.setFillColorHsl(240, 100, 50);
- context.fillRect(0, 0, canvas.width, canvas.height);
- checkPixel(readPixel(2, 2), [0, 0, 255, 255]);
- });
-
- test('setFillColorHsl sat', () {
- context.setFillColorHsl(0, 0, 50);
- context.fillRect(0, 0, canvas.width, canvas.height);
- checkPixel(readPixel(2, 2), [127, 127, 127, 255]);
- });
-
- test('setStrokeColorRgb', () {
- context.setStrokeColorRgb(255, 0, 255, 1);
- context.lineWidth = 10;
- context.strokeRect(0, 0, canvas.width, canvas.height);
- expect(readPixel(2, 2), [255, 0, 255, 255]);
- });
-
- test('setStrokeColorHsl hue', () {
- context.setStrokeColorHsl(0, 100, 50);
- context.lineWidth = 10;
- context.strokeRect(0, 0, canvas.width, canvas.height);
- expect(readPixel(2, 2), [255, 0, 0, 255]);
- });
-
- test('setStrokeColorHsl hue 2', () {
- context.setStrokeColorHsl(240, 100, 50);
- context.lineWidth = 10;
- context.strokeRect(0, 0, canvas.width, canvas.height);
- expect(readPixel(2, 2), [0, 0, 255, 255]);
- });
-
- test('setStrokeColorHsl sat', () {
- context.setStrokeColorHsl(0, 0, 50);
- context.lineWidth = 10;
- context.strokeRect(0, 0, canvas.width, canvas.height);
- checkPixel(readPixel(2, 2), [127, 127, 127, 255]);
- });
-
- test('fillStyle', () {
- context.fillStyle = "red";
- context.fillRect(0, 0, canvas.width, canvas.height);
- checkPixel(readPixel(2, 2), [255, 0, 0, 255]);
- });
-
- test('strokeStyle', () {
- context.strokeStyle = "blue";
- context.lineWidth = 10;
- context.strokeRect(0, 0, canvas.width, canvas.height);
- expect(readPixel(2, 2), [0, 0, 255, 255]);
- });
-
- test('fillStyle linearGradient', () {
- var gradient = context.createLinearGradient(0, 0, 20, 20);
- gradient.addColorStop(0, 'red');
- gradient.addColorStop(1, 'blue');
- context.fillStyle = gradient;
- context.fillRect(0, 0, canvas.width, canvas.height);
- expect(context.fillStyle is CanvasGradient, isTrue);
- });
-
- test('putImageData', () {
- context.fillStyle = 'green';
- context.fillRect(0, 0, canvas.width, canvas.height);
-
- ImageData expectedData = context.getImageData(0, 0, 10, 10);
- expectedData.data[0] = 25;
- expectedData.data[1] = 65;
- expectedData.data[2] = 255;
- // Set alpha to 255 to make the pixels show up.
- expectedData.data[3] = 255;
-
- context.putImageData(expectedData, 0, 0);
-
- var resultingData = context.getImageData(0, 0, 10, 10);
- // Make sure that we read back what we wrote.
- expect(resultingData.data, expectedData.data);
- });
-
- test('putImageData dirty rectangle', () {
- context.fillStyle = 'green';
- context.fillRect(0, 0, canvas.width, canvas.height);
-
- ImageData drawnData = context.getImageData(0, 0, 10, 10);
- drawnData.data[0] = 25;
- drawnData.data[1] = 65;
- drawnData.data[2] = 255;
- drawnData.data[3] = 255;
-
- // Draw these pixels to the 2nd pixel.
- drawnData.data[2 * 4 + 0] = 25;
- drawnData.data[2 * 4 + 1] = 65;
- drawnData.data[2 * 4 + 2] = 255;
- drawnData.data[2 * 4 + 3] = 255;
-
- // Draw these pixels to the 8th pixel.
- drawnData.data[7 * 4 + 0] = 25;
- drawnData.data[7 * 4 + 1] = 65;
- drawnData.data[7 * 4 + 2] = 255;
- drawnData.data[7 * 4 + 3] = 255;
-
- // Use a dirty rectangle to limit what pixels are drawn.
- context.putImageData(drawnData, 0, 0, 1, 0, 5, 5);
-
- // Expect the data to be all green, as we skip all drawn pixels.
- ImageData expectedData = context.createImageData(10, 10);
- for (int i = 0; i < expectedData.data.length; i++) {
- switch (i % 4) {
- case 0:
- expectedData.data[i] = 0;
- break;
- case 1:
- expectedData.data[i] = 128;
- break;
- case 2:
- expectedData.data[i] = 0;
- break;
- case 3:
- expectedData.data[i] = 255;
- break;
- }
- }
- // Third pixel was copied.
- expectedData.data[2 * 4 + 0] = 25;
- expectedData.data[2 * 4 + 1] = 65;
- expectedData.data[2 * 4 + 2] = 255;
- expectedData.data[2 * 4 + 3] = 255;
-
- // Make sure that our data is all green.
- var resultingData = context.getImageData(0, 0, 10, 10);
- expect(resultingData.data, expectedData.data);
- });
-
- test('putImageData throws with wrong number of arguments', () {
- ImageData expectedData = context.getImageData(0, 0, 10, 10);
-
- // TODO(antonm): in Dartium ArgumentError should be thrown too.
- expect(() => context.putImageData(expectedData, 0, 0, 1), throws);
- expect(() => context.putImageData(expectedData, 0, 0, 1, 1), throws);
- expect(() => context.putImageData(expectedData, 0, 0, 1, 1, 5), throws);
- });
- });
-
- group('arc', () {
- setUp(setupFunc);
- tearDown(tearDownFunc);
-
- test('default arc should be clockwise', () {
- context.beginPath();
- final r = 10;
-
- // Center of arc.
- final cx = 20;
- final cy = 20;
- // Arc centered at (20, 20) with radius 10 will go clockwise
- // from (20 + r, 20) to (20, 20 + r), which is 1/4 of a circle.
- context.arc(cx, cy, r, 0, pi / 2);
-
- context.strokeStyle = 'green';
- context.lineWidth = 2;
- context.stroke();
-
- // Center should not be filled.
- expectPixelUnfilled(cx, cy);
-
- // (cx + r, cy) should be filled.
- expectPixelFilled(cx + r, cy, true);
- // (cx, cy + r) should be filled.
- expectPixelFilled(cx, cy + r, true);
- // (cx - r, cy) should be empty.
- expectPixelFilled(cx - r, cy, false);
- // (cx, cy - r) should be empty.
- expectPixelFilled(cx, cy - r, false);
-
- // (cx + r/SQRT2, cy + r/SQRT2) should be filled.
- expectPixelFilled(
- (cx + r / sqrt2).toInt(), (cy + r / sqrt2).toInt(), true);
-
- // (cx - r/SQRT2, cy - r/SQRT2) should be empty.
- expectPixelFilled(
- (cx - r / sqrt2).toInt(), (cy + r / sqrt2).toInt(), false);
-
- // (cx + r/SQRT2, cy + r/SQRT2) should be empty.
- expectPixelFilled(
- (cx - r / sqrt2).toInt(), (cy - r / sqrt2).toInt(), false);
-
- // (cx - r/SQRT2, cy - r/SQRT2) should be empty.
- expectPixelFilled(
- (cx + r / sqrt2).toInt(), (cy - r / sqrt2).toInt(), false);
- });
-
- test('arc anticlockwise', () {
- context.beginPath();
- final r = 10;
-
- // Center of arc.
- final cx = 20;
- final cy = 20;
- // Arc centered at (20, 20) with radius 10 will go anticlockwise
- // from (20 + r, 20) to (20, 20 + r), which is 3/4 of a circle.
- // Because of the way arc work, when going anti-clockwise, the end points
- // are not included, so small values are added to radius to make a little
- // more than a 3/4 circle.
- context.arc(cx, cy, r, .1, pi / 2 - .1, true);
-
- context.strokeStyle = 'green';
- context.lineWidth = 2;
- context.stroke();
-
- // Center should not be filled.
- expectPixelUnfilled(cx, cy);
-
- // (cx + r, cy) should be filled.
- expectPixelFilled(cx + r, cy, true);
- // (cx, cy + r) should be filled.
- expectPixelFilled(cx, cy + r, true);
- // (cx - r, cy) should be filled.
- expectPixelFilled(cx - r, cy, true);
- // (cx, cy - r) should be filled.
- expectPixelFilled(cx, cy - r, true);
-
- // (cx + r/SQRT2, cy + r/SQRT2) should be empty.
- expectPixelFilled(
- (cx + r / sqrt2).toInt(), (cy + r / sqrt2).toInt(), false);
-
- // (cx - r/SQRT2, cy - r/SQRT2) should be filled.
- expectPixelFilled(
- (cx - r / sqrt2).toInt(), (cy + r / sqrt2).toInt(), true);
-
- // (cx + r/SQRT2, cy + r/SQRT2) should be filled.
- expectPixelFilled(
- (cx - r / sqrt2).toInt(), (cy - r / sqrt2).toInt(), true);
-
- // (cx - r/SQRT2, cy - r/SQRT2) should be filled.
- expectPixelFilled(
- (cx + r / sqrt2).toInt(), (cy - r / sqrt2).toInt(), true);
- });
- });
-
- group('drawImage_image_element', () {
- setUp(setupFunc);
- tearDown(tearDownFunc);
- // Draw an image to the canvas from an image element.
- test('with 3 params', () {
- var dataUrl = otherCanvas.toDataUrl('image/gif');
- var img = new ImageElement();
-
- img.onLoad.listen(expectAsync((_) {
- context.drawImage(img, 50, 50);
-
- expectPixelFilled(50, 50);
- expectPixelFilled(55, 55);
- expectPixelFilled(59, 59);
- expectPixelUnfilled(60, 60);
- expectPixelUnfilled(0, 0);
- expectPixelUnfilled(70, 70);
- }));
- img.onError.listen((_) {
- fail('URL failed to load.');
- });
- img.src = dataUrl;
- });
-
- // Draw an image to the canvas from an image element and scale it.
- test('with 5 params', () {
- var dataUrl = otherCanvas.toDataUrl('image/gif');
- var img = new ImageElement();
-
- img.onLoad.listen(expectAsync((_) {
- context.drawImageToRect(img, new Rectangle(50, 50, 20, 20));
-
- expectPixelFilled(50, 50);
- expectPixelFilled(55, 55);
- expectPixelFilled(59, 59);
- expectPixelFilled(60, 60);
- expectPixelFilled(69, 69);
- expectPixelUnfilled(70, 70);
- expectPixelUnfilled(0, 0);
- expectPixelUnfilled(80, 80);
- }));
- img.onError.listen((_) {
- fail('URL failed to load.');
- });
- img.src = dataUrl;
- });
-
- // Draw an image to the canvas from an image element and scale it.
- test('with 9 params', () {
- otherContext.fillStyle = "blue";
- otherContext.fillRect(5, 5, 5, 5);
- var dataUrl = otherCanvas.toDataUrl('image/gif');
- var img = new ImageElement();
-
- img.onLoad.listen(expectAsync((_) {
- // This will take a 6x6 square from the first canvas from position 2,2
- // and then scale it to a 20x20 square and place it to the second
- // canvas at 50,50.
- context.drawImageToRect(img, new Rectangle(50, 50, 20, 20),
- sourceRect: new Rectangle(2, 2, 6, 6));
-
- checkPixel(readPixel(50, 50), [255, 0, 0, 255]);
- checkPixel(readPixel(55, 55), [255, 0, 0, 255]);
- checkPixel(readPixel(60, 50), [255, 0, 0, 255]);
- checkPixel(readPixel(65, 65), [0, 0, 255, 255]);
- checkPixel(readPixel(69, 69), [0, 0, 255, 255]);
-
- expectPixelFilled(50, 50);
- expectPixelFilled(55, 55);
- expectPixelFilled(59, 59);
- expectPixelFilled(60, 60);
- expectPixelFilled(69, 69);
- expectPixelUnfilled(70, 70);
- expectPixelUnfilled(0, 0);
- expectPixelUnfilled(80, 80);
- }));
- img.onError.listen((_) {
- fail('URL failed to load.');
- });
- img.src = dataUrl;
- });
- });
-
- // These videos and base64 strings are the same video, representing 2
- // frames of 8x8 red pixels.
- // The videos were created with:
- // convert -size 8x8 xc:red blank1.jpg
- // convert -size 8x8 xc:red blank2.jpg
- // avconv -f image2 -i "blank%d.jpg" -c:v libx264 small.mp4
- // avconv -i small.mp4 small.webm
- // python -m base64 -e small.mp4
- // python -m base64 -e small.webm
- var mp4VideoUrl = '/root_dart/tests/lib_2/html/small.mp4';
- var webmVideoUrl = '/root_dart/tests/lib_2/html/small.webm';
- var mp4VideoDataUrl =
- 'data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAA'
- 'AIZnJlZQAAAsdtZGF0AAACmwYF//+X3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlID'
- 'EyMCByMjE1MSBhM2Y0NDA3IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZW'
- 'Z0IDIwMDMtMjAxMSAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG'
- '9wdGlvbnM6IGNhYmFjPTEgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweD'
- 'ExMSBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj'
- '0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MCBjcW09MC'
- 'BkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aH'
- 'JlYWRzPTE4IHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZW'
- 'Q9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl'
- '9weXJhbWlkPTAgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MCBvcG'
- 'VuX2dvcD0xIHdlaWdodHA9MiBrZXlpbnQ9MjUwIGtleWludF9taW49MjUgc2NlbmVjdX'
- 'Q9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD00MCByYz1jcmYgbWJ0cmVlPT'
- 'EgY3JmPTUxLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IGlwX3'
- 'JhdGlvPTEuMjUgYXE9MToxLjAwAIAAAAARZYiEB//3aoK5/tP9+8yeuIEAAAAHQZoi2P'
- '/wgAAAAzxtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAAUAABAAABAAAAAAAAAA'
- 'AAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAA'
- 'AAAAAAAAAAAAAAAAAAAAACAAAAGGlvZHMAAAAAEICAgAcAT/////7/AAACUHRyYWsAAA'
- 'BcdGtoZAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAQAAAA'
- 'AAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAACAAAAAgAAAAAACRlZHRzAAAAHG'
- 'Vsc3QAAAAAAAAAAQAAAFAAAAABAAEAAAAAAchtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAA'
- 'AAAAAZAAAAAlXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSG'
- 'FuZGxlcgAAAAFzbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZg'
- 'AAAAAAAAABAAAADHVybCAAAAABAAABM3N0YmwAAACXc3RzZAAAAAAAAAABAAAAh2F2Yz'
- 'EAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAACAAIAEgAAABIAAAAAAAAAAEAAAAAAAAAAA'
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAxYXZjQwFNQAr/4QAYZ01ACuiPyy'
- '4C2QAAAwABAAADADIPEiUSAQAGaOvAZSyAAAAAGHN0dHMAAAAAAAAAAQAAAAIAAAABAA'
- 'AAFHN0c3MAAAAAAAAAAQAAAAEAAAAYY3R0cwAAAAAAAAABAAAAAgAAAAEAAAAcc3RzYw'
- 'AAAAAAAAABAAAAAQAAAAEAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAK0AAAACwAAAB'
- 'hzdGNvAAAAAAAAAAIAAAAwAAAC5AAAAGB1ZHRhAAAAWG1ldGEAAAAAAAAAIWhkbHIAAA'
- 'AAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAK2lsc3QAAAAjqXRvbwAAABtkYXRhAAAAAQ'
- 'AAAABMYXZmNTMuMjEuMQ==';
- var webmVideoDataUrl =
- 'data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlY'
- 'm1Ch4ECQoWBAhhTgGcBAAAAAAAB/hFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua'
- '1OsggEsTbuMU6uEHFO7a1OsggHk7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAA'
- 'EEq17GDD0JATYCLTGF2ZjUzLjIxLjFXQYtMYXZmNTMuMjEuMXOkkJatuHwTJ7cvFLSzB'
- 'Smxbp5EiYhAVAAAAAAAABZUrmsBAAAAAAAAR64BAAAAAAAAPteBAXPFgQGcgQAitZyDd'
- 'W5khoVWX1ZQOIOBASPjg4QCYloA4AEAAAAAAAASsIEIuoEIVLCBCFS6gQhUsoEDH0O2d'
- 'QEAAAAAAABZ54EAo72BAACA8AIAnQEqCAAIAABHCIWFiIWEiAICAnWqA/gD+gINTRgA/'
- 'v0hRf/kb+PnRv/I4//8WE8DijI//FRAo5WBACgAsQEAARAQABgAGFgv9AAIAAAcU7trA'
- 'QAAAAAAAA67jLOBALeH94EB8YIBfw==';
- group('drawImage_video_element', () {
- setUp(setupFunc);
- tearDown(tearDownFunc);
-
- test('with 3 params', () {
- video.onCanPlay.listen(expectAsync((_) {
- context.drawImage(video, 50, 50);
-
- expectPixelFilled(50, 50);
- expectPixelFilled(54, 54);
- expectPixelFilled(57, 57);
- expectPixelUnfilled(58, 58);
- expectPixelUnfilled(0, 0);
- expectPixelUnfilled(70, 70);
- }));
-
- video.onError.listen((_) {
- fail('URL failed to load.');
- });
-
- if (video.canPlayType('video/webm; codecs="vp8.0, vorbis"', '') != '') {
- video.src = webmVideoUrl;
- } else if (video.canPlayType(
- 'video/mp4; codecs="avc1.4D401E, mp4a.40.2"', null) !=
- '') {
- video.src = mp4VideoUrl;
- } else {
- window.console.log('Video is not supported on this system.');
- }
- });
-
- test('with 5 params', () {
- video.onCanPlay.listen(expectAsync((_) {
- context.drawImageToRect(video, new Rectangle(50, 50, 20, 20));
-
- expectPixelFilled(50, 50);
- expectPixelFilled(55, 55);
- expectPixelFilled(59, 59);
- expectPixelFilled(60, 60);
- expectPixelFilled(69, 69);
- expectPixelUnfilled(70, 70);
- expectPixelUnfilled(0, 0);
- expectPixelUnfilled(80, 80);
- }));
- video.onError.listen((_) {
- fail('URL failed to load.');
- });
-
- if (video.canPlayType('video/webm; codecs="vp8.0, vorbis"', '') != '') {
- video.src = webmVideoUrl;
- } else if (video.canPlayType(
- 'video/mp4; codecs="avc1.4D401E, mp4a.40.2"', null) !=
- '') {
- video.src = mp4VideoUrl;
- } else {
- // TODO(amouravski): Better fallback?
- window.console.log('Video is not supported on this system.');
- }
- });
-
- test('with 9 params', () {
- video.onCanPlay.listen(expectAsync((_) {
- context.drawImageToRect(video, new Rectangle(50, 50, 20, 20),
- sourceRect: new Rectangle(2, 2, 6, 6));
-
- expectPixelFilled(50, 50);
- expectPixelFilled(55, 55);
- expectPixelFilled(59, 59);
- expectPixelFilled(60, 60);
- expectPixelFilled(69, 69);
- expectPixelUnfilled(70, 70);
- expectPixelUnfilled(0, 0);
- expectPixelUnfilled(80, 80);
- }));
- video.onError.listen((_) {
- fail('URL failed to load.');
- });
-
- if (video.canPlayType('video/webm; codecs="vp8.0, vorbis"', '') != '') {
- video.src = webmVideoUrl;
- } else if (video.canPlayType(
- 'video/mp4; codecs="avc1.4D401E, mp4a.40.2"', null) !=
- '') {
- video.src = mp4VideoUrl;
- } else {
- // TODO(amouravski): Better fallback?
- window.console.log('Video is not supported on this system.');
- }
- });
- });
-
- group('drawImage_video_element_dataUrl', () {
- setUp(setupFunc);
- tearDown(tearDownFunc);
-
- test('with 9 params', () {
- video = new VideoElement();
- canvas = new CanvasElement();
- video.onCanPlay.listen(expectAsync((_) {
- context.drawImageToRect(video, new Rectangle(50, 50, 20, 20),
- sourceRect: new Rectangle(2, 2, 6, 6));
-
- expectPixelFilled(50, 50);
- expectPixelFilled(55, 55);
- expectPixelFilled(59, 59);
- expectPixelFilled(60, 60);
- expectPixelFilled(69, 69);
- expectPixelUnfilled(70, 70);
- expectPixelUnfilled(0, 0);
- expectPixelUnfilled(80, 80);
- }));
- video.onError.listen((_) {
- fail('URL failed to load.');
- });
-
- if (video.canPlayType('video/webm; codecs="vp8.0, vorbis"', '') != '') {
- video.src = webmVideoDataUrl;
- } else if (video.canPlayType(
- 'video/mp4; codecs="avc1.4D401E, mp4a.40.2"', null) !=
- '') {
- video.src = mp4VideoDataUrl;
- } else {
- // TODO(amouravski): Better fallback?
- window.console.log('Video is not supported on this system.');
- }
- });
- });
-
- group('drawImage_canvas_element', () {
- setUp(setupFunc);
- tearDown(tearDownFunc);
-
- test('with 3 params', () {
- // Draw an image to the canvas from a canvas element.
- context.drawImage(otherCanvas, 50, 50);
-
- expectPixelFilled(50, 50);
- expectPixelFilled(55, 55);
- expectPixelFilled(59, 59);
- expectPixelUnfilled(60, 60);
- expectPixelUnfilled(0, 0);
- expectPixelUnfilled(70, 70);
- });
- test('with 5 params', () {
- // Draw an image to the canvas from a canvas element.
- context.drawImageToRect(otherCanvas, new Rectangle(50, 50, 20, 20));
-
- expectPixelFilled(50, 50);
- expectPixelFilled(55, 55);
- expectPixelFilled(59, 59);
- expectPixelFilled(60, 60);
- expectPixelFilled(69, 69);
- expectPixelUnfilled(70, 70);
- expectPixelUnfilled(0, 0);
- expectPixelUnfilled(80, 80);
- });
- test('with 9 params', () {
- // Draw an image to the canvas from a canvas element.
- otherContext.fillStyle = "blue";
- otherContext.fillRect(5, 5, 5, 5);
- context.drawImageToRect(otherCanvas, new Rectangle(50, 50, 20, 20),
- sourceRect: new Rectangle(2, 2, 6, 6));
-
- checkPixel(readPixel(50, 50), [255, 0, 0, 255]);
- checkPixel(readPixel(55, 55), [255, 0, 0, 255]);
- checkPixel(readPixel(60, 50), [255, 0, 0, 255]);
- checkPixel(readPixel(65, 65), [0, 0, 255, 255]);
- checkPixel(readPixel(69, 69), [0, 0, 255, 255]);
- expectPixelFilled(50, 50);
- expectPixelFilled(55, 55);
- expectPixelFilled(59, 59);
- expectPixelFilled(60, 60);
- expectPixelFilled(69, 69);
- expectPixelUnfilled(70, 70);
- expectPixelUnfilled(0, 0);
- expectPixelUnfilled(80, 80);
- });
-
- test('createImageData', () {
- var imageData = context.createImageData(15, 15);
- expect(imageData.width, 15);
- expect(imageData.height, 15);
-
- var other = context.createImageDataFromImageData(imageData);
- expect(other.width, 15);
- expect(other.height, 15);
- });
-
- test('createPattern', () {
- var pattern = context.createPattern(new CanvasElement(), '');
- //var pattern2 = context.createPatternFromImage(new ImageElement(), '');
- });
- });
-
- group('fillText', () {
- setUp(setupFunc);
- tearDown(tearDownFunc);
-
- final x = 20;
- final y = 20;
-
- test('without maxWidth', () {
- context.font = '40pt Garamond';
- context.fillStyle = 'blue';
-
- // Draw a blue box.
- context.fillText('â–ˆ', x, y);
-
- var width = context.measureText('â–ˆ').width.ceil();
-
- checkPixel(readPixel(x, y), [0, 0, 255, 255]);
- checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
-
- expectPixelUnfilled(x - 10, y);
- expectPixelFilled(x, y);
- expectPixelFilled(x + 10, y);
-
- // The box does not draw after `width` pixels.
- // Check -2 rather than -1 because this seems
- // to run into a rounding error on Mac bots.
- expectPixelFilled(x + width - 2, y);
- expectPixelUnfilled(x + width + 1, y);
- });
-
- test('with maxWidth null', () {
- context.font = '40pt Garamond';
- context.fillStyle = 'blue';
-
- // Draw a blue box with null maxWidth.
- context.fillText('â–ˆ', x, y, null);
-
- var width = context.measureText('â–ˆ').width.ceil();
-
- checkPixel(readPixel(x, y), [0, 0, 255, 255]);
- checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
-
- expectPixelUnfilled(x - 10, y);
- expectPixelFilled(x, y);
- expectPixelFilled(x + 10, y);
-
- // The box does not draw after `width` pixels.
- // Check -2 rather than -1 because this seems
- // to run into a rounding error on Mac bots.
- expectPixelFilled(x + width - 2, y);
- expectPixelUnfilled(x + width + 1, y);
- });
-
- test('with maxWidth defined', () {
- context.font = '40pt Garamond';
- context.fillStyle = 'blue';
-
- final maxWidth = 20;
-
- // Draw a blue box that's at most 20 pixels wide.
- context.fillText('â–ˆ', x, y, maxWidth);
-
- checkPixel(readPixel(x, y), [0, 0, 255, 255]);
- checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
-
- // The box does not draw after 20 pixels.
- expectPixelUnfilled(x - 10, y);
- expectPixelUnfilled(x + maxWidth + 1, y);
- expectPixelUnfilled(x + maxWidth + 20, y);
- expectPixelFilled(x, y);
- expectPixelFilled(x + 10, y);
- });
- });
-}
diff --git a/tests/lib_2/html/css_selector_test.dart b/tests/lib_2/html/css_selector_test.dart
index 5fcbd9e..2b001a0 100644
--- a/tests/lib_2/html/css_selector_test.dart
+++ b/tests/lib_2/html/css_selector_test.dart
@@ -4,13 +4,10 @@
import 'dart:html';
-import 'package:unittest/unittest.dart';
-import 'package:unittest/html_individual_config.dart';
+import 'package:expect/expect.dart';
import 'utils.dart';
main() {
- useHtmlIndividualConfiguration();
-
final String htmlPayload = "<div>"
"<div>"
"<p class='a'>"
@@ -32,18 +29,20 @@
para.classes.removeAll(['a', 'b']);
para = document.body.querySelector('p') as ParagraphElement;
- expect(para.outerHtml, '<p class=""><span>Test #1</span></p>');
+ Expect.equals('<p class=""><span>Test #1</span></p>', para.outerHtml);
para = document.body.querySelector('p') as ParagraphElement;
para.classes.addAll(['c']);
para = document.body.querySelector('p') as ParagraphElement;
- expect(para.outerHtml, '<p class="c"><span>Test #1</span></p>');
+ Expect.equals('<p class="c"><span>Test #1</span></p>', para.outerHtml);
var allPara = document.body.querySelectorAll('p');
allPara.classes.removeAll(['b', 'c']);
var checkAllPara = document.body.querySelectorAll('p');
- expect(checkAllPara[0].outerHtml, '<p class=""><span>Test #1</span></p>');
- expect(checkAllPara[1].outerHtml, '<p class=""><span>Test #2</span></p>');
+ Expect.equals(
+ '<p class=""><span>Test #1</span></p>', checkAllPara[0].outerHtml);
+ Expect.equals(
+ '<p class=""><span>Test #2</span></p>', checkAllPara[1].outerHtml);
}
diff --git a/tests/lib_2/html/custom/regress_194523002_test.dart b/tests/lib_2/html/custom/regress_194523002_test.dart
index a705e34..bfecc97 100644
--- a/tests/lib_2/html/custom/regress_194523002_test.dart
+++ b/tests/lib_2/html/custom/regress_194523002_test.dart
@@ -5,7 +5,6 @@
// Regression test for CL 194523002.
import 'dart:html';
-import 'package:unittest/html_individual_config.dart';
import 'package:unittest/unittest.dart';
import 'utils.dart';
@@ -17,8 +16,6 @@
}
main() {
- useHtmlIndividualConfiguration();
-
// Adapted from Blink's
// fast/dom/custom/constructor-calls-created-synchronously test.
diff --git a/tests/lib_2/html/custom_element_method_clash_test.dart b/tests/lib_2/html/custom_element_method_clash_test.dart
index b9ad26d..dca1d12 100644
--- a/tests/lib_2/html/custom_element_method_clash_test.dart
+++ b/tests/lib_2/html/custom_element_method_clash_test.dart
@@ -6,7 +6,6 @@
import 'dart:async';
import 'dart:html';
-import 'package:unittest/html_individual_config.dart';
import 'package:unittest/unittest.dart';
import 'utils.dart';
@@ -22,8 +21,6 @@
}
main() {
- useHtmlIndividualConfiguration();
-
setUp(() => customElementsReady);
group('test', () {
diff --git a/tests/lib_2/html/custom_element_name_clash_test.dart b/tests/lib_2/html/custom_element_name_clash_test.dart
index 58e29d3..3ca1768 100644
--- a/tests/lib_2/html/custom_element_name_clash_test.dart
+++ b/tests/lib_2/html/custom_element_name_clash_test.dart
@@ -6,7 +6,6 @@
import 'dart:async';
import 'dart:html';
-import 'package:unittest/html_individual_config.dart';
import 'package:unittest/unittest.dart';
import 'utils.dart';
@@ -20,8 +19,6 @@
}
main() {
- useHtmlIndividualConfiguration();
-
setUp(() => customElementsReady);
group('test', () {
diff --git a/tests/lib_2/html/custom_elements_23127_test.dart b/tests/lib_2/html/custom_elements_23127_test.dart
index 559dbb1..6e04e01 100644
--- a/tests/lib_2/html/custom_elements_23127_test.dart
+++ b/tests/lib_2/html/custom_elements_23127_test.dart
@@ -10,7 +10,6 @@
import 'dart:async';
import 'dart:html';
-import 'package:unittest/html_individual_config.dart';
import 'package:unittest/unittest.dart';
import 'utils.dart';
@@ -88,8 +87,6 @@
var callTwice;
main() {
- useHtmlIndividualConfiguration();
-
setUp(() => customElementsReady);
callTwice = (f) {
diff --git a/tests/lib_2/html/custom_elements_test.dart b/tests/lib_2/html/custom_elements_test.dart
index 223145e..6c787c4 100644
--- a/tests/lib_2/html/custom_elements_test.dart
+++ b/tests/lib_2/html/custom_elements_test.dart
@@ -6,7 +6,6 @@
import 'dart:async';
import 'dart:html';
-import 'package:unittest/html_individual_config.dart';
import 'package:unittest/unittest.dart';
import 'utils.dart';
@@ -40,8 +39,6 @@
class NotAnElement {}
main() {
- useHtmlIndividualConfiguration();
-
setUp(() => customElementsReady);
group('register', () {
diff --git a/tests/lib_2/html/form_data_test.dart b/tests/lib_2/html/form_data_test.dart
index 825b545..2a01ea0 100644
--- a/tests/lib_2/html/form_data_test.dart
+++ b/tests/lib_2/html/form_data_test.dart
@@ -5,14 +5,11 @@
library FormDataTest;
import 'package:unittest/unittest.dart';
-import 'package:unittest/html_individual_config.dart';
import 'dart:html';
void main() {
// TODO(efortuna): This is a bad test. Revisit when we have tests that can run
// both a server and fire up a browser.
- useHtmlIndividualConfiguration();
-
group('supported', () {
test('supported', () {
expect(FormData.supported, isTrue);
diff --git a/tests/lib_2/html/history_hash_change_test.dart b/tests/lib_2/html/history_hash_change_test.dart
index c16263c..8bca7e0 100644
--- a/tests/lib_2/html/history_hash_change_test.dart
+++ b/tests/lib_2/html/history_hash_change_test.dart
@@ -1,13 +1,10 @@
library HistoryTest;
import 'package:unittest/unittest.dart';
-import 'package:unittest/html_individual_config.dart';
import 'dart:html';
import 'dart:async';
main() {
- useHtmlIndividualConfiguration();
-
test('supported', () {
expect(HashChangeEvent.supported, true);
});
diff --git a/tests/lib_2/html/history_supports_tests.dart b/tests/lib_2/html/history_supports_tests.dart
index a405bfa..0459fae 100644
--- a/tests/lib_2/html/history_supports_tests.dart
+++ b/tests/lib_2/html/history_supports_tests.dart
@@ -1,13 +1,10 @@
library HistoryTest;
import 'package:unittest/unittest.dart';
-import 'package:unittest/html_individual_config.dart';
import 'dart:html';
import 'dart:async';
main() {
- useHtmlIndividualConfiguration();
-
test('supportsState', () {
expect(History.supportsState, true);
});
diff --git a/tests/lib_2/html/interactive_test.dart b/tests/lib_2/html/interactive_test.dart
index 39227b6..d1f1269 100644
--- a/tests/lib_2/html/interactive_test.dart
+++ b/tests/lib_2/html/interactive_test.dart
@@ -7,12 +7,9 @@
import 'dart:async';
import 'dart:html';
import 'package:unittest/unittest.dart';
-import 'package:unittest/html_individual_config.dart';
import 'utils.dart';
main() {
- useHtmlIndividualConfiguration();
-
group('KeyEvent', () {
keydownHandlerTest(KeyEvent e) {
document.body.innerHtml =
diff --git a/tests/lib_2/html/xhr_cross_origin_test.dart b/tests/lib_2/html/xhr_cross_origin_test.dart
index 846bb8d..997f01a 100644
--- a/tests/lib_2/html/xhr_cross_origin_test.dart
+++ b/tests/lib_2/html/xhr_cross_origin_test.dart
@@ -5,7 +5,6 @@
library XHRCrossOriginTest;
import 'package:unittest/unittest.dart';
-import 'package:unittest/html_individual_config.dart';
import 'dart:html';
import "dart:convert";
@@ -26,8 +25,6 @@
}
main() {
- useHtmlIndividualConfiguration();
-
group('supported', () {
test('supported', () {
expect(HttpRequest.supportsCrossOrigin, isTrue);
diff --git a/tests/standalone/io/process_detached_test.dart b/tests/standalone/io/process_detached_test.dart
index f970fa6..c011451 100644
--- a/tests/standalone/io/process_detached_test.dart
+++ b/tests/standalone/io/process_detached_test.dart
@@ -12,8 +12,6 @@
import "package:async_helper/async_helper.dart";
import "package:expect/expect.dart";
-import "process_test_util.dart";
-
void test() {
asyncStart();
var script =
@@ -27,10 +25,10 @@
future.then((process) {
Expect.isNotNull(process.pid);
Expect.isTrue(process.pid is int);
- Expect.isNull(process.exitCode);
- Expect.isNull(process.stderr);
- Expect.isNull(process.stdin);
- Expect.isNull(process.stdout);
+ Expect.throwsStateError(() => process.exitCode);
+ Expect.throwsStateError(() => process.stderr);
+ Expect.throwsStateError(() => process.stdin);
+ Expect.throwsStateError(() => process.stdout);
Expect.isTrue(process.kill());
}).whenComplete(() {
asyncEnd();
@@ -47,7 +45,7 @@
future.then((process) {
Expect.isNotNull(process.pid);
Expect.isTrue(process.pid is int);
- Expect.isNull(process.exitCode);
+ Expect.throwsStateError(() => process.exitCode);
var message = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
process.stdin.add(message);
process.stdin.flush().then((_) => process.stdin.close());
diff --git a/tests/standalone/io/sleep_test.dart b/tests/standalone/io/sleep_test.dart
index f240296..ef5d20c 100644
--- a/tests/standalone/io/sleep_test.dart
+++ b/tests/standalone/io/sleep_test.dart
@@ -2,15 +2,15 @@
// 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 "package:unittest/unittest.dart";
+import 'dart:io';
+import 'package:expect/expect.dart';
test(int milliseconds) {
var watch = new Stopwatch();
watch.start();
sleep(new Duration(milliseconds: milliseconds));
watch.stop();
- expect(watch.elapsedMilliseconds, greaterThanOrEqualTo(milliseconds));
+ Expect.isTrue(watch.elapsedMilliseconds >= milliseconds);
}
main() {
@@ -21,9 +21,9 @@
bool sawError = false;
try {
sleep(new Duration(milliseconds: -1));
- expect(false, isTrue); // should not reach here.
+ Expect.fail('Should not reach here.');
} on ArgumentError catch (e) {
sawError = true;
}
- expect(sawError, isTrue);
+ Expect.isTrue(sawError);
}
diff --git a/tests/standalone/io/socket_finalizer_test.dart b/tests/standalone/io/socket_finalizer_test.dart
index d25ac1c..5718559 100644
--- a/tests/standalone/io/socket_finalizer_test.dart
+++ b/tests/standalone/io/socket_finalizer_test.dart
@@ -36,8 +36,18 @@
Expect.fail("Socket error $e");
});
isolate.kill();
+
+ // Cause a GC to collect the [socket] from [connectorIsolate].
+ for (int i = 0; i < 100000; ++i) {
+ produceGarbage();
+ }
});
await completer.future;
await server.close();
asyncEnd();
}
+
+@pragma('vm:never-inline')
+produceGarbage() => all.add(List(1024));
+
+final all = [];
diff --git a/tests/standalone/io/socket_hang_test.dart b/tests/standalone/io/socket_hang_test.dart
new file mode 100644
index 0000000..2231844
--- /dev/null
+++ b/tests/standalone/io/socket_hang_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2020, 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:convert';
+import 'dart:io' as io;
+
+void main(List<String> args) async {
+ if (args.length != 0) {
+ for (int i = 0; i < 100000; i++) {
+ print('line $i');
+ }
+ print('done');
+ return;
+ } else {
+ // Create child process and keeps writing into stdout.
+ final p = await io.Process.start(
+ io.Platform.executable, [io.Platform.script.toFilePath(), 'child']);
+ p.stdout.transform(utf8.decoder).listen((x) => print('stdout: $x'));
+ p.stderr.transform(utf8.decoder).listen((x) => print('stderr: $x'));
+ final exitCode = await p.exitCode;
+ print('process exited with ${exitCode}');
+ }
+}
diff --git a/tests/standalone_2/dwarf_stack_trace_dedup_test.dart b/tests/standalone_2/dwarf_stack_trace_dedup_test.dart
deleted file mode 100644
index 9c715b3..0000000
--- a/tests/standalone_2/dwarf_stack_trace_dedup_test.dart
+++ /dev/null
@@ -1,73 +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.
-
-/// VMOptions=--dwarf-stack-traces --save-debugging-info=dwarf_dedup.so --dedup-instructions
-
-import 'dart:io';
-
-import 'package:native_stack_traces/native_stack_traces.dart';
-import 'package:path/path.dart' as path;
-
-import 'dwarf_stack_trace_test.dart' as base;
-
-@pragma("vm:prefer-inline")
-bar() {
- // Keep the 'throw' and its argument on separate lines.
- throw // force linebreak with dartfmt
- "Hello, Dwarf!";
-}
-
-@pragma("vm:never-inline")
-foo() {
- bar();
-}
-
-Future<void> main() async {
- String rawStack;
- try {
- foo();
- } catch (e, st) {
- rawStack = st.toString();
- }
-
- if (path.basenameWithoutExtension(Platform.executable) !=
- "dart_precompiled_runtime") {
- return; // Not running from an AOT compiled snapshot.
- }
-
- if (Platform.isAndroid) {
- return; // Generated dwarf.so not available on the test device.
- }
-
- final dwarf = Dwarf.fromFile("dwarf_dedup.so");
-
- await base.checkStackTrace(rawStack, dwarf, expectedCallsInfo);
-}
-
-final expectedCallsInfo = <List<CallInfo>>[
- // The first frame should correspond to the throw in bar, which was inlined
- // into foo (so we'll get information for two calls for that PC address).
- [
- CallInfo(
- function: "bar",
- filename: "dwarf_stack_trace_dedup_test.dart",
- line: 17,
- inlined: true),
- CallInfo(
- function: "foo",
- filename: "dwarf_stack_trace_dedup_test.dart",
- line: 23,
- inlined: false)
- ],
- // The second frame corresponds to call to foo in main.
- [
- CallInfo(
- function: "main",
- filename: "dwarf_stack_trace_dedup_test.dart",
- line: 29,
- inlined: false)
- ],
- // Don't assume anything about any of the frames below the call to foo
- // in main, as this makes the test too brittle.
-];
diff --git a/tests/standalone_2/dwarf_stack_trace_test.dart b/tests/standalone_2/dwarf_stack_trace_test.dart
index 9d0f3e0..fd811ca 100644
--- a/tests/standalone_2/dwarf_stack_trace_test.dart
+++ b/tests/standalone_2/dwarf_stack_trace_test.dart
@@ -9,7 +9,7 @@
import 'package:native_stack_traces/native_stack_traces.dart';
import 'package:path/path.dart' as path;
-import 'package:unittest/unittest.dart';
+import 'package:expect/expect.dart';
@pragma("vm:prefer-inline")
bar() {
@@ -61,7 +61,7 @@
// We should have at least enough PC addresses to cover the frames we'll be
// checking.
- expect(pcOffsets.length, greaterThanOrEqualTo(expectedAllCallsInfo.length));
+ Expect.isTrue(pcOffsets.length >= expectedAllCallsInfo.length);
final virtualAddresses =
pcOffsets.map((o) => dwarf.virtualAddressOf(o)).toList();
@@ -125,9 +125,8 @@
final expectedStrings = extractCallStrings(expectedAllCallsInfo);
final expectedCallCount = expectedStrings.length ~/ 2;
- expect(externalSymbolizedCalls.length,
- greaterThanOrEqualTo(expectedExternalCallCount));
- expect(allSymbolizedCalls.length, greaterThanOrEqualTo(expectedCallCount));
+ Expect.isTrue(externalSymbolizedCalls.length >= expectedExternalCallCount);
+ Expect.isTrue(allSymbolizedCalls.length >= expectedCallCount);
// Strip off any unexpected lines, so we can also make sure we didn't get
// unexpected calls prior to those calls we expect.
@@ -136,8 +135,8 @@
final allCallsTrace =
allSymbolizedCalls.sublist(0, expectedCallCount).join('\n');
- expect(externalCallsTrace, stringContainsInOrder(expectedExternalStrings));
- expect(allCallsTrace, stringContainsInOrder(expectedStrings));
+ Expect.stringContainsInOrder(externalCallsTrace, expectedExternalStrings);
+ Expect.stringContainsInOrder(allCallsTrace, expectedStrings);
}
final expectedCallsInfo = <List<CallInfo>>[
@@ -176,29 +175,43 @@
List<List<CallInfo>> externalFrames, List<List<CallInfo>> allFrames) {
// We should have the same number of frames for both external-only
// and combined call information.
- expect(externalFrames.length, equals(allFrames.length));
- // There should be no frames in either version where we failed to look up
- // call information.
- expect(externalFrames, everyElement(isNotNull));
- expect(allFrames, everyElement(isNotNull));
- // All frames in the internal-including version should have at least one
- // piece of call information.
- expect(allFrames, everyElement(isNotEmpty));
- // External-only call information should only include call information with
- // positive line numbers.
- expect(
- externalFrames, everyElement(everyElement(predicate((c) => c.line > 0))));
+ Expect.equals(externalFrames.length, allFrames.length);
+
+ for (var frame in externalFrames) {
+ // There should be no frames in either version where we failed to look up
+ // call information.
+ Expect.isNotNull(frame);
+
+ // External-only call information should only include call information with
+ // positive line numbers.
+ for (var call in frame) {
+ Expect.isTrue(call.line > 0);
+ }
+ }
+
+ for (var frame in allFrames) {
+ // There should be no frames in either version where we failed to look up
+ // call information.
+ Expect.isNotNull(frame);
+
+ // All frames in the internal-including version should have at least one
+ // piece of call information.
+ Expect.isTrue(frame.isNotEmpty);
+ }
+
// The information in the external-only and combined call information should
// be consistent for external frames.
for (var i = 0; i < allFrames.length; i++) {
- expect(externalFrames[i], anyOf(isEmpty, equals(allFrames[i])));
+ if (externalFrames[i].isNotEmpty) {
+ Expect.listEquals(externalFrames[i], allFrames[i]);
+ }
}
}
void checkFrames(
List<List<CallInfo>> framesInfo, List<List<CallInfo>> expectedInfo) {
// There may be frames below those we check.
- expect(framesInfo.length, greaterThanOrEqualTo(expectedInfo.length));
+ Expect.isTrue(framesInfo.length >= expectedInfo.length);
// We can't just use deep equality, since we only have the filenames in the
// expected version, not the whole path, and we don't really care if
@@ -207,13 +220,13 @@
for (var j = 0; j < expectedInfo[i].length; j++) {
final got = framesInfo[i][j];
final expected = expectedInfo[i][j];
- expect(got.function, equals(expected.function));
- expect(got.inlined, equals(expected.inlined));
- expect(path.basename(got.filename), equals(expected.filename));
+ Expect.equals(got.function, expected.function);
+ Expect.equals(got.inlined, expected.inlined);
+ Expect.equals(path.basename(got.filename), expected.filename);
if (expected.line > 0) {
- expect(got.line, equals(expected.line));
+ Expect.equals(got.line, expected.line);
} else {
- expect(got.line, lessThanOrEqualTo(0));
+ Expect.isTrue(got.line <= 0);
}
}
}
diff --git a/tests/standalone_2/io/file_test.dart b/tests/standalone_2/io/file_test.dart
index 8f18060..3b0901d 100644
--- a/tests/standalone_2/io/file_test.dart
+++ b/tests/standalone_2/io/file_test.dart
@@ -777,12 +777,12 @@
await openedFile.writeFrom(const [1, 2, 3]);
await openedFile.setPosition(0);
- var list = [null, null, null];
+ var list = <int>[null, null, null];
Expect.equals(3, await openedFile.readInto(list));
Expect.listEquals([1, 2, 3], list);
- read(start, end, length, expected) async {
- var list = [null, null, null];
+ read(int start, int end, int length, List<int> expected) async {
+ var list = <int>[null, null, null];
await openedFile.setPosition(0);
Expect.equals(length, await openedFile.readInto(list, start, end));
Expect.listEquals(expected, list);
@@ -808,12 +808,12 @@
openedFile.writeFromSync(const [1, 2, 3]);
openedFile.setPositionSync(0);
- var list = [null, null, null];
+ var list = <int>[null, null, null];
Expect.equals(3, openedFile.readIntoSync(list));
Expect.listEquals([1, 2, 3], list);
read(start, end, length, expected) {
- var list = [null, null, null];
+ var list = <int>[null, null, null];
openedFile.setPositionSync(0);
Expect.equals(length, openedFile.readIntoSync(list, start, end));
Expect.listEquals(expected, list);
diff --git a/tests/standalone_2/io/process_detached_test.dart b/tests/standalone_2/io/process_detached_test.dart
index b6b59e7..528d0cf 100644
--- a/tests/standalone_2/io/process_detached_test.dart
+++ b/tests/standalone_2/io/process_detached_test.dart
@@ -12,8 +12,6 @@
import "package:async_helper/async_helper.dart";
import "package:expect/expect.dart";
-import "process_test_util.dart";
-
void test() {
asyncStart();
var script =
@@ -27,10 +25,10 @@
future.then((process) {
Expect.isNotNull(process.pid);
Expect.isTrue(process.pid is int);
- Expect.isNull(process.exitCode);
- Expect.isNull(process.stderr);
- Expect.isNull(process.stdin);
- Expect.isNull(process.stdout);
+ Expect.throwsStateError(() => process.exitCode);
+ Expect.throwsStateError(() => process.stderr);
+ Expect.throwsStateError(() => process.stdin);
+ Expect.throwsStateError(() => process.stdout);
Expect.isTrue(process.kill());
}).whenComplete(() {
asyncEnd();
@@ -47,7 +45,7 @@
future.then((process) {
Expect.isNotNull(process.pid);
Expect.isTrue(process.pid is int);
- Expect.isNull(process.exitCode);
+ Expect.throwsStateError(() => process.exitCode);
var message = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
process.stdin.add(message);
process.stdin.flush().then((_) => process.stdin.close());
diff --git a/tests/standalone_2/io/sleep_test.dart b/tests/standalone_2/io/sleep_test.dart
index f240296..ef5d20c 100644
--- a/tests/standalone_2/io/sleep_test.dart
+++ b/tests/standalone_2/io/sleep_test.dart
@@ -2,15 +2,15 @@
// 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 "package:unittest/unittest.dart";
+import 'dart:io';
+import 'package:expect/expect.dart';
test(int milliseconds) {
var watch = new Stopwatch();
watch.start();
sleep(new Duration(milliseconds: milliseconds));
watch.stop();
- expect(watch.elapsedMilliseconds, greaterThanOrEqualTo(milliseconds));
+ Expect.isTrue(watch.elapsedMilliseconds >= milliseconds);
}
main() {
@@ -21,9 +21,9 @@
bool sawError = false;
try {
sleep(new Duration(milliseconds: -1));
- expect(false, isTrue); // should not reach here.
+ Expect.fail('Should not reach here.');
} on ArgumentError catch (e) {
sawError = true;
}
- expect(sawError, isTrue);
+ Expect.isTrue(sawError);
}
diff --git a/tests/standalone_2/io/socket_finalizer_test.dart b/tests/standalone_2/io/socket_finalizer_test.dart
index 84ade9e..cbaae2c 100644
--- a/tests/standalone_2/io/socket_finalizer_test.dart
+++ b/tests/standalone_2/io/socket_finalizer_test.dart
@@ -16,7 +16,7 @@
import "package:async_helper/async_helper.dart";
import "package:expect/expect.dart";
-ConnectorIsolate(Object portObj) async {
+connectorIsolate(Object portObj) async {
int port = portObj;
Socket socket = await Socket.connect("127.0.0.1", port);
socket.listen((_) {});
@@ -25,7 +25,7 @@
main() async {
asyncStart();
ServerSocket server = await ServerSocket.bind("127.0.0.1", 0);
- Isolate isolate = await Isolate.spawn(ConnectorIsolate, server.port);
+ Isolate isolate = await Isolate.spawn(connectorIsolate, server.port);
Completer<Null> completer = new Completer<Null>();
server.listen((Socket socket) {
socket.listen((_) {}, onDone: () {
@@ -36,8 +36,18 @@
Expect.fail("Socket error $e");
});
isolate.kill();
+
+ // Cause a GC to collect the [socket] from [connectorIsolate].
+ for (int i = 0; i < 100000; ++i) {
+ produceGarbage();
+ }
});
await completer.future;
await server.close();
asyncEnd();
}
+
+@pragma('vm:never-inline')
+produceGarbage() => all.add(List(1024));
+
+final all = [];
diff --git a/tests/standalone_2/io/socket_hang_test.dart b/tests/standalone_2/io/socket_hang_test.dart
new file mode 100644
index 0000000..2231844
--- /dev/null
+++ b/tests/standalone_2/io/socket_hang_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2020, 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:convert';
+import 'dart:io' as io;
+
+void main(List<String> args) async {
+ if (args.length != 0) {
+ for (int i = 0; i < 100000; i++) {
+ print('line $i');
+ }
+ print('done');
+ return;
+ } else {
+ // Create child process and keeps writing into stdout.
+ final p = await io.Process.start(
+ io.Platform.executable, [io.Platform.script.toFilePath(), 'child']);
+ p.stdout.transform(utf8.decoder).listen((x) => print('stdout: $x'));
+ p.stderr.transform(utf8.decoder).listen((x) => print('stderr: $x'));
+ final exitCode = await p.exitCode;
+ print('process exited with ${exitCode}');
+ }
+}
diff --git a/tests/standalone_2/package/invalid_uri_test.dart b/tests/standalone_2/package/invalid_uri_test.dart
index bb1acc6..c081860 100644
--- a/tests/standalone_2/package/invalid_uri_test.dart
+++ b/tests/standalone_2/package/invalid_uri_test.dart
@@ -4,6 +4,7 @@
library invalid_uri_test;
-import 'package://lib1.dart'; // Should not contain "//".
+ // Should not contain "//".
+import 'package://lib1.dart'; //# 01: compile-time error
void main() {}
diff --git a/tests/standalone_2/slowpath_safepoints_test.dart b/tests/standalone_2/slowpath_safepoints_test.dart
index e9892eb..c983e62 100644
--- a/tests/standalone_2/slowpath_safepoints_test.dart
+++ b/tests/standalone_2/slowpath_safepoints_test.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
// Test that safepoints associated with slowpaths don't mark non-existing values
// alive.
-// VMOptions=--optimization-counter-threshold=5 --no-inline_alloc --gc_at_instance_allocation=_Double --no-background-compilation
+// VMOptions=--optimization-counter-threshold=5 --no-inline_alloc --no-background-compilation
class C {
final next;
diff --git a/third_party/tcmalloc/BUILD.gn b/third_party/tcmalloc/BUILD.gn
index 9ab294d..a2a925a 100644
--- a/third_party/tcmalloc/BUILD.gn
+++ b/third_party/tcmalloc/BUILD.gn
@@ -35,7 +35,10 @@
"-faligned-new",
]
if (is_clang) {
- cflags += [ "-Wno-unused-const-variable" ]
+ cflags += [
+ "-Wno-unused-const-variable",
+ "-Wno-implicit-int-float-conversion",
+ ]
}
if (current_cpu == "arm" && !is_clang) {
cflags += [ "-Wno-psabi" ]
@@ -80,9 +83,7 @@
public_configs = [ ":link_config" ]
- deps = [
- ":dynamic_annotations",
- ]
+ deps = [ ":dynamic_annotations" ]
include_dirs = [
"include",
diff --git a/tools/VERSION b/tools/VERSION
index 510a80b..286097d 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -33,7 +33,7 @@
MAJOR 2
MINOR 8
PATCH 0
-PRERELEASE 10
+PRERELEASE 11
PRERELEASE_PATCH 0
ABI_VERSION 28
OLDEST_SUPPORTED_ABI_VERSION 28
diff --git a/tools/apps/update_homebrew/.gitignore b/tools/apps/update_homebrew/.gitignore
index 16a1724..e4da250a3 100644
--- a/tools/apps/update_homebrew/.gitignore
+++ b/tools/apps/update_homebrew/.gitignore
@@ -1 +1,2 @@
.packages
+.dart_tool
diff --git a/tools/apps/update_homebrew/lib/src/impl.dart b/tools/apps/update_homebrew/lib/src/impl.dart
index 3c1acab..2f7b66d 100644
--- a/tools/apps/update_homebrew/lib/src/impl.dart
+++ b/tools/apps/update_homebrew/lib/src/impl.dart
@@ -88,7 +88,7 @@
'''
class Dart < Formula
desc "The Dart SDK"
- homepage "https://www.dartlang.org/"
+ homepage "https://dart.dev"
version "$stableVersion"
if OS.mac?
@@ -149,9 +149,10 @@
EOS
end
- def caveats; <<~EOS
- Please note the path to the Dart SDK:
- #{opt_libexec}
+ def caveats
+ <<~EOS
+ Please note the path to the Dart SDK:
+ #{opt_libexec}
EOS
end
diff --git a/tools/bots/post_results_to_pubsub.dart b/tools/bots/post_results_to_pubsub.dart
index 386b86d..572e451 100644
--- a/tools/bots/post_results_to_pubsub.dart
+++ b/tools/bots/post_results_to_pubsub.dart
@@ -45,6 +45,7 @@
parser.addOption('result_file',
abbr: 'f', help: 'File containing the results to send');
parser.addOption('id', abbr: 'i', help: 'Buildbucket ID of this build');
+ parser.addOption('base_revision', help: 'A try build\'s patch base');
final options = parser.parse(args);
if (options['help']) {
@@ -56,6 +57,7 @@
final lines = await File(options['result_file']).readAsLines();
final token = await File(options['auth_token']).readAsString();
final buildbucketID = options['id'];
+ final baseRevision = options['base_revision'];
if (lines.isEmpty) {
print('No results in input file');
return;
@@ -116,7 +118,8 @@
final base64data = base64Encode(utf8.encode(message.toString()));
final attributes = {
if (chunk == chunks.last) 'num_chunks': chunks.length.toString(),
- if (buildbucketID != null) 'buildbucket_id': buildbucketID
+ if (buildbucketID != null) 'buildbucket_id': buildbucketID,
+ if (baseRevision != null) 'base_revision': baseRevision,
};
final jsonMessage = jsonEncode({
'messages': [
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 0e048a0..fcd91d5 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -11,6 +11,7 @@
"analyzer_unit_tests": [
".packages",
"pkg/",
+ "tests/compiler/dart2js/",
"third_party/pkg/",
"third_party/pkg_tested/",
"tools/",
@@ -486,31 +487,31 @@
"builder-tag": "analyzer_use_fasta"
}
},
- "dartk-asan-(linux|mac|win)-(debug|product|release)-(ia32|x64)": {
+ "dartk-asan-(linux|mac)-(debug|product|release)-(ia32|x64)": {
"options": {
"builder-tag": "asan",
"timeout": 240
}
},
- "dartk-lsan-(linux|mac|win)-(debug|product|release)-(ia32|x64)": {
+ "dartk-lsan-(linux|mac)-(debug|product|release)-(ia32|x64)": {
"options": {
"builder-tag": "lsan",
"timeout": 240
}
},
- "dartk-msan-(linux|mac|win)-(debug|product|release)-(ia32|x64)": {
+ "dartk-msan-linux-(debug|product|release)-x64": {
"options": {
"builder-tag": "msan",
"timeout": 240
}
},
- "dartk-tsan-(linux|mac|win)-(debug|product|release)-x64": {
+ "dartk-tsan-(linux|mac)-(debug|product|release)-x64": {
"options": {
"builder-tag": "tsan",
"timeout": 240
}
},
- "dartk-ubsan-(linux|mac|win)-(debug|product|release)-(ia32|x64)": {
+ "dartk-ubsan-(linux|mac)-(debug|product|release)-(ia32|x64)": {
"options": {
"builder-tag": "ubsan",
"timeout": 240
@@ -649,9 +650,7 @@
"dartkp-win-debug-x64": {
"options": {
"use-elf": true,
- "vm-options": [
- "--no-enable-malloc-hooks"
- ]
+ "vm-options": []
}
},
"dartkp-(linux|mac)-(product|release)-x64": {},
@@ -665,15 +664,12 @@
},
"dartkp-(linux|mac)-debug-x64": {
"options": {
- "vm-options": [
- "--no-enable-malloc-hooks"
- ]
+ "vm-options": []
}
},
"dartkp-no-bare-(linux|mac|win)-(debug|product|release)-x64": {
"options": {
"vm-options": [
- "--no-enable-malloc-hooks",
"--no-use-bare-instructions"
]
}
@@ -681,13 +677,29 @@
"dartkp-no-bare-(linux|mac|win)-(debug|product|release)-(simarm|simarm64)": {
"options": {
"vm-options": [
- "--no-enable-malloc-hooks",
"--no-use-bare-instructions"
],
"use-elf": true
}
},
"dartk-(linux|mac|win)-(debug|product|release)-(ia32|x64)": {},
+ "dartkp-weak-asserts-(linux|mac)-(debug|product|release)-x64": {
+ "options": {
+ "enable-experiment": [
+ "non-nullable"
+ ],
+ "enable-asserts": true
+ }
+ },
+ "dartkp-weak-asserts-win-(debug|product|release)-x64": {
+ "options": {
+ "enable-experiment": [
+ "non-nullable"
+ ],
+ "enable-asserts": true,
+ "use-elf": true
+ }
+ },
"dartk-weak-asserts-(linux|mac|win)-(debug|product|release)-x64": {
"options": {
"enable-experiment": [
@@ -696,6 +708,46 @@
"enable-asserts": true
}
},
+ "dartk-strong-(linux|mac|win)-(debug|product|release)-x64": {
+ "options": {
+ "enable-experiment": [
+ "non-nullable"
+ ],
+ "gen-kernel-options": [
+ "--null-safety"
+ ],
+ "vm-options": [
+ "--null-safety"
+ ]
+ }
+ },
+ "dartkp-strong-(linux|mac)-(debug|product|release)-x64": {
+ "options": {
+ "enable-experiment": [
+ "non-nullable"
+ ],
+ "gen-kernel-options": [
+ "--null-safety"
+ ],
+ "vm-options": [
+ "--null-safety"
+ ]
+ }
+ },
+ "dartkp-strong-win-(debug|product|release)-x64": {
+ "options": {
+ "use-elf": true,
+ "enable-experiment": [
+ "non-nullable"
+ ],
+ "gen-kernel-options": [
+ "--null-safety"
+ ],
+ "vm-options": [
+ "--null-safety"
+ ]
+ }
+ },
"dartk-(linux|mac|win)-(debug|product|release)-(ia32|simarm|simarm64|x64)-ast": {
"options": {
"builder-tag": "ast",
@@ -858,6 +910,14 @@
]
}
},
+ "cfe-strong-(linux|mac|win)": {
+ "options": {
+ "compiler": "fasta",
+ "enable-experiment": [
+ "non-nullable"
+ ]
+ }
+ },
"analyzer-(linux|mac|win)": {
"options": {
"compiler": "dart2analyzer",
@@ -969,27 +1029,6 @@
]
},
{
- "name": "weak sdk tests",
- "arguments": [
- "-ncfe-weak-${system}",
- "corelib",
- "ffi",
- "language",
- "lib"
- ],
- "fileset": "front-end",
- "shards": 3
- },
- {
- "name": "weak co19 tests",
- "arguments": [
- "-ncfe-weak-${system}",
- "co19/LanguageFeatures/nnbd"
- ],
- "fileset": "front-end",
- "shards": 2
- },
- {
"name": "legacy sdk tests",
"arguments": [
"-ncfe-weak-${system}"
@@ -1005,6 +1044,40 @@
],
"fileset": "front-end",
"shards": 6
+ },
+ {
+ "name": "weak sdk tests",
+ "arguments": [
+ "-ncfe-weak-${system}",
+ "corelib",
+ "ffi",
+ "language",
+ "lib"
+ ]
+ },
+ {
+ "name": "weak co19 tests",
+ "arguments": [
+ "-ncfe-weak-${system}",
+ "co19/LanguageFeatures/nnbd"
+ ]
+ },
+ {
+ "name": "strong sdk tests",
+ "arguments": [
+ "-ncfe-strong-${system}",
+ "corelib",
+ "ffi",
+ "language",
+ "lib"
+ ]
+ },
+ {
+ "name": "strong co19 tests",
+ "arguments": [
+ "-ncfe-strong-${system}",
+ "co19/LanguageFeatures/nnbd"
+ ]
}
]
},
@@ -1165,6 +1238,43 @@
},
{
"builders": [
+ "vm-kernel-precomp-nnbd-linux-release-x64"
+ ],
+ "meta": {
+ "description": "This configuration is for the VM AOT nnbd builder group."
+ },
+ "steps": [
+ {
+ "name": "build dart",
+ "script": "tools/build.py",
+ "arguments": [
+ "--nnbd",
+ "runtime_kernel",
+ "dart_precompiled_runtime"
+ ]
+ },
+ {
+ "name": "vm weak legacy tests with asserts",
+ "arguments": [
+ "-ndartkp-weak-asserts-${system}-${mode}-${arch}"
+ ],
+ "fileset": "vm-kernel-nnbd",
+ "shards": 6
+ },
+ {
+ "name": "vm weak tests with asserts",
+ "arguments": [
+ "-ndartkp-weak-asserts-${system}-${mode}-${arch}",
+ "ffi",
+ "language",
+ "lib/mirrors",
+ "standalone/io"
+ ]
+ }
+ ]
+ },
+ {
+ "builders": [
"vm-kernel-precomp-linux-product-x64",
"vm-kernel-precomp-linux-release-simarm",
"vm-kernel-precomp-linux-release-simarm64",
@@ -1298,21 +1408,13 @@
"arguments": [
"--sanitizer=asan",
"runtime"
- ],
- "environment": {
- "ASAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
- "ASAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
- }
+ ]
},
{
"name": "vm tests",
"arguments": [
"-ndartk-asan-linux-release-${arch}"
- ],
- "environment": {
- "ASAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
- "ASAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
- }
+ ]
}
]
},
@@ -1340,27 +1442,18 @@
"arguments": [
"--sanitizer=lsan",
"runtime"
- ],
- "environment": {
- "ASAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
- "ASAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
- }
+ ]
},
{
"name": "vm tests",
"arguments": [
"-ndartk-lsan-linux-release-${arch}"
- ],
- "environment": {
- "ASAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
- "ASAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
- }
+ ]
}
]
},
{
"builders": [
- "vm-kernel-msan-linux-release-ia32",
"vm-kernel-msan-linux-release-x64"
],
"meta": {
@@ -1382,21 +1475,13 @@
"arguments": [
"--sanitizer=msan",
"runtime"
- ],
- "environment": {
- "MSAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
- "MSAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
- }
+ ]
},
{
"name": "vm tests",
"arguments": [
"-ndartk-msan-linux-release-${arch}"
- ],
- "environment": {
- "MSAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
- "MSAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
- }
+ ]
}
]
},
@@ -1423,21 +1508,14 @@
"arguments": [
"--sanitizer=tsan",
"runtime"
- ],
- "environment": {
- "TSAN_OPTIONS": "handle_segv=0:disable_coredump=0:abort_on_error=1",
- "TSAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
- }
+ ]
},
{
"name": "vm tests",
"arguments": [
- "-ndartk-tsan-linux-release-${arch}"
- ],
- "environment": {
- "TSAN_OPTIONS": "handle_segv=0:disable_coredump=0:abort_on_error=1",
- "TSAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
- }
+ "-ndartk-tsan-linux-release-${arch}",
+ "vm"
+ ]
}
]
},
@@ -1465,19 +1543,13 @@
"arguments": [
"--sanitizer=ubsan",
"runtime"
- ],
- "environment": {
- "UBSAN_OPTIONS": "handle_segv=0:disable_coredump=0:abort_on_error=1"
- }
+ ]
},
{
"name": "vm tests",
"arguments": [
"-ndartk-ubsan-linux-release-${arch}"
- ],
- "environment": {
- "UBSAN_OPTIONS": "handle_segv=0:disable_coredump=0:abort_on_error=1"
- }
+ ]
}
]
},
@@ -1532,16 +1604,6 @@
]
},
{
- "name": "vm weak tests with asserts",
- "arguments": [
- "-ndartk-weak-asserts-${system}-${mode}-${arch}",
- "ffi",
- "language",
- "lib/mirrors",
- "standalone/io"
- ]
- },
- {
"name": "vm weak legacy tests with asserts",
"arguments": [
"-ndartk-weak-asserts-${system}-${mode}-${arch}"
@@ -1552,11 +1614,21 @@
{
"name": "vm weak legacy tests(co19_2) with asserts",
"arguments": [
- "-ndartk-weak-asserts-${system}-${mode}-${arch}",
+ "-ndartk-weak-asserts-${system}-${mode}-${arch}",
"co19_2"
],
"fileset": "vm-kernel-nnbd",
"shards": 6
+ },
+ {
+ "name": "vm weak tests with asserts",
+ "arguments": [
+ "-ndartk-weak-asserts-${system}-${mode}-${arch}",
+ "ffi",
+ "language",
+ "lib/mirrors",
+ "standalone/io"
+ ]
}
]
},
@@ -2392,15 +2464,13 @@
"--enable-experiment=non-nullable",
"pkg/dev_compiler/tool/check_nnbd_sdk.dart",
"--target",
- "dart2js",
- "--libraries",
- "sdk_nnbd/lib/dart2js_migration_libraries.json"
+ "dart2js"
]
},
{
"name": "dart2js nnbd weak tests",
"arguments": [
- "-ndart2js-weak-linux-x64-d8",
+ "-ndart2js-hostasserts-weak-linux-x64-d8",
"--dart2js-batch",
"language_2",
"corelib_2",
@@ -2408,7 +2478,7 @@
"dart2js_native"
],
"shards": 6,
- "fileset": "dart2js_nnbd"
+ "fileset": "dart2js_hostasserts_nnbd"
}
]
},
@@ -2691,6 +2761,15 @@
"arguments": [
"pkg/dev_compiler/tool/check_nnbd_sdk.dart"
]
+ },
+ {
+ "name": "check nnbd sdk (dart2js patch) for static errors",
+ "script": "out/ReleaseX64/dart-sdk/bin/dart",
+ "arguments": [
+ "pkg/dev_compiler/tool/check_nnbd_sdk.dart",
+ "--target",
+ "dart2js"
+ ]
}
]
},
@@ -3410,5 +3489,15 @@
}
]
}
- ]
+ ],
+ "sanitizer_options": {
+ "ASAN_OPTIONS": "check_initialization_order=true:handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
+ "MSAN_OPTIONS": "check_initialization_order=true:handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
+ "TSAN_OPTIONS": "handle_segv=0:disable_coredump=0:abort_on_error=1",
+ "UBSAN_OPTIONS": "handle_segv=0:disable_coredump=0:abort_on_error=1"
+ },
+ "sanitizer_symbolizer": {
+ "linux": "buildtools/linux-x64/clang/bin/llvm-symbolizer",
+ "macos": "buildtools/mac-x64/clang/bin/llvm-symbolizer"
+ }
}
diff --git a/tools/build.py b/tools/build.py
index 17ee88d..20ac683 100755
--- a/tools/build.py
+++ b/tools/build.py
@@ -4,6 +4,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 io
+import json
import multiprocessing
import optparse
import os
@@ -312,10 +314,10 @@
return (build_config, command, using_goma)
-def RunOneBuildCommand(build_config, args):
+def RunOneBuildCommand(build_config, args, env):
start_time = time.time()
print(' '.join(args))
- process = subprocess.Popen(args, stdin=None)
+ process = subprocess.Popen(args, env=env, stdin=None)
process.wait()
if process.returncode != 0:
NotifyBuildDone(build_config, success=False, start=start_time)
@@ -326,10 +328,11 @@
return 0
-def RunOneGomaBuildCommand(args):
+def RunOneGomaBuildCommand(options):
+ (env, args) = options
try:
print(' '.join(args))
- process = subprocess.Popen(args, stdin=None)
+ process = subprocess.Popen(args, env=env, stdin=None)
process.wait()
print(' '.join(args) + " done.")
return process.returncode
@@ -337,6 +340,21 @@
return 1
+def SanitizerEnvironmentVariables():
+ with io.open('tools/bots/test_matrix.json', encoding='utf-8') as fd:
+ config = json.loads(fd.read())
+ env = dict()
+ for k, v in config['sanitizer_options'].items():
+ env[str(k)] = str(v)
+ symbolizer_path = config['sanitizer_symbolizer'].get(HOST_OS, None)
+ if symbolizer_path:
+ symbolizer_path = str(os.path.join(DART_ROOT, symbolizer_path))
+ env['ASAN_SYMBOLIZER_PATH'] = symbolizer_path
+ env['MSAN_SYMBOLIZER_PATH'] = symbolizer_path
+ env['TSAN_SYMBOLIZER_PATH'] = symbolizer_path
+ return env
+
+
def Main():
starttime = time.time()
# Parse the options.
@@ -354,6 +372,12 @@
if not GenerateBuildfilesIfNeeded():
return 1
+ # If binaries are built with sanitizers we should use those flags.
+ # If the binaries are not built with sanitizers the flag should have no
+ # effect.
+ env = dict(os.environ)
+ env.update(SanitizerEnvironmentVariables())
+
# Build all targets for each requested configuration.
configs = []
for target_os in options.os:
@@ -370,8 +394,8 @@
if args is None:
return 1
if goma:
- goma_builds.append(args)
- elif RunOneBuildCommand(build_config, args) != 0:
+ goma_builds.append([env, args])
+ elif RunOneBuildCommand(build_config, args, env=env) != 0:
return 1
# Run goma builds in parallel.
diff --git a/tools/dom/nnbd_src/WrappedList.dart b/tools/dom/nnbd_src/WrappedList.dart
index 733e784..65d0d94 100644
--- a/tools/dom/nnbd_src/WrappedList.dart
+++ b/tools/dom/nnbd_src/WrappedList.dart
@@ -52,10 +52,10 @@
}
}
- int indexOf(Object element, [int start = 0]) =>
+ int indexOf(Object? element, [int start = 0]) =>
_list.indexOf(element as Node, start);
- int lastIndexOf(Object element, [int? start]) =>
+ int lastIndexOf(Object? element, [int? start]) =>
_list.lastIndexOf(element as Node, start);
void insert(int index, E element) => _list.insert(index, element);
diff --git a/tools/dom/nnbd_src/shared_html.dart b/tools/dom/nnbd_src/shared_html.dart
index b9a8d7f..5e7bc8e 100644
--- a/tools/dom/nnbd_src/shared_html.dart
+++ b/tools/dom/nnbd_src/shared_html.dart
@@ -4,15 +4,17 @@
part of dart.dom.html;
-void Function(T) _wrapZone<T>(void Function(T) callback) {
+void Function(T)? _wrapZone<T>(void Function(T) callback) {
// For performance reasons avoid wrapping if we are in the root zone.
if (Zone.current == Zone.root) return callback;
+ if (callback == null) return null;
return Zone.current.bindUnaryCallbackGuarded(callback);
}
-void Function(T1, T2) _wrapBinaryZone<T1, T2>(void Function(T1, T2) callback) {
+void Function(T1, T2)? _wrapBinaryZone<T1, T2>(void Function(T1, T2) callback) {
// For performance reasons avoid wrapping if we are in the root zone.
if (Zone.current == Zone.root) return callback;
+ if (callback == null) return null;
return Zone.current.bindBinaryCallbackGuarded(callback);
}
diff --git a/tools/dom/scripts/css_code_generator.py b/tools/dom/scripts/css_code_generator.py
index 9e71e69..2d7ac7b 100644
--- a/tools/dom/scripts/css_code_generator.py
+++ b/tools/dom/scripts/css_code_generator.py
@@ -125,8 +125,7 @@
///
/// Please note the property name uses camelCase, not-hyphens.
String getPropertyValue(String propertyName) {
- var propValue = _getPropertyValueHelper(propertyName);
- return propValue ?? '';
+ return _getPropertyValueHelper(propertyName);
}
String _getPropertyValueHelper(String propertyName) {
@@ -151,7 +150,7 @@
}
- void setProperty(String propertyName, String value,
+ void setProperty(String propertyName, String$NULLABLE value,
[String$NULLABLE priority]) {
return _setPropertyHelper(_browserPropertyName(propertyName),
value, priority);
@@ -204,7 +203,7 @@
* Checks to see if CSS Transitions are supported.
*/
static bool get supportsTransitions {
- return document.body.style.supportsProperty('transition');
+ return document.body$NULLASSERT.style.supportsProperty('transition');
}
$!MEMBERS
""")
@@ -221,9 +220,12 @@
}
@Returns('String')
@JSName('%s')
- String _%s;
+ String get _%s native;
+
+ @JSName('%s')
+ set _%s(String value) native;
""" % (property, camelName, camelName, property, camelName, camelName,
- camelName, camelName))
+ camelName, camelName, camelName, camelName))
class_file.write("""
}
@@ -241,7 +243,7 @@
_elementCssStyleDeclarationSetIterable$NULLASSERT.first.getPropertyValue(
propertyName);
- void setProperty(String propertyName, String value,
+ void setProperty(String propertyName, String$NULLABLE value,
[String$NULLABLE priority]) {
_elementCssStyleDeclarationSetIterable$NULLASSERT.forEach((e) =>
e.setProperty(propertyName, value, priority));
@@ -278,7 +280,7 @@
abstract class CssStyleDeclarationBase {
String getPropertyValue(String propertyName);
- void setProperty(String propertyName, String value,
+ void setProperty(String propertyName, String$NULLABLE value,
[String$NULLABLE priority]);
""")
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index a2e1586..ac223d9 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -839,7 +839,8 @@
else:
template = '\n $TYPE get $NAME;\n'
else:
- template = '\n $TYPE $NAME;\n'
+ template = '\n $TYPE get $NAME native;\n' \
+ '\n void set $NAME native;\n'
self._members_emitter.Emit(template, NAME=attr_name, TYPE=type_name)
diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py
index 6b3750c2..68a721f 100644
--- a/tools/dom/scripts/systemhtml.py
+++ b/tools/dom/scripts/systemhtml.py
@@ -20,16 +20,6 @@
'html', 'indexed_db', 'svg', 'web_audio', 'web_gl', 'web_sql'
]
-# The following two sets let us avoid shadowing fields with properties.
-# This information could be derived from the IDL files but would require
-# a significant refactor to compute accurately. Instead we manually compute
-# these sets based on manual triage of strong mode errors.
-_force_property_members = monitored.Set('systemhtml._force_property_members', [
- 'Element.outerHtml',
- 'Element.isContentEditable',
- 'AudioContext.createGain',
- 'AudioContext.createScriptProcessor',
-])
_safe_to_ignore_shadowing_members = monitored.Set(
'systemhtml._safe_to_ignore_shadowing_members', [
'SVGElement.tabIndex',
@@ -1401,32 +1391,30 @@
return
if IsPureInterface(self._interface.id, self._database):
- self._AddInterfaceAttribute(attribute, html_name, read_only)
+ self._AddAttributeUsingProperties(attribute, html_name, read_only)
return
# If the attribute is shadowing, we can't generate a shadowing
- # field (Issue 1633).
+ # getter or setter (Issue 1633).
# TODO(sra): _FindShadowedAttribute does not take into account the html
- # renaming. we should be looking for another attribute that has the same
- # html_name. Two attributes with the same IDL name might not match if one
- # is renamed.
+ # renaming. We should be looking for another attribute that has the
+ # same html_name. Two attributes with the same IDL name might not match
+ # if one is renamed.
+ # TODO(srujzs): Determine if logic behind shadowing is still true here
+ # and below with the transition to natives.
(super_attribute,
super_attribute_interface) = self._FindShadowedAttribute(attribute)
- if self._ForcePropertyMember(html_name):
- self._members_emitter.Emit(
- '\n // Using property as subclass shadows.')
- self._AddAttributeUsingProperties(attribute, html_name, read_only)
- return
if super_attribute:
if read_only or self._SafeToIgnoreShadowingMember(html_name):
if attribute.type.id == super_attribute.type.id:
- # Compatible attribute, use the superclass property. This works
- # because JavaScript will do its own dynamic dispatch.
+ # Compatible attribute, use the superclass property. This
+ # works because JavaScript will do its own dynamic dispatch.
self._members_emitter.Emit(
'\n'
' // Use implementation from $SUPER.\n'
- ' // final $TYPE $NAME;\n',
+ ' // $TYPE get $NAME native;\n'
+ ' // void set $NAME($TYPE value) native;\n',
SUPER=super_attribute_interface,
NAME=html_name,
TYPE=self.SecureOutputType(attribute.type.id,
@@ -1438,9 +1426,10 @@
return
# If the attribute is shadowed incompatibly in a subclass then we also
- # can't just generate it as a field. In particular, this happens with
- # DomMatrixReadOnly and its subclass DomMatrix. Force the superclass
- # to generate getters. Hardcoding the known problem classes for now.
+ # can't just generate it as a getter/setter. In particular, this happens
+ # with DomMatrixReadOnly and its subclass DomMatrix. Force the
+ # superclass to generate getters. Hardcoding the known problem classes
+ # for now.
# TODO(alanknight): Fix this more generally.
if (self._interface.id == 'DOMMatrixReadOnly' or
self._interface.id == 'DOMPointReadOnly' or
@@ -1465,23 +1454,12 @@
input_type = self._NarrowInputType(attribute.type.id)
if self._nnbd and attribute.type.nullable:
input_type += '?'
- static_attribute = 'static' if attribute.is_static else ''
if not read_only:
- if self._nnbd and not attribute.type.nullable:
- self._AddAttributeUsingProperties(attribute, html_name, read_only,
- rename, metadata)
- return
if attribute.type.id == 'Promise':
_logger.warn('R/W member is a Promise: %s.%s' %
(self._interface.id, html_name))
- template = '\n $RENAME$METADATA$STATIC $TYPE $NAME;\n'
- self._members_emitter.Emit(
- template,
- RENAME=rename,
- METADATA=metadata,
- STATIC=static_attribute,
- NAME=html_name,
- TYPE=output_type)
+ self._AddAttributeUsingProperties(attribute, html_name, read_only,
+ rename, metadata)
else:
if attribute.type.id == 'Promise':
lookupOp = "%s.%s" % (self._interface.id, html_name)
@@ -1528,19 +1506,19 @@
template = (
'\n $RENAME$(ANNOTATIONS)$TYPE get $NAME => ' +
'JS("$TYPE", "#.$NAME", this);\n')
- elif self._nnbd:
- # Finals need to be transformed to getters/setters.
+ self._members_emitter.Emit(
+ template,
+ RENAME=rename,
+ ANNOTATIONS=metadata,
+ NAME=html_name,
+ TYPE=input_type
+ if output_type == 'double' else output_type)
+ else:
+ # Transform to native getters/setters.
+ # TODO(srujzs): Should the logic for types and doubles from
+ # above and before stay the same here?
self._AddAttributeUsingProperties(attribute, html_name,
read_only, rename, metadata)
- return
- self._members_emitter.Emit(
- template,
- RENAME=rename,
- ANNOTATIONS=metadata,
- STATIC=static_attribute,
- NAME=html_name,
- TYPE=input_type
- if output_type == 'double' else output_type)
def _AddAttributeUsingProperties(self, attribute, html_name, read_only,
rename=None, metadata=None):
@@ -1549,18 +1527,6 @@
# No metadata for setters.
self._AddRenamingSetter(attribute, html_name, rename)
- def _AddInterfaceAttribute(self, attribute, html_name, read_only):
- if read_only and self._nnbd:
- self._AddAttributeUsingProperties(attribute, html_name, read_only)
- else:
- self._members_emitter.Emit(
- '\n $QUALIFIER$TYPE $NAME;'
- '\n',
- QUALIFIER='final ' if read_only else '',
- NAME=html_name,
- TYPE=self.SecureOutputType(attribute.type.id,
- nullable=attribute.type.nullable))
-
def _AddRenamingGetter(self, attr, html_name, rename, metadata):
conversion = self._OutputConversion(attr.type.id, attr.id)
if conversion:
@@ -1569,17 +1535,14 @@
nullable=attr.type.nullable)
native_type = self._NarrowToImplementationType(attr.type.id)
self._members_emitter.Emit(
- # TODO(sra): Use metadata to provide native name.
'\n $RENAME'
'\n $METADATA'
- '\n $TYPE get $HTML_NAME => JS("$NATIVE_TYPE", "#.$NAME", this);'
+ '\n $TYPE get $HTML_NAME native;'
'\n',
RENAME=rename if rename else '',
METADATA=metadata if metadata else '',
HTML_NAME=html_name,
- NAME=attr.id,
- TYPE=return_type,
- NATIVE_TYPE=native_type)
+ TYPE=return_type)
def _AddRenamingSetter(self, attr, html_name, rename):
conversion = self._InputConversion(attr.type.id, attr.id)
@@ -1593,23 +1556,14 @@
if conversion and conversion.nullable_output:
nullable_type = True
self._members_emitter.Emit(
- # TODO(sra): Use metadata to provide native name.
'\n $RENAME'
- '\n set $HTML_NAME($TYPE value) {'
- '\n JS("void", "#.$NAME = #", this, value);'
- '\n }'
+ '\n set $HTML_NAME($TYPE value) native;'
'\n',
RENAME=rename if rename else '',
HTML_NAME=html_name,
- NAME=attr.id,
TYPE=self.SecureOutputType(attr.type.id, nullable=nullable_type))
def _AddConvertingGetter(self, attr, html_name, conversion):
- getter = '\n $(JS_METADATA)final $NATIVE_TYPE _get_$HTML_NAME;'
- if self._nnbd:
- # TODO(srujzs): Should the inline call have the value type or should
- # it be inferred?
- getter = '\n $(JS_METADATA)$NATIVE_TYPE$NULLABLE_IN get _get_$HTML_NAME => JS("", "#.$NAME", this);'
nullable_out = conversion.nullable_output and \
not conversion.output_type == 'dynamic'
# If the attribute is nullable, the getter should be nullable.
@@ -1618,8 +1572,8 @@
self._members_emitter.Emit(
'\n $(METADATA)$RETURN_TYPE$NULLABLE_OUT get $HTML_NAME => '
'$CONVERT(this._get_$(HTML_NAME)$NULLASSERT);'
- "\n @JSName('$NAME')" +
- getter +
+ "\n @JSName('$NAME')"
+ '\n $(JS_METADATA)$NATIVE_TYPE$NULLABLE_IN get _get_$HTML_NAME native;'
'\n',
METADATA=self._metadata.GetFormattedMetadata(
self._library_name, self._interface, html_name, ' '),
@@ -1988,10 +1942,6 @@
member_name = '%s.%s' % (self._interface.doc_js_name, member_name)
return member_name in _js_custom_members
- def _ForcePropertyMember(self, member_name):
- member_name = '%s.%s' % (self._interface.doc_js_name, member_name)
- return member_name in _force_property_members
-
def _SafeToIgnoreShadowingMember(self, member_name):
member_name = '%s.%s' % (self._interface.doc_js_name, member_name)
return member_name in _safe_to_ignore_shadowing_members
diff --git a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
index 3d86ede..4af64a3 100644
--- a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
+++ b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
@@ -132,16 +132,8 @@
HtmlElement.created() : super.created();
// From NoncedElement
-$if NNBD
- String get nonce => JS("String", "#.nonce", this);
-
- set nonce(String value) {
- JS("void", "#.nonce = #", this, value);
- }
-$else
- String nonce;
-$endif
-
+ String get nonce native;
+ set nonce(String value) native;
}
/**
diff --git a/tools/dom/templates/html/dart2js/impl_KeyboardEvent.darttemplate b/tools/dom/templates/html/dart2js/impl_KeyboardEvent.darttemplate
index e34ea4c..aa5f3e1 100644
--- a/tools/dom/templates/html/dart2js/impl_KeyboardEvent.darttemplate
+++ b/tools/dom/templates/html/dart2js/impl_KeyboardEvent.darttemplate
@@ -63,9 +63,9 @@
}
}
- final int keyCode;
+ int get keyCode native;
- final int charCode;
+ int get charCode native;
int get which => _which;
$!MEMBERS
diff --git a/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate b/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
index 6edac30..914faca 100644
--- a/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
+++ b/tools/dom/templates/html/impl/impl_CSSStyleDeclaration.darttemplate
@@ -27,8 +27,7 @@
///
/// Please note the property name uses camelCase, not-hyphens.
String getPropertyValue(String propertyName) {
- var propValue = _getPropertyValueHelper(propertyName);
- return propValue ?? '';
+ return _getPropertyValueHelper(propertyName);
}
String _getPropertyValueHelper(String propertyName) {
@@ -53,7 +52,7 @@
}
- void setProperty(String propertyName, String value,
+ void setProperty(String propertyName, String$NULLABLE value,
[String$NULLABLE priority]) {
return _setPropertyHelper(_browserPropertyName(propertyName),
value, priority);
@@ -106,7 +105,7 @@
* Checks to see if CSS Transitions are supported.
*/
static bool get supportsTransitions {
- return document.body.style.supportsProperty('transition');
+ return document.body$NULLASSERT.style.supportsProperty('transition');
}
$!MEMBERS
@@ -119,7 +118,10 @@
}
@Returns('String')
@JSName('background')
- String _background;
+ String get _background native;
+
+ @JSName('background')
+ set _background(String value) native;
/** Gets the value of "background-attachment" */
String get backgroundAttachment => this._backgroundAttachment;
@@ -130,7 +132,10 @@
}
@Returns('String')
@JSName('backgroundAttachment')
- String _backgroundAttachment;
+ String get _backgroundAttachment native;
+
+ @JSName('backgroundAttachment')
+ set _backgroundAttachment(String value) native;
/** Gets the value of "background-color" */
String get backgroundColor => this._backgroundColor;
@@ -141,7 +146,10 @@
}
@Returns('String')
@JSName('backgroundColor')
- String _backgroundColor;
+ String get _backgroundColor native;
+
+ @JSName('backgroundColor')
+ set _backgroundColor(String value) native;
/** Gets the value of "background-image" */
String get backgroundImage => this._backgroundImage;
@@ -152,7 +160,10 @@
}
@Returns('String')
@JSName('backgroundImage')
- String _backgroundImage;
+ String get _backgroundImage native;
+
+ @JSName('backgroundImage')
+ set _backgroundImage(String value) native;
/** Gets the value of "background-position" */
String get backgroundPosition => this._backgroundPosition;
@@ -163,7 +174,10 @@
}
@Returns('String')
@JSName('backgroundPosition')
- String _backgroundPosition;
+ String get _backgroundPosition native;
+
+ @JSName('backgroundPosition')
+ set _backgroundPosition(String value) native;
/** Gets the value of "background-repeat" */
String get backgroundRepeat => this._backgroundRepeat;
@@ -174,7 +188,10 @@
}
@Returns('String')
@JSName('backgroundRepeat')
- String _backgroundRepeat;
+ String get _backgroundRepeat native;
+
+ @JSName('backgroundRepeat')
+ set _backgroundRepeat(String value) native;
/** Gets the value of "border" */
String get border => this._border;
@@ -185,7 +202,10 @@
}
@Returns('String')
@JSName('border')
- String _border;
+ String get _border native;
+
+ @JSName('border')
+ set _border(String value) native;
/** Gets the value of "border-bottom" */
String get borderBottom => this._borderBottom;
@@ -196,7 +216,10 @@
}
@Returns('String')
@JSName('borderBottom')
- String _borderBottom;
+ String get _borderBottom native;
+
+ @JSName('borderBottom')
+ set _borderBottom(String value) native;
/** Gets the value of "border-bottom-color" */
String get borderBottomColor => this._borderBottomColor;
@@ -207,7 +230,10 @@
}
@Returns('String')
@JSName('borderBottomColor')
- String _borderBottomColor;
+ String get _borderBottomColor native;
+
+ @JSName('borderBottomColor')
+ set _borderBottomColor(String value) native;
/** Gets the value of "border-bottom-style" */
String get borderBottomStyle => this._borderBottomStyle;
@@ -218,7 +244,10 @@
}
@Returns('String')
@JSName('borderBottomStyle')
- String _borderBottomStyle;
+ String get _borderBottomStyle native;
+
+ @JSName('borderBottomStyle')
+ set _borderBottomStyle(String value) native;
/** Gets the value of "border-bottom-width" */
String get borderBottomWidth => this._borderBottomWidth;
@@ -229,7 +258,10 @@
}
@Returns('String')
@JSName('borderBottomWidth')
- String _borderBottomWidth;
+ String get _borderBottomWidth native;
+
+ @JSName('borderBottomWidth')
+ set _borderBottomWidth(String value) native;
/** Gets the value of "border-collapse" */
String get borderCollapse => this._borderCollapse;
@@ -240,7 +272,10 @@
}
@Returns('String')
@JSName('borderCollapse')
- String _borderCollapse;
+ String get _borderCollapse native;
+
+ @JSName('borderCollapse')
+ set _borderCollapse(String value) native;
/** Gets the value of "border-color" */
String get borderColor => this._borderColor;
@@ -251,7 +286,10 @@
}
@Returns('String')
@JSName('borderColor')
- String _borderColor;
+ String get _borderColor native;
+
+ @JSName('borderColor')
+ set _borderColor(String value) native;
/** Gets the value of "border-left" */
String get borderLeft => this._borderLeft;
@@ -262,7 +300,10 @@
}
@Returns('String')
@JSName('borderLeft')
- String _borderLeft;
+ String get _borderLeft native;
+
+ @JSName('borderLeft')
+ set _borderLeft(String value) native;
/** Gets the value of "border-left-color" */
String get borderLeftColor => this._borderLeftColor;
@@ -273,7 +314,10 @@
}
@Returns('String')
@JSName('borderLeftColor')
- String _borderLeftColor;
+ String get _borderLeftColor native;
+
+ @JSName('borderLeftColor')
+ set _borderLeftColor(String value) native;
/** Gets the value of "border-left-style" */
String get borderLeftStyle => this._borderLeftStyle;
@@ -284,7 +328,10 @@
}
@Returns('String')
@JSName('borderLeftStyle')
- String _borderLeftStyle;
+ String get _borderLeftStyle native;
+
+ @JSName('borderLeftStyle')
+ set _borderLeftStyle(String value) native;
/** Gets the value of "border-left-width" */
String get borderLeftWidth => this._borderLeftWidth;
@@ -295,7 +342,10 @@
}
@Returns('String')
@JSName('borderLeftWidth')
- String _borderLeftWidth;
+ String get _borderLeftWidth native;
+
+ @JSName('borderLeftWidth')
+ set _borderLeftWidth(String value) native;
/** Gets the value of "border-right" */
String get borderRight => this._borderRight;
@@ -306,7 +356,10 @@
}
@Returns('String')
@JSName('borderRight')
- String _borderRight;
+ String get _borderRight native;
+
+ @JSName('borderRight')
+ set _borderRight(String value) native;
/** Gets the value of "border-right-color" */
String get borderRightColor => this._borderRightColor;
@@ -317,7 +370,10 @@
}
@Returns('String')
@JSName('borderRightColor')
- String _borderRightColor;
+ String get _borderRightColor native;
+
+ @JSName('borderRightColor')
+ set _borderRightColor(String value) native;
/** Gets the value of "border-right-style" */
String get borderRightStyle => this._borderRightStyle;
@@ -328,7 +384,10 @@
}
@Returns('String')
@JSName('borderRightStyle')
- String _borderRightStyle;
+ String get _borderRightStyle native;
+
+ @JSName('borderRightStyle')
+ set _borderRightStyle(String value) native;
/** Gets the value of "border-right-width" */
String get borderRightWidth => this._borderRightWidth;
@@ -339,7 +398,10 @@
}
@Returns('String')
@JSName('borderRightWidth')
- String _borderRightWidth;
+ String get _borderRightWidth native;
+
+ @JSName('borderRightWidth')
+ set _borderRightWidth(String value) native;
/** Gets the value of "border-spacing" */
String get borderSpacing => this._borderSpacing;
@@ -350,7 +412,10 @@
}
@Returns('String')
@JSName('borderSpacing')
- String _borderSpacing;
+ String get _borderSpacing native;
+
+ @JSName('borderSpacing')
+ set _borderSpacing(String value) native;
/** Gets the value of "border-style" */
String get borderStyle => this._borderStyle;
@@ -361,7 +426,10 @@
}
@Returns('String')
@JSName('borderStyle')
- String _borderStyle;
+ String get _borderStyle native;
+
+ @JSName('borderStyle')
+ set _borderStyle(String value) native;
/** Gets the value of "border-top" */
String get borderTop => this._borderTop;
@@ -372,7 +440,10 @@
}
@Returns('String')
@JSName('borderTop')
- String _borderTop;
+ String get _borderTop native;
+
+ @JSName('borderTop')
+ set _borderTop(String value) native;
/** Gets the value of "border-top-color" */
String get borderTopColor => this._borderTopColor;
@@ -383,7 +454,10 @@
}
@Returns('String')
@JSName('borderTopColor')
- String _borderTopColor;
+ String get _borderTopColor native;
+
+ @JSName('borderTopColor')
+ set _borderTopColor(String value) native;
/** Gets the value of "border-top-style" */
String get borderTopStyle => this._borderTopStyle;
@@ -394,7 +468,10 @@
}
@Returns('String')
@JSName('borderTopStyle')
- String _borderTopStyle;
+ String get _borderTopStyle native;
+
+ @JSName('borderTopStyle')
+ set _borderTopStyle(String value) native;
/** Gets the value of "border-top-width" */
String get borderTopWidth => this._borderTopWidth;
@@ -405,7 +482,10 @@
}
@Returns('String')
@JSName('borderTopWidth')
- String _borderTopWidth;
+ String get _borderTopWidth native;
+
+ @JSName('borderTopWidth')
+ set _borderTopWidth(String value) native;
/** Gets the value of "border-width" */
String get borderWidth => this._borderWidth;
@@ -416,7 +496,10 @@
}
@Returns('String')
@JSName('borderWidth')
- String _borderWidth;
+ String get _borderWidth native;
+
+ @JSName('borderWidth')
+ set _borderWidth(String value) native;
/** Gets the value of "bottom" */
String get bottom => this._bottom;
@@ -427,7 +510,10 @@
}
@Returns('String')
@JSName('bottom')
- String _bottom;
+ String get _bottom native;
+
+ @JSName('bottom')
+ set _bottom(String value) native;
/** Gets the value of "caption-side" */
String get captionSide => this._captionSide;
@@ -438,7 +524,10 @@
}
@Returns('String')
@JSName('captionSide')
- String _captionSide;
+ String get _captionSide native;
+
+ @JSName('captionSide')
+ set _captionSide(String value) native;
/** Gets the value of "clear" */
String get clear => this._clear;
@@ -449,7 +538,10 @@
}
@Returns('String')
@JSName('clear')
- String _clear;
+ String get _clear native;
+
+ @JSName('clear')
+ set _clear(String value) native;
/** Gets the value of "clip" */
String get clip => this._clip;
@@ -460,7 +552,10 @@
}
@Returns('String')
@JSName('clip')
- String _clip;
+ String get _clip native;
+
+ @JSName('clip')
+ set _clip(String value) native;
/** Gets the value of "color" */
String get color => this._color;
@@ -471,7 +566,10 @@
}
@Returns('String')
@JSName('color')
- String _color;
+ String get _color native;
+
+ @JSName('color')
+ set _color(String value) native;
/** Gets the value of "content" */
String get content => this._content;
@@ -482,7 +580,10 @@
}
@Returns('String')
@JSName('content')
- String _content;
+ String get _content native;
+
+ @JSName('content')
+ set _content(String value) native;
/** Gets the value of "cursor" */
String get cursor => this._cursor;
@@ -493,7 +594,10 @@
}
@Returns('String')
@JSName('cursor')
- String _cursor;
+ String get _cursor native;
+
+ @JSName('cursor')
+ set _cursor(String value) native;
/** Gets the value of "direction" */
String get direction => this._direction;
@@ -504,7 +608,10 @@
}
@Returns('String')
@JSName('direction')
- String _direction;
+ String get _direction native;
+
+ @JSName('direction')
+ set _direction(String value) native;
/** Gets the value of "display" */
String get display => this._display;
@@ -515,7 +622,10 @@
}
@Returns('String')
@JSName('display')
- String _display;
+ String get _display native;
+
+ @JSName('display')
+ set _display(String value) native;
/** Gets the value of "empty-cells" */
String get emptyCells => this._emptyCells;
@@ -526,7 +636,10 @@
}
@Returns('String')
@JSName('emptyCells')
- String _emptyCells;
+ String get _emptyCells native;
+
+ @JSName('emptyCells')
+ set _emptyCells(String value) native;
/** Gets the value of "font" */
String get font => this._font;
@@ -537,7 +650,10 @@
}
@Returns('String')
@JSName('font')
- String _font;
+ String get _font native;
+
+ @JSName('font')
+ set _font(String value) native;
/** Gets the value of "font-family" */
String get fontFamily => this._fontFamily;
@@ -548,7 +664,10 @@
}
@Returns('String')
@JSName('fontFamily')
- String _fontFamily;
+ String get _fontFamily native;
+
+ @JSName('fontFamily')
+ set _fontFamily(String value) native;
/** Gets the value of "font-size" */
String get fontSize => this._fontSize;
@@ -559,7 +678,10 @@
}
@Returns('String')
@JSName('fontSize')
- String _fontSize;
+ String get _fontSize native;
+
+ @JSName('fontSize')
+ set _fontSize(String value) native;
/** Gets the value of "font-style" */
String get fontStyle => this._fontStyle;
@@ -570,7 +692,10 @@
}
@Returns('String')
@JSName('fontStyle')
- String _fontStyle;
+ String get _fontStyle native;
+
+ @JSName('fontStyle')
+ set _fontStyle(String value) native;
/** Gets the value of "font-variant" */
String get fontVariant => this._fontVariant;
@@ -581,7 +706,10 @@
}
@Returns('String')
@JSName('fontVariant')
- String _fontVariant;
+ String get _fontVariant native;
+
+ @JSName('fontVariant')
+ set _fontVariant(String value) native;
/** Gets the value of "font-weight" */
String get fontWeight => this._fontWeight;
@@ -592,7 +720,10 @@
}
@Returns('String')
@JSName('fontWeight')
- String _fontWeight;
+ String get _fontWeight native;
+
+ @JSName('fontWeight')
+ set _fontWeight(String value) native;
/** Gets the value of "height" */
String get height => this._height;
@@ -603,7 +734,10 @@
}
@Returns('String')
@JSName('height')
- String _height;
+ String get _height native;
+
+ @JSName('height')
+ set _height(String value) native;
/** Gets the value of "left" */
String get left => this._left;
@@ -614,7 +748,10 @@
}
@Returns('String')
@JSName('left')
- String _left;
+ String get _left native;
+
+ @JSName('left')
+ set _left(String value) native;
/** Gets the value of "letter-spacing" */
String get letterSpacing => this._letterSpacing;
@@ -625,7 +762,10 @@
}
@Returns('String')
@JSName('letterSpacing')
- String _letterSpacing;
+ String get _letterSpacing native;
+
+ @JSName('letterSpacing')
+ set _letterSpacing(String value) native;
/** Gets the value of "line-height" */
String get lineHeight => this._lineHeight;
@@ -636,7 +776,10 @@
}
@Returns('String')
@JSName('lineHeight')
- String _lineHeight;
+ String get _lineHeight native;
+
+ @JSName('lineHeight')
+ set _lineHeight(String value) native;
/** Gets the value of "list-style" */
String get listStyle => this._listStyle;
@@ -647,7 +790,10 @@
}
@Returns('String')
@JSName('listStyle')
- String _listStyle;
+ String get _listStyle native;
+
+ @JSName('listStyle')
+ set _listStyle(String value) native;
/** Gets the value of "list-style-image" */
String get listStyleImage => this._listStyleImage;
@@ -658,7 +804,10 @@
}
@Returns('String')
@JSName('listStyleImage')
- String _listStyleImage;
+ String get _listStyleImage native;
+
+ @JSName('listStyleImage')
+ set _listStyleImage(String value) native;
/** Gets the value of "list-style-position" */
String get listStylePosition => this._listStylePosition;
@@ -669,7 +818,10 @@
}
@Returns('String')
@JSName('listStylePosition')
- String _listStylePosition;
+ String get _listStylePosition native;
+
+ @JSName('listStylePosition')
+ set _listStylePosition(String value) native;
/** Gets the value of "list-style-type" */
String get listStyleType => this._listStyleType;
@@ -680,7 +832,10 @@
}
@Returns('String')
@JSName('listStyleType')
- String _listStyleType;
+ String get _listStyleType native;
+
+ @JSName('listStyleType')
+ set _listStyleType(String value) native;
/** Gets the value of "margin" */
String get margin => this._margin;
@@ -691,7 +846,10 @@
}
@Returns('String')
@JSName('margin')
- String _margin;
+ String get _margin native;
+
+ @JSName('margin')
+ set _margin(String value) native;
/** Gets the value of "margin-bottom" */
String get marginBottom => this._marginBottom;
@@ -702,7 +860,10 @@
}
@Returns('String')
@JSName('marginBottom')
- String _marginBottom;
+ String get _marginBottom native;
+
+ @JSName('marginBottom')
+ set _marginBottom(String value) native;
/** Gets the value of "margin-left" */
String get marginLeft => this._marginLeft;
@@ -713,7 +874,10 @@
}
@Returns('String')
@JSName('marginLeft')
- String _marginLeft;
+ String get _marginLeft native;
+
+ @JSName('marginLeft')
+ set _marginLeft(String value) native;
/** Gets the value of "margin-right" */
String get marginRight => this._marginRight;
@@ -724,7 +888,10 @@
}
@Returns('String')
@JSName('marginRight')
- String _marginRight;
+ String get _marginRight native;
+
+ @JSName('marginRight')
+ set _marginRight(String value) native;
/** Gets the value of "margin-top" */
String get marginTop => this._marginTop;
@@ -735,7 +902,10 @@
}
@Returns('String')
@JSName('marginTop')
- String _marginTop;
+ String get _marginTop native;
+
+ @JSName('marginTop')
+ set _marginTop(String value) native;
/** Gets the value of "max-height" */
String get maxHeight => this._maxHeight;
@@ -746,7 +916,10 @@
}
@Returns('String')
@JSName('maxHeight')
- String _maxHeight;
+ String get _maxHeight native;
+
+ @JSName('maxHeight')
+ set _maxHeight(String value) native;
/** Gets the value of "max-width" */
String get maxWidth => this._maxWidth;
@@ -757,7 +930,10 @@
}
@Returns('String')
@JSName('maxWidth')
- String _maxWidth;
+ String get _maxWidth native;
+
+ @JSName('maxWidth')
+ set _maxWidth(String value) native;
/** Gets the value of "min-height" */
String get minHeight => this._minHeight;
@@ -768,7 +944,10 @@
}
@Returns('String')
@JSName('minHeight')
- String _minHeight;
+ String get _minHeight native;
+
+ @JSName('minHeight')
+ set _minHeight(String value) native;
/** Gets the value of "min-width" */
String get minWidth => this._minWidth;
@@ -779,7 +958,10 @@
}
@Returns('String')
@JSName('minWidth')
- String _minWidth;
+ String get _minWidth native;
+
+ @JSName('minWidth')
+ set _minWidth(String value) native;
/** Gets the value of "outline" */
String get outline => this._outline;
@@ -790,7 +972,10 @@
}
@Returns('String')
@JSName('outline')
- String _outline;
+ String get _outline native;
+
+ @JSName('outline')
+ set _outline(String value) native;
/** Gets the value of "outline-color" */
String get outlineColor => this._outlineColor;
@@ -801,7 +986,10 @@
}
@Returns('String')
@JSName('outlineColor')
- String _outlineColor;
+ String get _outlineColor native;
+
+ @JSName('outlineColor')
+ set _outlineColor(String value) native;
/** Gets the value of "outline-style" */
String get outlineStyle => this._outlineStyle;
@@ -812,7 +1000,10 @@
}
@Returns('String')
@JSName('outlineStyle')
- String _outlineStyle;
+ String get _outlineStyle native;
+
+ @JSName('outlineStyle')
+ set _outlineStyle(String value) native;
/** Gets the value of "outline-width" */
String get outlineWidth => this._outlineWidth;
@@ -823,7 +1014,10 @@
}
@Returns('String')
@JSName('outlineWidth')
- String _outlineWidth;
+ String get _outlineWidth native;
+
+ @JSName('outlineWidth')
+ set _outlineWidth(String value) native;
/** Gets the value of "overflow" */
String get overflow => this._overflow;
@@ -834,7 +1028,10 @@
}
@Returns('String')
@JSName('overflow')
- String _overflow;
+ String get _overflow native;
+
+ @JSName('overflow')
+ set _overflow(String value) native;
/** Gets the value of "padding" */
String get padding => this._padding;
@@ -845,7 +1042,10 @@
}
@Returns('String')
@JSName('padding')
- String _padding;
+ String get _padding native;
+
+ @JSName('padding')
+ set _padding(String value) native;
/** Gets the value of "padding-bottom" */
String get paddingBottom => this._paddingBottom;
@@ -856,7 +1056,10 @@
}
@Returns('String')
@JSName('paddingBottom')
- String _paddingBottom;
+ String get _paddingBottom native;
+
+ @JSName('paddingBottom')
+ set _paddingBottom(String value) native;
/** Gets the value of "padding-left" */
String get paddingLeft => this._paddingLeft;
@@ -867,7 +1070,10 @@
}
@Returns('String')
@JSName('paddingLeft')
- String _paddingLeft;
+ String get _paddingLeft native;
+
+ @JSName('paddingLeft')
+ set _paddingLeft(String value) native;
/** Gets the value of "padding-right" */
String get paddingRight => this._paddingRight;
@@ -878,7 +1084,10 @@
}
@Returns('String')
@JSName('paddingRight')
- String _paddingRight;
+ String get _paddingRight native;
+
+ @JSName('paddingRight')
+ set _paddingRight(String value) native;
/** Gets the value of "padding-top" */
String get paddingTop => this._paddingTop;
@@ -889,7 +1098,10 @@
}
@Returns('String')
@JSName('paddingTop')
- String _paddingTop;
+ String get _paddingTop native;
+
+ @JSName('paddingTop')
+ set _paddingTop(String value) native;
/** Gets the value of "page-break-after" */
String get pageBreakAfter => this._pageBreakAfter;
@@ -900,7 +1112,10 @@
}
@Returns('String')
@JSName('pageBreakAfter')
- String _pageBreakAfter;
+ String get _pageBreakAfter native;
+
+ @JSName('pageBreakAfter')
+ set _pageBreakAfter(String value) native;
/** Gets the value of "page-break-before" */
String get pageBreakBefore => this._pageBreakBefore;
@@ -911,7 +1126,10 @@
}
@Returns('String')
@JSName('pageBreakBefore')
- String _pageBreakBefore;
+ String get _pageBreakBefore native;
+
+ @JSName('pageBreakBefore')
+ set _pageBreakBefore(String value) native;
/** Gets the value of "page-break-inside" */
String get pageBreakInside => this._pageBreakInside;
@@ -922,7 +1140,10 @@
}
@Returns('String')
@JSName('pageBreakInside')
- String _pageBreakInside;
+ String get _pageBreakInside native;
+
+ @JSName('pageBreakInside')
+ set _pageBreakInside(String value) native;
/** Gets the value of "position" */
String get position => this._position;
@@ -933,7 +1154,10 @@
}
@Returns('String')
@JSName('position')
- String _position;
+ String get _position native;
+
+ @JSName('position')
+ set _position(String value) native;
/** Gets the value of "quotes" */
String get quotes => this._quotes;
@@ -944,7 +1168,10 @@
}
@Returns('String')
@JSName('quotes')
- String _quotes;
+ String get _quotes native;
+
+ @JSName('quotes')
+ set _quotes(String value) native;
/** Gets the value of "right" */
String get right => this._right;
@@ -955,7 +1182,10 @@
}
@Returns('String')
@JSName('right')
- String _right;
+ String get _right native;
+
+ @JSName('right')
+ set _right(String value) native;
/** Gets the value of "table-layout" */
String get tableLayout => this._tableLayout;
@@ -966,7 +1196,10 @@
}
@Returns('String')
@JSName('tableLayout')
- String _tableLayout;
+ String get _tableLayout native;
+
+ @JSName('tableLayout')
+ set _tableLayout(String value) native;
/** Gets the value of "text-align" */
String get textAlign => this._textAlign;
@@ -977,7 +1210,10 @@
}
@Returns('String')
@JSName('textAlign')
- String _textAlign;
+ String get _textAlign native;
+
+ @JSName('textAlign')
+ set _textAlign(String value) native;
/** Gets the value of "text-decoration" */
String get textDecoration => this._textDecoration;
@@ -988,7 +1224,10 @@
}
@Returns('String')
@JSName('textDecoration')
- String _textDecoration;
+ String get _textDecoration native;
+
+ @JSName('textDecoration')
+ set _textDecoration(String value) native;
/** Gets the value of "text-indent" */
String get textIndent => this._textIndent;
@@ -999,7 +1238,10 @@
}
@Returns('String')
@JSName('textIndent')
- String _textIndent;
+ String get _textIndent native;
+
+ @JSName('textIndent')
+ set _textIndent(String value) native;
/** Gets the value of "text-transform" */
String get textTransform => this._textTransform;
@@ -1010,7 +1252,10 @@
}
@Returns('String')
@JSName('textTransform')
- String _textTransform;
+ String get _textTransform native;
+
+ @JSName('textTransform')
+ set _textTransform(String value) native;
/** Gets the value of "top" */
String get top => this._top;
@@ -1021,7 +1266,10 @@
}
@Returns('String')
@JSName('top')
- String _top;
+ String get _top native;
+
+ @JSName('top')
+ set _top(String value) native;
/** Gets the value of "unicode-bidi" */
String get unicodeBidi => this._unicodeBidi;
@@ -1032,7 +1280,10 @@
}
@Returns('String')
@JSName('unicodeBidi')
- String _unicodeBidi;
+ String get _unicodeBidi native;
+
+ @JSName('unicodeBidi')
+ set _unicodeBidi(String value) native;
/** Gets the value of "vertical-align" */
String get verticalAlign => this._verticalAlign;
@@ -1043,7 +1294,10 @@
}
@Returns('String')
@JSName('verticalAlign')
- String _verticalAlign;
+ String get _verticalAlign native;
+
+ @JSName('verticalAlign')
+ set _verticalAlign(String value) native;
/** Gets the value of "visibility" */
String get visibility => this._visibility;
@@ -1054,7 +1308,10 @@
}
@Returns('String')
@JSName('visibility')
- String _visibility;
+ String get _visibility native;
+
+ @JSName('visibility')
+ set _visibility(String value) native;
/** Gets the value of "white-space" */
String get whiteSpace => this._whiteSpace;
@@ -1065,7 +1322,10 @@
}
@Returns('String')
@JSName('whiteSpace')
- String _whiteSpace;
+ String get _whiteSpace native;
+
+ @JSName('whiteSpace')
+ set _whiteSpace(String value) native;
/** Gets the value of "width" */
String get width => this._width;
@@ -1076,7 +1336,10 @@
}
@Returns('String')
@JSName('width')
- String _width;
+ String get _width native;
+
+ @JSName('width')
+ set _width(String value) native;
/** Gets the value of "word-spacing" */
String get wordSpacing => this._wordSpacing;
@@ -1087,7 +1350,10 @@
}
@Returns('String')
@JSName('wordSpacing')
- String _wordSpacing;
+ String get _wordSpacing native;
+
+ @JSName('wordSpacing')
+ set _wordSpacing(String value) native;
/** Gets the value of "z-index" */
String get zIndex => this._zIndex;
@@ -1098,7 +1364,10 @@
}
@Returns('String')
@JSName('zIndex')
- String _zIndex;
+ String get _zIndex native;
+
+ @JSName('zIndex')
+ set _zIndex(String value) native;
}
@@ -1115,7 +1384,7 @@
_elementCssStyleDeclarationSetIterable$NULLASSERT.first.getPropertyValue(
propertyName);
- void setProperty(String propertyName, String value,
+ void setProperty(String propertyName, String$NULLABLE value,
[String$NULLABLE priority]) {
_elementCssStyleDeclarationSetIterable$NULLASSERT.forEach((e) =>
e.setProperty(propertyName, value, priority));
@@ -1589,7 +1858,7 @@
abstract class CssStyleDeclarationBase {
String getPropertyValue(String propertyName);
- void setProperty(String propertyName, String value,
+ void setProperty(String propertyName, String$NULLABLE value,
[String$NULLABLE priority]);
/** Gets the value of "align-content" */
diff --git a/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate b/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
index ea760be..d2b2c9d 100644
--- a/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
+++ b/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
@@ -11,7 +11,7 @@
{NodeValidator$NULLABLE validator,
NodeTreeSanitizer$NULLABLE treeSanitizer}) {
- return document.body.createFragment(html,
+ return document.body$NULLASSERT.createFragment(html,
validator: validator, treeSanitizer: treeSanitizer);
}
@@ -29,13 +29,13 @@
// Native field is used only by Dart code so does not lead to instantiation
// of native classes
@Creates('Null')
- List<Element> _docChildren;
+ List<Element>$NULLABLE _docChildren;
List<Element> get children {
if (_docChildren == null) {
_docChildren = new FilteredElementList(this);
}
- return _docChildren;
+ return _docChildren$NULLASSERT;
}
set children(List<Element> value) {
@@ -75,7 +75,7 @@
NodeTreeSanitizer$NULLABLE treeSanitizer}) {
this.nodes.clear();
- append(document.body.createFragment(
+ append(document.body$NULLASSERT.createFragment(
html, validator: validator, treeSanitizer: treeSanitizer));
}
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index d061f98..d05d9c5 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -348,8 +348,8 @@
factory Element.html(String html,
{NodeValidator$NULLABLE validator,
NodeTreeSanitizer$NULLABLE treeSanitizer}) {
- var fragment = document.body.createFragment(html, validator: validator,
- treeSanitizer: treeSanitizer);
+ var fragment = document.body$NULLASSERT.createFragment(html,
+ validator: validator, treeSanitizer: treeSanitizer);
return fragment.nodes.where((e) => e is Element).single $#NULLSAFECAST(as Element);
}
@@ -567,10 +567,7 @@
@pragma('dart2js:tryInline')
String$NULLABLE getAttribute(String name) {
// Protect [name] against string conversion to "null" or "undefined".
-$if NNBD
-$else
assert(name != null, 'Attribute name cannot be null');
-$endif
return _getAttribute(name);
}
@@ -578,20 +575,14 @@
String$NULLABLE getAttributeNS(String$NULLABLE namespaceURI, String name) {
// Protect [name] against string conversion to "null" or "undefined".
// [namespaceURI] does not need protecting, both `null` and `undefined` map to `null`.
-$if NNBD
-$else
assert(name != null, 'Attribute name cannot be null');
-$endif
return _getAttributeNS(namespaceURI, name);
}
@pragma('dart2js:tryInline')
bool hasAttribute(String name) {
// Protect [name] against string conversion to "null" or "undefined".
-$if NNBD
-$else
assert(name != null, 'Attribute name cannot be null');
-$endif
return _hasAttribute(name);
}
@@ -599,52 +590,37 @@
bool hasAttributeNS(String$NULLABLE namespaceURI, String name) {
// Protect [name] against string conversion to "null" or "undefined".
// [namespaceURI] does not need protecting, both `null` and `undefined` map to `null`.
-$if NNBD
-$else
assert(name != null, 'Attribute name cannot be null');
-$endif
return _hasAttributeNS(namespaceURI, name);
}
@pragma('dart2js:tryInline')
void removeAttribute(String name) {
// Protect [name] against string conversion to "null" or "undefined".
-$if NNBD
-$else
assert(name != null, 'Attribute name cannot be null');
-$endif
_removeAttribute(name);
}
@pragma('dart2js:tryInline')
void removeAttributeNS(String$NULLABLE namespaceURI, String name) {
// Protect [name] against string conversion to "null" or "undefined".
-$if NNBD
-$else
assert(name != null, 'Attribute name cannot be null');
-$endif
_removeAttributeNS(namespaceURI, name);
}
@pragma('dart2js:tryInline')
void setAttribute(String name, String value) {
// Protect [name] against string conversion to "null" or "undefined".
-$if NNBD
-$else
assert(name != null, 'Attribute name cannot be null');
// TODO(sra): assert(value != null, 'Attribute value cannot be null.');
-$endif
_setAttribute(name, value);
}
@pragma('dart2js:tryInline')
void setAttributeNS(String$NULLABLE namespaceURI, String name, String value) {
// Protect [name] against string conversion to "null" or "undefined".
-$if NNBD
-$else
assert(name != null, 'Attribute name cannot be null');
// TODO(sra): assert(value != null, 'Attribute value cannot be null.');
-$endif
_setAttributeNS(namespaceURI, name, value);
}
@@ -1360,10 +1336,10 @@
var contextElement;
if (this is BodyElement) {
- contextElement = _parseDocument$NULLASSERT.body;
+ contextElement = _parseDocument$NULLASSERT.body$NULLASSERT;
} else {
contextElement = _parseDocument$NULLASSERT.createElement(tagName);
- _parseDocument$NULLASSERT.body.append(contextElement);
+ _parseDocument$NULLASSERT.body$NULLASSERT.append(contextElement);
}
var fragment;
if (Range.supportsCreateContextualFragment &&
@@ -1452,14 +1428,8 @@
String get innerHtml => _innerHtml;
@JSName('innerText')
-$if NNBD
- String get innerText => JS<String>("String", "#.innerText", this);
- set innerText(String value) {
- JS("void", "#.innerText = #", this, value);
- }
-$else
- String innerText;
-$endif
+ String get innerText native;
+ set innerText(String value) native;
/**
* This is an ease-of-use accessor for event streams which should only be
@@ -1527,11 +1497,7 @@
return result;
}
-$if NNBD
- Element get offsetParent => JS("Element", "#.offsetParent", this);
-$else
- final Element offsetParent;
-$endif
+ Element get offsetParent native;
int get offsetHeight => JS<num>('num', '#.offsetHeight', this).round();
diff --git a/tools/dom/templates/html/impl/impl_Event.darttemplate b/tools/dom/templates/html/impl/impl_Event.darttemplate
index 7a4d92e..25772d2 100644
--- a/tools/dom/templates/html/impl/impl_Event.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Event.darttemplate
@@ -35,7 +35,8 @@
}
/** The CSS selector involved with event delegation. */
- String$NULLABLE _selector;
+ String$NULLABLE get _selector native;
+ set _selector(String$NULLABLE value) native;
/**
* A pointer to the element whose CSS selector matched within which an event
diff --git a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
index 4401781..5da7c9b 100644
--- a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
@@ -9,7 +9,8 @@
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
$!MEMBERS
- BodyElement body;
+ BodyElement$NULLABLE get body native;
+ set body(BodyElement$NULLABLE value) native;
/// UNSTABLE: Chrome-only - create a Range from the given point.
@Unstable()
diff --git a/tools/dom/templates/html/impl/impl_HTMLInputElement.darttemplate b/tools/dom/templates/html/impl/impl_HTMLInputElement.darttemplate
index fb81a0a..11c04d4 100644
--- a/tools/dom/templates/html/impl/impl_HTMLInputElement.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLInputElement.darttemplate
@@ -50,9 +50,6 @@
* Exposes the functionality common between all InputElement types.
*/
abstract class InputElementBase implements Element {
-$if NNBD
- // These fields here and below are overridden by generated code and therefore
- // can't be nullable. Opted to translate these fields to getters/setters.
bool get autofocus;
set autofocus(bool value);
@@ -70,19 +67,6 @@
String get value;
set value(String value);
-$else
- bool autofocus;
-
- bool disabled;
-
- bool incremental;
-
- bool indeterminate;
-
- String name;
-
- String value;
-$endif
List<Node> get labels;
@@ -109,7 +93,6 @@
* Base interface for all inputs which involve text editing.
*/
abstract class TextInputElementBase implements InputElementBase {
-$if NNBD
String get autocomplete;
set autocomplete(String value);
@@ -130,29 +113,17 @@
int get size;
set size(int value);
-$else
- String autocomplete;
-
- int maxLength;
-
- String pattern;
-
- String placeholder;
-
- bool readOnly;
-
- bool required;
-
- int size;
-$endif
void select();
- String$NULLABLE selectionDirection;
+ String$NULLABLE get selectionDirection;
+ set selectionDirection(String$NULLABLE value);
- int$NULLABLE selectionEnd;
+ int$NULLABLE get selectionEnd;
+ set selectionEnd(int$NULLABLE value);
- int$NULLABLE selectionStart;
+ int$NULLABLE get selectionStart;
+ set selectionStart(int$NULLABLE value);
void setSelectionRange(int start, int end, [String$NULLABLE direction]);
}
@@ -170,7 +141,8 @@
abstract class SearchInputElement implements TextInputElementBase {
factory SearchInputElement() => new InputElement(type: 'search');
- String dirName;
+ String get dirName;
+ set dirName(String value);
Element$NULLABLE get list;
@@ -186,7 +158,8 @@
abstract class TextInputElement implements TextInputElementBase {
factory TextInputElement() => new InputElement(type: 'text');
- String dirName;
+ String get dirName;
+ set dirName(String value);
Element$NULLABLE get list;
}
@@ -246,25 +219,34 @@
abstract class EmailInputElement implements TextInputElementBase {
factory EmailInputElement() => new InputElement(type: 'email');
- String autocomplete;
+ String get autocomplete;
+ set autocomplete(String value);
- bool autofocus;
+ bool get autofocus;
+ set autofocus(bool value);
Element$NULLABLE get list;
- int maxLength;
+ int get maxLength;
+ set maxLength(int value);
- bool multiple;
+ bool get multiple;
+ set multiple(bool value);
- String pattern;
+ String get pattern;
+ set pattern(String value);
- String placeholder;
+ String get placeholder;
+ set placeholder(String value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
- int size;
+ int get size;
+ set size(int value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -286,7 +268,6 @@
Element$NULLABLE get list;
-$if NNBD
String get max;
set max(String value);
@@ -298,15 +279,6 @@
num get valueAsNumber;
set valueAsNumber(num value);
-$else
- String max;
-
- String min;
-
- String step;
-
- num valueAsNumber;
-$endif
void stepDown([int$NULLABLE n]);
@@ -322,11 +294,14 @@
abstract class DateInputElement implements RangeInputElementBase {
factory DateInputElement() => new InputElement(type: 'date');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -343,11 +318,14 @@
abstract class MonthInputElement implements RangeInputElementBase {
factory MonthInputElement() => new InputElement(type: 'month');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -364,11 +342,14 @@
abstract class WeekInputElement implements RangeInputElementBase {
factory WeekInputElement() => new InputElement(type: 'week');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -385,11 +366,14 @@
abstract class TimeInputElement implements RangeInputElementBase {
factory TimeInputElement() => new InputElement(type: 'time');
- DateTime valueAsDate;
+ DateTime get valueAsDate;
+ set valueAsDate(DateTime value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -408,9 +392,11 @@
factory LocalDateTimeInputElement() =>
new InputElement(type: 'datetime-local');
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -427,11 +413,14 @@
abstract class NumberInputElement implements RangeInputElementBase {
factory NumberInputElement() => new InputElement(type: 'number');
- String placeholder;
+ String get placeholder;
+ set placeholder(String value);
- bool readOnly;
+ bool get readOnly;
+ set readOnly(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
/// Returns true if this input type is supported on the current platform.
static bool get supported {
@@ -465,9 +454,11 @@
abstract class CheckboxInputElement implements InputElementBase {
factory CheckboxInputElement() => new InputElement(type: 'checkbox');
- bool checked;
+ bool get checked;
+ set checked(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
}
@@ -485,9 +476,11 @@
abstract class RadioButtonInputElement implements InputElementBase {
factory RadioButtonInputElement() => new InputElement(type: 'radio');
- bool checked;
+ bool get checked;
+ set checked(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
}
/**
@@ -496,11 +489,14 @@
abstract class FileUploadInputElement implements InputElementBase {
factory FileUploadInputElement() => new InputElement(type: 'file');
- String accept;
+ String get accept;
+ set accept(String value);
- bool multiple;
+ bool get multiple;
+ set multiple(bool value);
- bool required;
+ bool get required;
+ set required(bool value);
List<File>$NULLABLE files;
}
@@ -511,15 +507,20 @@
abstract class SubmitButtonInputElement implements InputElementBase {
factory SubmitButtonInputElement() => new InputElement(type: 'submit');
- String formAction;
+ String get formAction;
+ set formAction(String value);
- String formEnctype;
+ String get formEnctype;
+ set formEnctype(String value);
- String formMethod;
+ String get formMethod;
+ set formMethod(String value);
- bool formNoValidate;
+ bool get formNoValidate;
+ set formNoValidate(bool value);
- String formTarget;
+ String get formTarget;
+ set formTarget(String value);
}
/**
@@ -529,23 +530,32 @@
abstract class ImageButtonInputElement implements InputElementBase {
factory ImageButtonInputElement() => new InputElement(type: 'image');
- String alt;
+ String get alt;
+ set alt(String value);
- String formAction;
+ String get formAction;
+ set formAction(String value);
- String formEnctype;
+ String get formEnctype;
+ set formEnctype(String value);
- String formMethod;
+ String get formMethod;
+ set formMethod(String value);
- bool formNoValidate;
+ bool get formNoValidate;
+ set formNoValidate(bool value);
- String formTarget;
+ String get formTarget;
+ set formTarget(String value);
- int height;
+ int get height;
+ set height(int value);
- String src;
+ String get src;
+ set src(String value);
- int width;
+ int get width;
+ set width(int value);
}
/**
diff --git a/tools/dom/templates/html/impl/impl_IDBVersionChangeEvent.darttemplate b/tools/dom/templates/html/impl/impl_IDBVersionChangeEvent.darttemplate
index f93d07e..c2741b94 100644
--- a/tools/dom/templates/html/impl/impl_IDBVersionChangeEvent.darttemplate
+++ b/tools/dom/templates/html/impl/impl_IDBVersionChangeEvent.darttemplate
@@ -7,6 +7,6 @@
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
$!MEMBERS
@JSName('target')
- final OpenDBRequest target;
+ OpenDBRequest get target native;
}
diff --git a/tools/dom/templates/html/impl/impl_MessageEvent.darttemplate b/tools/dom/templates/html/impl/impl_MessageEvent.darttemplate
index 3c690ac..e98d744 100644
--- a/tools/dom/templates/html/impl/impl_MessageEvent.darttemplate
+++ b/tools/dom/templates/html/impl/impl_MessageEvent.darttemplate
@@ -35,7 +35,7 @@
@JSName('data')
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final dynamic _get_data;
+ dynamic get _get_data native;
$!MEMBERS
}
diff --git a/tools/dom/templates/html/impl/impl_Node.darttemplate b/tools/dom/templates/html/impl/impl_Node.darttemplate
index b95204e..2616515 100644
--- a/tools/dom/templates/html/impl/impl_Node.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Node.darttemplate
@@ -268,11 +268,7 @@
*/
@Returns('NodeList')
@Creates('NodeList')
-$if NNBD
- List<Node> get childNodes => JS("NodeList", "#.childNodes", this);
-$else
- final List<Node> childNodes;
-$endif
+ List<Node> get childNodes native;
$!MEMBERS
}
diff --git a/tools/dom/templates/html/impl/impl_SVGElement.darttemplate b/tools/dom/templates/html/impl/impl_SVGElement.darttemplate
index 9934ddb..1e66365 100644
--- a/tools/dom/templates/html/impl/impl_SVGElement.darttemplate
+++ b/tools/dom/templates/html/impl/impl_SVGElement.darttemplate
@@ -100,7 +100,7 @@
// We create a fragment which will parse in the HTML parser
var html = '<svg version="1.1">$svg</svg>';
- var fragment = document.body.createFragment(html,
+ var fragment = document.body$NULLASSERT.createFragment(html,
treeSanitizer: treeSanitizer);
var svgFragment = new DocumentFragment();
diff --git a/tools/dom/templates/html/impl/impl_ServiceWorkerMessageEvent.darttemplate b/tools/dom/templates/html/impl/impl_ServiceWorkerMessageEvent.darttemplate
index 2df0f3b..c8bd286 100644
--- a/tools/dom/templates/html/impl/impl_ServiceWorkerMessageEvent.darttemplate
+++ b/tools/dom/templates/html/impl/impl_ServiceWorkerMessageEvent.darttemplate
@@ -18,7 +18,7 @@
@JSName('data')
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final dynamic _get_data;
+ dynamic get _get_data native;
$!MEMBERS
}
diff --git a/tools/dom/templates/html/impl/impl_WebGLCanvas.darttemplate b/tools/dom/templates/html/impl/impl_WebGLCanvas.darttemplate
index a4730dc..2909b4d 100644
--- a/tools/dom/templates/html/impl/impl_WebGLCanvas.darttemplate
+++ b/tools/dom/templates/html/impl/impl_WebGLCanvas.darttemplate
@@ -8,9 +8,9 @@
$!MEMBERS
@JSName('canvas')
- final CanvasElement canvas;
+ CanvasElement get canvas native;
@JSName('canvas')
- final OffscreenCanvas offscreenCanvas;
+ OffscreenCanvas get offscreenCanvas native;
}
diff --git a/tools/dom/templates/html/impl/impl_Window.darttemplate b/tools/dom/templates/html/impl/impl_Window.darttemplate
index 5898c0c..da850bf 100644
--- a/tools/dom/templates/html/impl/impl_Window.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Window.darttemplate
@@ -106,7 +106,7 @@
*/
int requestAnimationFrame(FrameRequestCallback callback) {
_ensureRequestAnimationFrame();
- return _requestAnimationFrame(_wrapZone(callback));
+ return _requestAnimationFrame(_wrapZone(callback)$NULLASSERT);
}
/**
diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart
new file mode 100755
index 0000000..3d415c3
--- /dev/null
+++ b/tools/generate_package_config.dart
@@ -0,0 +1,139 @@
+#!/usr/bin/env dart
+
+/// Generates the repo's ".dart_tool/package_config.json" file.
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:path/path.dart' as p;
+import 'package:pub_semver/pub_semver.dart';
+import 'package:yaml/yaml.dart';
+
+/// Version to use if a package doesn't constrain the language version.
+final defaultVersion = Version(2, 7, 0);
+
+final repoRoot = p.dirname(p.dirname(p.fromUri(Platform.script)));
+final configFilePath = p.join(repoRoot, '.dart_tool/package_config.json');
+
+void main(List<String> args) {
+ var packageDirs = [
+ ...listSubdirectories('pkg'),
+ ...listSubdirectories('third_party/pkg'),
+ ...listSubdirectories('third_party/pkg_tested'),
+ ...listSubdirectories('third_party/pkg/test/pkgs'),
+ packageDirectory('runtime/observatory'),
+ packageDirectory(
+ 'runtime/observatory/tests/service/observatory_test_package'),
+ packageDirectory('sdk/lib/_internal/sdk_library_metadata'),
+ packageDirectory('sdk/lib/_internal/js_runtime'),
+ packageDirectory('third_party/pkg/protobuf/protobuf'),
+ packageDirectory('tools/gardening'),
+ ];
+
+ var cfePackageDirs = [
+ packageDirectory('pkg/front_end/testcases/agnostic/'),
+ packageDirectory('pkg/front_end/testcases/general_nnbd_opt_out/'),
+ packageDirectory('pkg/front_end/testcases/late_lowering/'),
+ packageDirectory('pkg/front_end/testcases/nnbd/'),
+ ];
+
+ var packages = [
+ ...makePackageConfigs(packageDirs),
+ ...makeCfePackageConfigs(cfePackageDirs)
+ ];
+ packages.sort((a, b) => a["name"].compareTo(b["name"]));
+
+ var year = DateTime.now().year;
+ var config = <String, dynamic>{
+ 'copyright': [
+ 'Copyright (c) $year, 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.'
+ ],
+ 'comment': [
+ 'Package configuration for all packages in /pkg, and checked out by DEPS',
+ 'into /third_party/pkg and /third_party/pkg_tested.',
+ 'If you add a package to DEPS or /pkg or change a package\'s SDK',
+ 'constraint, update this by running tools/generate_package_config.dart.'
+ ],
+ 'configVersion': 2,
+ 'generated': DateTime.now().toIso8601String(),
+ 'generator': 'tools/generate_package_config.dart',
+ 'packages': packages,
+ };
+
+ // TODO(rnystrom): Consider using package_config_v2 to generate this instead.
+ var json = JsonEncoder.withIndent(' ').convert(config);
+ File(p.join(repoRoot, '.dart_tool', 'package_config.json'))
+ .writeAsStringSync(json);
+ print('Generated .dart_tool/package_config.dart containing '
+ '${packages.length} packages.');
+}
+
+/// Generates package configurations for each package in [packageDirs].
+Iterable<Map<String, String>> makePackageConfigs(
+ List<String> packageDirs) sync* {
+ for (var packageDir in packageDirs) {
+ var version = pubspecLanguageVersion(packageDir);
+ if (version == null) {
+ print('Warning: Unknown language version for ${p.basename(packageDir)}.');
+ version = defaultVersion;
+ }
+
+ var hasLibDirectory = Directory(p.join(packageDir, 'lib')).existsSync();
+
+ yield {
+ 'name': p.basename(packageDir),
+ 'rootUri': p.relative(packageDir, from: p.dirname(configFilePath)),
+ if (hasLibDirectory) 'packageUri': 'lib/',
+ 'languageVersion': '${version.major}.${version.minor}'
+ };
+ }
+}
+
+/// Generates package configurations for the special pseudo-packages used by
+/// the CFE unit tests (`pkg/front_end/test/unit_test_suites.dart`).
+Iterable<Map<String, String>> makeCfePackageConfigs(
+ List<String> packageDirs) sync* {
+ for (var packageDir in packageDirs) {
+ yield {
+ 'name': 'front_end_${p.basename(packageDir)}',
+ 'rootUri': p.relative(packageDir, from: p.dirname(configFilePath)),
+ 'packageUri': '.nonexisting/',
+ };
+ }
+}
+
+/// Generates a path to [relativePath] within the repo.
+String packageDirectory(String relativePath) => p.join(repoRoot, relativePath);
+
+/// Finds the paths of the immediate subdirectories of [packagesDir] that
+/// contain pubspecs.
+Iterable<String> listSubdirectories(String packagesDir) sync* {
+ for (var entry in Directory(p.join(repoRoot, packagesDir)).listSync()) {
+ if (entry is! Directory) continue;
+ if (!File(p.join(entry.path, 'pubspec.yaml')).existsSync()) continue;
+ yield entry.path;
+ }
+}
+
+/// Infers the language version from the SDK constraint in the pubspec for
+/// [packageDir].
+///
+/// Returns `null` if there is no pubspec or no SDK constraint.
+Version pubspecLanguageVersion(String packageDir) {
+ var pubspecFile = File(p.join(packageDir, 'pubspec.yaml'));
+
+ if (!pubspecFile.existsSync()) return null;
+
+ var pubspec =
+ loadYaml(pubspecFile.readAsStringSync()) as Map<dynamic, dynamic>;
+ if (!pubspec.containsKey('environment')) return null;
+
+ var environment = pubspec['environment'] as Map<dynamic, dynamic>;
+ if (!environment.containsKey('sdk')) return null;
+
+ var sdkConstraint = VersionConstraint.parse(environment['sdk'] as String);
+ if (sdkConstraint is VersionRange) return sdkConstraint.min;
+
+ return null;
+}
diff --git a/tools/migration/bin/migrate.dart b/tools/migration/bin/migrate.dart
index 211e64c..d327040 100644
--- a/tools/migration/bin/migrate.dart
+++ b/tools/migration/bin/migrate.dart
@@ -85,9 +85,9 @@
_showNextStep("Then use analyzer to migrate the files", "analyze", testDir);
}
-void _analyzeFiles(String testDir) {
+Future _analyzeFiles(String testDir) async {
var toDir = p.join(testRoot, toNnbdPath(testDir));
- if (analyzeTests(toDir)) {
+ if (await analyzeTests(toDir)) {
print(
"Next, commit the changed files and upload a new patchset with them:");
print(bold(" git add ."));
diff --git a/tools/migration/lib/src/analyze.dart b/tools/migration/lib/src/analyze.dart
index 80a124b..0a34076 100644
--- a/tools/migration/lib/src/analyze.dart
+++ b/tools/migration/lib/src/analyze.dart
@@ -8,7 +8,7 @@
import 'io.dart';
import 'log.dart';
-bool analyzeTests(String nnbdTestDir) {
+Future<bool> analyzeTests(String nnbdTestDir) async {
var files = <String, _FileInfo>{};
for (var entry in Directory(nnbdTestDir).listSync(recursive: true)) {
@@ -21,9 +21,18 @@
}
}
+ // Pre-existing multi-line errors will modify the character length in the
+ // errors reported by the analyzer. Strip all errors first before updating.
+ for (var file in files.values) {
+ if (!dryRun) _removeErrors(file.path);
+ }
+
// Analyze the directory both in legacy and NNBD modes.
- var legacyErrors = _runAnalyzer(nnbdTestDir, nnbd: false);
- var nnbdErrors = _runAnalyzer(nnbdTestDir, nnbd: true);
+ var legacyErrorsFuture = _runAnalyzer(nnbdTestDir, nnbd: false);
+ var nnbdErrorsFuture = _runAnalyzer(nnbdTestDir, nnbd: true);
+
+ var legacyErrors = await legacyErrorsFuture;
+ var nnbdErrors = await nnbdErrorsFuture;
legacyErrors.forEach((path, errors) {
// Sometimes the analysis reaches out to things like pkg/expect.
@@ -49,7 +58,9 @@
plural(int count, String name) => "$count $name${count == 1 ? '' : 's'}";
- for (var file in files.values) {
+ var fileNames = files.keys.toList()..sort();
+ for (var fileName in fileNames) {
+ var file = files[fileName];
if (!file.isTest) continue;
// Only insert errors that are not already present when the file is
@@ -65,7 +76,7 @@
errorFileCount++;
}
- if (!dryRun) _updateErrors(file.path, file.addedErrors);
+ if (!dryRun) _insertErrors(file.path, file.addedErrors);
}
if (errorCount == 0) {
@@ -79,10 +90,11 @@
return errorCount == 0;
}
-Map<String, List<_StaticError>> _runAnalyzer(String inputDir, {bool nnbd}) {
+Future<Map<String, List<_StaticError>>> _runAnalyzer(String inputDir,
+ {bool nnbd}) async {
print("Analyzing ${p.relative(inputDir, from: testRoot)}"
"${nnbd ? ' with NNBD' : ''}...");
- var result = Process.runSync("dartanalyzer", [
+ var result = await Process.run("dartanalyzer", [
"--packages=${p.join(sdkRoot, '.packages')}",
if (nnbd) ...[
"--dart-sdk=$nnbdSdkBuildDir",
@@ -106,9 +118,8 @@
return errorsByFile;
}
-/// Removes any previously inserted errors from the file at [path] and inserts
-/// any new errors in [errors].
-void _updateErrors(String path, List<_StaticError> errors) {
+/// Removes pre-existing errors in the file at [path].
+void _removeErrors(String path) {
// Sanity check.
if (!p.isWithin(testRoot, path)) {
throw ArgumentError("$path is outside of test directory.");
@@ -125,7 +136,26 @@
} else {
changed = true;
}
+ }
+ if (changed) {
+ writeFile(path, result.toString());
+ }
+}
+
+/// Inserts any new errors in [errors] into the file at [path].
+void _insertErrors(String path, List<_StaticError> errors) {
+ // Sanity check.
+ if (!p.isWithin(testRoot, path)) {
+ throw ArgumentError("$path is outside of test directory.");
+ }
+
+ var lines = readFileLines(path);
+ var result = StringBuffer();
+ var changed = false;
+
+ for (var i = 0; i < lines.length; i++) {
+ result.writeln(lines[i]);
// TODO(rnystrom): Inefficient.
for (var error in errors) {
if (error.line == i + 1) {
diff --git a/tools/migration/lib/src/io.dart b/tools/migration/lib/src/io.dart
index 1b5ee6b..638b27b5 100644
--- a/tools/migration/lib/src/io.dart
+++ b/tools/migration/lib/src/io.dart
@@ -83,7 +83,10 @@
return;
}
- File(p.join(testRoot, path)).writeAsStringSync(contents);
+ final oldContents = File(p.join(testRoot, path)).readAsStringSync();
+ if (oldContents != contents) {
+ File(p.join(testRoot, path)).writeAsStringSync(contents);
+ }
}
/// Whether the contents of the files at [aPath] and [bPath] are identical.
diff --git a/tools/patches/flutter-flutter/445a23a9bc14a57ea6275e5d4da179f7cb0bbdb6.patch b/tools/patches/flutter-flutter/445a23a9bc14a57ea6275e5d4da179f7cb0bbdb6.patch
deleted file mode 100644
index ec58158..0000000
--- a/tools/patches/flutter-flutter/445a23a9bc14a57ea6275e5d4da179f7cb0bbdb6.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart
-index 7d450be42..e158e33af 100644
---- a/packages/flutter_test/lib/src/binding.dart
-+++ b/packages/flutter_test/lib/src/binding.dart
-@@ -1763,9 +1763,10 @@ class _MockHttpResponse extends Stream<List<int>> implements HttpClientResponse
- @override
- int get contentLength => -1;
-
-- // @override
-- // TODO(tvolkert): Uncomment @override annotation once SDK change lands.
-- bool get autoUncompress => true;
-+ @override
-+ HttpClientResponseCompressionState get compressionState {
-+ return HttpClientResponseCompressionState.decompressed;
-+ }
-
- @override
- List<Cookie> get cookies => null;
-diff --git a/packages/flutter_tools/lib/src/base/io.dart b/packages/flutter_tools/lib/src/base/io.dart
-index 4c9d2250b..8b3535d54 100644
---- a/packages/flutter_tools/lib/src/base/io.dart
-+++ b/packages/flutter_tools/lib/src/base/io.dart
-@@ -47,6 +47,7 @@ export 'dart:io'
- HttpClient,
- HttpClientRequest,
- HttpClientResponse,
-+ HttpClientResponseCompressionState,
- HttpHeaders,
- HttpRequest,
- HttpServer,
-diff --git a/packages/flutter_tools/test/commands/create_test.dart b/packages/flutter_tools/test/commands/create_test.dart
-index b5453cbb1..f7cdf6164 100644
---- a/packages/flutter_tools/test/commands/create_test.dart
-+++ b/packages/flutter_tools/test/commands/create_test.dart
-@@ -1172,6 +1172,11 @@ class MockHttpClientResponse extends Stream<List<int>> implements HttpClientResp
- @override
- String get reasonPhrase => '<reason phrase>';
-
-+ @override
-+ HttpClientResponseCompressionState get compressionState {
-+ return HttpClientResponseCompressionState.decompressed;
-+ }
-+
- @override
- StreamSubscription<List<int>> listen(
- void onData(List<int> event), {
diff --git a/utils/compiler/BUILD.gn b/utils/compiler/BUILD.gn
index 03fe4df..9313f35 100644
--- a/utils/compiler/BUILD.gn
+++ b/utils/compiler/BUILD.gn
@@ -73,7 +73,6 @@
if (use_nnbd) {
training_args += [ "--enable-experiment=non-nullable" ]
}
-
training_args += [ rebase_path("$target_gen_dir/dart2js.dart") ]
}
diff --git a/utils/dartdev/BUILD.gn b/utils/dartdev/BUILD.gn
new file mode 100644
index 0000000..e41e7a4
--- /dev/null
+++ b/utils/dartdev/BUILD.gn
@@ -0,0 +1,18 @@
+# Copyright (c) 2020, 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")
+
+dartdev_files = exec_script("../../tools/list_dart_files.py",
+ [
+ "absolute",
+ rebase_path("../../pkg/dartdev"),
+ ],
+ "list lines")
+
+application_snapshot("dartdev") {
+ main_dart = "../../pkg/dartdev/bin/dartdev.dart"
+ training_args = [ "--help" ]
+ inputs = dartdev_files
+}
diff --git a/utils/pub/BUILD.gn b/utils/pub/BUILD.gn
index 6459f59..de93998 100644
--- a/utils/pub/BUILD.gn
+++ b/utils/pub/BUILD.gn
@@ -7,9 +7,5 @@
application_snapshot("pub") {
main_dart = "../../third_party/pkg/pub/bin/pub.dart"
- # TODO (40486) : Remove the trace option once this issue is fixed.
- training_args = [
- "--trace",
- "--help",
- ]
+ training_args = [ "--help" ]
}