Version 2.0.0-dev.53.0
Merge commit '16f6ce2fee29658425337f324522d1be14840412' into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9d3a3cd..1ef9bfb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,5 @@
+## 2.0.0-dev.53.0
+
## 2.0.0-dev.52.0
### Tool Changes
diff --git a/DEPS b/DEPS
index 15caef2..dc79768 100644
--- a/DEPS
+++ b/DEPS
@@ -35,39 +35,39 @@
"chromium_git": "https://chromium.googlesource.com",
"fuchsia_git": "https://fuchsia.googlesource.com",
- "co19_rev": "@d4b3fc9af414c990b4d22f313e533b275d2f27c5",
- "co19_2_rev": "@74562e984a81673b581e148b5802684d6df840d2",
+ "co19_rev": "d4b3fc9af414c990b4d22f313e533b275d2f27c5",
+ "co19_2_rev": "74562e984a81673b581e148b5802684d6df840d2",
# As Flutter does, we pull buildtools, including the clang toolchain, from
# Fuchsia. This revision should be kept up to date with the revision pulled
# by the Flutter engine. If there are problems with the toolchain, contact
# fuchsia-toolchain@.
- "buildtools_revision": "@446d5b1019dcbe7835236dc85261e91cf29a9239",
+ "buildtools_revision": "446d5b1019dcbe7835236dc85261e91cf29a9239",
# Scripts that make 'git cl format' work.
- "clang_format_scripts_rev": "@c09c8deeac31f05bd801995c475e7c8070f9ecda",
+ "clang_format_scripts_rev": "c09c8deeac31f05bd801995c475e7c8070f9ecda",
- "gperftools_revision": "@02eeed29df112728564a5dde6417fa4622b57a06",
+ "gperftools_revision": "02eeed29df112728564a5dde6417fa4622b57a06",
# Revisions of /third_party/* dependencies.
- "args_tag": "@1.4.1",
- "async_tag": "@2.0.6",
- "barback-0.13.0_rev": "@34853",
- "barback-0.14.0_rev": "@36398",
- "barback-0.14.1_rev": "@38525",
- "barback_tag" : "@0.15.2+14",
- "bazel_worker_tag": "@v0.1.9",
- "boolean_selector_tag" : "@1.0.3",
- "boringssl_gen_rev": "@344f455fd13d46f054726638e76026156ea73aa9",
- "boringssl_rev" : "@672f6fc2486745d0cabc3aaeb4e0a3cd13b37b12",
- "charcode_tag": "@v1.1.1",
- "chrome_rev" : "@19997",
- "cli_util_tag" : "@0.1.2+1",
- "collection_tag": "@1.14.6",
- "convert_tag": "@2.0.1",
- "crypto_tag" : "@2.0.2+1",
- "csslib_tag" : "@0.14.1",
- "dart2js_info_tag" : "@0.5.6+2",
+ "args_tag": "1.4.1",
+ "async_tag": "2.0.6",
+ "barback-0.13.0_rev": "34853",
+ "barback-0.14.0_rev": "36398",
+ "barback-0.14.1_rev": "38525",
+ "barback_tag" : "0.15.2+14",
+ "bazel_worker_tag": "v0.1.9",
+ "boolean_selector_tag" : "1.0.3",
+ "boringssl_gen_rev": "344f455fd13d46f054726638e76026156ea73aa9",
+ "boringssl_rev" : "672f6fc2486745d0cabc3aaeb4e0a3cd13b37b12",
+ "charcode_tag": "v1.1.1",
+ "chrome_rev" : "19997",
+ "cli_util_tag" : "0.1.2+1",
+ "collection_tag": "1.14.6",
+ "convert_tag": "2.0.1",
+ "crypto_tag" : "2.0.2+1",
+ "csslib_tag" : "0.14.1",
+ "dart2js_info_tag" : "0.5.6+2",
# Note: updates to dart_style have to be coordinated carefully with
# the infrastructure-team so that the internal formatter in
@@ -81,287 +81,284 @@
# minutes later.
#
# For more details, see https://github.com/dart-lang/sdk/issues/30164
- "dart_style_tag": "@1.0.12", # Please see the note above before updating.
+ "dart_style_tag": "1.0.12", # Please see the note above before updating.
- "dartdoc_tag" : "@v0.18.1",
- "fixnum_tag": "@0.10.5",
- "func_rev": "@25eec48146a58967d75330075ab376b3838b18a8",
- "glob_tag": "@1.1.5",
- "html_tag" : "@0.13.3",
- "http_io_tag": "@35dc43c9144cf7ed4236843dacd62ebaf89df21a",
- "http_multi_server_tag" : "@2.0.4",
- "http_parser_tag" : "@3.1.1",
- "http_retry_tag": "@0.1.1",
- "http_tag" : "@0.11.3+16",
- "http_throttle_tag" : "@1.0.1",
- "idl_parser_rev": "@5fb1ebf49d235b5a70c9f49047e83b0654031eb7",
- "intl_tag": "@0.15.2",
- "jinja2_rev": "@2222b31554f03e62600cd7e383376a7c187967a1",
- "json_rpc_2_tag": "@2.0.6",
- "linter_tag": "@0.1.49",
- "logging_tag": "@0.11.3+1",
- "markdown_tag": "@1.1.1",
- "matcher_tag": "@0.12.1+4",
- "mime_tag": "@0.9.6",
- "mockito_tag": "@a92db054fba18bc2d605be7670aee74b7cadc00a",
- "mustache4dart_tag" : "@v2.1.0",
- "oauth2_tag": "@1.1.0",
- "observatory_pub_packages_rev": "@d3a3aebefbd35aa30fe7bbc2889b772b398f7d7f",
- "package_config_tag": "@1.0.3",
- "package_resolver_tag": "@1.0.2+1",
- "path_tag": "@1.5.1",
- "plugin_tag": "@0.2.0+2",
- "ply_rev": "@604b32590ffad5cbb82e4afef1d305512d06ae93",
- "pool_tag": "@1.3.4",
- "protobuf_tag": "@0.7.1",
- "pub_rev": "@2e821bff00c00889afe5200e3a33f280ce942336",
- "pub_semver_tag": "@1.3.7",
- "quiver_tag": "@5aaa3f58c48608af5b027444d561270b53f15dbf",
- "resource_rev":"@af5a5bf65511943398146cf146e466e5f0b95cb9",
- "root_certificates_rev": "@16ef64be64c7dfdff2b9f4b910726e635ccc519e",
- "shelf_static_rev": "@v0.2.7",
- "shelf_packages_handler_tag": "@1.0.3",
- "shelf_tag": "@0.7.2",
- "shelf_web_socket_tag": "@0.2.2",
- "source_map_stack_trace_tag": "@1.1.4",
- "source_maps-0.9.4_rev": "@38524",
- "source_maps_tag": "@0.10.4",
- "source_span_tag": "@1.4.0",
- "stack_trace_tag": "@1.9.2",
- "stream_channel_tag": "@1.6.4",
- "string_scanner_tag": "@1.0.2",
- "sunflower_rev": "@879b704933413414679396b129f5dfa96f7a0b1e",
- "test_descriptor_tag": "@1.0.3",
- "test_process_tag": "@1.0.1",
- "term_glyph_tag": "@1.0.0",
- "test_reflective_loader_tag": "@0.1.4",
- "test_tag": "@0.12.30+1",
- "tuple_tag": "@v1.0.1",
- "typed_data_tag": "@1.1.3",
- "usage_tag": "@3.3.0",
- "utf_tag": "@0.9.0+4",
- "watcher_tag": "@0.9.7+7",
- "web_components_rev": "@8f57dac273412a7172c8ade6f361b407e2e4ed02",
- "web_socket_channel_tag": "@1.0.7",
- "WebCore_rev": "@fb11e887f77919450e497344da570d780e078bc8",
- "yaml_tag": "@2.1.13",
- "zlib_rev": "@c3d0a6190f2f8c924a05ab6cc97b8f975bddd33f",
+ "dartdoc_tag" : "v0.19.0",
+ "fixnum_tag": "0.10.5",
+ "func_rev": "25eec48146a58967d75330075ab376b3838b18a8",
+ "glob_tag": "1.1.5",
+ "html_tag" : "0.13.3",
+ "http_io_tag": "35dc43c9144cf7ed4236843dacd62ebaf89df21a",
+ "http_multi_server_tag" : "2.0.4",
+ "http_parser_tag" : "3.1.1",
+ "http_retry_tag": "0.1.1",
+ "http_tag" : "0.11.3+16",
+ "http_throttle_tag" : "1.0.1",
+ "idl_parser_rev": "5fb1ebf49d235b5a70c9f49047e83b0654031eb7",
+ "intl_tag": "0.15.2",
+ "jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
+ "json_rpc_2_tag": "2.0.6",
+ "linter_tag": "0.1.49",
+ "logging_tag": "0.11.3+1",
+ "markdown_tag": "1.1.1",
+ "matcher_tag": "0.12.1+4",
+ "mime_tag": "0.9.6",
+ "mockito_tag": "a92db054fba18bc2d605be7670aee74b7cadc00a",
+ "mustache4dart_tag" : "v2.1.1",
+ "oauth2_tag": "1.1.0",
+ "observatory_pub_packages_rev": "d3a3aebefbd35aa30fe7bbc2889b772b398f7d7f",
+ "package_config_tag": "1.0.3",
+ "package_resolver_tag": "1.0.2+1",
+ "path_tag": "1.5.1",
+ "plugin_tag": "0.2.0+2",
+ "ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
+ "pool_tag": "1.3.4",
+ "protobuf_tag": "0.7.1",
+ "pub_rev": "2e821bff00c00889afe5200e3a33f280ce942336",
+ "pub_semver_tag": "1.3.7",
+ "quiver_tag": "5aaa3f58c48608af5b027444d561270b53f15dbf",
+ "resource_rev":"af5a5bf65511943398146cf146e466e5f0b95cb9",
+ "root_certificates_rev": "16ef64be64c7dfdff2b9f4b910726e635ccc519e",
+ "shelf_static_rev": "v0.2.7",
+ "shelf_packages_handler_tag": "1.0.3",
+ "shelf_tag": "0.7.2",
+ "shelf_web_socket_tag": "0.2.2",
+ "source_map_stack_trace_tag": "1.1.4",
+ "source_maps-0.9.4_rev": "38524",
+ "source_maps_tag": "0.10.4",
+ "source_span_tag": "1.4.0",
+ "stack_trace_tag": "1.9.2",
+ "stream_channel_tag": "1.6.4",
+ "string_scanner_tag": "1.0.2",
+ "sunflower_rev": "879b704933413414679396b129f5dfa96f7a0b1e",
+ "test_descriptor_tag": "1.0.3",
+ "test_process_tag": "1.0.1",
+ "term_glyph_tag": "1.0.0",
+ "test_reflective_loader_tag": "0.1.4",
+ "test_tag": "0.12.30+1",
+ "tuple_tag": "v1.0.1",
+ "typed_data_tag": "1.1.3",
+ "usage_tag": "3.3.0",
+ "utf_tag": "0.9.0+4",
+ "watcher_tag": "0.9.7+7",
+ "web_components_rev": "8f57dac273412a7172c8ade6f361b407e2e4ed02",
+ "web_socket_channel_tag": "1.0.7",
+ "WebCore_rev": "fb11e887f77919450e497344da570d780e078bc8",
+ "yaml_tag": "2.1.13",
+ "zlib_rev": "c3d0a6190f2f8c924a05ab6cc97b8f975bddd33f",
}
deps = {
# Stuff needed for GN build.
Var("dart_root") + "/buildtools":
- Var("fuchsia_git") + "/buildtools" + Var("buildtools_revision"),
+ Var("fuchsia_git") + "/buildtools" + "@" + Var("buildtools_revision"),
Var("dart_root") + "/buildtools/clang_format/script":
Var("chromium_git") + "/chromium/llvm-project/cfe/tools/clang-format.git" +
- Var("clang_format_scripts_rev"),
+ "@" + Var("clang_format_scripts_rev"),
Var("dart_root") + "/tests/co19/src":
- Var("dart_git") + "co19.git" + Var("co19_rev"),
+ Var("dart_git") + "co19.git" + "@" + Var("co19_rev"),
Var("dart_root") + "/tests/co19_2/src":
Var("chromium_git") + "/external/github.com/dart-lang/co19.git" +
- Var("co19_2_rev"),
+ "@" + Var("co19_2_rev"),
Var("dart_root") + "/third_party/zlib":
Var("chromium_git") + "/chromium/src/third_party/zlib.git" +
- Var("zlib_rev"),
+ "@" + Var("zlib_rev"),
Var("dart_root") + "/third_party/boringssl":
- Var("dart_git") + "boringssl_gen.git" + Var("boringssl_gen_rev"),
+ Var("dart_git") + "boringssl_gen.git" + "@" + Var("boringssl_gen_rev"),
Var("dart_root") + "/third_party/boringssl/src":
"https://boringssl.googlesource.com/boringssl.git" +
- Var("boringssl_rev"),
+ "@" + Var("boringssl_rev"),
Var("dart_root") + "/third_party/root_certificates":
Var("dart_git") + "root_certificates.git" +
- Var("root_certificates_rev"),
+ "@" + Var("root_certificates_rev"),
Var("dart_root") + "/third_party/jinja2":
Var("chromium_git") + "/chromium/src/third_party/jinja2.git" +
- Var("jinja2_rev"),
+ "@" + Var("jinja2_rev"),
Var("dart_root") + "/third_party/ply":
Var("chromium_git") + "/chromium/src/third_party/ply.git" +
- Var("ply_rev"),
+ "@" + Var("ply_rev"),
Var("dart_root") + "/tools/idl_parser":
Var("chromium_git") + "/chromium/src/tools/idl_parser.git" +
- Var("idl_parser_rev"),
+ "@" + Var("idl_parser_rev"),
Var("dart_root") + "/third_party/WebCore":
- Var("dart_git") + "webcore.git" + Var("WebCore_rev"),
+ Var("dart_git") + "webcore.git" + "@" + Var("WebCore_rev"),
Var("dart_root") + "/third_party/tcmalloc/gperftools":
Var('chromium_git') + '/external/github.com/gperftools/gperftools.git' +
- Var("gperftools_revision"),
+ "@" + Var("gperftools_revision"),
Var("dart_root") + "/third_party/pkg/args":
- Var("dart_git") + "args.git" + Var("args_tag"),
+ Var("dart_git") + "args.git" + "@" + Var("args_tag"),
Var("dart_root") + "/third_party/pkg/async":
- Var("dart_git") + "async.git" + Var("async_tag"),
+ Var("dart_git") + "async.git" + "@" + Var("async_tag"),
Var("dart_root") + "/third_party/pkg/barback":
- Var("dart_git") + "barback.git" + Var("barback_tag"),
+ Var("dart_git") + "barback.git" + "@" + Var("barback_tag"),
Var("dart_root") + "/third_party/pkg/bazel_worker":
- Var("dart_git") + "bazel_worker.git" + Var("bazel_worker_tag"),
+ Var("dart_git") + "bazel_worker.git" + "@" + Var("bazel_worker_tag"),
Var("dart_root") + "/third_party/pkg/boolean_selector":
Var("dart_git") + "boolean_selector.git" +
- Var("boolean_selector_tag"),
+ "@" + Var("boolean_selector_tag"),
Var("dart_root") + "/third_party/pkg/charcode":
- Var("dart_git") + "charcode.git" + Var("charcode_tag"),
+ Var("dart_git") + "charcode.git" + "@" + Var("charcode_tag"),
Var("dart_root") + "/third_party/pkg/cli_util":
- Var("dart_git") + "cli_util.git" + Var("cli_util_tag"),
+ Var("dart_git") + "cli_util.git" + "@" + Var("cli_util_tag"),
Var("dart_root") + "/third_party/pkg/collection":
- Var("dart_git") + "collection.git" + Var("collection_tag"),
+ Var("dart_git") + "collection.git" + "@" + Var("collection_tag"),
Var("dart_root") + "/third_party/pkg/convert":
- Var("dart_git") + "convert.git" + Var("convert_tag"),
+ Var("dart_git") + "convert.git" + "@" + Var("convert_tag"),
Var("dart_root") + "/third_party/pkg/crypto":
- Var("dart_git") + "crypto.git" + Var("crypto_tag"),
+ Var("dart_git") + "crypto.git" + "@" + Var("crypto_tag"),
Var("dart_root") + "/third_party/pkg/csslib":
- Var("dart_git") + "csslib.git" + Var("csslib_tag"),
+ Var("dart_git") + "csslib.git" + "@" + Var("csslib_tag"),
Var("dart_root") + "/third_party/pkg_tested/dart_style":
- Var("dart_git") + "dart_style.git" + Var("dart_style_tag"),
+ Var("dart_git") + "dart_style.git" + "@" + Var("dart_style_tag"),
Var("dart_root") + "/third_party/pkg/dart2js_info":
- Var("dart_git") + "dart2js_info.git" + Var("dart2js_info_tag"),
+ Var("dart_git") + "dart2js_info.git" + "@" + Var("dart2js_info_tag"),
Var("dart_root") + "/third_party/pkg/dartdoc":
- Var("dart_git") + "dartdoc.git" + Var("dartdoc_tag"),
+ Var("dart_git") + "dartdoc.git" + "@" + Var("dartdoc_tag"),
Var("dart_root") + "/third_party/pkg/fixnum":
- Var("dart_git") + "fixnum.git" + Var("fixnum_tag"),
+ Var("dart_git") + "fixnum.git" + "@" + Var("fixnum_tag"),
Var("dart_root") + "/third_party/pkg/func":
- Var("dart_git") + "func.git" + Var("func_rev"),
+ Var("dart_git") + "func.git" + "@" + Var("func_rev"),
Var("dart_root") + "/third_party/pkg/glob":
- Var("dart_git") + "glob.git" + Var("glob_tag"),
+ Var("dart_git") + "glob.git" + "@" + Var("glob_tag"),
Var("dart_root") + "/third_party/pkg/html":
- Var("dart_git") + "html.git" + Var("html_tag"),
+ Var("dart_git") + "html.git" + "@" + Var("html_tag"),
Var("dart_root") + "/third_party/pkg/http":
- Var("dart_git") + "http.git" + Var("http_tag"),
+ Var("dart_git") + "http.git" + "@" + Var("http_tag"),
Var("dart_root") + "/third_party/pkg_tested/http_io":
- Var("dart_git") + "http_io.git" + Var("http_io_tag"),
+ Var("dart_git") + "http_io.git" + "@" + Var("http_io_tag"),
Var("dart_root") + "/third_party/pkg/http_multi_server":
Var("dart_git") + "http_multi_server.git" +
- Var("http_multi_server_tag"),
+ "@" + Var("http_multi_server_tag"),
Var("dart_root") + "/third_party/pkg/http_parser":
- Var("dart_git") + "http_parser.git" + Var("http_parser_tag"),
+ Var("dart_git") + "http_parser.git" + "@" + Var("http_parser_tag"),
Var("dart_root") + "/third_party/pkg/http_retry":
Var("dart_git") + "http_retry.git" +
- Var("http_retry_tag"),
+ "@" + Var("http_retry_tag"),
Var("dart_root") + "/third_party/pkg/http_throttle":
Var("dart_git") + "http_throttle.git" +
- Var("http_throttle_tag"),
+ "@" + Var("http_throttle_tag"),
Var("dart_root") + "/third_party/pkg/intl":
- Var("dart_git") + "intl.git" + Var("intl_tag"),
+ Var("dart_git") + "intl.git" + "@" + Var("intl_tag"),
Var("dart_root") + "/third_party/pkg/json_rpc_2":
- Var("dart_git") + "json_rpc_2.git" + Var("json_rpc_2_tag"),
+ Var("dart_git") + "json_rpc_2.git" + "@" + Var("json_rpc_2_tag"),
Var("dart_root") + "/third_party/pkg/linter":
- Var("dart_git") + "linter.git" + Var("linter_tag"),
+ Var("dart_git") + "linter.git" + "@" + Var("linter_tag"),
Var("dart_root") + "/third_party/pkg/logging":
- Var("dart_git") + "logging.git" + Var("logging_tag"),
+ Var("dart_git") + "logging.git" + "@" + Var("logging_tag"),
Var("dart_root") + "/third_party/pkg/markdown":
- Var("dart_git") + "markdown.git" + Var("markdown_tag"),
+ Var("dart_git") + "markdown.git" + "@" + Var("markdown_tag"),
Var("dart_root") + "/third_party/pkg/matcher":
- Var("dart_git") + "matcher.git" + Var("matcher_tag"),
+ Var("dart_git") + "matcher.git" + "@" + Var("matcher_tag"),
Var("dart_root") + "/third_party/pkg/mime":
- Var("dart_git") + "mime.git" + Var("mime_tag"),
+ Var("dart_git") + "mime.git" + "@" + Var("mime_tag"),
Var("dart_root") + "/third_party/pkg/mockito":
- Var("dart_git") + "mockito.git" + Var("mockito_tag"),
+ Var("dart_git") + "mockito.git" + "@" + Var("mockito_tag"),
Var("dart_root") + "/third_party/pkg/mustache4dart":
Var("chromium_git")
+ "/external/github.com/valotas/mustache4dart.git"
- + Var("mustache4dart_tag"),
+ + "@" + Var("mustache4dart_tag"),
Var("dart_root") + "/third_party/pkg/oauth2":
- Var("dart_git") + "oauth2.git" + Var("oauth2_tag"),
+ Var("dart_git") + "oauth2.git" + "@" + Var("oauth2_tag"),
Var("dart_root") + "/third_party/observatory_pub_packages":
Var("dart_git") + "observatory_pub_packages.git"
- + Var("observatory_pub_packages_rev"),
+ + "@" + Var("observatory_pub_packages_rev"),
Var("dart_root") + "/third_party/pkg_tested/package_config":
Var("dart_git") + "package_config.git" +
- Var("package_config_tag"),
+ "@" + Var("package_config_tag"),
Var("dart_root") + "/third_party/pkg_tested/package_resolver":
Var("dart_git") + "package_resolver.git"
- + Var("package_resolver_tag"),
+ + "@" + Var("package_resolver_tag"),
Var("dart_root") + "/third_party/pkg/path":
- Var("dart_git") + "path.git" + Var("path_tag"),
+ Var("dart_git") + "path.git" + "@" + Var("path_tag"),
Var("dart_root") + "/third_party/pkg/plugin":
- Var("dart_git") + "plugin.git" + Var("plugin_tag"),
+ Var("dart_git") + "plugin.git" + "@" + Var("plugin_tag"),
Var("dart_root") + "/third_party/pkg/pool":
- Var("dart_git") + "pool.git" + Var("pool_tag"),
+ Var("dart_git") + "pool.git" + "@" + Var("pool_tag"),
Var("dart_root") + "/third_party/pkg/protobuf":
- Var("dart_git") + "protobuf.git" + Var("protobuf_tag"),
+ Var("dart_git") + "protobuf.git" + "@" + Var("protobuf_tag"),
Var("dart_root") + "/third_party/pkg/pub_semver":
- Var("dart_git") + "pub_semver.git" + Var("pub_semver_tag"),
+ Var("dart_git") + "pub_semver.git" + "@" + Var("pub_semver_tag"),
Var("dart_root") + "/third_party/pkg/pub":
- Var("dart_git") + "pub.git" + Var("pub_rev"),
+ Var("dart_git") + "pub.git" + "@" + Var("pub_rev"),
Var("dart_root") + "/third_party/pkg/quiver":
Var("chromium_git")
+ "/external/github.com/google/quiver-dart.git"
- + Var("quiver_tag"),
+ + "@" + Var("quiver_tag"),
Var("dart_root") + "/third_party/pkg/resource":
- Var("dart_git") + "resource.git" + Var("resource_rev"),
+ Var("dart_git") + "resource.git" + "@" + Var("resource_rev"),
Var("dart_root") + "/third_party/pkg/shelf":
- Var("dart_git") + "shelf.git" + Var("shelf_tag"),
+ Var("dart_git") + "shelf.git" + "@" + Var("shelf_tag"),
Var("dart_root") + "/third_party/pkg/shelf_packages_handler":
Var("dart_git") + "shelf_packages_handler.git"
- + Var("shelf_packages_handler_tag"),
+ + "@" + Var("shelf_packages_handler_tag"),
Var("dart_root") + "/third_party/pkg/shelf_static":
- Var("dart_git") + "shelf_static.git" + Var("shelf_static_rev"),
+ Var("dart_git") + "shelf_static.git" + "@" + Var("shelf_static_rev"),
Var("dart_root") + "/third_party/pkg/shelf_web_socket":
Var("dart_git") + "shelf_web_socket.git" +
- Var("shelf_web_socket_tag"),
+ "@" + Var("shelf_web_socket_tag"),
Var("dart_root") + "/third_party/pkg/source_maps":
- Var("dart_git") + "source_maps.git" + Var("source_maps_tag"),
+ Var("dart_git") + "source_maps.git" + "@" + Var("source_maps_tag"),
Var("dart_root") + "/third_party/pkg/source_span":
- Var("dart_git") + "source_span.git" + Var("source_span_tag"),
+ Var("dart_git") + "source_span.git" + "@" + Var("source_span_tag"),
Var("dart_root") + "/third_party/pkg/source_map_stack_trace":
Var("dart_git") + "source_map_stack_trace.git" +
- Var("source_map_stack_trace_tag"),
+ "@" + Var("source_map_stack_trace_tag"),
Var("dart_root") + "/third_party/pkg/stack_trace":
- Var("dart_git") + "stack_trace.git" + Var("stack_trace_tag"),
+ Var("dart_git") + "stack_trace.git" + "@" + Var("stack_trace_tag"),
Var("dart_root") + "/third_party/pkg/stream_channel":
Var("dart_git") + "stream_channel.git" +
- Var("stream_channel_tag"),
+ "@" + Var("stream_channel_tag"),
Var("dart_root") + "/third_party/pkg/string_scanner":
Var("dart_git") + "string_scanner.git" +
- Var("string_scanner_tag"),
+ "@" + Var("string_scanner_tag"),
Var("dart_root") + "/third_party/sunflower":
Var("chromium_git") +
"/external/github.com/dart-lang/sample-sunflower.git" +
- Var("sunflower_rev"),
+ "@" + Var("sunflower_rev"),
Var("dart_root") + "/third_party/pkg/term_glyph":
- Var("dart_git") + "term_glyph.git" + Var("term_glyph_tag"),
+ Var("dart_git") + "term_glyph.git" + "@" + Var("term_glyph_tag"),
Var("dart_root") + "/third_party/pkg/test":
- Var("dart_git") + "test.git" + Var("test_tag"),
+ Var("dart_git") + "test.git" + "@" + Var("test_tag"),
Var("dart_root") + "/third_party/pkg/test_descriptor":
- Var("dart_git") + "test_descriptor.git" + Var("test_descriptor_tag"),
+ Var("dart_git") + "test_descriptor.git" + "@" + Var("test_descriptor_tag"),
Var("dart_root") + "/third_party/pkg/test_process":
- Var("dart_git") + "test_process.git" + Var("test_process_tag"),
+ Var("dart_git") + "test_process.git" + "@" + Var("test_process_tag"),
Var("dart_root") + "/third_party/pkg/test_reflective_loader":
Var("dart_git") + "test_reflective_loader.git" +
- Var("test_reflective_loader_tag"),
+ "@" + Var("test_reflective_loader_tag"),
Var("dart_root") + "/third_party/pkg/tuple":
- Var("dart_git") + "tuple.git" + Var("tuple_tag"),
+ Var("dart_git") + "tuple.git" + "@" + Var("tuple_tag"),
Var("dart_root") + "/third_party/pkg/typed_data":
- Var("dart_git") + "typed_data.git" + Var("typed_data_tag"),
+ Var("dart_git") + "typed_data.git" + "@" + Var("typed_data_tag"),
Var("dart_root") + "/third_party/pkg/usage":
- Var("dart_git") + "usage.git" + Var("usage_tag"),
+ Var("dart_git") + "usage.git" + "@" + Var("usage_tag"),
Var("dart_root") + "/third_party/pkg/utf":
- Var("dart_git") + "utf.git" + Var("utf_tag"),
+ Var("dart_git") + "utf.git" + "@" + Var("utf_tag"),
Var("dart_root") + "/third_party/pkg/watcher":
- Var("dart_git") + "watcher.git" + Var("watcher_tag"),
+ Var("dart_git") + "watcher.git" + "@" + Var("watcher_tag"),
Var("dart_root") + "/third_party/pkg/web_components":
Var("dart_git") + "web-components.git" +
- Var("web_components_rev"),
+ "@" + Var("web_components_rev"),
Var("dart_root") + "/third_party/pkg/web_socket_channel":
Var("dart_git") + "web_socket_channel.git" +
- Var("web_socket_channel_tag"),
+ "@" + Var("web_socket_channel_tag"),
Var("dart_root") + "/third_party/pkg/yaml":
- Var("dart_git") + "yaml.git" + Var("yaml_tag"),
-}
-
-deps_os = {
- "win": {
- Var("dart_root") + "/third_party/cygwin":
- Var("chromium_git") + "/chromium/deps/cygwin.git" +
- "@c89e446b273697fadf3a10ff1007a97c0b7de6df",
+ Var("dart_git") + "yaml.git" + "@" + Var("yaml_tag"),
+ Var("dart_root") + "/third_party/cygwin": {
+ "url": Var("chromium_git") + "/chromium/deps/cygwin.git" + "@" +
+ "c89e446b273697fadf3a10ff1007a97c0b7de6df",
+ "condition": "checkout_win",
},
}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 002314b..4d83619 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -190,7 +190,7 @@
windows = utils.GuessOS() == 'win32'
if windows:
- dart += '.bat'
+ dart += '.exe'
if not os.path.isfile(dart):
print('WARNING: dart not found: %s' % dart)
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 8085a6b..f8b1648 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -95,7 +95,7 @@
/**
* The version of data format, should be incremented on every format change.
*/
- static const int DATA_VERSION = 57;
+ static const int DATA_VERSION = 58;
/**
* The number of exception contexts allowed to write. Once this field is
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index b82ab39..d775100 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -403,12 +403,10 @@
* Return `true` if the API signature changed since the last refresh.
*/
bool refresh({bool allowCached: false}) {
- List<int> contentBytes;
{
var rawFileState = _fsState._fileContentCache.get(path, allowCached);
_content = rawFileState.content;
_exists = rawFileState.exists;
- contentBytes = rawFileState.contentBytes;
_contentHash = rawFileState.contentHash;
}
@@ -416,7 +414,6 @@
{
ApiSignature signature = new ApiSignature();
signature.addUint32List(_fsState._salt);
- signature.addInt(contentBytes.length);
signature.addString(_contentHash);
_unlinkedKey = '${signature.toHex()}.unlinked';
}
@@ -974,11 +971,9 @@
final String path;
final bool exists;
final String content;
- final List<int> contentBytes;
final String contentHash;
- _FileContent(this.path, this.exists, this.content, this.contentBytes,
- this.contentHash);
+ _FileContent(this.path, this.exists, this.content, this.contentHash);
}
/**
@@ -1024,7 +1019,7 @@
List<int> contentHashBytes = md5.convert(contentBytes).bytes;
String contentHash = hex.encode(contentHashBytes);
- file = new _FileContent(path, exists, content, contentBytes, contentHash);
+ file = new _FileContent(path, exists, content, contentHash);
_pathToFile[path] = file;
}
return file;
diff --git a/pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart b/pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart
index ba03cb8..5778af8 100644
--- a/pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart
+++ b/pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart
@@ -277,9 +277,11 @@
if (json is int) {
return json;
} else if (json is String) {
- return int.parse(json, onError: (String value) {
+ int value = int.tryParse(json);
+ if (value == null) {
throw mismatch(jsonPath, 'int', json);
- });
+ }
+ return value;
}
throw mismatch(jsonPath, 'int', json);
}
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index de73841..e08a1d1 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -440,13 +440,19 @@
helpAndFail('Extra arguments: ${extra.join(" ")}');
}
+ if (checkedMode && strongMode) {
+ checkedMode = false;
+ hints.add("Option '${Flags.enableCheckedMode}' is not needed in strong "
+ "mode.");
+ }
+
if (trustTypeAnnotations) {
if (checkedMode) {
helpAndFail("Option '${Flags.trustTypeAnnotations}' may not be used in "
"checked mode.");
} else if (strongMode) {
- hints.add("Option '--trust-type-annotations' is not available "
- "in strong mode. Try usign '--omit-implicit-checks' instead.");
+ hints.add("Option '${Flags.trustTypeAnnotations}' is not available "
+ "in strong mode. Try using '${Flags.omitImplicitChecks}' instead.");
}
}
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index e97726c..165643c 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -8,6 +8,7 @@
show ChunkedConversionSink, JsonEncoder, StringConversionSink;
import 'package:dart2js_info/info.dart';
+import 'package:path/path.dart' as p;
import '../compiler_new.dart';
import 'common/names.dart';
@@ -77,7 +78,17 @@
libname = '<unnamed>';
}
int size = compiler.dumpInfoTask.sizeOf(lib);
- LibraryInfo info = new LibraryInfo(libname, lib.canonicalUri, null, size);
+
+ var uri = lib.canonicalUri;
+ if (Uri.base.isScheme('file') && lib.canonicalUri.isScheme('file')) {
+ var basePath = p.fromUri(Uri.base);
+ var libPath = p.fromUri(lib.canonicalUri);
+ if (p.isWithin(basePath, libPath)) {
+ uri = p.toUri(p.relative(libPath, from: basePath));
+ }
+ }
+
+ LibraryInfo info = new LibraryInfo(libname, uri, null, size);
_entityToInfo[lib] = info;
environment.forEachLibraryMember(lib, (MemberEntity member) {
@@ -127,8 +138,12 @@
GlobalTypeInferenceElementResult _resultOfParameter(Local e) =>
compiler.globalInference.results.resultOfParameter(e);
- FieldInfo visitField(FieldEntity field) {
- if (!_hasBeenResolved(field)) {
+ FieldInfo visitField(FieldEntity field, {ClassEntity containingClass}) {
+ var isInInstantiatedClass = false;
+ if (containingClass != null) {
+ isInInstantiatedClass = closedWorld.isInstantiated(containingClass);
+ }
+ if (!isInInstantiatedClass && !_hasBeenResolved(field)) {
return null;
}
TypeMask inferredType = _resultOfMember(field).type;
@@ -137,6 +152,8 @@
int size = compiler.dumpInfoTask.sizeOf(field);
String code = compiler.dumpInfoTask.codeOf(field);
+
+ // TODO(het): Why doesn't `size` account for the code size already?
if (code != null) size += code.length;
FieldInfo info = new FieldInfo(
@@ -193,7 +210,7 @@
}
}
} else if (member.isField) {
- FieldInfo fieldInfo = visitField(member);
+ FieldInfo fieldInfo = visitField(member, containingClass: clazz);
if (fieldInfo != null) {
classInfo.fields.add(fieldInfo);
fieldInfo.parent = classInfo;
diff --git a/pkg/compiler/lib/src/elements/resolution_types.dart b/pkg/compiler/lib/src/elements/resolution_types.dart
index 4b80a11..3c0949f 100644
--- a/pkg/compiler/lib/src/elements/resolution_types.dart
+++ b/pkg/compiler/lib/src/elements/resolution_types.dart
@@ -1117,7 +1117,7 @@
* substitute for the bound of [typeVariable]. [bound] holds the bound against
* which [typeArgument] should be checked.
*/
-typedef void CheckTypeVariableBound(GenericType type, DartType typeArgument,
+typedef void CheckTypeVariableBound<T>(T context, DartType typeArgument,
TypeVariableType typeVariable, DartType bound);
class Types extends DartTypes {
@@ -1248,14 +1248,16 @@
}
@override
- void checkTypeVariableBounds(
- covariant ResolutionInterfaceType type,
- void checkTypeVariableBound(InterfaceType type, DartType typeArgument,
+ void checkTypeVariableBounds<T>(
+ T context,
+ List<DartType> typeArguments,
+ List<DartType> typeVariables,
+ void checkTypeVariableBound(T context, DartType typeArgument,
TypeVariableType typeVariable, DartType bound)) {
- void f(DartType type, DartType typeArgument, TypeVariableType typeVariable,
+ void f(T context, DartType typeArgument, TypeVariableType typeVariable,
DartType bound) =>
- checkTypeVariableBound(type, typeArgument, typeVariable, bound);
- genericCheckTypeVariableBounds(type, f);
+ checkTypeVariableBound(context, typeArgument, typeVariable, bound);
+ genericCheckTypeVariableBounds(context, typeArguments, typeVariables, f);
}
/**
@@ -1263,18 +1265,18 @@
* declared on [element]. Calls [checkTypeVariableBound] on each type
* argument and bound.
*/
- void genericCheckTypeVariableBounds(
- GenericType type, CheckTypeVariableBound checkTypeVariableBound) {
- TypeDeclarationElement element = type.element;
- List<ResolutionDartType> typeArguments = type.typeArguments;
- List<ResolutionDartType> typeVariables = element.typeVariables;
+ void genericCheckTypeVariableBounds<T>(
+ T context,
+ List<DartType> typeArguments,
+ List<DartType> typeVariables,
+ CheckTypeVariableBound<T> checkTypeVariableBound) {
assert(typeVariables.length == typeArguments.length);
for (int index = 0; index < typeArguments.length; index++) {
ResolutionTypeVariableType typeVariable = typeVariables[index];
ResolutionDartType bound =
- typeVariable.element.bound.substByContext(type);
+ typeVariable.element.bound.subst(typeArguments, typeVariables);
ResolutionDartType typeArgument = typeArguments[index];
- checkTypeVariableBound(type, typeArgument, typeVariable, bound);
+ checkTypeVariableBound(context, typeArgument, typeVariable, bound);
}
}
diff --git a/pkg/compiler/lib/src/elements/types.dart b/pkg/compiler/lib/src/elements/types.dart
index b60700f..20264b1 100644
--- a/pkg/compiler/lib/src/elements/types.dart
+++ b/pkg/compiler/lib/src/elements/types.dart
@@ -1408,9 +1408,11 @@
/// Checks the type arguments of [type] against the type variable bounds
/// declared on `type.element`. Calls [checkTypeVariableBound] on each type
/// argument and bound.
- void checkTypeVariableBounds(
- InterfaceType type,
- void checkTypeVariableBound(InterfaceType type, DartType typeArgument,
+ void checkTypeVariableBounds<T>(
+ T context,
+ List<DartType> typeArguments,
+ List<DartType> typeVariables,
+ void checkTypeVariableBound(T context, DartType typeArgument,
TypeVariableType typeVariable, DartType bound));
/// Returns the [ClassEntity] which declares the type variables occurring in
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index 5b6488d..ab2f509 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -19,6 +19,7 @@
import '../js/js.dart' as jsAst;
import '../js/js.dart' show js;
import '../js_emitter/js_emitter.dart' show Emitter;
+import '../options.dart';
import '../universe/selector.dart';
import '../universe/world_builder.dart';
import '../world.dart' show ClosedWorld;
@@ -139,8 +140,9 @@
/// Computes the [RuntimeTypesNeed] for the data registered with this builder.
RuntimeTypesNeed computeRuntimeTypesNeed(
- ResolutionWorldBuilder resolutionWorldBuilder, ClosedWorld closedWorld,
- {bool enableTypeAssertions, bool strongMode});
+ ResolutionWorldBuilder resolutionWorldBuilder,
+ ClosedWorld closedWorld,
+ CompilerOptions options);
}
class TrivialRuntimeTypesNeedBuilder implements RuntimeTypesNeedBuilder {
@@ -157,8 +159,9 @@
@override
RuntimeTypesNeed computeRuntimeTypesNeed(
- ResolutionWorldBuilder resolutionWorldBuilder, ClosedWorld closedWorld,
- {bool enableTypeAssertions, bool strongMode}) {
+ ResolutionWorldBuilder resolutionWorldBuilder,
+ ClosedWorld closedWorld,
+ CompilerOptions options) {
return const TrivialRuntimeTypesNeed();
}
}
@@ -200,8 +203,7 @@
/// Computes the [RuntimeTypesChecks] for the data in this builder.
RuntimeTypesChecks computeRequiredChecks(
- CodegenWorldBuilder codegenWorldBuilder,
- {bool strongMode});
+ CodegenWorldBuilder codegenWorldBuilder, CompilerOptions options);
bool get rtiChecksBuilderClosed;
}
@@ -221,8 +223,7 @@
@override
RuntimeTypesChecks computeRequiredChecks(
- CodegenWorldBuilder codegenWorldBuilder,
- {bool strongMode}) {
+ CodegenWorldBuilder codegenWorldBuilder, CompilerOptions options) {
rtiChecksBuilderClosed = true;
Map<ClassEntity, ClassUse> classUseMap = <ClassEntity, ClassUse>{};
@@ -235,7 +236,7 @@
..typeArgument = true
..checkedTypeArgument = true
..functionType = _computeFunctionType(_elementEnvironment, cls,
- strongMode: strongMode);
+ strongMode: options.strongMode);
classUseMap[cls] = classUse;
}
TypeChecks typeChecks = _substitutions._requiredChecks =
@@ -1387,8 +1388,9 @@
@override
RuntimeTypesNeed computeRuntimeTypesNeed(
- ResolutionWorldBuilder resolutionWorldBuilder, ClosedWorld closedWorld,
- {bool enableTypeAssertions, bool strongMode}) {
+ ResolutionWorldBuilder resolutionWorldBuilder,
+ ClosedWorld closedWorld,
+ CompilerOptions options) {
TypeVariableTests typeVariableTests = new TypeVariableTests(
closedWorld.elementEnvironment,
closedWorld.commonElements,
@@ -1437,7 +1439,7 @@
});
}
- Set<Local> localFunctions = strongMode
+ Set<Local> localFunctions = options.strongMode
? resolutionWorldBuilder.localFunctions.toSet()
: resolutionWorldBuilder.localFunctionsWithFreeTypeVariables.toSet();
Set<FunctionEntity> closurizedMembers =
@@ -1459,7 +1461,7 @@
Set<Local> localFunctionsToRemove;
Set<FunctionEntity> closurizedMembersToRemove;
- if (strongMode) {
+ if (options.strongMode) {
for (Local function in localFunctions) {
FunctionType functionType =
_elementEnvironment.getLocalFunctionType(function);
@@ -1535,7 +1537,7 @@
processChecks(typeVariableTests.explicitIsChecks);
processChecks(typeVariableTests.implicitIsChecks);
- if (enableTypeAssertions) {
+ if (options.enableTypeAssertions) {
checkClosures();
}
@@ -1555,6 +1557,29 @@
}
}
+ if (options.parameterCheckPolicy.isEmitted) {
+ void checkFunction(Entity function, FunctionType type) {
+ for (FunctionTypeVariable typeVariable in type.typeVariables) {
+ DartType bound = typeVariable.bound;
+ if (!bound.isDynamic &&
+ !bound.isVoid &&
+ bound != closedWorld.commonElements.objectType) {
+ potentiallyNeedTypeArguments(function);
+ break;
+ }
+ }
+ }
+
+ for (FunctionEntity method in resolutionWorldBuilder.genericMethods) {
+ checkFunction(method, _elementEnvironment.getFunctionType(method));
+ }
+
+ for (Local function in resolutionWorldBuilder.genericLocalFunctions) {
+ checkFunction(
+ function, _elementEnvironment.getLocalFunctionType(function));
+ }
+ }
+
Set<Selector> selectorsNeedingTypeArguments = new Set<Selector>();
typeVariableTests
.forEachAppliedSelector((Selector selector, Set<Entity> targets) {
@@ -1692,8 +1717,7 @@
}
RuntimeTypesChecks computeRequiredChecks(
- CodegenWorldBuilder codegenWorldBuilder,
- {bool strongMode}) {
+ CodegenWorldBuilder codegenWorldBuilder, CompilerOptions options) {
TypeVariableTests typeVariableTests = new TypeVariableTests(
_elementEnvironment, _commonElements, _types, codegenWorldBuilder,
forRtiNeeds: false);
@@ -1786,7 +1810,7 @@
void processClass(ClassEntity cls) {
ClassFunctionType functionType = _computeFunctionType(
_elementEnvironment, cls,
- strongMode: strongMode);
+ strongMode: options.strongMode);
if (functionType != null) {
ClassUse classUse =
classUseMap.putIfAbsent(cls, () => new ClassUse());
@@ -1812,6 +1836,20 @@
liveClasses.forEach(processSuperClasses);
}
+ if (options.parameterCheckPolicy.isEmitted) {
+ for (FunctionEntity method in codegenWorldBuilder.genericMethods) {
+ if (_rtiNeed.methodNeedsTypeArguments(method)) {
+ for (TypeVariableType typeVariable
+ in _elementEnvironment.getFunctionTypeVariables(method)) {
+ DartType bound =
+ _elementEnvironment.getTypeVariableBound(typeVariable.element);
+ processCheckedType(bound);
+ liveTypeVisitor.visit(bound, true);
+ }
+ }
+ }
+ }
+
cachedRequiredChecks = _computeChecks(classUseMap);
rtiChecksBuilderClosed = true;
return new _RuntimeTypesChecks(this, cachedRequiredChecks);
diff --git a/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart
index d4a56bc..84f2502 100644
--- a/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart
@@ -13,6 +13,7 @@
import '../js_backend/namer.dart' show Namer;
import '../js_backend/native_data.dart';
import '../js_backend/interceptor_data.dart';
+import '../js_backend/runtime_types.dart';
import '../universe/call_structure.dart' show CallStructure;
import '../universe/selector.dart' show Selector;
import '../universe/world_builder.dart'
@@ -28,6 +29,7 @@
final CodeEmitterTask _emitterTask;
final Namer _namer;
+ final RuntimeTypesEncoder _rtiEncoder;
final NativeData _nativeData;
final InterceptorData _interceptorData;
final CodegenWorldBuilder _codegenWorldBuilder;
@@ -37,6 +39,7 @@
ParameterStubGenerator(
this._emitterTask,
this._namer,
+ this._rtiEncoder,
this._nativeData,
this._interceptorData,
this._codegenWorldBuilder,
@@ -164,9 +167,11 @@
for (TypeVariableType typeVariable
in _closedWorld.elementEnvironment.getFunctionTypeVariables(member)) {
if (selector.typeArgumentCount == 0) {
- // TODO(32741): Insert the type variable bound instead of `null`.
- targetArguments[count++] =
- _emitter.constantReference(new NullConstantValue());
+ targetArguments[count++] = _rtiEncoder.getTypeRepresentation(
+ _emitter,
+ _closedWorld.elementEnvironment
+ .getTypeVariableBound(typeVariable.element),
+ (_) => _emitter.constantReference(new NullConstantValue()));
} else {
String jsName = '\$${typeVariable.element.name}';
stubParameters[parameterIndex++] = new jsAst.Parameter(jsName);
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index 3b55095..87667ed 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -985,6 +985,7 @@
ParameterStubGenerator generator = new ParameterStubGenerator(
_task,
_namer,
+ _rtiEncoder,
_nativeData,
_interceptorData,
_worldBuilder,
diff --git a/pkg/compiler/lib/src/js_emitter/type_test_registry.dart b/pkg/compiler/lib/src/js_emitter/type_test_registry.dart
index 6f979fd..1f1895b 100644
--- a/pkg/compiler/lib/src/js_emitter/type_test_registry.dart
+++ b/pkg/compiler/lib/src/js_emitter/type_test_registry.dart
@@ -113,7 +113,7 @@
}
void computeRequiredTypeChecks(RuntimeTypesChecksBuilder rtiChecksBuilder) {
- _rtiChecks = rtiChecksBuilder.computeRequiredChecks(_codegenWorldBuilder,
- strongMode: _options.strongMode);
+ _rtiChecks =
+ rtiChecksBuilder.computeRequiredChecks(_codegenWorldBuilder, _options);
}
}
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index 5216b83..1a73d22 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -2113,9 +2113,7 @@
typesImplementedBySubclasses,
classHierarchyNodes,
classSets) {
- computeRtiNeed(resolutionWorldBuilder, rtiNeedBuilder,
- enableTypeAssertions: options.enableTypeAssertions,
- strongMode: options.strongMode);
+ computeRtiNeed(resolutionWorldBuilder, rtiNeedBuilder, options);
}
@override
diff --git a/pkg/compiler/lib/src/kernel/types.dart b/pkg/compiler/lib/src/kernel/types.dart
index 9f6efde..6775859 100644
--- a/pkg/compiler/lib/src/kernel/types.dart
+++ b/pkg/compiler/lib/src/kernel/types.dart
@@ -69,23 +69,20 @@
}
@override
- void checkTypeVariableBounds(
- InterfaceType instantiatedType,
- void checkTypeVariableBound(InterfaceType type, DartType typeArgument,
+ void checkTypeVariableBounds<T>(
+ T context,
+ List<DartType> typeArguments,
+ List<DartType> typeVariables,
+ void checkTypeVariableBound(T context, DartType typeArgument,
TypeVariableType typeVariable, DartType bound)) {
- InterfaceType declaredType = getThisType(instantiatedType.element);
- List<DartType> typeArguments = instantiatedType.typeArguments;
- List<DartType> typeVariables = declaredType.typeArguments;
assert(typeVariables.length == typeArguments.length);
for (int index = 0; index < typeArguments.length; index++) {
DartType typeArgument = typeArguments[index];
TypeVariableType typeVariable = typeVariables[index];
- DartType bound = substByContext(
- elementMap.elementEnvironment
- .getTypeVariableBound(typeVariable.element),
- instantiatedType);
- checkTypeVariableBound(
- instantiatedType, typeArgument, typeVariable, bound);
+ DartType bound = elementMap.elementEnvironment
+ .getTypeVariableBound(typeVariable.element)
+ .subst(typeArguments, typeVariables);
+ checkTypeVariableBound(context, typeArgument, typeVariable, bound);
}
}
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index 01e4689..53fa292 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -316,7 +316,8 @@
..enableMinification = _hasOption(options, Flags.minify)
..enableNativeLiveTypeAnalysis =
!_hasOption(options, Flags.disableNativeLiveTypeAnalysis)
- ..enableTypeAssertions = _hasOption(options, Flags.enableCheckedMode)
+ ..enableTypeAssertions = _hasOption(options, Flags.enableCheckedMode) &&
+ !_hasOption(options, Flags.strongMode)
..enableUserAssertions = _hasOption(options, Flags.enableCheckedMode) ||
_hasOption(options, Flags.enableAsserts)
..experimentalTrackAllocations =
@@ -460,6 +461,9 @@
static const trusted = const CheckPolicy(isTrusted: true);
static const checked = const CheckPolicy(isEmitted: true);
static const ignored = const CheckPolicy(isIgnored: true);
+
+ String toString() => 'CheckPolicy(isTrusted=$isTrusted,'
+ 'isEmitted=$isEmitted,isIgnored=$isIgnored)';
}
String _extractStringOption(
diff --git a/pkg/compiler/lib/src/resolution/type_resolver.dart b/pkg/compiler/lib/src/resolution/type_resolver.dart
index 40d5dd9..47b9ef0 100644
--- a/pkg/compiler/lib/src/resolution/type_resolver.dart
+++ b/pkg/compiler/lib/src/resolution/type_resolver.dart
@@ -415,7 +415,8 @@
}
}
- types.genericCheckTypeVariableBounds(type, checkTypeVariableBound);
+ types.genericCheckTypeVariableBounds(type, type.typeArguments,
+ type.element.typeVariables, checkTypeVariableBound);
}
/**
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index 23353e6..8a75570 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -1566,19 +1566,29 @@
}
}
- void assertIsSubtype(ast.Node node, ResolutionDartType subtype,
- ResolutionDartType supertype, String message) {
+ void assertIsSubtype(
+ ast.Node node,
+ ResolutionDartType subtype,
+ ResolutionDartType supertype,
+ String prefix,
+ String infix,
+ String suffix) {
HInstruction subtypeInstruction = typeBuilder.analyzeTypeArgument(
localsHandler.substInContext(subtype), sourceElement);
HInstruction supertypeInstruction = typeBuilder.analyzeTypeArgument(
localsHandler.substInContext(supertype), sourceElement);
- HInstruction messageInstruction =
- graph.addConstantString(message, closedWorld);
+ HInstruction prefixInstruction =
+ graph.addConstantString(prefix, closedWorld);
+ HInstruction infixInstruction = graph.addConstantString(infix, closedWorld);
+ HInstruction suffixInstruction =
+ graph.addConstantString(suffix, closedWorld);
MethodElement element = commonElements.assertIsSubtype;
var inputs = <HInstruction>[
subtypeInstruction,
supertypeInstruction,
- messageInstruction
+ prefixInstruction,
+ infixInstruction,
+ suffixInstruction,
];
HInstruction assertIsSubtype = new HInvokeStatic(element, inputs,
subtypeInstruction.instructionType, const <DartType>[]);
@@ -3691,15 +3701,21 @@
int subtypeRelation = types.computeSubtypeRelation(typeArgument, bound);
if (subtypeRelation == DartTypes.IS_SUBTYPE) return;
- String message = "Can't create an instance of malbounded type '$type': "
- "'${typeArgument}' is not a subtype of bound '${bound}' for "
- "type variable '${typeVariable}' of type "
- "${type == instance
- ? "'${type.element.thisType}'"
- : "'${instance.element.thisType}' on the supertype "
- "'${instance}' of '${type}'"
- }.";
+ String prefix = "Can't create an instance of malbounded type '$type': '";
+ String infix = "' is not a subtype of bound '";
+ String suffix;
+
+ if (type == instance) {
+ suffix = "' of type variable '${typeVariable}' of type "
+ "'${type.element.thisType}'.";
+ } else {
+ suffix = "' of type variable '${typeVariable}' of type "
+ "'${instance.element.thisType}' on the supertype "
+ "'${instance}' of '${type}'.";
+ }
+
if (subtypeRelation == DartTypes.NOT_SUBTYPE) {
+ String message = "TypeError: $prefix$typeArgument$infix$bound$suffix";
generateTypeError(node, message);
definitelyFails = true;
return;
@@ -3708,18 +3724,20 @@
typeArgument, () => new Set<ResolutionDartType>());
if (!seenChecks.contains(bound)) {
seenChecks.add(bound);
- assertIsSubtype(node, typeArgument, bound, message);
+ assertIsSubtype(node, typeArgument, bound, prefix, infix, suffix);
}
}
}
- types.checkTypeVariableBounds(type, addTypeVariableBoundCheck);
+ types.checkTypeVariableBounds(type, type.typeArguments,
+ type.element.typeVariables, addTypeVariableBoundCheck);
if (definitelyFails) {
return true;
}
for (ResolutionInterfaceType supertype in type.element.allSupertypes) {
ResolutionInterfaceType instance = type.asInstanceOf(supertype.element);
- types.checkTypeVariableBounds(instance, addTypeVariableBoundCheck);
+ types.checkTypeVariableBounds(instance, instance.typeArguments,
+ instance.element.typeVariables, addTypeVariableBoundCheck);
if (definitelyFails) {
return true;
}
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 029f975..3d8966f 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -991,6 +991,30 @@
function.positionalParameters.forEach(_handleParameter);
function.namedParameters.toList()..forEach(_handleParameter);
+
+ checkTypeVariableBounds(targetElement);
+ }
+
+ void checkTypeVariableBounds(FunctionEntity method) {
+ if (rtiNeed.methodNeedsTypeArguments(method)) {
+ ir.FunctionNode function = getFunctionNode(_elementMap, method);
+ for (ir.TypeParameter typeParameter in function.typeParameters) {
+ Local local = localsMap.getLocalTypeVariable(
+ new ir.TypeParameterType(typeParameter), _elementMap);
+ HInstruction newParameter = localsHandler.directLocals[local];
+ DartType bound = _getDartTypeIfValid(typeParameter.bound);
+ if (!bound.isDynamic &&
+ !bound.isVoid &&
+ bound != _commonElements.objectType) {
+ _assertIsType(
+ newParameter,
+ bound,
+ "The type argument '",
+ "' is not a subtype of the type variable bound '",
+ "' of type variable '${local.name}' in '${method.name}'.");
+ }
+ }
+ }
}
/// Builds a SSA graph for FunctionNodes of external methods.
@@ -4250,15 +4274,21 @@
int subtypeRelation = types.computeSubtypeRelation(typeArgument, bound);
if (subtypeRelation == DartTypes.IS_SUBTYPE) return;
- String message = "Can't create an instance of malbounded type '$type': "
- "'${typeArgument}' is not a subtype of bound '${bound}' for "
- "type variable '${typeVariable}' of type "
- "${type == instance
- ? "'${types.getThisType(type.element)}'"
- : "'${types.getThisType(instance.element)}' on the supertype "
- "'${instance}' of '${type}'"
- }.";
+ String prefix = "Can't create an instance of malbounded type '$type': '";
+ String infix = "' is not a subtype of bound '";
+ String suffix;
+
+ if (type == instance) {
+ suffix = "' type variable '${typeVariable}' of type "
+ "'${types.getThisType(type.element)}'.";
+ } else {
+ suffix = "' type variable '${typeVariable}' of type "
+ "'${types.getThisType(instance.element)}' on the supertype "
+ "'${instance}' of '${type}'.";
+ }
+
if (subtypeRelation == DartTypes.NOT_SUBTYPE) {
+ String message = "TypeError: $prefix$typeArgument$infix$bound$suffix";
generateTypeError(message, sourceInformation);
knownInvalidBounds = true;
return;
@@ -4267,19 +4297,29 @@
seenChecksMap.putIfAbsent(typeArgument, () => new Set<DartType>());
if (!seenChecks.contains(bound)) {
seenChecks.add(bound);
- _assertIsSubtype(typeArgument, bound, message);
+ _assertIsSubtype(typeArgument, bound, prefix, infix, suffix);
}
}
}
- types.checkTypeVariableBounds(type, _addTypeVariableBoundCheck);
+ types.checkTypeVariableBounds(
+ type,
+ type.typeArguments,
+ _elementMap.elementEnvironment.getThisType(type.element).typeArguments,
+ _addTypeVariableBoundCheck);
if (knownInvalidBounds) {
return true;
}
for (InterfaceType supertype
in types.getSupertypes(constructor.enclosingClass)) {
InterfaceType instance = types.asInstanceOf(type, supertype.element);
- types.checkTypeVariableBounds(instance, _addTypeVariableBoundCheck);
+ types.checkTypeVariableBounds(
+ instance,
+ instance.typeArguments,
+ _elementMap.elementEnvironment
+ .getThisType(instance.element)
+ .typeArguments,
+ _addTypeVariableBoundCheck);
if (knownInvalidBounds) {
return true;
}
@@ -4287,22 +4327,33 @@
return false;
}
- void _assertIsSubtype(DartType subtype, DartType supertype, String message) {
+ void _assertIsSubtype(DartType subtype, DartType supertype, String prefix,
+ String infix, String suffix) {
HInstruction subtypeInstruction = typeBuilder.analyzeTypeArgument(
localsHandler.substInContext(subtype), sourceElement);
+ _assertIsType(subtypeInstruction, supertype, prefix, infix, suffix);
+ registry?.registerTypeVariableBoundsSubtypeCheck(subtype, supertype);
+ }
+
+ void _assertIsType(HInstruction subtypeInstruction, DartType supertype,
+ String prefix, String infix, String suffix) {
HInstruction supertypeInstruction = typeBuilder.analyzeTypeArgument(
localsHandler.substInContext(supertype), sourceElement);
- HInstruction messageInstruction =
- graph.addConstantString(message, closedWorld);
+ HInstruction prefixInstruction =
+ graph.addConstantString(prefix, closedWorld);
+ HInstruction infixInstruction = graph.addConstantString(infix, closedWorld);
+ HInstruction suffixInstruction =
+ graph.addConstantString(suffix, closedWorld);
FunctionEntity element = commonElements.assertIsSubtype;
var inputs = <HInstruction>[
subtypeInstruction,
supertypeInstruction,
- messageInstruction
+ prefixInstruction,
+ infixInstruction,
+ suffixInstruction
];
HInstruction assertIsSubtype = new HInvokeStatic(element, inputs,
subtypeInstruction.instructionType, const <DartType>[]);
- registry?.registerTypeVariableBoundsSubtypeCheck(subtype, supertype);
add(assertIsSubtype);
}
@@ -5606,9 +5657,11 @@
GlobalLocalsMap _globalLocalsMap;
KernelTypeBuilder(
- GraphBuilder builder, this._elementMap, this._globalLocalsMap)
+ KernelSsaGraphBuilder builder, this._elementMap, this._globalLocalsMap)
: super(builder);
+ KernelSsaGraphBuilder get builder => super.builder;
+
ClassTypeVariableAccess computeTypeVariableAccess(MemberEntity member) {
return _elementMap.getClassTypeVariableAccessForMember(member);
}
@@ -5625,6 +5678,7 @@
potentiallyCheckOrTrustTypeOfParameter(
argument, localsMap.getLocalType(_elementMap, parameter));
});
+ builder.checkTypeVariableBounds(function);
}
}
diff --git a/pkg/compiler/lib/src/ssa/kernel_impact.dart b/pkg/compiler/lib/src/ssa/kernel_impact.dart
index b22749f..735c58e 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -104,6 +104,11 @@
registerSeenClasses(node.returnType);
node.positionalParameters.forEach(handleParameter);
node.namedParameters.forEach(handleParameter);
+ if (_options.strongMode) {
+ for (ir.TypeParameter parameter in node.typeParameters) {
+ checkType(parameter.bound, TypeUseKind.PARAMETER_CHECK);
+ }
+ }
}
ResolutionImpact buildField(ir.Field field) {
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 5aa3fc6..dd8bea5 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -20,6 +20,7 @@
import '../types/types.dart';
import '../universe/selector.dart' show Selector;
import '../universe/side_effects.dart' show SideEffects;
+import '../universe/use.dart' show StaticUse;
import '../util/util.dart';
import '../world.dart' show ClosedWorld;
import 'interceptor_simplifier.dart';
@@ -538,10 +539,9 @@
_closedWorld.locateSingleMember(node.selector, receiverType);
// TODO(ngeoffray): Also fold if it's a getter or variable.
if (element != null &&
- element.isFunction
+ element.isFunction &&
// If we found out that the only target is an implicitly called
// [:noSuchMethod:] we just ignore it.
- &&
node.selector.applies(element)) {
FunctionEntity method = element;
@@ -654,6 +654,7 @@
node.typeArguments,
node.sourceInformation);
result.element = method;
+ _registry.registerStaticUse(new StaticUse.inlining(method, null));
return result;
}
@@ -799,7 +800,7 @@
//
// if (x) { init(); x = false; } else { x = false; }
//
- // which is further simplifed to:
+ // which is further simplified to:
//
// if (x) { init(); }
// ...
diff --git a/pkg/compiler/lib/src/universe/codegen_world_builder.dart b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
index b6b3485..12c547a0 100644
--- a/pkg/compiler/lib/src/universe/codegen_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
@@ -618,6 +618,23 @@
_instanceMemberUsage.forEach(processMemberUse);
return functions;
}
+
+ @override
+ Iterable<FunctionEntity> get genericMethods {
+ List<FunctionEntity> functions = <FunctionEntity>[];
+
+ void processMemberUse(Entity member, AbstractUsage memberUsage) {
+ if (member is FunctionEntity &&
+ memberUsage.hasUse &&
+ _elementEnvironment.getFunctionTypeVariables(member).isNotEmpty) {
+ functions.add(member);
+ }
+ }
+
+ _instanceMemberUsage.forEach(processMemberUse);
+ _staticMemberUsage.forEach(processMemberUse);
+ return functions;
+ }
}
class ElementCodegenWorldBuilderImpl extends CodegenWorldBuilderImpl {
diff --git a/pkg/compiler/lib/src/universe/resolution_world_builder.dart b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
index 2849612..7983684 100644
--- a/pkg/compiler/lib/src/universe/resolution_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
@@ -975,6 +975,22 @@
return classHierarchyBuilder.isInheritedInSubtypeOf(
member.enclosingClass, type);
}
+
+ @override
+ Iterable<FunctionEntity> get genericMethods {
+ List<FunctionEntity> functions = <FunctionEntity>[];
+
+ void processMemberUse(Entity member, AbstractUsage memberUsage) {
+ if (member is FunctionEntity &&
+ memberUsage.hasUse &&
+ _elementEnvironment.getFunctionTypeVariables(member).isNotEmpty) {
+ functions.add(member);
+ }
+ }
+
+ _memberUsage.forEach(processMemberUse);
+ return functions;
+ }
}
abstract class KernelResolutionWorldBuilderBase
diff --git a/pkg/compiler/lib/src/universe/world_builder.dart b/pkg/compiler/lib/src/universe/world_builder.dart
index 9b67772..fdac83d 100644
--- a/pkg/compiler/lib/src/universe/world_builder.dart
+++ b/pkg/compiler/lib/src/universe/world_builder.dart
@@ -293,6 +293,9 @@
/// Live generic local functions.
Iterable<Local> get genericLocalFunctions;
+ /// Live generic methods.
+ Iterable<FunctionEntity> get genericMethods;
+
/// Live user-defined 'noSuchMethod' implementations.
Iterable<FunctionEntity> get userNoSuchMethods;
diff --git a/pkg/compiler/lib/src/world.dart b/pkg/compiler/lib/src/world.dart
index bfe1a5d..f2d8b34 100644
--- a/pkg/compiler/lib/src/world.dart
+++ b/pkg/compiler/lib/src/world.dart
@@ -1338,9 +1338,7 @@
typesImplementedBySubclasses,
classHierarchyNodes,
classSets) {
- computeRtiNeed(resolutionWorldBuilder, rtiNeedBuilder,
- enableTypeAssertions: options.enableTypeAssertions,
- strongMode: options.strongMode);
+ computeRtiNeed(resolutionWorldBuilder, rtiNeedBuilder, options);
}
bool checkClass(ClassElement cls) => cls.isDeclaration;
@@ -1470,11 +1468,9 @@
RuntimeTypesNeed _rtiNeed;
void computeRtiNeed(ResolutionWorldBuilder resolutionWorldBuilder,
- RuntimeTypesNeedBuilder rtiNeedBuilder,
- {bool enableTypeAssertions, bool strongMode}) {
+ RuntimeTypesNeedBuilder rtiNeedBuilder, CompilerOptions options) {
_rtiNeed = rtiNeedBuilder.computeRuntimeTypesNeed(
- resolutionWorldBuilder, this,
- enableTypeAssertions: enableTypeAssertions, strongMode: strongMode);
+ resolutionWorldBuilder, this, options);
}
RuntimeTypesNeed get rtiNeed => _rtiNeed;
diff --git a/pkg/compiler/pubspec.yaml b/pkg/compiler/pubspec.yaml
index 3cf04df..3530a9f 100644
--- a/pkg/compiler/pubspec.yaml
+++ b/pkg/compiler/pubspec.yaml
@@ -19,6 +19,8 @@
path: ../../third_party/pkg/dart2js_info
front_end:
path: ../front_end
+ path:
+ path: ../../third_party/pkg/path
dependency_overrides:
front_end:
path: ../front_end
diff --git a/pkg/dev_compiler/lib/src/analyzer/module_compiler.dart b/pkg/dev_compiler/lib/src/analyzer/module_compiler.dart
index 3b3ad50..deb7004 100644
--- a/pkg/dev_compiler/lib/src/analyzer/module_compiler.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/module_compiler.dart
@@ -34,6 +34,7 @@
import '../compiler/js_names.dart' as JS;
import '../compiler/module_builder.dart'
show transformModuleFormat, ModuleFormat;
+import '../compiler/shared_command.dart';
import '../js_ast/js_ast.dart' as JS;
import '../js_ast/js_ast.dart' show js;
import '../js_ast/source_map_printer.dart' show SourceMapPrintingContext;
@@ -113,17 +114,8 @@
context.resultProvider =
new InputPackagesResultProvider(context, summaryData);
}
- var variables = <String, String>{};
- variables.addAll(options.declaredVariables);
- variables.addAll({
- 'dart.isVM': 'false',
- // TODO(vsm): Should this be hardcoded?
- 'dart.library.html': 'true',
- 'dart.library.io': 'false',
- 'dart.library.ui': 'false',
- 'dart.library.mirrors': 'false',
- 'dart.library.isolate': 'false'
- });
+ var variables = new Map<String, String>.from(options.declaredVariables)
+ ..addAll(sdkLibraryVariables);
context.declaredVariables = new DeclaredVariables.fromMap(variables);
if (!context.analysisOptions.strongMode) {
diff --git a/pkg/dev_compiler/lib/src/compiler/shared_command.dart b/pkg/dev_compiler/lib/src/compiler/shared_command.dart
new file mode 100644
index 0000000..3c4a177
--- /dev/null
+++ b/pkg/dev_compiler/lib/src/compiler/shared_command.dart
@@ -0,0 +1,36 @@
+// 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.
+
+/// Shared code between Analyzer and Kernel CLI interfaces.
+///
+/// This file should only implement functionality that does not depend on
+/// Analyzer/Kernel imports.
+
+/// Variables that indicate which libraries are available in dev compiler.
+// TODO(jmesserly): provide an option to compile without dart:html & friends?
+Map<String, String> sdkLibraryVariables = {
+ 'dart.isVM': 'false',
+ 'dart.library.async': 'true',
+ 'dart.library.core': 'true',
+ 'dart.library.collection': 'true',
+ 'dart.library.convert': 'true',
+ // TODO(jmesserly): this is not really supported in dart4web other than
+ // `debugger()`
+ 'dart.library.developer': 'true',
+ 'dart.library.io': 'false',
+ 'dart.library.isolate': 'false',
+ 'dart.library.js': 'true',
+ 'dart.library.js_util': 'true',
+ 'dart.library.math': 'true',
+ 'dart.library.mirrors': 'false',
+ 'dart.library.typed_data': 'true',
+ 'dart.library.indexed_db': 'true',
+ 'dart.library.html': 'true',
+ 'dart.library.html_common': 'true',
+ 'dart.library.svg': 'true',
+ 'dart.library.ui': 'false',
+ 'dart.library.web_audio': 'true',
+ 'dart.library.web_gl': 'true',
+ 'dart.library.web_sql': 'true',
+};
diff --git a/pkg/dev_compiler/lib/src/kernel/command.dart b/pkg/dev_compiler/lib/src/kernel/command.dart
index 92a045d..0510037 100644
--- a/pkg/dev_compiler/lib/src/kernel/command.dart
+++ b/pkg/dev_compiler/lib/src/kernel/command.dart
@@ -7,7 +7,6 @@
import 'dart:io';
import 'package:args/args.dart';
-import 'package:dev_compiler/src/kernel/target.dart';
import 'package:front_end/src/api_prototype/standard_file_system.dart';
import 'package:front_end/src/api_unstable/ddc.dart' as fe;
import 'package:front_end/src/multi_root_file_system.dart';
@@ -17,9 +16,11 @@
import '../compiler/js_names.dart' as JS;
import '../compiler/module_builder.dart';
+import '../compiler/shared_command.dart';
import '../js_ast/js_ast.dart' as JS;
import '../js_ast/source_map_printer.dart' show SourceMapPrintingContext;
import 'compiler.dart';
+import 'target.dart';
const _binaryName = 'dartdevk';
@@ -373,15 +374,7 @@
}
// Add platform defined variables
- declaredVariables.addAll({
- 'dart.isVM': 'false',
- // TODO(vsm): Should this be hardcoded?
- 'dart.library.html': 'true',
- 'dart.library.io': 'false',
- 'dart.library.ui': 'false',
- 'dart.library.mirrors': 'false',
- 'dart.library.isolate': 'false'
- });
+ declaredVariables.addAll(sdkLibraryVariables);
return declaredVariables;
}
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index c39004a..e8aa203 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -4652,8 +4652,7 @@
args.positional.length == 1 &&
// TODO(jmesserly): this does not correctly handle when the arguments to
// fromEnvironment are constant non-literal values.
- args.positional[0] is BasicLiteral &&
- (args.named.isEmpty || args.named[0].value is BasicLiteral)) {
+ args.positional[0] is BasicLiteral) {
var varName = (args.positional[0] as StringLiteral).value;
var value = declaredVariables[varName];
var defaultArg = args.named.isNotEmpty ? args.named[0].value : null;
diff --git a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
index c60a782..d9ed1f49 100644
--- a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
+++ b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
@@ -4,7 +4,8 @@
import 'dart:async' show Future;
-import 'package:kernel/kernel.dart' show Component;
+import 'package:kernel/kernel.dart'
+ show Component, DartType, NamedNode, Procedure, TypeParameter;
import '../base/processed_options.dart' show ProcessedOptions;
@@ -12,8 +13,19 @@
import '../fasta/incremental_compiler.dart' show IncrementalCompiler;
+import '../fasta/scanner/string_scanner.dart' show StringScanner;
+
import 'compiler_options.dart' show CompilerOptions;
+/// Identifies a position in the source program for expression compilation.
+///
+/// Currently this can be either a library-scope or a class-scope. This object
+/// may also contain references to FE-internal datastructures, so it is
+/// invalidated by any changes to the Kernel program.
+abstract class CompilationPosition {
+ final NamedNode kernelNode = null;
+}
+
abstract class IncrementalKernelGenerator {
factory IncrementalKernelGenerator(CompilerOptions options, Uri entryPoint,
[Uri bootstrapDill]) {
@@ -30,4 +42,42 @@
/// valid files. This guarantees that those files will be re-read on the
/// next call to [computeDelta]).
void invalidate(Uri uri);
+
+ /// Compile [expression] as an [Expression]. A function returning that
+ /// expression is compiled.
+ ///
+ /// [expression] may use the variables supplied in [definitions] as free
+ /// variables and [typeDefinitions] as free type variables. These will become
+ /// required parameters to the compiled function. All elements of
+ /// [definitions] and [typeDefinitions] will become parameters/type
+ /// parameters, whether or not they appear free in [expression]. The type
+ /// parameters should have a null parent pointer.
+ ///
+ /// [enclosingNode] must refer to either a [Library] or a [Class] in which
+ /// scope [expression] is compiled. If it refers to a [Class], the flag
+ /// [isStatic] determines whether [expression] may reference "this".
+ ///
+ /// It is illegal to use "await" in [expression] and the compiled function
+ /// will always be synchronous.
+ ///
+ /// [computeDelta] must have been called at least once prior.
+ ///
+ /// [compileExpression] will return [null] if the library or class for
+ /// [enclosingNode] could not be found. Otherwise, errors are reported in the
+ /// normal way.
+ Future<Procedure> compileExpression(
+ String expression,
+ Map<String, DartType> definitions,
+ List<TypeParameter> typeDefinitions,
+ CompilationPosition position,
+ [bool isStatic = false]);
+
+ /// Finds the [CompilationPosition] referenced by [library] and optionally
+ /// [class].
+ CompilationPosition resolveCompilationPosition(Uri library,
+ [String className]);
+}
+
+bool isLegalIdentifier(String identifier) {
+ return StringScanner.isLegalIdentifier(identifier);
}
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 17a2764..1933002 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -8,13 +8,25 @@
import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
-import 'package:kernel/kernel.dart'
- show Component, Library, LibraryPart, Procedure, Source;
-
import '../api_prototype/file_system.dart' show FileSystemEntity;
+import 'package:kernel/kernel.dart'
+ show
+ AsyncMarker,
+ Component,
+ DartType,
+ DynamicType,
+ InterfaceType,
+ Library,
+ LibraryPart,
+ NamedNode,
+ Procedure,
+ ProcedureKind,
+ Source,
+ TypeParameter;
+
import '../api_prototype/incremental_kernel_generator.dart'
- show IncrementalKernelGenerator;
+ show CompilationPosition, isLegalIdentifier, IncrementalKernelGenerator;
import 'builder/builder.dart' show LibraryBuilder;
@@ -31,12 +43,55 @@
import 'library_graph.dart' show LibraryGraph;
+import 'kernel/kernel_library_builder.dart' show KernelLibraryBuilder;
+
import 'source/source_library_builder.dart' show SourceLibraryBuilder;
import 'ticker.dart' show Ticker;
import 'uri_translator.dart' show UriTranslator;
+import 'modifier.dart' as Modifier;
+
+import '../scanner/token.dart' show Token;
+
+import 'scanner/error_token.dart' show ErrorToken;
+
+import 'scanner/string_scanner.dart' show StringScanner;
+
+import 'dill/built_type_builder.dart' show BuiltTypeBuilder;
+
+import 'kernel/kernel_formal_parameter_builder.dart'
+ show KernelFormalParameterBuilder;
+
+import 'kernel/kernel_procedure_builder.dart' show KernelProcedureBuilder;
+
+import 'builder/class_builder.dart' show ClassBuilder;
+
+import 'kernel/kernel_shadow_ast.dart' show ShadowTypeInferenceEngine;
+
+import 'kernel/body_builder.dart' show BodyBuilder;
+
+import 'kernel/kernel_type_variable_builder.dart'
+ show KernelTypeVariableBuilder;
+
+import 'parser/parser.dart' show Parser;
+
+import 'parser/member_kind.dart' show MemberKind;
+
+import 'scope.dart' show Scope;
+
+import 'type_inference/type_inferrer.dart' show TypeInferrer;
+
+class IncrementalCompilationPosition implements CompilationPosition {
+ final NamedNode kernelNode;
+ final LibraryBuilder libraryBuilder; // will not be null
+ final ClassBuilder classBuilder; // may be null if not inside a class
+
+ IncrementalCompilationPosition(
+ this.kernelNode, this.libraryBuilder, this.classBuilder);
+}
+
class IncrementalCompiler implements IncrementalKernelGenerator {
final CompilerContext context;
@@ -46,7 +101,7 @@
DillTarget dillLoadedData;
Map<Uri, Source> dillLoadedDataUriToSource = <Uri, Source>{};
- List<LibraryBuilder> platformBuilders;
+ Map<Uri, LibraryBuilder> platformBuilders;
Map<Uri, LibraryBuilder> userBuilders;
final Uri initializeFromDillUri;
bool initializedFromDill = false;
@@ -101,10 +156,10 @@
}
summaryBytes = null;
userBuilders = <Uri, LibraryBuilder>{};
- platformBuilders = <LibraryBuilder>[];
+ platformBuilders = <Uri, LibraryBuilder>{};
dillLoadedData.loader.builders.forEach((uri, builder) {
if (builder.uri.scheme == "dart") {
- platformBuilders.add(builder);
+ platformBuilders[uri] = builder;
} else {
userBuilders[uri] = builder;
}
@@ -132,7 +187,8 @@
ticker.logMs("Decided to reuse ${reusedLibraries.length}"
" of ${userCode.loader.builders.length} libraries");
}
- reusedLibraries.addAll(platformBuilders);
+
+ reusedLibraries.addAll(platformBuilders.values);
KernelIncrementalTarget userCodeOld = userCode;
userCode = new KernelIncrementalTarget(
@@ -168,8 +224,11 @@
return new Component(
libraries: compiledLibraries, uriToSource: <Uri, Source>{});
}
- userCodeOld?.loader?.builders?.clear();
- userCodeOld = null;
+ if (componentWithDill != null) {
+ userCodeOld?.loader?.releaseAncillaryResources();
+ userCodeOld?.loader?.builders?.clear();
+ userCodeOld = null;
+ }
List<Library> compiledLibraries =
new List<Library>.from(userCode.loader.libraries);
@@ -188,8 +247,10 @@
outputLibraries = compiledLibraries;
}
- // Clean up.
- userCode.loader.releaseAncillaryResources();
+ if (componentWithDill == null) {
+ userCode.loader.builders.clear();
+ userCode = userCodeOld;
+ }
// This is the incremental component.
return new Component(libraries: outputLibraries, uriToSource: uriToSource)
@@ -318,6 +379,194 @@
ticker.logMs("Appended libraries");
}
+ IncrementalCompilationPosition resolveCompilationPosition(Uri libraryUri,
+ [String className]) {
+ if (userCode == null || dillLoadedData == null) return null;
+
+ // Find library.
+ LibraryBuilder enclosingLibrary = userCode.loader.builders[libraryUri];
+ if (enclosingLibrary == null) return null;
+
+ if (className == null) {
+ return new IncrementalCompilationPosition(
+ enclosingLibrary.target, enclosingLibrary, null);
+ }
+
+ ClassBuilder classBuilder = enclosingLibrary.scopeBuilder[className];
+ if (classBuilder == null) return null;
+
+ return new IncrementalCompilationPosition(
+ classBuilder.target, enclosingLibrary, classBuilder);
+ }
+
+ @override
+ Future<Procedure> compileExpression(
+ String expression,
+ Map<String, DartType> definitions,
+ List<TypeParameter> typeDefinitions,
+ covariant IncrementalCompilationPosition position,
+ [bool isStatic = false]) async {
+ assert(dillLoadedData != null && userCode != null);
+
+ dillLoadedData.loader.seenMessages.clear();
+ userCode.loader.seenMessages.clear();
+
+ for (TypeParameter typeParam in typeDefinitions) {
+ if (!isLegalIdentifier(typeParam.name)) return null;
+ }
+ for (String name in definitions.keys) {
+ if (!isLegalIdentifier(name)) return null;
+ }
+
+ String expressionPrefix =
+ '(${definitions.keys.map((name) => "dynamic $name").join(",")}) =>';
+
+ return context.runInContext((CompilerContext c) async {
+ // Find library builder or report error.
+ bool inClass = position.classBuilder != null;
+ LibraryBuilder enclosingLibraryBuilder = position.libraryBuilder;
+ ClassBuilder classBuilder = position.classBuilder;
+ Library enclosingLibrary = position.libraryBuilder.target;
+
+ dillLoadedData.loader.coreTypes = userCode.loader.coreTypes;
+
+ // Create a synthetic KernelLibraryBuilder to hold the compiled procedure.
+ // This ensures that the uri and character offset positions inside the
+ // expression refer to the the expression text, and not to random
+ // positions in the enclosing library's source.
+ Uri debugExprUri = new Uri(
+ scheme: "org-dartlang-debug", path: "synthetic_debug_expression");
+ KernelLibraryBuilder kernelLibraryBuilder = new KernelLibraryBuilder(
+ debugExprUri,
+ debugExprUri,
+ userCode.loader,
+ /*actualOrigin=*/ null,
+ enclosingLibrary);
+
+ // Parse the function prefix.
+ StringScanner scanner = new StringScanner(expressionPrefix);
+ Token startToken = scanner.tokenize();
+ assert(startToken is! ErrorToken);
+ assert(!scanner.hasErrors);
+
+ // Parse the expression. By parsing the expression separately from the
+ // function prefix, we ensure that the offsets for tokens coming from the
+ // expression are correct.
+ scanner = new StringScanner(expression);
+ Token expressionStartToken = scanner.tokenize();
+ while (expressionStartToken is ErrorToken) {
+ ErrorToken token = expressionStartToken;
+ // add compile time error
+ kernelLibraryBuilder.addCompileTimeError(token.assertionMessage,
+ token.charOffset, token.endOffset - token.charOffset, debugExprUri);
+ }
+
+ var functionLastToken = startToken;
+ while (!functionLastToken.next.isEof) {
+ functionLastToken.offset = -1;
+ functionLastToken = functionLastToken.next;
+ }
+ functionLastToken.offset = -1;
+
+ functionLastToken.next = expressionStartToken;
+ expressionStartToken.previous = functionLastToken;
+
+ // If we're in a library loaded from a dill file, we'll have to do some
+ // extra work to get the scope setup.
+ if (enclosingLibraryBuilder is DillLibraryBuilder) {
+ dillLoadedData.loader.buildOutline(enclosingLibraryBuilder);
+ Map<Uri, LibraryBuilder> libraries = <Uri, LibraryBuilder>{};
+ if (userBuilders != null) libraries.addAll(userBuilders);
+ libraries.addAll(platformBuilders);
+ enclosingLibraryBuilder.addImportsToScope(libraries);
+ }
+ Scope scope =
+ inClass ? classBuilder.scope : enclosingLibraryBuilder.scope;
+
+ // Create a [ProcedureBuilder] and a [BodyBuilder] to parse the expression.
+ dynamicType() => new BuiltTypeBuilder(new DynamicType());
+ List<KernelFormalParameterBuilder> formalParameterBuilders =
+ <KernelFormalParameterBuilder>[];
+ definitions.forEach((name, type) {
+ formalParameterBuilders.add(new KernelFormalParameterBuilder(
+ null,
+ Modifier.varMask,
+ new BuiltTypeBuilder(type),
+ name,
+ false,
+ kernelLibraryBuilder,
+ -1));
+ });
+ List<KernelTypeVariableBuilder> typeVariableBuilders =
+ <KernelTypeVariableBuilder>[];
+ typeDefinitions.forEach((TypeParameter typeParam) {
+ typeVariableBuilders.add(new KernelTypeVariableBuilder(
+ typeParam.name,
+ kernelLibraryBuilder,
+ -1,
+ new BuiltTypeBuilder(typeParam.bound),
+ typeParam));
+ });
+ KernelProcedureBuilder procedureBuilder = new KernelProcedureBuilder(
+ /*metadata=*/ null,
+ isStatic ? Modifier.staticMask : Modifier.varMask,
+ dynamicType(),
+ "debugExpr",
+ typeVariableBuilders,
+ formalParameterBuilders,
+ ProcedureKind.Method,
+ kernelLibraryBuilder,
+ /*charOffset=*/ -1,
+ /*charOpenParenOffset=*/ -1,
+ /*charEndOffset=*/ -1);
+ Procedure procedure = procedureBuilder.build(kernelLibraryBuilder);
+ procedure.parent =
+ inClass ? classBuilder.target : kernelLibraryBuilder.target;
+ scope = procedureBuilder.computeTypeParameterScope(scope);
+ Scope formalParamScope =
+ procedureBuilder.computeFormalParameterScope(scope);
+ var typeInferenceEngine = new ShadowTypeInferenceEngine(
+ null, /*strongMode=*/ context.options.strongMode);
+ typeInferenceEngine.prepareTopLevel(
+ userCode.loader.coreTypes, userCode.loader.hierarchy);
+ InterfaceType thisType;
+ if (inClass) {
+ thisType = classBuilder.target.thisType;
+ }
+ TypeInferrer typeInferrer = typeInferenceEngine.createLocalTypeInferrer(
+ debugExprUri, thisType, kernelLibraryBuilder);
+ BodyBuilder bodyBuilder = new BodyBuilder(
+ kernelLibraryBuilder,
+ procedureBuilder,
+ scope,
+ formalParamScope,
+ userCode.loader.hierarchy,
+ userCode.loader.coreTypes,
+ classBuilder,
+ inClass && !isStatic,
+ null /*uri*/,
+ typeInferrer);
+ bodyBuilder.scope = formalParamScope;
+
+ // Parse the expression.
+ MemberKind kind = inClass
+ ? (isStatic ? MemberKind.StaticMethod : MemberKind.NonStaticMethod)
+ : MemberKind.TopLevelMethod;
+ Parser parser = new Parser(bodyBuilder);
+ Token token = parser.syntheticPreviousToken(startToken);
+ token = parser.parseFormalParametersOpt(token, kind);
+ var formals = bodyBuilder.pop();
+ bodyBuilder.checkEmpty(token.next.charOffset);
+ parser.parseFunctionBody(
+ token, /*isExpression=*/ true, /*allowAbstract=*/ false);
+ var body = bodyBuilder.pop();
+ bodyBuilder.checkEmpty(token.charOffset);
+ bodyBuilder.finishFunction([], formals, AsyncMarker.Sync, body);
+
+ return procedure;
+ });
+ }
+
List<LibraryBuilder> computeReusedLibraries(
Set<Uri> invalidatedUris, UriTranslator uriTranslator) {
if (userCode == null && userBuilders == null) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 4742c42..0a02326 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -111,8 +111,11 @@
/// the error message is the corresponding value in the map.
Map<String, String> unserializableExports;
- KernelLibraryBuilder(Uri uri, Uri fileUri, Loader loader, this.actualOrigin)
- : library = actualOrigin?.library ?? new Library(uri, fileUri: fileUri),
+ KernelLibraryBuilder(Uri uri, Uri fileUri, Loader loader, this.actualOrigin,
+ [Library intendedTarget])
+ : library = intendedTarget ??
+ actualOrigin?.library ??
+ new Library(uri, fileUri: fileUri),
super(loader, fileUri);
@override
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart
index 00ef2e1..485a005 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart
@@ -29,9 +29,12 @@
KernelTypeVariableBuilder(
String name, KernelLibraryBuilder compilationUnit, int charOffset,
- [KernelTypeBuilder bound])
- : actualParameter = new TypeParameter(name, null)
- ..fileOffset = charOffset,
+ [KernelTypeBuilder bound, TypeParameter actual])
+ // TODO(32378): We would like to use '??' here instead, but in conjuction
+ // with '..', it crashes Dart2JS.
+ : actualParameter = actual != null
+ ? (actual..fileOffset = charOffset)
+ : (new TypeParameter(name, null)..fileOffset = charOffset),
super(name, bound, compilationUnit, charOffset);
@override
diff --git a/pkg/front_end/lib/src/fasta/scanner/string_scanner.dart b/pkg/front_end/lib/src/fasta/scanner/string_scanner.dart
index 236b31e..ee2d64b 100644
--- a/pkg/front_end/lib/src/fasta/scanner/string_scanner.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/string_scanner.dart
@@ -4,7 +4,7 @@
library dart2js.scanner.string_scanner;
-import '../../scanner/token.dart' show SyntheticStringToken, TokenType;
+import '../../scanner/token.dart' show SyntheticStringToken, Token, TokenType;
import '../../scanner/token.dart' as analyzer show StringToken;
@@ -12,6 +12,8 @@
import 'token.dart' show CommentToken, DartDocToken, StringToken;
+import 'error_token.dart' show ErrorToken;
+
/**
* Scanner that reads from a String and creates tokens that points to
* substrings.
@@ -37,6 +39,12 @@
: string;
}
+ static bool isLegalIdentifier(String identifier) {
+ StringScanner scanner = new StringScanner(identifier);
+ Token startToken = scanner.tokenize();
+ return startToken is! ErrorToken && startToken.next.isEof;
+ }
+
int advance() => string.codeUnitAt(++scanOffset);
int peek() => string.codeUnitAt(scanOffset + 1);
diff --git a/pkg/front_end/test/fasta/expression_test.dart b/pkg/front_end/test/fasta/expression_test.dart
index c0611b0..37741b9 100644
--- a/pkg/front_end/test/fasta/expression_test.dart
+++ b/pkg/front_end/test/fasta/expression_test.dart
@@ -14,7 +14,6 @@
show
Procedure,
Component,
- CanonicalName,
DynamicType,
DartType,
TypeParameter;
@@ -42,7 +41,7 @@
import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/fasta/incremental_compiler.dart'
- show IncrementalCompiler;
+ show IncrementalCompiler, IncrementalCompilationPosition;
import 'package:kernel/text/ast_to_text.dart' show Printer;
@@ -123,7 +122,9 @@
final bool isStaticMethod;
- final CanonicalName enclosingNode;
+ final Uri library;
+
+ final String className;
String expression;
@@ -135,7 +136,8 @@
this.definitions,
this.typeDefinitions,
this.isStaticMethod,
- this.enclosingNode,
+ this.library,
+ this.className,
this.expression);
String toString() {
@@ -143,7 +145,8 @@
"$entryPoint, "
"$definitions, "
"$typeDefinitions,"
- "$enclosingNode, "
+ "$library, "
+ "$className, "
"static = $isStaticMethod)";
}
@@ -155,7 +158,7 @@
if (!(new File.fromUri(entryPoint)).existsSync()) {
return "Entry point $entryPoint doesn't exist.";
}
- if (enclosingNode == null || enclosingNode == "") {
+ if (library == null) {
return "No enclosing node.";
}
if (expression == null) {
@@ -233,7 +236,8 @@
List<String> definitions = <String>[];
List<String> typeDefinitions = <String>[];
bool isStaticMethod = false;
- CanonicalName enclosingNode;
+ Uri library;
+ String className;
String expression;
dynamic maps = loadYamlNode(contents, sourceUrl: uri);
@@ -248,13 +252,10 @@
if (key == "entry_point") {
entryPoint = description.uri.resolveUri(Uri.parse(value as String));
} else if (key == "position") {
- Uri positionUri =
- description.uri.resolveUri(Uri.parse(value as String));
- enclosingNode = new CanonicalName.root();
- enclosingNode =
- enclosingNode.getChild("${positionUri.removeFragment()}");
- if (positionUri.fragment != null && positionUri.fragment != '') {
- enclosingNode = enclosingNode.getChild(positionUri.fragment);
+ Uri uri = description.uri.resolveUri(Uri.parse(value as String));
+ library = uri.removeFragment();
+ if (uri.fragment != null && uri.fragment != '') {
+ className = uri.fragment;
}
} else if (key == "definitions") {
definitions = (value as YamlList).map((x) => x as String).toList();
@@ -268,7 +269,7 @@
}
}
var test = new TestCase(description, entryPoint, definitions,
- typeDefinitions, isStaticMethod, enclosingNode, expression);
+ typeDefinitions, isStaticMethod, library, className, expression);
var result = test.validate();
if (result != null) {
return new Result.fail(tests, result);
@@ -325,9 +326,15 @@
}
for (var compiler in [sourceCompiler, dillCompiler]) {
- // TODO: actually run the compiler
- test.results
- .add(new CompilationResult(compiler == null ? null : null, []));
+ IncrementalCompilationPosition enclosingNode =
+ compiler.resolveCompilationPosition(test.library, test.className);
+ Procedure compiledProcedure;
+ if (enclosingNode != null) {
+ compiledProcedure = await compiler.compileExpression(test.expression,
+ definitions, typeParams, enclosingNode, test.isStaticMethod);
+ }
+ var errors = context.takeErrors();
+ test.results.add(new CompilationResult(compiledProcedure, errors));
}
}
return new Result.pass(tests);
@@ -357,7 +364,7 @@
final List<CompilationMessage> errors = <CompilationMessage>[];
final CompilerOptions optionBuilder = new CompilerOptions()
- ..strongMode = false
+ ..strongMode = true
..reportMessages = true
..verbose = true
..fileSystem = fs
diff --git a/pkg/front_end/test/subpackage_relationships_test.dart b/pkg/front_end/test/subpackage_relationships_test.dart
index ddacabc..4ce0e7b 100644
--- a/pkg/front_end/test/subpackage_relationships_test.dart
+++ b/pkg/front_end/test/subpackage_relationships_test.dart
@@ -49,6 +49,7 @@
'lib/src/base',
'lib/src/byte_store',
'lib/src/fasta',
+ 'lib/src/fasta/scanner'
]),
'lib/src/api_unstable': new SubpackageRules(allowedDependencies: [
'lib/src',
@@ -75,6 +76,7 @@
'lib/src/fasta/scanner',
'lib/src/fasta/source',
'lib/src/fasta/util',
+ 'lib/src/fasta/type_inference',
'lib/src/scanner',
]),
'lib/src/fasta/builder': new SubpackageRules(allowedDependencies: [
diff --git a/pkg/front_end/testcases/expression.status b/pkg/front_end/testcases/expression.status
index 87a97a3..87869b0 100644
--- a/pkg/front_end/testcases/expression.status
+++ b/pkg/front_end/testcases/expression.status
@@ -1,47 +1,3 @@
// 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.
-
-class_capture.expression: Fail
-class_getter.expression: Fail
-class_invalid_static.expression: Fail
-class_invalid_static_capture.expression: Fail
-class_invalid_static_getter.expression: Fail
-class_invalid_static_setter.expression: Fail
-class_method.expression: Fail
-class_setter.expression: Fail
-class_static.expression: Fail
-class_static2.expression: Fail
-class_static3.expression: Fail
-class_type_param_bound.expression: Fail
-class_type_param_bound_illegal.expression: Fail
-class_type_param_reference.expression: Fail
-class_type_param_reference_arg.expression: Fail
-class_type_param_reference_arg_inferred.expression: Fail
-class_type_param_reference_ctor.expression: Fail
-class_type_param_reference_ctor_inferred.expression: Fail
-class_type_param_reference_var.expression: Fail
-core_lib_imported.expression: Fail
-core_lib_internal.expression: Fail
-eval.dart: Fail
-invalid.expression: Fail
-lib_ctor.expression: Fail
-lib_external_ctor.expression: Fail
-lib_nonctor.expression: Fail
-lib_nonreference.expression: Fail
-lib_nonshown_ctor.expression: Fail
-lib_reference.expression: Fail
-lib_simple.expression: Fail
-missing_variable_types.expression: Fail
-param_assign.expression: Fail
-param_capture.expression: Fail
-param_conflict.expression: Fail
-param_conflict_class.expression: Fail
-param_method.expression: Fail
-type_param_bound.expression: Fail
-type_param_shadow.expression: Fail
-type_param_shadow_arg.expression: Fail
-type_param_shadow_arg_ctor_inferred.expression: Fail
-type_param_shadow_arg_inferred.expression: Fail
-type_param_shadow_ctor.expression: Fail
-type_param_shadow_var.expression: Fail
diff --git a/pkg/front_end/testcases/expression/main.dart b/pkg/front_end/testcases/expression/main.dart
index ba2d61d..d946d39 100644
--- a/pkg/front_end/testcases/expression/main.dart
+++ b/pkg/front_end/testcases/expression/main.dart
@@ -2,10 +2,6 @@
// 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.
-// 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.
-
library main;
import 'dart:io' show File, Process, exit;
diff --git a/pkg/front_end/testcases/expression/type_param_shadow_arg_ctor_inferred.expression.yaml.expect b/pkg/front_end/testcases/expression/type_param_shadow_arg_ctor_inferred.expression.yaml.expect
index 6368c6b..b5a35db 100644
--- a/pkg/front_end/testcases/expression/type_param_shadow_arg_ctor_inferred.expression.yaml.expect
+++ b/pkg/front_end/testcases/expression/type_param_shadow_arg_ctor_inferred.expression.yaml.expect
@@ -3,5 +3,5 @@
}
method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr<T extends dynamic>() → dynamic
return () → dart.core::Null {
- main::A::debugExpr::T k = let final dynamic #t1 = new main::A::•<dynamic>() in let dynamic _ = null in invalid-expression "Error: A value of type 'main::A<dynamic>' can't be assigned to a variable of type 'main::A::debugExpr::T'.\nTry changing the type of the left hand side, or casting the right hand side to 'main::A::debugExpr::T'.";
+ main::A::debugExpr::T k = let final dynamic #t1 = let dynamic _ = null in invalid-expression "Error: A value of type 'main::A<dynamic>' can't be assigned to a variable of type 'main::A::debugExpr::T'.\nTry changing the type of the left hand side, or casting the right hand side to 'main::A::debugExpr::T'." in let final dynamic #t2 = new main::A::•<dynamic>() in null;
};
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index c5638dd..ba13f5c 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -42,8 +42,6 @@
type UInt32 = big endian 32-bit unsigned integer
-type Double = Double-precision floating-point number.
-
type List<T> {
UInt length;
T[length] items;
@@ -713,7 +711,7 @@
type DoubleLiteral extends Expression {
Byte tag = 40;
- Double value;
+ StringReference valueString;
}
type TrueLiteral extends Expression {
@@ -876,7 +874,7 @@
type DoubleConstant extends Constant {
Byte tag = 3;
- Double value;
+ StringReference value;
}
type StringConstant extends Constant {
@@ -1052,8 +1050,8 @@
type TryCatch extends Statement {
Byte tag = 75;
Statement body;
- // 1 if any catch needs a stacktrace (have a stacktrace variable).
- Byte anyCatchNeedsStackTrace;
+ // "any catch needs a stacktrace" means it has a stacktrace variable.
+ Byte flags (anyCatchNeedsStackTrace, isSynthesized);
List<Catch> catches;
}
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 3bfd973..2d27d28 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -4164,8 +4164,9 @@
class TryCatch extends Statement {
Statement body;
List<Catch> catches;
+ bool isSynthetic;
- TryCatch(this.body, this.catches) {
+ TryCatch(this.body, this.catches, {this.isSynthetic: false}) {
body?.parent = this;
setParents(catches, this);
}
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index 384fcf5..d9e61cc 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -97,22 +97,6 @@
readByte();
}
- final Float64List _doubleBuffer = new Float64List(1);
- Uint8List _doubleBufferUint8;
-
- double readDouble() {
- _doubleBufferUint8 ??= _doubleBuffer.buffer.asUint8List();
- _doubleBufferUint8[0] = readByte();
- _doubleBufferUint8[1] = readByte();
- _doubleBufferUint8[2] = readByte();
- _doubleBufferUint8[3] = readByte();
- _doubleBufferUint8[4] = readByte();
- _doubleBufferUint8[5] = readByte();
- _doubleBufferUint8[6] = readByte();
- _doubleBufferUint8[7] = readByte();
- return _doubleBuffer[0];
- }
-
List<int> readByteList() {
List<int> bytes = new Uint8List(readUInt());
bytes.setRange(0, bytes.length, _bytes, _byteOffset);
@@ -190,7 +174,7 @@
case ConstantTag.IntConstant:
return new IntConstant((readExpression() as IntLiteral).value);
case ConstantTag.DoubleConstant:
- return new DoubleConstant(readDouble());
+ return new DoubleConstant(double.parse(readStringReference()));
case ConstantTag.StringConstant:
return new StringConstant(readStringReference());
case ConstantTag.MapConstant:
@@ -1349,7 +1333,7 @@
case Tag.BigIntLiteral:
return new IntLiteral(int.parse(readStringReference()));
case Tag.DoubleLiteral:
- return new DoubleLiteral(readDouble());
+ return new DoubleLiteral(double.parse(readStringReference()));
case Tag.TrueLiteral:
return new BoolLiteral(true);
case Tag.FalseLiteral:
@@ -1565,8 +1549,8 @@
return new ReturnStatement(readExpressionOption())..fileOffset = offset;
case Tag.TryCatch:
Statement body = readStatement();
- readByte(); // whether any catch needs a stacktrace.
- return new TryCatch(body, readCatchList());
+ int flags = readByte();
+ return new TryCatch(body, readCatchList(), isSynthetic: flags & 2 == 2);
case Tag.TryFinally:
return new TryFinally(readStatement(), readStatement());
case Tag.YieldStatement:
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index 7314521..adb16a0 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -147,7 +147,7 @@
writeInteger(constant.value);
} else if (constant is DoubleConstant) {
writeByte(ConstantTag.DoubleConstant);
- writeDouble(constant.value);
+ writeStringReference('${constant.value}');
} else if (constant is StringConstant) {
writeByte(ConstantTag.StringConstant);
writeStringReference(constant.value);
@@ -1238,12 +1238,13 @@
@override
void visitDoubleLiteral(DoubleLiteral node) {
- writeByte(Tag.DoubleLiteral);
writeDouble(node.value);
}
writeDouble(double value) {
- _sink.addDouble(value);
+ // TODO: Pick a better format for double literals.
+ writeByte(Tag.DoubleLiteral);
+ writeStringReference('$value');
}
@override
@@ -1543,17 +1544,16 @@
writeOptionalNode(node.expression);
}
+ int _encodeTryCatchFlags(bool needsStackTrace, bool isSynthetic) {
+ return (needsStackTrace ? 1 : 0) | (isSynthetic ? 2 : 0);
+ }
+
@override
void visitTryCatch(TryCatch node) {
writeByte(Tag.TryCatch);
writeNode(node.body);
- if (node.catches.any((Catch c) => c.stackTrace != null)) {
- // at least one catch needs the stack trace.
- writeByte(1);
- } else {
- // no catch needs the stack trace.
- writeByte(0);
- }
+ bool needsStackTrace = node.catches.any((Catch c) => c.stackTrace != null);
+ writeByte(_encodeTryCatchFlags(needsStackTrace, node.isSynthetic));
writeNodeList(node.catches);
}
@@ -2190,20 +2190,8 @@
int length = 0;
int flushedLength = 0;
- Float64List _doubleBuffer = new Float64List(1);
- Uint8List _doubleBufferUint8;
-
BufferedSink(this._sink);
- void addDouble(double d) {
- _doubleBufferUint8 ??= _doubleBuffer.buffer.asUint8List();
- _doubleBuffer[0] = d;
- addByte4(_doubleBufferUint8[0], _doubleBufferUint8[1],
- _doubleBufferUint8[2], _doubleBufferUint8[3]);
- addByte4(_doubleBufferUint8[4], _doubleBufferUint8[5],
- _doubleBufferUint8[6], _doubleBufferUint8[7]);
- }
-
void addByte(int byte) {
_buffer[length++] = byte;
if (length == SIZE) {
diff --git a/pkg/kernel/lib/clone.dart b/pkg/kernel/lib/clone.dart
index b7cfe0a..5553fd03 100644
--- a/pkg/kernel/lib/clone.dart
+++ b/pkg/kernel/lib/clone.dart
@@ -372,7 +372,8 @@
}
visitTryCatch(TryCatch node) {
- return new TryCatch(clone(node.body), node.catches.map(clone).toList());
+ return new TryCatch(clone(node.body), node.catches.map(clone).toList(),
+ isSynthetic: node.isSynthetic);
}
visitCatch(Catch node) {
diff --git a/pkg/kernel/lib/transformations/continuation.dart b/pkg/kernel/lib/transformations/continuation.dart
index ae9076f..7cfea5e 100644
--- a/pkg/kernel/lib/transformations/continuation.dart
+++ b/pkg/kernel/lib/transformations/continuation.dart
@@ -355,14 +355,18 @@
var exceptionVariable = new VariableDeclaration(":exception");
var stackTraceVariable = new VariableDeclaration(":stack_trace");
- return new TryCatch(buildReturn(labeledBody), <Catch>[
- new Catch(
- exceptionVariable,
- new Block(<Statement>[
- buildCatchBody(exceptionVariable, stackTraceVariable)
- ]),
- stackTrace: stackTraceVariable)
- ]);
+ return new TryCatch(
+ buildReturn(labeledBody),
+ <Catch>[
+ new Catch(
+ exceptionVariable,
+ new Block(<Statement>[
+ buildCatchBody(exceptionVariable, stackTraceVariable)
+ ]),
+ stackTrace: stackTraceVariable)
+ ],
+ isSynthetic: true,
+ );
}
Statement buildCatchBody(
diff --git a/pkg/meta/lib/meta.dart b/pkg/meta/lib/meta.dart
index 3e8395e..ea23c35 100644
--- a/pkg/meta/lib/meta.dart
+++ b/pkg/meta/lib/meta.dart
@@ -105,6 +105,22 @@
/// class that has this annotation is not immutable.
const Immutable immutable = const Immutable();
+/// Used to annotate a test framework function that runs a single test.
+///
+/// Tools, such as IDEs, can show invocations of such function in a file
+/// structure view to help the user navigating in large test files.
+///
+/// The first parameter of the function must be the description of the test.
+const _IsTest isTest = const _IsTest();
+
+/// Used to annotate a test framework function that runs a group of tests.
+///
+/// Tools, such as IDEs, can show invocations of such function in a file
+/// structure view to help the user navigating in large test files.
+///
+/// The first parameter of the function must be the description of the group.
+const _IsTestGroup isTestGroup = const _IsTestGroup();
+
/// Used to annotate a const constructor `c`. Indicates that any invocation of
/// the constructor must use the keyword `const` unless one or more of the
/// arguments to the constructor is not a compile-time constant.
@@ -244,6 +260,14 @@
const _Factory();
}
+class _IsTest {
+ const _IsTest();
+}
+
+class _IsTestGroup {
+ const _IsTestGroup();
+}
+
class _Literal {
const _Literal();
}
diff --git a/pkg/vm/bin/kernel_service.dart b/pkg/vm/bin/kernel_service.dart
index c3b0f6b..ef4c8ef 100644
--- a/pkg/vm/bin/kernel_service.dart
+++ b/pkg/vm/bin/kernel_service.dart
@@ -64,10 +64,14 @@
Compiler(this.fileSystem, Uri platformKernelPath,
{this.strongMode: false,
bool suppressWarnings: false,
- bool syncAsync: false}) {
- Uri packagesUri = (Platform.packageConfig != null)
- ? Uri.parse(Platform.packageConfig)
- : null;
+ bool syncAsync: false,
+ String packageConfig: null}) {
+ Uri packagesUri = null;
+ if (packageConfig != null) {
+ packagesUri = Uri.parse(packageConfig);
+ } else if (Platform.packageConfig != null) {
+ packagesUri = Uri.parse(Platform.packageConfig);
+ }
if (verbose) {
print("DFE: Platform.packageConfig: ${Platform.packageConfig}");
@@ -127,11 +131,15 @@
IncrementalCompiler generator;
IncrementalCompilerWrapper(FileSystem fileSystem, Uri platformKernelPath,
- {bool strongMode: false, bool suppressWarnings: false, syncAsync: false})
+ {bool strongMode: false,
+ bool suppressWarnings: false,
+ bool syncAsync: false,
+ String packageConfig: null})
: super(fileSystem, platformKernelPath,
strongMode: strongMode,
suppressWarnings: suppressWarnings,
- syncAsync: syncAsync);
+ syncAsync: syncAsync,
+ packageConfig: packageConfig);
@override
Future<Component> compileInternal(Uri script) async {
@@ -153,11 +161,13 @@
{this.requireMain: false,
bool strongMode: false,
bool suppressWarnings: false,
- bool syncAsync: false})
+ bool syncAsync: false,
+ String packageConfig: null})
: super(fileSystem, platformKernelPath,
strongMode: strongMode,
suppressWarnings: suppressWarnings,
- syncAsync: syncAsync);
+ syncAsync: syncAsync,
+ packageConfig: packageConfig);
@override
Future<Component> compileInternal(Uri script) async {
@@ -177,7 +187,8 @@
List sourceFiles, Uri platformKernelPath, List<int> platformKernel,
{bool strongMode: false,
bool suppressWarnings: false,
- bool syncAsync: false}) async {
+ bool syncAsync: false,
+ String packageConfig: null}) async {
IncrementalCompilerWrapper compiler = lookupIncrementalCompiler(isolateId);
if (compiler != null) {
updateSources(compiler, sourceFiles);
@@ -194,7 +205,8 @@
compiler = new IncrementalCompilerWrapper(fileSystem, platformKernelPath,
strongMode: strongMode,
suppressWarnings: suppressWarnings,
- syncAsync: syncAsync);
+ syncAsync: syncAsync,
+ packageConfig: packageConfig);
isolateCompilers[isolateId] = compiler;
}
return compiler;
@@ -244,6 +256,7 @@
final List sourceFiles = request[7];
final bool suppressWarnings = request[8];
final bool syncAsync = request[9];
+ final String packageConfig = request[10];
Uri platformKernelPath = null;
List<int> platformKernel = null;
@@ -295,7 +308,8 @@
isolateId, sourceFiles, platformKernelPath, platformKernel,
strongMode: strong,
suppressWarnings: suppressWarnings,
- syncAsync: syncAsync);
+ syncAsync: syncAsync,
+ packageConfig: packageConfig);
} else {
final FileSystem fileSystem = sourceFiles.isEmpty && platformKernel == null
? StandardFileSystem.instance
@@ -304,7 +318,8 @@
requireMain: sourceFiles.isEmpty,
strongMode: strong,
suppressWarnings: suppressWarnings,
- syncAsync: syncAsync);
+ syncAsync: syncAsync,
+ packageConfig: packageConfig);
}
CompilationResult result;
@@ -401,6 +416,7 @@
[] /* source files */,
false /* suppress warnings */,
false /* synchronous async */,
+ null /* package_config */,
];
_processLoadRequest(request);
}
diff --git a/pkg/vm/lib/frontend_server.dart b/pkg/vm/lib/frontend_server.dart
index fe7e529..f94b215 100644
--- a/pkg/vm/lib/frontend_server.dart
+++ b/pkg/vm/lib/frontend_server.dart
@@ -85,7 +85,8 @@
'Scheme that is used in virtual filesystem set up via --filesystem-root'
' option',
defaultsTo: 'org-dartlang-root',
- hide: true);
+ hide: true)
+ ..addFlag('verbose', help: 'Enables verbose output from the compiler.');
String usage = '''
Usage: server [options] [input.dart]
@@ -210,6 +211,7 @@
..packagesFileUri = _getFileOrUri(_options['packages'])
..strongMode = options['strong']
..sdkSummary = sdkRoot.resolve(platformKernelDill)
+ ..verbose = options['verbose']
..onProblem =
(message, Severity severity, List<FormattedMessage> context) {
bool printMessage;
diff --git a/pkg/vm/test/frontend_server_test.dart b/pkg/vm/test/frontend_server_test.dart
index bac3e69..fb1c877 100644
--- a/pkg/vm/test/frontend_server_test.dart
+++ b/pkg/vm/test/frontend_server_test.dart
@@ -654,6 +654,35 @@
int exitcode = await starter(args);
expect(exitcode, equals(0));
});
+
+ test('compile and produce deps file', () async {
+ if (Platform.isWindows) {
+ // TODO(dartbug.com/33032): Fix depfile generation on Windows.
+ return;
+ }
+ var file = new File('${tempDir.path}/foo.dart')..createSync();
+ file.writeAsStringSync("main() {}\n");
+ var dillFile = new File('${tempDir.path}/app.dill');
+ expect(dillFile.existsSync(), equals(false));
+ var depFile = new File('${tempDir.path}/depfile');
+ expect(depFile.existsSync(), equals(false));
+ final List<String> args = <String>[
+ '--sdk-root=${sdkRoot.toFilePath()}',
+ '--strong',
+ '--platform=${platformKernel.path}',
+ '--output-dill=${dillFile.path}',
+ '--depfile=${depFile.path}',
+ file.path
+ ];
+ int exitcode = await starter(args);
+ expect(exitcode, equals(0));
+
+ expect(depFile.existsSync(), true);
+ var depContents = depFile.readAsStringSync();
+ var depContentsParsed = depContents.split(':');
+ expect(depContentsParsed[0], dillFile.path);
+ expect(depContentsParsed[1], isNotEmpty);
+ });
});
return 0;
}
diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
index 585562d..00065fc 100644
--- a/runtime/BUILD.gn
+++ b/runtime/BUILD.gn
@@ -182,7 +182,6 @@
public_configs = [ ":dart_public_config" ]
sources = [
"include/dart_api.h",
- "include/dart_mirrors_api.h",
"include/dart_native_api.h",
"include/dart_tools_api.h",
]
@@ -214,11 +213,9 @@
sources = [
"$target_gen_dir/version.cc",
"include/dart_api.h",
- "include/dart_mirrors_api.h",
"include/dart_native_api.h",
"include/dart_tools_api.h",
"vm/dart_api_impl.cc",
- "vm/mirrors_api_impl.cc",
"vm/native_api_impl.cc",
"vm/version.h",
]
diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart
index 9cffabf..811ed14 100644
--- a/runtime/bin/builtin.dart
+++ b/runtime/bin/builtin.dart
@@ -150,7 +150,7 @@
// Embedder Entrypoint:
// The embedder calls this method with a custom package root.
-_setPackageRoot(String packageRoot) {
+String _setPackageRoot(String packageRoot) {
if (!_setupCompleted) {
_setupHooks();
}
@@ -171,14 +171,16 @@
// up for use in Platform.packageRoot. This is only set when the embedder
// sets up the package root. Automatically discovered package root will
// not update the VMLibraryHooks value.
- VMLibraryHooks.packageRootString = _packageRoot.toString();
+ var packageRootStr = _packageRoot.toString();
+ VMLibraryHooks.packageRootString = packageRootStr;
if (_traceLoading) {
_log('Package root URI: $_packageRoot');
}
+ return packageRootStr;
}
// Embedder Entrypoint:
-void _setPackagesMap(String packagesParam) {
+String _setPackagesMap(String packagesParam) {
if (!_setupCompleted) {
_setupHooks();
}
@@ -204,6 +206,7 @@
if (_traceLoading) {
_log('Resolved packages map to: $packagesUri');
}
+ return packagesUriStr;
}
// Resolves the script uri in the current working directory iff the given uri
diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
index 8043ec0..bb4661e 100644
--- a/runtime/bin/dartutils.cc
+++ b/runtime/bin/dartutils.cc
@@ -496,28 +496,28 @@
Dart_Handle DartUtils::SetupPackageRoot(const char* package_root,
const char* packages_config) {
+ Dart_Handle result = Dart_Null();
+
// Set up package root if specified.
if (package_root != NULL) {
ASSERT(packages_config == NULL);
- Dart_Handle result = NewString(package_root);
+ result = NewString(package_root);
RETURN_IF_ERROR(result);
const int kNumArgs = 1;
Dart_Handle dart_args[kNumArgs];
dart_args[0] = result;
result = Dart_Invoke(DartUtils::BuiltinLib(), NewString("_setPackageRoot"),
kNumArgs, dart_args);
- RETURN_IF_ERROR(result);
} else if (packages_config != NULL) {
- Dart_Handle result = NewString(packages_config);
+ result = NewString(packages_config);
RETURN_IF_ERROR(result);
const int kNumArgs = 1;
Dart_Handle dart_args[kNumArgs];
dart_args[0] = result;
result = Dart_Invoke(DartUtils::BuiltinLib(), NewString("_setPackagesMap"),
kNumArgs, dart_args);
- RETURN_IF_ERROR(result);
}
- return Dart_True();
+ return result;
}
Dart_Handle DartUtils::PrepareForScriptLoading(bool is_service_isolate,
diff --git a/runtime/bin/dfe.cc b/runtime/bin/dfe.cc
index 6bccb8d..11167d4 100644
--- a/runtime/bin/dfe.cc
+++ b/runtime/bin/dfe.cc
@@ -33,6 +33,10 @@
namespace dart {
namespace bin {
+#if !defined(DART_PRECOMPILED_RUNTIME)
+DFE dfe;
+#endif
+
#if defined(DART_NO_SNAPSHOT) || defined(DART_PRECOMPILER)
const uint8_t* kernel_service_dill = NULL;
const intptr_t kernel_service_dill_size = 0;
@@ -213,10 +217,10 @@
DISALLOW_COPY_AND_ASSIGN(WindowsPathSanitizer);
};
-void* DFE::CompileAndReadScript(const char* script_uri,
- char** error,
- int* exit_code,
- bool strong) {
+Dart_KernelCompilationResult DFE::CompileScript(const char* script_uri,
+ bool strong,
+ bool incremental,
+ const char* package_config) {
// TODO(aam): When Frontend is ready, VM should be passing vm_outline.dill
// instead of vm_platform.dill to Frontend for compilation.
#if defined(HOST_OS_WINDOWS)
@@ -230,8 +234,18 @@
strong ? platform_strong_dill : platform_dill;
intptr_t platform_binary_size =
strong ? platform_strong_dill_size : platform_dill_size;
- Dart_KernelCompilationResult result = Dart_CompileToKernel(
- sanitized_uri, platform_binary, platform_binary_size);
+ return Dart_CompileToKernel(sanitized_uri, platform_binary,
+ platform_binary_size, incremental,
+ package_config);
+}
+
+void* DFE::CompileAndReadScript(const char* script_uri,
+ char** error,
+ int* exit_code,
+ bool strong,
+ const char* package_config) {
+ Dart_KernelCompilationResult result =
+ CompileScript(script_uri, strong, true, package_config);
switch (result.status) {
case Dart_KernelCompilationStatus_Ok:
return Dart_ReadKernelBinary(result.kernel, result.kernel_size,
diff --git a/runtime/bin/dfe.h b/runtime/bin/dfe.h
index 558de85..d770bb0 100644
--- a/runtime/bin/dfe.h
+++ b/runtime/bin/dfe.h
@@ -45,14 +45,22 @@
}
void* application_kernel_binary() const { return application_kernel_binary_; }
- // Compiles a script and reads the resulting kernel file.
+ // Compiles specified script.
+ // Returns result from compiling the script.
+ Dart_KernelCompilationResult CompileScript(const char* script_uri,
+ bool strong,
+ bool incremental,
+ const char* package_config);
+
+ // Compiles specified script and reads the resulting kernel file.
// If the compilation is successful, returns a valid in memory kernel
// representation of the script, NULL otherwise
// 'error' and 'exit_code' have the error values in case of errors.
void* CompileAndReadScript(const char* script_uri,
char** error,
int* exit_code,
- bool strong);
+ bool strong,
+ const char* package_config);
// Reads the script kernel file if specified 'script_uri' is a kernel file.
// Returns an in memory kernel representation of the specified script is a
@@ -94,6 +102,10 @@
DISALLOW_COPY_AND_ASSIGN(DFE);
};
+#if !defined(DART_PRECOMPILED_RUNTIME)
+extern DFE dfe;
+#endif
+
} // namespace bin
} // namespace dart
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index 7e9725e..4cf1c9d 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -36,8 +36,6 @@
namespace dart {
namespace bin {
-DFE dfe;
-
// Exit code indicating an API error.
static const int kApiErrorExitCode = 253;
// Exit code indicating a compilation error.
@@ -1530,7 +1528,12 @@
#endif
}
- Dart_SetVMFlags(vm_options.count(), vm_options.arguments());
+ char* error = Dart_SetVMFlags(vm_options.count(), vm_options.arguments());
+ if (error != NULL) {
+ Log::PrintErr("Setting VM flags failed: %s\n", error);
+ free(error);
+ return kErrorExitCode;
+ }
// Initialize the Dart VM.
// Note: We don't expect isolates to be created from dart code during
@@ -1580,7 +1583,7 @@
}
}
- char* error = Dart_Initialize(&init_params);
+ error = Dart_Initialize(&init_params);
if (error != NULL) {
Log::PrintErr("VM initialization failed: %s\n", error);
free(error);
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 36e3a24..9e2a352 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -80,10 +80,6 @@
* dart <app_snapshot_filename> [<script_options>]
*/
static bool vm_run_app_snapshot = false;
-#if !defined(DART_PRECOMPILED_RUNTIME)
-DFE dfe;
-#endif
-
static char* app_script_uri = NULL;
static const uint8_t* app_isolate_snapshot_data = NULL;
static const uint8_t* app_isolate_snapshot_instructions = NULL;
@@ -224,6 +220,7 @@
const char* packages_config,
bool set_native_resolvers,
bool isolate_run_app_snapshot,
+ Dart_IsolateFlags* flags,
char** error,
int* exit_code) {
Dart_EnterScope();
@@ -241,7 +238,47 @@
result = DartUtils::PrepareForScriptLoading(false, Options::trace_loading());
CHECK_RESULT(result);
+ // Set up the load port provided by the service isolate so that we can
+ // load scripts.
+ result = DartUtils::SetupServiceLoadPort();
+ CHECK_RESULT(result);
+
+ // Setup package root if specified.
+ result = DartUtils::SetupPackageRoot(package_root, packages_config);
+ CHECK_RESULT(result);
+ const char* resolved_packages_config = NULL;
+ if (!Dart_IsNull(result)) {
+ result = Dart_StringToCString(result, &resolved_packages_config);
+ CHECK_RESULT(result);
+ ASSERT(resolved_packages_config != NULL);
+ }
+
+ result = Dart_SetEnvironmentCallback(EnvironmentCallback);
+ CHECK_RESULT(result);
+
#if !defined(DART_PRECOMPILED_RUNTIME)
+ if (Options::preview_dart_2() && !isolate_run_app_snapshot &&
+ kernel_program == NULL && !Dart_IsKernelIsolate(isolate)) {
+ if (!dfe.CanUseDartFrontend()) {
+ const char* format = "Dart frontend unavailable to compile script %s.";
+ intptr_t len = snprintf(NULL, 0, format, script_uri) + 1;
+ *error = reinterpret_cast<char*>(malloc(len));
+ ASSERT(error != NULL);
+ snprintf(*error, len, format, script_uri);
+ *exit_code = kErrorExitCode;
+ Dart_ExitScope();
+ Dart_ShutdownIsolate();
+ return NULL;
+ }
+ kernel_program = dfe.CompileAndReadScript(
+ script_uri, error, exit_code, flags->strong, resolved_packages_config);
+ if (kernel_program == NULL) {
+ Dart_ExitScope();
+ Dart_ShutdownIsolate();
+ return NULL;
+ }
+ isolate_data->kernel_program = kernel_program;
+ }
if (kernel_program != NULL) {
Dart_Handle uri = Dart_NewStringFromCString(script_uri);
CHECK_RESULT(uri);
@@ -266,18 +303,6 @@
CHECK_RESULT(result);
}
- // Set up the load port provided by the service isolate so that we can
- // load scripts.
- result = DartUtils::SetupServiceLoadPort();
- CHECK_RESULT(result);
-
- // Setup package root if specified.
- result = DartUtils::SetupPackageRoot(package_root, packages_config);
- CHECK_RESULT(result);
-
- result = Dart_SetEnvironmentCallback(EnvironmentCallback);
- CHECK_RESULT(result);
-
if (isolate_run_app_snapshot) {
result = DartUtils::SetupIOLibrary(Options::namespc(), script_uri,
Options::exit_disabled());
@@ -324,9 +349,8 @@
// Make the isolate runnable so that it is ready to handle messages.
Dart_ExitScope();
Dart_ExitIsolate();
- bool retval = Dart_IsolateMakeRunnable(isolate);
- if (!retval) {
- *error = strdup("Invalid isolate state - Unable to make it runnable");
+ *error = Dart_IsolateMakeRunnable(isolate);
+ if (*error != NULL) {
Dart_EnterIsolate(isolate);
Dart_ShutdownIsolate();
return NULL;
@@ -393,7 +417,8 @@
}
return IsolateSetupHelper(isolate, false, uri, package_root, packages_config,
- true, isolate_run_app_snapshot, error, exit_code);
+ true, isolate_run_app_snapshot, flags, error,
+ exit_code);
}
#endif // !defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM)
@@ -438,7 +463,7 @@
ASSERT(flags != NULL);
flags->load_vmservice_library = true;
- if (dfe.UseDartFrontend()) {
+ if (Options::preview_dart_2()) {
// If there is intention to use DFE, then we create the isolate
// from kernel only if we can.
void* platform_program = dfe.platform_program(flags->strong) != NULL
@@ -551,7 +576,7 @@
Dart_Isolate isolate = NULL;
#if !defined(DART_PRECOMPILED_RUNTIME)
- if (dfe.UseDartFrontend()) {
+ if (Options::preview_dart_2()) {
void* platform_program = dfe.platform_program(flags->strong) != NULL
? dfe.platform_program(flags->strong)
: kernel_program;
@@ -564,36 +589,18 @@
// Isolate should be created only if it is a self contained kernel binary.
isolate = Dart_CreateIsolateFromKernel(script_uri, main, platform_program,
flags, isolate_data, error);
-
- if (!isolate_run_app_snapshot && kernel_program == NULL) {
- if (!dfe.CanUseDartFrontend()) {
- const char* format = "Dart frontend unavailable to compile script %s.";
- intptr_t len = snprintf(NULL, 0, format, script_uri) + 2;
- *error = reinterpret_cast<char*>(malloc(len));
- ASSERT(error != NULL);
- snprintf(*error, len, format, script_uri);
- return NULL;
- }
-
- kernel_program =
- dfe.CompileAndReadScript(script_uri, error, exit_code, flags->strong);
- if (kernel_program == NULL) {
- if (Dart_CurrentIsolate() != NULL) {
- Dart_ShutdownIsolate();
- }
- return NULL;
- }
- }
isolate_data->kernel_program = kernel_program;
} else {
-#endif // !defined(DART_PRECOMPILED_RUNTIME)
-
isolate = Dart_CreateIsolate(
script_uri, main, isolate_snapshot_data, isolate_snapshot_instructions,
app_isolate_shared_data, app_isolate_shared_instructions, flags,
isolate_data, error);
-#if !defined(DART_PRECOMPILED_RUNTIME)
}
+#else
+ isolate = Dart_CreateIsolate(
+ script_uri, main, isolate_snapshot_data, isolate_snapshot_instructions,
+ app_isolate_shared_data, app_isolate_shared_instructions, flags,
+ isolate_data, error);
#endif // !defined(DART_PRECOMPILED_RUNTIME)
Dart_Isolate created_isolate = NULL;
@@ -601,9 +608,10 @@
delete isolate_data;
} else {
bool set_native_resolvers = (kernel_program || isolate_snapshot_data);
- created_isolate = IsolateSetupHelper(
- isolate, is_main_isolate, script_uri, package_root, packages_config,
- set_native_resolvers, isolate_run_app_snapshot, error, exit_code);
+ created_isolate =
+ IsolateSetupHelper(isolate, is_main_isolate, script_uri, package_root,
+ packages_config, set_native_resolvers,
+ isolate_run_app_snapshot, flags, error, exit_code);
}
int64_t end = Dart_TimelineGetMicros();
Dart_TimelineEvent("CreateIsolateAndSetupHelper", start, end,
@@ -870,7 +878,12 @@
// the core snapshot.
Platform::Exit(kErrorExitCode);
}
- Snapshot::GenerateScript(Options::snapshot_filename());
+ if (Options::preview_dart_2()) {
+ Snapshot::GenerateKernel(Options::snapshot_filename(), script_name,
+ flags.strong, Options::packages_file());
+ } else {
+ Snapshot::GenerateScript(Options::snapshot_filename());
+ }
} else {
// Lookup the library of the root script.
Dart_Handle root_lib = Dart_RootLibrary();
@@ -1059,7 +1072,12 @@
} else if (print_flags_seen) {
// Will set the VM flags, print them out and then we exit as no
// script was specified on the command line.
- Dart_SetVMFlags(vm_options.count(), vm_options.arguments());
+ char* error = Dart_SetVMFlags(vm_options.count(), vm_options.arguments());
+ if (error != NULL) {
+ Log::PrintErr("Setting VM flags failed: %s\n", error);
+ free(error);
+ Platform::Exit(kErrorExitCode);
+ }
Platform::Exit(0);
} else {
Options::PrintUsage();
@@ -1129,7 +1147,12 @@
Process::SetExitHook(SnapshotOnExitHook);
}
- Dart_SetVMFlags(vm_options.count(), vm_options.arguments());
+ char* error = Dart_SetVMFlags(vm_options.count(), vm_options.arguments());
+ if (error != NULL) {
+ Log::PrintErr("Setting VM flags failed: %s\n", error);
+ free(error);
+ Platform::Exit(kErrorExitCode);
+ }
// Note: must read platform only *after* VM flags are parsed because
// they might affect how the platform is loaded.
@@ -1139,9 +1162,9 @@
if (application_kernel_binary != NULL) {
// Since we loaded the script anyway, save it.
dfe.set_application_kernel_binary(application_kernel_binary);
- // Since we saw a dill file, it means we have to use DFE for
- // any further source file parsing.
- dfe.set_use_dfe();
+ // Since we saw a dill file, it means we have to turn on all the
+ // preview_dart_2 options.
+ Options::SetPreviewDart2Options(&vm_options);
}
#endif
@@ -1171,7 +1194,7 @@
init_params.start_kernel_isolate = false;
#endif
- char* error = Dart_Initialize(&init_params);
+ error = Dart_Initialize(&init_params);
if (error != NULL) {
EventHandler::Stop();
Log::PrintErr("VM initialization failed: %s\n", error);
diff --git a/runtime/bin/main_options.cc b/runtime/bin/main_options.cc
index df3ec97..c5ce7a6 100644
--- a/runtime/bin/main_options.cc
+++ b/runtime/bin/main_options.cc
@@ -63,20 +63,19 @@
CB_OPTIONS_LIST(CB_OPTION_DEFINITION)
#undef CB_OPTION_DEFINITION
-static bool checked_set = false;
-static bool preview_dart_2_set = false;
-
-static void SetPreviewDart2Options(CommandLineOptions* vm_options) {
+void Options::SetPreviewDart2Options(CommandLineOptions* vm_options) {
#if !defined(DART_PRECOMPILED_RUNTIME)
Options::dfe()->set_use_dfe();
#endif // !defined(DART_PRECOMPILED_RUNTIME)
- preview_dart_2_set = true;
+ OPTION_FIELD(preview_dart_2) = true;
vm_options->AddArgument("--strong");
vm_options->AddArgument("--reify-generic-functions");
vm_options->AddArgument("--limit-ints-to-64-bits");
}
-DEFINE_BOOL_OPTION_CB(preview_dart_2, { SetPreviewDart2Options(vm_options); });
+bool OPTION_FIELD(preview_dart_2) = false;
+DEFINE_BOOL_OPTION_CB(preview_dart_2,
+ { Options::SetPreviewDart2Options(vm_options); });
#if !defined(DART_PRECOMPILED_RUNTIME)
DFE* Options::dfe_ = NULL;
@@ -218,7 +217,8 @@
"The following options are only used for VM development and may\n"
"be changed in any future version:\n");
const char* print_flags = "--print_flags";
- Dart_SetVMFlags(1, &print_flags);
+ char* error = Dart_SetVMFlags(1, &print_flags);
+ ASSERT(error == NULL);
}
}
// clang-format on
@@ -325,6 +325,8 @@
return true;
}
+static bool checked_set = false;
+
int Options::ParseArguments(int argc,
char** argv,
bool vm_run_app_snapshot,
@@ -456,7 +458,7 @@
" run using a snapshot is invalid.\n");
return -1;
}
- if (checked_set && preview_dart_2_set) {
+ if (checked_set && Options::preview_dart_2()) {
Log::PrintErr("Flags --checked and --preview-dart-2 are not compatible.\n");
return -1;
}
diff --git a/runtime/bin/main_options.h b/runtime/bin/main_options.h
index d4b46d8..b5e87d2 100644
--- a/runtime/bin/main_options.h
+++ b/runtime/bin/main_options.h
@@ -107,6 +107,9 @@
CB_OPTIONS_LIST(CB_OPTIONS_DECL)
#undef CB_OPTIONS_DECL
+ static bool preview_dart_2() { return preview_dart_2_; }
+ static void SetPreviewDart2Options(CommandLineOptions* vm_options);
+
static dart::HashMap* environment() { return environment_; }
static const char* vm_service_server_ip() { return vm_service_server_ip_; }
@@ -123,34 +126,24 @@
static void DestroyEnvironment();
private:
-#define STRING_OPTION_DECL(flag, variable) \
- static const char* variable##_; \
- static bool Process_##variable(const char* arg, \
- CommandLineOptions* vm_options);
+#define STRING_OPTION_DECL(flag, variable) static const char* variable##_;
STRING_OPTIONS_LIST(STRING_OPTION_DECL)
#undef STRING_OPTION_DECL
-#define BOOL_OPTION_DECL(flag, variable) \
- static bool variable##_; \
- static bool Process_##variable(const char* arg, \
- CommandLineOptions* vm_options);
+#define BOOL_OPTION_DECL(flag, variable) static bool variable##_;
BOOL_OPTIONS_LIST(BOOL_OPTION_DECL)
#undef BOOL_OPTION_DECL
#define SHORT_BOOL_OPTION_DECL(short_name, long_name, variable) \
- static bool variable##_; \
- static bool Process_##variable(const char* arg, \
- CommandLineOptions* vm_options);
+ static bool variable##_;
SHORT_BOOL_OPTIONS_LIST(SHORT_BOOL_OPTION_DECL)
#undef SHORT_BOOL_OPTION_DECL
-#define ENUM_OPTION_DECL(flag, type, variable) \
- static type variable##_; \
- static bool Process_##variable(const char* arg, \
- CommandLineOptions* vm_options);
+#define ENUM_OPTION_DECL(flag, type, variable) static type variable##_;
ENUM_OPTIONS_LIST(ENUM_OPTION_DECL)
#undef ENUM_OPTION_DECL
+ static bool preview_dart_2_;
static dart::HashMap* environment_;
// Frontend argument processing.
@@ -170,7 +163,7 @@
#define OPTION_FRIEND(flag, variable) friend class OptionProcessor_##flag;
STRING_OPTIONS_LIST(OPTION_FRIEND)
BOOL_OPTIONS_LIST(OPTION_FRIEND)
-#undef STRING_OPTION_FRIEND
+#undef OPTION_FRIEND
#define SHORT_BOOL_OPTION_FRIEND(short_name, long_name, variable) \
friend class OptionProcessor_##long_name;
@@ -182,6 +175,8 @@
ENUM_OPTIONS_LIST(ENUM_OPTION_FRIEND)
#undef ENUM_OPTION_FRIEND
+ friend class OptionProcessor_preview_dart_2;
+
DISALLOW_ALLOCATION();
DISALLOW_IMPLICIT_CONSTRUCTORS(Options);
};
diff --git a/runtime/bin/run_vm_tests.cc b/runtime/bin/run_vm_tests.cc
index 8293434..b896978 100644
--- a/runtime/bin/run_vm_tests.cc
+++ b/runtime/bin/run_vm_tests.cc
@@ -189,9 +189,8 @@
Dart_ExitScope();
Dart_ExitIsolate();
- bool retval = Dart_IsolateMakeRunnable(isolate);
- if (!retval) {
- *error = strdup("Invalid isolate state - Unable to make it runnable");
+ *error = Dart_IsolateMakeRunnable(isolate);
+ if (*error != NULL) {
Dart_EnterIsolate(isolate);
Dart_ShutdownIsolate();
return NULL;
@@ -269,10 +268,10 @@
bin::TimerUtils::InitOnce();
bin::EventHandler::Start();
- bool set_vm_flags_success =
- Flags::ProcessCommandLineFlags(dart_argc, dart_argv);
- ASSERT(set_vm_flags_success);
- const char* err_msg = Dart::InitOnce(
+ const char* error = Flags::ProcessCommandLineFlags(dart_argc, dart_argv);
+ ASSERT(error == NULL);
+
+ error = Dart::InitOnce(
dart::bin::vm_snapshot_data, dart::bin::vm_snapshot_instructions,
CreateIsolateAndSetup /* create */, NULL /* shutdown */,
CleanupIsolate /* cleanup */, NULL /* thread_exit */,
@@ -280,15 +279,15 @@
dart::bin::DartUtils::WriteFile, dart::bin::DartUtils::CloseFile,
NULL /* entropy_source */, NULL /* get_service_assets */,
start_kernel_isolate);
+ ASSERT(error == NULL);
- ASSERT(err_msg == NULL);
// Apply the filter to all registered tests.
TestCaseBase::RunAll();
// Apply the filter to all registered benchmarks.
Benchmark::RunAll(argv[0]);
- err_msg = Dart::Cleanup();
- ASSERT(err_msg == NULL);
+ error = Dart::Cleanup();
+ ASSERT(error == NULL);
bin::EventHandler::Stop();
diff --git a/runtime/bin/snapshot_utils.cc b/runtime/bin/snapshot_utils.cc
index dfceb0e..5bed503 100644
--- a/runtime/bin/snapshot_utils.cc
+++ b/runtime/bin/snapshot_utils.cc
@@ -5,6 +5,7 @@
#include "bin/snapshot_utils.h"
#include "bin/dartutils.h"
+#include "bin/dfe.h"
#include "bin/error_exit.h"
#include "bin/extensions.h"
#include "bin/file.h"
@@ -241,7 +242,7 @@
if (snapshot != NULL) {
return snapshot;
}
-#endif // defined(DART_PRECOMPILED_RUNTIME)
+#endif // defined(DART_PRECOMPILED_RUNTIME)
return NULL;
}
@@ -317,6 +318,22 @@
file->Release();
}
+void Snapshot::GenerateKernel(const char* snapshot_filename,
+ const char* script_name,
+ bool strong,
+ const char* package_config) {
+#if !defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM) && !defined(TESTING)
+ Dart_KernelCompilationResult result =
+ dfe.CompileScript(script_name, strong, false, package_config);
+ if (result.status != Dart_KernelCompilationStatus_Ok) {
+ ErrorExit(kErrorExitCode, "%s\n", result.error);
+ }
+ WriteSnapshotFile(snapshot_filename, result.kernel, result.kernel_size);
+#else
+ UNREACHABLE();
+#endif // !defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM) && !defined(TESTING)
+}
+
void Snapshot::GenerateScript(const char* snapshot_filename) {
// First create a snapshot.
uint8_t* buffer = NULL;
diff --git a/runtime/bin/snapshot_utils.h b/runtime/bin/snapshot_utils.h
index 8b74821..5f935b5 100644
--- a/runtime/bin/snapshot_utils.h
+++ b/runtime/bin/snapshot_utils.h
@@ -28,6 +28,10 @@
class Snapshot {
public:
+ static void GenerateKernel(const char* snapshot_filename,
+ const char* script_name,
+ bool strong,
+ const char* package_config);
static void GenerateScript(const char* snapshot_filename);
static void GenerateAppJIT(const char* snapshot_filename);
static void GenerateAppAOTAsBlobs(const char* snapshot_filename,
diff --git a/runtime/bin/vmservice_impl.cc b/runtime/bin/vmservice_impl.cc
index 621b3f5..74f96e6 100644
--- a/runtime/bin/vmservice_impl.cc
+++ b/runtime/bin/vmservice_impl.cc
@@ -211,11 +211,10 @@
// Make runnable.
Dart_ExitScope();
Dart_ExitIsolate();
- bool retval = Dart_IsolateMakeRunnable(isolate);
- if (!retval) {
+ error_msg_ = Dart_IsolateMakeRunnable(isolate);
+ if (error_msg_ != NULL) {
Dart_EnterIsolate(isolate);
Dart_ShutdownIsolate();
- error_msg_ = "Invalid isolate state - Unable to make it runnable.";
return false;
}
Dart_EnterIsolate(isolate);
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 7d7a298..1e39caf 100644
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -64,6 +64,14 @@
#endif
#endif
+#if __GNUC__
+#define DART_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#elif _MSC_VER
+#define DART_WARN_UNUSED_RESULT _Check_return_
+#else
+#define DART_WARN_UNUSED_RESULT
+#endif
+
#include <assert.h>
/*
@@ -783,7 +791,8 @@
* \return NULL if initialization is successful. Returns an error message
* otherwise. The caller is responsible for freeing the error message.
*/
-DART_EXPORT char* Dart_Initialize(Dart_InitializeParams* params);
+DART_EXPORT DART_WARN_UNUSED_RESULT char* Dart_Initialize(
+ Dart_InitializeParams* params);
/**
* Cleanup state in the VM before process termination.
@@ -791,7 +800,7 @@
* \return NULL if cleanup is successful. Returns an error message otherwise.
* The caller is responsible for freeing the error message.
*/
-DART_EXPORT char* Dart_Cleanup();
+DART_EXPORT DART_WARN_UNUSED_RESULT char* Dart_Cleanup();
/**
* Sets command line flags. Should be called before Dart_Initialize.
@@ -799,9 +808,11 @@
* \param argc The length of the arguments array.
* \param argv An array of arguments.
*
- * \return True if VM flags set successfully.
+ * \return NULL if successful. Returns an error message otherwise.
+ * The caller is responsible for freeing the error message.
*/
-DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv);
+DART_EXPORT DART_WARN_UNUSED_RESULT char* Dart_SetVMFlags(int argc,
+ const char** argv);
/**
* Returns true if the named VM flag is set.
@@ -1063,14 +1074,18 @@
/**
* Make isolate runnable.
*
- * When isolates are spawned this function is used to indicate that
+ * When isolates are spawned, this function is used to indicate that
* the creation and initialization (including script loading) of the
* isolate is complete and the isolate can start.
- * This function does not expect there to be a current isolate.
+ * This function expects there to be no current isolate.
*
* \param isolate The isolate to be made runnable.
+ *
+ * \return NULL if successful. Returns an error message otherwise. The caller
+ * is responsible for freeing the error message.
*/
-DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate);
+DART_EXPORT DART_WARN_UNUSED_RESULT char* Dart_IsolateMakeRunnable(
+ Dart_Isolate isolate);
/*
* ==================
@@ -3198,7 +3213,9 @@
DART_EXPORT Dart_KernelCompilationResult
Dart_CompileToKernel(const char* script_uri,
const uint8_t* platform_kernel,
- const intptr_t platform_kernel_size);
+ const intptr_t platform_kernel_size,
+ bool incremental_compile,
+ const char* package_config);
typedef struct {
const char* uri;
@@ -3210,7 +3227,8 @@
intptr_t platform_kernel_size,
int source_files_count,
Dart_SourceFile source_files[],
- bool incremental_compile);
+ bool incremental_compile,
+ const char* package_config);
#define DART_KERNEL_ISOLATE_NAME "kernel-service"
diff --git a/runtime/include/dart_mirrors_api.h b/runtime/include/dart_mirrors_api.h
deleted file mode 100644
index 6352f92..0000000
--- a/runtime/include/dart_mirrors_api.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
- * for details. All rights reserved. Use of this source code is governed by a
- * BSD-style license that can be found in the LICENSE file.
- */
-
-#ifndef RUNTIME_INCLUDE_DART_MIRRORS_API_H_
-#define RUNTIME_INCLUDE_DART_MIRRORS_API_H_
-
-#include "dart_api.h"
-
-/**
- * Returns the simple name for the provided type.
- */
-DART_EXPORT Dart_Handle Dart_TypeName(Dart_Handle type);
-
-/**
- * Returns the qualified name for the provided type.
- */
-DART_EXPORT Dart_Handle Dart_QualifiedTypeName(Dart_Handle type);
-
-/**
- * Returns a list of the names of all functions or methods declared in
- * a library or class.
- *
- * \param target A library or class.
- *
- * \return If no error occurs, a list of strings is returned.
- * Otherwise an error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target);
-
-/**
- * Looks up a function or method declaration by name from a library or
- * class.
- *
- * \param target The library or class containing the function.
- * \param function_name The name of the function.
- *
- * \return If an error is encountered, returns an error handle.
- * Otherwise returns a function handle if the function is found of
- * Dart_Null() if the function is not found.
- */
-DART_EXPORT Dart_Handle Dart_LookupFunction(Dart_Handle target,
- Dart_Handle function_name);
-
-/**
- * Returns the name for the provided function or method.
- *
- * \return A valid string handle if no error occurs during the
- * operation.
- */
-DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function);
-
-/**
- * Returns a handle to the owner of a function.
- *
- * The owner of an instance method or a static method is its defining
- * class. The owner of a top-level function is its defining
- * library. The owner of the function of a non-implicit closure is the
- * function of the method or closure that defines the non-implicit
- * closure.
- *
- * \return A valid handle to the owner of the function, or an error
- * handle if the argument is not a valid handle to a function.
- */
-DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function);
-
-/**
- * Determines whether a function handle referes to a static function
- * of method.
- *
- * For the purposes of the embedding API, a top-level function is
- * implicitly declared static.
- *
- * \param function A handle to a function or method declaration.
- * \param is_static Returns whether the function or method is declared static.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function,
- bool* is_static);
-
-/**
- * Determines whether a function handle referes to a constructor.
- *
- * \param function A handle to a function or method declaration.
- * \param is_static Returns whether the function or method is a constructor.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_FunctionIsConstructor(Dart_Handle function,
- bool* is_constructor);
-/* TODO(turnidge): Document behavior for factory constructors too. */
-
-/**
- * Determines whether a function or method is a getter.
- *
- * \param function A handle to a function or method declaration.
- * \param is_static Returns whether the function or method is a getter.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_FunctionIsGetter(Dart_Handle function,
- bool* is_getter);
-
-/**
- * Determines whether a function or method is a setter.
- *
- * \param function A handle to a function or method declaration.
- * \param is_static Returns whether the function or method is a setter.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function,
- bool* is_setter);
-
-/**
- * Returns the name of a library as declared in the #library directive.
- */
-DART_EXPORT Dart_Handle Dart_LibraryName(Dart_Handle library);
-
-/**
- * Returns a list of the names of all classes and interfaces declared
- * in a library.
- *
- * \return If no error occurs, a list of strings is returned.
- * Otherwise an error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_LibraryGetClassNames(Dart_Handle library);
-
-/**
- * Retrieves the function of a closure.
- *
- * \return A handle to the function of the closure, or an error handle if the
- * argument is not a closure.
- */
-DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure);
-
-#endif /* INCLUDE_DART_MIRRORS_API_H_ */ /* NOLINT */
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index c60f70c..c9b5f1d 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -16,7 +16,6 @@
evaluate_activation_test/instance: RuntimeError
evaluate_activation_test/scope: RuntimeError
evaluate_in_sync_star_activation_test: RuntimeError
-pause_on_unhandled_async_exceptions2_test: RuntimeError # --pause-isolates-on-unhandled-exceptions doesn't currently work. Issue #29056
pause_on_unhandled_async_exceptions_test: RuntimeError # --pause-isolates-on-unhandled-exceptions doesn't currently work. Issue #29056
step_through_arithmetic_test: RuntimeError # probably constant evaluator pre-evaluating e.g. 1+2
unused_changes_in_last_reload_test: RuntimeError
@@ -34,7 +33,6 @@
[ $arch == simdbc64 && $compiler == dartk ]
coverage_optimized_function_test: Crash # Please triage
get_cpu_profile_timeline_rpc_test: Pass, RuntimeError # http://dartbug.com/31794
-pause_on_unhandled_async_exceptions2_test: RuntimeError, Timeout # Issue 31765
pause_on_unhandled_async_exceptions_test: RuntimeError, Timeout # Issue 31765
[ $arch == simdbc64 && $compiler == dartk && $mode == debug ]
diff --git a/runtime/tests/vm/dart/issue32950_test.dart b/runtime/tests/vm/dart/issue32950_test.dart
new file mode 100644
index 0000000..7e14a7f
--- /dev/null
+++ b/runtime/tests/vm/dart/issue32950_test.dart
@@ -0,0 +1,22 @@
+import 'dart:isolate';
+import 'dart:io';
+
+import 'package:path/path.dart' as p;
+
+main() async {
+ Directory tmp = await Directory.systemTemp.createTemp("testCopy");
+ var path = "${tmp.path}/other.dart";
+ var sourceFile = new File(path);
+ sourceFile.writeAsStringSync("""
+ import 'package:path/path.dart' as p;
+
+ void main() => print(p.current);
+ """);
+
+ var exitPort = new ReceivePort();
+ await Isolate.spawnUri(p.toUri(p.absolute(path)), [], null,
+ packageConfig: p.toUri(p.absolute(".packages")),
+ onExit: exitPort.sendPort);
+ await exitPort.first;
+ await sourceFile.delete();
+}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 26c3491..4c98cc9 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -9,10 +9,10 @@
cc/Fail0: Fail # These tests are expected to crash on all platforms.
cc/Fail1: Fail # These tests are expected to crash on all platforms.
cc/Fail2: Fail # These tests are expected to crash on all platforms.
-cc/IsolateReload_PendingConstructorCall_AbstractToConcrete: Fail # Issue 32981
-cc/IsolateReload_PendingConstructorCall_ConcreteToAbstract: Fail # Issue 32981
+cc/IsolateReload_PendingConstructorCall_AbstractToConcrete: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
+cc/IsolateReload_PendingConstructorCall_ConcreteToAbstract: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
cc/IsolateReload_PendingStaticCall_DefinedToNSM: Fail # Issue 32981
-cc/IsolateReload_PendingStaticCall_NSMToDefined: Fail # Issue 32981
+cc/IsolateReload_PendingStaticCall_NSMToDefined: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
cc/IsolateReload_PendingUnqualifiedCall_InstanceToStatic: Fail # Issue 32981
cc/IsolateReload_PendingUnqualifiedCall_StaticToInstance: Fail # Issue 32981
cc/IsolateReload_RunNewFieldInitializersWithGenerics: Fail # Issue 32299
@@ -36,6 +36,7 @@
dart/byte_array_test: Skip # compilers not aware of byte arrays
dart/error_messages_in_null_checks_test: SkipByDesign # Dart2js throws NullError exceptions with different messages.
dart/inline_stack_frame_test: Skip # Issue 7953, Methods can be missing in dart2js stack traces due to inlining. Also when minifying they can be renamed, which is issue 7953.
+dart/issue32950_test: SkipByDesign # uses isolates.
dart/optimized_stacktrace_line_and_column_test: RuntimeError # The source positions do not match with dart2js.
dart/optimized_stacktrace_line_test: RuntimeError # The source positions do not match with dart2js.
dart/redirection_type_shuffling_test: Skip # Depends on lazy enforcement of type bounds
@@ -71,6 +72,7 @@
[ $runtime == dart_precompiled ]
dart/data_uri_spawn_test: SkipByDesign # Isolate.spawnUri
+dart/issue32950_test: SkipByDesign # uses spawnUri.
[ $runtime != vm ]
dart/hello_fuchsia_test: SkipByDesign # This is a test for fuchsia OS
@@ -224,6 +226,7 @@
[ $compiler == dartkp && ($runtime == dart_precompiled || $runtime == vm) ]
dart/data_uri_import_test/utf16: MissingRuntimeError # UTF-16 data URIs work in dartk
+dart/issue32950_test: SkipByDesign # uses spawnUri.
dart/redirection_type_shuffling_test: SkipByDesign # Includes dart:mirrors.
dart/spawn_shutdown_test: SkipSlow
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index 11c5abc..943119a 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -1548,7 +1548,7 @@
builder_->ReadUInt(); // read value.
return;
case kDoubleLiteral:
- builder_->ReadDouble(); // read value.
+ builder_->SkipStringReference(); // read index into string table.
return;
case kTrueLiteral:
return;
@@ -1807,7 +1807,7 @@
++depth_.catch_;
AddCatchVariables();
- builder_->ReadBool(); // read any_catch_needs_stack_trace.
+ builder_->ReadByte(); // read flags
intptr_t catch_count =
builder_->ReadListLength(); // read number of catches.
for (intptr_t i = 0; i < catch_count; ++i) {
@@ -3542,7 +3542,8 @@
}
void StreamingConstantEvaluator::EvaluateDoubleLiteral() {
- result_ = Double::New(builder_->ReadDouble(), Heap::kOld); // read value.
+ result_ = Double::New(H.DartString(builder_->ReadStringReference()),
+ Heap::kOld); // read string reference.
result_ = H.Canonicalize(result_);
}
@@ -4354,7 +4355,7 @@
}
case kTryCatch: {
CalculateStatementFingerprint(); // read body.
- BuildHash(ReadBool()); // read any_catch_needs_stack_trace.
+ BuildHash(ReadByte()); // read flags
intptr_t catch_count = ReadListLength(); // read number of catches.
for (intptr_t i = 0; i < catch_count; ++i) {
ReadPosition(); // read position.
@@ -6021,10 +6022,6 @@
return reader_.ReadUInt();
}
-double KernelReaderHelper::ReadDouble() {
- return reader_.ReadDouble();
-}
-
uint32_t KernelReaderHelper::PeekListLength() {
AlternativeReadingScope alt(&reader_);
return reader_.ReadListLength();
@@ -6492,7 +6489,7 @@
ReadUInt(); // read value.
return;
case kDoubleLiteral:
- ReadDouble(); // read value.
+ SkipStringReference(); // read index into string table.
return;
case kTrueLiteral:
return;
@@ -6606,7 +6603,7 @@
}
case kTryCatch: {
SkipStatement(); // read body.
- ReadBool(); // read any_catch_needs_stack_trace.
+ ReadByte(); // read flags
intptr_t catch_count = ReadListLength(); // read number of catches.
for (intptr_t i = 0; i < catch_count; ++i) {
ReadPosition(); // read position.
@@ -7166,9 +7163,10 @@
Fragment StreamingFlowGraphBuilder::CatchBlockEntry(const Array& handler_types,
intptr_t handler_index,
- bool needs_stacktrace) {
+ bool needs_stacktrace,
+ bool is_synthesized) {
return flow_graph_builder_->CatchBlockEntry(handler_types, handler_index,
- needs_stacktrace);
+ needs_stacktrace, is_synthesized);
}
Fragment StreamingFlowGraphBuilder::TryCatch(int try_handler_index) {
@@ -8985,7 +8983,8 @@
if (position != NULL) *position = TokenPosition::kNoSource;
Double& constant = Double::ZoneHandle(
- Z, Double::NewCanonical(ReadDouble())); // read double.
+ Z, Double::NewCanonical(
+ H.DartString(ReadStringReference()))); // read string reference.
return Constant(constant);
}
@@ -9853,14 +9852,21 @@
}
try_depth_dec();
- bool needs_stacktrace = ReadBool(); // read any_catch_needs_stack_trace
+ const int kNeedsStracktraceBit = 1 << 0;
+ const int kIsSyntheticBit = 1 << 1;
+
+ uint8_t flags = ReadByte();
+ bool needs_stacktrace =
+ (flags & kNeedsStracktraceBit) == kNeedsStracktraceBit;
+ bool is_synthetic = (flags & kIsSyntheticBit) == kIsSyntheticBit;
catch_depth_inc();
intptr_t catch_count = ReadListLength(); // read number of catches.
const Array& handler_types =
Array::ZoneHandle(Z, Array::New(catch_count, Heap::kOld));
- Fragment catch_body =
- CatchBlockEntry(handler_types, try_handler_index, needs_stacktrace);
+
+ Fragment catch_body = CatchBlockEntry(handler_types, try_handler_index,
+ needs_stacktrace, is_synthetic);
// Fill in the body of the catch.
for (intptr_t i = 0; i < catch_count; ++i) {
intptr_t catch_offset = ReaderOffset(); // Catch has no tag.
@@ -10031,7 +10037,8 @@
handler_types.SetAt(0, Object::dynamic_type());
// Note: rethrow will actually force mark the handler as needing a stacktrace.
Fragment finally_body = CatchBlockEntry(handler_types, try_handler_index,
- /* needs_stacktrace = */ false);
+ /* needs_stacktrace = */ false,
+ /* is_synthesized = */ true);
SetOffset(finalizer_offset);
finally_body += BuildStatement(); // read finalizer
if (finally_body.is_open()) {
@@ -10819,7 +10826,8 @@
break;
}
case kDoubleConstant: {
- temp_instance_ = Double::New(builder_.ReadDouble(), Heap::kOld);
+ temp_instance_ = Double::New(
+ H.DartString(builder_.ReadStringReference()), Heap::kOld);
temp_instance_ = H.Canonicalize(temp_instance_);
break;
}
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
index a572a7d..82ebe8a 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
@@ -1043,7 +1043,6 @@
uint32_t ReadUInt();
uint32_t ReadUInt32();
uint32_t PeekUInt();
- double ReadDouble();
uint32_t PeekListLength();
StringIndex ReadStringReference();
NameIndex ReadCanonicalNameReference();
@@ -1425,7 +1424,8 @@
bool negate = false);
Fragment CatchBlockEntry(const Array& handler_types,
intptr_t handler_index,
- bool needs_stacktrace);
+ bool needs_stacktrace,
+ bool is_synthesized);
Fragment TryCatch(int try_handler_index);
Fragment Drop();
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index 93ce810..aa1cb20 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -1176,14 +1176,15 @@
Fragment FlowGraphBuilder::CatchBlockEntry(const Array& handler_types,
intptr_t handler_index,
- bool needs_stacktrace) {
+ bool needs_stacktrace,
+ bool is_synthesized) {
ASSERT(CurrentException()->is_captured() ==
CurrentStackTrace()->is_captured());
const bool should_restore_closure_context =
CurrentException()->is_captured() || CurrentCatchContext()->is_captured();
CatchBlockEntryInstr* entry = new (Z) CatchBlockEntryInstr(
TokenPosition::kNoSource, // Token position of catch block.
- false, // Not an artifact of compilation.
+ is_synthesized, // whether catch block was synthesized by FE compiler
AllocateBlockId(), CurrentTryIndex(), graph_entry_, handler_types,
handler_index, *CurrentException(), *CurrentStackTrace(),
needs_stacktrace, GetNextDeoptId(), should_restore_closure_context);
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.h b/runtime/vm/compiler/frontend/kernel_to_il.h
index 1aa740d..817633f 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.h
+++ b/runtime/vm/compiler/frontend/kernel_to_il.h
@@ -731,7 +731,8 @@
Fragment BooleanNegate();
Fragment CatchBlockEntry(const Array& handler_types,
intptr_t handler_index,
- bool needs_stacktrace);
+ bool needs_stacktrace,
+ bool is_synthesized);
Fragment TryCatch(int try_handler_index);
Fragment CheckStackOverflowInPrologue(TokenPosition position);
Fragment CheckStackOverflow(TokenPosition position);
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 7398646..26bb097 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
#include "include/dart_api.h"
-#include "include/dart_mirrors_api.h"
#include "include/dart_native_api.h"
#include "lib/stacktrace.h"
@@ -1051,7 +1050,7 @@
return NULL;
}
-DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv) {
+DART_EXPORT char* Dart_SetVMFlags(int argc, const char** argv) {
return Flags::ProcessCommandLineFlags(argc, argv);
}
@@ -1605,7 +1604,7 @@
return false;
}
-DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) {
+DART_EXPORT char* Dart_IsolateMakeRunnable(Dart_Isolate isolate) {
CHECK_NO_ISOLATE(Isolate::Current());
API_TIMELINE_DURATION(Thread::Current());
if (isolate == NULL) {
@@ -1613,11 +1612,17 @@
}
// TODO(16615): Validate isolate parameter.
Isolate* iso = reinterpret_cast<Isolate*>(isolate);
+ const char* error;
if (iso->object_store()->root_library() == Library::null()) {
// The embedder should have called Dart_LoadScript by now.
- return false;
+ error = "Missing root library";
+ } else {
+ error = iso->MakeRunnable();
}
- return iso->MakeRunnable();
+ if (error != NULL) {
+ return strdup(error);
+ }
+ return NULL;
}
// --- Messages and Ports ---
@@ -6005,7 +6010,9 @@
DART_EXPORT Dart_KernelCompilationResult
Dart_CompileToKernel(const char* script_uri,
const uint8_t* platform_kernel,
- intptr_t platform_kernel_size) {
+ intptr_t platform_kernel_size,
+ bool incremental_compile,
+ const char* package_config) {
Dart_KernelCompilationResult result;
#if defined(DART_PRECOMPILED_RUNTIME)
result.status = Dart_KernelCompilationStatus_Unknown;
@@ -6013,7 +6020,8 @@
return result;
#else
result = KernelIsolate::CompileToKernel(script_uri, platform_kernel,
- platform_kernel_size, 0, NULL, true);
+ platform_kernel_size, 0, NULL,
+ incremental_compile, package_config);
if (result.status == Dart_KernelCompilationStatus_Ok) {
if (KernelIsolate::AcceptCompilation().status !=
Dart_KernelCompilationStatus_Ok) {
@@ -6032,7 +6040,8 @@
intptr_t platform_kernel_size,
int source_files_count,
Dart_SourceFile sources[],
- bool incremental_compile) {
+ bool incremental_compile,
+ const char* package_config) {
Dart_KernelCompilationResult result;
#if defined(DART_PRECOMPILED_RUNTIME)
result.status = Dart_KernelCompilationStatus_Unknown;
@@ -6041,7 +6050,7 @@
#else
result = KernelIsolate::CompileToKernel(
script_uri, platform_kernel, platform_kernel_size, source_files_count,
- sources, incremental_compile);
+ sources, incremental_compile, package_config);
if (result.status == Dart_KernelCompilationStatus_Ok) {
if (KernelIsolate::AcceptCompilation().status !=
Dart_KernelCompilationStatus_Ok) {
@@ -6562,6 +6571,8 @@
return Api::NewError("AOT compilation is not supported on IA32.");
#elif defined(TARGET_ARCH_DBC)
return Api::NewError("AOT compilation is not supported on DBC.");
+#elif defined(TARGET_OS_WINDOWS)
+ return Api::NewError("Assembly generation is not implemented for Windows.");
#elif !defined(DART_PRECOMPILER)
return Api::NewError(
"This VM was built without support for AOT compilation.");
@@ -6600,6 +6611,8 @@
return Api::NewError("AOT compilation is not supported on IA32.");
#elif defined(TARGET_ARCH_DBC)
return Api::NewError("AOT compilation is not supported on DBC.");
+#elif defined(TARGET_OS_WINDOWS)
+ return Api::NewError("Assembly generation is not implemented for Windows.");
#elif !defined(DART_PRECOMPILER)
return Api::NewError(
"This VM was built without support for AOT compilation.");
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 7e7b9d7..6cc86f0 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -5,7 +5,6 @@
#include "vm/dart_api_impl.h"
#include "bin/builtin.h"
#include "include/dart_api.h"
-#include "include/dart_mirrors_api.h"
#include "include/dart_native_api.h"
#include "include/dart_tools_api.h"
#include "platform/assert.h"
@@ -775,18 +774,6 @@
const Type& bool_type_obj = Api::UnwrapTypeHandle(zone, type);
EXPECT(bool_type_obj.raw() == Type::BoolType());
- Dart_Handle cls_name = Dart_TypeName(type);
- EXPECT_VALID(cls_name);
- const char* cls_name_cstr = "";
- EXPECT_VALID(Dart_StringToCString(cls_name, &cls_name_cstr));
- EXPECT_STREQ("bool", cls_name_cstr);
-
- Dart_Handle qual_cls_name = Dart_QualifiedTypeName(type);
- EXPECT_VALID(qual_cls_name);
- const char* qual_cls_name_cstr = "";
- EXPECT_VALID(Dart_StringToCString(qual_cls_name, &qual_cls_name_cstr));
- EXPECT_STREQ("Library:'dart:core' Class: bool", qual_cls_name_cstr);
-
// Errors propagate.
Dart_Handle error = Dart_NewApiError("MyError");
Dart_Handle error_type = Dart_InstanceGetType(error);
@@ -5672,11 +5659,12 @@
}
// Load a script successfully.
- result = TestCase::LoadTestScript(kScriptChars, NULL);
+ Dart_Handle root_lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ EXPECT_VALID(root_lib);
+ result = Dart_FinalizeLoading(false);
EXPECT_VALID(result);
- Dart_FinalizeLoading(false);
- result = Dart_Invoke(result, NewString("main"), 0, NULL);
+ result = Dart_Invoke(root_lib, NewString("main"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
int64_t value = 0;
@@ -5705,13 +5693,6 @@
EXPECT_VALID(LoadScript(TestCase::url(), kScriptChars));
root_lib = Dart_RootLibrary();
- Dart_Handle lib_name = Dart_LibraryName(root_lib);
- EXPECT_VALID(lib_name);
- EXPECT(!Dart_IsNull(root_lib));
- const char* name_cstr = "";
- EXPECT_VALID(Dart_StringToCString(lib_name, &name_cstr));
- EXPECT_STREQ("testlib", name_cstr);
-
Dart_Handle lib_uri = Dart_LibraryUrl(root_lib);
EXPECT_VALID(lib_uri);
EXPECT(!Dart_IsNull(lib_uri));
@@ -5851,72 +5832,6 @@
Dart_GetError(result));
}
-TEST_CASE(DartAPI_LibraryName) {
- const char* kLibrary1Chars = "library library1_name;";
- Dart_Handle lib = TestCase::LoadTestLibrary("library1_url", kLibrary1Chars);
- Dart_Handle error = Dart_NewApiError("incoming error");
- EXPECT_VALID(lib);
-
- Dart_Handle result = Dart_LibraryName(Dart_Null());
- EXPECT(Dart_IsError(result));
- EXPECT_STREQ("Dart_LibraryName expects argument 'library' to be non-null.",
- Dart_GetError(result));
-
- result = Dart_LibraryName(Dart_True());
- EXPECT(Dart_IsError(result));
- EXPECT_STREQ(
- "Dart_LibraryName expects argument 'library' to be of type Library.",
- Dart_GetError(result));
-
- result = Dart_LibraryName(error);
- EXPECT(Dart_IsError(result));
- EXPECT_STREQ("incoming error", Dart_GetError(result));
-
- result = Dart_LibraryName(lib);
- EXPECT_VALID(result);
- EXPECT(Dart_IsString(result));
- const char* cstr = NULL;
- EXPECT_VALID(Dart_StringToCString(result, &cstr));
- EXPECT_STREQ("library1_name", cstr);
-}
-
-#ifndef PRODUCT
-
-TEST_CASE(DartAPI_LibraryId) {
- const char* kLibrary1Chars = "library library1_name;";
- Dart_Handle lib = TestCase::LoadTestLibrary("library1_url", kLibrary1Chars);
- Dart_Handle error = Dart_NewApiError("incoming error");
- EXPECT_VALID(lib);
- intptr_t libraryId = -1;
-
- Dart_Handle result = Dart_LibraryId(Dart_Null(), &libraryId);
- EXPECT(Dart_IsError(result));
- EXPECT_STREQ("Dart_LibraryId expects argument 'library' to be non-null.",
- Dart_GetError(result));
-
- result = Dart_LibraryId(Dart_True(), &libraryId);
- EXPECT(Dart_IsError(result));
- EXPECT_STREQ(
- "Dart_LibraryId expects argument 'library' to be of type Library.",
- Dart_GetError(result));
-
- result = Dart_LibraryId(error, &libraryId);
- EXPECT(Dart_IsError(result));
- EXPECT_STREQ("incoming error", Dart_GetError(result));
-
- result = Dart_LibraryId(lib, &libraryId);
- EXPECT_VALID(result);
- Dart_Handle libFromId = Dart_GetLibraryFromId(libraryId);
- EXPECT(Dart_IsLibrary(libFromId));
- result = Dart_LibraryName(libFromId);
- EXPECT(Dart_IsString(result));
- const char* cstr = NULL;
- EXPECT_VALID(Dart_StringToCString(result, &cstr));
- EXPECT_STREQ("library1_name", cstr);
-}
-
-#endif // !PRODUCT
-
TEST_CASE(DartAPI_LibraryUrl) {
const char* kLibrary1Chars = "library library1_name;";
Dart_Handle lib = TestCase::LoadTestLibrary("library1_url", kLibrary1Chars);
@@ -5946,111 +5861,6 @@
EXPECT_SUBSTRING("library1_url", cstr);
}
-TEST_CASE(DartAPI_LibraryGetClassNames) {
- const char* kLibraryChars =
- "library library_name;\n"
- "\n"
- "class A {}\n"
- "class B {}\n"
- "abstract class C {}\n"
- "class _A {}\n"
- "class _B {}\n"
- "abstract class _C {}\n"
- "\n"
- "int _compare(dynamic a, dynamic b) => a.compareTo(b);\n"
- "sort(list) => list.sort(_compare);\n";
-
- Dart_Handle lib = TestCase::LoadTestLibrary("library_url", kLibraryChars);
- EXPECT_VALID(lib);
- Dart_Handle result = Dart_FinalizeLoading(false);
- EXPECT_VALID(result);
-
- Dart_Handle list = Dart_LibraryGetClassNames(lib);
- EXPECT_VALID(list);
- EXPECT(Dart_IsList(list));
-
- // Sort the list.
- const int kNumArgs = 1;
- Dart_Handle args[1];
- args[0] = list;
- EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args));
-
- Dart_Handle list_string = Dart_ToString(list);
- EXPECT_VALID(list_string);
- const char* list_cstr = "";
- EXPECT_VALID(Dart_StringToCString(list_string, &list_cstr));
- EXPECT_STREQ("[A, B, C, _A, _B, _C]", list_cstr);
-}
-
-TEST_CASE(DartAPI_GetFunctionNames) {
- const char* kLibraryChars =
- "library library_name;\n"
- "\n"
- "void A() {}\n"
- "get B => 11;\n"
- "set C(x) { }\n"
- "var D;\n"
- "void _A() {}\n"
- "get _B => 11;\n"
- "set _C(x) { }\n"
- "var _D;\n"
- "\n"
- "class MyClass {\n"
- " void A2() {}\n"
- " get B2 => 11;\n"
- " set C2(x) { }\n"
- " var D2;\n"
- " void _A2() {}\n"
- " get _B2 => 11;\n"
- " set _C2(x) { }\n"
- " var _D2;\n"
- "}\n"
- "\n"
- "int _compare(dynamic a, dynamic b) => a.compareTo(b);\n"
- "sort(list) => list.sort(_compare);\n";
-
- // Get the functions from a library.
- Dart_Handle lib = TestCase::LoadTestScript(kLibraryChars, NULL);
- EXPECT_VALID(lib);
- Dart_Handle result = Dart_FinalizeLoading(false);
- EXPECT_VALID(result);
-
- Dart_Handle list = Dart_GetFunctionNames(lib);
- EXPECT_VALID(list);
- EXPECT(Dart_IsList(list));
-
- // Sort the list.
- const int kNumArgs = 1;
- Dart_Handle args[1];
- args[0] = list;
- EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args));
-
- Dart_Handle list_string = Dart_ToString(list);
- EXPECT_VALID(list_string);
- const char* list_cstr = "";
- EXPECT_VALID(Dart_StringToCString(list_string, &list_cstr));
- EXPECT_STREQ("[A, B, C=, _A, _B, _C=, _compare, sort]", list_cstr);
-
- // Get the functions from a class.
- Dart_Handle cls = Dart_GetClass(lib, NewString("MyClass"));
- EXPECT_VALID(cls);
-
- list = Dart_GetFunctionNames(cls);
- EXPECT_VALID(list);
- EXPECT(Dart_IsList(list));
-
- // Sort the list.
- args[0] = list;
- EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args));
-
- // Check list contents.
- list_string = Dart_ToString(list);
- EXPECT_VALID(list_string);
- list_cstr = "";
- EXPECT_VALID(Dart_StringToCString(list_string, &list_cstr));
- EXPECT_STREQ("[A2, B2, C2=, MyClass, _A2, _B2, _C2=]", list_cstr);
-}
-
TEST_CASE(DartAPI_LibraryImportLibrary) {
const char* kLibrary1Chars = "library library1_name;";
const char* kLibrary2Chars = "library library2_name;";
@@ -7203,8 +7013,8 @@
EXPECT_VALID(result);
Dart_ExitScope();
Dart_ExitIsolate();
- bool retval = Dart_IsolateMakeRunnable(isolate);
- EXPECT(retval);
+ char* err_msg = Dart_IsolateMakeRunnable(isolate);
+ EXPECT(err_msg == NULL);
return isolate;
}
@@ -8214,7 +8024,8 @@
Dart_Handle source = NewString(kLoadSecond);
Dart_Handle url = NewString(TestCase::url());
- Dart_LoadSource(TestCase::lib(), url, Dart_Null(), source, 0, 0);
+ result = Dart_LoadSource(TestCase::lib(), url, Dart_Null(), source, 0, 0);
+ EXPECT_VALID(result);
result = Dart_FinalizeLoading(false);
EXPECT_VALID(result);
diff --git a/runtime/vm/flags.cc b/runtime/vm/flags.cc
index dbee5f1..9120a8e 100644
--- a/runtime/vm/flags.cc
+++ b/runtime/vm/flags.cc
@@ -414,10 +414,10 @@
return strcmp(left_flag->name_, right_flag->name_);
}
-bool Flags::ProcessCommandLineFlags(int number_of_vm_flags,
- const char** vm_flags) {
+char* Flags::ProcessCommandLineFlags(int number_of_vm_flags,
+ const char** vm_flags) {
if (initialized_) {
- return false;
+ return strdup("Flags already set");
}
qsort(flags_, num_flags_, sizeof flags_[0], CompareFlagNames);
@@ -435,20 +435,20 @@
if (!FLAG_ignore_unrecognized_flags) {
int unrecognized_count = 0;
+ TextBuffer error(64);
for (intptr_t j = 0; j < num_flags_; j++) {
Flag* flag = flags_[j];
if (flag->IsUnrecognized()) {
if (unrecognized_count == 0) {
- OS::PrintErr("Unrecognized flags: %s", flag->name_);
+ error.Printf("Unrecognized flags: %s", flag->name_);
} else {
- OS::PrintErr(", %s", flag->name_);
+ error.Printf(", %s", flag->name_);
}
unrecognized_count++;
}
}
if (unrecognized_count > 0) {
- OS::PrintErr("\n");
- exit(255);
+ return error.Steal();
}
}
if (FLAG_print_flags) {
@@ -456,7 +456,7 @@
}
initialized_ = true;
- return true;
+ return NULL;
}
bool Flags::SetFlag(const char* name, const char* value, const char** error) {
diff --git a/runtime/vm/flags.h b/runtime/vm/flags.h
index a83e2e0..e72b33f 100644
--- a/runtime/vm/flags.h
+++ b/runtime/vm/flags.h
@@ -63,7 +63,7 @@
const char* name,
const char* comment);
- static bool ProcessCommandLineFlags(int argc, const char** argv);
+ static char* ProcessCommandLineFlags(int argc, const char** argv);
static Flag* Lookup(const char* name);
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index b444072..c3dcbe0 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -1244,13 +1244,13 @@
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
}
-bool Isolate::MakeRunnable() {
+const char* Isolate::MakeRunnable() {
ASSERT(Isolate::Current() == NULL);
MutexLocker ml(mutex_);
// Check if we are in a valid state to make the isolate runnable.
if (is_runnable() == true) {
- return false; // Already runnable.
+ return "Isolate is already runnable";
}
// Set the isolate as runnable and if we are being spawned schedule
// isolate on thread pool for execution.
@@ -1294,7 +1294,7 @@
GetRunnableHeapSizeMetric()->set_value(heap_size);
}
#endif // !PRODUCT
- return true;
+ return NULL;
}
bool Isolate::VerifyPauseCapability(const Object& capability) const {
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 0febbfe..66f75f9 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -302,7 +302,7 @@
bool dont_delete_reload_context = false);
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
- bool MakeRunnable();
+ const char* MakeRunnable();
void Run();
MessageHandler* message_handler() const { return message_handler_; }
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index 8dcf7d8..984de86 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -601,7 +601,7 @@
Dart_KernelCompilationResult retval = KernelIsolate::CompileToKernel(
root_lib_url.ToCString(), NULL, 0, modified_scripts_count,
- modified_scripts, true);
+ modified_scripts, true, NULL);
if (retval.status != Dart_KernelCompilationStatus_Ok) {
TIR_Print("---- LOAD FAILED, ABORTING RELOAD\n");
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index daee540..1106d45 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -213,14 +213,6 @@
return value;
}
- double ReadDouble() {
- ASSERT((size_ >= 8) && (offset_ >= 0) && (offset_ <= size_ - 8));
- double value = ReadUnaligned(
- reinterpret_cast<const double*>(&this->buffer()[offset_]));
- offset_ += 8;
- return value;
- }
-
uint32_t ReadUInt() {
ASSERT((size_ >= 1) && (offset_ >= 0) && (offset_ <= size_ - 1));
diff --git a/runtime/vm/kernel_isolate.cc b/runtime/vm/kernel_isolate.cc
index a8a9a1f..cf12542 100644
--- a/runtime/vm/kernel_isolate.cc
+++ b/runtime/vm/kernel_isolate.cc
@@ -348,7 +348,8 @@
intptr_t platform_kernel_size,
int source_files_count,
Dart_SourceFile source_files[],
- bool incremental_compile) {
+ bool incremental_compile,
+ const char* package_config) {
// Build the [null, send_port, script_uri, platform_kernel,
// incremental_compile, isolate_id, [files]] message for the Kernel isolate.
// tag is used to specify which operation the frontend should perform.
@@ -422,6 +423,14 @@
dart_sync_async.type = Dart_CObject_kBool;
dart_sync_async.value.as_bool = FLAG_sync_async;
+ Dart_CObject package_config_uri;
+ if (package_config != NULL) {
+ package_config_uri.type = Dart_CObject_kString;
+ package_config_uri.value.as_string = const_cast<char*>(package_config);
+ } else {
+ package_config_uri.type = Dart_CObject_kNull;
+ }
+
Dart_CObject* message_arr[] = {&tag,
&send_port,
&uri,
@@ -431,7 +440,8 @@
&isolate_id,
&files,
&suppress_warnings,
- &dart_sync_async};
+ &dart_sync_async,
+ &package_config_uri};
message.value.as_array.values = message_arr;
message.value.as_array.length = ARRAY_SIZE(message_arr);
// Send the message.
@@ -557,7 +567,8 @@
intptr_t platform_kernel_size,
int source_file_count,
Dart_SourceFile source_files[],
- bool incremental_compile) {
+ bool incremental_compile,
+ const char* package_config) {
// This must be the main script to be loaded. Wait for Kernel isolate
// to finish initialization.
Dart_Port kernel_port = WaitForKernelPort();
@@ -572,7 +583,7 @@
return request.SendAndWaitForResponse(kCompileTag, kernel_port, script_uri,
platform_kernel, platform_kernel_size,
source_file_count, source_files,
- incremental_compile);
+ incremental_compile, package_config);
}
Dart_KernelCompilationResult KernelIsolate::AcceptCompilation() {
@@ -588,7 +599,7 @@
KernelCompilationRequest request;
return request.SendAndWaitForResponse(kAcceptTag, kernel_port, NULL, NULL, 0,
- 0, NULL, true);
+ 0, NULL, true, NULL);
}
Dart_KernelCompilationResult KernelIsolate::UpdateInMemorySources(
@@ -607,7 +618,7 @@
KernelCompilationRequest request;
return request.SendAndWaitForResponse(kUpdateSourcesTag, kernel_port, NULL,
NULL, 0, source_files_count,
- source_files, true);
+ source_files, true, NULL);
}
#endif // DART_PRECOMPILED_RUNTIME
diff --git a/runtime/vm/kernel_isolate.h b/runtime/vm/kernel_isolate.h
index 001aa41..f9084cf 100644
--- a/runtime/vm/kernel_isolate.h
+++ b/runtime/vm/kernel_isolate.h
@@ -38,7 +38,8 @@
intptr_t platform_kernel_size,
int source_files_count = 0,
Dart_SourceFile source_files[] = NULL,
- bool incremental_compile = true);
+ bool incremental_compile = true,
+ const char* package_config = NULL);
static Dart_KernelCompilationResult AcceptCompilation();
static Dart_KernelCompilationResult UpdateInMemorySources(
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index 6a3358c..4b83212 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -82,7 +82,8 @@
return true;
case kDoubleLiteral:
simple_value_ = &Double::ZoneHandle(
- Z, Double::New(builder_->ReadDouble(), Heap::kOld)); // read value.
+ Z, Double::New(H.DartString(builder_->ReadStringReference()),
+ Heap::kOld)); // read string reference.
*simple_value_ = H.Canonicalize(*simple_value_);
return true;
case kTrueLiteral:
diff --git a/runtime/vm/mirrors_api_impl.cc b/runtime/vm/mirrors_api_impl.cc
deleted file mode 100644
index fdbad30..0000000
--- a/runtime/vm/mirrors_api_impl.cc
+++ /dev/null
@@ -1,344 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#include "include/dart_mirrors_api.h"
-
-#include "platform/assert.h"
-#include "vm/class_finalizer.h"
-#include "vm/dart.h"
-#include "vm/dart_api_impl.h"
-#include "vm/dart_api_state.h"
-#include "vm/dart_entry.h"
-#include "vm/exceptions.h"
-#include "vm/growable_array.h"
-#include "vm/object.h"
-#include "vm/resolver.h"
-#include "vm/stack_frame.h"
-#include "vm/symbols.h"
-
-namespace dart {
-
-// Facilitate quick access to the current zone once we have the current thread.
-#define Z (T->zone())
-
-// --- Classes and Interfaces Reflection ---
-
-DART_EXPORT Dart_Handle Dart_TypeName(Dart_Handle object) {
- DARTSCOPE(Thread::Current());
- const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
- if (obj.IsType()) {
- const Class& cls = Class::Handle(Type::Cast(obj).type_class());
- return Api::NewHandle(T, cls.UserVisibleName());
- } else {
- RETURN_TYPE_ERROR(Z, object, Class / Type);
- }
-}
-
-DART_EXPORT Dart_Handle Dart_QualifiedTypeName(Dart_Handle object) {
- DARTSCOPE(Thread::Current());
- const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
- if (obj.IsType() || obj.IsClass()) {
- const Class& cls = (obj.IsType())
- ? Class::Handle(Z, Type::Cast(obj).type_class())
- : Class::Cast(obj);
- const char* str = cls.ToCString();
- if (str == NULL) {
- RETURN_NULL_ERROR(str);
- }
- CHECK_CALLBACK_STATE(T);
- return Api::NewHandle(T, String::New(str));
- } else {
- RETURN_TYPE_ERROR(Z, object, Class / Type);
- }
-}
-
-// --- Function and Variable Reflection ---
-
-// Outside of the vm, we expose setter names with a trailing '='.
-static bool HasExternalSetterSuffix(const String& name) {
- return name.CharAt(name.Length() - 1) == '=';
-}
-
-static RawString* RemoveExternalSetterSuffix(const String& name) {
- ASSERT(HasExternalSetterSuffix(name));
- return String::SubString(name, 0, name.Length() - 1);
-}
-
-DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target) {
- DARTSCOPE(Thread::Current());
- const Object& obj = Object::Handle(Z, Api::UnwrapHandle(target));
- if (obj.IsError()) {
- return target;
- }
-
- const GrowableObjectArray& names =
- GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
- Function& func = Function::Handle(Z);
- String& name = String::Handle(Z);
-
- if (obj.IsType()) {
- const Class& cls = Class::Handle(Z, Type::Cast(obj).type_class());
- const Error& error = Error::Handle(Z, cls.EnsureIsFinalized(T));
- if (!error.IsNull()) {
- return Api::NewHandle(T, error.raw());
- }
- const Array& func_array = Array::Handle(Z, cls.functions());
-
- // Some special types like 'dynamic' have a null functions list.
- if (!func_array.IsNull()) {
- for (intptr_t i = 0; i < func_array.Length(); ++i) {
- func ^= func_array.At(i);
-
- // Skip implicit getters and setters.
- if (func.kind() == RawFunction::kImplicitGetter ||
- func.kind() == RawFunction::kImplicitSetter ||
- func.kind() == RawFunction::kImplicitStaticFinalGetter ||
- func.kind() == RawFunction::kMethodExtractor ||
- func.kind() == RawFunction::kNoSuchMethodDispatcher) {
- continue;
- }
-
- name = func.UserVisibleName();
- names.Add(name);
- }
- }
- } else if (obj.IsLibrary()) {
- const Library& lib = Library::Cast(obj);
- DictionaryIterator it(lib);
- Object& obj = Object::Handle();
- while (it.HasNext()) {
- obj = it.GetNext();
- if (obj.IsFunction()) {
- func ^= obj.raw();
- name = func.UserVisibleName();
- names.Add(name);
- }
- }
- } else {
- return Api::NewError(
- "%s expects argument 'target' to be a class or library.", CURRENT_FUNC);
- }
- return Api::NewHandle(T, Array::MakeFixedLength(names));
-}
-
-DART_EXPORT Dart_Handle Dart_LookupFunction(Dart_Handle target,
- Dart_Handle function_name) {
- DARTSCOPE(Thread::Current());
- const Object& obj = Object::Handle(Z, Api::UnwrapHandle(target));
- if (obj.IsError()) {
- return target;
- }
- const String& func_name = Api::UnwrapStringHandle(Z, function_name);
- if (func_name.IsNull()) {
- RETURN_TYPE_ERROR(Z, function_name, String);
- }
-
- Function& func = Function::Handle(Z);
- String& tmp_name = String::Handle(Z);
- if (obj.IsType()) {
- const Class& cls = Class::Handle(Z, Type::Cast(obj).type_class());
-
- // Case 1. Lookup the unmodified function name.
- func = cls.LookupFunctionAllowPrivate(func_name);
-
- // Case 2. Lookup the function without the external setter suffix
- // '='. Make sure to do this check after the regular lookup, so
- // that we don't interfere with operator lookups (like ==).
- if (func.IsNull() && HasExternalSetterSuffix(func_name)) {
- tmp_name = RemoveExternalSetterSuffix(func_name);
- tmp_name = Field::SetterName(tmp_name);
- func = cls.LookupFunctionAllowPrivate(tmp_name);
- }
-
- // Case 3. Lookup the function with the getter prefix prepended.
- if (func.IsNull()) {
- tmp_name = Field::GetterName(func_name);
- func = cls.LookupFunctionAllowPrivate(tmp_name);
- }
-
- // Case 4. Lookup the function with a . appended to find the
- // unnamed constructor.
- if (func.IsNull()) {
- tmp_name = String::Concat(func_name, Symbols::Dot());
- func = cls.LookupFunctionAllowPrivate(tmp_name);
- }
- } else if (obj.IsLibrary()) {
- const Library& lib = Library::Cast(obj);
-
- // Case 1. Lookup the unmodified function name.
- func = lib.LookupFunctionAllowPrivate(func_name);
-
- // Case 2. Lookup the function without the external setter suffix
- // '='. Make sure to do this check after the regular lookup, so
- // that we don't interfere with operator lookups (like ==).
- if (func.IsNull() && HasExternalSetterSuffix(func_name)) {
- tmp_name = RemoveExternalSetterSuffix(func_name);
- tmp_name = Field::SetterName(tmp_name);
- func = lib.LookupFunctionAllowPrivate(tmp_name);
- }
-
- // Case 3. Lookup the function with the getter prefix prepended.
- if (func.IsNull()) {
- tmp_name = Field::GetterName(func_name);
- func = lib.LookupFunctionAllowPrivate(tmp_name);
- }
- } else {
- return Api::NewError(
- "%s expects argument 'target' to be a class or library.", CURRENT_FUNC);
- }
-
-#if defined(DEBUG)
- if (!func.IsNull()) {
- // We only provide access to a subset of function kinds.
- RawFunction::Kind func_kind = func.kind();
- ASSERT(func_kind == RawFunction::kRegularFunction ||
- func_kind == RawFunction::kGetterFunction ||
- func_kind == RawFunction::kSetterFunction ||
- func_kind == RawFunction::kConstructor);
- }
-#endif
- return Api::NewHandle(T, func.raw());
-}
-
-DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function) {
- DARTSCOPE(Thread::Current());
- const Function& func = Api::UnwrapFunctionHandle(Z, function);
- if (func.IsNull()) {
- RETURN_TYPE_ERROR(Z, function, Function);
- }
- return Api::NewHandle(T, func.UserVisibleName());
-}
-
-DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function) {
- DARTSCOPE(Thread::Current());
- const Function& func = Api::UnwrapFunctionHandle(Z, function);
- if (func.IsNull()) {
- RETURN_TYPE_ERROR(Z, function, Function);
- }
- if (func.IsNonImplicitClosureFunction()) {
- RawFunction* parent_function = func.parent_function();
- return Api::NewHandle(T, parent_function);
- }
- const Class& owner = Class::Handle(Z, func.Owner());
- ASSERT(!owner.IsNull());
- if (owner.IsTopLevel()) {
-// Top-level functions are implemented as members of a hidden class. We hide
-// that class here and instead answer the library.
-#if defined(DEBUG)
- const Library& lib = Library::Handle(Z, owner.library());
- if (lib.IsNull()) {
- ASSERT(owner.IsDynamicClass() || owner.IsVoidClass());
- }
-#endif
- return Api::NewHandle(T, owner.library());
- } else {
- return Api::NewHandle(T, owner.RareType());
- }
-}
-
-DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function,
- bool* is_static) {
- DARTSCOPE(Thread::Current());
- if (is_static == NULL) {
- RETURN_NULL_ERROR(is_static);
- }
- const Function& func = Api::UnwrapFunctionHandle(Z, function);
- if (func.IsNull()) {
- RETURN_TYPE_ERROR(Z, function, Function);
- }
- *is_static = func.is_static();
- return Api::Success();
-}
-
-DART_EXPORT Dart_Handle Dart_FunctionIsConstructor(Dart_Handle function,
- bool* is_constructor) {
- DARTSCOPE(Thread::Current());
- if (is_constructor == NULL) {
- RETURN_NULL_ERROR(is_constructor);
- }
- const Function& func = Api::UnwrapFunctionHandle(Z, function);
- if (func.IsNull()) {
- RETURN_TYPE_ERROR(Z, function, Function);
- }
- *is_constructor = func.kind() == RawFunction::kConstructor;
- return Api::Success();
-}
-
-DART_EXPORT Dart_Handle Dart_FunctionIsGetter(Dart_Handle function,
- bool* is_getter) {
- DARTSCOPE(Thread::Current());
- if (is_getter == NULL) {
- RETURN_NULL_ERROR(is_getter);
- }
- const Function& func = Api::UnwrapFunctionHandle(Z, function);
- if (func.IsNull()) {
- RETURN_TYPE_ERROR(Z, function, Function);
- }
- *is_getter = func.IsGetterFunction();
- return Api::Success();
-}
-
-DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function,
- bool* is_setter) {
- DARTSCOPE(Thread::Current());
- if (is_setter == NULL) {
- RETURN_NULL_ERROR(is_setter);
- }
- const Function& func = Api::UnwrapFunctionHandle(Z, function);
- if (func.IsNull()) {
- RETURN_TYPE_ERROR(Z, function, Function);
- }
- *is_setter = (func.kind() == RawFunction::kSetterFunction);
- return Api::Success();
-}
-
-// --- Libraries Reflection ---
-
-DART_EXPORT Dart_Handle Dart_LibraryName(Dart_Handle library) {
- DARTSCOPE(Thread::Current());
- const Library& lib = Api::UnwrapLibraryHandle(Z, library);
- if (lib.IsNull()) {
- RETURN_TYPE_ERROR(Z, library, Library);
- }
- const String& name = String::Handle(Z, lib.name());
- ASSERT(!name.IsNull());
- return Api::NewHandle(T, name.raw());
-}
-
-DART_EXPORT Dart_Handle Dart_LibraryGetClassNames(Dart_Handle library) {
- DARTSCOPE(Thread::Current());
- const Library& lib = Api::UnwrapLibraryHandle(Z, library);
- if (lib.IsNull()) {
- RETURN_TYPE_ERROR(Z, library, Library);
- }
-
- const GrowableObjectArray& names =
- GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
- ClassDictionaryIterator it(lib);
- Class& cls = Class::Handle(Z);
- String& name = String::Handle(Z);
- while (it.HasNext()) {
- cls = it.GetNextClass();
- name = cls.UserVisibleName();
- names.Add(name);
- }
- return Api::NewHandle(T, Array::MakeFixedLength(names));
-}
-
-// --- Closures Reflection ---
-
-DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) {
- DARTSCOPE(Thread::Current());
- const Instance& closure_obj = Api::UnwrapInstanceHandle(Z, closure);
- if (closure_obj.IsNull() || !closure_obj.IsClosure()) {
- RETURN_TYPE_ERROR(Z, closure, Instance);
- }
-
- ASSERT(ClassFinalizer::AllClassesFinalized());
-
- RawFunction* rf = Closure::Cast(closure_obj).function();
- return Api::NewHandle(T, rf);
-}
-
-} // namespace dart
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
index 92e1838..10795eb 100644
--- a/runtime/vm/unit_test.cc
+++ b/runtime/vm/unit_test.cc
@@ -266,7 +266,7 @@
Dart_KernelCompilationResult compilation_result = Dart_CompileSourcesToKernel(
url, FLAG_strong ? platform_strong_dill : platform_dill,
FLAG_strong ? platform_strong_dill_size : platform_dill_size,
- sourcefiles_count, sourcefiles, incrementally);
+ sourcefiles_count, sourcefiles, incrementally, NULL);
if (compilation_result.status != Dart_KernelCompilationStatus_Ok) {
char* result =
diff --git a/samples-dev/swarm/swarm_ui_lib/touch/TouchUtil.dart b/samples-dev/swarm/swarm_ui_lib/touch/TouchUtil.dart
index 0a841b7..dc12c0e 100644
--- a/samples-dev/swarm/swarm_ui_lib/touch/TouchUtil.dart
+++ b/samples-dev/swarm/swarm_ui_lib/touch/TouchUtil.dart
@@ -359,4 +359,12 @@
/*InputDevice*/ get sourceDevice {
throw new UnimplementedError();
}
+
+ bool get composed {
+ throw new UnimplementedError();
+ }
+
+ List<EventTarget> composedPath() {
+ throw new UnimplementedError();
+ }
}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 766a114..40dfafb 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -53,7 +53,6 @@
#.............templates/
# ....include/
# ......dart_api.h
-# ......dart_mirrors_api.h
# ......dart_native_api.h
# ......dart_tools_api.h
# ....lib/
@@ -761,7 +760,6 @@
visibility = [ ":create_common_sdk" ]
sources = [
"../runtime/include/dart_api.h",
- "../runtime/include/dart_mirrors_api.h",
"../runtime/include/dart_native_api.h",
"../runtime/include/dart_tools_api.h",
]
diff --git a/sdk/lib/_internal/js_runtime/lib/js_rti.dart b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
index 6fe6853..9a0627c 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_rti.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
@@ -630,11 +630,16 @@
}
/// Checks that the type represented by [subtype] is a subtype of [supertype].
-/// If not a type error with [message] is thrown.
+/// If not a type error is thrown using [prefix], [infix], [suffix] and the
+/// runtime types [subtype] and [supertype] to generate the error message.
///
/// Called from generated code.
-assertIsSubtype(var subtype, var supertype, String message) {
+assertIsSubtype(
+ var subtype, var supertype, String prefix, String infix, String suffix) {
if (!isSubtype(subtype, supertype)) {
+ String message = "TypeError: "
+ "$prefix${runtimeTypeToString(subtype)}$infix"
+ "${runtimeTypeToString(supertype)}$suffix";
throwTypeError(message);
}
}
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index a8cc728..6296cde 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -1487,14 +1487,10 @@
LibTest/typed_data/Float32x4List/Float32x4List.view_A06_t01: Fail # co19-roll r587: Please triage this failure
LibTest/typed_data/Int32x4/operator_OR_A01_t01: RuntimeError # Issue 7728, timer not supported in jsshell
-[ $compiler == dart2js && $runtime == d8 && $system == windows ]
-LibTest/async/DeferredLibrary/*: Skip # Issue 17458
-
[ $compiler == dart2js && $runtime == d8 && $checked && $fast_startup && $minified ]
Language/Classes/Constructors/Factories/function_type_t02: RuntimeError
Language/Expressions/Instance_Creation/New/redirecting_factory_constructor_t02: RuntimeError
Language/Generics/malformed_t02: Crash
-LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01: RuntimeError
[ $compiler == dart2js && $runtime == d8 && $fast_startup ]
LibTest/isolate/Isolate/spawn_A04_t04: Pass # Technically fails, but since sync-async was turned on, this test completes before it fails. Underlying issue: #27558
@@ -6939,15 +6935,10 @@
LibTest/core/Uri/Uri_A06_t03: Slow, Pass # Please triage this failure
LibTest/math/Point/operator_mult_A02_t01: RuntimeError # Issue 1533
-[ $compiler == dart2js && $checked && $fast_startup && $fasta && $minified ]
-Language/Libraries_and_Scripts/Imports/deferred_import_t02: RuntimeError
-
[ $compiler == dart2js && $checked && $fasta && $host_checked ]
Language/Classes/Constructors/Factories/function_type_t02: RuntimeError
Language/Expressions/Instance_Creation/New/redirecting_factory_constructor_t02: RuntimeError
Language/Generics/malformed_t02: Crash
-Language/Libraries_and_Scripts/Imports/deferred_import_t02: RuntimeError
-LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01: RuntimeError
[ $compiler == dart2js && !$checked && $enable_asserts ]
Language/Statements/Assert/execution_t01: SkipByDesign # Unspec'd feature.
diff --git a/tests/compiler/dart2js/generic_methods/generic_method_test.dart b/tests/compiler/dart2js/generic_methods/generic_method_test.dart
index 1574ab9..14ccaa6 100644
--- a/tests/compiler/dart2js/generic_methods/generic_method_test.dart
+++ b/tests/compiler/dart2js/generic_methods/generic_method_test.dart
@@ -113,6 +113,8 @@
new Class2().method5<int>(0);
new Class3().method6<int>(0);
dynamic c3 = args != null ? new Class3() : new Class2();
+ // TODO(johnniwinther): Expected bounds should be `dynamic` when CFE supports
+ // instantiate-to-bound.
c3.method6(0); // Missing type arguments.
try {
dynamic c2 = args == null ? new Class3() : new Class2();
@@ -160,8 +162,8 @@
"foo" is int = false
Class3.method6:
-0 is dynamic = true
-"foo" is dynamic = true
+0 is Object = true
+"foo" is Object = true
Class2.method6:
0 is int = true
diff --git a/tests/compiler/dart2js/kernel/compiler_helper.dart b/tests/compiler/dart2js/kernel/compiler_helper.dart
index d59c303..7c5101a 100644
--- a/tests/compiler/dart2js/kernel/compiler_helper.dart
+++ b/tests/compiler/dart2js/kernel/compiler_helper.dart
@@ -123,8 +123,8 @@
print(out);
if (expectedOutput != null) {
Expect.equals(0, runResult.exitCode);
- Expect.stringEquals(
- expectedOutput, runResult.stdout.replaceAll('\r\n', '\n'));
+ Expect.stringEquals(expectedOutput.trim(),
+ runResult.stdout.replaceAll('\r\n', '\n').trim());
}
return result.compiler;
}
diff --git a/tests/compiler/dart2js/rti/bound_check_test.dart b/tests/compiler/dart2js/rti/bound_check_test.dart
new file mode 100644
index 0000000..74cf201
--- /dev/null
+++ b/tests/compiler/dart2js/rti/bound_check_test.dart
@@ -0,0 +1,89 @@
+// 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:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
+import '../kernel/compiler_helper.dart';
+
+const String SOURCE1 = r'''
+import 'package:expect/expect.dart';
+
+class A {}
+class B {}
+
+method1<T extends A>() {}
+
+class C {
+ method2<T, S extends T>() {}
+}
+
+main() {
+ bool printError(e) {
+ print(e); return true;
+ }
+
+ method3<T extends B>() {}
+
+ dynamic m1 = method1;
+ dynamic m2 = new C().method2;
+ dynamic m3 = method3;
+
+ m1<A>();
+ Expect.throws(() => m1<B>(), printError);
+ m2<A, A>();
+ Expect.throws(() => m2<B, A>(), printError);
+ m3<B>();
+ Expect.throws(() => m3<A>(), printError);
+}
+
+''';
+
+const String OUTPUT1 = r'''
+TypeError: The type argument 'B' is not a subtype of the type variable bound 'A' of type variable 'T' in 'method1'.
+TypeError: The type argument 'A' is not a subtype of the type variable bound 'B' of type variable 'S' in 'method2'.
+TypeError: The type argument 'A' is not a subtype of the type variable bound 'B' of type variable 'T' in 'call'.
+''';
+
+const String SOURCE2 = r'''
+import 'package:expect/expect.dart';
+
+class A {}
+class B {}
+
+class C<T extends A>{
+}
+
+class D<T> extends C<T> {}
+
+main() {
+ bool printError(e) {
+ print(e); return true;
+ }
+
+ new C<A>();
+ Expect.throws(() => new C<B>(), printError);
+ new D<A>();
+ Expect.throws(() => new D<B>(), printError);
+}
+''';
+
+const String OUTPUT2 = r'''
+TypeError: Can't create an instance of malbounded type 'C<B>': 'B' is not a subtype of bound 'A' type variable 'C.T' of type 'C<C.T>'.
+TypeError: Can't create an instance of malbounded type 'D<B>': 'B' is not a subtype of bound 'A' type variable 'C.T' of type 'C<C.T>' on the supertype 'C<B>' of 'D<B>'.
+''';
+
+main(List<String> args) {
+ asyncTest(() async {
+ await runWithD8(memorySourceFiles: {
+ 'main.dart': SOURCE1
+ }, options: [
+ Flags.strongMode,
+ ], expectedOutput: OUTPUT1, printJs: args.contains('-v'));
+ await runWithD8(
+ memorySourceFiles: {'main.dart': SOURCE2},
+ options: [Flags.enableCheckedMode],
+ expectedOutput: OUTPUT2,
+ printJs: args.contains('-v'));
+ });
+}
diff --git a/tests/compiler/dart2js/rti/data/dynamic_not2_strong.dart b/tests/compiler/dart2js/rti/data/dynamic_not2_strong.dart
index 55caaec..10a4018 100644
--- a/tests/compiler/dart2js/rti/data/dynamic_not2_strong.dart
+++ b/tests/compiler/dart2js/rti/data/dynamic_not2_strong.dart
@@ -2,7 +2,6 @@
// 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.
-/*!strong.class: A:*/
/*strong.class: A:explicit=[A]*/
class A {
/*element: A.instanceMethod:deps=[B.instanceMethod]*/
@@ -10,6 +9,7 @@
}
class B {
+ /*element: B.instanceMethod:*/
instanceMethod<T>(A a, t) => a.instanceMethod<T>(t);
}
diff --git a/tests/compiler/dart2js/rti/data/dynamic_not_closure_strong.dart b/tests/compiler/dart2js/rti/data/dynamic_not_closure_strong.dart
index 601a0d6..03451cd 100644
--- a/tests/compiler/dart2js/rti/data/dynamic_not_closure_strong.dart
+++ b/tests/compiler/dart2js/rti/data/dynamic_not_closure_strong.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
class A {
+ /*element: A.instanceMethod:*/
instanceMethod<T>(t) => t;
}
diff --git a/tests/compiler/dart2js/rti/data/dynamic_not_strong.dart b/tests/compiler/dart2js/rti/data/dynamic_not_strong.dart
index 5e81376..9a5b7d3 100644
--- a/tests/compiler/dart2js/rti/data/dynamic_not_strong.dart
+++ b/tests/compiler/dart2js/rti/data/dynamic_not_strong.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
class A {
+ /*element: A.instanceMethod:*/
instanceMethod<T>(t) => t;
}
diff --git a/tests/compiler/dart2js/rti/data/generic_bounds_strong.dart b/tests/compiler/dart2js/rti/data/generic_bounds_strong.dart
new file mode 100644
index 0000000..e26c0a2
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/generic_bounds_strong.dart
@@ -0,0 +1,78 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+/*strong.class: Class1a:explicit=[Class1a]*/
+class Class1a {}
+
+class Class1b extends Class1a {}
+
+/*strong.class: Class2a:explicit=[Class2a<num>],needsArgs*/
+class Class2a<T> {}
+
+class Class2b<T> extends Class2a<T> {}
+
+/*strong.element: method1:needsArgs,selectors=[Selector(call, call, arity=0, types=1)]*/
+method1<T extends Class1a>() => null;
+
+/*strong.element: method2:needsArgs,selectors=[Selector(call, call, arity=0, types=1)]*/
+method2<T extends Class2a<num>>() => null;
+
+method3<T>() => null;
+
+class Class3 {
+ /*strong.element: Class3.method4:needsArgs,selectors=[Selector(call, method4, arity=0, types=1)]*/
+ method4<T extends Class1a>() => null;
+
+ /*strong.element: Class3.method5:needsArgs,selectors=[Selector(call, method5, arity=0, types=1)]*/
+ method5<T extends Class2a<num>>() => null;
+
+ method6<T>() => null;
+}
+
+main() {
+ /*strong.needsArgs,selectors=[Selector(call, call, arity=0, types=1)]*/
+ method7<T extends Class1a>() => null;
+
+ /*strong.needsArgs,selectors=[Selector(call, call, arity=0, types=1)]*/
+ method8<T extends Class2a<num>>() => null;
+
+ /**/
+ method9<T>() => null;
+
+ dynamic f1 = method1;
+ dynamic f2 = method2;
+ dynamic f3 = method3;
+ dynamic c3 = new Class3();
+ dynamic f7 = method7;
+ dynamic f8 = method8;
+ dynamic f9 = method9;
+
+ f1<Class1b>();
+ f2<Class2b<int>>();
+ f3<int>();
+ c3.method4<Class1b>();
+ c3.method5<Class2b<int>>();
+ c3.method6<int>();
+ f7<Class1b>();
+ f8<Class2b<int>>();
+ f9<int>();
+
+ if (typeAssertionsEnabled) {
+ Expect.throws(/*needsSignature*/ () => f1<Class2a<num>>());
+ Expect.throws(/*needsSignature*/ () => f2<Class2b<String>>());
+ Expect.throws(/*needsSignature*/ () => c3.method4<Class2a<num>>());
+ Expect.throws(/*needsSignature*/ () => c3.method5<Class2b<String>>());
+ Expect.throws(/*needsSignature*/ () => f7<Class2a<num>>());
+ Expect.throws(/*needsSignature*/ () => f8<Class2b<String>>());
+ } else {
+ f1<Class2a<num>>();
+ f2<Class2b<String>>();
+ c3.method4<Class2a<num>>();
+ c3.method5<Class2b<String>>();
+ f7<Class2a<num>>();
+ f8<Class2b<String>>();
+ }
+}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_async.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_async.dart
new file mode 100644
index 0000000..b4ffec3
--- /dev/null
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_async.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+main() {
+ // This call is on the stack when the error is thrown.
+ /*1:main*/ test();
+}
+
+@NoInline()
+test() async /*2:test*/ {
+ /*3:test*/ throw '>ExceptionMarker<';
+}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart
new file mode 100644
index 0000000..424a063
--- /dev/null
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+main() {
+ // This call is on the stack when the error is thrown.
+ /*1:main*/ test1();
+}
+
+@NoInline()
+test1() async /*2:test1*/ {
+ // This call is on the stack when the error is thrown.
+ await /*3:test1*/ test2();
+}
+
+@NoInline()
+test2() async /*4:test2*/ {
+ /*5:test2*/ throw '>ExceptionMarker<';
+}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
new file mode 100644
index 0000000..50035b4
--- /dev/null
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+main() {
+ /*1:main*/ test();
+}
+
+test() async /*ast.2:test*/ {
+ // TODO(johnniwinther): Investigate why kernel doesn't point to the body
+ // start brace.
+ // ignore: UNUSED_LOCAL_VARIABLE
+ var /*kernel.2:test*/ c = new /*3:test*/ Class();
+}
+
+class Class {
+ @NoInline()
+ /*4:Class*/ Class() {
+ /*5:Class*/ throw '>ExceptionMarker<';
+ }
+}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart
new file mode 100644
index 0000000..120b60c
--- /dev/null
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+main() {
+ /*1:main*/ test1();
+}
+
+@NoInline()
+test1() async /*2:test1*/ {
+ /*3:test1*/ test2();
+}
+
+@NoInline()
+test2() {
+ /*4:test2*/ throw '>ExceptionMarker<';
+}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
index bf86d5d..1a815d9 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
@@ -108,6 +108,7 @@
/// Lines allowed after the intended stack trace. Typically from the event
/// queue.
const List<LineException> afterExceptions = const [
+ const LineException('_asyncStartSync', 'async_patch.dart'),
const LineException('_wrapJsFunctionForAsync', 'async_patch.dart'),
const LineException(
'_wrapJsFunctionForAsync.<anonymous function>', 'async_patch.dart'),
@@ -130,6 +131,7 @@
const LineException('invokeClosure.<anonymous function>', 'js_helper.dart'),
const LineException('_IsolateContext.eval', 'isolate_helper.dart'),
const LineException('_callInIsolate', 'isolate_helper.dart'),
+ const LineException('startRootIsolate', 'isolate_helper.dart'),
const LineException('invokeClosure', 'js_helper.dart'),
const LineException('convertDartClosureToJS', 'js_helper.dart'),
];
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 1dc91cd..5dce5f5 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -58,9 +58,6 @@
[ $compiler == dart2js && $checked ]
variable_type_test/01: Fail, OK
variable_type_test/03: Fail, OK
-32997a_test: SkipByDesign # --omit-implicit-checks shouldn't be used together
-32997b_test/none: SkipByDesign # --omit-implicit-checks shouldn't be used together
-32997b_test/01: SkipByDesign # --omit-implicit-checks shouldn't be used together
[ $compiler == dart2js && $checked && $fasta ]
deferred/deferred_mirrors1_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
diff --git a/tests/compiler/dart2js_extra/generic_bounds_test.dart b/tests/compiler/dart2js_extra/generic_bounds_test.dart
new file mode 100644
index 0000000..0b9cacb
--- /dev/null
+++ b/tests/compiler/dart2js_extra/generic_bounds_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.
+
+// dart2jsOptions=--strong
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class B extends A {}
+
+class C {}
+
+class D<T> {}
+
+class E<T> extends D<T> {}
+
+class F<T> {}
+
+void f1<T extends A>() {
+ print('f1<$T>');
+}
+
+void f2<S, T extends D<S>>() {
+ print('f2<$S,$T>');
+}
+
+main() {
+ dynamic f = f1;
+ f<A>();
+ f<B>();
+ Expect.throws(() => f<C>(), (e) {
+ print(e);
+ return true;
+ });
+ f();
+ f = f2;
+ f<A, D<A>>();
+ f<A, E<A>>();
+ Expect.throws(() => f<A, F<A>>(), (e) {
+ print(e);
+ return true;
+ });
+ f();
+}
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index 6641868..6c66c0c 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -16,6 +16,7 @@
date_time11_test: RuntimeError, Pass # Fails when US is on winter time, issue 31285.
iterable_where_type_test: RuntimeError # issue 31718
list_unmodifiable_test: Pass, RuntimeError # Issue 28712
+apply_generic_function_test: RuntimeError # Issue 32691
[ $compiler != dartdevc ]
error_stack_trace_test/static: MissingCompileTimeError
@@ -328,6 +329,9 @@
[ $compiler != dartk && $runtime == vm && $checked ]
apply_test/01: RuntimeError
+[ $compiler == dartkp && $mode == debug && $runtime == dart_precompiled && $strong ]
+growable_list_test: Crash
+
[ $compiler == dartkp && $runtime == dart_precompiled && $strong ]
apply_generic_function_test: RuntimeError
iterable_fold_test/02: RuntimeError
diff --git a/tests/language_2/function_call_generic_test.dart b/tests/language_2/function_call_generic_test.dart
index 0d90f52..b98584e 100644
--- a/tests/language_2/function_call_generic_test.dart
+++ b/tests/language_2/function_call_generic_test.dart
@@ -1,7 +1,6 @@
// 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.
-// dart2jsOptions=-Ddart.isdart2js=true
import "package:expect/expect.dart";
@@ -22,10 +21,11 @@
print('a: $expected');
print('b: $actual');
if (((actual[0] == Object && expected[0] == dynamic) ||
- (actual[0] == dynamic && expected[0] == Object)) &&
- !const bool.fromEnvironment('dart.isdart2js')) {
+ (actual[0] == dynamic && expected[0] == Object))) {
// TODO(32483): dartdevk sometimes defaults type to 'Object' when 'dynamic'
// is required. Remove this hack when fixed.
+ // TODO(31581): dart2js needs instantiate-to-bound to generic 'dynamic'
+ // instead of 'Object'.
actual = actual.toList()..[0] = expected[0];
print('b*: $actual');
}
diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status
index 7bf5e3c..790afc0 100644
--- a/tests/language_2/language_2_analyzer.status
+++ b/tests/language_2/language_2_analyzer.status
@@ -100,15 +100,7 @@
parameter_initializer4_negative_test: CompileTimeError
parameter_initializer6_negative_test: CompileTimeError
part_refers_to_core_library_test/01: MissingCompileTimeError # Issue 29709
-prefix11_negative_test: Fail # Issue 11964
-prefix12_negative_test: Fail # Issue 11962
-prefix1_negative_test: Fail # Issue 11962
-prefix2_negative_test: Fail # Issue 11962
-prefix3_negative_test: Fail # Issue 12191
-prefix4_negative_test: Fail # Issue 11962
-prefix5_negative_test: Fail # Issue 11962
-prefix7_negative_test: CompileTimeError
-prefix8_negative_test: Fail # Issue 11964
+prefix_shadow_test/01: MissingCompileTimeError # Issue 33005
private_member1_negative_test: Fail # Issue 14021
private_member2_negative_test: Fail # Issue 14021
private_member3_negative_test: Fail # Issue 14021
@@ -1161,10 +1153,6 @@
override_inheritance_method_test/29: CompileTimeError
parameter_initializer_test: CompileTimeError
parser_quirks_test: CompileTimeError
-prefix13_negative_test: CompileTimeError, OK
-prefix15_negative_test: CompileTimeError, OK
-prefix18_negative_test: CompileTimeError, OK
-prefix6_negative_test: CompileTimeError, OK
regress_22976_test/01: CompileTimeError
regress_22976_test/02: CompileTimeError
regress_22976_test/none: CompileTimeError
@@ -1566,13 +1554,17 @@
partial_tearoff_instantiation_test/08: MissingCompileTimeError
positional_parameters_type_test/01: MissingCompileTimeError
positional_parameters_type_test/02: MissingCompileTimeError
-prefix13_negative_test: CompileTimeError, OK
-prefix15_negative_test: CompileTimeError, OK
prefix16_test/00: MissingCompileTimeError
prefix16_test/01: MissingCompileTimeError
-prefix18_negative_test: CompileTimeError, OK
prefix22_test/00: MissingCompileTimeError
prefix23_test/00: MissingCompileTimeError
+prefix_import_collision_test/01: MissingCompileTimeError
+prefix_shadow_test/02: MissingCompileTimeError
+prefix_transitive_import_prefix_test/01: MissingCompileTimeError
+prefix_transitive_import_prefix_test/02: MissingCompileTimeError
+prefix_transitive_import_prefix_test/03: MissingCompileTimeError
+prefix_transitive_import_test/01: MissingCompileTimeError
+prefix_transitive_import_test/02: MissingCompileTimeError
private_access_test/01: MissingCompileTimeError
private_access_test/02: MissingCompileTimeError
private_access_test/03: MissingCompileTimeError
@@ -1733,4 +1725,5 @@
unresolved_default_constructor_test/01: MissingCompileTimeError
unresolved_top_level_method_test: MissingCompileTimeError
unresolved_top_level_var_test: MissingCompileTimeError
+variable_shadow_class_test/01: MissingCompileTimeError
vm/type_vm_test: StaticWarning
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index 646ea75..9a340bb 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -278,9 +278,7 @@
constructor_redirect2_negative_test: Crash # Stack Overflow
constructor_redirect2_test/01: MissingCompileTimeError
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
-covariance_type_parameter_test/01: Crash # NoSuchMethodError: The method 'hasSubclass' was called on null.
covariance_type_parameter_test/02: Crash # NoSuchMethodError: The method 'hasSubclass' was called on null.
-covariance_type_parameter_test/03: Crash # NoSuchMethodError: The method 'hasSubclass' was called on null.
covariant_override/runtime_check_test: RuntimeError
covariant_subtyping_test: RuntimeError
cyclic_constructor_test/01: Crash # Stack Overflow
@@ -633,9 +631,7 @@
constructor_redirect1_negative_test/01: Crash # Stack Overflow
constructor_redirect2_negative_test: Crash # Stack Overflow
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
-covariance_type_parameter_test/01: RuntimeError
covariance_type_parameter_test/02: RuntimeError
-covariance_type_parameter_test/03: RuntimeError
covariant_override/tear_off_type_test: RuntimeError
covariant_subtyping_test: Crash # Unsupported operation: Unsupported type parameter type node E.
cyclic_constructor_test/01: Crash # Stack Overflow
@@ -1053,9 +1049,7 @@
constructor_redirect1_negative_test/01: Crash # Stack Overflow
constructor_redirect2_negative_test: Crash # Issue 30856
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
-covariance_type_parameter_test/01: RuntimeError
covariance_type_parameter_test/02: RuntimeError
-covariance_type_parameter_test/03: RuntimeError
covariant_override/tear_off_type_test: RuntimeError
covariant_subtyping_test: RuntimeError
cyclic_constructor_test/01: Crash # Issue 30856
@@ -1640,9 +1634,7 @@
constructor_redirect1_negative_test/01: Crash # Stack Overflow
constructor_redirect2_negative_test: Crash # Issue 30856
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
-covariance_type_parameter_test/01: RuntimeError
covariance_type_parameter_test/02: RuntimeError
-covariance_type_parameter_test/03: RuntimeError
covariant_override/tear_off_type_test: RuntimeError
covariant_subtyping_test: RuntimeError
cyclic_constructor_test/01: Crash # Issue 30856
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index c407314..ed5dedb 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -98,9 +98,6 @@
issue32353_test: RuntimeError
label_test: RuntimeError
left_shift_test: RuntimeError # Ints and doubles are unified.
-library_env_test/has_io_support: RuntimeError # Intended to fail, bool.fromEnvironment("dart.library.async") is false
-library_env_test/has_mirror_support: RuntimeError # Intended to fail, bool.fromEnvironment("dart.library.async") is false
-library_env_test/has_no_html_support: RuntimeError # Intended to fail, bool.fromEnvironment("dart.library.async") is false
method_override_test: CompileTimeError # Negative test
mixin_super_2_test/01: MissingCompileTimeError
mixin_super_2_test/03: MissingCompileTimeError
@@ -143,7 +140,7 @@
override_inheritance_method_test/29: CompileTimeError
parameter_initializer_test: CompileTimeError
part_refers_to_core_library_test/01: Crash
-prefix10_negative_test: Fail # Issue 29920
+prefix_shadow_test/01: MissingCompileTimeError # Issue 33005
regress_23089_test: MissingCompileTimeError
regress_23408_test: CompileTimeError
regress_24283_test: RuntimeError # Intended to fail, requires 64-bit numbers.
@@ -424,9 +421,6 @@
issue31596_super_test/03: CompileTimeError
issue31596_super_test/04: MissingCompileTimeError
issue31596_super_test/05: RuntimeError
-library_env_test/has_io_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
-library_env_test/has_mirror_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
-library_env_test/has_no_html_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
malbounded_instantiation_test/01: MissingCompileTimeError
malbounded_instantiation_test/02: MissingCompileTimeError
malbounded_instantiation_test/03: MissingCompileTimeError
@@ -716,10 +710,9 @@
issue23244_test: RuntimeError # Issue 29920; Uncaught Unsupported operation: only top-level functions can be spawned.
least_upper_bound_expansive_test/none: RuntimeError # 30908; Uncaught RangeError: Maximum call stack size exceeded
left_shift_test: RuntimeError # Ints and doubles are unified.; Expect.equals(expected: <1>, actual: <-4294967295>) fails.
-library_env_test/has_html_support: RuntimeError # Issue 30907; Unsupported operation: bool.fromEnvironment can only be used as a const constructor
-library_env_test/has_no_io_support: RuntimeError # Issue 30907; Unsupported operation: bool.fromEnvironment can only be used as a const constructor
-library_env_test/has_no_mirror_support: RuntimeError # Issue 30907; Unsupported operation: bool.fromEnvironment can only be used as a const constructor
-library_env_test/none: RuntimeError # Issue 30907; Unsupported operation: bool.fromEnvironment can only be used as a const constructor
+library_env_test/has_io_support: RuntimeError, OK # Intended to fail, bool.fromEnvironment("dart.library.async") is false
+library_env_test/has_mirror_support: RuntimeError, OK # Intended to fail, bool.fromEnvironment("dart.library.async") is false
+library_env_test/has_no_html_support: RuntimeError, OK # Intended to fail, bool.fromEnvironment("dart.library.async") is false
local_function2_test/none: RuntimeError # ReferenceError: TToNull is not defined
local_function3_test/none: RuntimeError # Expect.equals(expected: <true>, actual: <false>) fails.
local_function_test/none: RuntimeError # Expect.equals(expected: <true>, actual: <false>) fails.
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 611f8e8..b58c2c8 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -727,6 +727,7 @@
[ $compiler == dartkp && $mode == debug && $runtime == dart_precompiled && $strong ]
const_instance_field_test/01: Crash # Issue 32326.
external_test/13: Crash
+extract_type_arguments_test: Crash # Issue 33029
type_promotion_functions_test/05: Pass
type_promotion_functions_test/06: Pass
type_promotion_functions_test/07: Pass
@@ -1308,6 +1309,15 @@
override_inheritance_no_such_method_test/09: MissingCompileTimeError
override_inheritance_no_such_method_test/10: MissingCompileTimeError
override_inheritance_no_such_method_test/12: MissingCompileTimeError
+prefix_import_collision_test/01: MissingCompileTimeError
+prefix_shadow_test/01: MissingCompileTimeError
+prefix_shadow_test/02: MissingCompileTimeError
+prefix_transitive_import_prefix_test/01: MissingCompileTimeError
+prefix_transitive_import_prefix_test/02: MissingCompileTimeError
+prefix_transitive_import_prefix_test/03: MissingCompileTimeError
+prefix_transitive_import_test/01: MissingCompileTimeError
+prefix_transitive_import_test/02: MissingCompileTimeError
+variable_shadow_class_test/01: MissingCompileTimeError
[ $fasta && $strong ]
compile_time_constant_k_test/01: MissingCompileTimeError
@@ -1938,20 +1948,10 @@
partial_tearoff_instantiation_test/03: MissingCompileTimeError
positional_parameters_type_test/01: MissingCompileTimeError
positional_parameters_type_test/02: MissingCompileTimeError
-prefix10_negative_test: Fail
-prefix11_negative_test: Fail
-prefix12_negative_test: Fail
prefix16_test/00: MissingCompileTimeError
prefix16_test/01: MissingCompileTimeError
-prefix1_negative_test: Fail
prefix22_test/00: MissingCompileTimeError
prefix23_test/00: MissingCompileTimeError
-prefix2_negative_test: Fail
-prefix3_negative_test: Fail
-prefix4_negative_test: Fail
-prefix5_negative_test: Fail
-prefix6_negative_test: Fail
-prefix8_negative_test: Fail
private_access_test/01: MissingCompileTimeError
private_access_test/02: MissingCompileTimeError
private_access_test/03: MissingCompileTimeError
diff --git a/tests/language_2/language_2_spec_parser.status b/tests/language_2/language_2_spec_parser.status
index 7788992..1504f8f 100644
--- a/tests/language_2/language_2_spec_parser.status
+++ b/tests/language_2/language_2_spec_parser.status
@@ -55,20 +55,6 @@
parameter_initializer3_negative_test: Skip # Negative, not syntax.
parameter_initializer4_negative_test: Skip # Negative, not syntax.
parameter_initializer6_negative_test: Skip # Negative, not syntax.
-prefix10_negative_test: Skip # Negative, not syntax.
-prefix11_negative_test: Skip # Negative, not syntax.
-prefix12_negative_test: Skip # Negative, not syntax.
-prefix13_negative_test: Skip # Negative, not syntax.
-prefix15_negative_test: Skip # Negative, not syntax.
-prefix18_negative_test: Fail # Negative, uses `lib1.invalid` as library prefix.
-prefix1_negative_test: Skip # Negative, not syntax.
-prefix2_negative_test: Skip # Negative, not syntax.
-prefix3_negative_test: Skip # Negative, not syntax.
-prefix4_negative_test: Skip # Negative, not syntax.
-prefix5_negative_test: Skip # Negative, not syntax.
-prefix6_negative_test: Skip # Negative, not syntax.
-prefix7_negative_test: Skip # Negative, not syntax.
-prefix8_negative_test: Skip # Negative, not syntax.
private_member1_negative_test: Skip # Negative, not syntax.
private_member2_negative_test: Skip # Negative, not syntax.
private_member3_negative_test: Skip # Negative, not syntax.
diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status
index 8b95fdf9..b86d7b2 100644
--- a/tests/language_2/language_2_vm.status
+++ b/tests/language_2/language_2_vm.status
@@ -847,6 +847,14 @@
prefix16_test/01: MissingCompileTimeError
prefix22_test/00: MissingCompileTimeError
prefix23_test/00: MissingCompileTimeError
+prefix_import_collision_test/01: MissingCompileTimeError
+prefix_shadow_test/01: MissingCompileTimeError
+prefix_shadow_test/02: MissingCompileTimeError
+prefix_transitive_import_prefix_test/01: MissingCompileTimeError
+prefix_transitive_import_prefix_test/02: MissingCompileTimeError
+prefix_transitive_import_prefix_test/03: MissingCompileTimeError
+prefix_transitive_import_test/01: MissingCompileTimeError
+prefix_transitive_import_test/02: MissingCompileTimeError
private_access_test/01: MissingCompileTimeError
private_access_test/02: MissingCompileTimeError
private_access_test/03: MissingCompileTimeError
@@ -1031,6 +1039,7 @@
unresolved_in_factory_test: MissingCompileTimeError
unresolved_top_level_method_test: MissingCompileTimeError
unresolved_top_level_var_test: MissingCompileTimeError
+variable_shadow_class_test/01: MissingCompileTimeError
[ $compiler != dartk && $runtime == vm && $checked ]
call_method_as_cast_test/06: RuntimeError
diff --git a/tests/language_2/library2.dart b/tests/language_2/library2.dart
index 5bdf267..219303f 100644
--- a/tests/language_2/library2.dart
+++ b/tests/language_2/library2.dart
@@ -1,9 +1,6 @@
// 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
// BSD-style license that can be found in the LICENSE file.
-//
-
-library library2.dart;
var foo;
var foo1 = 0;
diff --git a/tests/language_2/prefix10_negative_test.dart b/tests/language_2/prefix10_negative_test.dart
deleted file mode 100644
index c660513..0000000
--- a/tests/language_2/prefix10_negative_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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
-// BSD-style license that can be found in the LICENSE file.
-//
-
-// Type parameters can shadow a library prefix.
-
-library Prefix10NegativeTest.dart;
-
-import "package:expect/expect.dart";
-import "library10.dart" as T;
-
-class P<T> {
- P.named(T this.fld);
- T fld;
- main() {
- var i = new T.Library10(10); // This should be an error.
- Expect.equals(10, i.fld);
- }
-}
-
-main() {
- var i = new P<int>.named(10);
- i.main();
-}
diff --git a/tests/language_2/prefix12_negative_test.dart b/tests/language_2/prefix12_negative_test.dart
deleted file mode 100644
index 8c2ba21..0000000
--- a/tests/language_2/prefix12_negative_test.dart
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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
-// BSD-style license that can be found in the LICENSE file.
-//
-// Symbols in libraries imported by the prefixed library should not be visible
-
-library Prefix12NegativeTest.dart;
-
-import "library12.dart" as lib12;
-
-main() {
- var obj = lib12.top_level11; // Error, variable should not be visible
-}
diff --git a/tests/language_2/prefix15_negative_test.dart b/tests/language_2/prefix15_negative_test.dart
deleted file mode 100644
index 156c512..0000000
--- a/tests/language_2/prefix15_negative_test.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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
-// BSD-style license that can be found in the LICENSE file.
-//
-// Unresolved symbols should be reported as an error.
-
-library Prefix15NegativeTest.dart;
-
-import "library12.dart" as lib12;
-
-class myClass implements lib12.Library13 {
- myClass(int this.fld) : super(0);
- int fld;
-}
-
-main() {
- new myClass(1);
-}
diff --git a/tests/language_2/prefix1_negative_test.dart b/tests/language_2/prefix1_negative_test.dart
deleted file mode 100644
index ea6ae23..0000000
--- a/tests/language_2/prefix1_negative_test.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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
-// BSD-style license that can be found in the LICENSE file.
-//
-
-library Prefix1NegativeTest.dart;
-
-import "library1.dart";
-
-class Prefix1NegativeTest {
- static Main() {
- // This is a syntax error as library1 was not imported with a prefix.
- return library1.foo;
- }
-}
-
-main() {
- Prefix1NegativeTest.Main();
-}
diff --git a/tests/language_2/prefix2_negative_test.dart b/tests/language_2/prefix2_negative_test.dart
deleted file mode 100644
index 05cf8c3..0000000
--- a/tests/language_2/prefix2_negative_test.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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
-// BSD-style license that can be found in the LICENSE file.
-//
-
-library Prefix2NegativeTest.dart;
-
-import "library2.dart" as lib2;
-
-class Prefix2NegativeTest {
- static Main() {
- // This is a syntax error as multiple prefixes are not possible.
- return lib2.Library2.main() + lib2.lib1.foo;
- }
-}
-
-main() {
- Prefix2NegativeTest.Main();
-}
diff --git a/tests/language_2/prefix4_negative_test.dart b/tests/language_2/prefix4_negative_test.dart
deleted file mode 100644
index 5063274..0000000
--- a/tests/language_2/prefix4_negative_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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
-// BSD-style license that can be found in the LICENSE file.
-//
-
-library Prefix4NegativeTest.dart;
-
-import "package:expect/expect.dart";
-import "library10.dart";
-
-class Prefix4NegativeTest {
- static Test1() {
- // Library prefixes in the imported libraries should not be visible here.
- var result = 0;
- var obj = new lib11.Library11(1);
- result = obj.fld;
- Expect.equals(1, result);
- result += obj.func();
- Expect.equals(3, result);
- }
-}
-
-main() {
- Prefix4NegativeTest.Test1();
-}
diff --git a/tests/language_2/prefix5_negative_test.dart b/tests/language_2/prefix5_negative_test.dart
deleted file mode 100644
index 930a66b..0000000
--- a/tests/language_2/prefix5_negative_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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
-// BSD-style license that can be found in the LICENSE file.
-
-library Prefix5NegativeTest.dart;
-
-import "package:expect/expect.dart";
-import "library10.dart";
-
-class Prefix5NegativeTest {
- static Test1() {
- // Library prefixes in the imported libraries should not be visible here.
- var result = 0;
- result += lib11.Library11.static_func();
- Expect.equals(6, result);
- result += lib11.Library11.static_fld;
- Expect.equals(10, result);
- }
-}
-
-main() {
- Prefix5NegativeTest.Test1();
-}
diff --git a/tests/language_2/prefix6_negative_test.dart b/tests/language_2/prefix6_negative_test.dart
deleted file mode 100644
index d0ee640..0000000
--- a/tests/language_2/prefix6_negative_test.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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
-// BSD-style license that can be found in the LICENSE file.
-//
-
-library Prefix6NegativeTest.dart;
-
-import "library10.dart" as lib10;
-
-class Prefix6NegativeTest {
- static Test1() {
- // Variables in the local scope hide the library prefix.
- var lib10 = 0;
- var result = 0;
- result += lib10.Library10.static_func(); // This should fail.
- }
-}
-
-main() {
- Prefix6NegativeTest.Test1();
-}
diff --git a/tests/language_2/prefix8_negative_test.dart b/tests/language_2/prefix8_negative_test.dart
deleted file mode 100644
index 321bf91..0000000
--- a/tests/language_2/prefix8_negative_test.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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
-// BSD-style license that can be found in the LICENSE file.
-//
-
-import "package:expect/expect.dart";
-
-// Local variables can shadow class names and hence should result in an
-// error.
-
-class Test {
- Test.named(int this.fld);
- int fld;
-}
-
-main() {
- var Test;
- var i = new Test.named(10); // This should be an error.
- Expect.equals(10, i.fld);
-}
diff --git a/tests/language_2/prefix3_negative_test.dart b/tests/language_2/prefix_import_collision_test.dart
similarity index 90%
rename from tests/language_2/prefix3_negative_test.dart
rename to tests/language_2/prefix_import_collision_test.dart
index 2308f7c..5540dde 100644
--- a/tests/language_2/prefix3_negative_test.dart
+++ b/tests/language_2/prefix_import_collision_test.dart
@@ -1,17 +1,13 @@
// 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
// BSD-style license that can be found in the LICENSE file.
-//
// Using the same prefix name while importing two different libraries is
// not an error but both library1.dart and library2.dart define 'foo' which
// results in a duplicate definition error.
-
-library Prefix3NegativeTest.dart;
-
import "library1.dart" as lib2; // defines 'foo'.
import "library2.dart" as lib2; // also defines 'foo'.
main() {
- lib2.foo = 1;
+ lib2.foo = 1; //# 01: compile-time error
}
diff --git a/tests/language_2/prefix18_negative_test.dart b/tests/language_2/prefix_invalid_name_test.dart
similarity index 63%
rename from tests/language_2/prefix18_negative_test.dart
rename to tests/language_2/prefix_invalid_name_test.dart
index 0131538..6b10189 100644
--- a/tests/language_2/prefix18_negative_test.dart
+++ b/tests/language_2/prefix_invalid_name_test.dart
@@ -1,11 +1,10 @@
// 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
// BSD-style license that can be found in the LICENSE file.
-//
-// prefix must be a valid identifier
-library Prefix18NegativeTest.dart;
-import "library1.dart" as lib1.invalid;
+// Prefix must be a valid identifier.
+import "library1.dart"
+ as lib1.invalid //# 01: compile-time error
+ ;
-main() {
-}
+main() {}
diff --git a/tests/language_2/prefix_shadow_test.dart b/tests/language_2/prefix_shadow_test.dart
new file mode 100644
index 0000000..e385baf
--- /dev/null
+++ b/tests/language_2/prefix_shadow_test.dart
@@ -0,0 +1,33 @@
+// 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
+// BSD-style license that can be found in the LICENSE file.
+
+// Type parameters can shadow a library prefix.
+
+import "package:expect/expect.dart";
+import "library10.dart" as T;
+import "library10.dart" as lib10;
+
+class P<T> {
+ test() {
+ new T.Library10(10); //# 01: compile-time error
+ }
+}
+
+main() {
+ new P<int>().test();
+
+ {
+ // Variables in the local scope hide the library prefix.
+ var lib10 = 0; //# 02: compile-time error
+ var result = 0;
+ result = lib10.Library10.static_fld;
+ Expect.equals(4, result);
+ }
+
+ {
+ // Shadowing is not an error.
+ var lib10 = 1;
+ Expect.equals(2, lib10 + 1);
+ }
+}
diff --git a/tests/language_2/prefix_transitive_import_prefix_test.dart b/tests/language_2/prefix_transitive_import_prefix_test.dart
new file mode 100644
index 0000000..ec1767a
--- /dev/null
+++ b/tests/language_2/prefix_transitive_import_prefix_test.dart
@@ -0,0 +1,11 @@
+// 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
+// BSD-style license that can be found in the LICENSE file.
+import "library10.dart";
+
+main() {
+ // Library prefixes in the imported libraries should not be visible here.
+ new lib11.Library11(1); //# 01: compile-time error
+ lib11.Library11.static_func(); //# 02: compile-time error
+ lib11.Library11.static_fld; //# 03: compile-time error
+}
diff --git a/tests/language_2/prefix11_negative_test.dart b/tests/language_2/prefix_transitive_import_test.dart
similarity index 63%
rename from tests/language_2/prefix11_negative_test.dart
rename to tests/language_2/prefix_transitive_import_test.dart
index 40df3d1..d71654d 100644
--- a/tests/language_2/prefix11_negative_test.dart
+++ b/tests/language_2/prefix_transitive_import_test.dart
@@ -1,13 +1,15 @@
// 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
// BSD-style license that can be found in the LICENSE file.
-//
-// Symbols in libraries imported by the prefixed library should not be visible
-library Prefix11NegativeTest.dart;
+// Symbols in libraries imported by the prefixed library should not be visible.
import "library12.dart" as lib12;
main() {
- var obj = new lib12.Library11(1); // Error, method should not be visible
+ // Class should not be visible.
+ new lib12.Library11(1); //# 01: compile-time error
+
+ // Variable should not be visible.
+ lib12.top_level11; //# 02: compile-time error
}
diff --git a/tests/language_2/prefix13_negative_test.dart b/tests/language_2/prefix_unresolved_class_test.dart
similarity index 62%
rename from tests/language_2/prefix13_negative_test.dart
rename to tests/language_2/prefix_unresolved_class_test.dart
index 63b74b1..38f3914 100644
--- a/tests/language_2/prefix13_negative_test.dart
+++ b/tests/language_2/prefix_unresolved_class_test.dart
@@ -1,18 +1,19 @@
// 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
// BSD-style license that can be found in the LICENSE file.
-//
+
// Unresolved symbols should be reported as an error.
-
-library Prefix13NegativeTest.dart;
-
import "library12.dart" as lib12;
-class myClass extends lib12.Library13 {
- myClass(int this.fld) : super(0);
- int fld;
-}
+class Subclass
+ extends lib12.Library13 //# 01: compile-time error
+{}
+
+class Implementer
+ implements lib12.Library13 //# 02: compile-time error
+{}
main() {
- new myClass(1);
+ new Subclass();
+ new Implementer();
}
diff --git a/tests/language_2/prefix7_negative_test.dart b/tests/language_2/prefix_variable_collision_test.dart
similarity index 86%
rename from tests/language_2/prefix7_negative_test.dart
rename to tests/language_2/prefix_variable_collision_test.dart
index 21e313d..9333fd0 100644
--- a/tests/language_2/prefix7_negative_test.dart
+++ b/tests/language_2/prefix_variable_collision_test.dart
@@ -1,14 +1,9 @@
// 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
// BSD-style license that can be found in the LICENSE file.
-//
-
-library Prefix7NegativeTest.dart;
-
import "library10.dart" as lib10;
// Top level variables cannot shadow library prefixes, they should collide.
-
-var lib10;
+var lib10; //# 01: compile-time error
main() {}
diff --git a/tests/language_2/variable_shadow_class_test.dart b/tests/language_2/variable_shadow_class_test.dart
new file mode 100644
index 0000000..628819b
--- /dev/null
+++ b/tests/language_2/variable_shadow_class_test.dart
@@ -0,0 +1,26 @@
+// 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
+// BSD-style license that can be found in the LICENSE file.
+import "package:expect/expect.dart";
+
+// Local variables can shadow class names.
+
+class Test {
+ final int field;
+ Test.named(this.field);
+}
+
+main() {
+ {
+ var Test; //# 01: compile-time error
+ // Now this refers to the variable.
+ var i = new Test.named(10);
+ Expect.equals(10, i.field);
+ }
+
+ {
+ // Shadowing is allowed.
+ var Test = 1;
+ Expect.equals(2, Test + 1);
+ }
+}
diff --git a/tools/VERSION b/tools/VERSION
index 9095694..0e39300 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 52
+PRERELEASE 53
PRERELEASE_PATCH 0
diff --git a/tools/gardening/bin/results_list.dart b/tools/gardening/bin/results_list.dart
index ea19914..2e9322c 100644
--- a/tools/gardening/bin/results_list.dart
+++ b/tools/gardening/bin/results_list.dart
@@ -59,7 +59,6 @@
argResults["enable-asserts"],
argResults["hot-reload"],
argResults["hot-reload-rollback"],
- argResults["no-preview-dart-2"],
argResults["preview-dart-2"],
argResults.rest);
}
diff --git a/tools/gardening/lib/src/results/configuration_environment.dart b/tools/gardening/lib/src/results/configuration_environment.dart
index 2e27e60..667a772 100644
--- a/tools/gardening/lib/src/results/configuration_environment.dart
+++ b/tools/gardening/lib/src/results/configuration_environment.dart
@@ -46,7 +46,6 @@
}),
"minified": new _Variable.bool((c) => c.minified),
"mode": new _Variable((c) => c.mode, Mode.names),
- "no_preview_dart_2": new _Variable.bool((c) => c.noPreviewDart2),
"preview_dart_2": new _Variable.bool((c) => c.previewDart2),
"runtime": new _Variable(_runtimeName, Runtime.names),
"spec_parser": new _Variable.bool((c) => c.compiler == Compiler.specParser),
diff --git a/tools/gardening/lib/src/results/result_json_models.dart b/tools/gardening/lib/src/results/result_json_models.dart
index 020859d..9f96d48 100644
--- a/tools/gardening/lib/src/results/result_json_models.dart
+++ b/tools/gardening/lib/src/results/result_json_models.dart
@@ -28,7 +28,6 @@
final bool enableAsserts;
final bool hotReload;
final bool hotReloadRollback;
- final bool noPreviewDart2;
final bool previewDart2;
final List<String> selectors;
@@ -54,7 +53,6 @@
this.enableAsserts,
this.hotReload,
this.hotReloadRollback,
- this.noPreviewDart2,
this.previewDart2,
this.selectors);
@@ -81,7 +79,6 @@
json["enable_asserts"] ?? false,
json["hot_reload"] ?? false,
json["hot_reload_rollback"] ?? false,
- json["no_preview_dart_2"] ?? false,
json["preview_dart_2"] ?? false,
json["selectors"] ?? []);
}
@@ -110,7 +107,6 @@
_boolToArg("enable-asserts", enableAsserts),
_boolToArg("hot-reload", hotReload),
_boolToArg("hot-reload-rollback", hotReloadRollback),
- _boolToArg("no-preview-dart-2", noPreviewDart2),
_boolToArg("preview-dart-2", previewDart2)
].where((x) => x != null).toList();
if (includeSelectors && selectors != null && selectors.length > 0) {
@@ -123,7 +119,7 @@
return "$mode;$arch;$compiler;$runtime;$checked;$strong;$hostChecked;"
"$minified;$csp;$fasta;$system;$vmOptions;$useSdk;$builderTag;$fastStartup;"
"$dart2JsWithKernel;$dart2JsOldFrontend;$enableAsserts;$hotReload;"
- "$hotReloadRollback;$noPreviewDart2;$previewDart2;$selectors";
+ "$hotReloadRollback;$previewDart2;$selectors";
}
String _stringToArg(String name, String value) {
diff --git a/tools/sdks/README b/tools/sdks/README
index 9bfd810..44c00f2 100644
--- a/tools/sdks/README
+++ b/tools/sdks/README
@@ -14,9 +14,6 @@
using the 32-bit ia32 build as the default on windows, and the 64-bit x64
build as the default on linux and macos.
-To upload new versions of these tar files, use the "upload_to_google_storage"
-tool in depot_tools, and download the new stable SDKs from the dartlang.org
-web page. The arm executables must be copied from the machines that
-build them, and stripped. Because these SDKs are used for the presubmit
-dartfmt check on changed files, they may need to be updated often when
-dartfmt is changing rapidly.
+To upload new versions of these tar files, run "./update.sh" in this directory.
+Because these SDKs are used for the presubmit dartfmt check on changed files,
+they may need to be updated often when dartfmt is changing rapidly.
diff --git a/tools/sdks/linux/dart-sdk.tar.gz.sha1 b/tools/sdks/linux/dart-sdk.tar.gz.sha1
index 69598a2..d3e10bd 100644
--- a/tools/sdks/linux/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/linux/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-7e1de2bcab2ea482aa9b4d955cab201913878c78
+bcfe42edaebd8c1a13a78590aab6235769160858
\ No newline at end of file
diff --git a/tools/sdks/mac/dart-sdk.tar.gz.sha1 b/tools/sdks/mac/dart-sdk.tar.gz.sha1
index 60dba1a..a34fc3f 100644
--- a/tools/sdks/mac/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/mac/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-2329404025ecfec4b51319427100e55bc14fd96f
\ No newline at end of file
+f1c33b5acdf0a3a4bd7838f98d71cf6199d38aa1
\ No newline at end of file
diff --git a/tools/sdks/update.sh b/tools/sdks/update.sh
new file mode 100755
index 0000000..95a5ebc
--- /dev/null
+++ b/tools/sdks/update.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+# Updates the checked in SDKs
+set -e
+set -x
+
+if [ -z "$1" ]; then
+ echo "Usage: update.sh version"
+ exit 1
+fi
+
+channel="stable"
+case "$1" in
+*-dev.*) channel="dev";;
+esac
+
+tmpdir=$(mktemp -d)
+cleanup() {
+ rm -rf "$tmpdir"
+}
+trap cleanup EXIT HUP INT QUIT TERM PIPE
+pushd "$tmpdir"
+
+gsutil cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-linux-x64-release.zip" .
+gsutil cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-linux-arm-release.zip" .
+gsutil cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-linux-arm64-release.zip" .
+gsutil cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-macos-x64-release.zip" .
+gsutil cp "gs://dart-archive/channels/$channel/release/$1/sdk/dartsdk-windows-ia32-release.zip" .
+
+unzip -q dartsdk-linux-arm-release.zip dart-sdk/bin/dart
+mv dart-sdk/bin/dart dart-sdk/bin/dart-arm
+unzip -q dartsdk-linux-arm64-release.zip dart-sdk/bin/dart
+mv dart-sdk/bin/dart dart-sdk/bin/dart-arm64
+unzip -q dartsdk-linux-x64-release.zip
+tar -czf dart-sdk.tar.gz dart-sdk
+upload_to_google_storage.py -b dart-dependencies dart-sdk.tar.gz
+mv dart-sdk.tar.gz.sha1 dart-sdk.tar.gz.sha1-linux
+rm -rf dart-sdk
+
+unzip -q dartsdk-macos-x64-release.zip
+tar -czf dart-sdk.tar.gz dart-sdk
+upload_to_google_storage.py -b dart-dependencies dart-sdk.tar.gz
+mv dart-sdk.tar.gz.sha1 dart-sdk.tar.gz.sha1-mac
+rm -rf dart-sdk
+
+unzip -q dartsdk-windows-ia32-release.zip
+tar -czf dart-sdk.tar.gz dart-sdk
+upload_to_google_storage.py -b dart-dependencies dart-sdk.tar.gz
+mv dart-sdk.tar.gz.sha1 dart-sdk.tar.gz.sha1-win
+rm -rf dart-sdk
+
+popd
+
+mv $tmpdir/dart-sdk.tar.gz.sha1-linux linux/dart-sdk.tar.gz.sha1
+mv $tmpdir/dart-sdk.tar.gz.sha1-mac mac/dart-sdk.tar.gz.sha1
+mv $tmpdir/dart-sdk.tar.gz.sha1-win win/dart-sdk.tar.gz.sha1
diff --git a/tools/sdks/win/dart-sdk.tar.gz.sha1 b/tools/sdks/win/dart-sdk.tar.gz.sha1
index 952fc08..cc0bdcf 100644
--- a/tools/sdks/win/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/win/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-552657620bcb08d2c45b32af33c2b3d988494b4b
\ No newline at end of file
+0a1a4fbd27281366e873ab5135260583286a2190
\ No newline at end of file
diff --git a/utils/dartanalyzer/BUILD.gn b/utils/dartanalyzer/BUILD.gn
index 9619512..3a9f0ee 100644
--- a/utils/dartanalyzer/BUILD.gn
+++ b/utils/dartanalyzer/BUILD.gn
@@ -29,20 +29,22 @@
name = "dartanalyzer"
}
-aot_assembly("dartanalyzer_aot_assembly") {
- main_dart = "../../pkg/analyzer_cli/bin/analyzer.dart"
- name = "dartanalyzer"
-}
+if (current_os == "linux") {
+ aot_assembly("dartanalyzer_aot_assembly") {
+ main_dart = "../../pkg/analyzer_cli/bin/analyzer.dart"
+ name = "dartanalyzer"
+ }
-# This target is for Goma. It should not be used in the SDK.
-executable("dartanalyzer_aot") {
- deps = [
- "../../runtime/bin:dart_precompiled_runtime_for_linking",
- ":dartanalyzer_aot_assembly",
- ]
- sources = [
- "$root_gen_dir/dartanalyzer.dart.S"
- ]
+ # This target is for Goma. It should not be used in the SDK.
+ executable("dartanalyzer_aot") {
+ deps = [
+ "../../runtime/bin:dart_precompiled_runtime_for_linking",
+ ":dartanalyzer_aot_assembly",
+ ]
+ sources = [
+ "$root_gen_dir/dartanalyzer.dart.S"
+ ]
+ }
}
sdk_lib_files = exec_script("../../tools/list_dart_files.py",